Re: [PATCH 1/5] extcon: gpio-usb: Introduce gpio usb extcon driver

2015-01-22 Thread Roger Quadros
Hi Chanwoo,

On 21/01/15 07:28, Chanwoo Choi wrote:
 Hi Roger,
 
 On 01/20/2015 02:52 AM, Roger Quadros wrote:
 This driver observes the USB ID pin connected over a GPIO and
 updates the USB cable extcon states accordingly.

 The existing GPIO extcon driver is not suitable for this purpose
 as it needs to be taught to understand USB cable states and it
 can't handle more than one cable per instance.

 For the USB case we need to handle 2 cable states.
 1) USB (attach/detach)
 2) USB-Host (attach/detach)

 This driver can be easily updated in the future to handle VBUS
 events in case it happens to be available on GPIO for any platform.

 Signed-off-by: Roger Quadros rog...@ti.com
 ---
  .../devicetree/bindings/extcon/extcon-usb.txt  |  20 ++
  drivers/extcon/Kconfig |   7 +
  drivers/extcon/Makefile|   1 +
  drivers/extcon/extcon-gpio-usb.c   | 225 
 +
  4 files changed, 253 insertions(+)
  create mode 100644 Documentation/devicetree/bindings/extcon/extcon-usb.txt
  create mode 100644 drivers/extcon/extcon-gpio-usb.c

 diff --git a/Documentation/devicetree/bindings/extcon/extcon-usb.txt 
 b/Documentation/devicetree/bindings/extcon/extcon-usb.txt
 new file mode 100644
 index 000..171c5a4
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/extcon/extcon-usb.txt
 
 Need to rename from extcon-usb.txt to extcon-gpio-usb.txt.
 
 @@ -0,0 +1,20 @@
 +USB Extcon device
 +
 +This is a virtual device used to generate USB cable states from the USB ID 
 pin
 +connected to a GPIO pin.
 +
 +Required properties:
 +- compatible: Should be linux,extcon-usb
 
 I think you better use linux,extcon-gpio-usb
 because the point of this driver use the gpio for usb cable.

I will change all instances of extcon-usb to extcon-usb-gpio.

 
 +- id-gpio: gpio for USB ID pin. See gpio binding.
 +
 +Example:
 +extcon_usb1 {
 +compatible = linux,extcon-usb;
 
 ditto.
 
 +id-gpio = gpio6 1 GPIO_ACTIVE_HIGH;
 +}
 +
 +usb@1 {
 +...
 +extcon = extcon_usb1;
 +...
 +};
 diff --git a/drivers/extcon/Kconfig b/drivers/extcon/Kconfig
 index 6a1f7de..8106a83 100644
 --- a/drivers/extcon/Kconfig
 +++ b/drivers/extcon/Kconfig
 @@ -35,6 +35,13 @@ config EXTCON_GPIO
Say Y here to enable GPIO based extcon support. Note that GPIO
extcon supports single state per extcon instance.
  
 +config EXTCON_GPIO_USB
 +tristate USB GPIO extcon support
 +depends on GPIOLIB
 +help
 +  Say Y here to enable GPIO based USB cable detection extcon support.
 +  Used typically if GPIO is used for USB ID pin detection.
 +
  config EXTCON_MAX14577
  tristate MAX14577/77836 EXTCON Support
  depends on MFD_MAX14577
 diff --git a/drivers/extcon/Makefile b/drivers/extcon/Makefile
 index 0370b42..bae594b 100644
 --- a/drivers/extcon/Makefile
 +++ b/drivers/extcon/Makefile
 @@ -12,3 +12,4 @@ obj-$(CONFIG_EXTCON_MAX8997)   += extcon-max8997.o
  obj-$(CONFIG_EXTCON_PALMAS) += extcon-palmas.o
  obj-$(CONFIG_EXTCON_RT8973A)+= extcon-rt8973a.o
  obj-$(CONFIG_EXTCON_SM5502) += extcon-sm5502.o
 +obj-$(CONFIG_EXTCON_GPIO_USB)   += extcon-gpio-usb.o
 
 Need to re-order it alphabetically.

OK. I will change this to extcon-usb-gpio so it will remain last.
 
 diff --git a/drivers/extcon/extcon-gpio-usb.c 
 b/drivers/extcon/extcon-gpio-usb.c
 new file mode 100644
 index 000..aeb2298
 --- /dev/null
 +++ b/drivers/extcon/extcon-gpio-usb.c
 @@ -0,0 +1,225 @@
 +/**
 + * drivers/extcon/extcon_gpio_usb.c - USB GPIO extcon driver
 + *
 + * Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com
 + *
 
 Remove un-necessary blank line.

OK.
 
 + * Author: Roger Quadros rog...@ti.com
 + *
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License version 2 as
 + * published by the Free Software Foundation.
 + *
 + * This program is distributed in the hope that it will be useful,
 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 + * GNU General Public License for more details.
 + */
 +
 +#include linux/extcon.h
 +#include linux/extcon/extcon-gpio.h
 
 Is it necessary? I think it is your mistake?

right. my bad.
 
 +#include linux/gpio.h
 
 Don't need it because 'of_gpio.h' includes already 'gpio.h'.

agreed.

 
 +#include linux/init.h
 +#include linux/interrupt.h
 +#include linux/irq.h
 +#include linux/kernel.h
 +#include linux/module.h
 +#include linux/of_gpio.h
 +#include linux/platform_device.h
 +#include linux/slab.h
 +#include linux/workqueue.h
 +
 +#define USB_GPIO_DEBOUNCE_MS20  /* ms */
 +
 +struct usb_extcon_info {
 +struct device *dev;
 +struct extcon_dev *edev;
 +
 +struct gpio_desc *id_gpiod;
 +int id_irq;
 +
 +unsigned long debounce_jiffies;
 +struct 

Re: [PATCH v11 2/4] clk: Make clk API return per-user struct clk instances

2015-01-22 Thread Tomeu Vizoso
On 01/22/2015 02:01 AM, Stephen Boyd wrote:
 On 01/21, Tomeu Vizoso wrote:
 @@ -2075,10 +2210,12 @@ struct clk *clk_register(struct device *dev, struct 
 clk_hw *hw)
  }
  }
  
 -ret = __clk_init(dev, clk);
 +hw-clk = __clk_create_clk(hw, NULL, NULL);
 +ret = __clk_init(dev, hw-clk);
  if (!ret)
 -return clk;
 +return hw-clk;
  
 +kfree(hw-clk);
  fail_parent_names_copy:
  while (--i = 0)
  kfree(clk-parent_names[i]);
 
 Sigh, this patch is so huge I keep finding more things. Sorry. It
 looks like __clk_create_clk() can return an error pointer, which
 we then send directly to __clk_init. First off, we shouldn't
 kfree() that pointer if it's an error pointer. Second, we
 shouldn't crash in __clk_init() in such a situation so there
 needs to be some sort of check somewhere.

Oops, done. I have reused the fail_parent_names_copy label as the
less-bad possibility. Probably the error labels should be named after
the target code and not after what the source code does, as per the
latest CodingStyle additions.

 BTW, please try and fixup checkpatch warnings.

