[PATCH] MAINTAINERS: omap_hsmmc: remove myself from MAINTAINERS

2014-09-17 Thread Balaji T K
As I won't be able to maintain omap_hsmmc driver

Signed-off-by: Balaji T K balaji...@gmail.com
---
 MAINTAINERS | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 5e7866a..b296e43 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -6540,10 +6540,9 @@ S:   Maintained
 F: drivers/mmc/host/omap.c
 
 OMAP HS MMC SUPPORT
-M: Balaji T K balaj...@ti.com
 L: linux-...@vger.kernel.org
 L: linux-omap@vger.kernel.org
-S: Maintained
+S: Orphan
 F: drivers/mmc/host/omap_hsmmc.c
 
 OMAP RANDOM NUMBER GENERATOR SUPPORT
-- 
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 v14 2/6] mmc: omap_hsmmc: Extend debugfs by SDIO IRQ handling, runtime state

2014-05-29 Thread Balaji T K

On Thursday 29 May 2014 01:58 PM, Andreas Fenkart wrote:

Add SDIO IRQ entries to debugfs entry. Note that PSTATE shows current
state of data lines, incl. SDIO IRQ pending

Signed-off-by: Andreas Fenkart afenk...@gmail.com


Thanks Andreas for fixing compilation with !CONFIG_PM[_RUNTIME],

Acked-by: Balaji T K balaj...@ti.com



diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 129569d..332d3d2 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -56,6 +56,7 @@
  #define OMAP_HSMMC_RSP54  0x0118
  #define OMAP_HSMMC_RSP76  0x011C
  #define OMAP_HSMMC_DATA   0x0120
+#define OMAP_HSMMC_PSTATE  0x0124
  #define OMAP_HSMMC_HCTL   0x0128
  #define OMAP_HSMMC_SYSCTL 0x012C
  #define OMAP_HSMMC_STAT   0x0130
@@ -1815,13 +1816,23 @@ static int omap_hsmmc_regs_show(struct seq_file *s, 
void *data)
struct mmc_host *mmc = s-private;
struct omap_hsmmc_host *host = mmc_priv(mmc);

-   seq_printf(s, mmc%d:\n ctx_loss:\t%d\n\nregs:\n,
-   mmc-index, host-context_loss);
+   seq_printf(s, mmc%d:\n, mmc-index);
+   seq_printf(s, sdio irq mode\t%s\n,
+  (mmc-caps  MMC_CAP_SDIO_IRQ) ? interrupt : polling);

-   pm_runtime_get_sync(host-dev);
+   if (mmc-caps  MMC_CAP_SDIO_IRQ) {
+   seq_printf(s, sdio irq \t%s\n,
+  (host-flags  HSMMC_SDIO_IRQ_ENABLED) ?  enabled
+  : disabled);
+   }
+   seq_printf(s, ctx_loss:\t%d\n, host-context_loss);

+   pm_runtime_get_sync(host-dev);
+   seq_puts(s, \nregs:\n);
seq_printf(s, CON:\t\t0x%08x\n,
OMAP_HSMMC_READ(host-base, CON));
+   seq_printf(s, PSTATE:\t\t0x%08x\n,
+  OMAP_HSMMC_READ(host-base, PSTATE));
seq_printf(s, HCTL:\t\t0x%08x\n,
OMAP_HSMMC_READ(host-base, HCTL));
seq_printf(s, SYSCTL:\t\t0x%08x\n,



--
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 v14 6/6] mmc: omap_hsmmc: Pin remux workaround to support SDIO interrupt on AM335x

2014-05-29 Thread Balaji T K

On Thursday 29 May 2014 01:58 PM, Andreas Fenkart wrote:

The am335x can't detect pending cirq in PM runtime suspend.
This patch reconfigures dat1 as a GPIO before going to suspend.
SDIO interrupts are detected with the GPIO, the GPIO will only wake
the module from suspend, SDIO irq detection will still happen through the
IP block.

Idea of remuxing the pins by Tony Lindgren. Code contributions from
Tony Lindgren and Balaji T K balaj...@ti.com

Signed-off-by: Andreas Fenkart afenk...@gmail.com
Signed-off-by: Tony Lindgren t...@atomide.com


Acked-by: Balaji T K balaj...@ti.com

Hi Chris/Ulf,

Can you please queue this series for 3.16

Thanks and Regards,
Balaji T K



diff --git a/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt 
b/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt
index 0233ba7..76bf087 100644
--- a/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt
+++ b/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt
@@ -57,3 +57,56 @@ Examples:
edma 25;
dma-names = tx, rx;
};
+
+[workaround for missing swakeup on am33xx]
+
+This SOC is missing the swakeup line, it will not detect SDIO irq
+while in suspend.
+
+ --
+ | PRCM |
+  --
+   ^ |
+   swakeup | | fclk
+   | v
+   -----   -
+  | card | -- CIRQ --  | hsmmc | -- IRQ --  | CPU |
+   -----   -
+
+In suspend the fclk is off and the module is disfunctional. Even register reads
+will fail. A small logic in the host will request fclk restore, when an
+external event is detected. Once the clock is restored, the host detects the
+event normally. Since am33xx doesn't have this line it never wakes from
+suspend.
+
+The workaround is to reconfigure the dat1 line as a GPIO upon suspend. To make
+this work, we need to set the named pinctrl states default and idle.
+Prepare idle to remux dat1 as a gpio, and default to remux it back as sdio
+dat1. The MMC driver will then toggle between idle and default state during
+runtime.
+
+In summary:
+1. select matching 'compatible' section, see example below.
+2. specify pinctrl states default and idle, sleep is optional.
+3. specify the gpio irq used for detecting sdio irq in suspend
+
+If configuration is incomplete, a warning message is emitted falling back to
+polling. Also check the sdio irq mode in /sys/kernel/debug/mmc0/regs. Mind
+not every application needs SDIO irq, e.g. MMC cards.
+
+   mmc1: mmc@48060100 {
+   compatible = ti,am33xx-hsmmc;
+   ...
+   pinctrl-names = default, idle, sleep
+   pinctrl-0 = mmc1_pins;
+   pinctrl-1 = mmc1_idle;
+   pinctrl-2 = mmc1_sleep;
+   ...
+   interrupts-extended = intc 64 gpio2 28 0;
+   };
+
+   mmc1_idle : pinmux_cirq_pin {
+   pinctrl-single,pins = 
+   0x0f8 0x3f  /* GPIO2_28 */
+   ;
+   };
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 0febb17..35ac2e4 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1754,15 +1754,33 @@ static int omap_hsmmc_configure_wake_irq(struct 
omap_hsmmc_host *host)
 * and need to remux SDIO DAT1 to GPIO for wake-up from idle.
 */
if (host-pdata-controller_flags  OMAP_HSMMC_SWAKEUP_MISSING) {
-   ret = -ENODEV;
-   devm_free_irq(host-dev, host-wake_irq, host);
-   goto err;
+   struct pinctrl *p = devm_pinctrl_get(host-dev);
+   if (!p) {
+   ret = -ENODEV;
+   goto err_free_irq;
+   }
+   if (IS_ERR(pinctrl_lookup_state(p, PINCTRL_STATE_DEFAULT))) {
+   dev_info(host-dev, missing default pinctrl state\n);
+   devm_pinctrl_put(p);
+   ret = -EINVAL;
+   goto err_free_irq;
+   }
+
+   if (IS_ERR(pinctrl_lookup_state(p, PINCTRL_STATE_IDLE))) {
+   dev_info(host-dev, missing idle pinctrl state\n);
+   devm_pinctrl_put(p);
+   ret = -EINVAL;
+   goto err_free_irq;
+   }
+   devm_pinctrl_put(p);
}

OMAP_HSMMC_WRITE(host-base, HCTL,
 OMAP_HSMMC_READ(host-base, HCTL) | IWE);
return 0;

+err_free_irq:
+   devm_free_irq(host-dev, host-wake_irq, host);
  err:
dev_warn(host-dev, no SDIO IRQ support, falling back to polling\n);
host-wake_irq = 0;



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

Re: [PATCH v13 1/7] mmc: omap_hsmmc: install dummy pm runtime hooks if !CONFIG_PM_RUNTIME

2014-05-23 Thread Balaji T K

On Friday 23 May 2014 02:00 PM, Andreas Fenkart wrote:

Signed-off-by: Andreas Fenkart afenk...@gmail.com

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 272e0ee..c62d9dd 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -199,7 +199,9 @@ struct omap_hsmmc_host {
struct dma_chan *rx_chan;
int slot_id;
int response_busy;
+#ifdef CONFIG_PM
int context_loss;
+#endif
int protect_card;
int reqs_blocked;
int use_reg;
@@ -712,14 +714,8 @@ static void omap_hsmmc_context_save(struct omap_hsmmc_host 
*host)

  #else

-static int omap_hsmmc_context_restore(struct omap_hsmmc_host *host)
-{
-   return 0;
-}
-
-static void omap_hsmmc_context_save(struct omap_hsmmc_host *host)
-{
-}
+#define omap_hsmmc_context_restore(host)
+#define omap_hsmmc_context_save(host)

  #endif

@@ -1700,11 +1696,14 @@ static int omap_hsmmc_regs_show(struct seq_file *s, 
void *data)
struct mmc_host *mmc = s-private;
struct omap_hsmmc_host *host = mmc_priv(mmc);

-   seq_printf(s, mmc%d:\n ctx_loss:\t%d\n\nregs:\n,
-   mmc-index, host-context_loss);
+   seq_printf(s, mmc%d:\n, mmc-index);

-   pm_runtime_get_sync(host-dev);
+#ifdef CONFIG_PM
+   seq_printf(s, ctx_loss:\t%d\n, host-context_loss);
+#endif

+   pm_runtime_get_sync(host-dev);
+   seq_puts(s, \nregs:\n);
seq_printf(s, CON:\t\t0x%08x\n,
OMAP_HSMMC_READ(host-base, CON));
seq_printf(s, HCTL:\t\t0x%08x\n,
@@ -2243,6 +2242,7 @@ static int omap_hsmmc_resume(struct device *dev)
  #define omap_hsmmc_resume NULL
  #endif

+#ifdef CONFIG_PM_RUNTIME


AFAIK, omap_hsmmc can build without these changes,
So, I think this patch is not needed.

Let me I know If it is not the case.


  static int omap_hsmmc_runtime_suspend(struct device *dev)
  {
struct omap_hsmmc_host *host;
@@ -2264,6 +2264,10 @@ static int omap_hsmmc_runtime_resume(struct device *dev)

return 0;
  }
+#else
+#define omap_hsmmc_runtime_suspend NULL
+#define omap_hsmmc_runtime_resume  NULL
+#endif

  static struct dev_pm_ops omap_hsmmc_dev_pm_ops = {
.suspend= omap_hsmmc_suspend,



--
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 v13 3/7] mmc: omap_hsmmc: Extend debugfs by SDIO IRQ handling, runtime state

2014-05-23 Thread Balaji T K

On Friday 23 May 2014 02:00 PM, Andreas Fenkart wrote:

Add SDIO IRQ entries to debugfs entry. Note that PSTATE shows current
state of data lines, incl. SDIO IRQ pending

Acked-by: Balaji T K balaj...@ti.com
Signed-off-by: Andreas Fenkart afenk...@gmail.com

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 0125eea..cfd2bfb 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -56,6 +56,7 @@
  #define OMAP_HSMMC_RSP54  0x0118
  #define OMAP_HSMMC_RSP76  0x011C
  #define OMAP_HSMMC_DATA   0x0120
+#define OMAP_HSMMC_PSTATE  0x0124
  #define OMAP_HSMMC_HCTL   0x0128
  #define OMAP_HSMMC_SYSCTL 0x012C
  #define OMAP_HSMMC_STAT   0x0130
@@ -1816,10 +1817,23 @@ static int omap_hsmmc_regs_show(struct seq_file *s, 
void *data)
  {
struct mmc_host *mmc = s-private;
struct omap_hsmmc_host *host = mmc_priv(mmc);
+#ifdef CONFIG_PM
+   bool suspended;
+#endif

seq_printf(s, mmc%d:\n, mmc-index);
+   seq_printf(s, sdio irq mode\t%s\n,
+  (mmc-caps  MMC_CAP_SDIO_IRQ) ? interrupt : polling);
+
+   if (mmc-caps  MMC_CAP_SDIO_IRQ) {
+   seq_printf(s, sdio irq \t%s\n,
+  (host-flags  HSMMC_SDIO_IRQ_ENABLED) ?  enabled
+  : disabled);
+   }

  #ifdef CONFIG_PM


shouldn't this be CONFIG_PM_RUNTIME ?


+   suspended = host-dev-power.runtime_status != RPM_ACTIVE;
+   seq_printf(s, runtime state\t%s\n, (suspended ? idle : active));


The whole check for runtime status (and check for CONFIG_PM..) can be removed,
since runtime status is available via sysfs

cat /sys/class/mmc_host/mmcX/device/power/runtime_status


seq_printf(s, ctx_loss:\t%d\n, host-context_loss);
  #endif

@@ -1827,6 +1841,8 @@ static int omap_hsmmc_regs_show(struct seq_file *s, void 
*data)
seq_puts(s, \nregs:\n);
seq_printf(s, CON:\t\t0x%08x\n,
OMAP_HSMMC_READ(host-base, CON));
+   seq_printf(s, PSTATE:\t\t0x%08x\n,
+  OMAP_HSMMC_READ(host-base, PSTATE));
seq_printf(s, HCTL:\t\t0x%08x\n,
OMAP_HSMMC_READ(host-base, HCTL));
seq_printf(s, SYSCTL:\t\t0x%08x\n,



--
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 v13 7/7] mmc: omap_hsmmc: Pin remux workaround to support SDIO interrupt on AM335x

2014-05-23 Thread Balaji T K

On Friday 23 May 2014 02:00 PM, Andreas Fenkart wrote:

The am335x can't detect pending cirq in PM runtime suspend.
This patch reconfigures dat1 as a GPIO before going to suspend.
SDIO interrupts are detected with the GPIO, the GPIO will only wake
the module from suspend, SDIO irq detection will still happen through the
IP block.

Idea of remuxing the pins by Tony Lindgren. Code contributions from
Tony Lindgren and Balaji T K balaj...@ti.com

Acked-by: Balaji T K balaj...@ti.com
Signed-off-by: Andreas Fenkart afenk...@gmail.com
Signed-off-by: Tony Lindgren t...@atomide.com

diff --git a/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt 
b/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt
index 0233ba7..76bf087 100644
--- a/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt
+++ b/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt
@@ -57,3 +57,56 @@ Examples:
edma 25;
dma-names = tx, rx;
};
+
+[workaround for missing swakeup on am33xx]
+
+This SOC is missing the swakeup line, it will not detect SDIO irq
+while in suspend.
+
+ --
+ | PRCM |
+  --
+   ^ |
+   swakeup | | fclk
+   | v
+   -----   -
+  | card | -- CIRQ --  | hsmmc | -- IRQ --  | CPU |
+   -----   -
+
+In suspend the fclk is off and the module is disfunctional. Even register reads
+will fail. A small logic in the host will request fclk restore, when an
+external event is detected. Once the clock is restored, the host detects the
+event normally. Since am33xx doesn't have this line it never wakes from
+suspend.
+
+The workaround is to reconfigure the dat1 line as a GPIO upon suspend. To make
+this work, we need to set the named pinctrl states default and idle.
+Prepare idle to remux dat1 as a gpio, and default to remux it back as sdio
+dat1. The MMC driver will then toggle between idle and default state during
+runtime.
+
+In summary:
+1. select matching 'compatible' section, see example below.
+2. specify pinctrl states default and idle, sleep is optional.
+3. specify the gpio irq used for detecting sdio irq in suspend
+
+If configuration is incomplete, a warning message is emitted falling back to
+polling. Also check the sdio irq mode in /sys/kernel/debug/mmc0/regs. Mind
+not every application needs SDIO irq, e.g. MMC cards.
+
+   mmc1: mmc@48060100 {
+   compatible = ti,am33xx-hsmmc;
+   ...
+   pinctrl-names = default, idle, sleep
+   pinctrl-0 = mmc1_pins;
+   pinctrl-1 = mmc1_idle;
+   pinctrl-2 = mmc1_sleep;
+   ...
+   interrupts-extended = intc 64 gpio2 28 0;
+   };
+
+   mmc1_idle : pinmux_cirq_pin {
+   pinctrl-single,pins = 
+   0x0f8 0x3f  /* GPIO2_28 */
+   ;
+   };
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 760b0ac..1238506 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1752,15 +1752,25 @@ static int omap_hsmmc_configure_wake_irq(struct 
omap_hsmmc_host *host)
 * and need to remux SDIO DAT1 to GPIO for wake-up from idle.
 */
if (host-pdata-controller_flags  OMAP_HSMMC_SWAKEUP_MISSING) {
-   ret = -ENODEV;
-   devm_free_irq(host-dev, host-wake_irq, host);
-   goto err;
+   if (IS_ERR(host-dev-pins-default_state)) {


Rater than introducing #ifdef CONFIG_PM on multiple places,
I think things will simple, if pinctrl_lookup_state is used here
to avoid build error on !CONFIG_PM




+   dev_info(host-dev, missing default pinctrl state\n);
+   ret = -EINVAL;
+   goto err_free_irq;
+   }
+
+   if (IS_ERR(host-dev-pins-idle_state)) {


same here.


+   dev_info(host-dev, missing idle pinctrl state\n);
+   ret = -EINVAL;
+   goto err_free_irq;
+   }
}

OMAP_HSMMC_WRITE(host-base, HCTL,
 OMAP_HSMMC_READ(host-base, HCTL) | IWE);
return 0;

+err_free_irq:
+   devm_free_irq(host-dev, host-wake_irq, host);
  err:
dev_warn(host-dev, no SDIO IRQ support, falling back to polling\n);
host-wake_irq = 0;


--
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 v2 6/6] mmc: omap_hsmmc: split omap-dma header file

2014-05-20 Thread Balaji T K

On Monday 19 May 2014 10:24 PM, Tony Lindgren wrote:

* Balaji T K balaj...@ti.com [140519 04:54]:

On Saturday 17 May 2014 03:11 AM, Tony Lindgren wrote:

-
-#if defined(CONFIG_DMA_OMAP) || defined(CONFIG_DMA_OMAP_MODULE)
-bool omap_dma_filter_fn(struct dma_chan *, void *);
-#else
-static inline bool omap_dma_filter_fn(struct dma_chan *c, void *d)
-{
-   return false;
-}
-#endif
+#include linux/omap-dmaengine.h


Can't the drivers needing this include it directly?



Yes, I have converted omap_hsmmc as part of this patch.
Due to lack of bandwidth, I haven't touched upon all other drivers that include
omap-dma.h. Once that is done in other subsystem after this patch gets merged,
this include can then be removed from omap-dma.h


OK


Also, has this been tested with make randconfig? Changes like
this can easily cause problems elsewhere..


May be I am missing something, Can you please elaborate ?


You're touching a header included in many places, so you
need to make sure you're not accidentally breaking anything.



True


There's an option that allows you to specify some selected
options like CONFIG_ARCH_OMAP2PLUS=y with KCONFIG_ALLCONFIG
and then run make randconfig. This should expose quite fast
if there are some issues for the other drivers.

Also, have you compile tested this with omap1_defconfig?



checked omap1_defconfig and randconfig's, both are OK.

Thanks and Regards,
Balaji T K
--
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 v2 6/6] mmc: omap_hsmmc: split omap-dma header file

2014-05-19 Thread Balaji T K

On Saturday 17 May 2014 03:11 AM, Tony Lindgren wrote:

* Balaji T K balaj...@ti.com [140509 09:47]:

moving dmaengine consumer specific function to omap-dmaengine.h
to Resolve build failure seen with sh-allmodconfig:
 include/linux/omap-dma.h:171:8: error: expected identifier before numeric 
constant
 make[4]: *** [drivers/mmc/host/omap_hsmmc.o] Error 1

Cc: Russell King - ARM Linux li...@arm.linux.org.uk
Cc: Tony Lindgren t...@atomide.com
Signed-off-by: Balaji T K balaj...@ti.com
---
  drivers/mmc/host/omap_hsmmc.c  |2 +-
  include/linux/omap-dma.h   |   19 +--
  include/linux/omap-dmaengine.h |   21 +
  3 files changed, 23 insertions(+), 19 deletions(-)
  create mode 100644 include/linux/omap-dmaengine.h

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index cba71d6..6b7b755 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -31,7 +31,7 @@
  #include linux/of.h
  #include linux/of_gpio.h
  #include linux/of_device.h
-#include linux/omap-dma.h
+#include linux/omap-dmaengine.h
  #include linux/mmc/host.h
  #include linux/mmc/core.h
  #include linux/mmc/mmc.h
diff --git a/include/linux/omap-dma.h b/include/linux/omap-dma.h
index 41a13e7..999f52d 100644
--- a/include/linux/omap-dma.h
+++ b/include/linux/omap-dma.h
@@ -1,23 +1,6 @@
-/*
- * OMAP DMA Engine support
- *
- * 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.
- */
  #ifndef __LINUX_OMAP_DMA_H
  #define __LINUX_OMAP_DMA_H
-
-struct dma_chan;
-
-#if defined(CONFIG_DMA_OMAP) || defined(CONFIG_DMA_OMAP_MODULE)
-bool omap_dma_filter_fn(struct dma_chan *, void *);
-#else
-static inline bool omap_dma_filter_fn(struct dma_chan *c, void *d)
-{
-   return false;
-}
-#endif
+#include linux/omap-dmaengine.h


Can't the drivers needing this include it directly?



Yes, I have converted omap_hsmmc as part of this patch.
Due to lack of bandwidth, I haven't touched upon all other drivers that include
omap-dma.h. Once that is done in other subsystem after this patch gets merged,
this include can then be removed from omap-dma.h


Also, has this been tested with make randconfig? Changes like
this can easily cause problems elsewhere..


May be I am missing something, Can you please elaborate ?
This patch is based on the discussion [1]
I just moved the dma consumer specific things needed by users
to a separate file and include the same file in place so that other users
can be converted one at a time.

[1]
https://lkml.org/lkml/2014/1/19/16


Regards,

Tony


  /*
   *  Legacy OMAP DMA handling defines and functions
diff --git a/include/linux/omap-dmaengine.h b/include/linux/omap-dmaengine.h
new file mode 100644
index 000..2b0b6aa
--- /dev/null
+++ b/include/linux/omap-dmaengine.h
@@ -0,0 +1,21 @@
+/*
+ * OMAP DMA Engine support
+ *
+ * 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.
+ */
+#ifndef __LINUX_OMAP_DMAENGINE_H
+#define __LINUX_OMAP_DMAENGINE_H
+
+struct dma_chan;
+
+#if defined(CONFIG_DMA_OMAP) || defined(CONFIG_DMA_OMAP_MODULE)
+bool omap_dma_filter_fn(struct dma_chan *, void *);
+#else
+static inline bool omap_dma_filter_fn(struct dma_chan *c, void *d)
+{
+   return false;
+}
+#endif
+#endif /* __LINUX_OMAP_DMAENGINE_H */
--
1.7.5.4



--
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] mmc: omap_hsmmc: use IS_ERR macro for error checking

2014-05-15 Thread Balaji T K
Debounce clock is optional, use IS_ERR macro instead of NULL pointer check.

Signed-off-by: Balaji T K balaj...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c |   18 +++---
 1 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 6b7b755..521eec3 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1155,7 +1155,7 @@ static int omap_hsmmc_switch_opcond(struct 
omap_hsmmc_host *host, int vdd)
 
/* Disable the clocks */
pm_runtime_put_sync(host-dev);
-   if (host-dbclk)
+   if (!IS_ERR(host-dbclk))
clk_disable_unprepare(host-dbclk);
 
/* Turn the power off */
@@ -1166,7 +1166,7 @@ static int omap_hsmmc_switch_opcond(struct 
omap_hsmmc_host *host, int vdd)
ret = mmc_slot(host).set_power(host-dev, host-slot_id, 1,
   vdd);
pm_runtime_get_sync(host-dev);
-   if (host-dbclk)
+   if (!IS_ERR(host-dbclk))
clk_prepare_enable(host-dbclk);
 
if (ret != 0)
@@ -1947,12 +1947,8 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
/*
 * MMC can still work without debounce clock.
 */
-   if (IS_ERR(host-dbclk)) {
-   host-dbclk = NULL;
-   } else if (clk_prepare_enable(host-dbclk) != 0) {
+   if (!IS_ERR(host-dbclk)  clk_prepare_enable(host-dbclk))
dev_warn(mmc_dev(host-mmc), Failed to enable debounce clk\n);
-   host-dbclk = NULL;
-   }
 
/* Since we do only SG emulation, we can have as many segs
 * as we want. */
@@ -2103,7 +2099,7 @@ err_irq:
dma_release_channel(host-rx_chan);
pm_runtime_put_sync(host-dev);
pm_runtime_disable(host-dev);
-   if (host-dbclk)
+   if (!IS_ERR(host-dbclk))
clk_disable_unprepare(host-dbclk);
 err1:
mmc_free_host(mmc);
@@ -2131,7 +2127,7 @@ static int omap_hsmmc_remove(struct platform_device *pdev)
 
pm_runtime_put_sync(host-dev);
pm_runtime_disable(host-dev);
-   if (host-dbclk)
+   if (!IS_ERR(host-dbclk))
clk_disable_unprepare(host-dbclk);
 
omap_hsmmc_gpio_free(host-pdata);
@@ -2175,7 +2171,7 @@ static int omap_hsmmc_suspend(struct device *dev)
OMAP_HSMMC_READ(host-base, HCTL)  ~SDBP);
}
 
-   if (host-dbclk)
+   if (!IS_ERR(host-dbclk))
clk_disable_unprepare(host-dbclk);
 
pm_runtime_put_sync(host-dev);
@@ -2192,7 +2188,7 @@ static int omap_hsmmc_resume(struct device *dev)
 
pm_runtime_get_sync(host-dev);
 
-   if (host-dbclk)
+   if (!IS_ERR(host-dbclk))
clk_prepare_enable(host-dbclk);
 
if (!(host-mmc-pm_flags  MMC_PM_KEEP_POWER))
-- 
1.7.5.4

--
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 v2 1/6] mmc: omap_hsmmc: use devm_clk_get

2014-05-15 Thread Balaji T K

On Monday 12 May 2014 07:20 PM, Ulf Hansson wrote:

On 12 May 2014 15:33, Balaji T K balaj...@ti.com wrote:

On Monday 12 May 2014 02:03 PM, Ulf Hansson wrote:


On 9 May 2014 18:46, Balaji T K balaj...@ti.com wrote:


With devm_clk_get conversion clk_put can be removed in clean up path

Signed-off-by: Balaji T K balaj...@ti.com
---
   drivers/mmc/host/omap_hsmmc.c |   15 ---
   1 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c
b/drivers/mmc/host/omap_hsmmc.c
index b4de63b..b8ae7ee 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1922,7 +1922,7 @@ static int omap_hsmmc_probe(struct platform_device
*pdev)

  spin_lock_init(host-irq_lock);

-   host-fclk = clk_get(pdev-dev, fck);
+   host-fclk = devm_clk_get(pdev-dev, fck);
  if (IS_ERR(host-fclk)) {
  ret = PTR_ERR(host-fclk);
  host-fclk = NULL;
@@ -1941,7 +1941,7 @@ static int omap_hsmmc_probe(struct platform_device
*pdev)

  omap_hsmmc_context_save(host);

-   host-dbclk = clk_get(pdev-dev, mmchsdb_fck);
+   host-dbclk = devm_clk_get(pdev-dev, mmchsdb_fck);
  /*
   * MMC can still work without debounce clock.
   */
@@ -1949,7 +1949,6 @@ static int omap_hsmmc_probe(struct platform_device
*pdev)
  host-dbclk = NULL;
  } else if (clk_prepare_enable(host-dbclk) != 0) {
  dev_warn(mmc_dev(host-mmc), Failed to enable debounce
clk\n);
-   clk_put(host-dbclk);
  host-dbclk = NULL;



You should use the IS_ERR macro, no need to reset dbclk to NULL.



Agreed, IS_ERR macro usage deserves patch on its own.
will create separate patch on top of this series.


Or you just update this patch, since it would touch there very same
piece of code. :-)


plus few more code additionally, since these are two different logical changes,
have sent a separate patch. But feel free to squash them if needed.

Thanks and Regards,
Balaji T K
--
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 v2 6/6] mmc: omap_hsmmc: split omap-dma header file

2014-05-15 Thread Balaji T K

On Friday 09 May 2014 10:16 PM, Balaji T K wrote:

moving dmaengine consumer specific function to omap-dmaengine.h
to Resolve build failure seen with sh-allmodconfig:
 include/linux/omap-dma.h:171:8: error: expected identifier before numeric 
constant
 make[4]: *** [drivers/mmc/host/omap_hsmmc.o] Error 1

Cc: Russell King - ARM Linux li...@arm.linux.org.uk
Cc: Tony Lindgren t...@atomide.com
Signed-off-by: Balaji T K balaj...@ti.com


Hi Russell, Tony,

Since this patches touches omap dma header file,
can you provide your comments / ack if it looks ok ?


---
  drivers/mmc/host/omap_hsmmc.c  |2 +-
  include/linux/omap-dma.h   |   19 +--
  include/linux/omap-dmaengine.h |   21 +
  3 files changed, 23 insertions(+), 19 deletions(-)
  create mode 100644 include/linux/omap-dmaengine.h

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index cba71d6..6b7b755 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -31,7 +31,7 @@
  #include linux/of.h
  #include linux/of_gpio.h
  #include linux/of_device.h
-#include linux/omap-dma.h
+#include linux/omap-dmaengine.h
  #include linux/mmc/host.h
  #include linux/mmc/core.h
  #include linux/mmc/mmc.h
diff --git a/include/linux/omap-dma.h b/include/linux/omap-dma.h
index 41a13e7..999f52d 100644
--- a/include/linux/omap-dma.h
+++ b/include/linux/omap-dma.h
@@ -1,23 +1,6 @@
-/*
- * OMAP DMA Engine support
- *
- * 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.
- */
  #ifndef __LINUX_OMAP_DMA_H
  #define __LINUX_OMAP_DMA_H
-
-struct dma_chan;
-
-#if defined(CONFIG_DMA_OMAP) || defined(CONFIG_DMA_OMAP_MODULE)
-bool omap_dma_filter_fn(struct dma_chan *, void *);
-#else
-static inline bool omap_dma_filter_fn(struct dma_chan *c, void *d)
-{
-   return false;
-}
-#endif
+#include linux/omap-dmaengine.h

  /*
   *  Legacy OMAP DMA handling defines and functions
diff --git a/include/linux/omap-dmaengine.h b/include/linux/omap-dmaengine.h
new file mode 100644
index 000..2b0b6aa
--- /dev/null
+++ b/include/linux/omap-dmaengine.h
@@ -0,0 +1,21 @@
+/*
+ * OMAP DMA Engine support
+ *
+ * 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.
+ */
+#ifndef __LINUX_OMAP_DMAENGINE_H
+#define __LINUX_OMAP_DMAENGINE_H
+
+struct dma_chan;
+
+#if defined(CONFIG_DMA_OMAP) || defined(CONFIG_DMA_OMAP_MODULE)
+bool omap_dma_filter_fn(struct dma_chan *, void *);
+#else
+static inline bool omap_dma_filter_fn(struct dma_chan *c, void *d)
+{
+   return false;
+}
+#endif
+#endif /* __LINUX_OMAP_DMAENGINE_H */



--
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 v2 1/6] mmc: omap_hsmmc: use devm_clk_get

2014-05-12 Thread Balaji T K

On Monday 12 May 2014 02:03 PM, Ulf Hansson wrote:

On 9 May 2014 18:46, Balaji T K balaj...@ti.com wrote:

With devm_clk_get conversion clk_put can be removed in clean up path

Signed-off-by: Balaji T K balaj...@ti.com
---
  drivers/mmc/host/omap_hsmmc.c |   15 ---
  1 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index b4de63b..b8ae7ee 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1922,7 +1922,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev)

 spin_lock_init(host-irq_lock);

-   host-fclk = clk_get(pdev-dev, fck);
+   host-fclk = devm_clk_get(pdev-dev, fck);
 if (IS_ERR(host-fclk)) {
 ret = PTR_ERR(host-fclk);
 host-fclk = NULL;
@@ -1941,7 +1941,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev)

 omap_hsmmc_context_save(host);

-   host-dbclk = clk_get(pdev-dev, mmchsdb_fck);
+   host-dbclk = devm_clk_get(pdev-dev, mmchsdb_fck);
 /*
  * MMC can still work without debounce clock.
  */
@@ -1949,7 +1949,6 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
 host-dbclk = NULL;
 } else if (clk_prepare_enable(host-dbclk) != 0) {
 dev_warn(mmc_dev(host-mmc), Failed to enable debounce 
clk\n);
-   clk_put(host-dbclk);
 host-dbclk = NULL;


You should use the IS_ERR macro, no need to reset dbclk to NULL.



Agreed, IS_ERR macro usage deserves patch on its own.
will create separate patch on top of this series.

Thanks and Regards
Balaji T K

 }

@@ -2105,11 +2104,8 @@ err_irq:
 dma_release_channel(host-rx_chan);
 pm_runtime_put_sync(host-dev);
 pm_runtime_disable(host-dev);
-   clk_put(host-fclk);
-   if (host-dbclk) {
+   if (host-dbclk)


Use IS_ERR instead.


 clk_disable_unprepare(host-dbclk);
-   clk_put(host-dbclk);
-   }
  err1:
 iounmap(host-base);
 mmc_free_host(mmc);
@@ -2144,11 +2140,8 @@ static int omap_hsmmc_remove(struct platform_device 
*pdev)

 pm_runtime_put_sync(host-dev);
 pm_runtime_disable(host-dev);
-   clk_put(host-fclk);
-   if (host-dbclk) {
+   if (host-dbclk)


Use IS_ERR instead.


 clk_disable_unprepare(host-dbclk);
-   clk_put(host-dbclk);
-   }

 omap_hsmmc_gpio_free(host-pdata);
 iounmap(host-base);
--
1.7.5.4



Kind regards
Ulf Hansson



--
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 v2 3/6] mmc: omap_hsmmc: use devm_request_threaded_irq

2014-05-09 Thread Balaji T K
With devm_request_threaded_irq conversion free_irq can be removed
in clean up path

Signed-off-by: Balaji T K balaj...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c |9 +++--
 1 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index ef7e48a..6179fe3 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -2043,9 +2043,9 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
 
/* Request IRQ for card detect */
if ((mmc_slot(host).card_detect_irq)) {
-   ret = request_threaded_irq(mmc_slot(host).card_detect_irq,
-  NULL,
-  omap_hsmmc_detect,
+   ret = devm_request_threaded_irq(pdev-dev,
+   mmc_slot(host).card_detect_irq,
+   NULL, omap_hsmmc_detect,
   IRQF_TRIGGER_RISING | 
IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
   mmc_hostname(mmc), host);
if (ret) {
@@ -2088,7 +2088,6 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
 
 err_slot_name:
mmc_remove_host(mmc);
-   free_irq(mmc_slot(host).card_detect_irq, host);
 err_irq_cd:
if (host-use_reg)
omap_hsmmc_reg_put(host);
@@ -2127,8 +2126,6 @@ static int omap_hsmmc_remove(struct platform_device *pdev)
omap_hsmmc_reg_put(host);
if (host-pdata-cleanup)
host-pdata-cleanup(pdev-dev);
-   if (mmc_slot(host).card_detect_irq)
-   free_irq(mmc_slot(host).card_detect_irq, host);
 
if (host-tx_chan)
dma_release_channel(host-tx_chan);
-- 
1.7.5.4

--
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 v2 5/6] mmc: omap_hsmmc: fix cmd23 multiblock read/write

2014-05-09 Thread Balaji T K
Check for set block count command fails always since host-cmd is
set to NULL in the same function incorrectly. Correct host-cmd usage properly.

Signed-off-by: Balaji T K balaj...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 140425c..cba71d6 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -920,16 +920,17 @@ omap_hsmmc_xfer_done(struct omap_hsmmc_host *host, struct 
mmc_data *data)
 static void
 omap_hsmmc_cmd_done(struct omap_hsmmc_host *host, struct mmc_command *cmd)
 {
-   host-cmd = NULL;
-
if (host-mrq-sbc  (host-cmd == host-mrq-sbc) 
!host-mrq-sbc-error  !(host-flags  AUTO_CMD23)) {
+   host-cmd = NULL;
omap_hsmmc_start_dma_transfer(host);
omap_hsmmc_start_command(host, host-mrq-cmd,
host-mrq-data);
return;
}
 
+   host-cmd = NULL;
+
if (cmd-flags  MMC_RSP_PRESENT) {
if (cmd-flags  MMC_RSP_136) {
/* response type 2 */
-- 
1.7.5.4

--
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 v2 1/6] mmc: omap_hsmmc: use devm_clk_get

2014-05-09 Thread Balaji T K
With devm_clk_get conversion clk_put can be removed in clean up path

Signed-off-by: Balaji T K balaj...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c |   15 ---
 1 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index b4de63b..b8ae7ee 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1922,7 +1922,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
 
spin_lock_init(host-irq_lock);
 
-   host-fclk = clk_get(pdev-dev, fck);
+   host-fclk = devm_clk_get(pdev-dev, fck);
if (IS_ERR(host-fclk)) {
ret = PTR_ERR(host-fclk);
host-fclk = NULL;
@@ -1941,7 +1941,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
 
omap_hsmmc_context_save(host);
 
-   host-dbclk = clk_get(pdev-dev, mmchsdb_fck);
+   host-dbclk = devm_clk_get(pdev-dev, mmchsdb_fck);
/*
 * MMC can still work without debounce clock.
 */
@@ -1949,7 +1949,6 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
host-dbclk = NULL;
} else if (clk_prepare_enable(host-dbclk) != 0) {
dev_warn(mmc_dev(host-mmc), Failed to enable debounce clk\n);
-   clk_put(host-dbclk);
host-dbclk = NULL;
}
 
@@ -2105,11 +2104,8 @@ err_irq:
dma_release_channel(host-rx_chan);
pm_runtime_put_sync(host-dev);
pm_runtime_disable(host-dev);
-   clk_put(host-fclk);
-   if (host-dbclk) {
+   if (host-dbclk)
clk_disable_unprepare(host-dbclk);
-   clk_put(host-dbclk);
-   }
 err1:
iounmap(host-base);
mmc_free_host(mmc);
@@ -2144,11 +2140,8 @@ static int omap_hsmmc_remove(struct platform_device 
*pdev)
 
pm_runtime_put_sync(host-dev);
pm_runtime_disable(host-dev);
-   clk_put(host-fclk);
-   if (host-dbclk) {
+   if (host-dbclk)
clk_disable_unprepare(host-dbclk);
-   clk_put(host-dbclk);
-   }
 
omap_hsmmc_gpio_free(host-pdata);
iounmap(host-base);
-- 
1.7.5.4

--
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 v2 4/6] mmc: omap_hsmmc: use devm_ioremap_resource

2014-05-09 Thread Balaji T K
With devm_ioremap_resource conversion release_mem_region, iounmap can be
removed in clean up path

Signed-off-by: Balaji T K balaj...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c |   19 +--
 1 files changed, 5 insertions(+), 14 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 6179fe3..140425c 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1851,6 +1851,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
unsigned tx_req, rx_req;
struct pinctrl *pinctrl;
const struct omap_mmc_of_data *data;
+   void __iomem *base;
 
match = of_match_device(of_match_ptr(omap_mmc_of_match), pdev-dev);
if (match) {
@@ -1881,9 +1882,9 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
if (res == NULL || irq  0)
return -ENXIO;
 
-   res = request_mem_region(res-start, resource_size(res), pdev-name);
-   if (res == NULL)
-   return -EBUSY;
+   base = devm_ioremap_resource(pdev-dev, res);
+   if (IS_ERR(base))
+   return PTR_ERR(base);
 
ret = omap_hsmmc_gpio_init(pdata);
if (ret)
@@ -1904,7 +1905,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
host-irq   = irq;
host-slot_id   = 0;
host-mapbase   = res-start + pdata-reg_offset;
-   host-base  = ioremap(host-mapbase, SZ_4K);
+   host-base  = base + pdata-reg_offset;
host-power_mode = MMC_POWER_OFF;
host-next_data.cookie = 1;
host-pbias_enabled = 0;
@@ -2104,21 +2105,16 @@ err_irq:
if (host-dbclk)
clk_disable_unprepare(host-dbclk);
 err1:
-   iounmap(host-base);
mmc_free_host(mmc);
 err_alloc:
omap_hsmmc_gpio_free(pdata);
 err:
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   if (res)
-   release_mem_region(res-start, resource_size(res));
return ret;
 }
 
 static int omap_hsmmc_remove(struct platform_device *pdev)
 {
struct omap_hsmmc_host *host = platform_get_drvdata(pdev);
-   struct resource *res;
 
pm_runtime_get_sync(host-dev);
mmc_remove_host(host-mmc);
@@ -2138,13 +2134,8 @@ static int omap_hsmmc_remove(struct platform_device 
*pdev)
clk_disable_unprepare(host-dbclk);
 
omap_hsmmc_gpio_free(host-pdata);
-   iounmap(host-base);
mmc_free_host(host-mmc);
 
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   if (res)
-   release_mem_region(res-start, resource_size(res));
-
return 0;
 }
 
-- 
1.7.5.4

--
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 v2 0/6] mmc: omap_hsmmc: convert to use devm_* and fixes

2014-05-09 Thread Balaji T K
v2:
use devm_ioremap_resource
add cmd23 multiblock read/write fix

Balaji T K (6):
  mmc: omap_hsmmc: use devm_clk_get
  mmc: omap_hsmmc: use devm_request_irq
  mmc: omap_hsmmc: use devm_request_threaded_irq
  mmc: omap_hsmmc: use devm_ioremap_resource
  mmc: omap_hsmmc: fix cmd23 multiblock read/write
  mmc: omap_hsmmc: split omap-dma header file

 drivers/mmc/host/omap_hsmmc.c  |   57 ---
 include/linux/omap-dma.h   |   19 +
 include/linux/omap-dmaengine.h |   21 ++
 3 files changed, 40 insertions(+), 57 deletions(-)
 create mode 100644 include/linux/omap-dmaengine.h

-- 
1.7.5.4

--
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 v2 2/6] mmc: omap_hsmmc: use devm_request_irq

2014-05-09 Thread Balaji T K
With devm_request_irq conversion free_irq can be removed in clean up path

Signed-off-by: Balaji T K balaj...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c |7 ++-
 1 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index b8ae7ee..ef7e48a 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -2017,7 +2017,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
}
 
/* Request IRQ for MMC operations */
-   ret = request_irq(host-irq, omap_hsmmc_irq, 0,
+   ret = devm_request_irq(pdev-dev, host-irq, omap_hsmmc_irq, 0,
mmc_hostname(mmc), host);
if (ret) {
dev_err(mmc_dev(host-mmc), Unable to grab HSMMC IRQ\n);
@@ -2028,7 +2028,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
if (pdata-init(pdev-dev) != 0) {
dev_err(mmc_dev(host-mmc),
Unable to configure MMC IRQs\n);
-   goto err_irq_cd_init;
+   goto err_irq;
}
}
 
@@ -2095,8 +2095,6 @@ err_irq_cd:
 err_reg:
if (host-pdata-cleanup)
host-pdata-cleanup(pdev-dev);
-err_irq_cd_init:
-   free_irq(host-irq, host);
 err_irq:
if (host-tx_chan)
dma_release_channel(host-tx_chan);
@@ -2129,7 +2127,6 @@ static int omap_hsmmc_remove(struct platform_device *pdev)
omap_hsmmc_reg_put(host);
if (host-pdata-cleanup)
host-pdata-cleanup(pdev-dev);
-   free_irq(host-irq, host);
if (mmc_slot(host).card_detect_irq)
free_irq(mmc_slot(host).card_detect_irq, host);
 
-- 
1.7.5.4

--
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 v2 6/6] mmc: omap_hsmmc: split omap-dma header file

2014-05-09 Thread Balaji T K
moving dmaengine consumer specific function to omap-dmaengine.h
to Resolve build failure seen with sh-allmodconfig:
include/linux/omap-dma.h:171:8: error: expected identifier before numeric 
constant
make[4]: *** [drivers/mmc/host/omap_hsmmc.o] Error 1

Cc: Russell King - ARM Linux li...@arm.linux.org.uk
Cc: Tony Lindgren t...@atomide.com
Signed-off-by: Balaji T K balaj...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c  |2 +-
 include/linux/omap-dma.h   |   19 +--
 include/linux/omap-dmaengine.h |   21 +
 3 files changed, 23 insertions(+), 19 deletions(-)
 create mode 100644 include/linux/omap-dmaengine.h

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index cba71d6..6b7b755 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -31,7 +31,7 @@
 #include linux/of.h
 #include linux/of_gpio.h
 #include linux/of_device.h
-#include linux/omap-dma.h
+#include linux/omap-dmaengine.h
 #include linux/mmc/host.h
 #include linux/mmc/core.h
 #include linux/mmc/mmc.h
diff --git a/include/linux/omap-dma.h b/include/linux/omap-dma.h
index 41a13e7..999f52d 100644
--- a/include/linux/omap-dma.h
+++ b/include/linux/omap-dma.h
@@ -1,23 +1,6 @@
-/*
- * OMAP DMA Engine support
- *
- * 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.
- */
 #ifndef __LINUX_OMAP_DMA_H
 #define __LINUX_OMAP_DMA_H
-
-struct dma_chan;
-
-#if defined(CONFIG_DMA_OMAP) || defined(CONFIG_DMA_OMAP_MODULE)
-bool omap_dma_filter_fn(struct dma_chan *, void *);
-#else
-static inline bool omap_dma_filter_fn(struct dma_chan *c, void *d)
-{
-   return false;
-}
-#endif
+#include linux/omap-dmaengine.h
 
 /*
  *  Legacy OMAP DMA handling defines and functions
diff --git a/include/linux/omap-dmaengine.h b/include/linux/omap-dmaengine.h
new file mode 100644
index 000..2b0b6aa
--- /dev/null
+++ b/include/linux/omap-dmaengine.h
@@ -0,0 +1,21 @@
+/*
+ * OMAP DMA Engine support
+ *
+ * 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.
+ */
+#ifndef __LINUX_OMAP_DMAENGINE_H
+#define __LINUX_OMAP_DMAENGINE_H
+
+struct dma_chan;
+
+#if defined(CONFIG_DMA_OMAP) || defined(CONFIG_DMA_OMAP_MODULE)
+bool omap_dma_filter_fn(struct dma_chan *, void *);
+#else
+static inline bool omap_dma_filter_fn(struct dma_chan *c, void *d)
+{
+   return false;
+}
+#endif
+#endif /* __LINUX_OMAP_DMAENGINE_H */
-- 
1.7.5.4

--
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/7] mmc: omap_hsmmc: Enable SDIO interrupt

2014-05-09 Thread Balaji T K

On Friday 09 May 2014 04:50 AM, Andreas Fenkart wrote:

There have been various patches floating around for enabling
the SDIO IRQ for hsmmc, but none of them ever got merged.

Probably the reason for not merging the SDIO interrupt patches
has been the lack of wake-up path for SDIO on some omaps that
has also needed remuxing the SDIO DAT1 line to a GPIO making
the patches complex.

This patch adds the minimal SDIO IRQ support to hsmmc for
omaps that do have the wake-up path. For those omaps, the
DAT1 line need to have the wake-up enable bit set, and the
wake-up interrupt is the same as for the MMC controller.

This patch has been tested on am3730 es1.2 with mwifiex
connected to MMC3 with mwifiex waking to Ethernet traffic
from off-idle mode. Note that for omaps that do not have
the SDIO wake-up path, this patch will not work for idle
modes and further patches for remuxing DAT1 to GPIO are
needed.

Based on earlier patches [1][2] by David Vrabel
david.vra...@csr.com, Steve Sakoman st...@sakoman.com

For now, only support SDIO interrupt if we are booted with
a separate wake-irq configued via device tree. This is
because omaps need the wake-irq for idle states, and some
omaps need special quirks. And we don't want to add new
legacy mux platform init code callbacks any longer as we
are moving to DT based booting anyways.

To use it, you need to specify the wake-irq using the
interrupts-extended property.

[1] 
http://www.sakoman.com/cgi-bin/gitweb.cgi?p=linux.git;a=commitdiff_plain;h=010810d22f6f49ac03da4ba384969432e0320453
[2] http://comments.gmane.org/gmane.linux.kernel.mmc/20446

Cc: Balaji T K balaj...@ti.com
Signed-off-by: Andreas Fenkart afenk...@gmail.com
Signed-off-by: Tony Lindgren t...@atomide.com


Hi Andreas,
Thanks for the new patch series.
Minor nit below,

other than that
Acked-by: Balaji T K balaj...@ti.com


diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 5042a15..f43a69e 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -29,6 +29,7 @@
  #include linux/timer.h
  #include linux/clk.h
  #include linux/of.h
+#include linux/of_irq.h
  #include linux/of_gpio.h
  #include linux/of_device.h
  #include linux/omap-dma.h
@@ -36,6 +37,7 @@
  #include linux/mmc/core.h
  #include linux/mmc/mmc.h
  #include linux/io.h
+#include linux/irq.h
  #include linux/gpio.h
  #include linux/regulator/consumer.h
  #include linux/pinctrl/consumer.h
@@ -133,6 +135,7 @@ static void apply_clk_hack(struct device *dev)
  #define TC_EN (1  1)
  #define BWR_EN(1  4)
  #define BRR_EN(1  5)
+#define CIRQ_EN(1  8)
  #define ERR_EN(1  15)
  #define CTO_EN(1  16)
  #define CCRC_EN   (1  17)
@@ -167,7 +170,6 @@ static void apply_clk_hack(struct device *dev)
  #define VDD_3V0   300 /* 30 uV */
  #define VDD_165_195   (ffs(MMC_VDD_165_195) - 1)

-#define AUTO_CMD23 (1  1)  /* Auto CMD23 support */
  /*
   * One controller can have multiple slots, like on some omap boards using
   * omap.c controller driver. Luckily this is not currently done on any known
@@ -221,6 +223,7 @@ struct omap_hsmmc_host {
u32 sysctl;
u32 capa;
int irq;
+   int wake_irq;
int use_dma, dma_ch;
struct dma_chan *tx_chan;
struct dma_chan *rx_chan;
@@ -233,6 +236,9 @@ struct omap_hsmmc_host {
int req_in_progress;
unsigned long   clk_rate;
unsigned intflags;
+#define AUTO_CMD23 (1  0)/* Auto CMD23 support */
+#define HSMMC_SDIO_IRQ_ENABLED (1  1)/* SDIO irq enabled */
+#define HSMMC_WAKE_IRQ_ENABLED (1  2)
struct omap_hsmmc_next  next_data;
struct  omap_mmc_platform_data  *pdata;
  };
@@ -537,27 +543,40 @@ static void omap_hsmmc_stop_clock(struct omap_hsmmc_host 
*host)
  static void omap_hsmmc_enable_irq(struct omap_hsmmc_host *host,
  struct mmc_command *cmd)
  {
-   unsigned int irq_mask;
+   u32 irq_mask = INT_EN_MASK;
+   unsigned long flags;

if (host-use_dma)
-   irq_mask = INT_EN_MASK  ~(BRR_EN | BWR_EN);
-   else
-   irq_mask = INT_EN_MASK;
+   irq_mask = ~(BRR_EN | BWR_EN);

/* Disable timeout for erases */
if (cmd-opcode == MMC_ERASE)
irq_mask = ~DTO_EN;

+   spin_lock_irqsave(host-irq_lock, flags);
OMAP_HSMMC_WRITE(host-base, STAT, STAT_CLEAR);
OMAP_HSMMC_WRITE(host-base, ISE, irq_mask);
+
+   /* latch pending CIRQ, but don't signal MMC core */
+   if (host-flags  HSMMC_SDIO_IRQ_ENABLED)
+   irq_mask |= CIRQ_EN;
OMAP_HSMMC_WRITE(host-base, IE

Re: [PATCH v11 4/7] mmc: omap_hsmmc: Extend debugfs by SDIO IRQ handling, runtime state

2014-05-09 Thread Balaji T K

On Friday 09 May 2014 04:50 AM, Andreas Fenkart wrote:

Add SDIO IRQ entries to debugfs entry. Note that PSTATE shows current
state of data lines, incl. SDIO IRQ pending

Signed-off-by: Andreas Fenkart afenk...@gmail.com



Looks good to me
Acked-by: Balaji T K balaj...@ti.com


diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index f76462d..14857d7 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -83,6 +83,7 @@ static void apply_clk_hack(struct device *dev)
  #define OMAP_HSMMC_RSP54  0x0118
  #define OMAP_HSMMC_RSP76  0x011C
  #define OMAP_HSMMC_DATA   0x0120
+#define OMAP_HSMMC_PSTATE  0x0124
  #define OMAP_HSMMC_HCTL   0x0128
  #define OMAP_HSMMC_SYSCTL 0x012C
  #define OMAP_HSMMC_STAT   0x0130
@@ -1854,14 +1855,29 @@ static int omap_hsmmc_regs_show(struct seq_file *s, 
void *data)
  {
struct mmc_host *mmc = s-private;
struct omap_hsmmc_host *host = mmc_priv(mmc);
+   bool suspended;

-   seq_printf(s, mmc%d:\n ctx_loss:\t%d\n\nregs:\n,
-   mmc-index, host-context_loss);
+   seq_printf(s, mmc%d:\n, mmc-index);
+   seq_printf(s, sdio irq mode\t%s\n,
+  (mmc-caps  MMC_CAP_SDIO_IRQ) ? interrupt : polling);

-   pm_runtime_get_sync(host-dev);
+   if (mmc-caps  MMC_CAP_SDIO_IRQ) {
+   seq_printf(s, sdio irq \t%s\n,
+  (host-flags  HSMMC_SDIO_IRQ_ENABLED) ?  enabled
+  : disabled);
+   }
+
+   suspended = host-dev-power.runtime_status != RPM_ACTIVE;
+   seq_printf(s, runtime state\t%s\n, (suspended ?  idle : active));

+   seq_printf(s, ctx_loss:\t%d\n, host-context_loss);
+
+   pm_runtime_get_sync(host-dev);
+   seq_puts(s, \nregs:\n);
seq_printf(s, CON:\t\t0x%08x\n,
OMAP_HSMMC_READ(host-base, CON));
+   seq_printf(s, PSTATE:\t\t0x%08x\n,
+  OMAP_HSMMC_READ(host-base, PSTATE));
seq_printf(s, HCTL:\t\t0x%08x\n,
OMAP_HSMMC_READ(host-base, HCTL));
seq_printf(s, SYSCTL:\t\t0x%08x\n,



--
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 7/7] mmc: omap_hsmmc: Pin remux workaround to support SDIO interrupt on AM335x

2014-05-09 Thread Balaji T K

On Friday 09 May 2014 04:50 AM, Andreas Fenkart wrote:

The am335x can't detect pending cirq in PM runtime suspend.
This patch reconfigures dat1 as a GPIO before going to suspend.
SDIO interrupts are detected with the GPIO, the GPIO will only wake
the module from suspend, SDIO irq detection will still happen through the
IP block.

Idea of remuxing the pins by Tony Lindgren. Code contributions from
Tony Lindgren and Balaji T K balaj...@ti.com

Signed-off-by: Andreas Fenkart afenk...@gmail.com
Signed-off-by: Tony Lindgren t...@atomide.com

Conflicts:
drivers/mmc/host/omap_hsmmc.c


Remove above 2 lines
Acked-by: Balaji T K balaj...@ti.com



diff --git a/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt 
b/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt
index ce80561..946bc5f 100644
--- a/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt
+++ b/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt
@@ -56,3 +56,56 @@ Examples:
edma 25;
dma-names = tx, rx;
};
+
+[workaround for missing swakeup on am33xx]
+
+This SOC is missing the swakeup line, it will not detect SDIO irq
+while in suspend.
+
+ --
+ | PRCM |
+  --
+   ^ |
+   swakeup | | fclk
+   | v
+   -----   -
+  | card | -- CIRQ --  | hsmmc | -- IRQ --  | CPU |
+   -----   -
+
+In suspend the fclk is off and the module is disfunctional. Even register reads
+will fail. A small logic in the host will request fclk restore, when an
+external event is detected. Once the clock is restored, the host detects the
+event normally. Since am33xx doesn't have this line it never wakes from
+suspend.
+
+The workaround is to reconfigure the dat1 line as a GPIO upon suspend. To make
+this work, we need to set the named pinctrl states default and idle.
+Prepare idle to remux dat1 as a gpio, and default to remux it back as sdio
+dat1. The MMC driver will then toggle between idle and default state during
+runtime.
+
+In summary:
+1. select matching 'compatible' section, see example below.
+2. specify pinctrl states default and idle, sleep is optional.
+3. specify the gpio irq used for detecting sdio irq in suspend
+
+If configuration is incomplete, a warning message is emitted falling back to
+polling. Also check the sdio irq mode in /sys/kernel/debug/mmc0/regs. Mind
+not every application needs SDIO irq, e.g. MMC cards.
+
+   mmc1: mmc@48060100 {
+   compatible = ti,am33xx-hsmmc;
+   ...
+   pinctrl-names = default, idle, sleep
+   pinctrl-0 = mmc1_pins;
+   pinctrl-1 = mmc1_idle;
+   pinctrl-2 = mmc1_sleep;
+   ...
+   interrupts-extended = intc 64 gpio2 28 0;
+   };
+
+   mmc1_idle : pinmux_cirq_pin {
+   pinctrl-single,pins = 
+   0x0f8 0x3f  /* GPIO2_28 */
+   ;
+   };
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 5a321f98..497b2fc 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1782,15 +1782,25 @@ static int omap_hsmmc_configure_wake_irq(struct 
omap_hsmmc_host *host)
 * and need to remux SDIO DAT1 to GPIO for wake-up from idle.
 */
if (host-pdata-controller_flags  OMAP_HSMMC_SWAKEUP_MISSING) {
-   ret = -ENODEV;
-   devm_free_irq(host-dev, host-wake_irq, host);
-   goto err;
+   if (IS_ERR(host-dev-pins-default_state)) {
+   dev_info(host-dev, missing default pinctrl state\n);
+   ret = -EINVAL;
+   goto err_free_irq;
+   }
+
+   if (IS_ERR(host-dev-pins-idle_state)) {
+   dev_info(host-dev, missing idle pinctrl state\n);
+   ret = -EINVAL;
+   goto err_free_irq;
+   }
}

OMAP_HSMMC_WRITE(host-base, HCTL,
 OMAP_HSMMC_READ(host-base, HCTL) | IWE);
return 0;

+err_free_irq:
+   devm_free_irq(host-dev, host-wake_irq, host);
  err:
dev_warn(host-dev, no SDIO IRQ support, falling back to polling\n);
host-wake_irq = 0;



--
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 6/7] mmc: omap_hsmmc: switch default/idle pinctrl states in runtime hooks

2014-05-09 Thread Balaji T K

On Friday 09 May 2014 04:50 AM, Andreas Fenkart wrote:

These are predefined states of the driver model. When not present,
as if not set in the device tree, they become no-ops.
Explicitly selecting the default state is not needed since the
device core layer sets pin mux to default state before probe.
This is not the simplest implementation, on AM335x at least, we could
switch to idle at any point in the suspend hook, only the default state
needs to be set before writing to the irq registers or an IRQ might get
lost.

Signed-off-by: Andreas Fenkart afenk...@gmail.com

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 47a5982..5a321f98 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -2032,7 +2032,6 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
const struct of_device_id *match;
dma_cap_mask_t mask;
unsigned tx_req, rx_req;
-   struct pinctrl *pinctrl;
const struct omap_mmc_of_data *data;

apply_clk_hack(pdev-dev);


Looks like this patches is not based on mmc-next[1]
Can you please rebase to mmc-next
[1] 
http://git.kernel.org/cgit/linux/kernel/git/cjb/mmc.git/log/?id=refs/heads/mmc-next

Other than that:

Acked-by: Balaji T K balaj...@ti.com


@@ -2258,11 +2257,6 @@ static int omap_hsmmc_probe(struct platform_device *pdev)

omap_hsmmc_disable_irq(host);

-   pinctrl = devm_pinctrl_get_select_default(pdev-dev);
-   if (IS_ERR(pinctrl))
-   dev_warn(pdev-dev,
-   pins are not configured from the driver\n);
-
/*
 * For now, only support SDIO interrupt if we have a separate
 * wake-up interrupt configured from device tree. This is because
@@ -2486,10 +2480,15 @@ static int omap_hsmmc_runtime_suspend(struct device 
*dev)
goto abort;
}

+   pinctrl_pm_select_idle_state(dev);
+
WARN_ON(host-flags  HSMMC_WAKE_IRQ_ENABLED);
enable_irq(host-wake_irq);
host-flags |= HSMMC_WAKE_IRQ_ENABLED;
+   } else {
+   pinctrl_pm_select_idle_state(dev);
}
+
  abort:
spin_unlock_irqrestore(host-irq_lock, flags);
return ret;
@@ -2513,9 +2512,14 @@ static int omap_hsmmc_runtime_resume(struct device *dev)
host-flags = ~HSMMC_WAKE_IRQ_ENABLED;
}

+   pinctrl_pm_select_default_state(host-dev);
+
+   /* irq lost, if pinmux incorrect */
OMAP_HSMMC_WRITE(host-base, STAT, STAT_CLEAR);
OMAP_HSMMC_WRITE(host-base, ISE, CIRQ_EN);
OMAP_HSMMC_WRITE(host-base, IE, CIRQ_EN);
+   } else {
+   pinctrl_pm_select_default_state(host-dev);
}
spin_unlock_irqrestore(host-irq_lock, flags);
return 0;



--
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 5/7] mmc: omap_hsmmc: abort runtime suspend if pending sdio irq detected

2014-05-09 Thread Balaji T K

On Friday 09 May 2014 04:50 AM, Andreas Fenkart wrote:

On multicores, an sdio irq handler could be running in parallel to
runtime suspend. In the worst case it could be waiting for the spinlock
held by the runtime suspend. When runtime suspend is complete and the
functional clock (fclk) turned off, the irq handler will continue and
cause a SIGBUS on the first register access.

Signed-off-by: Andreas Fenkart afenk...@gmail.com



Acked-by: Balaji T K balaj...@ti.com


diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 14857d7..47a5982 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -134,6 +134,9 @@ static void apply_clk_hack(struct device *dev)
  #define SRD   (1  26)
  #define SOFTRESET (1  1)

+/* PSTATE */
+#define DLEV_DAT(x)(1  (20 + (x)))
+
  /* Interrupt masks for IE and ISE register */
  #define CC_EN (1  0)
  #define TC_EN (1  1)