What were you thinking of specifically? I'm running it with
--max-line-length=106 and the other warnings are in clk-test.c that I
still have to polish when I get some time.

 diff --git a/drivers/clk/clkdev.c b/drivers/clk/clkdev.c
 index da4bda8..fac3244 100644
 --- a/drivers/clk/clkdev.c
 +++ b/drivers/clk/clkdev.c
 @@ -69,20 +70,22 @@ struct clk *of_clk_get(struct device_node *np, int index)
 [...]
 -struct clk *of_clk_get_by_name(struct device_node *np, const char *name)
 +static struct clk *__of_clk_get_by_name(struct device_node *np, const char 
 *name)
 
 It would be nice if this returned an already __clk_create_clk()ed
 pointer.
 
  {
  struct clk *clk = ERR_PTR(-ENOENT);
  
 @@ -119,7 +122,33 @@ struct clk *of_clk_get_by_name(struct device_node *np, 
 const char *name)
 [...]
 +struct clk *of_clk_get_by_name(struct device_node *np, const char *name)
 +{
 +struct clk *clk = __of_clk_get_by_name(np, name);
 +
 +if (!IS_ERR(clk))
 +clk = __clk_create_clk(__clk_get_hw(clk), np-full_name, name);
 
 Because we do it here where we know we're CONFIG_COMMON_CLK=y.
 
 +
 +return clk;
 +}
  EXPORT_SYMBOL(of_clk_get_by_name);
 +
 +#else /* defined(CONFIG_OF)  defined(CONFIG_COMMON_CLK) */
 +
 +static struct clk *__of_clk_get_by_name(struct device_node *np, const char 
 *name)
 +{
 +return ERR_PTR(-ENOENT);
 +}
  #endif
  
  /*
 @@ -185,9 +229,13 @@ struct clk *clk_get(struct device *dev, const char 
 *con_id)
  struct clk *clk;
  
  if (dev) {
 -clk = of_clk_get_by_name(dev-of_node, con_id);
 -if (!IS_ERR(clk))
 +clk = __of_clk_get_by_name(dev-of_node, con_id);
 +if (!IS_ERR(clk)) {
 +#if defined(CONFIG_COMMON_CLK)
 +clk = __clk_create_clk(__clk_get_hw(clk), dev_id, 
 con_id);
 +#endif
 
 And we do it here where we could remove the #ifdef.

Yeah, I tried to reduce the ifdefing back then and this is the simplest
I could come up with. The reason for clk_get() to call
__clk_create_clk() directly is that it has more relevant information
with which to tag the per-user clk.

of_clk_get_by_name() has the name of the node but not the dev_id, which
in my testing looked as much less useful when debugging who did what to
a clock.

Thanks,

Tomeu

  return clk;
 +}
  if (PTR_ERR(clk) == -EPROBE_DEFER)
  return clk;
  }
 

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/5] extcon: usb: Introduce USB GPIO extcon driver. Fix DRA7 USB.

2015-01-22 Thread Roger Quadros
Felipe,

On 20/01/15 21:02, Felipe Balbi wrote:
 On Mon, Jan 19, 2015 at 07:52:17PM +0200, Roger Quadros wrote:
 Hi,

 On DRA7 EVMs the USB ID pin is connected to a GPIO line. The USB drivers
 (dwc3 + dwc3-omap) depend on extcon framework to get the USB cable state
 (USB or USB-Host) to put the controller in the right mode.

 There were earlier attempts [1] to get this working by trying to patch up
 the existing GPIO extcon driver.

 This series attemts to take a different approach by introducing a new
 USB specific extcon driver to handle the USB ID GPIO pin and
 interpret a right USB cable state.

 The reasoning to introduce this new driver is:
 1) The existing GPIO extcon driver doesn't understand USB cable states
 and it can't handle more than one cable per instance.

 For the USB case we need to handle at least 2 cable states.
 a) USB (attach/detach)
 b) USB-Host (attach/detach)
 and could possible include more states like
 c) Fast-charger (attach/detach)
 d) Slow-charger (attach/detach)
 
 2) This USB specific driver can be easily updated in the future to
 handle VBUS events, or charger detect events, in case it happens
 to be available on GPIO for any platform.

 3) The DT implementation is very easy. You just need one extcon node per USB
 instead of one extcon node per cable state as in case of [1].

 4) The cable state string doesn't need to be encoded in the device tree
 as in case of [1].

 5) With only ID event available, you can simulate a USB-peripheral attach
 when USB-Host is detacted instead of hacking the USB driver to do the same.

 Tested on DRA7-evm and DRA72-evm.
 
 while at that, you might want to patch X15 too.
 
USB2 port is meant for peripheral use only. ID pin from USB port is not 
connected to GPIO.

cheers,
-roger
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] treewide: Convert clockevents_notify to use int cpu

2015-01-22 Thread Thomas Gleixner
On Wed, 10 Dec 2014, Joe Perches wrote:
 As far as I can tell, there's no value indirecting
 the cpu passed to this function via a void *.
 
 Update all the callers and called functions from within
 clockevents_notify.

Aside of that there is no value for this 'notification' function at
all. This should be seperate explicit calls. The notify function is a
leftover from the original implementation which used actual notifier
chains. I'll send out a cleanup series later today.

Thanks,

tglx


--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v11 3/4] clk: Add rate constraints to clocks

2015-01-22 Thread Tomeu Vizoso
On 01/22/2015 02:46 AM, Stephen Boyd wrote:
 On 01/21, Tomeu Vizoso wrote:
 Adds a way for clock consumers to set maximum and minimum rates. This
 can be used for thermal drivers to set minimum rates, or by misc.
 drivers to set maximum rates to assure a minimum performance level.

 Changes the signature of the determine_rate callback by adding the
 parameters min_rate and max_rate.

 Signed-off-by: Tomeu Vizoso tomeu.viz...@collabora.com

 ---
 v11: * Recalculate the rate before putting the reference to clk_core
  * Don't recalculate the rate when freeing the per-user clock
  in the initialization error paths
  * Move __clk_create_clk to be next to __clk_free_clk for more
  comfortable reading
 
 Can we do this in the previous patch where we introduce the
 function?

Ok.

 @@ -2143,9 +2314,16 @@ struct clk *__clk_register(struct device *dev, struct 
 clk_hw *hw)
  else
  clk-owner = NULL;
  
 +INIT_HLIST_HEAD(clk-clks);
 +
 +hw-clk = __clk_create_clk(hw, NULL, NULL);
 +
  ret = __clk_init(dev, hw-clk);
 -if (ret)
 +if (ret) {
 +__clk_free_clk(hw-clk);
 +hw-clk = NULL;
  return ERR_PTR(ret);
 +}
  
  return hw-clk;
  }
 @@ -2210,12 +2388,16 @@ struct clk *clk_register(struct device *dev, struct 
 clk_hw *hw)
  }
  }
  
 +INIT_HLIST_HEAD(clk-clks);
 +
  hw-clk = __clk_create_clk(hw, NULL, NULL);
  ret = __clk_init(dev, hw-clk);
  if (!ret)
  return hw-clk;
  
 -kfree(hw-clk);
 +__clk_free_clk(hw-clk);
 +hw-clk = NULL;
 
 Shouldn't we be assigning to NULL in the previous patch (same
 comment for __clk_register)?

Agreed, though I have gone ahead and removed __clk_register completely
because AFAICS it has never been used.

  fail_parent_names_copy:
  while (--i = 0)
  kfree(clk-parent_names[i]);
 @@ -2420,7 +2602,14 @@ void __clk_put(struct clk *clk)
  if (!clk || WARN_ON_ONCE(IS_ERR(clk)))
  return;
  
 +clk_prepare_lock();
 +hlist_del(clk-child_node);
 +clk_prepare_unlock();
 +
 +clk_core_set_rate(clk-core, clk-core-req_rate);
 +
  clk_core_put(clk-core);
 +
 
 Sad that we take the lock 3 times during __clk_put(). We should
 be able to do it only once if we have a lockless
 clk_core_set_rate() function and put the contents of
 clk_core_put() into this function. Actually we need to do that to
 be thread safe with clk-core-req_rate changing. We can call the
 same function in clk_set_rate_range() too so that we don't have
 to deal with recursive locking there.

Sweet, done.

  kfree(clk);
  }
  
 

Thanks,

Tomeu
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v7 1/4] Documentation: dt: add common bindings for hwspinlock

2015-01-22 Thread Mark Rutland
On Wed, Jan 21, 2015 at 05:56:37PM +, Suman Anna wrote:
 On 01/21/2015 06:41 AM, Ohad Ben-Cohen wrote:
  On Tue, Jan 20, 2015 at 8:05 PM, Tony Lindgren t...@atomide.com wrote:
  How about default to Linux id space and allow overriding that with
  a module param option if needed?
  
  I'm not sure I'm following.
  
  If the main point of contention is the base_id field, I'm also fine
  with removing it entirely, as I'm not aware of any actual user for it
  (Suman please confirm?).
 
 Yeah, well the current implementations that I am aware of only have a
 single bank, so all of them would be using a value of 0. I am yet to see
 a platform with multiple instances where the property really makes a
 difference. v7 has the property mandatory, so all the implementations
 would need to define this value even if it is 0.
 
 regards
 Suman
 
  
  Mark? Rob? Will you accept Suman's patches if the base_id field is removed?

My concern is that the mapping of hwspinlock IDs doesn't seem to be
explicit in the DT on a per-context basis, which is what I'd expect.

e.g.

lck: hwspinlock-device@f00 {
...
#hwlock-cells = 1;
};

some-other-os-interface {
...
hwlocks = lck 0, lck 1, lck 2, lck 3;
hwlock-names = glbl, pool0, pool1, pool2;
};

a-different-os-interface {
...
hwlocks = lck 18, lck 21, lck 4, lck 5;
hwlock-names = init, teardown, pool0, pool1;
};

That's the only way I would expect this to possibly remain a stable
over time, and it's the entire reason for #hwlock-cells, no?

How do you expect the other components sharing the hwspinlocks to be
described?

Thanks,
Mark.
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v11 2/4] clk: Make clk API return per-user struct clk instances

2015-01-22 Thread Stephen Boyd
On 01/22, Tomeu Vizoso wrote:
 On 01/22/2015 02:01 AM, Stephen Boyd wrote:
  BTW, please try and fixup checkpatch warnings.
 
 What were you thinking of specifically? I'm running it with
 --max-line-length=106 and the other warnings are in clk-test.c that I
 still have to polish when I get some time.

I can see that sometimes we exceed the 80 character limits that
are configured by default. We mostly stick to 80 in this file it
seems so I'm not sure why 106 is being used.

  
  And we do it here where we could remove the #ifdef.
 
 Yeah, I tried to reduce the ifdefing back then and this is the simplest
 I could come up with. The reason for clk_get() to call
 __clk_create_clk() directly is that it has more relevant information
 with which to tag the per-user clk.
 
 of_clk_get_by_name() has the name of the node but not the dev_id, which
 in my testing looked as much less useful when debugging who did what to
 a clock.
 

Agreed. But didn't we add __of_clk_get_by_name() so that we could
pass the dev_id and con_id to it? If we did that then all the
relevant information is there and we can call __clk_create_clk()
directly instead of relying on the caller to do it.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v12 3/6] clk: Make clk API return per-user struct clk instances

2015-01-22 Thread Tomeu Vizoso
Moves clock state to struct clk_core, but takes care to change as little API as
possible.

struct clk_hw still has a pointer to a struct clk, which is the
implementation's per-user clk instance, for backwards compatibility.

The struct clk that clk_get_parent() returns isn't owned by the caller, but by
the clock implementation, so the former shouldn't call clk_put() on it.

Because some boards in mach-omap2 still register clocks statically, their clock
registration had to be updated to take into account that the clock information
is stored in struct clk_core now.

Signed-off-by: Tomeu Vizoso tomeu.viz...@collabora.com

---
v12:* Move __clk_create_clk so it's later next to __clk_free_clk
* NULLify a just-free'd pointer
* Check the value returned by __clk_create_clk in clk_register

v11:* Allow for clk_set_parent to be called with a NULL parent

v10:* Add more missing NULL checks
* Remove __clk_reparent as it's now unused
* Remove clk_core_round_rate as it's now unused
* Call nolock variants from __clk_mux_determine_rate

v9: * Add missing NULL checks
* Remove __clk_prepare and __clk_unprepare as they are unused
  now

v7: * Add stub for __of_clk_get_by_name to fix builds without OF

v6: * Guard against NULL pointer

v4: * Remove unused function __clk_core_to_clk
* Use core more often as the name for struct clk_core* variables
* Make sure we don't lose information about the caller in of_clk_get_*

v3: * Rebase on top of linux-next 20141009

v2: * Remove exported functions that aren't really used outside clk.c
* Rename new internal functions to clk_core_ prefix
* Remove redundant checks for error pointers in *_get_parent
* Change __clk_create_clk to take a struct clk_hw instead
* Match the original error behavior in clk_get_sys
---
 arch/arm/mach-omap2/cclock3xxx_data.c   | 108 --
 arch/arm/mach-omap2/clock.h |  11 +-
 arch/arm/mach-omap2/clock_common_data.c |   5 +-
 drivers/clk/clk.c   | 616 
 drivers/clk/clk.h   |   5 +
 drivers/clk/clkdev.c|  80 -
 include/linux/clk-private.h |  35 +-
 include/linux/clk-provider.h|  12 +-
 8 files changed, 580 insertions(+), 292 deletions(-)

diff --git a/arch/arm/mach-omap2/cclock3xxx_data.c 
b/arch/arm/mach-omap2/cclock3xxx_data.c
index 644ff32..4305105 100644
--- a/arch/arm/mach-omap2/cclock3xxx_data.c
+++ b/arch/arm/mach-omap2/cclock3xxx_data.c
@@ -82,7 +82,7 @@ DEFINE_CLK_MUX(osc_sys_ck, osc_sys_ck_parent_names, NULL, 0x0,
   OMAP3430_PRM_CLKSEL, OMAP3430_SYS_CLKIN_SEL_SHIFT,
   OMAP3430_SYS_CLKIN_SEL_WIDTH, 0x0, NULL);
 
-DEFINE_CLK_DIVIDER(sys_ck, osc_sys_ck, osc_sys_ck, 0x0,
+DEFINE_CLK_DIVIDER(sys_ck, osc_sys_ck, osc_sys_ck_core, 0x0,
   OMAP3430_PRM_CLKSRC_CTRL, OMAP_SYSCLKDIV_SHIFT,
   OMAP_SYSCLKDIV_WIDTH, CLK_DIVIDER_ONE_BASED, NULL);
 
@@ -132,7 +132,7 @@ static struct clk_hw_omap dpll3_ck_hw = {
 
 DEFINE_STRUCT_CLK(dpll3_ck, dpll3_ck_parent_names, dpll3_ck_ops);
 
-DEFINE_CLK_DIVIDER(dpll3_m2_ck, dpll3_ck, dpll3_ck, 0x0,
+DEFINE_CLK_DIVIDER(dpll3_m2_ck, dpll3_ck, dpll3_ck_core, 0x0,
   OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
   OMAP3430_CORE_DPLL_CLKOUT_DIV_SHIFT,
   OMAP3430_CORE_DPLL_CLKOUT_DIV_WIDTH,
@@ -149,12 +149,12 @@ static const struct clk_ops core_ck_ops = {};
 DEFINE_STRUCT_CLK_HW_OMAP(core_ck, NULL);
 DEFINE_STRUCT_CLK(core_ck, core_ck_parent_names, core_ck_ops);
 
-DEFINE_CLK_DIVIDER(l3_ick, core_ck, core_ck, 0x0,
+DEFINE_CLK_DIVIDER(l3_ick, core_ck, core_ck_core, 0x0,
   OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
   OMAP3430_CLKSEL_L3_SHIFT, OMAP3430_CLKSEL_L3_WIDTH,
   CLK_DIVIDER_ONE_BASED, NULL);
 
-DEFINE_CLK_DIVIDER(l4_ick, l3_ick, l3_ick, 0x0,
+DEFINE_CLK_DIVIDER(l4_ick, l3_ick, l3_ick_core, 0x0,
   OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
   OMAP3430_CLKSEL_L4_SHIFT, OMAP3430_CLKSEL_L4_WIDTH,
   CLK_DIVIDER_ONE_BASED, NULL);
@@ -275,9 +275,9 @@ static struct clk_hw_omap dpll1_ck_hw = {
 
 DEFINE_STRUCT_CLK(dpll1_ck, dpll3_ck_parent_names, dpll1_ck_ops);
 
-DEFINE_CLK_FIXED_FACTOR(dpll1_x2_ck, dpll1_ck, dpll1_ck, 0x0, 2, 1);
+DEFINE_CLK_FIXED_FACTOR(dpll1_x2_ck, dpll1_ck, dpll1_ck_core, 0x0, 2, 1);
 
-DEFINE_CLK_DIVIDER(dpll1_x2m2_ck, dpll1_x2_ck, dpll1_x2_ck, 0x0,
+DEFINE_CLK_DIVIDER(dpll1_x2m2_ck, dpll1_x2_ck, dpll1_x2_ck_core, 0x0,
   OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_CLKSEL2_PLL),
   OMAP3430_MPU_DPLL_CLKOUT_DIV_SHIFT,
   OMAP3430_MPU_DPLL_CLKOUT_DIV_WIDTH,
@@ -292,7 +292,7 @@ static const char *mpu_ck_parent_names[] = {
 DEFINE_STRUCT_CLK_HW_OMAP(mpu_ck, mpu_clkdm);
 DEFINE_STRUCT_CLK(mpu_ck, mpu_ck_parent_names, 

Re: [PATCH 0/5] extcon: usb: Introduce USB GPIO extcon driver. Fix DRA7 USB.

2015-01-22 Thread Roger Quadros

On 22/01/15 15:32, Roger Quadros wrote:
 Felipe,
 
 On 20/01/15 21:02, Felipe Balbi wrote:
 On Mon, Jan 19, 2015 at 07:52:17PM +0200, Roger Quadros wrote:
 Hi,

 On DRA7 EVMs the USB ID pin is connected to a GPIO line. The USB drivers
 (dwc3 + dwc3-omap) depend on extcon framework to get the USB cable state
 (USB or USB-Host) to put the controller in the right mode.

 There were earlier attempts [1] to get this working by trying to patch up
 the existing GPIO extcon driver.

 This series attemts to take a different approach by introducing a new
 USB specific extcon driver to handle the USB ID GPIO pin and
 interpret a right USB cable state.

 The reasoning to introduce this new driver is:
 1) The existing GPIO extcon driver doesn't understand USB cable states
 and it can't handle more than one cable per instance.

 For the USB case we need to handle at least 2 cable states.
 a) USB (attach/detach)
 b) USB-Host (attach/detach)
 and could possible include more states like
 c) Fast-charger (attach/detach)
 d) Slow-charger (attach/detach)
 
 2) This USB specific driver can be easily updated in the future to
 handle VBUS events, or charger detect events, in case it happens
 to be available on GPIO for any platform.

 3) The DT implementation is very easy. You just need one extcon node per USB
 instead of one extcon node per cable state as in case of [1].

 4) The cable state string doesn't need to be encoded in the device tree
 as in case of [1].

 5) With only ID event available, you can simulate a USB-peripheral attach
 when USB-Host is detacted instead of hacking the USB driver to do the same.

 Tested on DRA7-evm and DRA72-evm.

 while at that, you might want to patch X15 too.

 USB2 port is meant for peripheral use only. ID pin from USB port is not 
 connected to GPIO.
 

OK answering myself here :).
Peripheral mode doesn't work on x15-bb as the USB driver (dwc3-omap)
doesn't set the mailbox correctly even when dwc3 node is set as otg = 
peripheral.

Looks like we need to implement usb-gpio-extcon for x15 even though ID is hard 
coded.

cheers,
-roger
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v12 4/6] clk: Add rate constraints to clocks

2015-01-22 Thread Tomeu Vizoso
Adds a way for clock consumers to set maximum and minimum rates. This
can be used for thermal drivers to set minimum rates, or by misc.
drivers to set maximum rates to assure a minimum performance level.

Changes the signature of the determine_rate callback by adding the
parameters min_rate and max_rate.

Signed-off-by: Tomeu Vizoso tomeu.viz...@collabora.com

---
v12:* Refactor locking so that __clk_put takes the lock only once

v11:* Recalculate the rate before putting the reference to clk_core
* Don't recalculate the rate when freeing the per-user clock
in the initialization error paths
* Move __clk_create_clk to be next to __clk_free_clk for more
comfortable reading

v10:* Refactor __clk_determine_rate to share code with
clk_round_rate.
* Remove clk_core_round_rate_nolock as it's unused now

v9: * s/floor/min and s/ceiling/max
* Add a bunch of NULL checks
* Propagate our rate range when querying our parent for the rate
* Take constraints into account in clk_round_rate
* Add __clk_determine_rate() for clk providers to ask their
parents for a rate within their range
* Make sure that what ops-round_rate returns when changing
rates is within the range

v7: * Update a few more instances in new code

v6: * Take the prepare lock before removing a per-user clk
* Init per-user clks list before adding the first clk
* Pass the constraints to determine_rate and let clk
  implementations deal with constraints
* Add clk_set_rate_range

v5: * Initialize clk.ceiling_constraint to ULONG_MAX
* Warn about inconsistent constraints

v4: * Copy function docs from header
* Move WARN out of critical section
* Refresh rate after removing a per-user clk
* Rename clk_core.per_user_clks to clk_core.clks
* Store requested rate and re-apply it when constraints are updated
---
 Documentation/clk.txt   |   2 +
 arch/arm/mach-omap2/dpll3xxx.c  |   2 +
 arch/arm/mach-omap2/dpll44xx.c  |   2 +
 arch/mips/alchemy/common/clock.c|   8 ++
 drivers/clk/at91/clk-programmable.c |   2 +
 drivers/clk/bcm/clk-kona.c  |   2 +
 drivers/clk/clk-composite.c |   9 +-
 drivers/clk/clk.c   | 248 +---
 drivers/clk/hisilicon/clk-hi3620.c  |   2 +
 drivers/clk/mmp/clk-mix.c   |   2 +
 drivers/clk/qcom/clk-pll.c  |   1 +
 drivers/clk/qcom/clk-rcg.c  |  10 +-
 drivers/clk/qcom/clk-rcg2.c |   6 +
 drivers/clk/sunxi/clk-factors.c |   2 +
 drivers/clk/sunxi/clk-sun6i-ar100.c |   2 +
 include/linux/clk-private.h |   6 +
 include/linux/clk-provider.h|  15 ++-
 include/linux/clk.h |  28 
 include/linux/clk/ti.h  |   4 +
 19 files changed, 297 insertions(+), 56 deletions(-)

diff --git a/Documentation/clk.txt b/Documentation/clk.txt
index 4ff8462..0e4f90a 100644
--- a/Documentation/clk.txt
+++ b/Documentation/clk.txt
@@ -73,6 +73,8 @@ the operations defined in clk.h:
unsigned long *parent_rate);
long(*determine_rate)(struct clk_hw *hw,
unsigned long rate,
+   unsigned long min_rate,
+   unsigned long max_rate,
unsigned long *best_parent_rate,
struct clk_hw 
**best_parent_clk);
int (*set_parent)(struct clk_hw *hw, u8 index);
diff --git a/arch/arm/mach-omap2/dpll3xxx.c b/arch/arm/mach-omap2/dpll3xxx.c
index c2da2a0..ac3fb11 100644
--- a/arch/arm/mach-omap2/dpll3xxx.c
+++ b/arch/arm/mach-omap2/dpll3xxx.c
@@ -473,6 +473,8 @@ void omap3_noncore_dpll_disable(struct clk_hw *hw)
  * in failure.
  */
 long omap3_noncore_dpll_determine_rate(struct clk_hw *hw, unsigned long rate,
+  unsigned long min_rate,
+  unsigned long max_rate,
   unsigned long *best_parent_rate,
   struct clk_hw **best_parent_clk)
 {
diff --git a/arch/arm/mach-omap2/dpll44xx.c b/arch/arm/mach-omap2/dpll44xx.c
index 0e58e5a..acacb90 100644
--- a/arch/arm/mach-omap2/dpll44xx.c
+++ b/arch/arm/mach-omap2/dpll44xx.c
@@ -222,6 +222,8 @@ out:
  * in failure.
  */
 long omap4_dpll_regm4xen_determine_rate(struct clk_hw *hw, unsigned long rate,
+   unsigned long min_rate,
+   unsigned long max_rate,
unsigned long *best_parent_rate,
struct clk_hw **best_parent_clk)
 {
diff --git a/arch/mips/alchemy/common/clock.c 

Re: [RFC PATCH 1/3] of/device: manage resources similar to platform_device_add

2015-01-22 Thread Suman Anna
Hi Grant,

On 01/13/2015 05:04 PM, Suman Anna wrote:
 On 01/13/2015 04:00 PM, Rob Herring wrote:
 On Tue, Jan 13, 2015 at 3:25 PM, Suman Anna s-a...@ti.com wrote:
 Hi Rob,

 On 01/13/2015 02:38 PM, Rob Herring wrote:
 On Wed, Jan 7, 2015 at 11:30 AM, Suman Anna s-a...@ti.com wrote:
 Drivers can use of_platform_populate() to create platform devices
 for children of the device main node, and a complementary API
 of_platform_depopulate() is provided to delete these child platform
 devices. The of_platform_depopulate() leverages the platform API
 for performing the cleanup of these devices.

 The platform device resources are managed differently between
 of_device_add and platform_device_add, and this asymmetry causes
 a kernel oops in platform_device_del during removal of the resources.
 Manage the platform device resources similar to platform_device_add
 to fix this kernel oops.

 This is a known issue and has been attempted to be fixed before (I
 believe there is a revert in mainline). The problem is there are known
 devicetrees which have overlapping resources and they will break with
 your change.

 Are you referring to 02bbde7849e6 (Revert of: use
 platform_device_add)?

 I believe that's the one.

 That one seems to be in registration path, and
 this crash is in the unregistration path. If so, to fix the crash,
 should we be skipping the release_resource() for now in
 platform_device_del for DT nodes, or replace platform_device_unregister
 with of_device_unregister in of_platform_device_destroy()?

 IIRC, the problem is inserting a resource twice on add from 2
 different nodes, not the removal path. Perhaps we could make a
 collision non-fatal for in the DT case.
 
 We may be talking two different things here, I understand that this
 patch would create an issue with inserting a resource twice in the
 devicetrees with overlapping resources (just like the commit that was
 reverted above), but the crash is on devices with resources whose
 parent, child, sibling pointers have never been initialized (the
 of_device_add path does not touch these at all), and get dereferenced in
 platform_device_del()-release_resource(). See the following that has a
 better explanation [1].
 
 regards
 Suman
 
 [1]
 http://lists.infradead.org/pipermail/linux-arm-kernel/2014-July/274412.html
 
 
 Grant may have some ideas on
 what's needed here.

Ping, any suggestions here? Do we ought to replace
platform_device_unregister() with of_device_unregister() similar to the
approach taken in 02bbde7849e6 (Revert of: use platform_device_add)?

regards
Suman


 This is a common crash and we cannot use of_platform_depopulate() today
 in drivers to complement of_platform_populate().

 Yes, I know.

 Also, the platform_data crash is independent of this, I could reproduce
 that one even with using of_device_unregister in a loop in driver remove.

 Missed this one. I'll reply to that patch.

 Rob


 regards
 Suman


 Rob


 Signed-off-by: Suman Anna s-a...@ti.com
 ---
  drivers/of/device.c | 38 +-
  1 file changed, 37 insertions(+), 1 deletion(-)

 diff --git a/drivers/of/device.c b/drivers/of/device.c
 index 46d6c75c1404..fa27c1c71f29 100644
 --- a/drivers/of/device.c
 +++ b/drivers/of/device.c
 @@ -50,6 +50,8 @@ EXPORT_SYMBOL(of_dev_put);

  int of_device_add(struct platform_device *ofdev)
  {
 +   int i, ret;
 +
 BUG_ON(ofdev-dev.of_node == NULL);

 /* name and id have to be set so that the platform bus doesn't get
 @@ -63,7 +65,41 @@ int of_device_add(struct platform_device *ofdev)
 if (!ofdev-dev.parent)
 set_dev_node(ofdev-dev, 
 of_node_to_nid(ofdev-dev.of_node));

 -   return device_add(ofdev-dev);
 +   for (i = 0; i  ofdev-num_resources; i++) {
 +   struct resource *p, *r = ofdev-resource[i];
 +
 +   if (!r-name)
 +   r-name = dev_name(ofdev-dev);
 +
 +   p = r-parent;
 +   if (!p) {
 +   if (resource_type(r) == IORESOURCE_MEM)
 +   p = iomem_resource;
 +   else if (resource_type(r) == IORESOURCE_IO)
 +   p = ioport_resource;
 +   }
 +
 +   if (p  insert_resource(p, r)) {
 +   dev_err(ofdev-dev, failed to claim resource 
 %d\n,
 +   i);
 +   ret = -EBUSY;
 +   goto failed;
 +   }
 +   }
 +
 +   ret = device_add(ofdev-dev);
 +   if (ret == 0)
 +   return ret;
 +
 +failed:
 +   while (--i = 0) {
 +   struct resource *r = ofdev-resource[i];
 +   unsigned long type = resource_type(r);
 +
 +   if (type == IORESOURCE_MEM || type == IORESOURCE_IO)
 +   release_resource(r);
 +   }
 +   return ret;
  }

  int of_device_register(struct platform_device *pdev)
 --
 2.2.1


 

--
To 

Re: [PATCH 12/13] ARM: dts: omap3-gta04: uart4 is not connected, so mark it disabled

2015-01-22 Thread Tony Lindgren
* Marek Belisko ma...@goldelico.com [150122 12:42]:
 From: NeilBrown n...@brown.name
 
 Signed-off-by: NeilBrown n...@brown.name
 ---
  arch/arm/boot/dts/omap3-gta04.dtsi | 4 
  1 file changed, 4 insertions(+)
 
 diff --git a/arch/arm/boot/dts/omap3-gta04.dtsi 
 b/arch/arm/boot/dts/omap3-gta04.dtsi
 index 228e79b..8d2b0a1 100644
 --- a/arch/arm/boot/dts/omap3-gta04.dtsi
 +++ b/arch/arm/boot/dts/omap3-gta04.dtsi
 @@ -357,6 +357,10 @@
   pinctrl-0 = uart3_pins;
  };
  
 +uart4 {
 + status = disabled;
 +};
 +

This you probably want to avoid from PM point of view. Depending on
bootloader state of uart4, Linux may or may not be able to hit any
deeper power states.

Marking something with status = disabled in dts causes the device
entry not even to be created. That means hwmod won't be able to reset
and idle this device during boot.

The uart4 device is there for sure even if not muxed and in incomplete
state. You may want to also check other places where you're using
status = disabled for the same reasons.

Regards,

Tony
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 06/13] ARM: dts: omap3-gta04: Enable power-off using twl4030

2015-01-22 Thread Tony Lindgren
* Marek Belisko ma...@goldelico.com [150122 12:42]:
 From: H. Nikolaus Schaller h...@goldelico.com
 
 Enabled poweroff through PMIC on GTA04.
 
 Signed-off-by: H. Nikolaus Schaller h...@goldelico.com
 ---
  arch/arm/boot/dts/omap3-gta04.dtsi | 5 +
  1 file changed, 5 insertions(+)
 
 diff --git a/arch/arm/boot/dts/omap3-gta04.dtsi 
 b/arch/arm/boot/dts/omap3-gta04.dtsi
 index 0265474..b56c85b 100644
 --- a/arch/arm/boot/dts/omap3-gta04.dtsi
 +++ b/arch/arm/boot/dts/omap3-gta04.dtsi
 @@ -209,6 +209,11 @@
   codec {
   };
   };
 +
 + twl_power: power {
 + compatible = ti,twl4030-power;
 + ti,use_poweroff;
 + };
   };
  };
  

No need to change this patch, but you may want to get things working
with ti,twl4030-power-idle-osc-off for PM if you're running it on
batteries :)

Regards,

Tony
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3 0/2] couple of generic remoteproc enhancements

2015-01-22 Thread Suman Anna
Hi Ohad,

On 01/09/2015 03:21 PM, Suman Anna wrote:
 Hi Ohad,
 
 The following is an updated patchset addressing the previous pending comments
 from v1  v2, and are rebased onto the latest 3.19-rc3 (are rc independent
 actually). 
 
 The patches are mainly developed to support the WkupM3 remote processor driver
 on TI AM335x/AM437x SoCs, and I have verified the loading using the latest
 version of Dave's WkupM3 remoteproc work [1]
 
 The only change in v3 is on the second patch, it mainly leverages the
 memcpy_toio and memset_io functions for copying/loading code into the
 internal memory sections. An additional argument has to be added to the
 rproc_da_to_va function to make this distinction.

Any comments on this series, or can I assume that this will make it to
v3.20?

regards
Suman

 
 [1] http://marc.info/?l=linux-omapm=142022842323885w=2
 
 v2:
 http://marc.info/?l=linux-omapm=141089879412807w=2
 - Add explicit setting of the .has_iommu field in each of the existing
   remoteproc platform drivers
 - Update patch description to add the usecase details for the change
   summary
 - Fixed a minor checkpatch warning.
 
 v1:
 http://marc.info/?l=linux-omapm=140483657604924w=2
 
 Suman Anna (2):
   remoteproc: use a flag to detect the presence of IOMMU
   remoteproc: add support to handle internal memories
 
  drivers/remoteproc/da8xx_remoteproc.c  |   1 +
  drivers/remoteproc/omap_remoteproc.c   |   5 ++
  drivers/remoteproc/remoteproc_core.c   | 104 
 -
  drivers/remoteproc/remoteproc_elf_loader.c |  23 +--
  drivers/remoteproc/remoteproc_internal.h   |   6 +-
  drivers/remoteproc/ste_modem_rproc.c   |   1 +
  include/linux/remoteproc.h |  45 -
  7 files changed, 161 insertions(+), 24 deletions(-)
 

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v12 4/6] clk: Add rate constraints to clocks

2015-01-22 Thread Stephen Boyd
On 01/22, Tomeu Vizoso wrote:
 Adds a way for clock consumers to set maximum and minimum rates. This
 can be used for thermal drivers to set minimum rates, or by misc.
 drivers to set maximum rates to assure a minimum performance level.
 
 Changes the signature of the determine_rate callback by adding the
 parameters min_rate and max_rate.
 
 Signed-off-by: Tomeu Vizoso tomeu.viz...@collabora.com
 

Reviewed-by: Stephen Boyd sb...@codeaurora.org

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v12 3/6] clk: Make clk API return per-user struct clk instances

2015-01-22 Thread Stephen Boyd
On 01/22, Tomeu Vizoso wrote:
 Moves clock state to struct clk_core, but takes care to change as little API 
 as
 possible.
 
 struct clk_hw still has a pointer to a struct clk, which is the
 implementation's per-user clk instance, for backwards compatibility.
 
 The struct clk that clk_get_parent() returns isn't owned by the caller, but by
 the clock implementation, so the former shouldn't call clk_put() on it.
 
 Because some boards in mach-omap2 still register clocks statically, their 
 clock
 registration had to be updated to take into account that the clock information
 is stored in struct clk_core now.
 
 Signed-off-by: Tomeu Vizoso tomeu.viz...@collabora.com
 
 ---

My comment on v11 still stands about __clk_create_clk() in
clkdev.c, but otherwise I don't see problems. You can have my
reviewed-by anyway.

Reviewed-by: Stephen Boyd sb...@codeaurora.org

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/5] extcon: usb: Introduce USB GPIO extcon driver. Fix DRA7 USB.

2015-01-22 Thread Felipe Balbi
On Thu, Jan 22, 2015 at 04:57:56PM +0200, Roger Quadros wrote:
 
 On 22/01/15 15:32, Roger Quadros wrote:
  Felipe,
  
  On 20/01/15 21:02, Felipe Balbi wrote:
  On Mon, Jan 19, 2015 at 07:52:17PM +0200, Roger Quadros wrote:
  Hi,
 
  On DRA7 EVMs the USB ID pin is connected to a GPIO line. The USB drivers
  (dwc3 + dwc3-omap) depend on extcon framework to get the USB cable state
  (USB or USB-Host) to put the controller in the right mode.
 
  There were earlier attempts [1] to get this working by trying to patch up
  the existing GPIO extcon driver.
 
  This series attemts to take a different approach by introducing a new
  USB specific extcon driver to handle the USB ID GPIO pin and
  interpret a right USB cable state.
 
  The reasoning to introduce this new driver is:
  1) The existing GPIO extcon driver doesn't understand USB cable states
  and it can't handle more than one cable per instance.
 
  For the USB case we need to handle at least 2 cable states.
  a) USB (attach/detach)
  b) USB-Host (attach/detach)
  and could possible include more states like
  c) Fast-charger (attach/detach)
  d) Slow-charger (attach/detach)
  
  2) This USB specific driver can be easily updated in the future to
  handle VBUS events, or charger detect events, in case it happens
  to be available on GPIO for any platform.
 
  3) The DT implementation is very easy. You just need one extcon node per 
  USB
  instead of one extcon node per cable state as in case of [1].
 
  4) The cable state string doesn't need to be encoded in the device tree
  as in case of [1].
 
  5) With only ID event available, you can simulate a USB-peripheral attach
  when USB-Host is detacted instead of hacking the USB driver to do the 
  same.
 
  Tested on DRA7-evm and DRA72-evm.
 
  while at that, you might want to patch X15 too.
 
  USB2 port is meant for peripheral use only. ID pin from USB port is not 
  connected to GPIO.
  
 
 OK answering myself here :).
 Peripheral mode doesn't work on x15-bb as the USB driver (dwc3-omap)
 doesn't set the mailbox correctly even when dwc3 node is set as otg = 
 peripheral.
 
 Looks like we need to implement usb-gpio-extcon for x15 even though ID is 
 hard coded.

right, another option is to have dwc3-omap read the child's DTS to check
dr_mode and hardcode things based on that.

-- 
balbi


signature.asc
Description: Digital signature


[PATCH 00/13] ARM: dts: omap3-gta04: Various DT fixes

2015-01-22 Thread Marek Belisko
This series contains fixes for gta04 devicetree. I collected patches
from H. Nikolaus Schaller + NeilBrown and myself. Patches contains mostly fixes
+ adding new nodes and comments. All changes tested on gta04a4 board.

H. Nikolaus Schaller (5):
  ARM: dts: omap3-gta04: Fix backup-battery charging in devicetree file.
  ARM: dts: omap3-gta04: Fix audio node malformatting
  ARM: dts: omap3-gta04: Enable mcbps2 necessary for audio
  ARM: dts: omap3-gta04: Enable twl audio vibra support
  ARM: dts: omap3-gta04: Enable power-off using twl4030

Marek Belisko (2):
  ARM: dts: omap3-gta04: Fix a GPIO line for bma180 node
  ARM: dts: omap3-gta04: Add ramp value for twl4030 audio

NeilBrown (6):
  ARM: dts: omap3-gta04: add comments about gpios
  ARM: dts: omap3-gta04: enable power-off for wifi card.
  ARM: dts: omap3-gta04: add gyroscope
  ARM: dts: omap3-gta04: only power DSS when necessary.
  ARM: dts: omap3-gta04: uart4 is not connected, so mark it disabled
  ARM: dts: omap3-gta04: Disable keypad

 arch/arm/boot/dts/omap3-gta04.dtsi | 54 +++---
 1 file changed, 39 insertions(+), 15 deletions(-)

-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 06/13] ARM: dts: omap3-gta04: Enable power-off using twl4030

2015-01-22 Thread Marek Belisko
From: H. Nikolaus Schaller h...@goldelico.com

Enabled poweroff through PMIC on GTA04.

Signed-off-by: H. Nikolaus Schaller h...@goldelico.com
---
 arch/arm/boot/dts/omap3-gta04.dtsi | 5 +
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/boot/dts/omap3-gta04.dtsi 
b/arch/arm/boot/dts/omap3-gta04.dtsi
index 0265474..b56c85b 100644
--- a/arch/arm/boot/dts/omap3-gta04.dtsi
+++ b/arch/arm/boot/dts/omap3-gta04.dtsi
@@ -209,6 +209,11 @@
codec {
};
};
+
+   twl_power: power {
+   compatible = ti,twl4030-power;
+   ti,use_poweroff;
+   };
};
 };
 
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 11/13] ARM: dts: omap3-gta04: only power DSS when necessary.

2015-01-22 Thread Marek Belisko
From: NeilBrown n...@brown.name

i.e. configure vpll2 as a supply for the dss rather
than being always-on.

Signed-off-by: NeilBrown n...@brown.name
---
 arch/arm/boot/dts/omap3-gta04.dtsi | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/arch/arm/boot/dts/omap3-gta04.dtsi 
b/arch/arm/boot/dts/omap3-gta04.dtsi
index 08f0b25..228e79b 100644
--- a/arch/arm/boot/dts/omap3-gta04.dtsi
+++ b/arch/arm/boot/dts/omap3-gta04.dtsi
@@ -393,16 +393,12 @@
regulator-max-microvolt = 315;
 };
 
-/* Needed to power the DPI pins */
-vpll2 {
-   regulator-always-on;
-};
-
 dss {
pinctrl-names = default;
pinctrl-0 =  dss_dpi_pins ;
 
status = okay;
+   vdds_dsi-supply = vpll2;
 
port {
dpi_out: endpoint {
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 10/13] ARM: dts: omap3-gta04: add gyroscope

2015-01-22 Thread Marek Belisko
From: NeilBrown n...@brown.name

Signed-off-by: NeilBrown n...@brown.name
---
 arch/arm/boot/dts/omap3-gta04.dtsi | 8 
 1 file changed, 8 insertions(+)

diff --git a/arch/arm/boot/dts/omap3-gta04.dtsi 
b/arch/arm/boot/dts/omap3-gta04.dtsi
index ab5dd98..08f0b25 100644
--- a/arch/arm/boot/dts/omap3-gta04.dtsi
+++ b/arch/arm/boot/dts/omap3-gta04.dtsi
@@ -240,6 +240,14 @@
interrupts = 19 IRQ_TYPE_LEVEL_HIGH; /* GPIO_115 */
};
 
+   /* gyroscope */
+   itg3200@68 {
+   compatible = invensense,itg3200;
+   reg = 0x68;
+   interrupt-parent = gpio2;
+   interrupts = 24 0; /* GPIO_56 */
+   };
+
/* leds */
tca6507@45 {
compatible = ti,tca6507;
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 13/13] ARM: dts: omap3-gta04: Disable keypad

2015-01-22 Thread Marek Belisko
From: NeilBrown n...@brown.name

The twl4030 keypad is not wired up in the gta04, so mark it disabled
to avoid pointless initialization.

Signed-off-by: NeilBrown n...@brown.name
---
 arch/arm/boot/dts/omap3-gta04.dtsi | 4 
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/boot/dts/omap3-gta04.dtsi 
b/arch/arm/boot/dts/omap3-gta04.dtsi
index 8d2b0a1..b3ecf1f 100644
--- a/arch/arm/boot/dts/omap3-gta04.dtsi
+++ b/arch/arm/boot/dts/omap3-gta04.dtsi
@@ -342,6 +342,10 @@
status = disabled;
 };
 
+twl_keypad {
+   status = disabled;
+};
+
 uart1 {
pinctrl-names = default;
pinctrl-0 = uart1_pins;
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 04/13] ARM: dts: omap3-gta04: Enable twl audio vibra support

2015-01-22 Thread Marek Belisko
From: H. Nikolaus Schaller h...@goldelico.com

Signed-off-by: H. Nikolaus Schaller h...@goldelico.com
---
 arch/arm/boot/dts/omap3-gta04.dtsi | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/boot/dts/omap3-gta04.dtsi 
b/arch/arm/boot/dts/omap3-gta04.dtsi
index 7272591..fd6ac80 100644
--- a/arch/arm/boot/dts/omap3-gta04.dtsi
+++ b/arch/arm/boot/dts/omap3-gta04.dtsi
@@ -205,6 +205,7 @@
 
twl_audio: audio {
compatible = ti,twl4030-audio;
+   ti,enable-vibra = 1;
codec {
};
};
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 08/13] ARM: dts: omap3-gta04: add comments about gpios

2015-01-22 Thread Marek Belisko
From: NeilBrown n...@brown.name

Add comments to state which GPIO is used for some interrupts.

Signed-off-by: NeilBrown n...@brown.name
---
 arch/arm/boot/dts/omap3-gta04.dtsi | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/omap3-gta04.dtsi 
b/arch/arm/boot/dts/omap3-gta04.dtsi
index 6f5fcbb..b65b5ed 100644
--- a/arch/arm/boot/dts/omap3-gta04.dtsi
+++ b/arch/arm/boot/dts/omap3-gta04.dtsi
@@ -229,7 +229,7 @@
compatible = bosch,bmp085;
reg = 0x77;
interrupt-parent = gpio4;
-   interrupts = 17 IRQ_TYPE_EDGE_RISING;
+   interrupts = 17 IRQ_TYPE_EDGE_RISING; /* GPIO_113 */
};
 
/* accelerometer */
@@ -237,7 +237,7 @@
compatible = bosch,bma180;
reg = 0x41;
interrupt-parent = gpio4;
-   interrupts = 19 IRQ_TYPE_LEVEL_HIGH;
+   interrupts = 19 IRQ_TYPE_LEVEL_HIGH; /* GPIO_115 */
};
 
/* leds */
@@ -288,7 +288,7 @@
compatible = ti,tsc2007;
reg = 0x48;
interrupt-parent = gpio6;
-   interrupts = 0 IRQ_TYPE_EDGE_FALLING;
+   interrupts = 0 IRQ_TYPE_EDGE_FALLING; /* GPIO_160 */
gpios = gpio6 0 GPIO_ACTIVE_LOW;
ti,x-plate-ohms = 600;
};
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 02/13] ARM: dts: omap3-gta04: Fix audio node malformatting

2015-01-22 Thread Marek Belisko
From: H. Nikolaus Schaller h...@goldelico.com

Audio should be child of twl node.

Signed-off-by: H. Nikolaus Schaller h...@goldelico.com
---
 arch/arm/boot/dts/omap3-gta04.dtsi | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/arm/boot/dts/omap3-gta04.dtsi 
b/arch/arm/boot/dts/omap3-gta04.dtsi
index fa39232..c78380e 100644
--- a/arch/arm/boot/dts/omap3-gta04.dtsi
+++ b/arch/arm/boot/dts/omap3-gta04.dtsi
@@ -202,11 +202,11 @@
reg = 0x48;
interrupts = 7; /* SYS_NIRQ cascaded to intc */
interrupt-parent = intc;
-   };
 
-   twl_audio: audio {
-   compatible = ti,twl4030-audio;
-   codec {
+   twl_audio: audio {
+   compatible = ti,twl4030-audio;
+   codec {
+   };
};
};
 };
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 09/13] ARM: dts: omap3-gta04: enable power-off for wifi card.

2015-01-22 Thread Marek Belisko
From: NeilBrown n...@brown.name

Signed-off-by: NeilBrown n...@brown.name
---
 arch/arm/boot/dts/omap3-gta04.dtsi | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/boot/dts/omap3-gta04.dtsi 