@@ -2455,6 +2458,7 @@ static int omap_hsmmc_runtime_suspend(struct device *dev)
  {
struct omap_hsmmc_host *host;
unsigned long flags;
+   int ret = 0;

host = platform_get_drvdata(to_platform_device(dev));
omap_hsmmc_context_save(host);
@@ -2466,14 +2470,29 @@ static int omap_hsmmc_runtime_suspend(struct device 
*dev)
/* disable sdio irq handling to prevent race */
OMAP_HSMMC_WRITE(host-base, ISE, 0);
OMAP_HSMMC_WRITE(host-base, IE, 0);
-   OMAP_HSMMC_WRITE(host-base, STAT, STAT_CLEAR);
+
+   if (!(OMAP_HSMMC_READ(host-base, PSTATE)  DLEV_DAT(1))) {
+   /*
+* dat1 line low, pending sdio irq
+* race condition: possible irq handler running on
+* multi-core, abort
+*/
+   dev_dbg(dev, pending sdio irq, abort suspend\n);
+   OMAP_HSMMC_WRITE(host-base, STAT, STAT_CLEAR);
+   OMAP_HSMMC_WRITE(host-base, ISE, CIRQ_EN);
+   OMAP_HSMMC_WRITE(host-base, IE, CIRQ_EN);
+   pm_runtime_mark_last_busy(dev);
+   ret = -EBUSY;
+   goto abort;
+   }

WARN_ON(host-flags  HSMMC_WAKE_IRQ_ENABLED);
enable_irq(host-wake_irq);
host-flags |= HSMMC_WAKE_IRQ_ENABLED;
}
+abort:
spin_unlock_irqrestore(host-irq_lock, flags);
-   return 0;
+   return ret;
  }

  static int omap_hsmmc_runtime_resume(struct device *dev)



--
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 v10 5/5] mmc: omap_hsmmc: Pin remux workaround to support SDIO interrupt on AM335x

2014-05-02 Thread Balaji T K

On Monday 28 April 2014 01:11 PM, Andreas Fenkart wrote:

The am335x can't detect pending cirq in PM runtime suspend.
This patch reconfigures dat1 as a GPIO before going to suspend.
SDIO interrupts are detected with the GPIO, the GPIO will only wake
the module from suspend, SDIO irq detection will still happen through the
IP block.

Idea of remuxing the pins by Tony Lindgren. Code contributions from
Tony Lindgren and Balaji T K balaj...@ti.com

Signed-off-by: Andreas Fenkart afenk...@gmail.com
Signed-off-by: Tony Lindgren t...@atomide.com


Thanks Andreas for the patch series.
Few comments ...



diff --git a/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt 
b/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt
index ce80561..4767cd1 100644
--- a/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt
+++ b/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt
@@ -56,3 +56,54 @@ Examples:
edma 25;
dma-names = tx, rx;
};
+
+[workaround for missing swakeup on am33xx]
+
+This SOC is missing the swakeup line, it will not detect SDIO irq
+while in suspend.
+
+ --
+ | PRCM |
+  --
+   ^ |
+   swakeup | | fclk
+   | v
+   -----   -
+  | card | -- CIRQ --  | hsmmc | -- IRQ --  | CPU |
+   -----   -
+
+In suspend the fclk is off and the module is disfunctional. Even
+register reads will fail. A small logic in the host will request
+fclk restore, when an external event is detected. Once the clock
+is restored, the host detects the event normally. Since am33xx
+doesn't have this line it never wakes from suspend.
+
+The workaround is to reconfigure the dat1 line as a GPIO upon
+suspend. To make this work, we need to set 1) the named pinctrl
+states default, idle and gpio_dat1, 2) the gpio detecting
+sdio irq in suspend and 3) the compatibe section, see example below.
+The MMC driver will then toggle between gpio_dat1 and default during
+the runtime. If configuration is incomplete, a warning message is
+emitted falling back to polling. Mind not every application
+needs SDIO irq, e.g. MMC cards Affected chips are am335x,
+probably others
+
+
+   mmc1: mmc@48060100 {
+   compatible = ti,am33xx-hsmmc;
+   ...
+   interrupts-extended = intc 64 gpio2 28 0;
+   ...
+   pinctrl-names = default, idle, sleep, gpio_dat1
+   pinctrl-0 = mmc1_pins;
+   pinctrl-1 = mmc1_idle;
+   pinctrl-2 = mmc1_sleep;
+   pinctrl-3 = mmc1_cirq_pin;
+   ...
+   };
+
+   mmc1_cirq_pin: pinmux_cirq_pin {
+   pinctrl-single,pins = 
+   0x0f8 0x3f  /* GPIO2_28 */
+   ;
+   };
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 9cc0d21..8661e1f 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -213,7 +213,10 @@ struct omap_hsmmc_host {
  #define AUTO_CMD23(1  0)/* Auto CMD23 support */
  #define HSMMC_SDIO_IRQ_ENABLED(1  1)/* SDIO irq enabled */
  #define HSMMC_WAKE_IRQ_ENABLED(1  2)
+#define HSMMC_SWAKEUP_QUIRK(1  3)
struct omap_hsmmc_next  next_data;
+   struct pinctrl  *pinctrl;
+   struct pinctrl_state*gpio_pinmux;
struct  omap_mmc_platform_data  *pdata;
  };

@@ -1744,8 +1747,28 @@ static int omap_hsmmc_configure_wake_irq(struct 
omap_hsmmc_host *host)
 * and need to remux SDIO DAT1 to GPIO for wake-up from idle.
 */
if (host-pdata-controller_flags  OMAP_HSMMC_SWAKEUP_MISSING) {
-   ret = -ENODEV;
-   goto err;
+   if (IS_ERR(host-dev-pins-default_state)) {
+   dev_info(host-dev, missing default pinctrl state\n);
+   ret = -EINVAL;
+   goto err;
+   }
+
+   host-pinctrl = devm_pinctrl_get(host-dev);
+   if (IS_ERR(host-pinctrl)) {
+   dev_warn(host-dev, no pinctrl handle\n);
+   ret = -ENODEV;
+   goto err;
+   }
+
+   host-gpio_pinmux = pinctrl_lookup_state(host-pinctrl,
+gpio_dat1);
+   if (IS_ERR(host-gpio_pinmux)) {
+   dev_info(host-dev, missing \gpio_dat1\ pinctrl 
state\n);
+   ret = -ENODEV;
+   goto err;
+   }
+
+   host-flags |= HSMMC_SWAKEUP_QUIRK;
}

devres_remove_group(host-dev, NULL);
@@ -2438,7 +2461,10 @@ static int omap_hsmmc_runtime_suspend(struct device *dev)
goto

Re: [PATCH v10 4/5] mmc: omap_hsmmc: switch default/idle pinctrl states in runtime hooks

2014-05-02 Thread Balaji T K

On Monday 28 April 2014 01:10 PM, Andreas Fenkart wrote:

These are predefined states of the driver model. When not present,
as if not set in the device tree, they simple become no-ops.
So it is always safe to call them.
This is not the simplest implementation, on AM335x at least, we could
witch to idle at any point in the suspend hook, only the default state
needs to be set before writing to the irq registers or an IRQ might get
lost.

Signed-off-by: Andreas Fenkart afenk...@gmail.com

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 76fe3bd..9cc0d21 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1992,7 +1992,6 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
const struct of_device_id *match;
dma_cap_mask_t mask;
unsigned tx_req, rx_req;
-   struct pinctrl *pinctrl;
const struct omap_mmc_of_data *data;

match = of_match_device(of_match_ptr(omap_mmc_of_match), pdev-dev);
@@ -2215,11 +2214,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
}

omap_hsmmc_disable_irq(host);
-
-   pinctrl = devm_pinctrl_get_select_default(pdev-dev);
-   if (IS_ERR(pinctrl))
-   dev_warn(pdev-dev,
-   pins are not configured from the driver\n);
+   pinctrl_pm_select_default_state(host-dev);


This can be removed, since device core layer sets pin mux to default state
before probe.


--
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 v10 2/5] mmc: omap_hsmmc: bug: abort runtime suspend if pending sdio irq detected

2014-05-02 Thread Balaji T K

On Monday 28 April 2014 01:10 PM, Andreas Fenkart wrote:

on multicores, an sdio irq handler could be running in parallel to
runtime suspend. In the worst case it could be waiting for the spinlock
held by the runtime suspend. When runtime suspend is complete and the
functional clock (fclk) turned off, the irq handler will continue and
cause a SIGBUS on the first register access.

Signed-off-by: Andreas Fenkart afenk...@gmail.com

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 700fb91..e675042 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -56,6 +56,7 @@
  #define OMAP_HSMMC_RSP54  0x0118
  #define OMAP_HSMMC_RSP76  0x011C
  #define OMAP_HSMMC_DATA   0x0120
+#define OMAP_HSMMC_PSTATE  0x0124
  #define OMAP_HSMMC_HCTL   0x0128
  #define OMAP_HSMMC_SYSCTL 0x012C
  #define OMAP_HSMMC_STAT   0x0130
@@ -2400,6 +2401,7 @@ static int omap_hsmmc_runtime_suspend(struct device *dev)
  {
struct omap_hsmmc_host *host;
unsigned long flags;
+   int ret = 0;

host = platform_get_drvdata(to_platform_device(dev));
omap_hsmmc_context_save(host);
@@ -2411,14 +2413,29 @@ static int omap_hsmmc_runtime_suspend(struct device 
*dev)
/* disable sdio irq handling to prevent race */
OMAP_HSMMC_WRITE(host-base, ISE, 0);
OMAP_HSMMC_WRITE(host-base, IE, 0);
-   OMAP_HSMMC_WRITE(host-base, STAT, STAT_CLEAR);
+
+   if (!(OMAP_HSMMC_READ(host-base, PSTATE)  BIT(21))) {


Please use #define for BIT(21), something like DLEV_DAT1

--
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 v10 1/5] mmc: omap_hsmmc: Enable SDIO interrupt

2014-05-02 Thread Balaji T K

On Monday 28 April 2014 01:10 PM, Andreas Fenkart wrote:

There have been various patches floating around for enabling
the SDIO IRQ for hsmmc, but none of them ever got merged.

Probably the reason for not merging the SDIO interrupt patches
has been the lack of wake-up path for SDIO on some omaps that
has also needed remuxing the SDIO DAT1 line to a GPIO making
the patches complex.

This patch adds the minimal SDIO IRQ support to hsmmc for
omaps that do have the wake-up path. For those omaps, the
DAT1 line need to have the wake-up enable bit set, and the
wake-up interrupt is the same as for the MMC controller.

This patch has been tested on am3730 es1.2 with mwifiex
connected to MMC3 with mwifiex waking to Ethernet traffic
from off-idle mode. Note that for omaps that do not have
the SDIO wake-up path, this patch will not work for idle
modes and further patches for remuxing DAT1 to GPIO are
needed.

Based on earlier patches [1][2] by David Vrabel
david.vra...@csr.com, Steve Sakoman st...@sakoman.com

For now, only support SDIO interrupt if we are booted with
a separate wake-irq configued via device tree. This is
because omaps need the wake-irq for idle states, and some
omaps need special quirks. And we don't want to add new
legacy mux platform init code callbacks any longer as we
are moving to DT based booting anyways.

To use it, you need to specify the wake-irq using the
interrupts-extended property.

[1] 
http://www.sakoman.com/cgi-bin/gitweb.cgi?p=linux.git;a=commitdiff_plain;h=010810d22f6f49ac03da4ba384969432e0320453
[2] http://comments.gmane.org/gmane.linux.kernel.mmc/20446

Cc: Balaji T K balaj...@ti.com
Signed-off-by: Andreas Fenkart afenk...@gmail.com
Signed-off-by: Tony Lindgren t...@atomide.com

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 272e0ee..700fb91 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -29,6 +29,7 @@
  #include linux/timer.h
  #include linux/clk.h
  #include linux/of.h
+#include linux/of_irq.h
  #include linux/of_gpio.h
  #include linux/of_device.h
  #include linux/omap-dma.h
@@ -36,6 +37,7 @@
  #include linux/mmc/core.h
  #include linux/mmc/mmc.h
  #include linux/io.h
+#include linux/irq.h
  #include linux/gpio.h
  #include linux/regulator/consumer.h
  #include linux/pinctrl/consumer.h
@@ -106,6 +108,7 @@
  #define TC_EN (1  1)
  #define BWR_EN(1  4)
  #define BRR_EN(1  5)
+#define CIRQ_EN(1  8)
  #define ERR_EN(1  15)
  #define CTO_EN(1  16)
  #define CCRC_EN   (1  17)
@@ -140,7 +143,6 @@
  #define VDD_3V0   300 /* 30 uV */
  #define VDD_165_195   (ffs(MMC_VDD_165_195) - 1)

-#define AUTO_CMD23 (1  1)  /* Auto CMD23 support */
  /*
   * One controller can have multiple slots, like on some omap boards using
   * omap.c controller driver. Luckily this is not currently done on any known
@@ -194,6 +196,7 @@ struct omap_hsmmc_host {
u32 sysctl;
u32 capa;
int irq;
+   int wake_irq;
int use_dma, dma_ch;
struct dma_chan *tx_chan;
struct dma_chan *rx_chan;
@@ -206,6 +209,9 @@ struct omap_hsmmc_host {
int req_in_progress;
unsigned long   clk_rate;
unsigned intflags;
+#define AUTO_CMD23 (1  0)/* Auto CMD23 support */
+#define HSMMC_SDIO_IRQ_ENABLED (1  1)/* SDIO irq enabled */
+#define HSMMC_WAKE_IRQ_ENABLED (1  2)
struct omap_hsmmc_next  next_data;
struct  omap_mmc_platform_data  *pdata;
  };
@@ -510,27 +516,40 @@ static void omap_hsmmc_stop_clock(struct omap_hsmmc_host 
*host)
  static void omap_hsmmc_enable_irq(struct omap_hsmmc_host *host,
  struct mmc_command *cmd)
  {
-   unsigned int irq_mask;
+   u32 irq_mask = INT_EN_MASK;
+   unsigned long flags;

if (host-use_dma)
-   irq_mask = INT_EN_MASK  ~(BRR_EN | BWR_EN);
-   else
-   irq_mask = INT_EN_MASK;
+   irq_mask = ~(BRR_EN | BWR_EN);

/* Disable timeout for erases */
if (cmd-opcode == MMC_ERASE)
irq_mask = ~DTO_EN;

+   spin_lock_irqsave(host-irq_lock, flags);
OMAP_HSMMC_WRITE(host-base, STAT, STAT_CLEAR);
OMAP_HSMMC_WRITE(host-base, ISE, irq_mask);
+
+   /* latch pending CIRQ, but don't signal MMC core */
+   if (host-flags  HSMMC_SDIO_IRQ_ENABLED)
+   irq_mask |= CIRQ_EN;
OMAP_HSMMC_WRITE(host-base, IE, irq_mask);
+   spin_unlock_irqrestore(host-irq_lock, flags);
  }

  static void omap_hsmmc_disable_irq(struct omap_hsmmc_host *host)
  {
-   OMAP_HSMMC_WRITE(host-base, ISE, 0

Re: [PATCH 9/9] mmc: omap_hsmmc: enable wakeup event for sdio

2014-05-02 Thread Balaji T K

On Friday 21 March 2014 09:47 PM, Balaji T K wrote:

To detect sdio irqs properly without spurious events,
OMAP4 needs IWE in CON and CTPL, CLKEXTFREE in HCTL to be set

Signed-off-by: Balaji T K balaj...@ti.com

Hi Andreas,

Can you please test this patch on top of your current(v10) series
and confirm that there are no regression due to this
additional programming on your am335x platform.

Thanks and Regards,
Balaji T K

---
  drivers/mmc/host/omap_hsmmc.c |   13 -
  1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 2482783..120f7cf 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -94,7 +94,10 @@
  #define BCE   (1  1)
  #define FOUR_BIT  (1  1)
  #define HSPE  (1  2)
+#define IWE(1  24)
  #define DDR   (1  19)
+#define CLKEXTFREE (1  16)
+#define CTPL   (1  11)
  #define DW8   (1  5)
  #define OD0x1
  #define STAT_CLEAR0x
@@ -732,6 +735,8 @@ static int omap_hsmmc_context_restore(struct 
omap_hsmmc_host *host)
capa = VS18;
}

+   if (host-mmc-caps  MMC_CAP_SDIO_IRQ)
+   hctl |= IWE;
OMAP_HSMMC_WRITE(host-base, HCTL,
OMAP_HSMMC_READ(host-base, HCTL) | hctl);

@@ -1728,7 +1733,7 @@ static void omap_hsmmc_init_card(struct mmc_host *mmc, 
struct mmc_card *card)
  static void omap_hsmmc_enable_sdio_irq(struct mmc_host *mmc, int enable)
  {
struct omap_hsmmc_host *host = mmc_priv(mmc);
-   u32 irq_mask;
+   u32 irq_mask, con;
unsigned long flags;

if (enable)
@@ -1737,14 +1742,18 @@ static void omap_hsmmc_enable_sdio_irq(struct mmc_host 
*mmc, int enable)
if (host-flags  HSMMC_RUNTIME_SUSPENDED)
goto out;

+   con = OMAP_HSMMC_READ(host-base, CON);
irq_mask = OMAP_HSMMC_READ(host-base, ISE);
if (enable) {
host-flags |= HSMMC_SDIO_IRQ_ENABLED;
irq_mask |= CIRQ_EN;
+   con |= CTPL | CLKEXTFREE;
} else {
host-flags = ~HSMMC_SDIO_IRQ_ENABLED;
irq_mask = ~CIRQ_EN;
+   con = ~(CTPL | CLKEXTFREE);
}
+   OMAP_HSMMC_WRITE(host-base, CON, con);
OMAP_HSMMC_WRITE(host-base, IE, irq_mask);

/*
@@ -1801,6 +1810,8 @@ static int omap_hsmmc_configure_wake_irq(struct 
omap_hsmmc_host *host)
}
host-flags |= HSMMC_SWAKEUP_QUIRK;
}
+   OMAP_HSMMC_WRITE(host-base, HCTL,
+OMAP_HSMMC_READ(host-base, HCTL) | IWE);

return 0;
  }



--
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] mmc: host: omap_hsmmc: a few improvements

2014-04-24 Thread Balaji T K

On Thursday 27 March 2014 05:34 AM, Felipe Balbi wrote:

Hi,

this series lets us access the newer registers introduced
back in OMAP4 which give us some valid information about
the OMAP HSMMC IP like max block size, support for ADMA,
support for Retention.


Support for Retention looks interesting, can you shed more lights
on it



Right now, only setting max_blk_size correctly as supporting
ADMA and Retention will take a lot of work.

Tested on OMAP5 uEVM.

Felipe Balbi (5):
   mmc: host: omap_hsmmc: pass host as an argument
   mmc: host: omap_hsmmc: add reg_offset field
   mmc: host: omap_hsmmc: introduce new accessor functions
   mmc: host: omap_hsmmc: switch over to new accessors
   mmc: host: omap_hsmmc: set max_blk_size correctly

  drivers/mmc/host/omap_hsmmc.c | 291 ++
  1 file changed, 182 insertions(+), 109 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 0/5] mmc: host: omap_hsmmc: a few improvements

2014-04-24 Thread Balaji T K

On Thursday 24 April 2014 08:09 PM, Felipe Balbi wrote:

On Thu, Apr 24, 2014 at 08:01:19PM +0530, Balaji T K wrote:

On Thursday 27 March 2014 05:34 AM, Felipe Balbi wrote:

Hi,

this series lets us access the newer registers introduced
back in OMAP4 which give us some valid information about
the OMAP HSMMC IP like max block size, support for ADMA,
support for Retention.


Support for Retention looks interesting, can you shed more lights on
it


HWINFO has a bit (bit 6) which tells you whether retention is supported,
it's in all TRMs since OMAP3630 or so.

6 RERETMODE   Retention mode generic parameter
This bit field indicates whether the
retention mode is supported using the
pin PIRFFRET.

0x0: Retention mode disabled
0x1: Retention mode enabled



I have seen that but just wondering how the driver can make use of it :-)

--
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 3/5] mmc: host: omap_hsmmc: introduce new accessor functions

2014-04-24 Thread Balaji T K

On Thursday 27 March 2014 05:34 AM, Felipe Balbi wrote:

we introduce new accessors which provide for register
access with and without offsets.

This is just to make sure newer versions of the IP
can access the new registers prepended at the beginning
of the address space.

Signed-off-by: Felipe Balbi ba...@ti.com
---
  drivers/mmc/host/omap_hsmmc.c | 36 
  1 file changed, 36 insertions(+)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index d46f768..e596c6a 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -211,6 +211,42 @@ struct omap_hsmmc_host {
struct  omap_mmc_platform_data  *pdata;
  };

+static inline int _omap_hsmmc_read(struct omap_hsmmc_host *host,
+   u32 reg, bool offset)
+{
+   return readl(host-base + reg + (offset ? host-reg_offset : 0));
+}
+
+static inline void _omap_hsmmc_write(struct omap_hsmmc_host *host,
+   u32 reg, u32 val, bool offset)
+{
+   writel(val, host-base + reg + (offset ? host-reg_offset : 0));
+}
+
+static inline int omap_hsmmc_read_offset(struct omap_hsmmc_host *host,


I think you can rename this function as just omap_hsmmc_read
(removing _offset suffix)


+   u32 reg)
+{
+   return _omap_hsmmc_read(host, reg, true);
+}
+
+static inline void omap_hsmmc_write_offset(struct omap_hsmmc_host *host,


and this one as omap_hsmmc_write since this version of read/write is most often
used, the one with no_offset might be used less often.


--
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] mmc: host: omap_hsmmc: a few improvements

2014-04-24 Thread Balaji T K

On Tuesday 22 April 2014 09:18 PM, Felipe Balbi wrote:

Hi,

On Tue, Apr 22, 2014 at 09:00:12PM +0530, Balaji T K wrote:

On Monday 21 April 2014 11:02 PM, Felipe Balbi wrote:

Hi,

On Wed, Mar 26, 2014 at 07:04:45PM -0500, Felipe Balbi wrote:

this series lets us access the newer registers introduced
back in OMAP4 which give us some valid information about
the OMAP HSMMC IP like max block size, support for ADMA,
support for Retention.

Right now, only setting max_blk_size correctly as supporting
ADMA and Retention will take a lot of work.

Tested on OMAP5 uEVM.

Felipe Balbi (5):
   mmc: host: omap_hsmmc: pass host as an argument
   mmc: host: omap_hsmmc: add reg_offset field
   mmc: host: omap_hsmmc: introduce new accessor functions
   mmc: host: omap_hsmmc: switch over to new accessors
   mmc: host: omap_hsmmc: set max_blk_size correctly


Got mislead by your reply to this series, about the alternative way of
reading memory size from CAPA register


sure, we can do that if you prefer, I just felt I wouldn't touch

 platforms I can't really test :-s

I think so, since those 3 newer registers are not documented for all platforms.
Not sure whether it is valid in those cases where it is not documented.

Since capa register has these info and can be
applied uniformly across all paltforms, I feel reading capa register is the
way to go. Do you still think there is a need for new api with no offset ?




this has been here for almost a month, any comments ?



Do you see any performance impact with this series ?


in the normal case ? no... it helps only with large transfers



Do you have the numbers ?
Is it for read or write,
how large should the transfer size be ?

I couldn't get any performance improvements with this patch series,
Could you please share your test setup, may be I am missing something.
--
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] mmc: host: omap_hsmmc: a few improvements

2014-04-22 Thread Balaji T K

On Monday 21 April 2014 11:02 PM, Felipe Balbi wrote:

Hi,

On Wed, Mar 26, 2014 at 07:04:45PM -0500, Felipe Balbi wrote:

this series lets us access the newer registers introduced
back in OMAP4 which give us some valid information about
the OMAP HSMMC IP like max block size, support for ADMA,
support for Retention.

Right now, only setting max_blk_size correctly as supporting
ADMA and Retention will take a lot of work.

Tested on OMAP5 uEVM.

Felipe Balbi (5):
   mmc: host: omap_hsmmc: pass host as an argument
   mmc: host: omap_hsmmc: add reg_offset field
   mmc: host: omap_hsmmc: introduce new accessor functions
   mmc: host: omap_hsmmc: switch over to new accessors
   mmc: host: omap_hsmmc: set max_blk_size correctly


Got mislead by your reply to this series, about the alternative way of
reading memory size from CAPA register



this has been here for almost a month, any comments ?



Do you see any performance impact with this series ?
--
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: OMAP baseline test results for v3.14

2014-04-03 Thread Balaji T K
On Thursday 03 April 2014 07:02 PM, Paolo Pisati wrote:
 On Wed, Apr 02, 2014 at 10:15:13AM -0700, Tony Lindgren wrote:
 Paul uses MMC filesystem, I use NFS. As Felipe Pointed out as well, I
 did rootcause MMC filesystem mount issue here:
 http://marc.info/?l=linux-omapm=139637044425644w=2

 Balaji, care to take a look at the issue for MMC? It may
 be already fixed in next with the PBIAS handling?
 
 it may be related (or not), but i'm experiencing reboot issues with 3.13/.14 
 on
 omap4 (panda), and after a bisection i found out that reverting
 

Do you have any logs for it ?

 commit e002264f7e45d7661b237045577052fd0b40f89c
 Author: Balaji T K balajitk at ti.com
 Date:   Mon Oct 21 00:25:18 2013 +0530
 
  mmc: omap_hsmmc: Fix pbias_disable for omap4
 
  pbias_disable is set to protect the mmc pbias i/o cells in DT boot
  by preventing voltage switch. Currently pbias_disable is enabled only
  for omap3 and not for omap4 due to reg_offset difference of 0x100.
  Enable pbias_disable for omap4+ too by using res-start
  which does not include the reg_offset.
 
  Signed-off-by: Balaji T K balajitk at ti.com
  Signed-off-by: Chris Ball cjb at laptop.org
 
 made it go away: can you point me to those pbias handling patches (i guess
 something about dt-booting handling pbias correctly now)?

It is avaliable in linux-next /mmc-next [1]

[1]
http://git.kernel.org/cgit/linux/kernel/git/cjb/mmc.git/log/?id=refs/heads/mmc-next

mmc: omap_hsmmc: remove pbias workaround
ARM: OMAP: enable SYSCON and REGULATOR_PBIAS in omap2plus_defconfig
ARM: dts: add pbias dt node
mmc: omap_hsmmc: adapt hsmmc to use pbias regulator
regulator: add pbias regulator support
mmc: omap_hsmmc: handle vcc and vcc_aux independently
mmc: omap_hsmmc: use devm_regulator API

Thanks and Regards,
Balaji T K

--
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 6/9] mmc: omap_hsmmc: Enable SDIO interrupt

2014-03-25 Thread Balaji T K

On Tuesday 25 March 2014 01:37 PM, Ulf Hansson wrote:

On 24 March 2014 17:34, Andreas Fenkart afenk...@gmail.com wrote:

2014-03-24 17:02 GMT+01:00 Ulf Hansson ulf.hans...@linaro.org:

On 24 March 2014 15:59, Andreas Fenkart afenk...@gmail.com wrote:

Hi,

2014-03-24 13:43 GMT+01:00 Ulf Hansson ulf.hans...@linaro.org:

On 21 March 2014 17:17, Balaji T K balaj...@ti.com wrote:

From: Andreas Fenkart afenk...@gmail.com

There have been various patches floating around for enabling
the SDIO IRQ for hsmmc, but none of them ever got merged.

Probably the reason for not merging the SDIO interrupt patches
has been the lack of wake-up path for SDIO on some omaps that
has also needed remuxing the SDIO DAT1 line to a GPIO making
the patches complex.

This patch adds the minimal SDIO IRQ support to hsmmc for
omaps that do have the wake-up path. For those omaps, the
DAT1 line need to have the wake-up enable bit set, and the
wake-up interrupt is the same as for the MMC controller.

This patch has been tested on am3730 es1.2 with mwifiex
connected to MMC3 with mwifiex waking to Ethernet traffic
from off-idle mode. Note that for omaps that do not have
the SDIO wake-up path, this patch will not work for idle
modes and further patches for remuxing DAT1 to GPIO are
needed.

Based on earlier patches [1][2] by David Vrabel
david.vra...@csr.com, Steve Sakoman st...@sakoman.com
and Andreas Fenkart afenk...@gmail.com with the SDIO IRQ
handing improved following how sdhci.c is doing it.

For now, only support SDIO interrupt if we are booted with
a separate wake-irq configued via device tree. This is
because omaps need the wake-irq for idle states, and some
omaps need special quirks. And we don't want to add new
legacy mux platform init code callbacks any longer as we
are moving to DT based booting anyways.

To use it, you need to specify the wake-irq using the
interrupts-extended property.

[1] 
http://www.sakoman.com/cgi-bin/gitweb.cgi?p=linux.git;a=commitdiff_plain;h=010810d22f6f49ac03da4ba384969432e0320453
[2] http://comments.gmane.org/gmane.linux.kernel.mmc/20446

Signed-off-by: Andreas Fenkart afenk...@gmail.com
Signed-off-by: Tony Lindgren t...@atomide.com
Signed-off-by: Balaji T K balaj...@ti.com
---
  drivers/mmc/host/omap_hsmmc.c  |  207 ++--
  include/linux/platform_data/mmc-omap.h |1 +
  2 files changed, 196 insertions(+), 12 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 38a75bc..0275e0a 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -29,6 +29,7 @@
  #include linux/timer.h
  #include linux/clk.h
  #include linux/of.h
+#include linux/of_irq.h
  #include linux/of_gpio.h
  #include linux/of_device.h
  #include linux/omap-dma.h
@@ -36,6 +37,7 @@
  #include linux/mmc/core.h
  #include linux/mmc/mmc.h
  #include linux/io.h
+#include linux/irq.h
  #include linux/gpio.h
  #include linux/regulator/consumer.h
  #include linux/pinctrl/consumer.h
@@ -106,6 +108,7 @@
  #define TC_EN  (1  1)
  #define BWR_EN (1  4)
  #define BRR_EN (1  5)
+#define CIRQ_EN(1  8)
  #define ERR_EN (1  15)
  #define CTO_EN (1  16)
  #define CCRC_EN(1  17)
@@ -140,7 +143,6 @@
  #define VDD_3V0300 /* 30 uV */
  #define VDD_165_195(ffs(MMC_VDD_165_195) - 1)

-#define AUTO_CMD23 (1  1)/* Auto CMD23 support */


Previous definition of AUTO_CMD23.


  /*
   * One controller can have multiple slots, like on some omap boards using
   * omap.c controller driver. Luckily this is not currently done on any known
@@ -194,6 +196,7 @@ struct omap_hsmmc_host {
 u32 sysctl;
 u32 capa;
 int irq;
+   int wake_irq;
 int use_dma, dma_ch;
 struct dma_chan *tx_chan;
 struct dma_chan *rx_chan;
@@ -206,6 +209,11 @@ struct omap_hsmmc_host {
 int req_in_progress;
 unsigned long   clk_rate;
 unsigned intflags;
+#define HSMMC_RUNTIME_SUSPENDED (1  0)
+#define AUTO_CMD23 (1  1)/* Auto CMD23 support */


merge conflict here? I do not use HSMMC_RUNTIME_SUSPEND anymore
and of course, neither do I define AUTO_CMD23. :-)



moved AUTO_CMD23 here to avoid overlap /redefinition while re-basing to 
mmc-next.


+#define HSMMC_SWAKEUP_QUIRK(1  2)
+#define HSMMC_SDIO_IRQ_ENABLED (1  3)/* SDIO irq enabled */
+#define HSMMC_WAKE_IRQ_ENABLED (1  4)
 struct omap_hsmmc_next  next_data;
 struct  omap_mmc_platform_data  *pdata;
  };
@@ -510,27 +518,40 @@ static void omap_hsmmc_stop_clock(struct omap_hsmmc_host 
*host)
  static void omap_hsmmc_enable_irq(struct omap_hsmmc_host *host

Re: [PATCH v9 resend 1/3] mmc: omap_hsmmc: Enable SDIO interrupt

2014-03-21 Thread Balaji T K

On Friday 21 March 2014 05:50 PM, Andreas Fenkart wrote:

Thanks Andreas for the patch series

I rebased against latest mmc-next, made few changes to your patch.
I have hosted your series along with devm cleanups on a branch[1] for testing
[1]
git://git.ti.com/~balajitk/ti-linux-kernel/omap-hsmmc.git 
omap_hsmmc_sdio_irq_devm_cleanup

Can you please test on your platform and provide feedback.

Details about the changes below.


diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
@@ -1088,6 +1113,45 @@ static irqreturn_t omap_hsmmc_irq(int irq, void *dev_id)
return IRQ_HANDLED;
  }

+static inline void hsmmc_enable_wake_irq(struct omap_hsmmc_host *host)
+{
+   unsigned long flags;
+
+   if (!host-wake_irq)
+   return;
+
+   spin_lock_irqsave(host-irq_lock, flags);
+   enable_irq(host-wake_irq);
+   host-wake_irq_en = true;


Using wake_irq_en flag leads to wake_irq enabled always after
suspend/resume due to unbalanced disable/enable_irq
so adding back HSMMC_WAKE_IRQ_ENABLED to host-flags


+   spin_unlock_irqrestore(host-irq_lock, flags);
+}
+
+static inline void hsmmc_disable_wake_irq(struct omap_hsmmc_host *host)
+{
+   unsigned long flags;
+
+   if (!host-wake_irq)
+   return;
+
+   spin_lock_irqsave(host-irq_lock, flags);
+   if (host-wake_irq_en)
+   disable_irq_nosync(host-wake_irq);
+   host-wake_irq_en = false;
+   spin_unlock_irqrestore(host-irq_lock, flags);
+}
+
+static irqreturn_t omap_hsmmc_wake_irq(int irq, void *dev_id)
+{
+   struct omap_hsmmc_host *host = dev_id;
+
+   /* cirq is level triggered, disable to avoid infinite loop */
+   hsmmc_disable_wake_irq(host);
+
+   pm_request_resume(host-dev); /* no use counter */
+
+   return IRQ_HANDLED;
+}
+
  static void set_sd_bus_power(struct omap_hsmmc_host *host)
  {
unsigned long i;
@@ -1591,6 +1655,72 @@ static void omap_hsmmc_init_card(struct mmc_host *mmc, 
struct mmc_card *card)
mmc_slot(host).init_card(card);
  }

+static void omap_hsmmc_enable_sdio_irq(struct mmc_host *mmc, int enable)
+{
+   struct omap_hsmmc_host *host = mmc_priv(mmc);
+   u32 irq_mask;
+   unsigned long flags;
+
+   spin_lock_irqsave(host-irq_lock, flags);
+


Introduced check for runtime suspend to be sure and explicitly
enable clocks using runtime_get_sync for enable sdio irq path.


+   irq_mask = OMAP_HSMMC_READ(host-base, ISE);
+   if (enable) {
+   host-flags |= HSMMC_SDIO_IRQ_ENABLED;
+   irq_mask |= CIRQ_EN;
+   } else {
+   host-flags = ~HSMMC_SDIO_IRQ_ENABLED;
+   irq_mask = ~CIRQ_EN;
+   }
+   OMAP_HSMMC_WRITE(host-base, IE, irq_mask);
+
+   /*
+* if enable, piggy back detection on current request
+* but always disable immediately
+*/
+   if (!host-req_in_progress || !enable)
+   OMAP_HSMMC_WRITE(host-base, ISE, irq_mask);
+
+   /* flush posted write */
+   OMAP_HSMMC_READ(host-base, IE);
+
+   spin_unlock_irqrestore(host-irq_lock, flags);
+}
+
+static int omap_hscmm_configure_wake_irq(struct omap_hsmmc_host *host)
+{
+   struct mmc_host *mmc = host-mmc;
+   int ret;
+
+   /*
+* The wake-irq is needed for omaps with wake-up path and also
+* when doing GPIO remuxing, because omap_hsmmc is doing runtime PM.
+* So there's nothing stopping from shutting it down. And there's
+* really no need to block runtime PM for it as it's working.
+*/
+   if (!host-dev-of_node || !host-wake_irq)
+   return -ENODEV;
+
+   /* Prevent auto-enabling of IRQ */
+   irq_set_status_flags(host-wake_irq, IRQ_NOAUTOEN);
+   ret = request_irq(host-wake_irq, omap_hsmmc_wake_irq,
+ IRQF_TRIGGER_LOW | IRQF_ONESHOT,
+ mmc_hostname(mmc), host);


Replaced request_irq with devm_request_irq


+   if (ret) {
+   dev_err(mmc_dev(host-mmc),
+   Unable to request wake IRQ\n);
+   return ret;
+   }
+
+   /*
+* Some omaps don't have wake-up path from deeper idle states
+* and need to remux SDIO DAT1 to GPIO for wake-up from idle.
+*/
+   if (host-pdata-controller_flags  OMAP_HSMMC_SWAKEUP_MISSING)
+   host-flags |= HSMMC_SWAKEUP_QUIRK;
+
+   return 0;
+}
+
  static void omap_hsmmc_conf_bus_power(struct omap_hsmmc_host *host)
  {
u32 hctl, capa, value;
@@ -1643,7 +1773,7 @@ static const struct mmc_host_ops omap_hsmmc_ops = {
.get_cd = omap_hsmmc_get_cd,
.get_ro = omap_hsmmc_get_ro,
.init_card = omap_hsmmc_init_card,
-   /* NYET -- enable_sdio_irq */
+   .enable_sdio_irq = omap_hsmmc_enable_sdio_irq,
  };

  #ifdef CONFIG_DEBUG_FS
@@ -1704,8 +1834,19 @@ static void omap_hsmmc_debugfs(struct mmc_host *mmc)

  #endif

+struct of_data {
+   

[PATCH 1/9] mmc: omap_hsmmc: use devm_clk_get

2014-03-21 Thread Balaji T K
With devm_clk_get conversion clk_put can be removed in clean up path

Signed-off-by: Balaji T K balaj...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c |   15 ---
 1 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index e91ee21..578e983 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1922,7 +1922,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
 
spin_lock_init(host-irq_lock);
 
-   host-fclk = clk_get(pdev-dev, fck);
+   host-fclk = devm_clk_get(pdev-dev, fck);
if (IS_ERR(host-fclk)) {
ret = PTR_ERR(host-fclk);
host-fclk = NULL;
@@ -1941,7 +1941,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
 
omap_hsmmc_context_save(host);
 
-   host-dbclk = clk_get(pdev-dev, mmchsdb_fck);
+   host-dbclk = devm_clk_get(pdev-dev, mmchsdb_fck);
/*
 * MMC can still work without debounce clock.
 */
@@ -1949,7 +1949,6 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
host-dbclk = NULL;
} else if (clk_prepare_enable(host-dbclk) != 0) {
dev_warn(mmc_dev(host-mmc), Failed to enable debounce clk\n);
-   clk_put(host-dbclk);
host-dbclk = NULL;
}
 
@@ -2105,11 +2104,8 @@ err_irq:
dma_release_channel(host-rx_chan);
pm_runtime_put_sync(host-dev);
pm_runtime_disable(host-dev);
-   clk_put(host-fclk);
-   if (host-dbclk) {
+   if (host-dbclk)
clk_disable_unprepare(host-dbclk);
-   clk_put(host-dbclk);
-   }
 err1:
iounmap(host-base);
mmc_free_host(mmc);
@@ -2144,11 +2140,8 @@ static int omap_hsmmc_remove(struct platform_device 
*pdev)
 
pm_runtime_put_sync(host-dev);
pm_runtime_disable(host-dev);
-   clk_put(host-fclk);
-   if (host-dbclk) {
+   if (host-dbclk)
clk_disable_unprepare(host-dbclk);
-   clk_put(host-dbclk);
-   }
 
omap_hsmmc_gpio_free(host-pdata);
iounmap(host-base);
-- 
1.7.5.4

--
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 2/9] mmc: omap_hsmmc: use devm_request_irq

2014-03-21 Thread Balaji T K
With devm_request_irq conversion free_irq can be removed in clean up path

Signed-off-by: Balaji T K balaj...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c |7 ++-
 1 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 578e983..4a3bb4b 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -2017,7 +2017,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
}
 
/* Request IRQ for MMC operations */
-   ret = request_irq(host-irq, omap_hsmmc_irq, 0,
+   ret = devm_request_irq(pdev-dev, host-irq, omap_hsmmc_irq, 0,
mmc_hostname(mmc), host);
if (ret) {
dev_err(mmc_dev(host-mmc), Unable to grab HSMMC IRQ\n);
@@ -2028,7 +2028,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
if (pdata-init(pdev-dev) != 0) {
dev_err(mmc_dev(host-mmc),
Unable to configure MMC IRQs\n);
-   goto err_irq_cd_init;
+   goto err_irq;
}
}
 
@@ -2095,8 +2095,6 @@ err_irq_cd:
 err_reg:
if (host-pdata-cleanup)
host-pdata-cleanup(pdev-dev);
-err_irq_cd_init:
-   free_irq(host-irq, host);
 err_irq:
if (host-tx_chan)
dma_release_channel(host-tx_chan);
@@ -2129,7 +2127,6 @@ static int omap_hsmmc_remove(struct platform_device *pdev)
omap_hsmmc_reg_put(host);
if (host-pdata-cleanup)
host-pdata-cleanup(pdev-dev);
-   free_irq(host-irq, host);
if (mmc_slot(host).card_detect_irq)
free_irq(mmc_slot(host).card_detect_irq, host);
 
-- 
1.7.5.4

--
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 0/9] mmc: omap_hsmmc: convert to use devm_* and enable sdio irq

2014-03-21 Thread Balaji T K
Andreas Fenkart (3):
  mmc: omap_hsmmc: Enable SDIO interrupt
  mmc: omap_hsmmc: Pin remux workaround to support SDIO interrupt on
AM335x
  mmc: omap_hsmmc: Extend debugfs for SDIO IRQ, GPIO and pinmux

Balaji T K (6):
  mmc: omap_hsmmc: use devm_clk_get
  mmc: omap_hsmmc: use devm_request_irq
  mmc: omap_hsmmc: use devm_request_threaded_irq
  mmc: omap_hsmmc: use devm_request_mem_region
  mmc: omap_hsmmc: use devm_ioremap
  mmc: omap_hsmmc: enable wakeup event for sdio

 .../devicetree/bindings/mmc/ti-omap-hsmmc.txt  |   50 +++
 drivers/mmc/host/omap_hsmmc.c  |  349 +---
 include/linux/platform_data/mmc-omap.h |1 +
 3 files changed, 346 insertions(+), 54 deletions(-)

-- 
1.7.5.4

--
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 3/9] mmc: omap_hsmmc: use devm_request_threaded_irq

2014-03-21 Thread Balaji T K
With devm_request_threaded_irq conversion free_irq can be removed
in clean up path

Signed-off-by: Balaji T K balaj...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c |9 +++--
 1 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 4a3bb4b..8e35a6e 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -2043,9 +2043,9 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
 
/* Request IRQ for card detect */
if ((mmc_slot(host).card_detect_irq)) {
-   ret = request_threaded_irq(mmc_slot(host).card_detect_irq,
-  NULL,
-  omap_hsmmc_detect,
+   ret = devm_request_threaded_irq(pdev-dev,
+   mmc_slot(host).card_detect_irq,
+   NULL, omap_hsmmc_detect,
   IRQF_TRIGGER_RISING | 
IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
   mmc_hostname(mmc), host);
if (ret) {
@@ -2088,7 +2088,6 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
 
 err_slot_name:
mmc_remove_host(mmc);
-   free_irq(mmc_slot(host).card_detect_irq, host);
 err_irq_cd:
if (host-use_reg)
omap_hsmmc_reg_put(host);
@@ -2127,8 +2126,6 @@ static int omap_hsmmc_remove(struct platform_device *pdev)
omap_hsmmc_reg_put(host);
if (host-pdata-cleanup)
host-pdata-cleanup(pdev-dev);
-   if (mmc_slot(host).card_detect_irq)
-   free_irq(mmc_slot(host).card_detect_irq, host);
 
if (host-tx_chan)
dma_release_channel(host-tx_chan);
-- 
1.7.5.4

--
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 5/9] mmc: omap_hsmmc: use devm_ioremap

2014-03-21 Thread Balaji T K
With devm_ioremap conversion iounmap can be removed in clean up path

Signed-off-by: Balaji T K balaj...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c |4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 9952673..38a75bc 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1905,7 +1905,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
host-irq   = irq;
host-slot_id   = 0;
host-mapbase   = res-start + pdata-reg_offset;
-   host-base  = ioremap(host-mapbase, SZ_4K);
+   host-base  = devm_ioremap(pdev-dev, host-mapbase, SZ_4K);
host-power_mode = MMC_POWER_OFF;
host-next_data.cookie = 1;
host-pbias_enabled = 0;
@@ -2105,7 +2105,6 @@ err_irq:
if (host-dbclk)
clk_disable_unprepare(host-dbclk);
 err1:
-   iounmap(host-base);
mmc_free_host(mmc);
 err_alloc:
omap_hsmmc_gpio_free(pdata);
@@ -2135,7 +2134,6 @@ static int omap_hsmmc_remove(struct platform_device *pdev)
clk_disable_unprepare(host-dbclk);
 
omap_hsmmc_gpio_free(host-pdata);
-   iounmap(host-base);
mmc_free_host(host-mmc);
 
return 0;
-- 
1.7.5.4

--
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 6/9] mmc: omap_hsmmc: Enable SDIO interrupt

2014-03-21 Thread Balaji T K
From: Andreas Fenkart afenk...@gmail.com

There have been various patches floating around for enabling
the SDIO IRQ for hsmmc, but none of them ever got merged.

Probably the reason for not merging the SDIO interrupt patches
has been the lack of wake-up path for SDIO on some omaps that
has also needed remuxing the SDIO DAT1 line to a GPIO making
the patches complex.

This patch adds the minimal SDIO IRQ support to hsmmc for
omaps that do have the wake-up path. For those omaps, the
DAT1 line need to have the wake-up enable bit set, and the
wake-up interrupt is the same as for the MMC controller.

This patch has been tested on am3730 es1.2 with mwifiex
connected to MMC3 with mwifiex waking to Ethernet traffic
from off-idle mode. Note that for omaps that do not have
the SDIO wake-up path, this patch will not work for idle
modes and further patches for remuxing DAT1 to GPIO are
needed.

Based on earlier patches [1][2] by David Vrabel
david.vra...@csr.com, Steve Sakoman st...@sakoman.com
and Andreas Fenkart afenk...@gmail.com with the SDIO IRQ
handing improved following how sdhci.c is doing it.

For now, only support SDIO interrupt if we are booted with
a separate wake-irq configued via device tree. This is
because omaps need the wake-irq for idle states, and some
omaps need special quirks. And we don't want to add new
legacy mux platform init code callbacks any longer as we
are moving to DT based booting anyways.

To use it, you need to specify the wake-irq using the
interrupts-extended property.

[1] 
http://www.sakoman.com/cgi-bin/gitweb.cgi?p=linux.git;a=commitdiff_plain;h=010810d22f6f49ac03da4ba384969432e0320453
[2] http://comments.gmane.org/gmane.linux.kernel.mmc/20446

Signed-off-by: Andreas Fenkart afenk...@gmail.com
Signed-off-by: Tony Lindgren t...@atomide.com
Signed-off-by: Balaji T K balaj...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c  |  207 ++--
 include/linux/platform_data/mmc-omap.h |1 +
 2 files changed, 196 insertions(+), 12 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 38a75bc..0275e0a 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -29,6 +29,7 @@
 #include linux/timer.h
 #include linux/clk.h
 #include linux/of.h
+#include linux/of_irq.h
 #include linux/of_gpio.h
 #include linux/of_device.h
 #include linux/omap-dma.h
@@ -36,6 +37,7 @@
 #include linux/mmc/core.h
 #include linux/mmc/mmc.h
 #include linux/io.h
+#include linux/irq.h
 #include linux/gpio.h
 #include linux/regulator/consumer.h
 #include linux/pinctrl/consumer.h
@@ -106,6 +108,7 @@
 #define TC_EN  (1  1)
 #define BWR_EN (1  4)
 #define BRR_EN (1  5)
+#define CIRQ_EN(1  8)
 #define ERR_EN (1  15)
 #define CTO_EN (1  16)
 #define CCRC_EN(1  17)
@@ -140,7 +143,6 @@
 #define VDD_3V0300 /* 30 uV */
 #define VDD_165_195(ffs(MMC_VDD_165_195) - 1)
 
-#define AUTO_CMD23 (1  1)/* Auto CMD23 support */
 /*
  * One controller can have multiple slots, like on some omap boards using
  * omap.c controller driver. Luckily this is not currently done on any known
@@ -194,6 +196,7 @@ struct omap_hsmmc_host {
u32 sysctl;
u32 capa;
int irq;
+   int wake_irq;
int use_dma, dma_ch;
struct dma_chan *tx_chan;
struct dma_chan *rx_chan;
@@ -206,6 +209,11 @@ struct omap_hsmmc_host {
int req_in_progress;
unsigned long   clk_rate;
unsigned intflags;
+#define HSMMC_RUNTIME_SUSPENDED (1  0)
+#define AUTO_CMD23 (1  1)/* Auto CMD23 support */
+#define HSMMC_SWAKEUP_QUIRK(1  2)
+#define HSMMC_SDIO_IRQ_ENABLED (1  3)/* SDIO irq enabled */
+#define HSMMC_WAKE_IRQ_ENABLED (1  4)
struct omap_hsmmc_next  next_data;
struct  omap_mmc_platform_data  *pdata;
 };
@@ -510,27 +518,40 @@ static void omap_hsmmc_stop_clock(struct omap_hsmmc_host 
*host)
 static void omap_hsmmc_enable_irq(struct omap_hsmmc_host *host,
  struct mmc_command *cmd)
 {
-   unsigned int irq_mask;
+   u32 irq_mask = INT_EN_MASK;
+   unsigned long flags;
 
if (host-use_dma)
-   irq_mask = INT_EN_MASK  ~(BRR_EN | BWR_EN);
-   else
-   irq_mask = INT_EN_MASK;
+   irq_mask = ~(BRR_EN | BWR_EN);
 
/* Disable timeout for erases */
if (cmd-opcode == MMC_ERASE)
irq_mask = ~DTO_EN;
 
+   spin_lock_irqsave(host-irq_lock, flags);
OMAP_HSMMC_WRITE(host-base, STAT, STAT_CLEAR);
OMAP_HSMMC_WRITE(host-base, ISE, irq_mask);
+
+   /* latch pending CIRQ, but don't signal MMC core

[PATCH 4/9] mmc: omap_hsmmc: use devm_request_mem_region

2014-03-21 Thread Balaji T K
With devm_request_mem_region conversion release_mem_region can be
removed in clean up path

Signed-off-by: Balaji T K balaj...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c |   11 ++-
 1 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 8e35a6e..9952673 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1881,7 +1881,8 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
if (res == NULL || irq  0)
return -ENXIO;
 
-   res = request_mem_region(res-start, resource_size(res), pdev-name);
+   res = devm_request_mem_region(pdev-dev, res-start,
+   resource_size(res), pdev-name);
if (res == NULL)
return -EBUSY;
 
@@ -2109,16 +2110,12 @@ err1:
 err_alloc:
omap_hsmmc_gpio_free(pdata);
 err:
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   if (res)
-   release_mem_region(res-start, resource_size(res));
return ret;
 }
 
 static int omap_hsmmc_remove(struct platform_device *pdev)
 {
struct omap_hsmmc_host *host = platform_get_drvdata(pdev);
-   struct resource *res;
 
pm_runtime_get_sync(host-dev);
mmc_remove_host(host-mmc);
@@ -2141,10 +2138,6 @@ static int omap_hsmmc_remove(struct platform_device 
*pdev)
iounmap(host-base);
mmc_free_host(host-mmc);
 
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   if (res)
-   release_mem_region(res-start, resource_size(res));
-
return 0;
 }
 
-- 
1.7.5.4

--
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 7/9] mmc: omap_hsmmc: Pin remux workaround to support SDIO interrupt on AM335x

2014-03-21 Thread Balaji T K
From: Andreas Fenkart afenk...@gmail.com

The am335x can't detect pending cirq in PM runtime suspend.
This patch reconfigures dat1 as a GPIO before going to suspend.
SDIO interrupts are detected with the GPIO, the GPIO will only wake
the module from suspend, SDIO irq detection will still happen through the
IP block.

Idea of remuxing the pins and some minor changes by Tony Lindgren.

Signed-off-by: Andreas Fenkart afenk...@gmail.com
Signed-off-by: Tony Lindgren t...@atomide.com
Signed-off-by: Balaji T K balaj...@ti.com
---
 .../devicetree/bindings/mmc/ti-omap-hsmmc.txt  |   50 +
 drivers/mmc/host/omap_hsmmc.c  |   74 +---
 2 files changed, 113 insertions(+), 11 deletions(-)

diff --git a/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt 
b/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt
index ce80561..0f9b426 100644
--- a/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt
+++ b/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt
@@ -56,3 +56,53 @@ Examples:
edma 25;
dma-names = tx, rx;
};
+
+[workaround for missing swakeup on am33xx]
+
+This SOC is missing the swakeup line, it will not detect SDIO irq
+while in suspend.
+
+ --
+ | PRCM |
+  --
+   ^ |
+   swakeup | | fclk
+   | v
+   -----   -
+  | card | -- CIRQ --  | hsmmc | -- IRQ --  | CPU |
+   -----   -
+
+In suspend the fclk is off and the module is disfunctional. Even
+register reads will fail. A small logic in the host will request
+fclk restore, when an external event is detected. Once the clock
+is restored, the host detects the event normally. Since am33xx
+doesn't have this line it never wakes from suspend.
+
+The workaround is to reconfigure the dat1 line as a GPIO upon
+suspend. To make this work, we need to set 1) the named pinctrl
+states default, active and idle, 2) the gpio detecting
+sdio irq in suspend and 3) compatibe section, see example below.
+The MMC driver will then toggle between active and idle during
+the runtime. If configuration is incomplete, a warning message is
+emitted falling back to polling.  Mind not every application
+needs SDIO irq, e.g. MMC cards Affected chips are am335x,
+probably others
+
+
+   mmc1: mmc@48060100 {
+   compatible = ti,am33xx-hsmmc;
+   ...
+   interrupts-extended = intc 64 gpio2 28 0;
+   ...
+   pinctrl-names = default, active, idle
+   pinctrl-0 = mmc1_pins;
+   pinctrl-1 = mmc1_pins;
+   pinctrl-2 = mmc1_cirq_pin;
+   ...
+   };
+
+   mmc1_cirq_pin: pinmux_cirq_pin {
+   pinctrl-single,pins = 
+   0x0f8 0x3f  /* GPIO2_28 */
+   ;
+   };
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 0275e0a..dc23ac7 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -215,6 +215,8 @@ struct omap_hsmmc_host {
 #define HSMMC_SDIO_IRQ_ENABLED (1  3)/* SDIO irq enabled */
 #define HSMMC_WAKE_IRQ_ENABLED (1  4)
struct omap_hsmmc_next  next_data;
+   struct pinctrl  *pinctrl;
+   struct pinctrl_state*active;
struct  omap_mmc_platform_data  *pdata;
 };
 
@@ -495,6 +497,47 @@ static void omap_hsmmc_gpio_free(struct 
omap_mmc_platform_data *pdata)
gpio_free(pdata-slots[0].switch_pin);
 }
 
+static int omap_hsmmc_pin_init(struct omap_hsmmc_host *host)
+{
+   struct pinctrl *_pinctrl;
+   int ret;
+
+   _pinctrl = devm_pinctrl_get(host-dev);
+   if (IS_ERR(_pinctrl)) {
+   /* okay, if the bootloader set it up right */
+   dev_warn(host-dev, no pinctrl handle\n);
+   return 0;
+   }
+
+   /* For most cases we don't have wake-ups, and exit after this */
+   host-active = pinctrl_lookup_state(_pinctrl, active);
+   if (IS_ERR(host-active)) {
+   ret = PTR_ERR(host-active);
+   host-active = NULL;
+   goto done;
+   }
+
+   /* Let's make sure the active and idle states work */
+   ret = pinctrl_pm_select_idle_state(host-dev);
+   if (ret  0)
+   goto err;
+
+   ret = pinctrl_select_state(_pinctrl, host-active);
+   if (ret  0)
+   goto err;
+
+   dev_info(mmc_dev(host-mmc), pins configured for wake-up events\n);
+
+done:
+   host-pinctrl = _pinctrl;
+   return 0;
+
+err:
+   dev_err(mmc_dev(host-mmc), pins configuration error: %i\n, ret);
+   devm_pinctrl_put(_pinctrl);
+   return ret;
+}
+
 /*
  * Start clock to the card
  */
@@ -1737,7 +1780,7 @@ static int

[PATCH 8/9] mmc: omap_hsmmc: Extend debugfs for SDIO IRQ, GPIO and pinmux

2014-03-21 Thread Balaji T K
From: Andreas Fenkart afenk...@gmail.com

Add SDIO IRQ entries to debugfs entry. Note that PSTATE shows current
state of data lines, incl. SDIO IRQ pending

Signed-off-by: Andreas Fenkart afenk...@gmail.com
Signed-off-by: Tony Lindgren t...@atomide.com
Signed-off-by: Balaji T K balaj...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c |   23 ---
 1 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index dc23ac7..2482783 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -56,6 +56,7 @@
 #define OMAP_HSMMC_RSP54   0x0118
 #define OMAP_HSMMC_RSP76   0x011C
 #define OMAP_HSMMC_DATA0x0120
+#define OMAP_HSMMC_PSTATE  0x0124
 #define OMAP_HSMMC_HCTL0x0128
 #define OMAP_HSMMC_SYSCTL  0x012C
 #define OMAP_HSMMC_STAT0x0130
@@ -1865,14 +1866,30 @@ static int omap_hsmmc_regs_show(struct seq_file *s, 
void *data)
 {
struct mmc_host *mmc = s-private;
struct omap_hsmmc_host *host = mmc_priv(mmc);
+   const char *cirq_state;
+   bool suspended;
 
-   seq_printf(s, mmc%d:\n ctx_loss:\t%d\n\nregs:\n,
-   mmc-index, host-context_loss);
+   seq_printf(s, mmc%d:\n, mmc-index);
+   if (mmc-caps  MMC_CAP_SDIO_IRQ)
+   cirq_state = (host-flags  HSMMC_SDIO_IRQ_ENABLED) ?
+   enabled : disabled;
+   else
+   cirq_state = polling;
+   seq_printf(s, sdio irq\t%s\n, cirq_state);
 
-   pm_runtime_get_sync(host-dev);
+   if (host-flags  HSMMC_SWAKEUP_QUIRK) {
+   suspended = host-dev-power.runtime_status != RPM_ACTIVE;
+   seq_printf(s, pinmux config\t%s\n, (suspended ?
+ gpio : sdio));
+   }
+   seq_printf(s, ctx_loss:\t%d\n, host-context_loss);
 
+   pm_runtime_get_sync(host-dev);
+   seq_puts(s, \nregs:\n);
seq_printf(s, CON:\t\t0x%08x\n,
OMAP_HSMMC_READ(host-base, CON));
+   seq_printf(s, PSTATE:\t\t0x%08x\n,
+  OMAP_HSMMC_READ(host-base, PSTATE));
seq_printf(s, HCTL:\t\t0x%08x\n,
OMAP_HSMMC_READ(host-base, HCTL));
seq_printf(s, SYSCTL:\t\t0x%08x\n,
-- 
1.7.5.4

--
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 9/9] mmc: omap_hsmmc: enable wakeup event for sdio

2014-03-21 Thread Balaji T K
To detect sdio irqs properly without spurious events,
OMAP4 needs IWE in CON and CTPL, CLKEXTFREE in HCTL to be set

Signed-off-by: Balaji T K balaj...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c |   13 -
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 2482783..120f7cf 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -94,7 +94,10 @@
 #define BCE(1  1)
 #define FOUR_BIT   (1  1)
 #define HSPE   (1  2)
+#define IWE(1  24)
 #define DDR(1  19)
+#define CLKEXTFREE (1  16)
+#define CTPL   (1  11)
 #define DW8(1  5)
 #define OD 0x1
 #define STAT_CLEAR 0x
@@ -732,6 +735,8 @@ static int omap_hsmmc_context_restore(struct 
omap_hsmmc_host *host)
capa = VS18;
}
 
+   if (host-mmc-caps  MMC_CAP_SDIO_IRQ)
+   hctl |= IWE;
OMAP_HSMMC_WRITE(host-base, HCTL,
OMAP_HSMMC_READ(host-base, HCTL) | hctl);
 