b/arch/arm/boot/dts/omap3-gta04.dtsi
index b65b5ed..ab5dd98 100644
--- a/arch/arm/boot/dts/omap3-gta04.dtsi
+++ b/arch/arm/boot/dts/omap3-gta04.dtsi
@@ -327,6 +327,7 @@
vmmc-supply = vaux4;
bus-width = 4;
ti,non-removable;
+   cap-power-off-card;
 };
 
 mmc3 {
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 01/13] ARM: dts: omap3-gta04: Fix backup-battery charging in devicetree file.

2015-01-22 Thread Marek Belisko
From: H. Nikolaus Schaller h...@goldelico.com

Fix attribute names.

Signed-off-by: H. Nikolaus Schaller h...@goldelico.com
---
 arch/arm/boot/dts/omap3-gta04.dtsi | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/omap3-gta04.dtsi 
b/arch/arm/boot/dts/omap3-gta04.dtsi
index 655d6e9..fa39232 100644
--- a/arch/arm/boot/dts/omap3-gta04.dtsi
+++ b/arch/arm/boot/dts/omap3-gta04.dtsi
@@ -342,8 +342,8 @@
 };
 
 charger {
-   bb_uvolt = 320;
-   bb_uamp = 150;
+   ti,bb-uvolt = 320;
+   ti,bb-uamp = 150;
 };
 
 /* spare */
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 05/13] ARM: dts: omap3-gta04: Fix a GPIO line for bma180 node