@@ -1728,7 +1733,7 @@ static void omap_hsmmc_init_card(struct mmc_host *mmc, 
struct mmc_card *card)
 static void omap_hsmmc_enable_sdio_irq(struct mmc_host *mmc, int enable)
 {
struct omap_hsmmc_host *host = mmc_priv(mmc);
-   u32 irq_mask;
+   u32 irq_mask, con;
unsigned long flags;
 
if (enable)
@@ -1737,14 +1742,18 @@ static void omap_hsmmc_enable_sdio_irq(struct mmc_host 
*mmc, int enable)
if (host-flags  HSMMC_RUNTIME_SUSPENDED)
goto out;
 
+   con = OMAP_HSMMC_READ(host-base, CON);
irq_mask = OMAP_HSMMC_READ(host-base, ISE);
if (enable) {
host-flags |= HSMMC_SDIO_IRQ_ENABLED;
irq_mask |= CIRQ_EN;
+   con |= CTPL | CLKEXTFREE;
} else {
host-flags = ~HSMMC_SDIO_IRQ_ENABLED;
irq_mask = ~CIRQ_EN;
+   con = ~(CTPL | CLKEXTFREE);
}
+   OMAP_HSMMC_WRITE(host-base, CON, con);
OMAP_HSMMC_WRITE(host-base, IE, irq_mask);
 
/*
@@ -1801,6 +1810,8 @@ static int omap_hsmmc_configure_wake_irq(struct 
omap_hsmmc_host *host)
}
host-flags |= HSMMC_SWAKEUP_QUIRK;
}
+   OMAP_HSMMC_WRITE(host-base, HCTL,
+OMAP_HSMMC_READ(host-base, HCTL) | IWE);
 
return 0;
 }
-- 
1.7.5.4

--
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 4/9] mmc: omap_hsmmc: use devm_request_mem_region

2014-03-21 Thread Balaji T K

On Friday 21 March 2014 09:48 PM, Felipe Balbi wrote:

On Fri, Mar 21, 2014 at 09:47:33PM +0530, Balaji T K wrote:

With devm_request_mem_region conversion release_mem_region can be
removed in clean up path

Signed-off-by: Balaji T K balaj...@ti.com
---
  drivers/mmc/host/omap_hsmmc.c |   11 ++-
  1 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 8e35a6e..9952673 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1881,7 +1881,8 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
if (res == NULL || irq  0)
return -ENXIO;

-   res = request_mem_region(res-start, resource_size(res), pdev-name);
+   res = devm_request_mem_region(pdev-dev, res-start,
+   resource_size(res), pdev-name);


while at that, why don't you switch over to devm_ioremap_resource()
already ?


I can't do that because of 0x100 reg_offset on OMAP4+ and am335x+

Thanks and Regards,
Balaji T K
--
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] mmc: omap_hsmmc: Enable SDIO IRQ.

2014-03-07 Thread Balaji T K

On Wednesday 05 March 2014 02:00 PM, Andreas Fenkart wrote:

Hi,

2014-02-28 18:04 GMT+01:00 Balaji T K balaj...@ti.com:

On Tuesday 25 February 2014 06:07 PM, Andreas Fenkart wrote:


For now, only support SDIO interrupt if we are booted with
DT. This is because some platforms need special quirks. And
we don't want to add new legacy mux platform init code
callbacks any longer as we are moving to DT based booting
anyways.

Signed-off-by: Andreas Fenkart afenk...@gmail.com

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index a5a38cc..bd3bb0c 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c



snip



@@ -1705,7 +1757,18 @@ static void omap_hsmmc_debugfs(struct mmc_host
*mmc)
   #endif

   #ifdef CONFIG_OF
-static u16 omap4_reg_offset = 0x100;
+struct of_data {
+   u16 offset;
+   int flags;
+};
+


Hi Andreas,

struct of_data declaration needs to be moved out of #ifdef CONFIG_OF
for !CONFIG_OF build.

should be fixed with new version



I tried testing this patch series on am335x, I see throughput in the
range of KBs. Will give another try with Tony's version.

KB sounds really bad, even with polling I have  5MBytes/s.

Could you pls paste
# cat /sys/kernel/debug/mmc0/regs


Hi,

Find below debug reg dump

mmc0:
sdio irqenabled
pinmux config   sdio
ctx_loss:   1

regs:
CON:0x0600
PSTATE: 0x01f7
HCTL:   0x0d06
SYSCTL: 0x000d0087
IE: 0x0100
ISE:0x0100
CAPA:   0x06e10080

--
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 RESEND] mmc: omap_hsmmc: support more DT properties

2014-03-04 Thread Balaji T K

On Tuesday 04 March 2014 02:46 AM, Daniel Mack wrote:

This should probably be done implicitly through mmc_of_parse(), but that
doesn't play well along with the multi-slot model the hsmmc driver
features. Hence, for now, do it manually. The properties are already
documented in Documentation/devicetree/bindings/mmc/mmc.txt.

Signed-off-by: Daniel Mack zon...@gmail.com
Acked-by: Balaji T K balaj...@ti.com
---
This is a resend of a patch that was already acked by Balaji T K:

   http://www.spinics.net/lists/linux-mmc/msg25029.html


Hi Chris,

To make it easier for you, I have collected omap_hsmmc patches [1]
and pushed a branch omap_hsmmc-for-3.15 based on 3.14rc2.

Please pull or cherry pick

The following changes since commit b28a960c42fcd9cfc987441fa6d1c1a471f0f9ed:

  Linux 3.14-rc2 (2014-02-09 18:15:47 -0800)

are available in the git repository at:
  git://git.ti.com/~balajitk/ti-linux-kernel/omap-hsmmc.git omap_hsmmc-for-3.15

Balaji T K (14):
  mmc: omap_hsmmc: use devm_regulator API
  mmc: omap_hsmmc: handle vcc and vcc_aux independently
  regulator: add pbias regulator support
  mmc: omap_hsmmc: adapt hsmmc to use pbias regulator
  ARM: dts: add pbias dt node
  ARM: OMAP: enable SYSCON and REGULATOR_PBIAS in omap2plus_defconfig
  mmc: omap_hsmmc: remove pbias workaround
  mmc: omap_hsmmc: fix return error code for of_get_hsmmc_pdata
  mmc: omap_hsmmc: remove redundant reset done
  mmc: omap_hsmmc: save clock rate to use in interrupt context
  mmc: omap_hsmmc: fix request done for sbc error case
  mmc: omap_hsmmc: split dma setup
  mmc: omap_hsmmc: add cmd23 support
  mmc: omap_hsmmc: add autocmd23 support

Dan Carpenter (1):
  mmc: omap_hsmmc: remove a duplicative test

Daniel Mack (1):
  mmc: omap_hsmmc: support more DT properties

Nishanth Menon (2):
  mmc: omap_hsmmc: Add support for quirky omap3 hsmmc controller
  ARM: dts: omap3-ldp: fix mmc configuration

 .../devicetree/bindings/mmc/ti-omap-hsmmc.txt  |1 +
 .../bindings/regulator/pbias-regulator.txt |   27 ++
 arch/arm/boot/dts/dra7.dtsi|   17 ++
 arch/arm/boot/dts/omap2430.dtsi|   17 ++
 arch/arm/boot/dts/omap3-ldp.dts|   23 ++
 arch/arm/boot/dts/omap3.dtsi   |   17 ++
 arch/arm/boot/dts/omap4.dtsi   |   17 ++
 arch/arm/boot/dts/omap5.dtsi   |   17 ++
 arch/arm/configs/omap2plus_defconfig   |2 +
 drivers/mmc/host/omap_hsmmc.c  |  242 +--
 drivers/regulator/Kconfig  |9 +
 drivers/regulator/Makefile |1 +
 drivers/regulator/pbias-regulator.c|  255 
 13 files changed, 569 insertions(+), 76 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/regulator/pbias-regulator.txt
 create mode 100644 drivers/regulator/pbias-regulator.c

[1]
http://www.spinics.net/lists/linux-omap/msg102811.html
http://lkml.org/lkml/2014/2/14/13
http://www.spinics.net/lists/linux-mmc/msg25029.html
http://www.spinics.net/lists/linux-omap/msg103488.html
http://www.spinics.net/lists/linux-omap/msg103608.html
http://comments.gmane.org/gmane.linux.kernel.mmc/24777

--
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 RESEND v11 6/7] ARM: OMAP: enable SYSCON and REGULATOR_PBIAS in omap2plus_defconfig

2014-03-03 Thread Balaji T K

On Wednesday 26 February 2014 10:31 PM, Tony Lindgren wrote:

* Balaji T K balaj...@ti.com [140219 07:00]:

Enable REGULATOR_PBIAS needed for SD card on most OMAPs.

Signed-off-by: Balaji T K balaj...@ti.com


I belive this is the only one missing my ack:

Acked-by: Tony Lindgren t...@atomide.com



Thanks Tony


Probably best that this all gets queued along with other MMC related
patches by Balaji and Chris.


Hi Chris,

Can you please pull this patch series for 3.15?

Thanks and Regards,
Balaji T K




---
  arch/arm/configs/omap2plus_defconfig |2 ++
  1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/arm/configs/omap2plus_defconfig 
b/arch/arm/configs/omap2plus_defconfig
index 3a0b53d..e4fec1c 100644
--- a/arch/arm/configs/omap2plus_defconfig
+++ b/arch/arm/configs/omap2plus_defconfig
@@ -169,6 +169,7 @@ CONFIG_DRA752_THERMAL=y
  CONFIG_WATCHDOG=y
  CONFIG_OMAP_WATCHDOG=y
  CONFIG_TWL4030_WATCHDOG=y
+CONFIG_MFD_SYSCON=y
  CONFIG_MFD_PALMAS=y
  CONFIG_MFD_TPS65217=y
  CONFIG_MFD_TPS65910=y
@@ -180,6 +181,7 @@ CONFIG_REGULATOR_TPS6507X=y
  CONFIG_REGULATOR_TPS65217=y
  CONFIG_REGULATOR_TPS65910=y
  CONFIG_REGULATOR_TWL4030=y
+CONFIG_REGULATOR_PBIAS=y
  CONFIG_FB=y
  CONFIG_FIRMWARE_EDID=y
  CONFIG_FB_MODE_HELPERS=y
--
1.7.5.4

--
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


--
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 0/2] mmc: omap_hsmmc: checkpatch cleanup

2014-02-28 Thread Balaji T K
fixes for checkpatch warnings.

Balaji T K (2):
  mmc: omap_hsmmc: fix return error code for of_get_hsmmc_pdata
  mmc: omap_hsmmc: remove redundant reset done

 drivers/mmc/host/omap_hsmmc.c |8 ++--
 1 files changed, 2 insertions(+), 6 deletions(-)

-- 
1.7.5.4

--
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 1/2] mmc: omap_hsmmc: fix return error code for of_get_hsmmc_pdata

2014-02-28 Thread Balaji T K
of_get_hsmmc_pdata returns a pointer, returning NULL is invalid,
return ERR_PTR for error case.

Signed-off-by: Balaji T K balaj...@ti.com
Reported-by: Dan Carpenter dan.carpen...@oracle.com
---
 drivers/mmc/host/omap_hsmmc.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 014bfe5..7d03d36 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1725,7 +1725,7 @@ static struct omap_mmc_platform_data 
*of_get_hsmmc_pdata(struct device *dev)
 
pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
if (!pdata)
-   return NULL; /* out of memory */
+   return ERR_PTR(-ENOMEM); /* out of memory */
 
if (of_find_property(np, ti,dual-volt, NULL))
pdata-controller_flags |= OMAP_HSMMC_SUPPORTS_DUAL_VOLT;
@@ -1760,7 +1760,7 @@ static struct omap_mmc_platform_data 
*of_get_hsmmc_pdata(struct device *dev)
 static inline struct omap_mmc_platform_data
*of_get_hsmmc_pdata(struct device *dev)
 {
-   return NULL;
+   return ERR_PTR(-EINVAL);
 }
 #endif
 
-- 
1.7.5.4

--
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 2/2] mmc: omap_hsmmc: remove redundant reset done

2014-02-28 Thread Balaji T K
Remove redundant reset done check since omap hwmod layer ensures IP reset.

Signed-off-by: Balaji T K balaj...@ti.com
Reported-by: Dan Carpenter dan.carpen...@oracle.com
---
 drivers/mmc/host/omap_hsmmc.c |4 
 1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 7d03d36..f9595b9 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -97,7 +97,6 @@
 #define SRC(1  25)
 #define SRD(1  26)
 #define SOFTRESET  (1  1)
-#define RESETDONE  (1  0)
 
 /* Interrupt masks for IE and ISE register */
 #define CC_EN  (1  0)
@@ -627,9 +626,6 @@ static int omap_hsmmc_context_restore(struct 
omap_hsmmc_host *host)
u32 hctl, capa;
unsigned long timeout;
 
-   if (!OMAP_HSMMC_READ(host-base, SYSSTATUS)  RESETDONE)
-   return 1;
-
if (host-con == OMAP_HSMMC_READ(host-base, CON) 
host-hctl == OMAP_HSMMC_READ(host-base, HCTL) 
host-sysctl == OMAP_HSMMC_READ(host-base, SYSCTL) 
-- 
1.7.5.4

--
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] mmc: omap_hsmmc: Enable SDIO IRQ.

2014-02-28 Thread Balaji T K

On Tuesday 25 February 2014 06:07 PM, Andreas Fenkart wrote:

For now, only support SDIO interrupt if we are booted with
DT. This is because some platforms need special quirks. And
we don't want to add new legacy mux platform init code
callbacks any longer as we are moving to DT based booting
anyways.

Signed-off-by: Andreas Fenkart afenk...@gmail.com

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index a5a38cc..bd3bb0c 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c


snip


@@ -1705,7 +1757,18 @@ static void omap_hsmmc_debugfs(struct mmc_host *mmc)
  #endif

  #ifdef CONFIG_OF
-static u16 omap4_reg_offset = 0x100;
+struct of_data {
+   u16 offset;
+   int flags;
+};
+

Hi Andreas,

struct of_data declaration needs to be moved out of #ifdef CONFIG_OF
for !CONFIG_OF build.

I tried testing this patch series on am335x, I see throughput in the
range of KBs. Will give another try with Tony's version.

Thanks and Regards,
Balaji T K


+static struct of_data omap4_data = {
+   .offset = 0x100,
+};
+static struct of_data am33xx_data = {
+   .offset = 0x100,
+   .flags  = OMAP_HSMMC_SWAKEUP_MISSING,
+};

  static const struct of_device_id omap_mmc_of_match[] = {
{

--
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: SD card timeout problems on Nokia N900 (omap_hsmmc on OMAP3)

2014-02-26 Thread Balaji T K

On Wednesday 26 February 2014 12:25 PM, Stefan Roese wrote:

Hi Sebastian,

On 26.02.2014 07:02, Michael Trimarchi wrote:

Hi Sebastian

On Wed, Feb 26, 2014 at 12:47 AM, Sebastian Reichel s...@ring0.de wrote:

Hi,

I have problems with the SD-card initialization on my Nokia N900
using a 3.14-rc1 based kernel in DT boot mode. The bug is can be
circumvented by changing the kernel slightly (e.g. remove some DT
nodes or mark them as disabled). So the SD card's timeout problems
seem to derive from kernel timing problems. I'm pretty sure, that
the problems are not originating from a broken SD card, since


Can you provide removed/Disabled dt nodes, it might give some clue ?



  1. The SD card worked quite good before and still does depending
 on unrelated DTS changes (= loading less drivers).
  2. The SD card works flawlessly on my notebook using a USB adapter
  3. Another SD card showed the same problem

I tried to git bisect the problem, but I just get shown some
unrelated driver additions.

Anyways, this is the error I get during boot:

[3.896820] mmc0: mmc_rescan_try_freq: trying to init card at 40 Hz
...
[5.956237] mmc0: error -110 whilst initialising SD card



Are you sure that some subsystem that you deactivate don't change
pin muxing setting? Can you check in the broken system if the pins of the sdcard
are correctly muxed? Does it happen even if you change the sdcard?


Did you try to add this patch series:

http://www.spinics.net/lists/linux-omap/msg103264.html

Without it I'm also having problems with MMC detection on some OMAP3 based 
boards.

Balaji, what is the status of this patch series? Are there any chances that it 
will be included in v3.14?



Due to dependencies between regulator, mmc, omap def config, devicetree changes,
I am hoping either Chris or Tony pick the whole series for 3.15

Couple of tested-by will surely help.

Thanks and Regards,
Balaji T K
--
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 RESEND v10 0/7] mmc: omap_hsmmc: pbias dt and cleanup

2014-02-26 Thread Balaji T K

On Wednesday 26 February 2014 07:34 PM, Florian Vaussard wrote:

Hi,

On 02/19/2014 03:56 PM, Balaji T K wrote:

Few cleanups to reduce code indent,
Add pbias_regulator support and adapt omap_hsmmc to use pbias regulator
to configure required voltage on mmc1 pad(SD card) i/o rails on OMAP SoCs.



I tested on both OMAP3630 (Overo Storm) and OMAP4430 (DuoVero). The
rootfs is mounted on mmc1 and works as usual. Here is what I can see:

- pbias-supply is parsed from DT
- VMMC1 is set to 3V
- According to the debugfs entry, we are working at 3V signaling
- By dumping CONTROL_PBIASLITE, bit MMC1_PBIASLITE_VMODE
(PBIASLITEVMODE0 on OMAP3) is set to 1 (- 3V)

Do you see any other tests that I could run to validate your patches?


Nope, Stefan has tested the other use case of detecting sd card at kernel
without any sd card/pbias activity at u-boot.


Otherwise:

Tested-by: Florian Vaussard florian.vauss...@epfl.ch



Thanks Florian, Stefan for Testing.
--
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 V2 2/2] ARM: dts: omap3-ldp: fix mmc configuration

2014-02-20 Thread Balaji T K

On Friday 14 February 2014 11:15 AM, Nishanth Menon wrote:

MMC1 is the only MMC interface available on the platform. Further,
since the platform is based on older revision of SoC which is not
capable of doing multi-block reads, mark it with compatibility for the
same and add pinmux to ensure that all relevant pins are configured
for non-MMC boot mode.

Signed-off-by: Nishanth Menon n...@ti.com


looks good to me
Acked-by: Balaji T K balaj...@ti.com

--
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 RESEND v10 0/7] mmc: omap_hsmmc: pbias dt and cleanup

2014-02-19 Thread Balaji T K
Few cleanups to reduce code indent,
Add pbias_regulator support and adapt omap_hsmmc to use pbias regulator
to configure required voltage on mmc1 pad(SD card) i/o rails on OMAP SoCs.

Balaji T K (7):
  mmc: omap_hsmmc: use devm_regulator API
  mmc: omap_hsmmc: handle vcc and vcc_aux independently
  regulator: add pbias regulator support
  mmc: omap_hsmmc: adapt hsmmc to use pbias regulator
  ARM: dts: add pbias dt node
  ARM: OMAP: enable SYSCON and REGULATOR_PBIAS in omap2plus_defconfig
  mmc: omap_hsmmc: remove pbias workaround

 .../bindings/regulator/pbias-regulator.txt |   27 ++
 arch/arm/boot/dts/dra7.dtsi|   17 ++
 arch/arm/boot/dts/omap2430.dtsi|   17 ++
 arch/arm/boot/dts/omap3.dtsi   |   17 ++
 arch/arm/boot/dts/omap4.dtsi   |   17 ++
 arch/arm/boot/dts/omap5.dtsi   |   17 ++
 arch/arm/configs/omap2plus_defconfig   |2 +
 drivers/mmc/host/omap_hsmmc.c  |  111 +
 drivers/regulator/Kconfig  |9 +
 drivers/regulator/Makefile |1 +
 drivers/regulator/pbias-regulator.c|  255 
 11 files changed, 441 insertions(+), 49 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/regulator/pbias-regulator.txt
 create mode 100644 drivers/regulator/pbias-regulator.c

-- 
1.7.5.4

--
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 RESEND v11 1/7] mmc: omap_hsmmc: use devm_regulator API

2014-02-19 Thread Balaji T K
Use devm_regulator API, while at it use
devm_regulator_get_optional for optional vmmc_aux supply

Signed-off-by: Balaji T K balaj...@ti.com
Acked-by: Tony Lindgren t...@atomide.com
---
 drivers/mmc/host/omap_hsmmc.c |6 ++
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index dbd32ad..1eb4350 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -316,7 +316,7 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
struct regulator *reg;
int ocr_value = 0;
 
-   reg = regulator_get(host-dev, vmmc);
+   reg = devm_regulator_get(host-dev, vmmc);
if (IS_ERR(reg)) {
dev_err(host-dev, vmmc regulator missing\n);
return PTR_ERR(reg);
@@ -336,7 +336,7 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
}
 
/* Allow an aux regulator */
-   reg = regulator_get(host-dev, vmmc_aux);
+   reg = devm_regulator_get_optional(host-dev, vmmc_aux);
host-vcc_aux = IS_ERR(reg) ? NULL : reg;
 
/* For eMMC do not power off when not in sleep state */
@@ -366,8 +366,6 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
 
 static void omap_hsmmc_reg_put(struct omap_hsmmc_host *host)
 {
-   regulator_put(host-vcc);
-   regulator_put(host-vcc_aux);
mmc_slot(host).set_power = NULL;
 }
 
-- 
1.7.5.4

--
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 RESEND v11 6/7] ARM: OMAP: enable SYSCON and REGULATOR_PBIAS in omap2plus_defconfig

2014-02-19 Thread Balaji T K
Enable REGULATOR_PBIAS needed for SD card on most OMAPs.

Signed-off-by: Balaji T K balaj...@ti.com
---
 arch/arm/configs/omap2plus_defconfig |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/arm/configs/omap2plus_defconfig 
b/arch/arm/configs/omap2plus_defconfig
index 3a0b53d..e4fec1c 100644
--- a/arch/arm/configs/omap2plus_defconfig
+++ b/arch/arm/configs/omap2plus_defconfig
@@ -169,6 +169,7 @@ CONFIG_DRA752_THERMAL=y
 CONFIG_WATCHDOG=y
 CONFIG_OMAP_WATCHDOG=y
 CONFIG_TWL4030_WATCHDOG=y
+CONFIG_MFD_SYSCON=y
 CONFIG_MFD_PALMAS=y
 CONFIG_MFD_TPS65217=y
 CONFIG_MFD_TPS65910=y
@@ -180,6 +181,7 @@ CONFIG_REGULATOR_TPS6507X=y
 CONFIG_REGULATOR_TPS65217=y
 CONFIG_REGULATOR_TPS65910=y
 CONFIG_REGULATOR_TWL4030=y
+CONFIG_REGULATOR_PBIAS=y
 CONFIG_FB=y
 CONFIG_FIRMWARE_EDID=y
 CONFIG_FB_MODE_HELPERS=y
-- 
1.7.5.4

--
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 RESEND v11 4/7] mmc: omap_hsmmc: adapt hsmmc to use pbias regulator

2014-02-19 Thread Balaji T K
In DT case, PBAIS registers are programmed via regulator,
use regulator APIs to control PBIAS.

Signed-off-by: Balaji T K balaj...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c |   37 +
 1 files changed, 37 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 342be25..2287bda 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -126,6 +126,10 @@
 #define OMAP_MMC_MAX_CLOCK 5200
 #define DRIVER_NAMEomap_hsmmc
 
+#define VDD_1V8180 /* 18 uV */
+#define VDD_3V0300 /* 30 uV */
+#define VDD_165_195(ffs(MMC_VDD_165_195) - 1)
+
 /*
  * One controller can have multiple slots, like on some omap boards using
  * omap.c controller driver. Luckily this is not currently done on any known
@@ -164,6 +168,8 @@ struct omap_hsmmc_host {
 */
struct  regulator   *vcc;
struct  regulator   *vcc_aux;
+   struct  regulator   *pbias;
+   boolpbias_enabled;
int pbias_disable;
void__iomem *base;
resource_size_t mapbase;
@@ -272,6 +278,15 @@ static int omap_hsmmc_set_power(struct device *dev, int 
slot, int power_on,
if (mmc_slot(host).before_set_reg)
mmc_slot(host).before_set_reg(dev, slot, power_on, vdd);
 
+   if (host-pbias) {
+   if (host-pbias_enabled == 1) {
+   ret = regulator_disable(host-pbias);
+   if (!ret)
+   host-pbias_enabled = 0;
+   }
+   regulator_set_voltage(host-pbias, VDD_3V0, VDD_3V0);
+   }
+
/*
 * Assume Vcc regulator is used only to power the card ... OMAP
 * VDDS is used to power the pins, optionally with a transceiver to
@@ -306,9 +321,27 @@ static int omap_hsmmc_set_power(struct device *dev, int 
slot, int power_on,
}
}
 
+   if (host-pbias) {
+   if (vdd = VDD_165_195)
+   ret = regulator_set_voltage(host-pbias, VDD_1V8,
+   VDD_1V8);
+   else
+   ret = regulator_set_voltage(host-pbias, VDD_3V0,
+   VDD_3V0);
+   if (ret  0)
+   goto error_set_power;
+
+   if (host-pbias_enabled == 0) {
+   ret = regulator_enable(host-pbias);
+   if (!ret)
+   host-pbias_enabled = 1;
+   }
+   }
+
if (mmc_slot(host).after_set_reg)
mmc_slot(host).after_set_reg(dev, slot, power_on, vdd);
 
+error_set_power:
return ret;
 }
 
@@ -342,6 +375,9 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
reg = devm_regulator_get_optional(host-dev, vmmc_aux);
host-vcc_aux = IS_ERR(reg) ? NULL : reg;
 
+   reg = devm_regulator_get_optional(host-dev, pbias);
+   host-pbias = IS_ERR(reg) ? NULL : reg;
+
/* For eMMC do not power off when not in sleep state */
if (mmc_slot(host).no_regulator_off_init)
return 0;
@@ -1808,6 +1844,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
host-base  = ioremap(host-mapbase, SZ_4K);
host-power_mode = MMC_POWER_OFF;
host-next_data.cookie = 1;
+   host-pbias_enabled = 0;
 
platform_set_drvdata(pdev, host);
 
-- 
1.7.5.4

--
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 RESEND v11 3/7] regulator: add pbias regulator support

2014-02-19 Thread Balaji T K
pbias register controls internal power supply to sd card i/o pads
in most OMAPs (OMAP2-5, DRA7).
Control bits for selecting voltage level and
enabling/disabling are in the same PBIAS register.

Signed-off-by: Balaji T K balaj...@ti.com
Acked-by: Tony Lindgren t...@atomide.com
Acked-by: Mark Brown broo...@linaro.org
---
 .../bindings/regulator/pbias-regulator.txt |   27 ++
 drivers/regulator/Kconfig  |9 +
 drivers/regulator/Makefile |1 +
 drivers/regulator/pbias-regulator.c|  255 
 4 files changed, 292 insertions(+), 0 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/regulator/pbias-regulator.txt
 create mode 100644 drivers/regulator/pbias-regulator.c

diff --git a/Documentation/devicetree/bindings/regulator/pbias-regulator.txt 
b/Documentation/devicetree/bindings/regulator/pbias-regulator.txt
new file mode 100644
index 000..32aa26f
--- /dev/null
+++ b/Documentation/devicetree/bindings/regulator/pbias-regulator.txt
@@ -0,0 +1,27 @@
+PBIAS internal regulator for SD card dual voltage i/o pads on OMAP SoCs.
+
+Required properties:
+- compatible:
+  - ti,pbias-omap for OMAP2, OMAP3, OMAP4, OMAP5, DRA7.
+- reg: pbias register offset from syscon base and size of pbias register.
+- syscon : phandle of the system control module
+- regulator-name : should be
+   pbias_mmc_omap2430 for OMAP2430, OMAP3 SoCs
+   pbias_sim_omap3 for OMAP3 SoCs
+   pbias_mmc_omap4 for OMAP4 SoCs
+   pbias_mmc_omap5 for OMAP5 and DRA7 SoC
+
+Optional properties:
+- Any optional property defined in bindings/regulator/regulator.txt
+
+Example:
+
+   pbias_regulator: pbias_regulator {
+   compatible = ti,pbias-omap;
+   reg = 0 0x4;
+   syscon = omap5_padconf_global;
+   pbias_mmc_reg: pbias_mmc_omap5 {
+   regulator-name = pbias_mmc_omap5;
+   regulator-min-microvolt = 180;
+   regulator-max-microvolt = 300;
+   };
diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index 6a79328..58f08d1 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -384,6 +384,15 @@ config REGULATOR_PALMAS
  on the muxing. This is handled automatically in the driver by
  reading the mux info from OTP.
 
+config REGULATOR_PBIAS
+   tristate PBIAS OMAP regulator driver
+   depends on (ARCH_OMAP || COMPILE_TEST)  MFD_SYSCON
+   help
+Say y here to support pbias regulator for mmc1:SD card i/o
+on OMAP SoCs.
+This driver provides support for OMAP pbias modelled
+regulators.
+
 config REGULATOR_PCAP
tristate Motorola PCAP2 regulator driver
depends on EZX_PCAP
diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile
index 979f9dd..001712e 100644
--- a/drivers/regulator/Makefile
+++ b/drivers/regulator/Makefile
@@ -54,6 +54,7 @@ obj-$(CONFIG_REGULATOR_MC13XXX_CORE) +=  
mc13xxx-regulator-core.o
 obj-$(CONFIG_REGULATOR_PALMAS) += palmas-regulator.o
 obj-$(CONFIG_REGULATOR_PFUZE100) += pfuze100-regulator.o
 obj-$(CONFIG_REGULATOR_TPS51632) += tps51632-regulator.o
+obj-$(CONFIG_REGULATOR_PBIAS) += pbias-regulator.o
 obj-$(CONFIG_REGULATOR_PCAP) += pcap-regulator.o
 obj-$(CONFIG_REGULATOR_PCF50633) += pcf50633-regulator.o
 obj-$(CONFIG_REGULATOR_RC5T583)  += rc5t583-regulator.o
diff --git a/drivers/regulator/pbias-regulator.c 
b/drivers/regulator/pbias-regulator.c
new file mode 100644
index 000..ded3b35
--- /dev/null
+++ b/drivers/regulator/pbias-regulator.c
@@ -0,0 +1,255 @@
+/*
+ * pbias-regulator.c
+ *
+ * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
+ * Author: Balaji T K balaj...@ti.com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation version 2.
+ *
+ * This program is distributed as is WITHOUT ANY WARRANTY of any
+ * kind, whether express or implied; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include linux/err.h
+#include linux/io.h
+#include linux/module.h
+#include linux/mfd/syscon.h
+#include linux/platform_device.h
+#include linux/regulator/driver.h
+#include linux/regulator/machine.h
+#include linux/regulator/of_regulator.h
+#include linux/regmap.h
+#include linux/slab.h
+#include linux/of.h
+#include linux/of_device.h
+
+struct pbias_reg_info {
+   u32 enable;
+   u32 enable_mask;
+   u32 vmode;
+   unsigned int enable_time;
+   char *name;
+};
+
+struct pbias_regulator_data {
+   struct regulator_desc desc;
+   void __iomem *pbias_addr

[PATCH RESEND v11 7/7] mmc: omap_hsmmc: remove pbias workaround

2014-02-19 Thread Balaji T K
remove pbias workaround

Signed-off-by: Balaji T K balaj...@ti.com
Acked-by: Tony Lindgren t...@atomide.com
---
 drivers/mmc/host/omap_hsmmc.c |   20 +---
 1 files changed, 1 insertions(+), 19 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 2287bda..014bfe5 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -170,7 +170,6 @@ struct omap_hsmmc_host {
struct  regulator   *vcc_aux;
struct  regulator   *pbias;
boolpbias_enabled;
-   int pbias_disable;
void__iomem *base;
resource_size_t mapbase;
spinlock_t  irq_lock; /* Prevent races with irq handler */
@@ -267,13 +266,6 @@ static int omap_hsmmc_set_power(struct device *dev, int 
slot, int power_on,
 */
if (!host-vcc)
return 0;
-   /*
-* With DT, never turn OFF the regulator for MMC1. This is because
-* the pbias cell programming support is still missing when
-* booting with Device tree
-*/
-   if (host-pbias_disable  !vdd)
-   return 0;
 
if (mmc_slot(host).before_set_reg)
mmc_slot(host).before_set_reg(dev, slot, power_on, vdd);
@@ -1539,13 +1531,7 @@ static void omap_hsmmc_set_ios(struct mmc_host *mmc, 
struct mmc_ios *ios)
 * of external transceiver; but they all handle 1.8V.
 */
if ((OMAP_HSMMC_READ(host-base, HCTL)  SDVSDET) 
-   (ios-vdd == DUAL_VOLT_OCR_BIT) 
-   /*
-* With pbias cell programming missing, this
-* can't be allowed on MMC1 when booting with device
-* tree.
-*/
-   !host-pbias_disable) {
+   (ios-vdd == DUAL_VOLT_OCR_BIT)) {
/*
 * The mmc_select_voltage fn of the core does
 * not seem to set the power_mode to
@@ -1878,10 +1864,6 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
 
omap_hsmmc_context_save(host);
 
-   /* This can be removed once we support PBIAS with DT */
-   if (host-dev-of_node  res-start == 0x4809c000)
-   host-pbias_disable = 1;
-
host-dbclk = clk_get(pdev-dev, mmchsdb_fck);
/*
 * MMC can still work without debounce clock.
-- 
1.7.5.4

--
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 RESEND v11 5/7] ARM: dts: add pbias dt node

2014-02-19 Thread Balaji T K
Add pbias regulator node as a child of system control
module - syscon.

Signed-off-by: Balaji T K balaj...@ti.com
Acked-by: Tony Lindgren t...@atomide.com
---
 arch/arm/boot/dts/dra7.dtsi |   17 +
 arch/arm/boot/dts/omap2430.dtsi |   17 +
 arch/arm/boot/dts/omap3.dtsi|   17 +
 arch/arm/boot/dts/omap4.dtsi|   17 +
 arch/arm/boot/dts/omap5.dtsi|   17 +
 5 files changed, 85 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
index 1fd75aa..63750d9 100644
--- a/arch/arm/boot/dts/dra7.dtsi
+++ b/arch/arm/boot/dts/dra7.dtsi
@@ -149,6 +149,22 @@
ti,hwmods = counter_32k;
};
 
+   dra7_ctrl_general: tisyscon@4a002e00 {
+   compatible = syscon, simple-bus;
+   reg = 0x4a002e00 0x7c;
+   };
+
+   pbias_regulator: pbias_regulator {
+   compatible = ti,pbias-omap;
+   reg = 0 0x4;
+   syscon = dra7_ctrl_general;
+   pbias_mmc_reg: pbias_mmc_omap5 {
+   regulator-name = pbias_mmc_omap5;
+   regulator-min-microvolt = 180;
+   regulator-max-microvolt = 300;
+   };
+   };
+
dra7_pmx_core: pinmux@4a003400 {
compatible = pinctrl-single;
reg = 0x4a003400 0x0464;
@@ -524,6 +540,7 @@
dmas = sdma 61, sdma 62;
dma-names = tx, rx;
status = disabled;
+   pbias-supply = pbias_mmc_reg;
};
 
mmc2: mmc@480b4000 {
diff --git a/arch/arm/boot/dts/omap2430.dtsi b/arch/arm/boot/dts/omap2430.dtsi
index d624345..af71eb0 100644
--- a/arch/arm/boot/dts/omap2430.dtsi
+++ b/arch/arm/boot/dts/omap2430.dtsi
@@ -29,6 +29,22 @@
pinctrl-single,function-mask = 0x3f;
};
 
+   omap2_scm_general: tisyscon@49002270 {
+   compatible = syscon, simple-bus;
+   reg = 0x49002270 0x240;
+   };
+
+   pbias_regulator: pbias_regulator {
+   compatible = ti,pbias-omap;
+   reg = 0x230 0x4;
+   syscon = omap2_scm_general;
+   pbias_mmc_reg: pbias_mmc_omap2430 {
+   regulator-name = pbias_mmc_omap2430;
+   regulator-min-microvolt = 180;
+   regulator-max-microvolt = 300;
+   };
+   };
+
gpio1: gpio@4900c000 {
compatible = ti,omap2-gpio;
reg = 0x4900c000 0x200;
@@ -183,6 +199,7 @@
ti,dual-volt;
dmas = sdma 61, sdma 62;
dma-names = tx, rx;
+   pbias-supply = pbias_mmc_reg;
};
 
mmc2: mmc@480b4000 {
diff --git a/arch/arm/boot/dts/omap3.dtsi b/arch/arm/boot/dts/omap3.dtsi
index a5fc83b..3726a64 100644
--- a/arch/arm/boot/dts/omap3.dtsi
+++ b/arch/arm/boot/dts/omap3.dtsi
@@ -176,6 +176,22 @@
pinctrl-single,function-mask = 0xff1f;
};
 
+   omap3_scm_general: tisyscon@48002270 {
+   compatible = syscon, simple-bus;
+   reg = 0x48002270 0x2f0;
+   };
+
+   pbias_regulator: pbias_regulator {
+   compatible = ti,pbias-omap;
+   reg = 0x2b0 0x4;
+   syscon = omap3_scm_general;
+   pbias_mmc_reg: pbias_mmc_omap2430 {
+   regulator-name = pbias_mmc_omap2430;
+   regulator-min-microvolt = 180;
+   regulator-max-microvolt = 300;
+   };
+   };
+
gpio1: gpio@4831 {
compatible = ti,omap3-gpio;
reg = 0x4831 0x200;
@@ -390,6 +406,7 @@
ti,dual-volt;
dmas = sdma 61, sdma 62;
dma-names = tx, rx;
+   pbias-supply = pbias_mmc_reg;
};
 
mmc2: mmc@480b4000 {
diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index d3f8a6e..8e79064 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -186,6 +186,22 @@
pinctrl-single,function-mask = 0x7fff;
};
 
+   omap4_padconf_global: tisyscon@4a1005a0 {
+   compatible = syscon, simple-bus

[PATCH RESEND v11 2/7] mmc: omap_hsmmc: handle vcc and vcc_aux independently

2014-02-19 Thread Balaji T K
handle vcc and vcc_aux independently to reduce indent.

Signed-off-by: Balaji T K balaj...@ti.com
Acked-by: Tony Lindgren t...@atomide.com
---
 drivers/mmc/host/omap_hsmmc.c |   54 +++--
 1 files changed, 25 insertions(+), 29 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 1eb4350..342be25 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -286,11 +286,12 @@ static int omap_hsmmc_set_power(struct device *dev, int 
slot, int power_on,
 * chips/cards need an interface voltage rail too.
 */
if (power_on) {
-   ret = mmc_regulator_set_ocr(host-mmc, host-vcc, vdd);
+   if (host-vcc)
+   ret = mmc_regulator_set_ocr(host-mmc, host-vcc, vdd);
/* Enable interface voltage rail, if needed */
if (ret == 0  host-vcc_aux) {
ret = regulator_enable(host-vcc_aux);
-   if (ret  0)
+   if (ret  0  host-vcc)
ret = mmc_regulator_set_ocr(host-mmc,
host-vcc, 0);
}
@@ -298,7 +299,7 @@ static int omap_hsmmc_set_power(struct device *dev, int 
slot, int power_on,
/* Shut down the rail */
if (host-vcc_aux)
ret = regulator_disable(host-vcc_aux);
-   if (!ret) {
+   if (host-vcc) {
/* Then proceed to shut down the local regulator */
ret = mmc_regulator_set_ocr(host-mmc,
host-vcc, 0);
@@ -318,10 +319,10 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host 
*host)
 
reg = devm_regulator_get(host-dev, vmmc);
if (IS_ERR(reg)) {
-   dev_err(host-dev, vmmc regulator missing\n);
+   dev_err(host-dev, unable to get vmmc regulator %ld\n,
+   PTR_ERR(reg));
return PTR_ERR(reg);
} else {
-   mmc_slot(host).set_power = omap_hsmmc_set_power;
host-vcc = reg;
ocr_value = mmc_regulator_get_ocrmask(reg);
if (!mmc_slot(host).ocr_mask) {
@@ -334,31 +335,26 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host 
*host)
return -EINVAL;
}
}
+   }
+   mmc_slot(host).set_power = omap_hsmmc_set_power;
 
-   /* Allow an aux regulator */
-   reg = devm_regulator_get_optional(host-dev, vmmc_aux);
-   host-vcc_aux = IS_ERR(reg) ? NULL : reg;
+   /* Allow an aux regulator */
+   reg = devm_regulator_get_optional(host-dev, vmmc_aux);
+   host-vcc_aux = IS_ERR(reg) ? NULL : reg;
 
-   /* For eMMC do not power off when not in sleep state */
-   if (mmc_slot(host).no_regulator_off_init)
-   return 0;
-   /*
-   * UGLY HACK:  workaround regulator framework bugs.
-   * When the bootloader leaves a supply active, it's
-   * initialized with zero usecount ... and we can't
-   * disable it without first enabling it.  Until the
-   * framework is fixed, we need a workaround like this
-   * (which is safe for MMC, but not in general).
-   */
-   if (regulator_is_enabled(host-vcc)  0 ||
-   (host-vcc_aux  regulator_is_enabled(host-vcc_aux))) {
-   int vdd = ffs(mmc_slot(host).ocr_mask) - 1;
+   /* For eMMC do not power off when not in sleep state */
+   if (mmc_slot(host).no_regulator_off_init)
+   return 0;
+   /*
+* To disable boot_on regulator, enable regulator
+* to increase usecount and then disable it.
+*/
+   if ((host-vcc  regulator_is_enabled(host-vcc)  0) ||
+   (host-vcc_aux  regulator_is_enabled(host-vcc_aux))) {
+   int vdd = ffs(mmc_slot(host).ocr_mask) - 1;
 
-   mmc_slot(host).set_power(host-dev, host-slot_id,
-1, vdd);
-   mmc_slot(host).set_power(host-dev, host-slot_id,
-0, 0);
-   }
+   mmc_slot(host).set_power(host-dev, host-slot_id, 1, vdd);
+   mmc_slot(host).set_power(host-dev, host-slot_id, 0, 0);
}
 
return 0;
-- 
1.7.5.4

--
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] mmc: omap_hsmmc: support more DT properties

2014-02-18 Thread Balaji T K

On Monday 17 February 2014 05:06 PM, Daniel Mack wrote:

This should probably be done implicitly through mmc_of_parse(), but that
doesn't play well along with the multi-slot model the hsmmc driver
features. Hence, for now, do it manually. The properties are already
documented in Documentation/devicetree/bindings/mmc/mmc.txt.

Signed-off-by: Daniel Mack zon...@gmail.com


looks good to me
Acked-by: Balaji T K balaj...@ti.com


---
  drivers/mmc/host/omap_hsmmc.c | 6 ++
  1 file changed, 6 insertions(+)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 2815de6..a5a38cc 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1765,6 +1765,12 @@ static struct omap_mmc_platform_data 
*of_get_hsmmc_pdata(struct device *dev)
if (of_find_property(np, ti,needs-special-hs-handling, NULL))
pdata-slots[0].features |= HSMMC_HAS_HSPE_SUPPORT;

+   if (of_find_property(np, keep-power-in-suspend, NULL))
+   pdata-slots[0].pm_caps |= MMC_PM_KEEP_POWER;
+
+   if (of_find_property(np, enable-sdio-wakeup, NULL))
+   pdata-slots[0].pm_caps |= MMC_PM_WAKE_SDIO_IRQ;
+
return pdata;
  }
  #else



--
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 V2 1/2] mmc: omap_hsmmc: Add support for quirky omap3 hsmmc controller

2014-02-18 Thread Balaji T K

On Friday 14 February 2014 11:15 AM, Nishanth Menon wrote:

When device is booted using devicetree, platforms impacted by Erratum
2.1.1.128 is not detected easily in the mmc driver. This erratum
indicates that the module cannot do multi-block transfers. Platforms
such as LDP which use OMAP3 ES revision prior to ES3.0 are impacted by
this.

Provide a new compatible property ti,omap3-pre-es3-hsmmc to allow
driver to determine if driver needs to implement quirks associated
with the specific module version (primarily because the IP revision
information is not sufficient for the same).

Signed-off-by: Nishanth Menon n...@ti.com


looks good to me
Acked-by: Balaji T K balaj...@ti.com


---
Changes since v1:
- new compatible flag as suggested by Tony which contains
  the relevant controller flag to work around the erratum

V1: https://patchwork.kernel.org/patch/3514851/

  .../devicetree/bindings/mmc/ti-omap-hsmmc.txt  |1 +
  drivers/mmc/host/omap_hsmmc.c  |   26 +---
  2 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt 
b/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt
index 8c8908a..ce80561 100644
--- a/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt
+++ b/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt
@@ -10,6 +10,7 @@ Required properties:
  - compatible:
   Should be ti,omap2-hsmmc, for OMAP2 controllers
   Should be ti,omap3-hsmmc, for OMAP3 controllers
+ Should be ti,omap3-pre-es3-hsmmc for OMAP3 controllers pre ES3.0
   Should be ti,omap4-hsmmc, for OMAP4 controllers
  - ti,hwmods: Must be mmcn, n is controller instance starting 1

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 575f9cc..390f421 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -192,6 +192,11 @@ struct omap_hsmmc_host {
struct  omap_mmc_platform_data  *pdata;
  };

+struct omap_mmc_of_data {
+   u32 reg_offset;
+   u8 controller_flags;
+};
+
  static int omap_hsmmc_card_detect(struct device *dev, int slot)
  {
struct omap_hsmmc_host *host = dev_get_drvdata(dev);
@@ -1678,18 +1683,29 @@ static void omap_hsmmc_debugfs(struct mmc_host *mmc)
  #endif

  #ifdef CONFIG_OF
-static u16 omap4_reg_offset = 0x100;
+static const struct omap_mmc_of_data omap3_pre_es3_mmc_of_data = {
+   /* See 35xx errata 2.1.1.128 in SPRZ278F */
+   .controller_flags = OMAP_HSMMC_BROKEN_MULTIBLOCK_READ,
+};
+
+static const struct omap_mmc_of_data omap4_mmc_of_data = {
+   .reg_offset = 0x100,
+};

  static const struct of_device_id omap_mmc_of_match[] = {
{
.compatible = ti,omap2-hsmmc,
},
{
+   .compatible = ti,omap3-pre-es3-hsmmc,
+   .data = omap3_pre_es3_mmc_of_data,
+   },
+   {
.compatible = ti,omap3-hsmmc,
},
{
.compatible = ti,omap4-hsmmc,
-   .data = omap4_reg_offset,
+   .data = omap4_mmc_of_data,
},
{},
  };
@@ -1759,6 +1775,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
dma_cap_mask_t mask;
unsigned tx_req, rx_req;
struct pinctrl *pinctrl;
+   const struct omap_mmc_of_data *data;

match = of_match_device(of_match_ptr(omap_mmc_of_match), pdev-dev);
if (match) {
@@ -1768,8 +1785,9 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
return PTR_ERR(pdata);

if (match-data) {
-   const u16 *offsetp = match-data;
-   pdata-reg_offset = *offsetp;
+   data = match-data;
+   pdata-reg_offset = data-reg_offset;
+   pdata-controller_flags |= data-controller_flags;
}
}




--
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] mmc: omap_hsmmc: Add support for Erratum 2.1.1.128 in device tree boot

2014-02-05 Thread Balaji T K

On Tuesday 04 February 2014 08:48 PM, Nishanth Menon wrote:

On 02/04/2014 06:44 AM, Balaji T K wrote:

On Tuesday 21 January 2014 04:59 AM, Nishanth Menon wrote:

When device is booted using devicetree, platforms impacted by
Erratum 2.1.1.128 is not detected easily in the mmc driver. This erratum
indicates that the module cannot do multi-block transfers.

Handle this by providing a boolean flag to indicate to driver that it is
working on a hardware with mentioned limitation.

Signed-off-by: Nishanth Menon n...@ti.com
---

This explains the logs I see:
OMAP3430 LDP (ES2.2):
uImage only boot:  http://slexy.org/raw/s2YrbMAi7c
uImage+dtb concatenated boot: http://slexy.org/raw/s20qVg17T0

With the following flag set, device is now able to consistently boot with
device tree supported uImage+dtb concat boot.

   .../devicetree/bindings/mmc/ti-omap-hsmmc.txt  |2 ++
   drivers/mmc/host/omap_hsmmc.c  |3 +++
   2 files changed, 5 insertions(+)

diff --git a/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt 
b/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt
index 8c8908a..ab36f8b 100644
--- a/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt
+++ b/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt
@@ -26,6 +26,8 @@ specifier is required.
   dma-names: List of DMA request names. These strings correspond
   1:1 with the DMA specifiers listed in dmas. The string naming is
   to be rx and tx for RX and TX DMA requests, respectively.
+ti,erratum-2.1.1.128: boolean, for OMAP3430/OMAP35xx platforms with broken
+multiblock reads


Rather than ti,errata.. specific property, something like
caps no/disable multiblock read is more readable in my opinion, Otherwise


Is'nt the better definition to state i have quirk X and allow the
driver to do the necessary thing/things needed to handle quirk X? in
this case, there is just one thing to do: broken multi_block_read, in
the case of other quirks, there might be more than 1 thing to do.. let
driver figure that out, dts just states the h/w capabilty or in this
case, the quirk capability.



But in this case there is only one. disable multi block read is more readable
than the errata reference, No strong feelings though.



Acked-by: Balaji T K balaj...@ti.com



   Examples:

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 014bfe5..f2d5940 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1730,6 +1730,9 @@ static struct omap_mmc_platform_data 
*of_get_hsmmc_pdata(struct device *dev)
if (of_find_property(np, ti,dual-volt, NULL))
pdata-controller_flags |= OMAP_HSMMC_SUPPORTS_DUAL_VOLT;

+   if (of_find_property(np, ti,erratum-2.1.1.128, NULL))
+   pdata-controller_flags |= OMAP_HSMMC_BROKEN_MULTIBLOCK_READ;
+
/* This driver only supports 1 slot */
pdata-nr_slots = 1;
pdata-slots[0].switch_pin = cd_gpio;








--
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 v10 0/7] mmc: omap_hsmmc: pbias dt and cleanup

2014-02-04 Thread Balaji T K

On Monday 13 January 2014 09:06 PM, Balaji T K wrote:

Few cleanups to reduce code indent,
Add pbias_regulator support and adapt omap_hsmmc to use pbias regulator
to configure required voltage on mmc1 pad(SD card) i/o rails on OMAP SoCs.



Hi Tony,

Considering the dependencies with regulator, defconfig, mmc and device tree,
Is it possible for you to pick this series.

Thanks and Regards,
Balaji T K


Balaji T K (7):
   mmc: omap_hsmmc: use devm_regulator API
   mmc: omap_hsmmc: handle vcc and vcc_aux independently
   regulator: add pbias regulator support
   mmc: omap_hsmmc: adapt hsmmc to use pbias regulator
   ARM: dts: add pbias dt node
   ARM: OMAP: enable SYSCON and REGULATOR_PBIAS in omap2plus_defconfig
   mmc: omap_hsmmc: remove pbias workaround

  .../bindings/regulator/pbias-regulator.txt |   27 ++
  arch/arm/boot/dts/dra7.dtsi|   17 ++
  arch/arm/boot/dts/omap2430.dtsi|   17 ++
  arch/arm/boot/dts/omap3.dtsi   |   17 ++
  arch/arm/boot/dts/omap4.dtsi   |   17 ++
  arch/arm/boot/dts/omap5.dtsi   |   17 ++
  arch/arm/configs/omap2plus_defconfig   |2 +
  drivers/mmc/host/omap_hsmmc.c  |  111 +
  drivers/regulator/Kconfig  |9 +
  drivers/regulator/Makefile |1 +
  drivers/regulator/pbias-regulator.c|  255 
  11 files changed, 441 insertions(+), 49 deletions(-)
  create mode 100644 
Documentation/devicetree/bindings/regulator/pbias-regulator.txt
  create mode 100644 drivers/regulator/pbias-regulator.c



--
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/RFC] dmaengine: omap-dma: split header file

2014-02-04 Thread Balaji T K

On Friday 24 January 2014 10:21 PM, Balaji T K wrote:

To Resolve build failure seen with sh-allmodconfig:
 include/linux/omap-dma.h:171:8: error: expected identifier before numeric 
constant
 make[4]: *** [drivers/mmc/host/omap_hsmmc.o] Error 1
due to CCR redefinition, move dmaengine consumer specific function to 
omap-dmaengine.h

Tested-by: Geert Uytterhoeven ge...@linux-m68k.org
Signed-off-by: Balaji T K balaj...@ti.com

Hi Russell,

Ping,
If this patch looks OK, I can drop RFC and post as Patch, let me know.

Thanks and Regards,
Balaji T K


---
  drivers/mmc/host/omap_hsmmc.c  |2 +-
  include/linux/omap-dma.h   |   19 +--
  include/linux/omap-dmaengine.h |   21 +
  3 files changed, 23 insertions(+), 19 deletions(-)
  create mode 100644 include/linux/omap-dmaengine.h

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index dbd32ad..2f57e36 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -31,7 +31,7 @@
  #include linux/of.h
  #include linux/of_gpio.h
  #include linux/of_device.h
-#include linux/omap-dma.h
+#include linux/omap-dmaengine.h
  #include linux/mmc/host.h
  #include linux/mmc/core.h
  #include linux/mmc/mmc.h
diff --git a/include/linux/omap-dma.h b/include/linux/omap-dma.h
index 7af25a9..6aa97e5 100644
--- a/include/linux/omap-dma.h
+++ b/include/linux/omap-dma.h
@@ -1,23 +1,6 @@
-/*
- * OMAP DMA Engine support
- *
- * 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.
- */
  #ifndef __LINUX_OMAP_DMA_H
  #define __LINUX_OMAP_DMA_H
-
-struct dma_chan;
-
-#if defined(CONFIG_DMA_OMAP) || defined(CONFIG_DMA_OMAP_MODULE)
-bool omap_dma_filter_fn(struct dma_chan *, void *);
-#else
-static inline bool omap_dma_filter_fn(struct dma_chan *c, void *d)
-{
-   return false;
-}
-#endif
+#include linux/omap-dmaengine.h

  /*
   *  Legacy OMAP DMA handling defines and functions
diff --git a/include/linux/omap-dmaengine.h b/include/linux/omap-dmaengine.h
new file mode 100644
index 000..2b0b6aa
--- /dev/null
+++ b/include/linux/omap-dmaengine.h
@@ -0,0 +1,21 @@
+/*
+ * OMAP DMA Engine support
+ *
+ * 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.
+ */
+#ifndef __LINUX_OMAP_DMAENGINE_H
+#define __LINUX_OMAP_DMAENGINE_H
+
+struct dma_chan;
+
+#if defined(CONFIG_DMA_OMAP) || defined(CONFIG_DMA_OMAP_MODULE)
+bool omap_dma_filter_fn(struct dma_chan *, void *);
+#else
+static inline bool omap_dma_filter_fn(struct dma_chan *c, void *d)
+{
+   return false;
+}
+#endif
+#endif /* __LINUX_OMAP_DMAENGINE_H */



--
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] mmc: omap_hsmmc: Add support for Erratum 2.1.1.128 in device tree boot

2014-02-04 Thread Balaji T K

On Tuesday 21 January 2014 04:59 AM, Nishanth Menon wrote:

When device is booted using devicetree, platforms impacted by
Erratum 2.1.1.128 is not detected easily in the mmc driver. This erratum
indicates that the module cannot do multi-block transfers.

Handle this by providing a boolean flag to indicate to driver that it is
working on a hardware with mentioned limitation.

Signed-off-by: Nishanth Menon n...@ti.com
---

This explains the logs I see:
OMAP3430 LDP (ES2.2):
uImage only boot:  http://slexy.org/raw/s2YrbMAi7c
uImage+dtb concatenated boot: http://slexy.org/raw/s20qVg17T0

With the following flag set, device is now able to consistently boot with
device tree supported uImage+dtb concat boot.

  .../devicetree/bindings/mmc/ti-omap-hsmmc.txt  |2 ++
  drivers/mmc/host/omap_hsmmc.c  |3 +++
  2 files changed, 5 insertions(+)

diff --git a/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt 
b/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt
index 8c8908a..ab36f8b 100644
--- a/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt
+++ b/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt
@@ -26,6 +26,8 @@ specifier is required.
  dma-names: List of DMA request names. These strings correspond
  1:1 with the DMA specifiers listed in dmas. The string naming is
  to be rx and tx for RX and TX DMA requests, respectively.
+ti,erratum-2.1.1.128: boolean, for OMAP3430/OMAP35xx platforms with broken
+multiblock reads


Rather than ti,errata.. specific property, something like
caps no/disable multiblock read is more readable in my opinion, Otherwise

Acked-by: Balaji T K balaj...@ti.com



  Examples:

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 014bfe5..f2d5940 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1730,6 +1730,9 @@ static struct omap_mmc_platform_data 
*of_get_hsmmc_pdata(struct device *dev)
if (of_find_property(np, ti,dual-volt, NULL))
pdata-controller_flags |= OMAP_HSMMC_SUPPORTS_DUAL_VOLT;

+   if (of_find_property(np, ti,erratum-2.1.1.128, NULL))
+   pdata-controller_flags |= OMAP_HSMMC_BROKEN_MULTIBLOCK_READ;
+
/* This driver only supports 1 slot */
pdata-nr_slots = 1;
pdata-slots[0].switch_pin = cd_gpio;



--
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] ARM: dts: omap3-ldp: fix mmc configuration

2014-02-04 Thread Balaji T K

On Tuesday 21 January 2014 05:04 AM, Nishanth Menon wrote:

MMC1 is the only MMC interface available on the platform. Further,
since the platform is based on older revision of SoC which is not
capable of doing multi-block writes, mark it so and add pinmux


s/writes/read

Thanks and Regards,
Balaji T K


to ensure that all relevant pins are configured for non-MMC boot
mode.

Signed-off-by: Nishanth Menon n...@ti.com
---
ti,erratum-2.1.1.128 introduced in https://patchwork.kernel.org/patch/3514851/
hence depends on the same.
  arch/arm/boot/dts/omap3-ldp.dts |   22 ++
  1 file changed, 22 insertions(+)

diff --git a/arch/arm/boot/dts/omap3-ldp.dts b/arch/arm/boot/dts/omap3-ldp.dts
index ddce0d8..bc0cc66 100644
--- a/arch/arm/boot/dts/omap3-ldp.dts
+++ b/arch/arm/boot/dts/omap3-ldp.dts
@@ -176,6 +176,17 @@
  mmc1 {
vmmc-supply = vmmc1;
bus-width = 4;
+   ti,erratum-2.1.1.128;
+   pinctrl-names = default;
+   pinctrl-0 = mmc1_pins;
+};
+
+mmc2 {
+   status=disabled;
+};
+
+mmc3 {
+   status=disabled;
  };

  omap3_pmx_core {
@@ -209,6 +220,17 @@
0x174 (PIN_OUTPUT | MUX_MODE0)  /* 
hsusb0_stp.hsusb0_stp */
;
};
+
+   mmc1_pins: pinmux_mmc1_pins {
+   pinctrl-single,pins = 
+   OMAP3_CORE1_IOPAD(0x2144, PIN_INPUT_PULLUP | MUX_MODE0) 
/* mmc1_clk.mmc1_clk */
+   OMAP3_CORE1_IOPAD(0x2146, PIN_INPUT_PULLUP | MUX_MODE0) 
/* mmc1_cmd.mmc1_cmd */
+   OMAP3_CORE1_IOPAD(0x2148, PIN_INPUT_PULLUP | MUX_MODE0) 
/* mmc1_dat0.mmc1_dat0 */
+   OMAP3_CORE1_IOPAD(0x214A, PIN_INPUT_PULLUP | MUX_MODE0) 
/* mmc1_dat1.mmc1_dat1 */
+   OMAP3_CORE1_IOPAD(0x214C, PIN_INPUT_PULLUP | MUX_MODE0) 
/* mmc1_dat2.mmc1_dat2 */
+   OMAP3_CORE1_IOPAD(0x214e, PIN_INPUT_PULLUP | MUX_MODE0) 
/* mmc1_dat3.mmc1_dat3 */
+   ;
+   };
  };

  usb_otg_hs {



--
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 1/2] mmc: omap_hsmmc: remove a duplicative test

2014-01-30 Thread Balaji T K

On Thursday 30 January 2014 05:45 PM, Dan Carpenter wrote:

Static checkers complain that testing for both next and !next is
duplicative.

Signed-off-by: Dan Carpenter dan.carpen...@oracle.com



Looks good to me
Acked-by: Balaji T K balaj...@ti.com


diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 2a629fbde613..bfb0dbd052c0 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1235,8 +1235,7 @@ static int omap_hsmmc_pre_dma_transfer(struct 
omap_hsmmc_host *host,
}

/* Check if next job is already prepared */
-   if (next ||
-   (!next  data-host_cookie != host-next_data.cookie)) {
+   if (next || data-host_cookie != host-next_data.cookie) {
dma_len = dma_map_sg(chan-device-dev, data-sg, data-sg_len,
 omap_hsmmc_get_dma_dir(host, data));




--
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 2/2] mmc: omap_hsmmc: checking for ERR_PTR instead of NULL

2014-01-30 Thread Balaji T K

On Thursday 30 January 2014 05:45 PM, Dan Carpenter wrote:

The of_get_hsmmc_pdata() function returns NULL on error, it doesn't
return ERR_PTRs.

Signed-off-by: Dan Carpenter dan.carpen...@oracle.com

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index bfb0dbd052c0..76dbc7b759c2 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1761,9 +1761,8 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
match = of_match_device(of_match_ptr(omap_mmc_of_match), pdev-dev);
if (match) {
pdata = of_get_hsmmc_pdata(pdev-dev);
-
-   if (IS_ERR(pdata))
-   return PTR_ERR(pdata);
+   if (!pdata)
+   return -ENOMEM;


Thanks for reporting this.
Caller needs to be fixed. I will send a patch to fix this.



if (match-data) {
const u16 *offsetp = match-data;



--
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] mmc: omap_hsmmc: precedence bug in omap_hsmmc_context_restore()

2014-01-30 Thread Balaji T K

On Thursday 30 January 2014 05:45 PM, Dan Carpenter wrote:

On Thu, Aug 22, 2013 at 08:16:28PM +0530, Balaji T K wrote:

On Thursday 22 August 2013 06:26 PM, Dan Carpenter wrote:

'!' has higher precedence than '' so this doesn't work as intended
although since RESETDONE is 1 it would work if none of the other bits
are set.


Hi Dan,

Thanks for the patch, Indeed other bits are reserved.
however ...


Signed-off-by: Dan Carpenter dan.carpen...@oracle.com
---
Untested.

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 1865321..7346b15 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -612,7 +612,7 @@ static int omap_hsmmc_context_restore(struct 
omap_hsmmc_host *host)
if (host-context_loss == context_loss)
return 1;

-   if (!OMAP_HSMMC_READ(host-base, SYSSTATUS)  RESETDONE)
+   if (!(OMAP_HSMMC_READ(host-base, SYSSTATUS)  RESETDONE))
return 1;


This check is unnecessary, will send a patch to remove this.


What happened with this?


My bad, I missed it, will fix it.

Thanks and Regards,
Balaji T K
--
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/RFC] dmaengine: omap-dma: split header file

2014-01-24 Thread Balaji T K
To Resolve build failure seen with sh-allmodconfig:
include/linux/omap-dma.h:171:8: error: expected identifier before numeric 
constant
make[4]: *** [drivers/mmc/host/omap_hsmmc.o] Error 1
due to CCR redefinition, move dmaengine consumer specific function to 
omap-dmaengine.h

Tested-by: Geert Uytterhoeven ge...@linux-m68k.org
Signed-off-by: Balaji T K balaj...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c  |2 +-
 include/linux/omap-dma.h   |   19 +--
 include/linux/omap-dmaengine.h |   21 +
 3 files changed, 23 insertions(+), 19 deletions(-)
 create mode 100644 include/linux/omap-dmaengine.h

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index dbd32ad..2f57e36 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -31,7 +31,7 @@
 #include linux/of.h
 #include linux/of_gpio.h
 #include linux/of_device.h
-#include linux/omap-dma.h
+#include linux/omap-dmaengine.h
 #include linux/mmc/host.h
 #include linux/mmc/core.h
 #include linux/mmc/mmc.h
diff --git a/include/linux/omap-dma.h b/include/linux/omap-dma.h
index 7af25a9..6aa97e5 100644
--- a/include/linux/omap-dma.h
+++ b/include/linux/omap-dma.h
@@ -1,23 +1,6 @@
-/*
- * OMAP DMA Engine support
- *
- * 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.
- */
 #ifndef __LINUX_OMAP_DMA_H
 #define __LINUX_OMAP_DMA_H
-
-struct dma_chan;
-
-#if defined(CONFIG_DMA_OMAP) || defined(CONFIG_DMA_OMAP_MODULE)
-bool omap_dma_filter_fn(struct dma_chan *, void *);
-#else
-static inline bool omap_dma_filter_fn(struct dma_chan *c, void *d)
-{
-   return false;
-}
-#endif
+#include linux/omap-dmaengine.h
 
 /*
  *  Legacy OMAP DMA handling defines and functions
diff --git a/include/linux/omap-dmaengine.h b/include/linux/omap-dmaengine.h
new file mode 100644
index 000..2b0b6aa
--- /dev/null
+++ b/include/linux/omap-dmaengine.h
@@ -0,0 +1,21 @@
+/*
+ * OMAP DMA Engine support
+ *
+ * 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.
+ */
+#ifndef __LINUX_OMAP_DMAENGINE_H
+#define __LINUX_OMAP_DMAENGINE_H
+
+struct dma_chan;
+
+#if defined(CONFIG_DMA_OMAP) || defined(CONFIG_DMA_OMAP_MODULE)
+bool omap_dma_filter_fn(struct dma_chan *, void *);
+#else
+static inline bool omap_dma_filter_fn(struct dma_chan *c, void *d)
+{
+   return false;
+}
+#endif
+#endif /* __LINUX_OMAP_DMAENGINE_H */
-- 
1.7.5.4

--
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/RFC] dmaengine: omap-dma: split header file

2014-01-24 Thread Balaji T K