2015-01-22 Thread Marek Belisko
GPIO_115 used as irq is in gpio4, not gpio3.

Signed-off-by: Marek Belisko ma...@goldelico.com
---
 arch/arm/boot/dts/omap3-gta04.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/omap3-gta04.dtsi 
b/arch/arm/boot/dts/omap3-gta04.dtsi
index fd6ac80..0265474 100644
--- a/arch/arm/boot/dts/omap3-gta04.dtsi
+++ b/arch/arm/boot/dts/omap3-gta04.dtsi
@@ -230,7 +230,7 @@
bma180@41 {
compatible = bosch,bma180;
reg = 0x41;
-   interrupt-parent = gpio3;
+   interrupt-parent = gpio4;
interrupts = 19 IRQ_TYPE_LEVEL_HIGH;
};
 
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 12/13] ARM: dts: omap3-gta04: uart4 is not connected, so mark it disabled

2015-01-22 Thread Marek Belisko
From: NeilBrown n...@brown.name

Signed-off-by: NeilBrown n...@brown.name
---
 arch/arm/boot/dts/omap3-gta04.dtsi | 4 
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/boot/dts/omap3-gta04.dtsi 
b/arch/arm/boot/dts/omap3-gta04.dtsi
index 228e79b..8d2b0a1 100644
--- a/arch/arm/boot/dts/omap3-gta04.dtsi
+++ b/arch/arm/boot/dts/omap3-gta04.dtsi
@@ -357,6 +357,10 @@
pinctrl-0 = uart3_pins;
 };
 