On Friday 24 January 2014 10:21 PM, Balaji T K wrote:

To Resolve build failure seen with sh-allmodconfig:
 include/linux/omap-dma.h:171:8: error: expected identifier before numeric 
constant
 make[4]: *** [drivers/mmc/host/omap_hsmmc.o] Error 1
due to CCR redefinition, move dmaengine consumer specific function to 
omap-dmaengine.h

Tested-by: Geert Uytterhoeven ge...@linux-m68k.org


s/Tested-by/Reported-by


Signed-off-by: Balaji T K balaj...@ti.com
---
  drivers/mmc/host/omap_hsmmc.c  |2 +-
  include/linux/omap-dma.h   |   19 +--
  include/linux/omap-dmaengine.h |   21 +
  3 files changed, 23 insertions(+), 19 deletions(-)
  create mode 100644 include/linux/omap-dmaengine.h

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index dbd32ad..2f57e36 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -31,7 +31,7 @@
  #include linux/of.h
  #include linux/of_gpio.h
  #include linux/of_device.h
-#include linux/omap-dma.h
+#include linux/omap-dmaengine.h
  #include linux/mmc/host.h
  #include linux/mmc/core.h
  #include linux/mmc/mmc.h
diff --git a/include/linux/omap-dma.h b/include/linux/omap-dma.h
index 7af25a9..6aa97e5 100644
--- a/include/linux/omap-dma.h
+++ b/include/linux/omap-dma.h
@@ -1,23 +1,6 @@
-/*
- * OMAP DMA Engine support
- *
- * 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.
- */
  #ifndef __LINUX_OMAP_DMA_H
  #define __LINUX_OMAP_DMA_H
-
-struct dma_chan;
-
-#if defined(CONFIG_DMA_OMAP) || defined(CONFIG_DMA_OMAP_MODULE)
-bool omap_dma_filter_fn(struct dma_chan *, void *);
-#else
-static inline bool omap_dma_filter_fn(struct dma_chan *c, void *d)
-{
-   return false;
-}
-#endif
+#include linux/omap-dmaengine.h

  /*
   *  Legacy OMAP DMA handling defines and functions
diff --git a/include/linux/omap-dmaengine.h b/include/linux/omap-dmaengine.h
new file mode 100644
index 000..2b0b6aa
--- /dev/null
+++ b/include/linux/omap-dmaengine.h
@@ -0,0 +1,21 @@
+/*
+ * OMAP DMA Engine support
+ *
+ * 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.
+ */
+#ifndef __LINUX_OMAP_DMAENGINE_H
+#define __LINUX_OMAP_DMAENGINE_H
+
+struct dma_chan;
+
+#if defined(CONFIG_DMA_OMAP) || defined(CONFIG_DMA_OMAP_MODULE)
+bool omap_dma_filter_fn(struct dma_chan *, void *);
+#else
+static inline bool omap_dma_filter_fn(struct dma_chan *c, void *d)
+{
+   return false;
+}
+#endif
+#endif /* __LINUX_OMAP_DMAENGINE_H */



--
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 4/5] mmc: omap_hsmmc: add cmd23 support

2014-01-21 Thread Balaji T K
Add set block count command support for close ended
multiblock read/write.

Signed-off-by: Balaji T K balaj...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c |   21 +
 1 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index b02fd30..bad246e 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -193,6 +193,8 @@ struct omap_hsmmc_host {
struct  omap_mmc_platform_data  *pdata;
 };
 
+static void omap_hsmmc_start_dma_transfer(struct omap_hsmmc_host *host);
+
 static int omap_hsmmc_card_detect(struct device *dev, int slot)
 {
struct omap_hsmmc_host *host = dev_get_drvdata(dev);
@@ -865,11 +867,10 @@ omap_hsmmc_xfer_done(struct omap_hsmmc_host *host, struct 
mmc_data *data)
else
data-bytes_xfered = 0;
 
-   if (!data-stop) {
+   if (data-stop  (data-error || !host-mrq-sbc))
+   omap_hsmmc_start_command(host, data-stop, NULL);
+   else
omap_hsmmc_request_done(host, data-mrq);
-   return;
-   }
-   omap_hsmmc_start_command(host, data-stop, NULL);
 }
 
 /*
@@ -880,6 +881,14 @@ omap_hsmmc_cmd_done(struct omap_hsmmc_host *host, struct 
mmc_command *cmd)
 {
host-cmd = NULL;
 
+   if (host-mrq-sbc  (host-cmd == host-mrq-sbc) 
+   !host-mrq-sbc-error) {
+   omap_hsmmc_start_dma_transfer(host);
+   omap_hsmmc_start_command(host, host-mrq-cmd,
+   host-mrq-data);
+   return;
+   }
+
if (cmd-flags  MMC_RSP_PRESENT) {
if (cmd-flags  MMC_RSP_136) {
/* response type 2 */
@@ -1482,6 +1491,10 @@ static void omap_hsmmc_request(struct mmc_host *mmc, 
struct mmc_request *req)
mmc_request_done(mmc, req);
return;
}
+   if (req-sbc) {
+   omap_hsmmc_start_command(host, req-sbc, NULL);
+   return;
+   }
 
omap_hsmmc_start_dma_transfer(host);
omap_hsmmc_start_command(host, req-cmd, req-data);
-- 
1.7.5.4

--
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 5/5] mmc: omap_hsmmc: add autocmd23 support

2014-01-21 Thread Balaji T K
Add support for autocmd23 support

Signed-off-by: Balaji T K balaj...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c |   39 ---
 1 files changed, 36 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index bad246e..fba67ab 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -45,6 +45,7 @@
 /* OMAP HSMMC Host Controller Registers */
 #define OMAP_HSMMC_SYSSTATUS   0x0014
 #define OMAP_HSMMC_CON 0x002C
+#define OMAP_HSMMC_SDMASA  0x0100
 #define OMAP_HSMMC_BLK 0x0104
 #define OMAP_HSMMC_ARG 0x0108
 #define OMAP_HSMMC_CMD 0x010C
@@ -58,6 +59,7 @@
 #define OMAP_HSMMC_STAT0x0130
 #define OMAP_HSMMC_IE  0x0134
 #define OMAP_HSMMC_ISE 0x0138
+#define OMAP_HSMMC_AC120x013C
 #define OMAP_HSMMC_CAPA0x0140
 
 #define VS18   (1  26)
@@ -81,6 +83,7 @@
 #define DTO_MASK   0x000F
 #define DTO_SHIFT  16
 #define INIT_STREAM(1  1)
+#define ACEN_ACMD23(2  2)
 #define DP_SELECT  (1  21)
 #define DDIR   (1  4)
 #define DMAE   0x1
@@ -112,13 +115,21 @@
 #define DTO_EN (1  20)
 #define DCRC_EN(1  21)
 #define DEB_EN (1  22)
+#define ACE_EN (1  24)
 #define CERR_EN(1  28)
 #define BADA_EN(1  29)
 
-#define INT_EN_MASK(BADA_EN | CERR_EN | DEB_EN | DCRC_EN |\
+#define INT_EN_MASK (BADA_EN | CERR_EN | ACE_EN | DEB_EN | DCRC_EN |\
DTO_EN | CIE_EN | CEB_EN | CCRC_EN | CTO_EN | \
BRR_EN | BWR_EN | TC_EN | CC_EN)
 
+#define CNI(1  7)
+#define ACIE   (1  4)
+#define ACEB   (1  3)
+#define ACCE   (1  2)
+#define ACTO   (1  1)
+#define ACNE   (1  0)
+
 #define MMC_AUTOSUSPEND_DELAY  100
 #define MMC_TIMEOUT_MS 20  /* 20 mSec */
 #define MMC_TIMEOUT_US 2   /* 2 micro Sec */
@@ -126,6 +137,7 @@
 #define OMAP_MMC_MAX_CLOCK 5200
 #define DRIVER_NAMEomap_hsmmc
 
+#define AUTO_CMD23 (1  1)/* Auto CMD23 support */
 /*
  * One controller can have multiple slots, like on some omap boards using
  * omap.c controller driver. Luckily this is not currently done on any known
@@ -189,6 +201,7 @@ struct omap_hsmmc_host {
int use_reg;
int req_in_progress;
unsigned long   clk_rate;
+   unsigned intflags;
struct omap_hsmmc_next  next_data;
struct  omap_mmc_platform_data  *pdata;
 };
@@ -790,6 +803,11 @@ omap_hsmmc_start_command(struct omap_hsmmc_host *host, 
struct mmc_command *cmd,
 
cmdreg = (cmd-opcode  24) | (resptype  16) | (cmdtype  22);
 
+   if ((host-flags  AUTO_CMD23)  mmc_op_multi(cmd-opcode) 
+   host-mrq-sbc) {
+   cmdreg |= ACEN_ACMD23;
+   OMAP_HSMMC_WRITE(host-base, SDMASA, host-mrq-sbc-arg);
+   }
if (data) {
cmdreg |= DP_SELECT | MSBS | BCE;
if (data-flags  MMC_DATA_READ)
@@ -882,7 +900,7 @@ omap_hsmmc_cmd_done(struct omap_hsmmc_host *host, struct 
mmc_command *cmd)
host-cmd = NULL;
 
if (host-mrq-sbc  (host-cmd == host-mrq-sbc) 
-   !host-mrq-sbc-error) {
+   !host-mrq-sbc-error  !(host-flags  AUTO_CMD23)) {
omap_hsmmc_start_dma_transfer(host);
omap_hsmmc_start_command(host, host-mrq-cmd,
host-mrq-data);
@@ -1025,6 +1043,7 @@ static void omap_hsmmc_do_irq(struct omap_hsmmc_host 
*host, int status)
 {
struct mmc_data *data;
int end_cmd = 0, end_trans = 0;
+   int error = 0;
 
data = host-data;
dev_vdbg(mmc_dev(host-mmc), IRQ Status is %x\n, status);
@@ -1039,6 +1058,20 @@ static void omap_hsmmc_do_irq(struct omap_hsmmc_host 
*host, int status)
else if (status  (CCRC_EN | DCRC_EN))
hsmmc_command_incomplete(host, -EILSEQ, end_cmd);
 
+   if (status  ACE_EN) {
+   u32 ac12;
+   ac12 = OMAP_HSMMC_READ(host-base, AC12);
+   if (!(ac12  ACNE)  host-mrq-sbc) {
+   end_cmd = 1;
+   if (ac12  ACTO)
+   error =  -ETIMEDOUT;
+   else if (ac12  (ACCE | ACEB | ACIE))
+   error = -EILSEQ;
+   host-mrq-sbc-error = error;
+   hsmmc_command_incomplete(host, error, end_cmd);
+   }
+   dev_dbg(mmc_dev(host-mmc), AC12 err: 0x%x\n, ac12);
+   }
if (host-data || host

[PATCH 0/5] mmc: omap_hsmmc: add support for set block count

2014-01-21 Thread Balaji T K
Balaji T K (5):
  mmc: omap_hsmmc: save clock rate to use in interrupt context
  mmc: omap_hsmmc: fix request done for sbc error case
  mmc: omap_hsmmc: split dma setup
  mmc: omap_hsmmc: add cmd23 support
  mmc: omap_hsmmc: add autocmd23 support

 drivers/mmc/host/omap_hsmmc.c |   88 ++---
 1 files changed, 73 insertions(+), 15 deletions(-)

-- 
1.7.5.4

--
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 2/5] mmc: omap_hsmmc: fix request done for sbc error case

2014-01-21 Thread Balaji T K
mrq is not populated for set block count(cmd23) command.
Use block read/write mmc_commond pointer for request done and
avoid NULL pointer access in error case for sbc (cmd23).

Signed-off-by: Balaji T K balaj...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 8d0048d..d3774b8 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -893,7 +893,7 @@ omap_hsmmc_cmd_done(struct omap_hsmmc_host *host, struct 
mmc_command *cmd)
}
}
if ((host-data == NULL  !host-response_busy) || cmd-error)
-   omap_hsmmc_request_done(host, cmd-mrq);
+   omap_hsmmc_request_done(host, host-mrq);
 }
 
 /*
-- 
1.7.5.4

--
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 1/5] mmc: omap_hsmmc: save clock rate to use in interrupt context

2014-01-21 Thread Balaji T K
clk_get_rate throws DEBUG_LOCKS_WARN_ON(in_interrupt()) warning
if called from interrupt context.
use cached clock rate in set_data_timeout, so that
set_data_timeout can be called from interrupt context.

Signed-off-by: Balaji T K balaj...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index dbd32ad..8d0048d 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -188,6 +188,7 @@ struct omap_hsmmc_host {
int reqs_blocked;
int use_reg;
int req_in_progress;
+   unsigned long   clk_rate;
struct omap_hsmmc_next  next_data;
struct  omap_mmc_platform_data  *pdata;
 };
@@ -1338,7 +1339,7 @@ static void set_data_timeout(struct omap_hsmmc_host *host,
if (clkd == 0)
clkd = 1;
 
-   cycle_ns = 10 / (clk_get_rate(host-fclk) / clkd);
+   cycle_ns = 10 / (host-clk_rate / clkd);
timeout = timeout_ns / cycle_ns;
timeout += timeout_clks;
if (timeout) {
@@ -1462,6 +1463,7 @@ static void omap_hsmmc_request(struct mmc_host *mmc, 
struct mmc_request *req)
host-reqs_blocked = 0;
WARN_ON(host-mrq != NULL);
host-mrq = req;
+   host-clk_rate = clk_get_rate(host-fclk);
err = omap_hsmmc_prepare_data(host, req);
if (err) {
req-cmd-error = err;
-- 
1.7.5.4

--
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 3/5] mmc: omap_hsmmc: split dma setup

2014-01-21 Thread Balaji T K
split start dma function into setup and start dma
to keep track of host_cookie when cmd23 support is enabled
along with async request.

Signed-off-by: Balaji T K balaj...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c |   26 ++
 1 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index d3774b8..b02fd30 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1263,7 +1263,7 @@ static int omap_hsmmc_pre_dma_transfer(struct 
omap_hsmmc_host *host,
 /*
  * Routine to configure and start DMA for the MMC card
  */
-static int omap_hsmmc_start_dma_transfer(struct omap_hsmmc_host *host,
+static int omap_hsmmc_setup_dma_transfer(struct omap_hsmmc_host *host,
struct mmc_request *req)
 {
struct dma_slave_config cfg;
@@ -1322,8 +1322,6 @@ static int omap_hsmmc_start_dma_transfer(struct 
omap_hsmmc_host *host,
 
host-dma_ch = 1;
 
-   dma_async_issue_pending(chan);
-
return 0;
 }
 
@@ -1364,6 +1362,21 @@ static void set_data_timeout(struct omap_hsmmc_host 
*host,
OMAP_HSMMC_WRITE(host-base, SYSCTL, reg);
 }
 
+static void omap_hsmmc_start_dma_transfer(struct omap_hsmmc_host *host)
+{
+   struct mmc_request *req = host-mrq;
+   struct dma_chan *chan;
+
+   if (!req-data)
+   return;
+   OMAP_HSMMC_WRITE(host-base, BLK, (req-data-blksz)
+   | (req-data-blocks  16));
+   set_data_timeout(host, req-data-timeout_ns,
+   req-data-timeout_clks);
+   chan = omap_hsmmc_get_dma_chan(host, req-data);
+   dma_async_issue_pending(chan);
+}
+
 /*
  * Configure block length for MMC/SD cards and initiate the transfer.
  */
@@ -1384,12 +1397,8 @@ omap_hsmmc_prepare_data(struct omap_hsmmc_host *host, 
struct mmc_request *req)
return 0;
}
 
-   OMAP_HSMMC_WRITE(host-base, BLK, (req-data-blksz)
-   | (req-data-blocks  16));
-   set_data_timeout(host, req-data-timeout_ns, req-data-timeout_clks);
-
if (host-use_dma) {
-   ret = omap_hsmmc_start_dma_transfer(host, req);
+   ret = omap_hsmmc_setup_dma_transfer(host, req);
if (ret != 0) {
dev_err(mmc_dev(host-mmc), MMC start dma failure\n);
return ret;
@@ -1474,6 +1483,7 @@ static void omap_hsmmc_request(struct mmc_host *mmc, 
struct mmc_request *req)
return;
}
 
+   omap_hsmmc_start_dma_transfer(host);
omap_hsmmc_start_command(host, req-cmd, req-data);
 }
 
-- 
1.7.5.4

--
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: Multiple CCR definitions

2014-01-17 Thread Balaji T K

On Friday 17 January 2014 12:09 AM, Nishanth Menon wrote:

+linux-omap as well.

On Thu, Jan 16, 2014 at 7:07 AM, Geert Uytterhoeven
ge...@linux-m68k.org wrote:

On Tue, Sep 10, 2013 at 11:05 PM, Linux Kernel Mailing List
linux-ker...@vger.kernel.org wrote:

 mmc: omap_hsmmc: use the generic config for omap2plus devices

 OMAP's hs_mmc driver is used for MMC controller operation on many
 omap2plus SoCs (OMAP2430, OMAP3, 4, 5 and AM335x).

 Considering that the device tree entries are already present for these,
 allow the driver to be built using the config ARCH_OMAP2PLUS rather
 than individually adding a config for each SoC to enable the
 support.

 Use COMPILE_TEST to enable the build for other platforms.

 Signed-off-by: Amarinder Bindra a-bin...@ti.com
 Cc: Ezequiel Garcia ezequiel.gar...@free-electrons.com
 Cc: Nishanth Menon n...@ti.com
 Acked-by: Felipe Balbi ba...@ti.com
 Acked-by: Balaji T K balaj...@ti.com
 Signed-off-by: Chris Ball c...@laptop.org
---
  drivers/mmc/host/Kconfig |6 +++---
  1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
index 84102bc..b8ce939 100644
--- a/drivers/mmc/host/Kconfig
+++ b/drivers/mmc/host/Kconfig
@@ -284,11 +284,11 @@ config MMC_OMAP

  config MMC_OMAP_HS
 tristate TI OMAP High Speed Multimedia Card Interface support
-   depends on SOC_OMAP2430 || ARCH_OMAP3 || ARCH_OMAP4
+   depends on ARCH_OMAP2PLUS || COMPILE_TEST


sh-allmodconfig (http://kisskb.ellerman.id.au/kisskb/buildresult/10477672/):
include/linux/omap-dma.h:171:8: error: expected identifier before
numeric constant
make[4]: *** [drivers/mmc/host/omap_hsmmc.o] Error 1

It fails because sh #defines CCR, which is one of the enum values in
include/linux/omap-dma.h.

I expect a similar failure on blackfin, which also has #define CCR.

Possible solutions:
   1. Rename CCR in sh/bfin to e.g. SH_CCR resp. BF_CCR.
   2. Use depends on ARCH_OMAP2PLUS || (COMPILE_TEST  ARM)


omap-dma.h will be needed until all OMAPs are converted to DT only boot.
So depends on ARCH_OMAP2PLUS || (COMPILE_TEST  ARM) looks good to me


   3. Stop using include/linux/omap-dma.h, as it says:

  *  Legacy OMAP DMA handling defines and functions
  *
  *  NOTE: Do not use these any longer.
  *
  *  Use the generic dmaengine functions as defined in
  *  include/linux/dmaengine.h.




Gr{oetje,eeting}s,

 Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say programmer or something like that.
 -- Linus Torvalds

--
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



--
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/3] ARM: dts: am43x/am335x-evm: add SD card hotplug support

2014-01-15 Thread Balaji T K

On Friday 27 December 2013 09:59 PM, Balaji T K wrote:

Balaji T K (3):
   ARM: dts: am335x-evm: add SD card hotplug support
   ARM: dts: am335x-evmsk: add SD card hotplug support
   ARM: dts: am43x-epos-evm: add SD card hotplug support

  arch/arm/boot/dts/am335x-evm.dts |9 +
  arch/arm/boot/dts/am335x-evmsk.dts   |9 +
  arch/arm/boot/dts/am4372.dtsi|1 +
  arch/arm/boot/dts/am43x-epos-evm.dts |9 +
  4 files changed, 28 insertions(+), 0 deletions(-)


Hi Benoit,

Gentle ping!


--
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 v10 5/7] ARM: dts: add pbias dt node

2014-01-15 Thread Balaji T K

On Monday 13 January 2014 09:06 PM, Balaji T K wrote:

Add pbias regulator node as a child of system control
module - syscon.

Signed-off-by: Balaji T K balaj...@ti.com
Acked-by: Tony Lindgren t...@atomide.com

Hi Benoit,

Gentle Ping, Let me know if you have any comments.


---
  arch/arm/boot/dts/dra7.dtsi |   17 +
  arch/arm/boot/dts/omap2430.dtsi |   17 +
  arch/arm/boot/dts/omap3.dtsi|   17 +
  arch/arm/boot/dts/omap4.dtsi|   17 +
  arch/arm/boot/dts/omap5.dtsi|   17 +
  5 files changed, 85 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
index d0df4c4..876c9b8 100644
--- a/arch/arm/boot/dts/dra7.dtsi
+++ b/arch/arm/boot/dts/dra7.dtsi
@@ -110,6 +110,22 @@
ti,hwmods = counter_32k;
};

+   dra7_ctrl_general: tisyscon@4a002e00 {
+   compatible = syscon, simple-bus;
+   reg = 0x4a002e00 0x7c;
+   };
+
+   pbias_regulator: pbias_regulator {
+   compatible = ti,pbias-omap;
+   reg = 0 0x4;
+   syscon = dra7_ctrl_general;
+   pbias_mmc_reg: pbias_mmc_omap5 {
+   regulator-name = pbias_mmc_omap5;
+   regulator-min-microvolt = 180;
+   regulator-max-microvolt = 300;
+   };
+   };
+
dra7_pmx_core: pinmux@4a003400 {
compatible = pinctrl-single;
reg = 0x4a003400 0x0464;
@@ -485,6 +501,7 @@
dmas = sdma 61, sdma 62;
dma-names = tx, rx;
status = disabled;
+   pbias-supply = pbias_mmc_reg;
};

mmc2: mmc@480b4000 {
diff --git a/arch/arm/boot/dts/omap2430.dtsi b/arch/arm/boot/dts/omap2430.dtsi
index d624345..af71eb0 100644
--- a/arch/arm/boot/dts/omap2430.dtsi
+++ b/arch/arm/boot/dts/omap2430.dtsi
@@ -29,6 +29,22 @@
pinctrl-single,function-mask = 0x3f;
};

+   omap2_scm_general: tisyscon@49002270 {
+   compatible = syscon, simple-bus;
+   reg = 0x49002270 0x240;
+   };
+
+   pbias_regulator: pbias_regulator {
+   compatible = ti,pbias-omap;
+   reg = 0x230 0x4;
+   syscon = omap2_scm_general;
+   pbias_mmc_reg: pbias_mmc_omap2430 {
+   regulator-name = pbias_mmc_omap2430;
+   regulator-min-microvolt = 180;
+   regulator-max-microvolt = 300;
+   };
+   };
+
gpio1: gpio@4900c000 {
compatible = ti,omap2-gpio;
reg = 0x4900c000 0x200;
@@ -183,6 +199,7 @@
ti,dual-volt;
dmas = sdma 61, sdma 62;
dma-names = tx, rx;
+   pbias-supply = pbias_mmc_reg;
};

mmc2: mmc@480b4000 {
diff --git a/arch/arm/boot/dts/omap3.dtsi b/arch/arm/boot/dts/omap3.dtsi
index daabf99..b7828da 100644
--- a/arch/arm/boot/dts/omap3.dtsi
+++ b/arch/arm/boot/dts/omap3.dtsi
@@ -137,6 +137,22 @@
pinctrl-single,function-mask = 0xff1f;
};

+   omap3_scm_general: tisyscon@48002270 {
+   compatible = syscon, simple-bus;
+   reg = 0x48002270 0x2f0;
+   };
+
+   pbias_regulator: pbias_regulator {
+   compatible = ti,pbias-omap;
+   reg = 0x2b0 0x4;
+   syscon = omap3_scm_general;
+   pbias_mmc_reg: pbias_mmc_omap2430 {
+   regulator-name = pbias_mmc_omap2430;
+   regulator-min-microvolt = 180;
+   regulator-max-microvolt = 300;
+   };
+   };
+
gpio1: gpio@4831 {
compatible = ti,omap3-gpio;
reg = 0x4831 0x200;
@@ -351,6 +367,7 @@
ti,dual-volt;
dmas = sdma 61, sdma 62;
dma-names = tx, rx;
+   pbias-supply = pbias_mmc_reg;
};

mmc2: mmc@480b4000 {
diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index a1e0585..9e19363 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -134,6 +134,22 @@
pinctrl-single,function-mask = 0x7fff

Re: [PATCH v9 4/7] mmc: omap_hsmmc: adapt hsmmc to use pbias regulator

2014-01-13 Thread Balaji T K

On Friday 10 January 2014 11:51 PM, Michael Trimarchi wrote:

Hi

On Fri, Jan 10, 2014 at 6:30 PM, Balaji T K balaj...@ti.com wrote:

In DT case, PBAIS registers are programmed via regulator,
use regulator APIs to control PBIAS.

Signed-off-by: Balaji T K balaj...@ti.com
---
  drivers/mmc/host/omap_hsmmc.c |   39 +++
  1 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 342be25..0a390f8 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -126,6 +126,10 @@
  #define OMAP_MMC_MAX_CLOCK 5200
  #define DRIVER_NAMEomap_hsmmc

+#define VDD_1V8180 /* 18 uV */
+#define VDD_3V0300 /* 30 uV */
+#define VDD_165_195(ffs(MMC_VDD_165_195) - 1)
+
  /*
   * One controller can have multiple slots, like on some omap boards using
   * omap.c controller driver. Luckily this is not currently done on any known
@@ -164,6 +168,8 @@ struct omap_hsmmc_host {
  */
 struct  regulator   *vcc;
 struct  regulator   *vcc_aux;
+   struct  regulator   *pbias;
+   boolpbias_enabled;
 int pbias_disable;
 void__iomem *base;
 resource_size_t mapbase;
@@ -272,6 +278,15 @@ static int omap_hsmmc_set_power(struct device *dev, int 
slot, int power_on,
 if (mmc_slot(host).before_set_reg)
 mmc_slot(host).before_set_reg(dev, slot, power_on, vdd);

+   if (host-pbias) {
+   if (host-pbias_enabled == 1) {
+   ret = regulator_disable(host-pbias);
+   if (!ret)
+   host-pbias_enabled = 0;
+   }
+   regulator_set_voltage(host-pbias, VDD_3V0, VDD_3V0);
+   }
+
 /*
  * Assume Vcc regulator is used only to power the card ... OMAP
  * VDDS is used to power the pins, optionally with a transceiver to
@@ -306,9 +321,29 @@ static int omap_hsmmc_set_power(struct device *dev, int 
slot, int power_on,
 }
 }

+   if (host-pbias) {
+   if (vdd = VDD_165_195)
+   ret = regulator_set_voltage(host-pbias, VDD_1V8,
+   VDD_1V8);
+   else
+   ret = regulator_set_voltage(host-pbias, VDD_3V0,
+   VDD_3V0);
+   if (ret  0)
+   goto error_set_power;
+
+   if (host-pbias_enabled == 0) {
+   ret = regulator_enable(host-pbias);
+   if (!ret) {
+   host-pbias_enabled = 1;
+   goto error_set_power;


why you a goto to error_set_power if the regulator enable was a succes?

Hi,

My bad
yes, goto error_set_power is not needed when regulator got enabled.
will remove it.



and if pbias_enabled is used for verify if is already enabled. Is the
same to use
regulator_is_enabled?



pbias_enabled is used to verify if it already enabled or not
and it is used to balance regulator_enable/disable.


Michael


+   }
+   }
+   }
+
 if (mmc_slot(host).after_set_reg)
 mmc_slot(host).after_set_reg(dev, slot, power_on, vdd);

+error_set_power:
 return ret;
  }

@@ -342,6 +377,9 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
 reg = devm_regulator_get_optional(host-dev, vmmc_aux);
 host-vcc_aux = IS_ERR(reg) ? NULL : reg;

+   reg = devm_regulator_get_optional(host-dev, pbias);
+   host-pbias = IS_ERR(reg) ? NULL : reg;
+
 /* For eMMC do not power off when not in sleep state */
 if (mmc_slot(host).no_regulator_off_init)
 return 0;
@@ -1808,6 +1846,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
 host-base  = ioremap(host-mapbase, SZ_4K);
 host-power_mode = MMC_POWER_OFF;
 host-next_data.cookie = 1;
+   host-pbias_enabled = 0;

 platform_set_drvdata(pdev, host);

--
1.7.5.4

--
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


--
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 v10 0/7] mmc: omap_hsmmc: pbias dt and cleanup

2014-01-13 Thread Balaji T K
Few cleanups to reduce code indent,
Add pbias_regulator support and adapt omap_hsmmc to use pbias regulator
to configure required voltage on mmc1 pad(SD card) i/o rails on OMAP SoCs.

Balaji T K (7):
  mmc: omap_hsmmc: use devm_regulator API
  mmc: omap_hsmmc: handle vcc and vcc_aux independently
  regulator: add pbias regulator support
  mmc: omap_hsmmc: adapt hsmmc to use pbias regulator
  ARM: dts: add pbias dt node
  ARM: OMAP: enable SYSCON and REGULATOR_PBIAS in omap2plus_defconfig
  mmc: omap_hsmmc: remove pbias workaround

 .../bindings/regulator/pbias-regulator.txt |   27 ++
 arch/arm/boot/dts/dra7.dtsi|   17 ++
 arch/arm/boot/dts/omap2430.dtsi|   17 ++
 arch/arm/boot/dts/omap3.dtsi   |   17 ++
 arch/arm/boot/dts/omap4.dtsi   |   17 ++
 arch/arm/boot/dts/omap5.dtsi   |   17 ++
 arch/arm/configs/omap2plus_defconfig   |2 +
 drivers/mmc/host/omap_hsmmc.c  |  111 +
 drivers/regulator/Kconfig  |9 +
 drivers/regulator/Makefile |1 +
 drivers/regulator/pbias-regulator.c|  255 
 11 files changed, 441 insertions(+), 49 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/regulator/pbias-regulator.txt
 create mode 100644 drivers/regulator/pbias-regulator.c

-- 
1.7.5.4

--
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 v10 1/7] mmc: omap_hsmmc: use devm_regulator API

2014-01-13 Thread Balaji T K
Use devm_regulator API, while at it use
devm_regulator_get_optional for optional vmmc_aux supply

Signed-off-by: Balaji T K balaj...@ti.com
Acked-by: Tony Lindgren t...@atomide.com
---
 drivers/mmc/host/omap_hsmmc.c |6 ++
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index dbd32ad..1eb4350 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -316,7 +316,7 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
struct regulator *reg;
int ocr_value = 0;
 
-   reg = regulator_get(host-dev, vmmc);
+   reg = devm_regulator_get(host-dev, vmmc);
if (IS_ERR(reg)) {
dev_err(host-dev, vmmc regulator missing\n);
return PTR_ERR(reg);
@@ -336,7 +336,7 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
}
 
/* Allow an aux regulator */
-   reg = regulator_get(host-dev, vmmc_aux);
+   reg = devm_regulator_get_optional(host-dev, vmmc_aux);
host-vcc_aux = IS_ERR(reg) ? NULL : reg;
 
/* For eMMC do not power off when not in sleep state */
@@ -366,8 +366,6 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
 
 static void omap_hsmmc_reg_put(struct omap_hsmmc_host *host)
 {
-   regulator_put(host-vcc);
-   regulator_put(host-vcc_aux);
mmc_slot(host).set_power = NULL;
 }
 
-- 
1.7.5.4

--
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 v10 2/7] mmc: omap_hsmmc: handle vcc and vcc_aux independently