+uart4 {
+   status = disabled;
+};
+
 charger {
ti,bb-uvolt = 320;
ti,bb-uamp = 150;
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 07/13] ARM: dts: omap3-gta04: Add ramp value for twl4030 audio

2015-01-22 Thread Marek Belisko
Signed-off-by: Marek Belisko ma...@goldelico.com
---
 arch/arm/boot/dts/omap3-gta04.dtsi | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/boot/dts/omap3-gta04.dtsi 
b/arch/arm/boot/dts/omap3-gta04.dtsi
index b56c85b..6f5fcbb 100644
--- a/arch/arm/boot/dts/omap3-gta04.dtsi
+++ b/arch/arm/boot/dts/omap3-gta04.dtsi
@@ -207,6 +207,7 @@
compatible = ti,twl4030-audio;
ti,enable-vibra = 1;
codec {
+   ti,ramp_delay_value = 3;
};
};
 
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 03/13] ARM: dts: omap3-gta04: Enable mcbps2 necessary for audio

2015-01-22 Thread Marek Belisko
From: H. Nikolaus Schaller h...@goldelico.com

mcbsp2 is used in gta04 soundcard config and by default
is disabled so enable it for gta04.

Signed-off-by: H. Nikolaus Schaller h...@goldelico.com
---
 arch/arm/boot/dts/omap3-gta04.dtsi | 4 
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/boot/dts/omap3-gta04.dtsi 
b/arch/arm/boot/dts/omap3-gta04.dtsi
index c78380e..7272591 100644
--- a/arch/arm/boot/dts/omap3-gta04.dtsi
+++ b/arch/arm/boot/dts/omap3-gta04.dtsi
@@ -449,3 +449,7 @@
};
};
 };
+
+mcbsp2 {
+   status = okay;
+};
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/5] extcon: usb: Introduce USB GPIO extcon driver. Fix DRA7 USB.

2015-01-22 Thread Roger Quadros
Felipe,

On 22/01/15 22:29, Felipe Balbi wrote:
 On Thu, Jan 22, 2015 at 04:57:56PM +0200, Roger Quadros wrote:

 On 22/01/15 15:32, Roger Quadros wrote:
 Felipe,

 On 20/01/15 21:02, Felipe Balbi wrote:
 On Mon, Jan 19, 2015 at 07:52:17PM +0200, Roger Quadros wrote:
 Hi,

 On DRA7 EVMs the USB ID pin is connected to a GPIO line. The USB drivers
 (dwc3 + dwc3-omap) depend on extcon framework to get the USB cable state
 (USB or USB-Host) to put the controller in the right mode.

 There were earlier attempts [1] to get this working by trying to patch up
 the existing GPIO extcon driver.

 This series attemts to take a different approach by introducing a new
 USB specific extcon driver to handle the USB ID GPIO pin and
 interpret a right USB cable state.

 The reasoning to introduce this new driver is:
 1) The existing GPIO extcon driver doesn't understand USB cable states
 and it can't handle more than one cable per instance.

 For the USB case we need to handle at least 2 cable states.
 a) USB (attach/detach)
 b) USB-Host (attach/detach)
 and could possible include more states like
 c) Fast-charger (attach/detach)
 d) Slow-charger (attach/detach)
 
 2) This USB specific driver can be easily updated in the future to
 handle VBUS events, or charger detect events, in case it happens
 to be available on GPIO for any platform.

 3) The DT implementation is very easy. You just need one extcon node per 
 USB
 instead of one extcon node per cable state as in case of [1].

 4) The cable state string doesn't need to be encoded in the device tree
 as in case of [1].

 5) With only ID event available, you can simulate a USB-peripheral attach
 when USB-Host is detacted instead of hacking the USB driver to do the 
 same.

 Tested on DRA7-evm and DRA72-evm.

 while at that, you might want to patch X15 too.

 USB2 port is meant for peripheral use only. ID pin from USB port is not 
 connected to GPIO.


 OK answering myself here :).
 Peripheral mode doesn't work on x15-bb as the USB driver (dwc3-omap)
 doesn't set the mailbox correctly even when dwc3 node is set as otg = 
 peripheral.

 Looks like we need to implement usb-gpio-extcon for x15 even though ID is 
 hard coded.
 
 right, another option is to have dwc3-omap read the child's DTS to check
 dr_mode and hardcode things based on that.
 
I think that option is better as it doesn't require a GPIO line to be reserved
for ID when USB is not meant for dual-role use.

cheers,
-roger
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html