2014-01-13 Thread Balaji T K
handle vcc and vcc_aux independently to reduce indent.

Signed-off-by: Balaji T K balaj...@ti.com
Acked-by: Tony Lindgren t...@atomide.com
---
 drivers/mmc/host/omap_hsmmc.c |   54 +++--
 1 files changed, 25 insertions(+), 29 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 1eb4350..342be25 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -286,11 +286,12 @@ static int omap_hsmmc_set_power(struct device *dev, int 
slot, int power_on,
 * chips/cards need an interface voltage rail too.
 */
if (power_on) {
-   ret = mmc_regulator_set_ocr(host-mmc, host-vcc, vdd);
+   if (host-vcc)
+   ret = mmc_regulator_set_ocr(host-mmc, host-vcc, vdd);
/* Enable interface voltage rail, if needed */
if (ret == 0  host-vcc_aux) {
ret = regulator_enable(host-vcc_aux);
-   if (ret  0)
+   if (ret  0  host-vcc)
ret = mmc_regulator_set_ocr(host-mmc,
host-vcc, 0);
}
@@ -298,7 +299,7 @@ static int omap_hsmmc_set_power(struct device *dev, int 
slot, int power_on,
/* Shut down the rail */
if (host-vcc_aux)
ret = regulator_disable(host-vcc_aux);
-   if (!ret) {
+   if (host-vcc) {
/* Then proceed to shut down the local regulator */
ret = mmc_regulator_set_ocr(host-mmc,
host-vcc, 0);
@@ -318,10 +319,10 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host 
*host)
 
reg = devm_regulator_get(host-dev, vmmc);
if (IS_ERR(reg)) {
-   dev_err(host-dev, vmmc regulator missing\n);
+   dev_err(host-dev, unable to get vmmc regulator %ld\n,
+   PTR_ERR(reg));
return PTR_ERR(reg);
} else {
-   mmc_slot(host).set_power = omap_hsmmc_set_power;
host-vcc = reg;
ocr_value = mmc_regulator_get_ocrmask(reg);
if (!mmc_slot(host).ocr_mask) {
@@ -334,31 +335,26 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host 
*host)
return -EINVAL;
}
}
+   }
+   mmc_slot(host).set_power = omap_hsmmc_set_power;
 
-   /* Allow an aux regulator */
-   reg = devm_regulator_get_optional(host-dev, vmmc_aux);
-   host-vcc_aux = IS_ERR(reg) ? NULL : reg;
+   /* Allow an aux regulator */
+   reg = devm_regulator_get_optional(host-dev, vmmc_aux);
+   host-vcc_aux = IS_ERR(reg) ? NULL : reg;
 
-   /* For eMMC do not power off when not in sleep state */
-   if (mmc_slot(host).no_regulator_off_init)
-   return 0;
-   /*
-   * UGLY HACK:  workaround regulator framework bugs.
-   * When the bootloader leaves a supply active, it's
-   * initialized with zero usecount ... and we can't
-   * disable it without first enabling it.  Until the
-   * framework is fixed, we need a workaround like this
-   * (which is safe for MMC, but not in general).
-   */
-   if (regulator_is_enabled(host-vcc)  0 ||
-   (host-vcc_aux  regulator_is_enabled(host-vcc_aux))) {
-   int vdd = ffs(mmc_slot(host).ocr_mask) - 1;
+   /* For eMMC do not power off when not in sleep state */
+   if (mmc_slot(host).no_regulator_off_init)
+   return 0;
+   /*
+* To disable boot_on regulator, enable regulator
+* to increase usecount and then disable it.
+*/
+   if ((host-vcc  regulator_is_enabled(host-vcc)  0) ||
+   (host-vcc_aux  regulator_is_enabled(host-vcc_aux))) {
+   int vdd = ffs(mmc_slot(host).ocr_mask) - 1;
 
-   mmc_slot(host).set_power(host-dev, host-slot_id,
-1, vdd);
-   mmc_slot(host).set_power(host-dev, host-slot_id,
-0, 0);
-   }
+   mmc_slot(host).set_power(host-dev, host-slot_id, 1, vdd);
+   mmc_slot(host).set_power(host-dev, host-slot_id, 0, 0);
}
 
return 0;
-- 
1.7.5.4

--
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 v10 3/7] regulator: add pbias regulator support

2014-01-13 Thread Balaji T K
pbias register controls internal power supply to sd card i/o pads
in most OMAPs (OMAP2-5, DRA7).
Control bits for selecting voltage level and
enabling/disabling are in the same PBIAS register.

Signed-off-by: Balaji T K balaj...@ti.com
Acked-by: Tony Lindgren t...@atomide.com
Acked-by: Mark Brown broo...@linaro.org
---
 .../bindings/regulator/pbias-regulator.txt |   27 ++
 drivers/regulator/Kconfig  |9 +
 drivers/regulator/Makefile |1 +
 drivers/regulator/pbias-regulator.c|  255 
 4 files changed, 292 insertions(+), 0 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/regulator/pbias-regulator.txt
 create mode 100644 drivers/regulator/pbias-regulator.c

diff --git a/Documentation/devicetree/bindings/regulator/pbias-regulator.txt 
b/Documentation/devicetree/bindings/regulator/pbias-regulator.txt
new file mode 100644
index 000..32aa26f
--- /dev/null
+++ b/Documentation/devicetree/bindings/regulator/pbias-regulator.txt
@@ -0,0 +1,27 @@
+PBIAS internal regulator for SD card dual voltage i/o pads on OMAP SoCs.
+
+Required properties:
+- compatible:
+  - ti,pbias-omap for OMAP2, OMAP3, OMAP4, OMAP5, DRA7.
+- reg: pbias register offset from syscon base and size of pbias register.
+- syscon : phandle of the system control module
+- regulator-name : should be
+   pbias_mmc_omap2430 for OMAP2430, OMAP3 SoCs
+   pbias_sim_omap3 for OMAP3 SoCs
+   pbias_mmc_omap4 for OMAP4 SoCs
+   pbias_mmc_omap5 for OMAP5 and DRA7 SoC
+
+Optional properties:
+- Any optional property defined in bindings/regulator/regulator.txt
+
+Example:
+
+   pbias_regulator: pbias_regulator {
+   compatible = ti,pbias-omap;
+   reg = 0 0x4;
+   syscon = omap5_padconf_global;
+   pbias_mmc_reg: pbias_mmc_omap5 {
+   regulator-name = pbias_mmc_omap5;
+   regulator-min-microvolt = 180;
+   regulator-max-microvolt = 300;
+   };
diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index ce785f4..741e8fb 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -369,6 +369,15 @@ config REGULATOR_PALMAS
  on the muxing. This is handled automatically in the driver by
  reading the mux info from OTP.
 
+config REGULATOR_PBIAS
+   tristate PBIAS OMAP regulator driver
+   depends on (ARCH_OMAP || COMPILE_TEST)  MFD_SYSCON
+   help
+Say y here to support pbias regulator for mmc1:SD card i/o
+on OMAP SoCs.
+This driver provides support for OMAP pbias modelled
+regulators.
+
 config REGULATOR_PCAP
tristate Motorola PCAP2 regulator driver
depends on EZX_PCAP
diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile
index 01c597e..16000fa 100644
--- a/drivers/regulator/Makefile
+++ b/drivers/regulator/Makefile
@@ -52,6 +52,7 @@ obj-$(CONFIG_REGULATOR_MC13XXX_CORE) +=  
mc13xxx-regulator-core.o
 obj-$(CONFIG_REGULATOR_PALMAS) += palmas-regulator.o
 obj-$(CONFIG_REGULATOR_PFUZE100) += pfuze100-regulator.o
 obj-$(CONFIG_REGULATOR_TPS51632) += tps51632-regulator.o
+obj-$(CONFIG_REGULATOR_PBIAS) += pbias-regulator.o
 obj-$(CONFIG_REGULATOR_PCAP) += pcap-regulator.o
 obj-$(CONFIG_REGULATOR_PCF50633) += pcf50633-regulator.o
 obj-$(CONFIG_REGULATOR_RC5T583)  += rc5t583-regulator.o
diff --git a/drivers/regulator/pbias-regulator.c 
b/drivers/regulator/pbias-regulator.c
new file mode 100644
index 000..39518e0
--- /dev/null
+++ b/drivers/regulator/pbias-regulator.c
@@ -0,0 +1,255 @@
+/*
+ * pbias-regulator.c
+ *
+ * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ * Author: Balaji T K balaj...@ti.com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation version 2.
+ *
+ * This program is distributed as is WITHOUT ANY WARRANTY of any
+ * kind, whether express or implied; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include linux/err.h
+#include linux/io.h
+#include linux/module.h
+#include linux/mfd/syscon.h
+#include linux/platform_device.h
+#include linux/regulator/driver.h
+#include linux/regulator/machine.h
+#include linux/regulator/of_regulator.h
+#include linux/regmap.h
+#include linux/slab.h
+#include linux/of.h
+#include linux/of_device.h
+
+struct pbias_reg_info {
+   u32 enable;
+   u32 enable_mask;
+   u32 vmode;
+   unsigned int enable_time;
+   char *name;
+};
+
+struct pbias_regulator_data {
+   struct regulator_desc desc;
+   void __iomem *pbias_addr

[PATCH v10 4/7] mmc: omap_hsmmc: adapt hsmmc to use pbias regulator

2014-01-13 Thread Balaji T K
In DT case, PBAIS registers are programmed via regulator,
use regulator APIs to control PBIAS.

Signed-off-by: Balaji T K balaj...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c |   37 +
 1 files changed, 37 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 342be25..2287bda 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -126,6 +126,10 @@
 #define OMAP_MMC_MAX_CLOCK 5200
 #define DRIVER_NAMEomap_hsmmc
 
+#define VDD_1V8180 /* 18 uV */
+#define VDD_3V0300 /* 30 uV */
+#define VDD_165_195(ffs(MMC_VDD_165_195) - 1)
+
 /*
  * One controller can have multiple slots, like on some omap boards using
  * omap.c controller driver. Luckily this is not currently done on any known
@@ -164,6 +168,8 @@ struct omap_hsmmc_host {
 */
struct  regulator   *vcc;
struct  regulator   *vcc_aux;
+   struct  regulator   *pbias;
+   boolpbias_enabled;
int pbias_disable;
void__iomem *base;
resource_size_t mapbase;
@@ -272,6 +278,15 @@ static int omap_hsmmc_set_power(struct device *dev, int 
slot, int power_on,
if (mmc_slot(host).before_set_reg)
mmc_slot(host).before_set_reg(dev, slot, power_on, vdd);
 
+   if (host-pbias) {
+   if (host-pbias_enabled == 1) {
+   ret = regulator_disable(host-pbias);
+   if (!ret)
+   host-pbias_enabled = 0;
+   }
+   regulator_set_voltage(host-pbias, VDD_3V0, VDD_3V0);
+   }
+
/*
 * Assume Vcc regulator is used only to power the card ... OMAP
 * VDDS is used to power the pins, optionally with a transceiver to
@@ -306,9 +321,27 @@ static int omap_hsmmc_set_power(struct device *dev, int 
slot, int power_on,
}
}
 
+   if (host-pbias) {
+   if (vdd = VDD_165_195)
+   ret = regulator_set_voltage(host-pbias, VDD_1V8,
+   VDD_1V8);
+   else
+   ret = regulator_set_voltage(host-pbias, VDD_3V0,
+   VDD_3V0);
+   if (ret  0)
+   goto error_set_power;
+
+   if (host-pbias_enabled == 0) {
+   ret = regulator_enable(host-pbias);
+   if (!ret)
+   host-pbias_enabled = 1;
+   }
+   }
+
if (mmc_slot(host).after_set_reg)
mmc_slot(host).after_set_reg(dev, slot, power_on, vdd);
 
+error_set_power:
return ret;
 }
 
@@ -342,6 +375,9 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
reg = devm_regulator_get_optional(host-dev, vmmc_aux);
host-vcc_aux = IS_ERR(reg) ? NULL : reg;
 
+   reg = devm_regulator_get_optional(host-dev, pbias);
+   host-pbias = IS_ERR(reg) ? NULL : reg;
+
/* For eMMC do not power off when not in sleep state */
if (mmc_slot(host).no_regulator_off_init)
return 0;
@@ -1808,6 +1844,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
host-base  = ioremap(host-mapbase, SZ_4K);
host-power_mode = MMC_POWER_OFF;
host-next_data.cookie = 1;
+   host-pbias_enabled = 0;
 
platform_set_drvdata(pdev, host);
 
-- 
1.7.5.4

--
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 v10 6/7] ARM: OMAP: enable SYSCON and REGULATOR_PBIAS in omap2plus_defconfig

2014-01-13 Thread Balaji T K
Enable REGULATOR_PBIAS needed for SD card on most OMAPs.

Signed-off-by: Balaji T K balaj...@ti.com
---
 arch/arm/configs/omap2plus_defconfig |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/arm/configs/omap2plus_defconfig 
b/arch/arm/configs/omap2plus_defconfig
index bfa80a1..f67baa9 100644
--- a/arch/arm/configs/omap2plus_defconfig
+++ b/arch/arm/configs/omap2plus_defconfig
@@ -169,6 +169,7 @@ CONFIG_DRA752_THERMAL=y
 CONFIG_WATCHDOG=y
 CONFIG_OMAP_WATCHDOG=y
 CONFIG_TWL4030_WATCHDOG=y
+CONFIG_MFD_SYSCON=y
 CONFIG_MFD_PALMAS=y
 CONFIG_MFD_TPS65217=y
 CONFIG_MFD_TPS65910=y
@@ -180,6 +181,7 @@ CONFIG_REGULATOR_TPS6507X=y
 CONFIG_REGULATOR_TPS65217=y
 CONFIG_REGULATOR_TPS65910=y
 CONFIG_REGULATOR_TWL4030=y
+CONFIG_REGULATOR_PBIAS=y
 CONFIG_FB=y
 CONFIG_FIRMWARE_EDID=y
 CONFIG_FB_MODE_HELPERS=y
-- 
1.7.5.4

--
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 v10 5/7] ARM: dts: add pbias dt node

2014-01-13 Thread Balaji T K
Add pbias regulator node as a child of system control
module - syscon.

Signed-off-by: Balaji T K balaj...@ti.com
Acked-by: Tony Lindgren t...@atomide.com
---
 arch/arm/boot/dts/dra7.dtsi |   17 +
 arch/arm/boot/dts/omap2430.dtsi |   17 +
 arch/arm/boot/dts/omap3.dtsi|   17 +
 arch/arm/boot/dts/omap4.dtsi|   17 +
 arch/arm/boot/dts/omap5.dtsi|   17 +
 5 files changed, 85 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
index d0df4c4..876c9b8 100644
--- a/arch/arm/boot/dts/dra7.dtsi
+++ b/arch/arm/boot/dts/dra7.dtsi
@@ -110,6 +110,22 @@
ti,hwmods = counter_32k;
};
 
+   dra7_ctrl_general: tisyscon@4a002e00 {
+   compatible = syscon, simple-bus;
+   reg = 0x4a002e00 0x7c;
+   };
+
+   pbias_regulator: pbias_regulator {
+   compatible = ti,pbias-omap;
+   reg = 0 0x4;
+   syscon = dra7_ctrl_general;
+   pbias_mmc_reg: pbias_mmc_omap5 {
+   regulator-name = pbias_mmc_omap5;
+   regulator-min-microvolt = 180;
+   regulator-max-microvolt = 300;
+   };
+   };
+
dra7_pmx_core: pinmux@4a003400 {
compatible = pinctrl-single;
reg = 0x4a003400 0x0464;
@@ -485,6 +501,7 @@
dmas = sdma 61, sdma 62;
dma-names = tx, rx;
status = disabled;
+   pbias-supply = pbias_mmc_reg;
};
 
mmc2: mmc@480b4000 {
diff --git a/arch/arm/boot/dts/omap2430.dtsi b/arch/arm/boot/dts/omap2430.dtsi
index d624345..af71eb0 100644
--- a/arch/arm/boot/dts/omap2430.dtsi
+++ b/arch/arm/boot/dts/omap2430.dtsi
@@ -29,6 +29,22 @@
pinctrl-single,function-mask = 0x3f;
};
 
+   omap2_scm_general: tisyscon@49002270 {
+   compatible = syscon, simple-bus;
+   reg = 0x49002270 0x240;
+   };
+
+   pbias_regulator: pbias_regulator {
+   compatible = ti,pbias-omap;
+   reg = 0x230 0x4;
+   syscon = omap2_scm_general;
+   pbias_mmc_reg: pbias_mmc_omap2430 {
+   regulator-name = pbias_mmc_omap2430;
+   regulator-min-microvolt = 180;
+   regulator-max-microvolt = 300;
+   };
+   };
+
gpio1: gpio@4900c000 {
compatible = ti,omap2-gpio;
reg = 0x4900c000 0x200;
@@ -183,6 +199,7 @@
ti,dual-volt;
dmas = sdma 61, sdma 62;
dma-names = tx, rx;
+   pbias-supply = pbias_mmc_reg;
};
 
mmc2: mmc@480b4000 {
diff --git a/arch/arm/boot/dts/omap3.dtsi b/arch/arm/boot/dts/omap3.dtsi
index daabf99..b7828da 100644
--- a/arch/arm/boot/dts/omap3.dtsi
+++ b/arch/arm/boot/dts/omap3.dtsi
@@ -137,6 +137,22 @@
pinctrl-single,function-mask = 0xff1f;
};
 
+   omap3_scm_general: tisyscon@48002270 {
+   compatible = syscon, simple-bus;
+   reg = 0x48002270 0x2f0;
+   };
+
+   pbias_regulator: pbias_regulator {
+   compatible = ti,pbias-omap;
+   reg = 0x2b0 0x4;
+   syscon = omap3_scm_general;
+   pbias_mmc_reg: pbias_mmc_omap2430 {
+   regulator-name = pbias_mmc_omap2430;
+   regulator-min-microvolt = 180;
+   regulator-max-microvolt = 300;
+   };
+   };
+
gpio1: gpio@4831 {
compatible = ti,omap3-gpio;
reg = 0x4831 0x200;
@@ -351,6 +367,7 @@
ti,dual-volt;
dmas = sdma 61, sdma 62;
dma-names = tx, rx;
+   pbias-supply = pbias_mmc_reg;
};
 
mmc2: mmc@480b4000 {
diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index a1e0585..9e19363 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -134,6 +134,22 @@
pinctrl-single,function-mask = 0x7fff;
};
 
+   omap4_padconf_global: tisyscon@4a1005a0 {
+   compatible = syscon, simple-bus

[PATCH v10 7/7] mmc: omap_hsmmc: remove pbias workaround

2014-01-13 Thread Balaji T K
remove pbias workaround

Signed-off-by: Balaji T K balaj...@ti.com
Acked-by: Tony Lindgren t...@atomide.com
---
 drivers/mmc/host/omap_hsmmc.c |   20 +---
 1 files changed, 1 insertions(+), 19 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 2287bda..014bfe5 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -170,7 +170,6 @@ struct omap_hsmmc_host {
struct  regulator   *vcc_aux;
struct  regulator   *pbias;
boolpbias_enabled;
-   int pbias_disable;
void__iomem *base;
resource_size_t mapbase;
spinlock_t  irq_lock; /* Prevent races with irq handler */
@@ -267,13 +266,6 @@ static int omap_hsmmc_set_power(struct device *dev, int 
slot, int power_on,
 */
if (!host-vcc)
return 0;
-   /*
-* With DT, never turn OFF the regulator for MMC1. This is because
-* the pbias cell programming support is still missing when
-* booting with Device tree
-*/
-   if (host-pbias_disable  !vdd)
-   return 0;
 
if (mmc_slot(host).before_set_reg)
mmc_slot(host).before_set_reg(dev, slot, power_on, vdd);
@@ -1539,13 +1531,7 @@ static void omap_hsmmc_set_ios(struct mmc_host *mmc, 
struct mmc_ios *ios)
 * of external transceiver; but they all handle 1.8V.
 */
if ((OMAP_HSMMC_READ(host-base, HCTL)  SDVSDET) 
-   (ios-vdd == DUAL_VOLT_OCR_BIT) 
-   /*
-* With pbias cell programming missing, this
-* can't be allowed on MMC1 when booting with device
-* tree.
-*/
-   !host-pbias_disable) {
+   (ios-vdd == DUAL_VOLT_OCR_BIT)) {
/*
 * The mmc_select_voltage fn of the core does
 * not seem to set the power_mode to
@@ -1878,10 +1864,6 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
 
omap_hsmmc_context_save(host);
 
-   /* This can be removed once we support PBIAS with DT */
-   if (host-dev-of_node  res-start == 0x4809c000)
-   host-pbias_disable = 1;
-
host-dbclk = clk_get(pdev-dev, mmchsdb_fck);
/*
 * MMC can still work without debounce clock.
-- 
1.7.5.4

--
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 v8 1/7] mmc: omap_hsmmc: use devm_regulator API

2014-01-10 Thread Balaji T K

On Thursday 09 January 2014 08:48 PM, Felipe Balbi wrote:

Hi,

On Thu, Jan 09, 2014 at 08:20:56PM +0530, Balaji T K wrote:

Use devm_regulator API, while at it use
devm_regulator_get_optional for optional vmmc_aux supply

Signed-off-by: Balaji T K balaj...@ti.com
Acked-by: Tony Lindgren t...@atomide.com
---
  drivers/mmc/host/omap_hsmmc.c |6 ++
  1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index dbd32ad..1eb4350 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -316,7 +316,7 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
struct regulator *reg;
int ocr_value = 0;

-   reg = regulator_get(host-dev, vmmc);
+   reg = devm_regulator_get(host-dev, vmmc);
if (IS_ERR(reg)) {
dev_err(host-dev, vmmc regulator missing\n);
return PTR_ERR(reg);
@@ -336,7 +336,7 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
}

/* Allow an aux regulator */
-   reg = regulator_get(host-dev, vmmc_aux);
+   reg = devm_regulator_get_optional(host-dev, vmmc_aux);
host-vcc_aux = IS_ERR(reg) ? NULL : reg;

/* For eMMC do not power off when not in sleep state */
@@ -366,8 +366,6 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)

  static void omap_hsmmc_reg_put(struct omap_hsmmc_host *host)


since this function does nothing now, you could pretty much remove it
and move set_power assignment to -remove() directly. No strong feelings
though.


Hi Felipe,

omap_hsmmc_reg_put is used in probe error handling path in addition to 
.remove(),
so I would keep it for now to balance omap_hsmmc_reg_get.

--
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 5/7] ARM: dts: add pbias dt node

2014-01-10 Thread Balaji T K

On Friday 10 January 2014 05:02 PM, Mark Rutland wrote:

On Wed, Jan 08, 2014 at 02:51:46PM +, Balaji T K wrote:

On Tuesday 07 January 2014 05:53 PM, Balaji T K wrote:

On Tuesday 07 January 2014 04:27 PM, Mark Rutland wrote:

On Tue, Jan 07, 2014 at 10:18:15AM +, Balaji T K wrote:

On Monday 06 January 2014 11:49 PM, Mark Rutland wrote:

On Fri, Dec 20, 2013 at 05:35:53PM +, Balaji T K wrote:

Add pbias regulator node as a child of system control
module - syscon.

Signed-off-by: Balaji T K balaj...@ti.com
---
arch/arm/boot/dts/dra7.dtsi |   18 ++
arch/arm/boot/dts/omap2430.dtsi |   18 ++
arch/arm/boot/dts/omap3.dtsi|   18 ++
arch/arm/boot/dts/omap4.dtsi|   18 ++
arch/arm/boot/dts/omap5.dtsi|   18 ++
5 files changed, 90 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
index d0df4c4..4e68df1 100644
--- a/arch/arm/boot/dts/dra7.dtsi
+++ b/arch/arm/boot/dts/dra7.dtsi
@@ -110,6 +110,23 @@
ti,hwmods = counter_32k;
};

+dra7_ctrl_general: tisyscon@4a002e00 {
+compatible = ti,control-syscon, syscon, simple-bus;


Please, don't use simple-bus like that. The components below this node
depend on it. It is _NOT_ a simple bus. Make the ti,control-syscon
driver probe it's children.


Hi Mark,

Actually ti,control-syscon driver does not exist, so I can remove it,
and simple-bus is needed for child creation.


This still shows up as a syscon node, with a reg property, and syscon is
not an extension of simple-bus.

There are properties in the parent node that children depend on, and
that makes me wary of describing it as a simple bus. I'd expect to be
able to move child nodes out of a simple-bus if ranges provided an
idmap, and I can't do that here.


Hi Mark,

Not sure if I am understanding here, can you please add more info.


A node's compatible string list describes the set of devices (or rather
descriptions of devices) with which it is compatible. The list goes from
most specific to least specific. The idea is that an OS reads through
the list until it finds a string it knows how to handle, then treats the
node as that.

Ignoring ti,control-syscon, the node has both syscon and
simple-bus. Given you expect the OS to recognise syscon, you should
_not_ expect it to also treat the node as simple-bus. Doing so is an
abuse of the property and current Linux implementation details.

The syscon binding is not a more specific version of simple-bus.
They imply completely different things.

Either make a ti,control-syscon driver that probes the child nodes, or
move the child nodes out and give them a phandle to the
dra7_ctrl_general node that they can parse. I'd prefer the latter as
relies on fewer topology details, is as easy to implement as your
current parent node parsing, and is easier to extend in future.



Thanks Mark,
phandle to syscon is fine for me.

--
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 v9 0/7] mmc: omap_hsmmc: pbias dt and cleanup

2014-01-10 Thread Balaji T K
Few cleanups to reduce code indent,
Add pbias_regulator support and adapt omap_hsmmc to use pbias regulator
to configure required voltage on mmc1 pad(SD card) i/o rails on OMAP SoCs.

v9 changes:
remove simple-bus, add phandle for syscon in dt node

Balaji T K (7):
  mmc: omap_hsmmc: use devm_regulator API
  mmc: omap_hsmmc: handle vcc and vcc_aux independently
  regulator: add pbias regulator support
  mmc: omap_hsmmc: adapt hsmmc to use pbias regulator
  ARM: dts: add pbias dt node
  ARM: OMAP: enable SYSCON and REGULATOR_PBIAS in omap2plus_defconfig
  mmc: omap_hsmmc: remove pbias workaround

 .../bindings/regulator/pbias-regulator.txt |   27 ++
 arch/arm/boot/dts/dra7.dtsi|   17 ++
 arch/arm/boot/dts/omap2430.dtsi|   17 ++
 arch/arm/boot/dts/omap3.dtsi   |   17 ++
 arch/arm/boot/dts/omap4.dtsi   |   17 ++
 arch/arm/boot/dts/omap5.dtsi   |   17 ++
 arch/arm/configs/omap2plus_defconfig   |2 +
 drivers/mmc/host/omap_hsmmc.c  |  113 +
 drivers/regulator/Kconfig  |9 +
 drivers/regulator/Makefile |1 +
 drivers/regulator/pbias-regulator.c|  255 
 11 files changed, 443 insertions(+), 49 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/regulator/pbias-regulator.txt
 create mode 100644 drivers/regulator/pbias-regulator.c

-- 
1.7.5.4

--
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 v9 5/7] ARM: dts: add pbias dt node

2014-01-10 Thread Balaji T K
Add pbias regulator node as a child of system control
module - syscon.

Signed-off-by: Balaji T K balaj...@ti.com
Acked-by: Tony Lindgren t...@atomide.com
---
 arch/arm/boot/dts/dra7.dtsi |   17 +
 arch/arm/boot/dts/omap2430.dtsi |   17 +
 arch/arm/boot/dts/omap3.dtsi|   17 +
 arch/arm/boot/dts/omap4.dtsi|   17 +
 arch/arm/boot/dts/omap5.dtsi|   17 +
 5 files changed, 85 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
index d0df4c4..876c9b8 100644
--- a/arch/arm/boot/dts/dra7.dtsi
+++ b/arch/arm/boot/dts/dra7.dtsi
@@ -110,6 +110,22 @@
ti,hwmods = counter_32k;
};
 
+   dra7_ctrl_general: tisyscon@4a002e00 {
+   compatible = syscon, simple-bus;
+   reg = 0x4a002e00 0x7c;
+   };
+
+   pbias_regulator: pbias_regulator {
+   compatible = ti,pbias-omap;
+   reg = 0 0x4;
+   syscon = dra7_ctrl_general;
+   pbias_mmc_reg: pbias_mmc_omap5 {
+   regulator-name = pbias_mmc_omap5;
+   regulator-min-microvolt = 180;
+   regulator-max-microvolt = 300;
+   };
+   };
+
dra7_pmx_core: pinmux@4a003400 {
compatible = pinctrl-single;
reg = 0x4a003400 0x0464;
@@ -485,6 +501,7 @@
dmas = sdma 61, sdma 62;
dma-names = tx, rx;
status = disabled;
+   pbias-supply = pbias_mmc_reg;
};
 
mmc2: mmc@480b4000 {
diff --git a/arch/arm/boot/dts/omap2430.dtsi b/arch/arm/boot/dts/omap2430.dtsi
index d624345..af71eb0 100644
--- a/arch/arm/boot/dts/omap2430.dtsi
+++ b/arch/arm/boot/dts/omap2430.dtsi
@@ -29,6 +29,22 @@
pinctrl-single,function-mask = 0x3f;
};
 
+   omap2_scm_general: tisyscon@49002270 {
+   compatible = syscon, simple-bus;
+   reg = 0x49002270 0x240;
+   };
+
+   pbias_regulator: pbias_regulator {
+   compatible = ti,pbias-omap;
+   reg = 0x230 0x4;
+   syscon = omap2_scm_general;
+   pbias_mmc_reg: pbias_mmc_omap2430 {
+   regulator-name = pbias_mmc_omap2430;
+   regulator-min-microvolt = 180;
+   regulator-max-microvolt = 300;
+   };
+   };
+
gpio1: gpio@4900c000 {
compatible = ti,omap2-gpio;
reg = 0x4900c000 0x200;
@@ -183,6 +199,7 @@
ti,dual-volt;
dmas = sdma 61, sdma 62;
dma-names = tx, rx;
+   pbias-supply = pbias_mmc_reg;
};
 
mmc2: mmc@480b4000 {
diff --git a/arch/arm/boot/dts/omap3.dtsi b/arch/arm/boot/dts/omap3.dtsi
index daabf99..b7828da 100644
--- a/arch/arm/boot/dts/omap3.dtsi
+++ b/arch/arm/boot/dts/omap3.dtsi
@@ -137,6 +137,22 @@
pinctrl-single,function-mask = 0xff1f;
};
 
+   omap3_scm_general: tisyscon@48002270 {
+   compatible = syscon, simple-bus;
+   reg = 0x48002270 0x2f0;
+   };
+
+   pbias_regulator: pbias_regulator {
+   compatible = ti,pbias-omap;
+   reg = 0x2b0 0x4;
+   syscon = omap3_scm_general;
+   pbias_mmc_reg: pbias_mmc_omap2430 {
+   regulator-name = pbias_mmc_omap2430;
+   regulator-min-microvolt = 180;
+   regulator-max-microvolt = 300;
+   };
+   };
+
gpio1: gpio@4831 {
compatible = ti,omap3-gpio;
reg = 0x4831 0x200;
@@ -351,6 +367,7 @@
ti,dual-volt;
dmas = sdma 61, sdma 62;
dma-names = tx, rx;
+   pbias-supply = pbias_mmc_reg;
};
 
mmc2: mmc@480b4000 {
diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index a1e0585..9e19363 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -134,6 +134,22 @@
pinctrl-single,function-mask = 0x7fff;
};
 
+   omap4_padconf_global: tisyscon@4a1005a0 {
+   compatible = syscon, simple-bus

  1   2   3   4   >