All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/16] SDHI support for r8a7790
@ 2013-11-14 10:16 ` Kuninori Morimoto
  0 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-14 10:16 UTC (permalink / raw)
  To: Simon, Laurent, Chris Ball; +Cc: Magnus, Linux-SH, Kuninori Morimoto, linux-mmc


Hi Simon, Chris, Laurent

These are SDHI support for r8a7790.
But, these are

1. bug fix patchset for mmc/sdhi
2. bug fix for SH-ARM
3. new feature for mmc
4. new feature for SH-ARM

all these patches are needed, but, to different maintainer.
I send these with separate set

Kuninori Morimoto (14):
      gpio: rcar: use postcore_init()
      mmc: tmio: don't overwrite caps2
      ARM: shmobile: marzen: remove SDHI0 WP pin setting from DTS
      ARM: shmobile: marzen: remove SDHI0 WP pin setting
      ARM: shmobile: sh73a0: fixup sdhi compatible name
      mmc: tmio: bus_shift become tmio_mmc_data member
      mmc: tmio: add new TMIO_MMC_HAVE_HIGH_REG flags
      mmc: SDHI: add SoC specific workaround via HW version
      mmc: SDHI: tidyup sh_mobile_sdhi_of_match position
      mmc: SDHI: updata sh_mobile_sdhi_of_data for r8a7778
      mmc: SDHI: updata sh_mobile_sdhi_of_data for r8a7779
      mmc: SDHI: updata sh_mobile_sdhi_of_data for r8a7790
      ARM: shmobile: lager: add SDHI0/2 support
      ARM: shmobile: lager: use gpio/fixed regulator for SDHI

Shinobu Uehara (2):
      mmc: tmio: Fix odd size access
      mmc: tmio: Add error IRQ status clear

 arch/arm/boot/dts/r8a7778-bockw-reference.dts  |    4 +-
 arch/arm/boot/dts/r8a7778.dtsi                 |    6 -
 arch/arm/boot/dts/r8a7779-marzen-reference.dts |    3 +-
 arch/arm/boot/dts/r8a7779.dtsi                 |    8 --
 arch/arm/boot/dts/sh73a0.dtsi                  |    6 +-
 arch/arm/mach-shmobile/board-lager.c           |  144 +++++++++++++++++++++++-
 arch/arm/mach-shmobile/board-marzen.c          |    2 -
 arch/sh/boards/board-sh7757lcr.c               |    2 +-
 drivers/gpio/gpio-rcar.c                       |   12 +-
 drivers/mmc/host/sh_mobile_sdhi.c              |   60 +++++++---
 drivers/mmc/host/tmio_mmc.c                    |    9 ++
 drivers/mmc/host/tmio_mmc.h                    |   17 ++-
 drivers/mmc/host/tmio_mmc_dma.c                |    2 +-
 drivers/mmc/host/tmio_mmc_pio.c                |   28 ++---
 include/linux/mfd/tmio.h                       |    8 ++
 include/linux/mmc/tmio.h                       |    1 +
 16 files changed, 247 insertions(+), 65 deletions(-)

^ permalink raw reply	[flat|nested] 113+ messages in thread

* [PATCH 0/16] SDHI support for r8a7790
@ 2013-11-14 10:16 ` Kuninori Morimoto
  0 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-14 10:16 UTC (permalink / raw)
  To: Simon, Laurent, Chris Ball; +Cc: Magnus, Linux-SH, Kuninori Morimoto, linux-mmc


Hi Simon, Chris, Laurent

These are SDHI support for r8a7790.
But, these are

1. bug fix patchset for mmc/sdhi
2. bug fix for SH-ARM
3. new feature for mmc
4. new feature for SH-ARM

all these patches are needed, but, to different maintainer.
I send these with separate set

Kuninori Morimoto (14):
      gpio: rcar: use postcore_init()
      mmc: tmio: don't overwrite caps2
      ARM: shmobile: marzen: remove SDHI0 WP pin setting from DTS
      ARM: shmobile: marzen: remove SDHI0 WP pin setting
      ARM: shmobile: sh73a0: fixup sdhi compatible name
      mmc: tmio: bus_shift become tmio_mmc_data member
      mmc: tmio: add new TMIO_MMC_HAVE_HIGH_REG flags
      mmc: SDHI: add SoC specific workaround via HW version
      mmc: SDHI: tidyup sh_mobile_sdhi_of_match position
      mmc: SDHI: updata sh_mobile_sdhi_of_data for r8a7778
      mmc: SDHI: updata sh_mobile_sdhi_of_data for r8a7779
      mmc: SDHI: updata sh_mobile_sdhi_of_data for r8a7790
      ARM: shmobile: lager: add SDHI0/2 support
      ARM: shmobile: lager: use gpio/fixed regulator for SDHI

Shinobu Uehara (2):
      mmc: tmio: Fix odd size access
      mmc: tmio: Add error IRQ status clear

 arch/arm/boot/dts/r8a7778-bockw-reference.dts  |    4 +-
 arch/arm/boot/dts/r8a7778.dtsi                 |    6 -
 arch/arm/boot/dts/r8a7779-marzen-reference.dts |    3 +-
 arch/arm/boot/dts/r8a7779.dtsi                 |    8 --
 arch/arm/boot/dts/sh73a0.dtsi                  |    6 +-
 arch/arm/mach-shmobile/board-lager.c           |  144 +++++++++++++++++++++++-
 arch/arm/mach-shmobile/board-marzen.c          |    2 -
 arch/sh/boards/board-sh7757lcr.c               |    2 +-
 drivers/gpio/gpio-rcar.c                       |   12 +-
 drivers/mmc/host/sh_mobile_sdhi.c              |   60 +++++++---
 drivers/mmc/host/tmio_mmc.c                    |    9 ++
 drivers/mmc/host/tmio_mmc.h                    |   17 ++-
 drivers/mmc/host/tmio_mmc_dma.c                |    2 +-
 drivers/mmc/host/tmio_mmc_pio.c                |   28 ++---
 include/linux/mfd/tmio.h                       |    8 ++
 include/linux/mmc/tmio.h                       |    1 +
 16 files changed, 247 insertions(+), 65 deletions(-)

^ permalink raw reply	[flat|nested] 113+ messages in thread

* [PATCH 0/16]: gpio-rcar fixup
  2013-11-14 10:16 ` Kuninori Morimoto
@ 2013-11-14 10:18   ` Kuninori Morimoto
  -1 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-14 10:18 UTC (permalink / raw)
  To: Simon, Laurent, Chris Ball; +Cc: Magnus, Linux-SH, Kuninori Morimoto, linux-mmc


Hi Laurent

This is fixup patch for R-Car GPIO driver

Kuninori Morimoto:
      gpio: rcar: use postcore_init()


Best regards
---
Kuninori Morimoto

^ permalink raw reply	[flat|nested] 113+ messages in thread

* [PATCH 0/16]: gpio-rcar fixup
@ 2013-11-14 10:18   ` Kuninori Morimoto
  0 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-14 10:18 UTC (permalink / raw)
  To: Simon, Laurent, Chris Ball; +Cc: Magnus, Linux-SH, Kuninori Morimoto, linux-mmc


Hi Laurent

This is fixup patch for R-Car GPIO driver

Kuninori Morimoto:
      gpio: rcar: use postcore_init()


Best regards
---
Kuninori Morimoto

^ permalink raw reply	[flat|nested] 113+ messages in thread

* [PATCH 01/16] gpio: rcar: use postcore_init()
  2013-11-14 10:18   ` Kuninori Morimoto
@ 2013-11-14 10:19     ` Kuninori Morimoto
  -1 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-14 10:19 UTC (permalink / raw)
  To: Laurent; +Cc: Simon, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

Renesas GPIO is being interlocked with PFC, and GPIO is
very basic system for R-Car.
GPIO should be initialised in same timing as PFC.
The GPIO based system doesn't work correctly without this patch.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/gpio/gpio-rcar.c |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c
index 6038966..0a10325 100644
--- a/drivers/gpio/gpio-rcar.c
+++ b/drivers/gpio/gpio-rcar.c
@@ -454,7 +454,17 @@ static struct platform_driver gpio_rcar_device_driver = {
 	}
 };
 
-module_platform_driver(gpio_rcar_device_driver);
+static int __init gpio_rcar_init(void)
+{
+	return platform_driver_register(&gpio_rcar_device_driver);
+}
+postcore_initcall(gpio_rcar_init);
+
+static void __exit gpio_rcar_exit(void)
+{
+	platform_driver_unregister(&gpio_rcar_device_driver);
+}
+module_exit(gpio_rcar_exit);
 
 MODULE_AUTHOR("Magnus Damm");
 MODULE_DESCRIPTION("Renesas R-Car GPIO Driver");
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH 01/16] gpio: rcar: use postcore_init()
@ 2013-11-14 10:19     ` Kuninori Morimoto
  0 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-14 10:19 UTC (permalink / raw)
  To: Laurent; +Cc: Simon, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

Renesas GPIO is being interlocked with PFC, and GPIO is
very basic system for R-Car.
GPIO should be initialised in same timing as PFC.
The GPIO based system doesn't work correctly without this patch.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/gpio/gpio-rcar.c |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c
index 6038966..0a10325 100644
--- a/drivers/gpio/gpio-rcar.c
+++ b/drivers/gpio/gpio-rcar.c
@@ -454,7 +454,17 @@ static struct platform_driver gpio_rcar_device_driver = {
 	}
 };
 
-module_platform_driver(gpio_rcar_device_driver);
+static int __init gpio_rcar_init(void)
+{
+	return platform_driver_register(&gpio_rcar_device_driver);
+}
+postcore_initcall(gpio_rcar_init);
+
+static void __exit gpio_rcar_exit(void)
+{
+	platform_driver_unregister(&gpio_rcar_device_driver);
+}
+module_exit(gpio_rcar_exit);
 
 MODULE_AUTHOR("Magnus Damm");
 MODULE_DESCRIPTION("Renesas R-Car GPIO Driver");
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 113+ messages in thread

* Re: [PATCH 0/16] mmc: bug fix patches
  2013-11-14 10:16 ` Kuninori Morimoto
@ 2013-11-14 10:21   ` Kuninori Morimoto
  -1 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-14 10:21 UTC (permalink / raw)
  To: Simon, Laurent, Chris Ball; +Cc: Magnus, Linux-SH, Kuninori Morimoto, linux-mmc


Hi Chris

These are mmc bugfix patches

Kuninori Morimoto
       mmc: tmio: don't overwrite caps2
 
Shinobu Uehara (2):
       mmc: tmio: Fix odd size access
       mmc: tmio: Add error IRQ status clear

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 0/16] mmc: bug fix patches
@ 2013-11-14 10:21   ` Kuninori Morimoto
  0 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-14 10:21 UTC (permalink / raw)
  To: Simon, Laurent, Chris Ball; +Cc: Magnus, Linux-SH, Kuninori Morimoto, linux-mmc


Hi Chris

These are mmc bugfix patches

Kuninori Morimoto
       mmc: tmio: don't overwrite caps2
 
Shinobu Uehara (2):
       mmc: tmio: Fix odd size access
       mmc: tmio: Add error IRQ status clear

^ permalink raw reply	[flat|nested] 113+ messages in thread

* [PATCH 03/17] mmc: tmio: Fix odd size access
  2013-11-14 10:21   ` Kuninori Morimoto
@ 2013-11-14 10:23     ` Kuninori Morimoto
  -1 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-14 10:23 UTC (permalink / raw)
  To: Chris Ball; +Cc: Simon, Laurent, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

From: Shinobu Uehara <shinobu.uehara.xc@renesas.com>

Current sd_ctrl_read/write16_rep() doesn't care odd size

Signed-off-by: Shinobu Uehara <shinobu.uehara.xc@renesas.com>
Signed-off-by: Ryo Kataoka <ryo.kataoka.wt@renesas.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/mmc/host/tmio_mmc_pio.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
index b380225..05ae15c 100644
--- a/drivers/mmc/host/tmio_mmc_pio.c
+++ b/drivers/mmc/host/tmio_mmc_pio.c
@@ -386,9 +386,11 @@ static void tmio_mmc_pio_irq(struct tmio_mmc_host *host)
 
 	/* Transfer the data */
 	if (data->flags & MMC_DATA_READ)
-		sd_ctrl_read16_rep(host, CTL_SD_DATA_PORT, buf, count >> 1);
+		sd_ctrl_read16_rep(host,
+			CTL_SD_DATA_PORT, buf, (count + 1) >> 1);
 	else
-		sd_ctrl_write16_rep(host, CTL_SD_DATA_PORT, buf, count >> 1);
+		sd_ctrl_write16_rep(host,
+			CTL_SD_DATA_PORT, buf, (count + 1) >> 1);
 
 	host->sg_off += count;
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH 03/17] mmc: tmio: Fix odd size access
@ 2013-11-14 10:23     ` Kuninori Morimoto
  0 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-14 10:23 UTC (permalink / raw)
  To: Chris Ball; +Cc: Simon, Laurent, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

From: Shinobu Uehara <shinobu.uehara.xc@renesas.com>

Current sd_ctrl_read/write16_rep() doesn't care odd size

Signed-off-by: Shinobu Uehara <shinobu.uehara.xc@renesas.com>
Signed-off-by: Ryo Kataoka <ryo.kataoka.wt@renesas.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/mmc/host/tmio_mmc_pio.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
index b380225..05ae15c 100644
--- a/drivers/mmc/host/tmio_mmc_pio.c
+++ b/drivers/mmc/host/tmio_mmc_pio.c
@@ -386,9 +386,11 @@ static void tmio_mmc_pio_irq(struct tmio_mmc_host *host)
 
 	/* Transfer the data */
 	if (data->flags & MMC_DATA_READ)
-		sd_ctrl_read16_rep(host, CTL_SD_DATA_PORT, buf, count >> 1);
+		sd_ctrl_read16_rep(host,
+			CTL_SD_DATA_PORT, buf, (count + 1) >> 1);
 	else
-		sd_ctrl_write16_rep(host, CTL_SD_DATA_PORT, buf, count >> 1);
+		sd_ctrl_write16_rep(host,
+			CTL_SD_DATA_PORT, buf, (count + 1) >> 1);
 
 	host->sg_off += count;
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH 04/17] mmc: tmio: Add error IRQ status clear
  2013-11-14 10:21   ` Kuninori Morimoto
@ 2013-11-14 10:24     ` Kuninori Morimoto
  -1 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-14 10:24 UTC (permalink / raw)
  To: Chris Ball; +Cc: Simon, Laurent, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

From: Shinobu Uehara <shinobu.uehara.xc@renesas.com>

After a card is ejected during card access,
the re-inserted card does not identified.
It can be identified by clearing error IRQ status.

Signed-off-by: Shinobu Uehara <shinobu.uehara.xc@renesas.com>
Signed-off-by: Ryo Kataoka <ryo.kataoka.wt@renesas.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/mmc/host/tmio_mmc_pio.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
index 05ae15c..99f6d29 100644
--- a/drivers/mmc/host/tmio_mmc_pio.c
+++ b/drivers/mmc/host/tmio_mmc_pio.c
@@ -565,6 +565,9 @@ static void tmio_mmc_card_irq_status(struct tmio_mmc_host *host,
 
 	pr_debug_status(*status);
 	pr_debug_status(*ireg);
+
+	/* Clear the status except the interrupt status */
+	sd_ctrl_write32(host, CTL_STATUS, TMIO_MASK_IRQ);
 }
 
 static bool __tmio_mmc_card_detect_irq(struct tmio_mmc_host *host,
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH 04/17] mmc: tmio: Add error IRQ status clear
@ 2013-11-14 10:24     ` Kuninori Morimoto
  0 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-14 10:24 UTC (permalink / raw)
  To: Chris Ball; +Cc: Simon, Laurent, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

From: Shinobu Uehara <shinobu.uehara.xc@renesas.com>

After a card is ejected during card access,
the re-inserted card does not identified.
It can be identified by clearing error IRQ status.

Signed-off-by: Shinobu Uehara <shinobu.uehara.xc@renesas.com>
Signed-off-by: Ryo Kataoka <ryo.kataoka.wt@renesas.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/mmc/host/tmio_mmc_pio.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
index 05ae15c..99f6d29 100644
--- a/drivers/mmc/host/tmio_mmc_pio.c
+++ b/drivers/mmc/host/tmio_mmc_pio.c
@@ -565,6 +565,9 @@ static void tmio_mmc_card_irq_status(struct tmio_mmc_host *host,
 
 	pr_debug_status(*status);
 	pr_debug_status(*ireg);
+
+	/* Clear the status except the interrupt status */
+	sd_ctrl_write32(host, CTL_STATUS, TMIO_MASK_IRQ);
 }
 
 static bool __tmio_mmc_card_detect_irq(struct tmio_mmc_host *host,
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH 05/17] mmc: tmio: don't overwrite caps2
  2013-11-14 10:21   ` Kuninori Morimoto
@ 2013-11-14 10:24     ` Kuninori Morimoto
  -1 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-14 10:24 UTC (permalink / raw)
  To: Chris Ball; +Cc: Simon, Laurent, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

02cb3221d5bb351ad9f7469453dcca7594a0fabf
(mmc: tmio: support caps2 flags) added caps2 support
on tmio, but it overwrites mmc_of_parse() settings.
This patch fixes it up

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/mmc/host/tmio_mmc_pio.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
index 99f6d29..1f5f2ba 100644
--- a/drivers/mmc/host/tmio_mmc_pio.c
+++ b/drivers/mmc/host/tmio_mmc_pio.c
@@ -1021,7 +1021,7 @@ int tmio_mmc_host_probe(struct tmio_mmc_host **host,
 
 	mmc->ops = &tmio_mmc_ops;
 	mmc->caps |= MMC_CAP_4_BIT_DATA | pdata->capabilities;
-	mmc->caps2 = pdata->capabilities2;
+	mmc->caps2 |= pdata->capabilities2;
 	mmc->max_segs = 32;
 	mmc->max_blk_size = 512;
 	mmc->max_blk_count = (PAGE_CACHE_SIZE / mmc->max_blk_size) *
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH 05/17] mmc: tmio: don't overwrite caps2
@ 2013-11-14 10:24     ` Kuninori Morimoto
  0 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-14 10:24 UTC (permalink / raw)
  To: Chris Ball; +Cc: Simon, Laurent, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

02cb3221d5bb351ad9f7469453dcca7594a0fabf
(mmc: tmio: support caps2 flags) added caps2 support
on tmio, but it overwrites mmc_of_parse() settings.
This patch fixes it up

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/mmc/host/tmio_mmc_pio.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
index 99f6d29..1f5f2ba 100644
--- a/drivers/mmc/host/tmio_mmc_pio.c
+++ b/drivers/mmc/host/tmio_mmc_pio.c
@@ -1021,7 +1021,7 @@ int tmio_mmc_host_probe(struct tmio_mmc_host **host,
 
 	mmc->ops = &tmio_mmc_ops;
 	mmc->caps |= MMC_CAP_4_BIT_DATA | pdata->capabilities;
-	mmc->caps2 = pdata->capabilities2;
+	mmc->caps2 |= pdata->capabilities2;
 	mmc->max_segs = 32;
 	mmc->max_blk_size = 512;
 	mmc->max_blk_count = (PAGE_CACHE_SIZE / mmc->max_blk_size) *
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 113+ messages in thread

* Re: [PATCH 0/16] ARM: shmobile: bug fix
  2013-11-14 10:16 ` Kuninori Morimoto
@ 2013-11-14 10:26   ` Kuninori Morimoto
  -1 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-14 10:26 UTC (permalink / raw)
  To: Simon; +Cc: Laurent, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc


Hi Simon

These are SH-ARM bug fix patches

Kuninori Morimoto (14):
       ARM: shmobile: marzen: remove SDHI0 WP pin setting from DTS
       ARM: shmobile: marzen: remove SDHI0 WP pin setting
       ARM: shmobile: sh73a0: fixup sdhi compatible name

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 0/16] ARM: shmobile: bug fix
@ 2013-11-14 10:26   ` Kuninori Morimoto
  0 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-14 10:26 UTC (permalink / raw)
  To: Simon; +Cc: Laurent, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc


Hi Simon

These are SH-ARM bug fix patches

Kuninori Morimoto (14):
       ARM: shmobile: marzen: remove SDHI0 WP pin setting from DTS
       ARM: shmobile: marzen: remove SDHI0 WP pin setting
       ARM: shmobile: sh73a0: fixup sdhi compatible name

^ permalink raw reply	[flat|nested] 113+ messages in thread

* [PATCH 06/17] ARM: shmobile: marzen: remove SDHI0 WP pin setting from DTS
  2013-11-14 10:26   ` Kuninori Morimoto
@ 2013-11-14 10:27     ` Kuninori Morimoto
  -1 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-14 10:27 UTC (permalink / raw)
  To: Simon; +Cc: Laurent, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

WP pin is not implemented on Marzen

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 arch/arm/boot/dts/r8a7779-marzen-reference.dts |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/r8a7779-marzen-reference.dts b/arch/arm/boot/dts/r8a7779-marzen-reference.dts
index ce3fe9e..cd063cd 100644
--- a/arch/arm/boot/dts/r8a7779-marzen-reference.dts
+++ b/arch/arm/boot/dts/r8a7779-marzen-reference.dts
@@ -93,8 +93,7 @@
 	};
 
 	sdhi0_pins: sd0 {
-		renesas,groups = "sdhi0_data4", "sdhi0_ctrl", "sdhi0_cd",
-				 "sdhi0_wp";
+		renesas,groups = "sdhi0_data4", "sdhi0_ctrl", "sdhi0_cd";
 		renesas,function = "sdhi0";
 	};
 };
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH 06/17] ARM: shmobile: marzen: remove SDHI0 WP pin setting from DTS
@ 2013-11-14 10:27     ` Kuninori Morimoto
  0 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-14 10:27 UTC (permalink / raw)
  To: Simon; +Cc: Laurent, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

WP pin is not implemented on Marzen

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 arch/arm/boot/dts/r8a7779-marzen-reference.dts |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/r8a7779-marzen-reference.dts b/arch/arm/boot/dts/r8a7779-marzen-reference.dts
index ce3fe9e..cd063cd 100644
--- a/arch/arm/boot/dts/r8a7779-marzen-reference.dts
+++ b/arch/arm/boot/dts/r8a7779-marzen-reference.dts
@@ -93,8 +93,7 @@
 	};
 
 	sdhi0_pins: sd0 {
-		renesas,groups = "sdhi0_data4", "sdhi0_ctrl", "sdhi0_cd",
-				 "sdhi0_wp";
+		renesas,groups = "sdhi0_data4", "sdhi0_ctrl", "sdhi0_cd";
 		renesas,function = "sdhi0";
 	};
 };
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH 07/17] ARM: shmobile: marzen: remove SDHI0 WP pin setting
  2013-11-14 10:26   ` Kuninori Morimoto
@ 2013-11-14 10:27     ` Kuninori Morimoto
  -1 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-14 10:27 UTC (permalink / raw)
  To: Simon; +Cc: Laurent, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

WP pin is not implemented on Marzen

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 arch/arm/mach-shmobile/board-marzen.c |    2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/arm/mach-shmobile/board-marzen.c b/arch/arm/mach-shmobile/board-marzen.c
index fa102f7..2288dc2 100644
--- a/arch/arm/mach-shmobile/board-marzen.c
+++ b/arch/arm/mach-shmobile/board-marzen.c
@@ -346,8 +346,6 @@ static const struct pinctrl_map marzen_pinctrl_map[] = {
 				  "sdhi0_ctrl", "sdhi0"),
 	PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7779",
 				  "sdhi0_cd", "sdhi0"),
-	PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7779",
-				  "sdhi0_wp", "sdhi0"),
 	/* SMSC */
 	PIN_MAP_MUX_GROUP_DEFAULT("smsc911x", "pfc-r8a7779",
 				  "intc_irq1_b", "intc"),
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH 07/17] ARM: shmobile: marzen: remove SDHI0 WP pin setting
@ 2013-11-14 10:27     ` Kuninori Morimoto
  0 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-14 10:27 UTC (permalink / raw)
  To: Simon; +Cc: Laurent, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

WP pin is not implemented on Marzen

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 arch/arm/mach-shmobile/board-marzen.c |    2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/arm/mach-shmobile/board-marzen.c b/arch/arm/mach-shmobile/board-marzen.c
index fa102f7..2288dc2 100644
--- a/arch/arm/mach-shmobile/board-marzen.c
+++ b/arch/arm/mach-shmobile/board-marzen.c
@@ -346,8 +346,6 @@ static const struct pinctrl_map marzen_pinctrl_map[] = {
 				  "sdhi0_ctrl", "sdhi0"),
 	PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7779",
 				  "sdhi0_cd", "sdhi0"),
-	PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7779",
-				  "sdhi0_wp", "sdhi0"),
 	/* SMSC */
 	PIN_MAP_MUX_GROUP_DEFAULT("smsc911x", "pfc-r8a7779",
 				  "intc_irq1_b", "intc"),
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH 08/17] ARM: shmobile: sh73a0: fixup sdhi compatible name
  2013-11-14 10:26   ` Kuninori Morimoto
@ 2013-11-14 10:27     ` Kuninori Morimoto
  -1 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-14 10:27 UTC (permalink / raw)
  To: Simon; +Cc: Laurent, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

sh73a0 != r8a7740

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 arch/arm/boot/dts/sh73a0.dtsi |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/sh73a0.dtsi b/arch/arm/boot/dts/sh73a0.dtsi
index 78f7201a..6e23fb4 100644
--- a/arch/arm/boot/dts/sh73a0.dtsi
+++ b/arch/arm/boot/dts/sh73a0.dtsi
@@ -201,7 +201,7 @@
 	};
 
 	sdhi0: sd@ee100000 {
-		compatible = "renesas,sdhi-r8a7740";
+		compatible = "renesas,sdhi-sh73a0";
 		reg = <0xee100000 0x100>;
 		interrupt-parent = <&gic>;
 		interrupts = <0 83 4
@@ -213,7 +213,7 @@
 
 	/* SDHI1 and SDHI2 have no CD pins, no need for CD IRQ */
 	sdhi1: sd@ee120000 {
-		compatible = "renesas,sdhi-r8a7740";
+		compatible = "renesas,sdhi-sh73a0";
 		reg = <0xee120000 0x100>;
 		interrupt-parent = <&gic>;
 		interrupts = <0 88 4
@@ -224,7 +224,7 @@
 	};
 
 	sdhi2: sd@ee140000 {
-		compatible = "renesas,sdhi-r8a7740";
+		compatible = "renesas,sdhi-sh73a0";
 		reg = <0xee140000 0x100>;
 		interrupt-parent = <&gic>;
 		interrupts = <0 104 4
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH 08/17] ARM: shmobile: sh73a0: fixup sdhi compatible name
@ 2013-11-14 10:27     ` Kuninori Morimoto
  0 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-14 10:27 UTC (permalink / raw)
  To: Simon; +Cc: Laurent, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

sh73a0 != r8a7740

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 arch/arm/boot/dts/sh73a0.dtsi |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/sh73a0.dtsi b/arch/arm/boot/dts/sh73a0.dtsi
index 78f7201a..6e23fb4 100644
--- a/arch/arm/boot/dts/sh73a0.dtsi
+++ b/arch/arm/boot/dts/sh73a0.dtsi
@@ -201,7 +201,7 @@
 	};
 
 	sdhi0: sd@ee100000 {
-		compatible = "renesas,sdhi-r8a7740";
+		compatible = "renesas,sdhi-sh73a0";
 		reg = <0xee100000 0x100>;
 		interrupt-parent = <&gic>;
 		interrupts = <0 83 4
@@ -213,7 +213,7 @@
 
 	/* SDHI1 and SDHI2 have no CD pins, no need for CD IRQ */
 	sdhi1: sd@ee120000 {
-		compatible = "renesas,sdhi-r8a7740";
+		compatible = "renesas,sdhi-sh73a0";
 		reg = <0xee120000 0x100>;
 		interrupt-parent = <&gic>;
 		interrupts = <0 88 4
@@ -224,7 +224,7 @@
 	};
 
 	sdhi2: sd@ee140000 {
-		compatible = "renesas,sdhi-r8a7740";
+		compatible = "renesas,sdhi-sh73a0";
 		reg = <0xee140000 0x100>;
 		interrupt-parent = <&gic>;
 		interrupts = <0 104 4
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 113+ messages in thread

* Re: [PATCH 0/16] mmc: SDHI: add new feature
  2013-11-14 10:16 ` Kuninori Morimoto
@ 2013-11-14 10:29   ` Kuninori Morimoto
  -1 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-14 10:29 UTC (permalink / raw)
  To: Chris Ball; +Cc: Simon, Laurent, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

Hi Chris

These are SDHI new feature

Kuninori Morimoto
       mmc: tmio: bus_shift become tmio_mmc_data member
       mmc: tmio: add new TMIO_MMC_HAVE_HIGH_REG flags
       mmc: SDHI: add SoC specific workaround via HW version
       mmc: SDHI: tidyup sh_mobile_sdhi_of_match position
       mmc: SDHI: updata sh_mobile_sdhi_of_data for r8a7778
       mmc: SDHI: updata sh_mobile_sdhi_of_data for r8a7779
       mmc: SDHI: updata sh_mobile_sdhi_of_data for r8a7790

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 0/16] mmc: SDHI: add new feature
@ 2013-11-14 10:29   ` Kuninori Morimoto
  0 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-14 10:29 UTC (permalink / raw)
  To: Chris Ball; +Cc: Simon, Laurent, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

Hi Chris

These are SDHI new feature

Kuninori Morimoto
       mmc: tmio: bus_shift become tmio_mmc_data member
       mmc: tmio: add new TMIO_MMC_HAVE_HIGH_REG flags
       mmc: SDHI: add SoC specific workaround via HW version
       mmc: SDHI: tidyup sh_mobile_sdhi_of_match position
       mmc: SDHI: updata sh_mobile_sdhi_of_data for r8a7778
       mmc: SDHI: updata sh_mobile_sdhi_of_data for r8a7779
       mmc: SDHI: updata sh_mobile_sdhi_of_data for r8a7790

^ permalink raw reply	[flat|nested] 113+ messages in thread

* [PATCH 09/17] mmc: tmio: bus_shift become tmio_mmc_data member
  2013-11-14 10:29   ` Kuninori Morimoto
@ 2013-11-14 10:30     ` Kuninori Morimoto
  -1 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-14 10:30 UTC (permalink / raw)
  To: Chris Ball; +Cc: Simon, Laurent, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

.bus_shift is used to 16/32bit register access
offset calculation on tmio driver.
tmio_mmc_xxx is used from Toshiba/Renesas now,
but this bus_shift value depends on HW IP.
This patch moves .bus_shift to tmio_mmc_data member
and set it on each driver.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/mmc/host/sh_mobile_sdhi.c |    8 ++++++++
 drivers/mmc/host/tmio_mmc.c       |    8 ++++++++
 drivers/mmc/host/tmio_mmc.h       |   17 ++++++++---------
 drivers/mmc/host/tmio_mmc_dma.c   |    2 +-
 drivers/mmc/host/tmio_mmc_pio.c   |    3 ---
 include/linux/mfd/tmio.h          |    1 +
 6 files changed, 26 insertions(+), 13 deletions(-)

diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
index f344659..f1e35a7 100644
--- a/drivers/mmc/host/sh_mobile_sdhi.c
+++ b/drivers/mmc/host/sh_mobile_sdhi.c
@@ -133,10 +133,15 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
 	struct tmio_mmc_data *mmc_data;
 	struct sh_mobile_sdhi_info *p = pdev->dev.platform_data;
 	struct tmio_mmc_host *host;
+	struct resource *res;
 	int irq, ret, i = 0;
 	bool multiplexed_isr = true;
 	struct tmio_mmc_dma *dma_priv;
 
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!res)
+		return -EINVAL;
+
 	priv = devm_kzalloc(&pdev->dev, sizeof(struct sh_mobile_sdhi), GFP_KERNEL);
 	if (priv = NULL) {
 		dev_err(&pdev->dev, "kzalloc failed\n");
@@ -206,6 +211,9 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
 		mmc_data->flags |= of_data->tmio_flags;
 	}
 
+	/* SD control register space size is 0x100, 0x200 for bus_shift=1 */
+	mmc_data->bus_shift = resource_size(res) >> 9;
+
 	ret = tmio_mmc_host_probe(&host, pdev, mmc_data);
 	if (ret < 0)
 		goto eprobe;
diff --git a/drivers/mmc/host/tmio_mmc.c b/drivers/mmc/host/tmio_mmc.c
index 8860d4d..6cfb2d5 100644
--- a/drivers/mmc/host/tmio_mmc.c
+++ b/drivers/mmc/host/tmio_mmc.c
@@ -62,6 +62,7 @@ static int tmio_mmc_probe(struct platform_device *pdev)
 	const struct mfd_cell *cell = mfd_get_cell(pdev);
 	struct tmio_mmc_data *pdata;
 	struct tmio_mmc_host *host;
+	struct resource *res;
 	int ret = -EINVAL, irq;
 
 	if (pdev->num_resources != 2)
@@ -84,6 +85,13 @@ static int tmio_mmc_probe(struct platform_device *pdev)
 			goto out;
 	}
 
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!res)
+		return -EINVAL;
+
+	/* SD control register space size is 0x200, 0x400 for bus_shift=1 */
+	pdata->bus_shift = resource_size(res_ctl) >> 10;
+
 	ret = tmio_mmc_host_probe(&host, pdev, pdata);
 	if (ret)
 		goto cell_disable;
diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
index 86fd21e..aaa9c7e 100644
--- a/drivers/mmc/host/tmio_mmc.h
+++ b/drivers/mmc/host/tmio_mmc.h
@@ -58,7 +58,6 @@ enum tmio_mmc_power {
 
 struct tmio_mmc_host {
 	void __iomem *ctl;
-	unsigned long bus_shift;
 	struct mmc_command      *cmd;
 	struct mmc_request      *mrq;
 	struct mmc_data         *data;
@@ -176,19 +175,19 @@ int tmio_mmc_host_runtime_resume(struct device *dev);
 
 static inline u16 sd_ctrl_read16(struct tmio_mmc_host *host, int addr)
 {
-	return readw(host->ctl + (addr << host->bus_shift));
+	return readw(host->ctl + (addr << host->pdata->bus_shift));
 }
 
 static inline void sd_ctrl_read16_rep(struct tmio_mmc_host *host, int addr,
 		u16 *buf, int count)
 {
-	readsw(host->ctl + (addr << host->bus_shift), buf, count);
+	readsw(host->ctl + (addr << host->pdata->bus_shift), buf, count);
 }
 
 static inline u32 sd_ctrl_read32(struct tmio_mmc_host *host, int addr)
 {
-	return readw(host->ctl + (addr << host->bus_shift)) |
-	       readw(host->ctl + ((addr + 2) << host->bus_shift)) << 16;
+	return readw(host->ctl + (addr << host->pdata->bus_shift)) |
+	       readw(host->ctl + ((addr + 2) << host->pdata->bus_shift)) << 16;
 }
 
 static inline void sd_ctrl_write16(struct tmio_mmc_host *host, int addr, u16 val)
@@ -198,19 +197,19 @@ static inline void sd_ctrl_write16(struct tmio_mmc_host *host, int addr, u16 val
 	 */
 	if (host->pdata->write16_hook && host->pdata->write16_hook(host, addr))
 		return;
-	writew(val, host->ctl + (addr << host->bus_shift));
+	writew(val, host->ctl + (addr << host->pdata->bus_shift));
 }
 
 static inline void sd_ctrl_write16_rep(struct tmio_mmc_host *host, int addr,
 		u16 *buf, int count)
 {
-	writesw(host->ctl + (addr << host->bus_shift), buf, count);
+	writesw(host->ctl + (addr << host->pdata->bus_shift), buf, count);
 }
 
 static inline void sd_ctrl_write32(struct tmio_mmc_host *host, int addr, u32 val)
 {
-	writew(val, host->ctl + (addr << host->bus_shift));
-	writew(val >> 16, host->ctl + ((addr + 2) << host->bus_shift));
+	writew(val, host->ctl + (addr << host->pdata->bus_shift));
+	writew(val >> 16, host->ctl + ((addr + 2) << host->pdata->bus_shift));
 }
 
 
diff --git a/drivers/mmc/host/tmio_mmc_dma.c b/drivers/mmc/host/tmio_mmc_dma.c
index 65edb4a..03e7b28 100644
--- a/drivers/mmc/host/tmio_mmc_dma.c
+++ b/drivers/mmc/host/tmio_mmc_dma.c
@@ -293,7 +293,7 @@ void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdat
 		if (pdata->dma->chan_priv_tx)
 			cfg.slave_id = pdata->dma->slave_id_tx;
 		cfg.direction = DMA_MEM_TO_DEV;
-		cfg.dst_addr = res->start + (CTL_SD_DATA_PORT << host->bus_shift);
+		cfg.dst_addr = res->start + (CTL_SD_DATA_PORT << host->pdata->bus_shift);
 		cfg.src_addr = 0;
 		ret = dmaengine_slave_config(host->chan_tx, &cfg);
 		if (ret < 0)
diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
index 1f5f2ba..ed8fd5a 100644
--- a/drivers/mmc/host/tmio_mmc_pio.c
+++ b/drivers/mmc/host/tmio_mmc_pio.c
@@ -1010,9 +1010,6 @@ int tmio_mmc_host_probe(struct tmio_mmc_host **host,
 	_host->set_pwr = pdata->set_pwr;
 	_host->set_clk_div = pdata->set_clk_div;
 
-	/* SD control register space size is 0x200, 0x400 for bus_shift=1 */
-	_host->bus_shift = resource_size(res_ctl) >> 10;
-
 	_host->ctl = ioremap(res_ctl->start, resource_size(res_ctl));
 	if (!_host->ctl) {
 		ret = -ENOMEM;
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
index b22883d..92f72cf 100644
--- a/include/linux/mfd/tmio.h
+++ b/include/linux/mfd/tmio.h
@@ -102,6 +102,7 @@ struct tmio_mmc_data {
 	unsigned long			capabilities;
 	unsigned long			capabilities2;
 	unsigned long			flags;
+	unsigned long			bus_shift;
 	u32				ocr_mask;	/* available voltages */
 	struct tmio_mmc_dma		*dma;
 	struct device			*dev;
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH 09/17] mmc: tmio: bus_shift become tmio_mmc_data member
@ 2013-11-14 10:30     ` Kuninori Morimoto
  0 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-14 10:30 UTC (permalink / raw)
  To: Chris Ball; +Cc: Simon, Laurent, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

.bus_shift is used to 16/32bit register access
offset calculation on tmio driver.
tmio_mmc_xxx is used from Toshiba/Renesas now,
but this bus_shift value depends on HW IP.
This patch moves .bus_shift to tmio_mmc_data member
and set it on each driver.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/mmc/host/sh_mobile_sdhi.c |    8 ++++++++
 drivers/mmc/host/tmio_mmc.c       |    8 ++++++++
 drivers/mmc/host/tmio_mmc.h       |   17 ++++++++---------
 drivers/mmc/host/tmio_mmc_dma.c   |    2 +-
 drivers/mmc/host/tmio_mmc_pio.c   |    3 ---
 include/linux/mfd/tmio.h          |    1 +
 6 files changed, 26 insertions(+), 13 deletions(-)

diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
index f344659..f1e35a7 100644
--- a/drivers/mmc/host/sh_mobile_sdhi.c
+++ b/drivers/mmc/host/sh_mobile_sdhi.c
@@ -133,10 +133,15 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
 	struct tmio_mmc_data *mmc_data;
 	struct sh_mobile_sdhi_info *p = pdev->dev.platform_data;
 	struct tmio_mmc_host *host;
+	struct resource *res;
 	int irq, ret, i = 0;
 	bool multiplexed_isr = true;
 	struct tmio_mmc_dma *dma_priv;
 
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!res)
+		return -EINVAL;
+
 	priv = devm_kzalloc(&pdev->dev, sizeof(struct sh_mobile_sdhi), GFP_KERNEL);
 	if (priv == NULL) {
 		dev_err(&pdev->dev, "kzalloc failed\n");
@@ -206,6 +211,9 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
 		mmc_data->flags |= of_data->tmio_flags;
 	}
 
+	/* SD control register space size is 0x100, 0x200 for bus_shift=1 */
+	mmc_data->bus_shift = resource_size(res) >> 9;
+
 	ret = tmio_mmc_host_probe(&host, pdev, mmc_data);
 	if (ret < 0)
 		goto eprobe;
diff --git a/drivers/mmc/host/tmio_mmc.c b/drivers/mmc/host/tmio_mmc.c
index 8860d4d..6cfb2d5 100644
--- a/drivers/mmc/host/tmio_mmc.c
+++ b/drivers/mmc/host/tmio_mmc.c
@@ -62,6 +62,7 @@ static int tmio_mmc_probe(struct platform_device *pdev)
 	const struct mfd_cell *cell = mfd_get_cell(pdev);
 	struct tmio_mmc_data *pdata;
 	struct tmio_mmc_host *host;
+	struct resource *res;
 	int ret = -EINVAL, irq;
 
 	if (pdev->num_resources != 2)
@@ -84,6 +85,13 @@ static int tmio_mmc_probe(struct platform_device *pdev)
 			goto out;
 	}
 
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!res)
+		return -EINVAL;
+
+	/* SD control register space size is 0x200, 0x400 for bus_shift=1 */
+	pdata->bus_shift = resource_size(res_ctl) >> 10;
+
 	ret = tmio_mmc_host_probe(&host, pdev, pdata);
 	if (ret)
 		goto cell_disable;
diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
index 86fd21e..aaa9c7e 100644
--- a/drivers/mmc/host/tmio_mmc.h
+++ b/drivers/mmc/host/tmio_mmc.h
@@ -58,7 +58,6 @@ enum tmio_mmc_power {
 
 struct tmio_mmc_host {
 	void __iomem *ctl;
-	unsigned long bus_shift;
 	struct mmc_command      *cmd;
 	struct mmc_request      *mrq;
 	struct mmc_data         *data;
@@ -176,19 +175,19 @@ int tmio_mmc_host_runtime_resume(struct device *dev);
 
 static inline u16 sd_ctrl_read16(struct tmio_mmc_host *host, int addr)
 {
-	return readw(host->ctl + (addr << host->bus_shift));
+	return readw(host->ctl + (addr << host->pdata->bus_shift));
 }
 
 static inline void sd_ctrl_read16_rep(struct tmio_mmc_host *host, int addr,
 		u16 *buf, int count)
 {
-	readsw(host->ctl + (addr << host->bus_shift), buf, count);
+	readsw(host->ctl + (addr << host->pdata->bus_shift), buf, count);
 }
 
 static inline u32 sd_ctrl_read32(struct tmio_mmc_host *host, int addr)
 {
-	return readw(host->ctl + (addr << host->bus_shift)) |
-	       readw(host->ctl + ((addr + 2) << host->bus_shift)) << 16;
+	return readw(host->ctl + (addr << host->pdata->bus_shift)) |
+	       readw(host->ctl + ((addr + 2) << host->pdata->bus_shift)) << 16;
 }
 
 static inline void sd_ctrl_write16(struct tmio_mmc_host *host, int addr, u16 val)
@@ -198,19 +197,19 @@ static inline void sd_ctrl_write16(struct tmio_mmc_host *host, int addr, u16 val
 	 */
 	if (host->pdata->write16_hook && host->pdata->write16_hook(host, addr))
 		return;
-	writew(val, host->ctl + (addr << host->bus_shift));
+	writew(val, host->ctl + (addr << host->pdata->bus_shift));
 }
 
 static inline void sd_ctrl_write16_rep(struct tmio_mmc_host *host, int addr,
 		u16 *buf, int count)
 {
-	writesw(host->ctl + (addr << host->bus_shift), buf, count);
+	writesw(host->ctl + (addr << host->pdata->bus_shift), buf, count);
 }
 
 static inline void sd_ctrl_write32(struct tmio_mmc_host *host, int addr, u32 val)
 {
-	writew(val, host->ctl + (addr << host->bus_shift));
-	writew(val >> 16, host->ctl + ((addr + 2) << host->bus_shift));
+	writew(val, host->ctl + (addr << host->pdata->bus_shift));
+	writew(val >> 16, host->ctl + ((addr + 2) << host->pdata->bus_shift));
 }
 
 
diff --git a/drivers/mmc/host/tmio_mmc_dma.c b/drivers/mmc/host/tmio_mmc_dma.c
index 65edb4a..03e7b28 100644
--- a/drivers/mmc/host/tmio_mmc_dma.c
+++ b/drivers/mmc/host/tmio_mmc_dma.c
@@ -293,7 +293,7 @@ void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdat
 		if (pdata->dma->chan_priv_tx)
 			cfg.slave_id = pdata->dma->slave_id_tx;
 		cfg.direction = DMA_MEM_TO_DEV;
-		cfg.dst_addr = res->start + (CTL_SD_DATA_PORT << host->bus_shift);
+		cfg.dst_addr = res->start + (CTL_SD_DATA_PORT << host->pdata->bus_shift);
 		cfg.src_addr = 0;
 		ret = dmaengine_slave_config(host->chan_tx, &cfg);
 		if (ret < 0)
diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
index 1f5f2ba..ed8fd5a 100644
--- a/drivers/mmc/host/tmio_mmc_pio.c
+++ b/drivers/mmc/host/tmio_mmc_pio.c
@@ -1010,9 +1010,6 @@ int tmio_mmc_host_probe(struct tmio_mmc_host **host,
 	_host->set_pwr = pdata->set_pwr;
 	_host->set_clk_div = pdata->set_clk_div;
 
-	/* SD control register space size is 0x200, 0x400 for bus_shift=1 */
-	_host->bus_shift = resource_size(res_ctl) >> 10;
-
 	_host->ctl = ioremap(res_ctl->start, resource_size(res_ctl));
 	if (!_host->ctl) {
 		ret = -ENOMEM;
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
index b22883d..92f72cf 100644
--- a/include/linux/mfd/tmio.h
+++ b/include/linux/mfd/tmio.h
@@ -102,6 +102,7 @@ struct tmio_mmc_data {
 	unsigned long			capabilities;
 	unsigned long			capabilities2;
 	unsigned long			flags;
+	unsigned long			bus_shift;
 	u32				ocr_mask;	/* available voltages */
 	struct tmio_mmc_dma		*dma;
 	struct device			*dev;
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH 10/17] mmc: tmio: add new TMIO_MMC_HAVE_HIGH_REG flags
  2013-11-14 10:29   ` Kuninori Morimoto
@ 2013-11-14 10:31     ` Kuninori Morimoto
  -1 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-14 10:31 UTC (permalink / raw)
  To: Chris Ball; +Cc: Simon, Laurent, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

The accessibility checking method to the
higher register was added by
69d1fe18e92afb4687605a1ab2ec73fbc3bae344
(mmc: tmio: only access registers above 0xff, if available)
But, it doesn't care 32bit register.
it is impossible to calculate it from  resource size, since,
there is 16/32 bit register IP
(ex VERSION is located on 0xe2 if 16bit register,
but it is located on  0x1c4 if 32bit register).
This patch adds new TMIO_MMC_HAVE_HIGH_REG flags,
tmio_mmc driver has it, and sh_mobile_sdhi doesn't has it today.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/mmc/host/tmio_mmc.c     |    1 +
 drivers/mmc/host/tmio_mmc_pio.c |   14 ++++----------
 include/linux/mfd/tmio.h        |    7 +++++++
 3 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/drivers/mmc/host/tmio_mmc.c b/drivers/mmc/host/tmio_mmc.c
index 6cfb2d5..8a781e2 100644
--- a/drivers/mmc/host/tmio_mmc.c
+++ b/drivers/mmc/host/tmio_mmc.c
@@ -91,6 +91,7 @@ static int tmio_mmc_probe(struct platform_device *pdev)
 
 	/* SD control register space size is 0x200, 0x400 for bus_shift=1 */
 	pdata->bus_shift = resource_size(res_ctl) >> 10;
+	pdata->flags |= TMIO_MMC_HAVE_HIGH_REG;
 
 	ret = tmio_mmc_host_probe(&host, pdev, pdata);
 	if (ret)
diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
index ed8fd5a..a55fe06 100644
--- a/drivers/mmc/host/tmio_mmc_pio.c
+++ b/drivers/mmc/host/tmio_mmc_pio.c
@@ -161,10 +161,8 @@ static void tmio_mmc_set_clock(struct tmio_mmc_host *host, int new_clock)
 
 static void tmio_mmc_clk_stop(struct tmio_mmc_host *host)
 {
-	struct resource *res = platform_get_resource(host->pdev, IORESOURCE_MEM, 0);
-
 	/* implicit BUG_ON(!res) */
-	if (resource_size(res) > 0x100) {
+	if (host->pdata->flags & TMIO_MMC_HAVE_HIGH_REG) {
 		sd_ctrl_write16(host, CTL_CLK_AND_WAIT_CTL, 0x0000);
 		msleep(10);
 	}
@@ -176,14 +174,12 @@ static void tmio_mmc_clk_stop(struct tmio_mmc_host *host)
 
 static void tmio_mmc_clk_start(struct tmio_mmc_host *host)
 {
-	struct resource *res = platform_get_resource(host->pdev, IORESOURCE_MEM, 0);
-
 	sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, 0x0100 |
 		sd_ctrl_read16(host, CTL_SD_CARD_CLK_CTL));
 	msleep(10);
 
 	/* implicit BUG_ON(!res) */
-	if (resource_size(res) > 0x100) {
+	if (host->pdata->flags & TMIO_MMC_HAVE_HIGH_REG) {
 		sd_ctrl_write16(host, CTL_CLK_AND_WAIT_CTL, 0x0100);
 		msleep(10);
 	}
@@ -191,16 +187,14 @@ static void tmio_mmc_clk_start(struct tmio_mmc_host *host)
 
 static void tmio_mmc_reset(struct tmio_mmc_host *host)
 {
-	struct resource *res = platform_get_resource(host->pdev, IORESOURCE_MEM, 0);
-
 	/* FIXME - should we set stop clock reg here */
 	sd_ctrl_write16(host, CTL_RESET_SD, 0x0000);
 	/* implicit BUG_ON(!res) */
-	if (resource_size(res) > 0x100)
+	if (host->pdata->flags & TMIO_MMC_HAVE_HIGH_REG)
 		sd_ctrl_write16(host, CTL_RESET_SDIO, 0x0000);
 	msleep(10);
 	sd_ctrl_write16(host, CTL_RESET_SD, 0x0001);
-	if (resource_size(res) > 0x100)
+	if (host->pdata->flags & TMIO_MMC_HAVE_HIGH_REG)
 		sd_ctrl_write16(host, CTL_RESET_SDIO, 0x0001);
 	msleep(10);
 }
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
index 92f72cf..8f6f2e9 100644
--- a/include/linux/mfd/tmio.h
+++ b/include/linux/mfd/tmio.h
@@ -76,6 +76,13 @@
  */
 #define TMIO_MMC_USE_GPIO_CD		(1 << 5)
 
+/*
+ * Some controllers doesn't have over 0x100 register.
+ * it is used to checking accessibility of
+ * CTL_SD_CARD_CLK_CTL / CTL_CLK_AND_WAIT_CTL
+ */
+#define TMIO_MMC_HAVE_HIGH_REG		(1 << 6)
+
 int tmio_core_mmc_enable(void __iomem *cnf, int shift, unsigned long base);
 int tmio_core_mmc_resume(void __iomem *cnf, int shift, unsigned long base);
 void tmio_core_mmc_pwr(void __iomem *cnf, int shift, int state);
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH 10/17] mmc: tmio: add new TMIO_MMC_HAVE_HIGH_REG flags
@ 2013-11-14 10:31     ` Kuninori Morimoto
  0 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-14 10:31 UTC (permalink / raw)
  To: Chris Ball; +Cc: Simon, Laurent, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

The accessibility checking method to the
higher register was added by
69d1fe18e92afb4687605a1ab2ec73fbc3bae344
(mmc: tmio: only access registers above 0xff, if available)
But, it doesn't care 32bit register.
it is impossible to calculate it from  resource size, since,
there is 16/32 bit register IP
(ex VERSION is located on 0xe2 if 16bit register,
but it is located on  0x1c4 if 32bit register).
This patch adds new TMIO_MMC_HAVE_HIGH_REG flags,
tmio_mmc driver has it, and sh_mobile_sdhi doesn't has it today.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/mmc/host/tmio_mmc.c     |    1 +
 drivers/mmc/host/tmio_mmc_pio.c |   14 ++++----------
 include/linux/mfd/tmio.h        |    7 +++++++
 3 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/drivers/mmc/host/tmio_mmc.c b/drivers/mmc/host/tmio_mmc.c
index 6cfb2d5..8a781e2 100644
--- a/drivers/mmc/host/tmio_mmc.c
+++ b/drivers/mmc/host/tmio_mmc.c
@@ -91,6 +91,7 @@ static int tmio_mmc_probe(struct platform_device *pdev)
 
 	/* SD control register space size is 0x200, 0x400 for bus_shift=1 */
 	pdata->bus_shift = resource_size(res_ctl) >> 10;
+	pdata->flags |= TMIO_MMC_HAVE_HIGH_REG;
 
 	ret = tmio_mmc_host_probe(&host, pdev, pdata);
 	if (ret)
diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
index ed8fd5a..a55fe06 100644
--- a/drivers/mmc/host/tmio_mmc_pio.c
+++ b/drivers/mmc/host/tmio_mmc_pio.c
@@ -161,10 +161,8 @@ static void tmio_mmc_set_clock(struct tmio_mmc_host *host, int new_clock)
 
 static void tmio_mmc_clk_stop(struct tmio_mmc_host *host)
 {
-	struct resource *res = platform_get_resource(host->pdev, IORESOURCE_MEM, 0);
-
 	/* implicit BUG_ON(!res) */
-	if (resource_size(res) > 0x100) {
+	if (host->pdata->flags & TMIO_MMC_HAVE_HIGH_REG) {
 		sd_ctrl_write16(host, CTL_CLK_AND_WAIT_CTL, 0x0000);
 		msleep(10);
 	}
@@ -176,14 +174,12 @@ static void tmio_mmc_clk_stop(struct tmio_mmc_host *host)
 
 static void tmio_mmc_clk_start(struct tmio_mmc_host *host)
 {
-	struct resource *res = platform_get_resource(host->pdev, IORESOURCE_MEM, 0);
-
 	sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, 0x0100 |
 		sd_ctrl_read16(host, CTL_SD_CARD_CLK_CTL));
 	msleep(10);
 
 	/* implicit BUG_ON(!res) */
-	if (resource_size(res) > 0x100) {
+	if (host->pdata->flags & TMIO_MMC_HAVE_HIGH_REG) {
 		sd_ctrl_write16(host, CTL_CLK_AND_WAIT_CTL, 0x0100);
 		msleep(10);
 	}
@@ -191,16 +187,14 @@ static void tmio_mmc_clk_start(struct tmio_mmc_host *host)
 
 static void tmio_mmc_reset(struct tmio_mmc_host *host)
 {
-	struct resource *res = platform_get_resource(host->pdev, IORESOURCE_MEM, 0);
-
 	/* FIXME - should we set stop clock reg here */
 	sd_ctrl_write16(host, CTL_RESET_SD, 0x0000);
 	/* implicit BUG_ON(!res) */
-	if (resource_size(res) > 0x100)
+	if (host->pdata->flags & TMIO_MMC_HAVE_HIGH_REG)
 		sd_ctrl_write16(host, CTL_RESET_SDIO, 0x0000);
 	msleep(10);
 	sd_ctrl_write16(host, CTL_RESET_SD, 0x0001);
-	if (resource_size(res) > 0x100)
+	if (host->pdata->flags & TMIO_MMC_HAVE_HIGH_REG)
 		sd_ctrl_write16(host, CTL_RESET_SDIO, 0x0001);
 	msleep(10);
 }
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
index 92f72cf..8f6f2e9 100644
--- a/include/linux/mfd/tmio.h
+++ b/include/linux/mfd/tmio.h
@@ -76,6 +76,13 @@
  */
 #define TMIO_MMC_USE_GPIO_CD		(1 << 5)
 
+/*
+ * Some controllers doesn't have over 0x100 register.
+ * it is used to checking accessibility of
+ * CTL_SD_CARD_CLK_CTL / CTL_CLK_AND_WAIT_CTL
+ */
+#define TMIO_MMC_HAVE_HIGH_REG		(1 << 6)
+
 int tmio_core_mmc_enable(void __iomem *cnf, int shift, unsigned long base);
 int tmio_core_mmc_resume(void __iomem *cnf, int shift, unsigned long base);
 void tmio_core_mmc_pwr(void __iomem *cnf, int shift, int state);
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH 11/17] mmc: SDHI: add SoC specific workaround via HW version
  2013-11-14 10:29   ` Kuninori Morimoto
@ 2013-11-14 10:31     ` Kuninori Morimoto
  -1 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-14 10:31 UTC (permalink / raw)
  To: Chris Ball; +Cc: Simon, Laurent, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

One of Renesas SDHI chip needs workaround to use it,
and, we can judge it based on chip version.
This patch adds very quick-hack workaround method,
since we still don't know how many chips
need workaround in the future.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/mmc/host/sh_mobile_sdhi.c |   11 +++++++++++
 include/linux/mmc/tmio.h          |    1 +
 2 files changed, 12 insertions(+)

diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
index f1e35a7..d241d86 100644
--- a/drivers/mmc/host/sh_mobile_sdhi.c
+++ b/drivers/mmc/host/sh_mobile_sdhi.c
@@ -33,6 +33,8 @@
 
 #include "tmio_mmc.h"
 
+#define EXT_ACC           0xe4
+
 struct sh_mobile_sdhi_of_data {
 	unsigned long tmio_flags;
 };
@@ -137,6 +139,7 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
 	int irq, ret, i = 0;
 	bool multiplexed_isr = true;
 	struct tmio_mmc_dma *dma_priv;
+	u16 ver;
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	if (!res)
@@ -219,6 +222,14 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
 		goto eprobe;
 
 	/*
+	 * FIXME:
+	 * this Workaround can be more clever method
+	 */
+	ver = sd_ctrl_read16(host, CTL_VERSION);
+	if (ver = 0xCB0D)
+		sd_ctrl_write16(host, EXT_ACC, 1);
+
+	/*
 	 * Allow one or more specific (named) ISRs or
 	 * one or more multiplexed (un-named) ISRs.
 	 */
diff --git a/include/linux/mmc/tmio.h b/include/linux/mmc/tmio.h
index a1c1f32..84d9053 100644
--- a/include/linux/mmc/tmio.h
+++ b/include/linux/mmc/tmio.h
@@ -33,6 +33,7 @@
 #define CTL_SDIO_IRQ_MASK 0x38
 #define CTL_DMA_ENABLE 0xd8
 #define CTL_RESET_SD 0xe0
+#define CTL_VERSION 0xe2
 #define CTL_SDIO_REGS 0x100
 #define CTL_CLK_AND_WAIT_CTL 0x138
 #define CTL_RESET_SDIO 0x1e0
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH 11/17] mmc: SDHI: add SoC specific workaround via HW version
@ 2013-11-14 10:31     ` Kuninori Morimoto
  0 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-14 10:31 UTC (permalink / raw)
  To: Chris Ball; +Cc: Simon, Laurent, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

One of Renesas SDHI chip needs workaround to use it,
and, we can judge it based on chip version.
This patch adds very quick-hack workaround method,
since we still don't know how many chips
need workaround in the future.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/mmc/host/sh_mobile_sdhi.c |   11 +++++++++++
 include/linux/mmc/tmio.h          |    1 +
 2 files changed, 12 insertions(+)

diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
index f1e35a7..d241d86 100644
--- a/drivers/mmc/host/sh_mobile_sdhi.c
+++ b/drivers/mmc/host/sh_mobile_sdhi.c
@@ -33,6 +33,8 @@
 
 #include "tmio_mmc.h"
 
+#define EXT_ACC           0xe4
+
 struct sh_mobile_sdhi_of_data {
 	unsigned long tmio_flags;
 };
@@ -137,6 +139,7 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
 	int irq, ret, i = 0;
 	bool multiplexed_isr = true;
 	struct tmio_mmc_dma *dma_priv;
+	u16 ver;
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	if (!res)
@@ -219,6 +222,14 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
 		goto eprobe;
 
 	/*
+	 * FIXME:
+	 * this Workaround can be more clever method
+	 */
+	ver = sd_ctrl_read16(host, CTL_VERSION);
+	if (ver == 0xCB0D)
+		sd_ctrl_write16(host, EXT_ACC, 1);
+
+	/*
 	 * Allow one or more specific (named) ISRs or
 	 * one or more multiplexed (un-named) ISRs.
 	 */
diff --git a/include/linux/mmc/tmio.h b/include/linux/mmc/tmio.h
index a1c1f32..84d9053 100644
--- a/include/linux/mmc/tmio.h
+++ b/include/linux/mmc/tmio.h
@@ -33,6 +33,7 @@
 #define CTL_SDIO_IRQ_MASK 0x38
 #define CTL_DMA_ENABLE 0xd8
 #define CTL_RESET_SD 0xe0
+#define CTL_VERSION 0xe2
 #define CTL_SDIO_REGS 0x100
 #define CTL_CLK_AND_WAIT_CTL 0x138
 #define CTL_RESET_SDIO 0x1e0
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH 12/17] mmc: SDHI: tidyup sh_mobile_sdhi_of_match position
  2013-11-14 10:29   ` Kuninori Morimoto
@ 2013-11-14 10:31     ` Kuninori Morimoto
  -1 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-14 10:31 UTC (permalink / raw)
  To: Chris Ball; +Cc: Simon, Laurent, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

it is easy to read if sh_mobile_sdhi_of_cfg and
sh_mobile_sdhi_of_match are closer

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/mmc/host/sh_mobile_sdhi.c |   26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
index d241d86..1a3bd0b 100644
--- a/drivers/mmc/host/sh_mobile_sdhi.c
+++ b/drivers/mmc/host/sh_mobile_sdhi.c
@@ -45,6 +45,19 @@ static const struct sh_mobile_sdhi_of_data sh_mobile_sdhi_of_cfg[] = {
 	},
 };
 
+static const struct of_device_id sh_mobile_sdhi_of_match[] = {
+	{ .compatible = "renesas,sdhi-shmobile" },
+	{ .compatible = "renesas,sdhi-sh7372" },
+	{ .compatible = "renesas,sdhi-sh73a0", .data = &sh_mobile_sdhi_of_cfg[0], },
+	{ .compatible = "renesas,sdhi-r8a73a4", .data = &sh_mobile_sdhi_of_cfg[0], },
+	{ .compatible = "renesas,sdhi-r8a7740", .data = &sh_mobile_sdhi_of_cfg[0], },
+	{ .compatible = "renesas,sdhi-r8a7778", .data = &sh_mobile_sdhi_of_cfg[0], },
+	{ .compatible = "renesas,sdhi-r8a7779", .data = &sh_mobile_sdhi_of_cfg[0], },
+	{ .compatible = "renesas,sdhi-r8a7790", .data = &sh_mobile_sdhi_of_cfg[0], },
+	{},
+};
+MODULE_DEVICE_TABLE(of, sh_mobile_sdhi_of_match);
+
 struct sh_mobile_sdhi {
 	struct clk *clk;
 	struct tmio_mmc_data mmc_data;
@@ -114,19 +127,6 @@ static const struct sh_mobile_sdhi_ops sdhi_ops = {
 	.cd_wakeup = sh_mobile_sdhi_cd_wakeup,
 };
 
-static const struct of_device_id sh_mobile_sdhi_of_match[] = {
-	{ .compatible = "renesas,sdhi-shmobile" },
-	{ .compatible = "renesas,sdhi-sh7372" },
-	{ .compatible = "renesas,sdhi-sh73a0", .data = &sh_mobile_sdhi_of_cfg[0], },
-	{ .compatible = "renesas,sdhi-r8a73a4", .data = &sh_mobile_sdhi_of_cfg[0], },
-	{ .compatible = "renesas,sdhi-r8a7740", .data = &sh_mobile_sdhi_of_cfg[0], },
-	{ .compatible = "renesas,sdhi-r8a7778", .data = &sh_mobile_sdhi_of_cfg[0], },
-	{ .compatible = "renesas,sdhi-r8a7779", .data = &sh_mobile_sdhi_of_cfg[0], },
-	{ .compatible = "renesas,sdhi-r8a7790", .data = &sh_mobile_sdhi_of_cfg[0], },
-	{},
-};
-MODULE_DEVICE_TABLE(of, sh_mobile_sdhi_of_match);
-
 static int sh_mobile_sdhi_probe(struct platform_device *pdev)
 {
 	const struct of_device_id *of_id -- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH 12/17] mmc: SDHI: tidyup sh_mobile_sdhi_of_match position
@ 2013-11-14 10:31     ` Kuninori Morimoto
  0 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-14 10:31 UTC (permalink / raw)
  To: Chris Ball; +Cc: Simon, Laurent, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

it is easy to read if sh_mobile_sdhi_of_cfg and
sh_mobile_sdhi_of_match are closer

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/mmc/host/sh_mobile_sdhi.c |   26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
index d241d86..1a3bd0b 100644
--- a/drivers/mmc/host/sh_mobile_sdhi.c
+++ b/drivers/mmc/host/sh_mobile_sdhi.c
@@ -45,6 +45,19 @@ static const struct sh_mobile_sdhi_of_data sh_mobile_sdhi_of_cfg[] = {
 	},
 };
 
+static const struct of_device_id sh_mobile_sdhi_of_match[] = {
+	{ .compatible = "renesas,sdhi-shmobile" },
+	{ .compatible = "renesas,sdhi-sh7372" },
+	{ .compatible = "renesas,sdhi-sh73a0", .data = &sh_mobile_sdhi_of_cfg[0], },
+	{ .compatible = "renesas,sdhi-r8a73a4", .data = &sh_mobile_sdhi_of_cfg[0], },
+	{ .compatible = "renesas,sdhi-r8a7740", .data = &sh_mobile_sdhi_of_cfg[0], },
+	{ .compatible = "renesas,sdhi-r8a7778", .data = &sh_mobile_sdhi_of_cfg[0], },
+	{ .compatible = "renesas,sdhi-r8a7779", .data = &sh_mobile_sdhi_of_cfg[0], },
+	{ .compatible = "renesas,sdhi-r8a7790", .data = &sh_mobile_sdhi_of_cfg[0], },
+	{},
+};
+MODULE_DEVICE_TABLE(of, sh_mobile_sdhi_of_match);
+
 struct sh_mobile_sdhi {
 	struct clk *clk;
 	struct tmio_mmc_data mmc_data;
@@ -114,19 +127,6 @@ static const struct sh_mobile_sdhi_ops sdhi_ops = {
 	.cd_wakeup = sh_mobile_sdhi_cd_wakeup,
 };
 
-static const struct of_device_id sh_mobile_sdhi_of_match[] = {
-	{ .compatible = "renesas,sdhi-shmobile" },
-	{ .compatible = "renesas,sdhi-sh7372" },
-	{ .compatible = "renesas,sdhi-sh73a0", .data = &sh_mobile_sdhi_of_cfg[0], },
-	{ .compatible = "renesas,sdhi-r8a73a4", .data = &sh_mobile_sdhi_of_cfg[0], },
-	{ .compatible = "renesas,sdhi-r8a7740", .data = &sh_mobile_sdhi_of_cfg[0], },
-	{ .compatible = "renesas,sdhi-r8a7778", .data = &sh_mobile_sdhi_of_cfg[0], },
-	{ .compatible = "renesas,sdhi-r8a7779", .data = &sh_mobile_sdhi_of_cfg[0], },
-	{ .compatible = "renesas,sdhi-r8a7790", .data = &sh_mobile_sdhi_of_cfg[0], },
-	{},
-};
-MODULE_DEVICE_TABLE(of, sh_mobile_sdhi_of_match);
-
 static int sh_mobile_sdhi_probe(struct platform_device *pdev)
 {
 	const struct of_device_id *of_id =
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH 13/17] mmc: SDHI: updata sh_mobile_sdhi_of_data for r8a7778
  2013-11-14 10:29   ` Kuninori Morimoto
@ 2013-11-14 10:32     ` Kuninori Morimoto
  -1 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-14 10:32 UTC (permalink / raw)
  To: Chris Ball; +Cc: Simon, Laurent, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

This patch updates r8a7778 DT data to have SoC specific settings.
Latest Renesas Chip has some SDHI channels and the WP pin
availability depends on its channel or HW implementation.
Thus, this patch disables it as default,
but we can use wp-gpios property to enable it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 arch/arm/boot/dts/r8a7778-bockw-reference.dts |    4 +++-
 arch/arm/boot/dts/r8a7778.dtsi                |    6 ------
 drivers/mmc/host/sh_mobile_sdhi.c             |    9 ++++++++-
 3 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/arch/arm/boot/dts/r8a7778-bockw-reference.dts b/arch/arm/boot/dts/r8a7778-bockw-reference.dts
index 9c8bd37..6e58077 100644
--- a/arch/arm/boot/dts/r8a7778-bockw-reference.dts
+++ b/arch/arm/boot/dts/r8a7778-bockw-reference.dts
@@ -16,6 +16,7 @@
 
 /dts-v1/;
 /include/ "r8a7778.dtsi"
+#include <dt-bindings/gpio/gpio.h>
 
 / {
 	model = "bockw";
@@ -83,7 +84,7 @@
 
 	sdhi0_pins: sd0 {
 		renesas,groups = "sdhi0_data4", "sdhi0_ctrl",
-				  "sdhi0_cd", "sdhi0_wp";
+				  "sdhi0_cd";
 		renesas,function = "sdhi0";
 	};
 };
@@ -95,4 +96,5 @@
 	vmmc-supply = <&fixedregulator3v3>;
 	bus-width = <4>;
 	status = "okay";
+	wp-gpios = <&gpio3 18 GPIO_ACTIVE_HIGH>;
 };
diff --git a/arch/arm/boot/dts/r8a7778.dtsi b/arch/arm/boot/dts/r8a7778.dtsi
index 698809f..bfb7030 100644
--- a/arch/arm/boot/dts/r8a7778.dtsi
+++ b/arch/arm/boot/dts/r8a7778.dtsi
@@ -170,8 +170,6 @@
 		reg = <0xffe4c000 0x100>;
 		interrupt-parent = <&gic>;
 		interrupts = <0 87 4>;
-		cap-sd-highspeed;
-		cap-sdio-irq;
 		status = "disabled";
 	};
 
@@ -180,8 +178,6 @@
 		reg = <0xffe4d000 0x100>;
 		interrupt-parent = <&gic>;
 		interrupts = <0 88 4>;
-		cap-sd-highspeed;
-		cap-sdio-irq;
 		status = "disabled";
 	};
 
@@ -190,8 +186,6 @@
 		reg = <0xffe4f000 0x100>;
 		interrupt-parent = <&gic>;
 		interrupts = <0 86 4>;
-		cap-sd-highspeed;
-		cap-sdio-irq;
 		status = "disabled";
 	};
 
diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
index 1a3bd0b..dc97027 100644
--- a/drivers/mmc/host/sh_mobile_sdhi.c
+++ b/drivers/mmc/host/sh_mobile_sdhi.c
@@ -37,6 +37,7 @@
 
 struct sh_mobile_sdhi_of_data {
 	unsigned long tmio_flags;
+	unsigned long capabilities;
 };
 
 static const struct sh_mobile_sdhi_of_data sh_mobile_sdhi_of_cfg[] = {
@@ -45,13 +46,18 @@ static const struct sh_mobile_sdhi_of_data sh_mobile_sdhi_of_cfg[] = {
 	},
 };
 
+static const struct sh_mobile_sdhi_of_data of_rcar_gen1_compatible = {
+	.tmio_flags	= TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_WRPROTECT_DISABLE,
+	.capabilities	= MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ,
+};
+
 static const struct of_device_id sh_mobile_sdhi_of_match[] = {
 	{ .compatible = "renesas,sdhi-shmobile" },
 	{ .compatible = "renesas,sdhi-sh7372" },
 	{ .compatible = "renesas,sdhi-sh73a0", .data = &sh_mobile_sdhi_of_cfg[0], },
 	{ .compatible = "renesas,sdhi-r8a73a4", .data = &sh_mobile_sdhi_of_cfg[0], },
 	{ .compatible = "renesas,sdhi-r8a7740", .data = &sh_mobile_sdhi_of_cfg[0], },
-	{ .compatible = "renesas,sdhi-r8a7778", .data = &sh_mobile_sdhi_of_cfg[0], },
+	{ .compatible = "renesas,sdhi-r8a7778", .data = &of_rcar_gen1_compatible, },
 	{ .compatible = "renesas,sdhi-r8a7779", .data = &sh_mobile_sdhi_of_cfg[0], },
 	{ .compatible = "renesas,sdhi-r8a7790", .data = &sh_mobile_sdhi_of_cfg[0], },
 	{},
@@ -212,6 +218,7 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
 	if (of_id && of_id->data) {
 		const struct sh_mobile_sdhi_of_data *of_data = of_id->data;
 		mmc_data->flags |= of_data->tmio_flags;
+		mmc_data->capabilities |= of_data->capabilities;
 	}
 
 	/* SD control register space size is 0x100, 0x200 for bus_shift=1 */
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH 13/17] mmc: SDHI: updata sh_mobile_sdhi_of_data for r8a7778
@ 2013-11-14 10:32     ` Kuninori Morimoto
  0 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-14 10:32 UTC (permalink / raw)
  To: Chris Ball; +Cc: Simon, Laurent, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

This patch updates r8a7778 DT data to have SoC specific settings.
Latest Renesas Chip has some SDHI channels and the WP pin
availability depends on its channel or HW implementation.
Thus, this patch disables it as default,
but we can use wp-gpios property to enable it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 arch/arm/boot/dts/r8a7778-bockw-reference.dts |    4 +++-
 arch/arm/boot/dts/r8a7778.dtsi                |    6 ------
 drivers/mmc/host/sh_mobile_sdhi.c             |    9 ++++++++-
 3 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/arch/arm/boot/dts/r8a7778-bockw-reference.dts b/arch/arm/boot/dts/r8a7778-bockw-reference.dts
index 9c8bd37..6e58077 100644
--- a/arch/arm/boot/dts/r8a7778-bockw-reference.dts
+++ b/arch/arm/boot/dts/r8a7778-bockw-reference.dts
@@ -16,6 +16,7 @@
 
 /dts-v1/;
 /include/ "r8a7778.dtsi"
+#include <dt-bindings/gpio/gpio.h>
 
 / {
 	model = "bockw";
@@ -83,7 +84,7 @@
 
 	sdhi0_pins: sd0 {
 		renesas,groups = "sdhi0_data4", "sdhi0_ctrl",
-				  "sdhi0_cd", "sdhi0_wp";
+				  "sdhi0_cd";
 		renesas,function = "sdhi0";
 	};
 };
@@ -95,4 +96,5 @@
 	vmmc-supply = <&fixedregulator3v3>;
 	bus-width = <4>;
 	status = "okay";
+	wp-gpios = <&gpio3 18 GPIO_ACTIVE_HIGH>;
 };
diff --git a/arch/arm/boot/dts/r8a7778.dtsi b/arch/arm/boot/dts/r8a7778.dtsi
index 698809f..bfb7030 100644
--- a/arch/arm/boot/dts/r8a7778.dtsi
+++ b/arch/arm/boot/dts/r8a7778.dtsi
@@ -170,8 +170,6 @@
 		reg = <0xffe4c000 0x100>;
 		interrupt-parent = <&gic>;
 		interrupts = <0 87 4>;
-		cap-sd-highspeed;
-		cap-sdio-irq;
 		status = "disabled";
 	};
 
@@ -180,8 +178,6 @@
 		reg = <0xffe4d000 0x100>;
 		interrupt-parent = <&gic>;
 		interrupts = <0 88 4>;
-		cap-sd-highspeed;
-		cap-sdio-irq;
 		status = "disabled";
 	};
 
@@ -190,8 +186,6 @@
 		reg = <0xffe4f000 0x100>;
 		interrupt-parent = <&gic>;
 		interrupts = <0 86 4>;
-		cap-sd-highspeed;
-		cap-sdio-irq;
 		status = "disabled";
 	};
 
diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
index 1a3bd0b..dc97027 100644
--- a/drivers/mmc/host/sh_mobile_sdhi.c
+++ b/drivers/mmc/host/sh_mobile_sdhi.c
@@ -37,6 +37,7 @@
 
 struct sh_mobile_sdhi_of_data {
 	unsigned long tmio_flags;
+	unsigned long capabilities;
 };
 
 static const struct sh_mobile_sdhi_of_data sh_mobile_sdhi_of_cfg[] = {
@@ -45,13 +46,18 @@ static const struct sh_mobile_sdhi_of_data sh_mobile_sdhi_of_cfg[] = {
 	},
 };
 
+static const struct sh_mobile_sdhi_of_data of_rcar_gen1_compatible = {
+	.tmio_flags	= TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_WRPROTECT_DISABLE,
+	.capabilities	= MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ,
+};
+
 static const struct of_device_id sh_mobile_sdhi_of_match[] = {
 	{ .compatible = "renesas,sdhi-shmobile" },
 	{ .compatible = "renesas,sdhi-sh7372" },
 	{ .compatible = "renesas,sdhi-sh73a0", .data = &sh_mobile_sdhi_of_cfg[0], },
 	{ .compatible = "renesas,sdhi-r8a73a4", .data = &sh_mobile_sdhi_of_cfg[0], },
 	{ .compatible = "renesas,sdhi-r8a7740", .data = &sh_mobile_sdhi_of_cfg[0], },
-	{ .compatible = "renesas,sdhi-r8a7778", .data = &sh_mobile_sdhi_of_cfg[0], },
+	{ .compatible = "renesas,sdhi-r8a7778", .data = &of_rcar_gen1_compatible, },
 	{ .compatible = "renesas,sdhi-r8a7779", .data = &sh_mobile_sdhi_of_cfg[0], },
 	{ .compatible = "renesas,sdhi-r8a7790", .data = &sh_mobile_sdhi_of_cfg[0], },
 	{},
@@ -212,6 +218,7 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
 	if (of_id && of_id->data) {
 		const struct sh_mobile_sdhi_of_data *of_data = of_id->data;
 		mmc_data->flags |= of_data->tmio_flags;
+		mmc_data->capabilities |= of_data->capabilities;
 	}
 
 	/* SD control register space size is 0x100, 0x200 for bus_shift=1 */
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH 14/17] mmc: SDHI: updata sh_mobile_sdhi_of_data for r8a7779
  2013-11-14 10:29   ` Kuninori Morimoto
@ 2013-11-14 10:32     ` Kuninori Morimoto
  -1 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-14 10:32 UTC (permalink / raw)
  To: Chris Ball; +Cc: Simon, Laurent, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

This patch updates r8a7779 DT data to have SoC specific settings.
Latest Renesas Chip has some SDHI channels and the WP pin
availability depends on its channel or HW implementation.
Thus, this patch disables it as default,
but we can use wp-gpios property to enable it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 arch/arm/boot/dts/r8a7779.dtsi    |    8 --------
 drivers/mmc/host/sh_mobile_sdhi.c |    2 +-
 2 files changed, 1 insertion(+), 9 deletions(-)

diff --git a/arch/arm/boot/dts/r8a7779.dtsi b/arch/arm/boot/dts/r8a7779.dtsi
index 05fd41c..084132e 100644
--- a/arch/arm/boot/dts/r8a7779.dtsi
+++ b/arch/arm/boot/dts/r8a7779.dtsi
@@ -212,8 +212,6 @@
 		reg = <0xffe4c000 0x100>;
 		interrupt-parent = <&gic>;
 		interrupts = <0 104 4>;
-		cap-sd-highspeed;
-		cap-sdio-irq;
 		status = "disabled";
 	};
 
@@ -222,8 +220,6 @@
 		reg = <0xffe4d000 0x100>;
 		interrupt-parent = <&gic>;
 		interrupts = <0 105 4>;
-		cap-sd-highspeed;
-		cap-sdio-irq;
 		status = "disabled";
 	};
 
@@ -232,8 +228,6 @@
 		reg = <0xffe4e000 0x100>;
 		interrupt-parent = <&gic>;
 		interrupts = <0 107 4>;
-		cap-sd-highspeed;
-		cap-sdio-irq;
 		status = "disabled";
 	};
 
@@ -242,8 +236,6 @@
 		reg = <0xffe4f000 0x100>;
 		interrupt-parent = <&gic>;
 		interrupts = <0 106 4>;
-		cap-sd-highspeed;
-		cap-sdio-irq;
 		status = "disabled";
 	};
 };
diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
index dc97027..9cffca1 100644
--- a/drivers/mmc/host/sh_mobile_sdhi.c
+++ b/drivers/mmc/host/sh_mobile_sdhi.c
@@ -58,7 +58,7 @@ static const struct of_device_id sh_mobile_sdhi_of_match[] = {
 	{ .compatible = "renesas,sdhi-r8a73a4", .data = &sh_mobile_sdhi_of_cfg[0], },
 	{ .compatible = "renesas,sdhi-r8a7740", .data = &sh_mobile_sdhi_of_cfg[0], },
 	{ .compatible = "renesas,sdhi-r8a7778", .data = &of_rcar_gen1_compatible, },
-	{ .compatible = "renesas,sdhi-r8a7779", .data = &sh_mobile_sdhi_of_cfg[0], },
+	{ .compatible = "renesas,sdhi-r8a7779", .data = &of_rcar_gen1_compatible, },
 	{ .compatible = "renesas,sdhi-r8a7790", .data = &sh_mobile_sdhi_of_cfg[0], },
 	{},
 };
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH 14/17] mmc: SDHI: updata sh_mobile_sdhi_of_data for r8a7779
@ 2013-11-14 10:32     ` Kuninori Morimoto
  0 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-14 10:32 UTC (permalink / raw)
  To: Chris Ball; +Cc: Simon, Laurent, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

This patch updates r8a7779 DT data to have SoC specific settings.
Latest Renesas Chip has some SDHI channels and the WP pin
availability depends on its channel or HW implementation.
Thus, this patch disables it as default,
but we can use wp-gpios property to enable it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 arch/arm/boot/dts/r8a7779.dtsi    |    8 --------
 drivers/mmc/host/sh_mobile_sdhi.c |    2 +-
 2 files changed, 1 insertion(+), 9 deletions(-)

diff --git a/arch/arm/boot/dts/r8a7779.dtsi b/arch/arm/boot/dts/r8a7779.dtsi
index 05fd41c..084132e 100644
--- a/arch/arm/boot/dts/r8a7779.dtsi
+++ b/arch/arm/boot/dts/r8a7779.dtsi
@@ -212,8 +212,6 @@
 		reg = <0xffe4c000 0x100>;
 		interrupt-parent = <&gic>;
 		interrupts = <0 104 4>;
-		cap-sd-highspeed;
-		cap-sdio-irq;
 		status = "disabled";
 	};
 
@@ -222,8 +220,6 @@
 		reg = <0xffe4d000 0x100>;
 		interrupt-parent = <&gic>;
 		interrupts = <0 105 4>;
-		cap-sd-highspeed;
-		cap-sdio-irq;
 		status = "disabled";
 	};
 
@@ -232,8 +228,6 @@
 		reg = <0xffe4e000 0x100>;
 		interrupt-parent = <&gic>;
 		interrupts = <0 107 4>;
-		cap-sd-highspeed;
-		cap-sdio-irq;
 		status = "disabled";
 	};
 
@@ -242,8 +236,6 @@
 		reg = <0xffe4f000 0x100>;
 		interrupt-parent = <&gic>;
 		interrupts = <0 106 4>;
-		cap-sd-highspeed;
-		cap-sdio-irq;
 		status = "disabled";
 	};
 };
diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
index dc97027..9cffca1 100644
--- a/drivers/mmc/host/sh_mobile_sdhi.c
+++ b/drivers/mmc/host/sh_mobile_sdhi.c
@@ -58,7 +58,7 @@ static const struct of_device_id sh_mobile_sdhi_of_match[] = {
 	{ .compatible = "renesas,sdhi-r8a73a4", .data = &sh_mobile_sdhi_of_cfg[0], },
 	{ .compatible = "renesas,sdhi-r8a7740", .data = &sh_mobile_sdhi_of_cfg[0], },
 	{ .compatible = "renesas,sdhi-r8a7778", .data = &of_rcar_gen1_compatible, },
-	{ .compatible = "renesas,sdhi-r8a7779", .data = &sh_mobile_sdhi_of_cfg[0], },
+	{ .compatible = "renesas,sdhi-r8a7779", .data = &of_rcar_gen1_compatible, },
 	{ .compatible = "renesas,sdhi-r8a7790", .data = &sh_mobile_sdhi_of_cfg[0], },
 	{},
 };
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH 15/17] mmc: SDHI: updata sh_mobile_sdhi_of_data for r8a7790
  2013-11-14 10:29   ` Kuninori Morimoto
@ 2013-11-14 10:32     ` Kuninori Morimoto
  -1 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-14 10:32 UTC (permalink / raw)
  To: Chris Ball; +Cc: Simon, Laurent, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

This patch updates r8a7790 DT data to have SoC specific settings.
Latest Renesas Chip has some SDHI channels and the WP pin
availability depends on its channel or HW implementation.
Thus, this patch disables it as default,
but we can use wp-gpios property to enable it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/mmc/host/sh_mobile_sdhi.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
index 9cffca1..62dcb54 100644
--- a/drivers/mmc/host/sh_mobile_sdhi.c
+++ b/drivers/mmc/host/sh_mobile_sdhi.c
@@ -38,6 +38,7 @@
 struct sh_mobile_sdhi_of_data {
 	unsigned long tmio_flags;
 	unsigned long capabilities;
+	unsigned long capabilities2;
 };
 
 static const struct sh_mobile_sdhi_of_data sh_mobile_sdhi_of_cfg[] = {
@@ -51,6 +52,12 @@ static const struct sh_mobile_sdhi_of_data of_rcar_gen1_compatible = {
 	.capabilities	= MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ,
 };
 
+static const struct sh_mobile_sdhi_of_data of_rcar_gen2_compatible = {
+	.tmio_flags	= TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_WRPROTECT_DISABLE,
+	.capabilities	= MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ,
+	.capabilities2	= MMC_CAP2_NO_MULTI_READ,
+};
+
 static const struct of_device_id sh_mobile_sdhi_of_match[] = {
 	{ .compatible = "renesas,sdhi-shmobile" },
 	{ .compatible = "renesas,sdhi-sh7372" },
@@ -59,7 +66,7 @@ static const struct of_device_id sh_mobile_sdhi_of_match[] = {
 	{ .compatible = "renesas,sdhi-r8a7740", .data = &sh_mobile_sdhi_of_cfg[0], },
 	{ .compatible = "renesas,sdhi-r8a7778", .data = &of_rcar_gen1_compatible, },
 	{ .compatible = "renesas,sdhi-r8a7779", .data = &of_rcar_gen1_compatible, },
-	{ .compatible = "renesas,sdhi-r8a7790", .data = &sh_mobile_sdhi_of_cfg[0], },
+	{ .compatible = "renesas,sdhi-r8a7790", .data = &of_rcar_gen2_compatible, },
 	{},
 };
 MODULE_DEVICE_TABLE(of, sh_mobile_sdhi_of_match);
@@ -219,6 +226,7 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
 		const struct sh_mobile_sdhi_of_data *of_data = of_id->data;
 		mmc_data->flags |= of_data->tmio_flags;
 		mmc_data->capabilities |= of_data->capabilities;
+		mmc_data->capabilities2 |= of_data->capabilities2;
 	}
 
 	/* SD control register space size is 0x100, 0x200 for bus_shift=1 */
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH 15/17] mmc: SDHI: updata sh_mobile_sdhi_of_data for r8a7790
@ 2013-11-14 10:32     ` Kuninori Morimoto
  0 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-14 10:32 UTC (permalink / raw)
  To: Chris Ball; +Cc: Simon, Laurent, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

This patch updates r8a7790 DT data to have SoC specific settings.
Latest Renesas Chip has some SDHI channels and the WP pin
availability depends on its channel or HW implementation.
Thus, this patch disables it as default,
but we can use wp-gpios property to enable it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/mmc/host/sh_mobile_sdhi.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
index 9cffca1..62dcb54 100644
--- a/drivers/mmc/host/sh_mobile_sdhi.c
+++ b/drivers/mmc/host/sh_mobile_sdhi.c
@@ -38,6 +38,7 @@
 struct sh_mobile_sdhi_of_data {
 	unsigned long tmio_flags;
 	unsigned long capabilities;
+	unsigned long capabilities2;
 };
 
 static const struct sh_mobile_sdhi_of_data sh_mobile_sdhi_of_cfg[] = {
@@ -51,6 +52,12 @@ static const struct sh_mobile_sdhi_of_data of_rcar_gen1_compatible = {
 	.capabilities	= MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ,
 };
 
+static const struct sh_mobile_sdhi_of_data of_rcar_gen2_compatible = {
+	.tmio_flags	= TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_WRPROTECT_DISABLE,
+	.capabilities	= MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ,
+	.capabilities2	= MMC_CAP2_NO_MULTI_READ,
+};
+
 static const struct of_device_id sh_mobile_sdhi_of_match[] = {
 	{ .compatible = "renesas,sdhi-shmobile" },
 	{ .compatible = "renesas,sdhi-sh7372" },
@@ -59,7 +66,7 @@ static const struct of_device_id sh_mobile_sdhi_of_match[] = {
 	{ .compatible = "renesas,sdhi-r8a7740", .data = &sh_mobile_sdhi_of_cfg[0], },
 	{ .compatible = "renesas,sdhi-r8a7778", .data = &of_rcar_gen1_compatible, },
 	{ .compatible = "renesas,sdhi-r8a7779", .data = &of_rcar_gen1_compatible, },
-	{ .compatible = "renesas,sdhi-r8a7790", .data = &sh_mobile_sdhi_of_cfg[0], },
+	{ .compatible = "renesas,sdhi-r8a7790", .data = &of_rcar_gen2_compatible, },
 	{},
 };
 MODULE_DEVICE_TABLE(of, sh_mobile_sdhi_of_match);
@@ -219,6 +226,7 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
 		const struct sh_mobile_sdhi_of_data *of_data = of_id->data;
 		mmc_data->flags |= of_data->tmio_flags;
 		mmc_data->capabilities |= of_data->capabilities;
+		mmc_data->capabilities2 |= of_data->capabilities2;
 	}
 
 	/* SD control register space size is 0x100, 0x200 for bus_shift=1 */
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 113+ messages in thread

* Re: [PATCH 0/16] ARM: shmobile: SDHI support for r8a7790
  2013-11-14 10:16 ` Kuninori Morimoto
@ 2013-11-14 10:34   ` Kuninori Morimoto
  -1 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-14 10:34 UTC (permalink / raw)
  To: Simon; +Cc: Laurent, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc


Hi Simon

These are SDHI support for r8a7790.

Kuninori Morimoto (14):
      ARM: shmobile: lager: add SDHI0/2 support
      ARM: shmobile: lager: use gpio/fixed regulator for SDHI

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 0/16] ARM: shmobile: SDHI support for r8a7790
@ 2013-11-14 10:34   ` Kuninori Morimoto
  0 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-14 10:34 UTC (permalink / raw)
  To: Simon; +Cc: Laurent, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc


Hi Simon

These are SDHI support for r8a7790.

Kuninori Morimoto (14):
      ARM: shmobile: lager: add SDHI0/2 support
      ARM: shmobile: lager: use gpio/fixed regulator for SDHI

^ permalink raw reply	[flat|nested] 113+ messages in thread

* [PATCH 16/17] ARM: shmobile: lager: add SDHI0/2 support
  2013-11-14 10:34   ` Kuninori Morimoto
@ 2013-11-14 10:34     ` Kuninori Morimoto
  -1 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-14 10:34 UTC (permalink / raw)
  To: Simon; +Cc: Laurent, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

SDHI0 (CN8) needs JP/SW settings

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 arch/arm/mach-shmobile/board-lager.c |   75 +++++++++++++++++++++++++++++++++-
 1 file changed, 74 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-shmobile/board-lager.c b/arch/arm/mach-shmobile/board-lager.c
index fcf06fd..2e529dc 100644
--- a/arch/arm/mach-shmobile/board-lager.c
+++ b/arch/arm/mach-shmobile/board-lager.c
@@ -24,8 +24,10 @@
 #include <linux/interrupt.h>
 #include <linux/kernel.h>
 #include <linux/leds.h>
+#include <linux/mfd/tmio.h>
 #include <linux/mmc/host.h>
 #include <linux/mmc/sh_mmcif.h>
+#include <linux/mmc/sh_mobile_sdhi.h>
 #include <linux/pinctrl/machine.h>
 #include <linux/platform_data/gpio-rcar.h>
 #include <linux/platform_data/rcar-du.h>
@@ -40,6 +42,19 @@
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 
+/*
+ * SDHI0 (CN8)
+ *
+ * JP3:  pin1
+ * SW20: pin1
+
+ * GP5_24:	1:  VDD  3.3V (defult)
+ *		0:  VDD  0.0V
+ * GP5_29:	1:  VccQ 3.3V (defult)
+ *		0:  VccQ 1.8V
+ *
+ */
+
 /* DU */
 static struct rcar_du_encoder_data lager_du_encoders[] = {
 	{
@@ -139,6 +154,10 @@ static const struct gpio_keys_platform_data lager_keys_pdata __initconst = {
 static struct regulator_consumer_supply fixed3v3_power_consumers[]  {
 	REGULATOR_SUPPLY("vmmc", "sh_mmcif.1"),
+	REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"),
+	REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.0"),
+	REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.2"),
+	REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.2"),
 };
 
 /* MMCIF */
@@ -166,6 +185,32 @@ static const struct resource ether_resources[] __initconst = {
 	DEFINE_RES_IRQ(gic_spi(162)),
 };
 
+/* SDHI0 */
+static struct sh_mobile_sdhi_info sdhi0_info __initdata = {
+	.tmio_caps	= MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ,
+	.tmio_caps2	= MMC_CAP2_NO_MULTI_READ,
+	.tmio_flags	= TMIO_MMC_HAS_IDLE_WAIT |
+			  TMIO_MMC_WRPROTECT_DISABLE,
+};
+
+static struct resource sdhi0_resources[] __initdata = {
+	DEFINE_RES_MEM(0xee100000, 0x200),
+	DEFINE_RES_IRQ(gic_spi(165)),
+};
+
+/* SDHI2 */
+static struct sh_mobile_sdhi_info sdhi2_info __initdata = {
+	.tmio_caps	= MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ,
+	.tmio_caps2	= MMC_CAP2_NO_MULTI_READ,
+	.tmio_flags	= TMIO_MMC_HAS_IDLE_WAIT |
+			  TMIO_MMC_WRPROTECT_DISABLE,
+};
+
+static struct resource sdhi2_resources[] __initdata = {
+	DEFINE_RES_MEM(0xee140000, 0x100),
+	DEFINE_RES_IRQ(gic_spi(167)),
+};
+
 static const struct pinctrl_map lager_pinctrl_map[] = {
 	/* DU (CN10: ARGB0, CN13: LVDS) */
 	PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7790", "pfc-r8a7790",
@@ -174,6 +219,22 @@ static const struct pinctrl_map lager_pinctrl_map[] = {
 				  "du_sync_1", "du"),
 	PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7790", "pfc-r8a7790",
 				  "du_clk_out_0", "du"),
+	/* SDHI */
+	PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7790",
+				  "sdhi0_data4", "sdhi0"),
+	PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7790",
+				  "sdhi0_ctrl", "sdhi0"),
+	PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7790",
+				  "sdhi0_cd", "sdhi0"),
+
+	/* SDHI2 */
+	PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.2", "pfc-r8a7790",
+				  "sdhi2_data4", "sdhi2"),
+	PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.2", "pfc-r8a7790",
+				  "sdhi2_ctrl", "sdhi2"),
+	PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.2", "pfc-r8a7790",
+				  "sdhi2_cd", "sdhi2"),
+
 	/* SCIF0 (CN19: DEBUG SERIAL0) */
 	PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.6", "pfc-r8a7790",
 				  "scif0_data", "scif0"),
@@ -223,7 +284,19 @@ static void __init lager_add_standard_devices(void)
 					  &ether_pdata, sizeof(ether_pdata));
 
 	lager_add_du_device();
-}
+
+	gpio_request_one(RCAR_GP_PIN(5, 24), GPIOF_OUT_INIT_HIGH, NULL); /* SD0 VDD  3.3V */
+	gpio_request_one(RCAR_GP_PIN(5, 25), GPIOF_OUT_INIT_HIGH, NULL); /* SD2 VDD  3.3V */
+	gpio_request_one(RCAR_GP_PIN(5, 29), GPIOF_OUT_INIT_HIGH, NULL); /* SD0 VccQ 3.3V */
+	gpio_request_one(RCAR_GP_PIN(5, 30), GPIOF_OUT_INIT_HIGH, NULL); /* SD2 VccQ 3.3V */
+	platform_device_register_resndata(&platform_bus, "sh_mobile_sdhi", 0,
+					  sdhi0_resources, ARRAY_SIZE(sdhi0_resources),
+					  &sdhi0_info, sizeof(struct sh_mobile_sdhi_info));
+	platform_device_register_resndata(&platform_bus, "sh_mobile_sdhi", 2,
+					  sdhi2_resources, ARRAY_SIZE(sdhi2_resources),
+					  &sdhi2_info, sizeof(struct sh_mobile_sdhi_info));
+
+};
 
 /*
  * Ether LEDs on the Lager board are named LINK and ACTIVE which corresponds
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH 16/17] ARM: shmobile: lager: add SDHI0/2 support
@ 2013-11-14 10:34     ` Kuninori Morimoto
  0 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-14 10:34 UTC (permalink / raw)
  To: Simon; +Cc: Laurent, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

SDHI0 (CN8) needs JP/SW settings

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 arch/arm/mach-shmobile/board-lager.c |   75 +++++++++++++++++++++++++++++++++-
 1 file changed, 74 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-shmobile/board-lager.c b/arch/arm/mach-shmobile/board-lager.c
index fcf06fd..2e529dc 100644
--- a/arch/arm/mach-shmobile/board-lager.c
+++ b/arch/arm/mach-shmobile/board-lager.c
@@ -24,8 +24,10 @@
 #include <linux/interrupt.h>
 #include <linux/kernel.h>
 #include <linux/leds.h>
+#include <linux/mfd/tmio.h>
 #include <linux/mmc/host.h>
 #include <linux/mmc/sh_mmcif.h>
+#include <linux/mmc/sh_mobile_sdhi.h>
 #include <linux/pinctrl/machine.h>
 #include <linux/platform_data/gpio-rcar.h>
 #include <linux/platform_data/rcar-du.h>
@@ -40,6 +42,19 @@
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 
+/*
+ * SDHI0 (CN8)
+ *
+ * JP3:  pin1
+ * SW20: pin1
+
+ * GP5_24:	1:  VDD  3.3V (defult)
+ *		0:  VDD  0.0V
+ * GP5_29:	1:  VccQ 3.3V (defult)
+ *		0:  VccQ 1.8V
+ *
+ */
+
 /* DU */
 static struct rcar_du_encoder_data lager_du_encoders[] = {
 	{
@@ -139,6 +154,10 @@ static const struct gpio_keys_platform_data lager_keys_pdata __initconst = {
 static struct regulator_consumer_supply fixed3v3_power_consumers[] =
 {
 	REGULATOR_SUPPLY("vmmc", "sh_mmcif.1"),
+	REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"),
+	REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.0"),
+	REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.2"),
+	REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.2"),
 };
 
 /* MMCIF */
@@ -166,6 +185,32 @@ static const struct resource ether_resources[] __initconst = {
 	DEFINE_RES_IRQ(gic_spi(162)),
 };
 
+/* SDHI0 */
+static struct sh_mobile_sdhi_info sdhi0_info __initdata = {
+	.tmio_caps	= MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ,
+	.tmio_caps2	= MMC_CAP2_NO_MULTI_READ,
+	.tmio_flags	= TMIO_MMC_HAS_IDLE_WAIT |
+			  TMIO_MMC_WRPROTECT_DISABLE,
+};
+
+static struct resource sdhi0_resources[] __initdata = {
+	DEFINE_RES_MEM(0xee100000, 0x200),
+	DEFINE_RES_IRQ(gic_spi(165)),
+};
+
+/* SDHI2 */
+static struct sh_mobile_sdhi_info sdhi2_info __initdata = {
+	.tmio_caps	= MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ,
+	.tmio_caps2	= MMC_CAP2_NO_MULTI_READ,
+	.tmio_flags	= TMIO_MMC_HAS_IDLE_WAIT |
+			  TMIO_MMC_WRPROTECT_DISABLE,
+};
+
+static struct resource sdhi2_resources[] __initdata = {
+	DEFINE_RES_MEM(0xee140000, 0x100),
+	DEFINE_RES_IRQ(gic_spi(167)),
+};
+
 static const struct pinctrl_map lager_pinctrl_map[] = {
 	/* DU (CN10: ARGB0, CN13: LVDS) */
 	PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7790", "pfc-r8a7790",
@@ -174,6 +219,22 @@ static const struct pinctrl_map lager_pinctrl_map[] = {
 				  "du_sync_1", "du"),
 	PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7790", "pfc-r8a7790",
 				  "du_clk_out_0", "du"),
+	/* SDHI */
+	PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7790",
+				  "sdhi0_data4", "sdhi0"),
+	PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7790",
+				  "sdhi0_ctrl", "sdhi0"),
+	PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7790",
+				  "sdhi0_cd", "sdhi0"),
+
+	/* SDHI2 */
+	PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.2", "pfc-r8a7790",
+				  "sdhi2_data4", "sdhi2"),
+	PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.2", "pfc-r8a7790",
+				  "sdhi2_ctrl", "sdhi2"),
+	PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.2", "pfc-r8a7790",
+				  "sdhi2_cd", "sdhi2"),
+
 	/* SCIF0 (CN19: DEBUG SERIAL0) */
 	PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.6", "pfc-r8a7790",
 				  "scif0_data", "scif0"),
@@ -223,7 +284,19 @@ static void __init lager_add_standard_devices(void)
 					  &ether_pdata, sizeof(ether_pdata));
 
 	lager_add_du_device();
-}
+
+	gpio_request_one(RCAR_GP_PIN(5, 24), GPIOF_OUT_INIT_HIGH, NULL); /* SD0 VDD  3.3V */
+	gpio_request_one(RCAR_GP_PIN(5, 25), GPIOF_OUT_INIT_HIGH, NULL); /* SD2 VDD  3.3V */
+	gpio_request_one(RCAR_GP_PIN(5, 29), GPIOF_OUT_INIT_HIGH, NULL); /* SD0 VccQ 3.3V */
+	gpio_request_one(RCAR_GP_PIN(5, 30), GPIOF_OUT_INIT_HIGH, NULL); /* SD2 VccQ 3.3V */
+	platform_device_register_resndata(&platform_bus, "sh_mobile_sdhi", 0,
+					  sdhi0_resources, ARRAY_SIZE(sdhi0_resources),
+					  &sdhi0_info, sizeof(struct sh_mobile_sdhi_info));
+	platform_device_register_resndata(&platform_bus, "sh_mobile_sdhi", 2,
+					  sdhi2_resources, ARRAY_SIZE(sdhi2_resources),
+					  &sdhi2_info, sizeof(struct sh_mobile_sdhi_info));
+
+};
 
 /*
  * Ether LEDs on the Lager board are named LINK and ACTIVE which corresponds
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH 17/17] ARM: shmobile: lager: use gpio/fixed regulator for SDHI
  2013-11-14 10:34   ` Kuninori Morimoto
@ 2013-11-14 10:35     ` Kuninori Morimoto
  -1 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-14 10:35 UTC (permalink / raw)
  To: Simon; +Cc: Laurent, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

SDHI0/2 Vcc/Vccq can use gpio/fixed regulator driver

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 arch/arm/mach-shmobile/board-lager.c |   89 +++++++++++++++++++++++++++++-----
 1 file changed, 78 insertions(+), 11 deletions(-)

diff --git a/arch/arm/mach-shmobile/board-lager.c b/arch/arm/mach-shmobile/board-lager.c
index 2e529dc..7c77521 100644
--- a/arch/arm/mach-shmobile/board-lager.c
+++ b/arch/arm/mach-shmobile/board-lager.c
@@ -33,7 +33,9 @@
 #include <linux/platform_data/rcar-du.h>
 #include <linux/platform_device.h>
 #include <linux/phy.h>
+#include <linux/regulator/driver.h>
 #include <linux/regulator/fixed.h>
+#include <linux/regulator/gpio-regulator.h>
 #include <linux/regulator/machine.h>
 #include <linux/sh_eth.h>
 #include <mach/common.h>
@@ -154,10 +156,6 @@ static const struct gpio_keys_platform_data lager_keys_pdata __initconst = {
 static struct regulator_consumer_supply fixed3v3_power_consumers[]  {
 	REGULATOR_SUPPLY("vmmc", "sh_mmcif.1"),
-	REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"),
-	REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.0"),
-	REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.2"),
-	REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.2"),
 };
 
 /* MMCIF */
@@ -185,9 +183,67 @@ static const struct resource ether_resources[] __initconst = {
 	DEFINE_RES_IRQ(gic_spi(162)),
 };
 
+/* SDHI regulator macro */
+#define SDHI_REGULATOR(idx, vdd_pin, vccq_pin)				\
+static struct regulator_consumer_supply vcc_sdhi##idx##_consumer =	\
+	REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi." #idx);		\
+									\
+static struct regulator_init_data vcc_sdhi##idx##_init_data = {		\
+	.constraints = {						\
+		.valid_ops_mask = REGULATOR_CHANGE_STATUS,		\
+	},								\
+	.consumer_supplies	= &vcc_sdhi##idx##_consumer,		\
+	.num_consumer_supplies	= 1,					\
+};									\
+									\
+static struct fixed_voltage_config vcc_sdhi##idx##_info = {		\
+	.supply_name	= "SDHI" #idx "Vcc",				\
+	.microvolts	= 3300000,					\
+	.gpio		= vdd_pin,					\
+	.enable_high	= 1,						\
+	.init_data	= &vcc_sdhi##idx##_init_data,			\
+};									\
+									\
+static struct regulator_consumer_supply vccq_sdhi##idx##_consumer=	\
+	REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi." #idx);		\
+									\
+static struct regulator_init_data vccq_sdhi##idx##_init_data = {	\
+	.constraints = {						\
+		.input_uV	= 3300000,				\
+		.min_uV		= 1800000,				\
+		.max_uV		= 3300000,				\
+		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |		\
+				  REGULATOR_CHANGE_STATUS,		\
+	},								\
+	.consumer_supplies	= &vccq_sdhi##idx##_consumer,		\
+	.num_consumer_supplies	= 1,					\
+};									\
+									\
+static struct gpio vccq_sdhi##idx##_gpio =				\
+	{ vccq_pin, GPIOF_OUT_INIT_HIGH, "vccq-sdhi" #idx };		\
+									\
+static struct gpio_regulator_state vccq_sdhi##idx##_states[] = {	\
+	{ .value = 1800000, .gpios = 0 },				\
+	{ .value = 3300000, .gpios = 1 },				\
+};									\
+									\
+static struct gpio_regulator_config vccq_sdhi##idx##_info = {		\
+	.supply_name	= "vqmmc",					\
+	.gpios		= &vccq_sdhi##idx##_gpio,			\
+	.nr_gpios	= 1,						\
+	.states		= vccq_sdhi##idx##_states,			\
+	.nr_states	= ARRAY_SIZE(vccq_sdhi##idx##_states),		\
+	.type		= REGULATOR_VOLTAGE,				\
+	.init_data	= &vccq_sdhi##idx##_init_data,			\
+};
+
+SDHI_REGULATOR(0, RCAR_GP_PIN(5, 24), RCAR_GP_PIN(5, 29));
+SDHI_REGULATOR(2, RCAR_GP_PIN(5, 25), RCAR_GP_PIN(5, 30));
+
 /* SDHI0 */
 static struct sh_mobile_sdhi_info sdhi0_info __initdata = {
-	.tmio_caps	= MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ,
+	.tmio_caps	= MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
+			  MMC_CAP_POWER_OFF_CARD,
 	.tmio_caps2	= MMC_CAP2_NO_MULTI_READ,
 	.tmio_flags	= TMIO_MMC_HAS_IDLE_WAIT |
 			  TMIO_MMC_WRPROTECT_DISABLE,
@@ -200,7 +256,8 @@ static struct resource sdhi0_resources[] __initdata = {
 
 /* SDHI2 */
 static struct sh_mobile_sdhi_info sdhi2_info __initdata = {
-	.tmio_caps	= MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ,
+	.tmio_caps	= MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
+			  MMC_CAP_POWER_OFF_CARD,
 	.tmio_caps2	= MMC_CAP2_NO_MULTI_READ,
 	.tmio_flags	= TMIO_MMC_HAS_IDLE_WAIT |
 			  TMIO_MMC_WRPROTECT_DISABLE,
@@ -259,6 +316,9 @@ static const struct pinctrl_map lager_pinctrl_map[] = {
 
 static void __init lager_add_standard_devices(void)
 {
+	int fixed_regulator_idx = 0;
+	int gpio_regulator_idx = 0;
+
 	r8a7790_clock_init();
 
 	pinctrl_register_mappings(lager_pinctrl_map,
@@ -272,7 +332,8 @@ static void __init lager_add_standard_devices(void)
 	platform_device_register_data(&platform_bus, "gpio-keys", -1,
 				      &lager_keys_pdata,
 				      sizeof(lager_keys_pdata));
-	regulator_register_always_on(0, "fixed-3.3V", fixed3v3_power_consumers,
+	regulator_register_always_on(fixed_regulator_idx++,
+				     "fixed-3.3V", fixed3v3_power_consumers,
 				     ARRAY_SIZE(fixed3v3_power_consumers), 3300000);
 	platform_device_register_resndata(&platform_bus, "sh_mmcif", 1,
 					  mmcif1_resources, ARRAY_SIZE(mmcif1_resources),
@@ -285,10 +346,16 @@ static void __init lager_add_standard_devices(void)
 
 	lager_add_du_device();
 
-	gpio_request_one(RCAR_GP_PIN(5, 24), GPIOF_OUT_INIT_HIGH, NULL); /* SD0 VDD  3.3V */
-	gpio_request_one(RCAR_GP_PIN(5, 25), GPIOF_OUT_INIT_HIGH, NULL); /* SD2 VDD  3.3V */
-	gpio_request_one(RCAR_GP_PIN(5, 29), GPIOF_OUT_INIT_HIGH, NULL); /* SD0 VccQ 3.3V */
-	gpio_request_one(RCAR_GP_PIN(5, 30), GPIOF_OUT_INIT_HIGH, NULL); /* SD2 VccQ 3.3V */
+	platform_device_register_data(&platform_bus, "reg-fixed-voltage", fixed_regulator_idx++,
+				      &vcc_sdhi0_info, sizeof(struct fixed_voltage_config));
+	platform_device_register_data(&platform_bus, "reg-fixed-voltage", fixed_regulator_idx++,
+				      &vcc_sdhi2_info, sizeof(struct fixed_voltage_config));
+
+	platform_device_register_data(&platform_bus, "gpio-regulator", gpio_regulator_idx++,
+				      &vccq_sdhi0_info, sizeof(struct gpio_regulator_config));
+	platform_device_register_data(&platform_bus, "gpio-regulator", gpio_regulator_idx++,
+				      &vccq_sdhi2_info, sizeof(struct gpio_regulator_config));
+
 	platform_device_register_resndata(&platform_bus, "sh_mobile_sdhi", 0,
 					  sdhi0_resources, ARRAY_SIZE(sdhi0_resources),
 					  &sdhi0_info, sizeof(struct sh_mobile_sdhi_info));
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH 17/17] ARM: shmobile: lager: use gpio/fixed regulator for SDHI
@ 2013-11-14 10:35     ` Kuninori Morimoto
  0 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-14 10:35 UTC (permalink / raw)
  To: Simon; +Cc: Laurent, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

SDHI0/2 Vcc/Vccq can use gpio/fixed regulator driver

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 arch/arm/mach-shmobile/board-lager.c |   89 +++++++++++++++++++++++++++++-----
 1 file changed, 78 insertions(+), 11 deletions(-)

diff --git a/arch/arm/mach-shmobile/board-lager.c b/arch/arm/mach-shmobile/board-lager.c
index 2e529dc..7c77521 100644
--- a/arch/arm/mach-shmobile/board-lager.c
+++ b/arch/arm/mach-shmobile/board-lager.c
@@ -33,7 +33,9 @@
 #include <linux/platform_data/rcar-du.h>
 #include <linux/platform_device.h>
 #include <linux/phy.h>
+#include <linux/regulator/driver.h>
 #include <linux/regulator/fixed.h>
+#include <linux/regulator/gpio-regulator.h>
 #include <linux/regulator/machine.h>
 #include <linux/sh_eth.h>
 #include <mach/common.h>
@@ -154,10 +156,6 @@ static const struct gpio_keys_platform_data lager_keys_pdata __initconst = {
 static struct regulator_consumer_supply fixed3v3_power_consumers[] =
 {
 	REGULATOR_SUPPLY("vmmc", "sh_mmcif.1"),
-	REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"),
-	REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.0"),
-	REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.2"),
-	REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.2"),
 };
 
 /* MMCIF */
@@ -185,9 +183,67 @@ static const struct resource ether_resources[] __initconst = {
 	DEFINE_RES_IRQ(gic_spi(162)),
 };
 
+/* SDHI regulator macro */
+#define SDHI_REGULATOR(idx, vdd_pin, vccq_pin)				\
+static struct regulator_consumer_supply vcc_sdhi##idx##_consumer =	\
+	REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi." #idx);		\
+									\
+static struct regulator_init_data vcc_sdhi##idx##_init_data = {		\
+	.constraints = {						\
+		.valid_ops_mask = REGULATOR_CHANGE_STATUS,		\
+	},								\
+	.consumer_supplies	= &vcc_sdhi##idx##_consumer,		\
+	.num_consumer_supplies	= 1,					\
+};									\
+									\
+static struct fixed_voltage_config vcc_sdhi##idx##_info = {		\
+	.supply_name	= "SDHI" #idx "Vcc",				\
+	.microvolts	= 3300000,					\
+	.gpio		= vdd_pin,					\
+	.enable_high	= 1,						\
+	.init_data	= &vcc_sdhi##idx##_init_data,			\
+};									\
+									\
+static struct regulator_consumer_supply vccq_sdhi##idx##_consumer=	\
+	REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi." #idx);		\
+									\
+static struct regulator_init_data vccq_sdhi##idx##_init_data = {	\
+	.constraints = {						\
+		.input_uV	= 3300000,				\
+		.min_uV		= 1800000,				\
+		.max_uV		= 3300000,				\
+		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |		\
+				  REGULATOR_CHANGE_STATUS,		\
+	},								\
+	.consumer_supplies	= &vccq_sdhi##idx##_consumer,		\
+	.num_consumer_supplies	= 1,					\
+};									\
+									\
+static struct gpio vccq_sdhi##idx##_gpio =				\
+	{ vccq_pin, GPIOF_OUT_INIT_HIGH, "vccq-sdhi" #idx };		\
+									\
+static struct gpio_regulator_state vccq_sdhi##idx##_states[] = {	\
+	{ .value = 1800000, .gpios = 0 },				\
+	{ .value = 3300000, .gpios = 1 },				\
+};									\
+									\
+static struct gpio_regulator_config vccq_sdhi##idx##_info = {		\
+	.supply_name	= "vqmmc",					\
+	.gpios		= &vccq_sdhi##idx##_gpio,			\
+	.nr_gpios	= 1,						\
+	.states		= vccq_sdhi##idx##_states,			\
+	.nr_states	= ARRAY_SIZE(vccq_sdhi##idx##_states),		\
+	.type		= REGULATOR_VOLTAGE,				\
+	.init_data	= &vccq_sdhi##idx##_init_data,			\
+};
+
+SDHI_REGULATOR(0, RCAR_GP_PIN(5, 24), RCAR_GP_PIN(5, 29));
+SDHI_REGULATOR(2, RCAR_GP_PIN(5, 25), RCAR_GP_PIN(5, 30));
+
 /* SDHI0 */
 static struct sh_mobile_sdhi_info sdhi0_info __initdata = {
-	.tmio_caps	= MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ,
+	.tmio_caps	= MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
+			  MMC_CAP_POWER_OFF_CARD,
 	.tmio_caps2	= MMC_CAP2_NO_MULTI_READ,
 	.tmio_flags	= TMIO_MMC_HAS_IDLE_WAIT |
 			  TMIO_MMC_WRPROTECT_DISABLE,
@@ -200,7 +256,8 @@ static struct resource sdhi0_resources[] __initdata = {
 
 /* SDHI2 */
 static struct sh_mobile_sdhi_info sdhi2_info __initdata = {
-	.tmio_caps	= MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ,
+	.tmio_caps	= MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
+			  MMC_CAP_POWER_OFF_CARD,
 	.tmio_caps2	= MMC_CAP2_NO_MULTI_READ,
 	.tmio_flags	= TMIO_MMC_HAS_IDLE_WAIT |
 			  TMIO_MMC_WRPROTECT_DISABLE,
@@ -259,6 +316,9 @@ static const struct pinctrl_map lager_pinctrl_map[] = {
 
 static void __init lager_add_standard_devices(void)
 {
+	int fixed_regulator_idx = 0;
+	int gpio_regulator_idx = 0;
+
 	r8a7790_clock_init();
 
 	pinctrl_register_mappings(lager_pinctrl_map,
@@ -272,7 +332,8 @@ static void __init lager_add_standard_devices(void)
 	platform_device_register_data(&platform_bus, "gpio-keys", -1,
 				      &lager_keys_pdata,
 				      sizeof(lager_keys_pdata));
-	regulator_register_always_on(0, "fixed-3.3V", fixed3v3_power_consumers,
+	regulator_register_always_on(fixed_regulator_idx++,
+				     "fixed-3.3V", fixed3v3_power_consumers,
 				     ARRAY_SIZE(fixed3v3_power_consumers), 3300000);
 	platform_device_register_resndata(&platform_bus, "sh_mmcif", 1,
 					  mmcif1_resources, ARRAY_SIZE(mmcif1_resources),
@@ -285,10 +346,16 @@ static void __init lager_add_standard_devices(void)
 
 	lager_add_du_device();
 
-	gpio_request_one(RCAR_GP_PIN(5, 24), GPIOF_OUT_INIT_HIGH, NULL); /* SD0 VDD  3.3V */
-	gpio_request_one(RCAR_GP_PIN(5, 25), GPIOF_OUT_INIT_HIGH, NULL); /* SD2 VDD  3.3V */
-	gpio_request_one(RCAR_GP_PIN(5, 29), GPIOF_OUT_INIT_HIGH, NULL); /* SD0 VccQ 3.3V */
-	gpio_request_one(RCAR_GP_PIN(5, 30), GPIOF_OUT_INIT_HIGH, NULL); /* SD2 VccQ 3.3V */
+	platform_device_register_data(&platform_bus, "reg-fixed-voltage", fixed_regulator_idx++,
+				      &vcc_sdhi0_info, sizeof(struct fixed_voltage_config));
+	platform_device_register_data(&platform_bus, "reg-fixed-voltage", fixed_regulator_idx++,
+				      &vcc_sdhi2_info, sizeof(struct fixed_voltage_config));
+
+	platform_device_register_data(&platform_bus, "gpio-regulator", gpio_regulator_idx++,
+				      &vccq_sdhi0_info, sizeof(struct gpio_regulator_config));
+	platform_device_register_data(&platform_bus, "gpio-regulator", gpio_regulator_idx++,
+				      &vccq_sdhi2_info, sizeof(struct gpio_regulator_config));
+
 	platform_device_register_resndata(&platform_bus, "sh_mobile_sdhi", 0,
 					  sdhi0_resources, ARRAY_SIZE(sdhi0_resources),
 					  &sdhi0_info, sizeof(struct sh_mobile_sdhi_info));
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 113+ messages in thread

* Re: [PATCH 03/17] mmc: tmio: Fix odd size access
  2013-11-14 10:23     ` Kuninori Morimoto
@ 2013-11-14 13:32       ` Laurent Pinchart
  -1 siblings, 0 replies; 113+ messages in thread
From: Laurent Pinchart @ 2013-11-14 13:32 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Chris Ball, Simon, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

Hi Morimoto-san,

Thank you for the patch.

On Thursday 14 November 2013 02:23:23 Kuninori Morimoto wrote:
> From: Shinobu Uehara <shinobu.uehara.xc@renesas.com>
> 
> Current sd_ctrl_read/write16_rep() doesn't care odd size
> 
> Signed-off-by: Shinobu Uehara <shinobu.uehara.xc@renesas.com>
> Signed-off-by: Ryo Kataoka <ryo.kataoka.wt@renesas.com>
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
>  drivers/mmc/host/tmio_mmc_pio.c |    6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mmc/host/tmio_mmc_pio.c
> b/drivers/mmc/host/tmio_mmc_pio.c index b380225..05ae15c 100644
> --- a/drivers/mmc/host/tmio_mmc_pio.c
> +++ b/drivers/mmc/host/tmio_mmc_pio.c
> @@ -386,9 +386,11 @@ static void tmio_mmc_pio_irq(struct tmio_mmc_host
> *host)
> 
>  	/* Transfer the data */
>  	if (data->flags & MMC_DATA_READ)
> -		sd_ctrl_read16_rep(host, CTL_SD_DATA_PORT, buf, count >> 1);
> +		sd_ctrl_read16_rep(host,
> +			CTL_SD_DATA_PORT, buf, (count + 1) >> 1);
>  	else
> -		sd_ctrl_write16_rep(host, CTL_SD_DATA_PORT, buf, count >> 1);
> +		sd_ctrl_write16_rep(host,
> +			CTL_SD_DATA_PORT, buf, (count + 1) >> 1);

This means that the hardware will transfer one more byte than the requested 
value. Have you verified that the buffer will always have room for that extra 
byte (when reading from the hardware), and that the extra byte will not have 
any side effect (when writing to the hardware) ? I'm also a bit surprised, do 
upper layers transfer data to/from the card using odd number of bytes ?

>  	host->sg_off += count;
-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 03/17] mmc: tmio: Fix odd size access
@ 2013-11-14 13:32       ` Laurent Pinchart
  0 siblings, 0 replies; 113+ messages in thread
From: Laurent Pinchart @ 2013-11-14 13:32 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Chris Ball, Simon, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

Hi Morimoto-san,

Thank you for the patch.

On Thursday 14 November 2013 02:23:23 Kuninori Morimoto wrote:
> From: Shinobu Uehara <shinobu.uehara.xc@renesas.com>
> 
> Current sd_ctrl_read/write16_rep() doesn't care odd size
> 
> Signed-off-by: Shinobu Uehara <shinobu.uehara.xc@renesas.com>
> Signed-off-by: Ryo Kataoka <ryo.kataoka.wt@renesas.com>
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
>  drivers/mmc/host/tmio_mmc_pio.c |    6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mmc/host/tmio_mmc_pio.c
> b/drivers/mmc/host/tmio_mmc_pio.c index b380225..05ae15c 100644
> --- a/drivers/mmc/host/tmio_mmc_pio.c
> +++ b/drivers/mmc/host/tmio_mmc_pio.c
> @@ -386,9 +386,11 @@ static void tmio_mmc_pio_irq(struct tmio_mmc_host
> *host)
> 
>  	/* Transfer the data */
>  	if (data->flags & MMC_DATA_READ)
> -		sd_ctrl_read16_rep(host, CTL_SD_DATA_PORT, buf, count >> 1);
> +		sd_ctrl_read16_rep(host,
> +			CTL_SD_DATA_PORT, buf, (count + 1) >> 1);
>  	else
> -		sd_ctrl_write16_rep(host, CTL_SD_DATA_PORT, buf, count >> 1);
> +		sd_ctrl_write16_rep(host,
> +			CTL_SD_DATA_PORT, buf, (count + 1) >> 1);

This means that the hardware will transfer one more byte than the requested 
value. Have you verified that the buffer will always have room for that extra 
byte (when reading from the hardware), and that the extra byte will not have 
any side effect (when writing to the hardware) ? I'm also a bit surprised, do 
upper layers transfer data to/from the card using odd number of bytes ?

>  	host->sg_off += count;
-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 04/17] mmc: tmio: Add error IRQ status clear
  2013-11-14 10:24     ` Kuninori Morimoto
@ 2013-11-14 13:34       ` Laurent Pinchart
  -1 siblings, 0 replies; 113+ messages in thread
From: Laurent Pinchart @ 2013-11-14 13:34 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Chris Ball, Simon, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

Hi Morimoto-san,

Thank you for the patch.

On Thursday 14 November 2013 02:24:37 Kuninori Morimoto wrote:
> From: Shinobu Uehara <shinobu.uehara.xc@renesas.com>
> 
> After a card is ejected during card access,
> the re-inserted card does not identified.
> It can be identified by clearing error IRQ status.
> 
> Signed-off-by: Shinobu Uehara <shinobu.uehara.xc@renesas.com>
> Signed-off-by: Ryo Kataoka <ryo.kataoka.wt@renesas.com>
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
>  drivers/mmc/host/tmio_mmc_pio.c |    3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/mmc/host/tmio_mmc_pio.c
> b/drivers/mmc/host/tmio_mmc_pio.c index 05ae15c..99f6d29 100644
> --- a/drivers/mmc/host/tmio_mmc_pio.c
> +++ b/drivers/mmc/host/tmio_mmc_pio.c
> @@ -565,6 +565,9 @@ static void tmio_mmc_card_irq_status(struct
> tmio_mmc_host *host,
> 
>  	pr_debug_status(*status);
>  	pr_debug_status(*ireg);
> +
> +	/* Clear the status except the interrupt status */
> +	sd_ctrl_write32(host, CTL_STATUS, TMIO_MASK_IRQ);

You should write *status, not TMIO_MASK_IRQ, or you could loose an interrupt 
if it gets triggered between the status read and status write.

>  }
> 
>  static bool __tmio_mmc_card_detect_irq(struct tmio_mmc_host *host,
-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 04/17] mmc: tmio: Add error IRQ status clear
@ 2013-11-14 13:34       ` Laurent Pinchart
  0 siblings, 0 replies; 113+ messages in thread
From: Laurent Pinchart @ 2013-11-14 13:34 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Chris Ball, Simon, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

Hi Morimoto-san,

Thank you for the patch.

On Thursday 14 November 2013 02:24:37 Kuninori Morimoto wrote:
> From: Shinobu Uehara <shinobu.uehara.xc@renesas.com>
> 
> After a card is ejected during card access,
> the re-inserted card does not identified.
> It can be identified by clearing error IRQ status.
> 
> Signed-off-by: Shinobu Uehara <shinobu.uehara.xc@renesas.com>
> Signed-off-by: Ryo Kataoka <ryo.kataoka.wt@renesas.com>
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
>  drivers/mmc/host/tmio_mmc_pio.c |    3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/mmc/host/tmio_mmc_pio.c
> b/drivers/mmc/host/tmio_mmc_pio.c index 05ae15c..99f6d29 100644
> --- a/drivers/mmc/host/tmio_mmc_pio.c
> +++ b/drivers/mmc/host/tmio_mmc_pio.c
> @@ -565,6 +565,9 @@ static void tmio_mmc_card_irq_status(struct
> tmio_mmc_host *host,
> 
>  	pr_debug_status(*status);
>  	pr_debug_status(*ireg);
> +
> +	/* Clear the status except the interrupt status */
> +	sd_ctrl_write32(host, CTL_STATUS, TMIO_MASK_IRQ);

You should write *status, not TMIO_MASK_IRQ, or you could loose an interrupt 
if it gets triggered between the status read and status write.

>  }
> 
>  static bool __tmio_mmc_card_detect_irq(struct tmio_mmc_host *host,
-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 05/17] mmc: tmio: don't overwrite caps2
  2013-11-14 10:24     ` Kuninori Morimoto
@ 2013-11-14 13:36       ` Laurent Pinchart
  -1 siblings, 0 replies; 113+ messages in thread
From: Laurent Pinchart @ 2013-11-14 13:36 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Chris Ball, Simon, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

Hi Morimoto-san,

Thank you for the patch.

On Thursday 14 November 2013 02:24:58 Kuninori Morimoto wrote:
> 02cb3221d5bb351ad9f7469453dcca7594a0fabf
> (mmc: tmio: support caps2 flags) added caps2 support
> on tmio, but it overwrites mmc_of_parse() settings.
> This patch fixes it up
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  drivers/mmc/host/tmio_mmc_pio.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/host/tmio_mmc_pio.c
> b/drivers/mmc/host/tmio_mmc_pio.c index 99f6d29..1f5f2ba 100644
> --- a/drivers/mmc/host/tmio_mmc_pio.c
> +++ b/drivers/mmc/host/tmio_mmc_pio.c
> @@ -1021,7 +1021,7 @@ int tmio_mmc_host_probe(struct tmio_mmc_host **host,
> 
>  	mmc->ops = &tmio_mmc_ops;
>  	mmc->caps |= MMC_CAP_4_BIT_DATA | pdata->capabilities;
> -	mmc->caps2 = pdata->capabilities2;
> +	mmc->caps2 |= pdata->capabilities2;
>  	mmc->max_segs = 32;
>  	mmc->max_blk_size = 512;
>  	mmc->max_blk_count = (PAGE_CACHE_SIZE / mmc->max_blk_size) *
-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 05/17] mmc: tmio: don't overwrite caps2
@ 2013-11-14 13:36       ` Laurent Pinchart
  0 siblings, 0 replies; 113+ messages in thread
From: Laurent Pinchart @ 2013-11-14 13:36 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Chris Ball, Simon, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

Hi Morimoto-san,

Thank you for the patch.

On Thursday 14 November 2013 02:24:58 Kuninori Morimoto wrote:
> 02cb3221d5bb351ad9f7469453dcca7594a0fabf
> (mmc: tmio: support caps2 flags) added caps2 support
> on tmio, but it overwrites mmc_of_parse() settings.
> This patch fixes it up
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  drivers/mmc/host/tmio_mmc_pio.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/host/tmio_mmc_pio.c
> b/drivers/mmc/host/tmio_mmc_pio.c index 99f6d29..1f5f2ba 100644
> --- a/drivers/mmc/host/tmio_mmc_pio.c
> +++ b/drivers/mmc/host/tmio_mmc_pio.c
> @@ -1021,7 +1021,7 @@ int tmio_mmc_host_probe(struct tmio_mmc_host **host,
> 
>  	mmc->ops = &tmio_mmc_ops;
>  	mmc->caps |= MMC_CAP_4_BIT_DATA | pdata->capabilities;
> -	mmc->caps2 = pdata->capabilities2;
> +	mmc->caps2 |= pdata->capabilities2;
>  	mmc->max_segs = 32;
>  	mmc->max_blk_size = 512;
>  	mmc->max_blk_count = (PAGE_CACHE_SIZE / mmc->max_blk_size) *
-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 06/17] ARM: shmobile: marzen: remove SDHI0 WP pin setting from DTS
  2013-11-14 10:27     ` Kuninori Morimoto
@ 2013-11-14 13:38       ` Laurent Pinchart
  -1 siblings, 0 replies; 113+ messages in thread
From: Laurent Pinchart @ 2013-11-14 13:38 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Simon, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

Hi Morimoto-san,

Thank you for the patch.

On Thursday 14 November 2013 02:27:16 Kuninori Morimoto wrote:
> WP pin is not implemented on Marzen
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  arch/arm/boot/dts/r8a7779-marzen-reference.dts |    3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/r8a7779-marzen-reference.dts
> b/arch/arm/boot/dts/r8a7779-marzen-reference.dts index ce3fe9e..cd063cd
> 100644
> --- a/arch/arm/boot/dts/r8a7779-marzen-reference.dts
> +++ b/arch/arm/boot/dts/r8a7779-marzen-reference.dts
> @@ -93,8 +93,7 @@
>  	};
> 
>  	sdhi0_pins: sd0 {
> -		renesas,groups = "sdhi0_data4", "sdhi0_ctrl", "sdhi0_cd",
> -				 "sdhi0_wp";
> +		renesas,groups = "sdhi0_data4", "sdhi0_ctrl", "sdhi0_cd";
>  		renesas,function = "sdhi0";
>  	};
>  };
-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 06/17] ARM: shmobile: marzen: remove SDHI0 WP pin setting from DTS
@ 2013-11-14 13:38       ` Laurent Pinchart
  0 siblings, 0 replies; 113+ messages in thread
From: Laurent Pinchart @ 2013-11-14 13:38 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Simon, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

Hi Morimoto-san,

Thank you for the patch.

On Thursday 14 November 2013 02:27:16 Kuninori Morimoto wrote:
> WP pin is not implemented on Marzen
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  arch/arm/boot/dts/r8a7779-marzen-reference.dts |    3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/r8a7779-marzen-reference.dts
> b/arch/arm/boot/dts/r8a7779-marzen-reference.dts index ce3fe9e..cd063cd
> 100644
> --- a/arch/arm/boot/dts/r8a7779-marzen-reference.dts
> +++ b/arch/arm/boot/dts/r8a7779-marzen-reference.dts
> @@ -93,8 +93,7 @@
>  	};
> 
>  	sdhi0_pins: sd0 {
> -		renesas,groups = "sdhi0_data4", "sdhi0_ctrl", "sdhi0_cd",
> -				 "sdhi0_wp";
> +		renesas,groups = "sdhi0_data4", "sdhi0_ctrl", "sdhi0_cd";
>  		renesas,function = "sdhi0";
>  	};
>  };
-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 07/17] ARM: shmobile: marzen: remove SDHI0 WP pin setting
  2013-11-14 10:27     ` Kuninori Morimoto
@ 2013-11-14 13:38       ` Laurent Pinchart
  -1 siblings, 0 replies; 113+ messages in thread
From: Laurent Pinchart @ 2013-11-14 13:38 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Simon, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

Hi Morimoto-san,

Thank you for the patch.

On Thursday 14 November 2013 02:27:32 Kuninori Morimoto wrote:
> WP pin is not implemented on Marzen
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  arch/arm/mach-shmobile/board-marzen.c |    2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/arch/arm/mach-shmobile/board-marzen.c
> b/arch/arm/mach-shmobile/board-marzen.c index fa102f7..2288dc2 100644
> --- a/arch/arm/mach-shmobile/board-marzen.c
> +++ b/arch/arm/mach-shmobile/board-marzen.c
> @@ -346,8 +346,6 @@ static const struct pinctrl_map marzen_pinctrl_map[] = {
> "sdhi0_ctrl", "sdhi0"),
>  	PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7779",
>  				  "sdhi0_cd", "sdhi0"),
> -	PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7779",
> -				  "sdhi0_wp", "sdhi0"),
>  	/* SMSC */
>  	PIN_MAP_MUX_GROUP_DEFAULT("smsc911x", "pfc-r8a7779",
>  				  "intc_irq1_b", "intc"),
-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 07/17] ARM: shmobile: marzen: remove SDHI0 WP pin setting
@ 2013-11-14 13:38       ` Laurent Pinchart
  0 siblings, 0 replies; 113+ messages in thread
From: Laurent Pinchart @ 2013-11-14 13:38 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Simon, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

Hi Morimoto-san,

Thank you for the patch.

On Thursday 14 November 2013 02:27:32 Kuninori Morimoto wrote:
> WP pin is not implemented on Marzen
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  arch/arm/mach-shmobile/board-marzen.c |    2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/arch/arm/mach-shmobile/board-marzen.c
> b/arch/arm/mach-shmobile/board-marzen.c index fa102f7..2288dc2 100644
> --- a/arch/arm/mach-shmobile/board-marzen.c
> +++ b/arch/arm/mach-shmobile/board-marzen.c
> @@ -346,8 +346,6 @@ static const struct pinctrl_map marzen_pinctrl_map[] = {
> "sdhi0_ctrl", "sdhi0"),
>  	PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7779",
>  				  "sdhi0_cd", "sdhi0"),
> -	PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7779",
> -				  "sdhi0_wp", "sdhi0"),
>  	/* SMSC */
>  	PIN_MAP_MUX_GROUP_DEFAULT("smsc911x", "pfc-r8a7779",
>  				  "intc_irq1_b", "intc"),
-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 08/17] ARM: shmobile: sh73a0: fixup sdhi compatible name
  2013-11-14 10:27     ` Kuninori Morimoto
@ 2013-11-14 13:39       ` Laurent Pinchart
  -1 siblings, 0 replies; 113+ messages in thread
From: Laurent Pinchart @ 2013-11-14 13:39 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Simon, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

Hi Morimoto-san,

Thank you for the patch.

On Thursday 14 November 2013 02:27:50 Kuninori Morimoto wrote:
> sh73a0 != r8a7740
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  arch/arm/boot/dts/sh73a0.dtsi |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/sh73a0.dtsi b/arch/arm/boot/dts/sh73a0.dtsi
> index 78f7201a..6e23fb4 100644
> --- a/arch/arm/boot/dts/sh73a0.dtsi
> +++ b/arch/arm/boot/dts/sh73a0.dtsi
> @@ -201,7 +201,7 @@
>  	};
> 
>  	sdhi0: sd@ee100000 {
> -		compatible = "renesas,sdhi-r8a7740";
> +		compatible = "renesas,sdhi-sh73a0";
>  		reg = <0xee100000 0x100>;
>  		interrupt-parent = <&gic>;
>  		interrupts = <0 83 4
> @@ -213,7 +213,7 @@
> 
>  	/* SDHI1 and SDHI2 have no CD pins, no need for CD IRQ */
>  	sdhi1: sd@ee120000 {
> -		compatible = "renesas,sdhi-r8a7740";
> +		compatible = "renesas,sdhi-sh73a0";
>  		reg = <0xee120000 0x100>;
>  		interrupt-parent = <&gic>;
>  		interrupts = <0 88 4
> @@ -224,7 +224,7 @@
>  	};
> 
>  	sdhi2: sd@ee140000 {
> -		compatible = "renesas,sdhi-r8a7740";
> +		compatible = "renesas,sdhi-sh73a0";
>  		reg = <0xee140000 0x100>;
>  		interrupt-parent = <&gic>;
>  		interrupts = <0 104 4
-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 08/17] ARM: shmobile: sh73a0: fixup sdhi compatible name
@ 2013-11-14 13:39       ` Laurent Pinchart
  0 siblings, 0 replies; 113+ messages in thread
From: Laurent Pinchart @ 2013-11-14 13:39 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Simon, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

Hi Morimoto-san,

Thank you for the patch.

On Thursday 14 November 2013 02:27:50 Kuninori Morimoto wrote:
> sh73a0 != r8a7740
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  arch/arm/boot/dts/sh73a0.dtsi |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/sh73a0.dtsi b/arch/arm/boot/dts/sh73a0.dtsi
> index 78f7201a..6e23fb4 100644
> --- a/arch/arm/boot/dts/sh73a0.dtsi
> +++ b/arch/arm/boot/dts/sh73a0.dtsi
> @@ -201,7 +201,7 @@
>  	};
> 
>  	sdhi0: sd@ee100000 {
> -		compatible = "renesas,sdhi-r8a7740";
> +		compatible = "renesas,sdhi-sh73a0";
>  		reg = <0xee100000 0x100>;
>  		interrupt-parent = <&gic>;
>  		interrupts = <0 83 4
> @@ -213,7 +213,7 @@
> 
>  	/* SDHI1 and SDHI2 have no CD pins, no need for CD IRQ */
>  	sdhi1: sd@ee120000 {
> -		compatible = "renesas,sdhi-r8a7740";
> +		compatible = "renesas,sdhi-sh73a0";
>  		reg = <0xee120000 0x100>;
>  		interrupt-parent = <&gic>;
>  		interrupts = <0 88 4
> @@ -224,7 +224,7 @@
>  	};
> 
>  	sdhi2: sd@ee140000 {
> -		compatible = "renesas,sdhi-r8a7740";
> +		compatible = "renesas,sdhi-sh73a0";
>  		reg = <0xee140000 0x100>;
>  		interrupt-parent = <&gic>;
>  		interrupts = <0 104 4
-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 01/16] gpio: rcar: use postcore_init()
  2013-11-14 10:19     ` Kuninori Morimoto
@ 2013-11-14 13:42       ` Laurent Pinchart
  -1 siblings, 0 replies; 113+ messages in thread
From: Laurent Pinchart @ 2013-11-14 13:42 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Simon, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

Hi Morimoto-san,

Thank you for the patch.

On Thursday 14 November 2013 02:19:54 Kuninori Morimoto wrote:
> Renesas GPIO is being interlocked with PFC, and GPIO is
> very basic system for R-Car.
> GPIO should be initialised in same timing as PFC.
> The GPIO based system doesn't work correctly without this patch.

Could you please describe the failure in a bit more details ?

> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
>  drivers/gpio/gpio-rcar.c |   12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c
> index 6038966..0a10325 100644
> --- a/drivers/gpio/gpio-rcar.c
> +++ b/drivers/gpio/gpio-rcar.c
> @@ -454,7 +454,17 @@ static struct platform_driver gpio_rcar_device_driver > { }
>  };
> 
> -module_platform_driver(gpio_rcar_device_driver);
> +static int __init gpio_rcar_init(void)
> +{
> +	return platform_driver_register(&gpio_rcar_device_driver);
> +}
> +postcore_initcall(gpio_rcar_init);
> +
> +static void __exit gpio_rcar_exit(void)
> +{
> +	platform_driver_unregister(&gpio_rcar_device_driver);
> +}
> +module_exit(gpio_rcar_exit);
> 
>  MODULE_AUTHOR("Magnus Damm");
>  MODULE_DESCRIPTION("Renesas R-Car GPIO Driver");
-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 01/16] gpio: rcar: use postcore_init()
@ 2013-11-14 13:42       ` Laurent Pinchart
  0 siblings, 0 replies; 113+ messages in thread
From: Laurent Pinchart @ 2013-11-14 13:42 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Simon, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

Hi Morimoto-san,

Thank you for the patch.

On Thursday 14 November 2013 02:19:54 Kuninori Morimoto wrote:
> Renesas GPIO is being interlocked with PFC, and GPIO is
> very basic system for R-Car.
> GPIO should be initialised in same timing as PFC.
> The GPIO based system doesn't work correctly without this patch.

Could you please describe the failure in a bit more details ?

> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
>  drivers/gpio/gpio-rcar.c |   12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c
> index 6038966..0a10325 100644
> --- a/drivers/gpio/gpio-rcar.c
> +++ b/drivers/gpio/gpio-rcar.c
> @@ -454,7 +454,17 @@ static struct platform_driver gpio_rcar_device_driver =
> { }
>  };
> 
> -module_platform_driver(gpio_rcar_device_driver);
> +static int __init gpio_rcar_init(void)
> +{
> +	return platform_driver_register(&gpio_rcar_device_driver);
> +}
> +postcore_initcall(gpio_rcar_init);
> +
> +static void __exit gpio_rcar_exit(void)
> +{
> +	platform_driver_unregister(&gpio_rcar_device_driver);
> +}
> +module_exit(gpio_rcar_exit);
> 
>  MODULE_AUTHOR("Magnus Damm");
>  MODULE_DESCRIPTION("Renesas R-Car GPIO Driver");
-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 0/16] ARM: shmobile: SDHI support for r8a7790
  2013-11-14 10:34   ` Kuninori Morimoto
@ 2013-11-14 13:46     ` Laurent Pinchart
  -1 siblings, 0 replies; 113+ messages in thread
From: Laurent Pinchart @ 2013-11-14 13:46 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Simon, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

Hi Morimoto-san,

Thank you for the patches.

On Thursday 14 November 2013 02:34:03 Kuninori Morimoto wrote:
> Hi Simon
> 
> These are SDHI support for r8a7790.
> 
> Kuninori Morimoto (14):
>       ARM: shmobile: lager: add SDHI0/2 support
>       ARM: shmobile: lager: use gpio/fixed regulator for SDHI

As the second patches fixes a problem in the first one, I'd like to split them 
differently. Could you please submit a first patch that adds the regulators, 
and a second patch that adds SDHI0/2 support using the regulators ?

-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 0/16] ARM: shmobile: SDHI support for r8a7790
@ 2013-11-14 13:46     ` Laurent Pinchart
  0 siblings, 0 replies; 113+ messages in thread
From: Laurent Pinchart @ 2013-11-14 13:46 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Simon, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

Hi Morimoto-san,

Thank you for the patches.

On Thursday 14 November 2013 02:34:03 Kuninori Morimoto wrote:
> Hi Simon
> 
> These are SDHI support for r8a7790.
> 
> Kuninori Morimoto (14):
>       ARM: shmobile: lager: add SDHI0/2 support
>       ARM: shmobile: lager: use gpio/fixed regulator for SDHI

As the second patches fixes a problem in the first one, I'd like to split them 
differently. Could you please submit a first patch that adds the regulators, 
and a second patch that adds SDHI0/2 support using the regulators ?

-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 17/17] ARM: shmobile: lager: use gpio/fixed regulator for SDHI
  2013-11-14 10:35     ` Kuninori Morimoto
@ 2013-11-14 13:51       ` Laurent Pinchart
  -1 siblings, 0 replies; 113+ messages in thread
From: Laurent Pinchart @ 2013-11-14 13:51 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Simon, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

Hi Morimoto-san,

Thank you for the patch.

On Thursday 14 November 2013 02:35:08 Kuninori Morimoto wrote:
> SDHI0/2 Vcc/Vccq can use gpio/fixed regulator driver
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
>  arch/arm/mach-shmobile/board-lager.c |   89 ++++++++++++++++++++++++++-----
>  1 file changed, 78 insertions(+), 11 deletions(-)
> 
> diff --git a/arch/arm/mach-shmobile/board-lager.c
> b/arch/arm/mach-shmobile/board-lager.c index 2e529dc..7c77521 100644
> --- a/arch/arm/mach-shmobile/board-lager.c
> +++ b/arch/arm/mach-shmobile/board-lager.c
> @@ -33,7 +33,9 @@
>  #include <linux/platform_data/rcar-du.h>
>  #include <linux/platform_device.h>
>  #include <linux/phy.h>
> +#include <linux/regulator/driver.h>
>  #include <linux/regulator/fixed.h>
> +#include <linux/regulator/gpio-regulator.h>
>  #include <linux/regulator/machine.h>
>  #include <linux/sh_eth.h>
>  #include <mach/common.h>
> @@ -154,10 +156,6 @@ static const struct gpio_keys_platform_data
> lager_keys_pdata __initconst = { static struct regulator_consumer_supply
> fixed3v3_power_consumers[] = {
>  	REGULATOR_SUPPLY("vmmc", "sh_mmcif.1"),
> -	REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"),
> -	REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.0"),
> -	REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.2"),
> -	REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.2"),
>  };
> 
>  /* MMCIF */
> @@ -185,9 +183,67 @@ static const struct resource ether_resources[]
> __initconst = { DEFINE_RES_IRQ(gic_spi(162)),
>  };
> 
> +/* SDHI regulator macro */
> +#define SDHI_REGULATOR(idx, vdd_pin, vccq_pin)				\
> +static struct regulator_consumer_supply vcc_sdhi##idx##_consumer =	\
> +	REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi." #idx);		\
> +									\
> +static struct regulator_init_data vcc_sdhi##idx##_init_data = {		\
> +	.constraints = {						\
> +		.valid_ops_mask = REGULATOR_CHANGE_STATUS,		\
> +	},								\
> +	.consumer_supplies	= &vcc_sdhi##idx##_consumer,		\
> +	.num_consumer_supplies	= 1,					\
> +};									\
> +									\
> +static struct fixed_voltage_config vcc_sdhi##idx##_info = {		\
> +	.supply_name	= "SDHI" #idx "Vcc",				\
> +	.microvolts	= 3300000,					\
> +	.gpio		= vdd_pin,					\
> +	.enable_high	= 1,						\
> +	.init_data	= &vcc_sdhi##idx##_init_data,			\
> +};									\
> +									\
> +static struct regulator_consumer_supply vccq_sdhi##idx##_consumer=	\
> +	REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi." #idx);		\
> +									\
> +static struct regulator_init_data vccq_sdhi##idx##_init_data = {	\
> +	.constraints = {						\
> +		.input_uV	= 3300000,				\
> +		.min_uV		= 1800000,				\
> +		.max_uV		= 3300000,				\
> +		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |		\
> +				  REGULATOR_CHANGE_STATUS,		\
> +	},								\
> +	.consumer_supplies	= &vccq_sdhi##idx##_consumer,		\
> +	.num_consumer_supplies	= 1,					\
> +};									\
> +									\
> +static struct gpio vccq_sdhi##idx##_gpio =				\
> +	{ vccq_pin, GPIOF_OUT_INIT_HIGH, "vccq-sdhi" #idx };		\
> +									\
> +static struct gpio_regulator_state vccq_sdhi##idx##_states[] = {	\
> +	{ .value = 1800000, .gpios = 0 },				\
> +	{ .value = 3300000, .gpios = 1 },				\
> +};									\
> +									\
> +static struct gpio_regulator_config vccq_sdhi##idx##_info = {		\
> +	.supply_name	= "vqmmc",					\
> +	.gpios		= &vccq_sdhi##idx##_gpio,			\
> +	.nr_gpios	= 1,						\
> +	.states		= vccq_sdhi##idx##_states,			\
> +	.nr_states	= ARRAY_SIZE(vccq_sdhi##idx##_states),		\
> +	.type		= REGULATOR_VOLTAGE,				\
> +	.init_data	= &vccq_sdhi##idx##_init_data,			\
> +};

The vmmc regulator looks fine to me at first sight, but I'm less sure about 
the vqmmc regulator. The vqmmc supplies are provided by the PMIC, we should 
ideally use the existing da9063 mfd driver. As this might require a 
significant amount of work I'm fine with this approach as a quick fix, but I'd 
like a comment in the source code stating that vqmmc should be handled by the 
da9063 driver.

> +SDHI_REGULATOR(0, RCAR_GP_PIN(5, 24), RCAR_GP_PIN(5, 29));
> +SDHI_REGULATOR(2, RCAR_GP_PIN(5, 25), RCAR_GP_PIN(5, 30));
> +
>  /* SDHI0 */
>  static struct sh_mobile_sdhi_info sdhi0_info __initdata = {
> -	.tmio_caps	= MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ,
> +	.tmio_caps	= MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
> +			  MMC_CAP_POWER_OFF_CARD,
>  	.tmio_caps2	= MMC_CAP2_NO_MULTI_READ,
>  	.tmio_flags	= TMIO_MMC_HAS_IDLE_WAIT |
>  			  TMIO_MMC_WRPROTECT_DISABLE,
> @@ -200,7 +256,8 @@ static struct resource sdhi0_resources[] __initdata = {
> 
>  /* SDHI2 */
>  static struct sh_mobile_sdhi_info sdhi2_info __initdata = {
> -	.tmio_caps	= MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ,
> +	.tmio_caps	= MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
> +			  MMC_CAP_POWER_OFF_CARD,
>  	.tmio_caps2	= MMC_CAP2_NO_MULTI_READ,
>  	.tmio_flags	= TMIO_MMC_HAS_IDLE_WAIT |
>  			  TMIO_MMC_WRPROTECT_DISABLE,
> @@ -259,6 +316,9 @@ static const struct pinctrl_map lager_pinctrl_map[] = {
> 
>  static void __init lager_add_standard_devices(void)
>  {
> +	int fixed_regulator_idx = 0;
> +	int gpio_regulator_idx = 0;
> +
>  	r8a7790_clock_init();
> 
>  	pinctrl_register_mappings(lager_pinctrl_map,
> @@ -272,7 +332,8 @@ static void __init lager_add_standard_devices(void)
>  	platform_device_register_data(&platform_bus, "gpio-keys", -1,
>  				      &lager_keys_pdata,
>  				      sizeof(lager_keys_pdata));
> -	regulator_register_always_on(0, "fixed-3.3V", fixed3v3_power_consumers,
> +	regulator_register_always_on(fixed_regulator_idx++,
> +				     "fixed-3.3V", fixed3v3_power_consumers,
>  				     ARRAY_SIZE(fixed3v3_power_consumers), 3300000);
>  	platform_device_register_resndata(&platform_bus, "sh_mmcif", 1,
>  					  mmcif1_resources, ARRAY_SIZE(mmcif1_resources),
> @@ -285,10 +346,16 @@ static void __init lager_add_standard_devices(void)
> 
>  	lager_add_du_device();
> 
> -	gpio_request_one(RCAR_GP_PIN(5, 24), GPIOF_OUT_INIT_HIGH, NULL); /* SD0
> VDD  3.3V */ -	gpio_request_one(RCAR_GP_PIN(5, 25), GPIOF_OUT_INIT_HIGH,
> NULL); /* SD2 VDD  3.3V */ -	gpio_request_one(RCAR_GP_PIN(5, 29),
> GPIOF_OUT_INIT_HIGH, NULL); /* SD0 VccQ 3.3V */
> -	gpio_request_one(RCAR_GP_PIN(5, 30), GPIOF_OUT_INIT_HIGH, NULL); /* SD2
> VccQ 3.3V */ +	platform_device_register_data(&platform_bus,
> "reg-fixed-voltage", fixed_regulator_idx++, +				      
&vcc_sdhi0_info,
> sizeof(struct fixed_voltage_config));
> +	platform_device_register_data(&platform_bus, "reg-fixed-voltage",
> fixed_regulator_idx++, +				      &vcc_sdhi2_info, sizeof(struct
> fixed_voltage_config));
> +
> +	platform_device_register_data(&platform_bus, "gpio-regulator",
> gpio_regulator_idx++, +				      &vccq_sdhi0_info, sizeof(struct
> gpio_regulator_config)); +	platform_device_register_data(&platform_bus,
> "gpio-regulator", gpio_regulator_idx++, +				      
&vccq_sdhi2_info,
> sizeof(struct gpio_regulator_config)); +
>  	platform_device_register_resndata(&platform_bus, "sh_mobile_sdhi", 0,
>  					  sdhi0_resources, ARRAY_SIZE(sdhi0_resources),
>  					  &sdhi0_info, sizeof(struct sh_mobile_sdhi_info));
-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 17/17] ARM: shmobile: lager: use gpio/fixed regulator for SDHI
@ 2013-11-14 13:51       ` Laurent Pinchart
  0 siblings, 0 replies; 113+ messages in thread
From: Laurent Pinchart @ 2013-11-14 13:51 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Simon, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

Hi Morimoto-san,

Thank you for the patch.

On Thursday 14 November 2013 02:35:08 Kuninori Morimoto wrote:
> SDHI0/2 Vcc/Vccq can use gpio/fixed regulator driver
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
>  arch/arm/mach-shmobile/board-lager.c |   89 ++++++++++++++++++++++++++-----
>  1 file changed, 78 insertions(+), 11 deletions(-)
> 
> diff --git a/arch/arm/mach-shmobile/board-lager.c
> b/arch/arm/mach-shmobile/board-lager.c index 2e529dc..7c77521 100644
> --- a/arch/arm/mach-shmobile/board-lager.c
> +++ b/arch/arm/mach-shmobile/board-lager.c
> @@ -33,7 +33,9 @@
>  #include <linux/platform_data/rcar-du.h>
>  #include <linux/platform_device.h>
>  #include <linux/phy.h>
> +#include <linux/regulator/driver.h>
>  #include <linux/regulator/fixed.h>
> +#include <linux/regulator/gpio-regulator.h>
>  #include <linux/regulator/machine.h>
>  #include <linux/sh_eth.h>
>  #include <mach/common.h>
> @@ -154,10 +156,6 @@ static const struct gpio_keys_platform_data
> lager_keys_pdata __initconst = { static struct regulator_consumer_supply
> fixed3v3_power_consumers[] = {
>  	REGULATOR_SUPPLY("vmmc", "sh_mmcif.1"),
> -	REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"),
> -	REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.0"),
> -	REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.2"),
> -	REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.2"),
>  };
> 
>  /* MMCIF */
> @@ -185,9 +183,67 @@ static const struct resource ether_resources[]
> __initconst = { DEFINE_RES_IRQ(gic_spi(162)),
>  };
> 
> +/* SDHI regulator macro */
> +#define SDHI_REGULATOR(idx, vdd_pin, vccq_pin)				\
> +static struct regulator_consumer_supply vcc_sdhi##idx##_consumer =	\
> +	REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi." #idx);		\
> +									\
> +static struct regulator_init_data vcc_sdhi##idx##_init_data = {		\
> +	.constraints = {						\
> +		.valid_ops_mask = REGULATOR_CHANGE_STATUS,		\
> +	},								\
> +	.consumer_supplies	= &vcc_sdhi##idx##_consumer,		\
> +	.num_consumer_supplies	= 1,					\
> +};									\
> +									\
> +static struct fixed_voltage_config vcc_sdhi##idx##_info = {		\
> +	.supply_name	= "SDHI" #idx "Vcc",				\
> +	.microvolts	= 3300000,					\
> +	.gpio		= vdd_pin,					\
> +	.enable_high	= 1,						\
> +	.init_data	= &vcc_sdhi##idx##_init_data,			\
> +};									\
> +									\
> +static struct regulator_consumer_supply vccq_sdhi##idx##_consumer=	\
> +	REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi." #idx);		\
> +									\
> +static struct regulator_init_data vccq_sdhi##idx##_init_data = {	\
> +	.constraints = {						\
> +		.input_uV	= 3300000,				\
> +		.min_uV		= 1800000,				\
> +		.max_uV		= 3300000,				\
> +		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |		\
> +				  REGULATOR_CHANGE_STATUS,		\
> +	},								\
> +	.consumer_supplies	= &vccq_sdhi##idx##_consumer,		\
> +	.num_consumer_supplies	= 1,					\
> +};									\
> +									\
> +static struct gpio vccq_sdhi##idx##_gpio =				\
> +	{ vccq_pin, GPIOF_OUT_INIT_HIGH, "vccq-sdhi" #idx };		\
> +									\
> +static struct gpio_regulator_state vccq_sdhi##idx##_states[] = {	\
> +	{ .value = 1800000, .gpios = 0 },				\
> +	{ .value = 3300000, .gpios = 1 },				\
> +};									\
> +									\
> +static struct gpio_regulator_config vccq_sdhi##idx##_info = {		\
> +	.supply_name	= "vqmmc",					\
> +	.gpios		= &vccq_sdhi##idx##_gpio,			\
> +	.nr_gpios	= 1,						\
> +	.states		= vccq_sdhi##idx##_states,			\
> +	.nr_states	= ARRAY_SIZE(vccq_sdhi##idx##_states),		\
> +	.type		= REGULATOR_VOLTAGE,				\
> +	.init_data	= &vccq_sdhi##idx##_init_data,			\
> +};

The vmmc regulator looks fine to me at first sight, but I'm less sure about 
the vqmmc regulator. The vqmmc supplies are provided by the PMIC, we should 
ideally use the existing da9063 mfd driver. As this might require a 
significant amount of work I'm fine with this approach as a quick fix, but I'd 
like a comment in the source code stating that vqmmc should be handled by the 
da9063 driver.

> +SDHI_REGULATOR(0, RCAR_GP_PIN(5, 24), RCAR_GP_PIN(5, 29));
> +SDHI_REGULATOR(2, RCAR_GP_PIN(5, 25), RCAR_GP_PIN(5, 30));
> +
>  /* SDHI0 */
>  static struct sh_mobile_sdhi_info sdhi0_info __initdata = {
> -	.tmio_caps	= MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ,
> +	.tmio_caps	= MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
> +			  MMC_CAP_POWER_OFF_CARD,
>  	.tmio_caps2	= MMC_CAP2_NO_MULTI_READ,
>  	.tmio_flags	= TMIO_MMC_HAS_IDLE_WAIT |
>  			  TMIO_MMC_WRPROTECT_DISABLE,
> @@ -200,7 +256,8 @@ static struct resource sdhi0_resources[] __initdata = {
> 
>  /* SDHI2 */
>  static struct sh_mobile_sdhi_info sdhi2_info __initdata = {
> -	.tmio_caps	= MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ,
> +	.tmio_caps	= MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
> +			  MMC_CAP_POWER_OFF_CARD,
>  	.tmio_caps2	= MMC_CAP2_NO_MULTI_READ,
>  	.tmio_flags	= TMIO_MMC_HAS_IDLE_WAIT |
>  			  TMIO_MMC_WRPROTECT_DISABLE,
> @@ -259,6 +316,9 @@ static const struct pinctrl_map lager_pinctrl_map[] = {
> 
>  static void __init lager_add_standard_devices(void)
>  {
> +	int fixed_regulator_idx = 0;
> +	int gpio_regulator_idx = 0;
> +
>  	r8a7790_clock_init();
> 
>  	pinctrl_register_mappings(lager_pinctrl_map,
> @@ -272,7 +332,8 @@ static void __init lager_add_standard_devices(void)
>  	platform_device_register_data(&platform_bus, "gpio-keys", -1,
>  				      &lager_keys_pdata,
>  				      sizeof(lager_keys_pdata));
> -	regulator_register_always_on(0, "fixed-3.3V", fixed3v3_power_consumers,
> +	regulator_register_always_on(fixed_regulator_idx++,
> +				     "fixed-3.3V", fixed3v3_power_consumers,
>  				     ARRAY_SIZE(fixed3v3_power_consumers), 3300000);
>  	platform_device_register_resndata(&platform_bus, "sh_mmcif", 1,
>  					  mmcif1_resources, ARRAY_SIZE(mmcif1_resources),
> @@ -285,10 +346,16 @@ static void __init lager_add_standard_devices(void)
> 
>  	lager_add_du_device();
> 
> -	gpio_request_one(RCAR_GP_PIN(5, 24), GPIOF_OUT_INIT_HIGH, NULL); /* SD0
> VDD  3.3V */ -	gpio_request_one(RCAR_GP_PIN(5, 25), GPIOF_OUT_INIT_HIGH,
> NULL); /* SD2 VDD  3.3V */ -	gpio_request_one(RCAR_GP_PIN(5, 29),
> GPIOF_OUT_INIT_HIGH, NULL); /* SD0 VccQ 3.3V */
> -	gpio_request_one(RCAR_GP_PIN(5, 30), GPIOF_OUT_INIT_HIGH, NULL); /* SD2
> VccQ 3.3V */ +	platform_device_register_data(&platform_bus,
> "reg-fixed-voltage", fixed_regulator_idx++, +				      
&vcc_sdhi0_info,
> sizeof(struct fixed_voltage_config));
> +	platform_device_register_data(&platform_bus, "reg-fixed-voltage",
> fixed_regulator_idx++, +				      &vcc_sdhi2_info, sizeof(struct
> fixed_voltage_config));
> +
> +	platform_device_register_data(&platform_bus, "gpio-regulator",
> gpio_regulator_idx++, +				      &vccq_sdhi0_info, sizeof(struct
> gpio_regulator_config)); +	platform_device_register_data(&platform_bus,
> "gpio-regulator", gpio_regulator_idx++, +				      
&vccq_sdhi2_info,
> sizeof(struct gpio_regulator_config)); +
>  	platform_device_register_resndata(&platform_bus, "sh_mobile_sdhi", 0,
>  					  sdhi0_resources, ARRAY_SIZE(sdhi0_resources),
>  					  &sdhi0_info, sizeof(struct sh_mobile_sdhi_info));
-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 11/17] mmc: SDHI: add SoC specific workaround via HW version
  2013-11-14 10:31     ` Kuninori Morimoto
@ 2013-11-14 14:03       ` Sergei Shtylyov
  -1 siblings, 0 replies; 113+ messages in thread
From: Sergei Shtylyov @ 2013-11-14 14:03 UTC (permalink / raw)
  To: Kuninori Morimoto, Chris Ball
  Cc: Simon, Laurent, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

Hello.

On 14-11-2013 14:31, Kuninori Morimoto wrote:

> One of Renesas SDHI chip needs workaround to use it,
> and, we can judge it based on chip version.
> This patch adds very quick-hack workaround method,
> since we still don't know how many chips
> need workaround in the future.

> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
>   drivers/mmc/host/sh_mobile_sdhi.c |   11 +++++++++++
>   include/linux/mmc/tmio.h          |    1 +
>   2 files changed, 12 insertions(+)
>
> diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
> index f1e35a7..d241d86 100644
> --- a/drivers/mmc/host/sh_mobile_sdhi.c
> +++ b/drivers/mmc/host/sh_mobile_sdhi.c
> @@ -33,6 +33,8 @@
>
>   #include "tmio_mmc.h"
>
> +#define EXT_ACC           0xe4
> +

    Why not #define it in the tmio.h? It already contains SDHI specific 
register, CTL_DMA_ENABLE...

[...]
> diff --git a/include/linux/mmc/tmio.h b/include/linux/mmc/tmio.h
> index a1c1f32..84d9053 100644
> --- a/include/linux/mmc/tmio.h
> +++ b/include/linux/mmc/tmio.h
> @@ -33,6 +33,7 @@
>   #define CTL_SDIO_IRQ_MASK 0x38
>   #define CTL_DMA_ENABLE 0xd8
>   #define CTL_RESET_SD 0xe0
> +#define CTL_VERSION 0xe2
>   #define CTL_SDIO_REGS 0x100
>   #define CTL_CLK_AND_WAIT_CTL 0x138
>   #define CTL_RESET_SDIO 0x1e0

WBR, Sergei


^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 11/17] mmc: SDHI: add SoC specific workaround via HW version
@ 2013-11-14 14:03       ` Sergei Shtylyov
  0 siblings, 0 replies; 113+ messages in thread
From: Sergei Shtylyov @ 2013-11-14 14:03 UTC (permalink / raw)
  To: Kuninori Morimoto, Chris Ball
  Cc: Simon, Laurent, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

Hello.

On 14-11-2013 14:31, Kuninori Morimoto wrote:

> One of Renesas SDHI chip needs workaround to use it,
> and, we can judge it based on chip version.
> This patch adds very quick-hack workaround method,
> since we still don't know how many chips
> need workaround in the future.

> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
>   drivers/mmc/host/sh_mobile_sdhi.c |   11 +++++++++++
>   include/linux/mmc/tmio.h          |    1 +
>   2 files changed, 12 insertions(+)
>
> diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
> index f1e35a7..d241d86 100644
> --- a/drivers/mmc/host/sh_mobile_sdhi.c
> +++ b/drivers/mmc/host/sh_mobile_sdhi.c
> @@ -33,6 +33,8 @@
>
>   #include "tmio_mmc.h"
>
> +#define EXT_ACC           0xe4
> +

    Why not #define it in the tmio.h? It already contains SDHI specific 
register, CTL_DMA_ENABLE...

[...]
> diff --git a/include/linux/mmc/tmio.h b/include/linux/mmc/tmio.h
> index a1c1f32..84d9053 100644
> --- a/include/linux/mmc/tmio.h
> +++ b/include/linux/mmc/tmio.h
> @@ -33,6 +33,7 @@
>   #define CTL_SDIO_IRQ_MASK 0x38
>   #define CTL_DMA_ENABLE 0xd8
>   #define CTL_RESET_SD 0xe0
> +#define CTL_VERSION 0xe2
>   #define CTL_SDIO_REGS 0x100
>   #define CTL_CLK_AND_WAIT_CTL 0x138
>   #define CTL_RESET_SDIO 0x1e0

WBR, Sergei


^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 11/17] mmc: SDHI: add SoC specific workaround via HW version
  2013-11-14 14:03       ` Sergei Shtylyov
@ 2013-11-15  0:16         ` Kuninori Morimoto
  -1 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-15  0:16 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: Chris Ball, Simon, Laurent, Magnus, Linux-SH, Kuninori Morimoto,
	linux-mmc


Hi

> > One of Renesas SDHI chip needs workaround to use it,
> > and, we can judge it based on chip version.
> > This patch adds very quick-hack workaround method,
> > since we still don't know how many chips
> > need workaround in the future.
> 
> > Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> > ---
> >   drivers/mmc/host/sh_mobile_sdhi.c |   11 +++++++++++
> >   include/linux/mmc/tmio.h          |    1 +
> >   2 files changed, 12 insertions(+)
> >
> > diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
> > index f1e35a7..d241d86 100644
> > --- a/drivers/mmc/host/sh_mobile_sdhi.c
> > +++ b/drivers/mmc/host/sh_mobile_sdhi.c
> > @@ -33,6 +33,8 @@
> >
> >   #include "tmio_mmc.h"
> >
> > +#define EXT_ACC           0xe4
> > +
> 
>     Why not #define it in the tmio.h? It already contains SDHI specific 
> register, CTL_DMA_ENABLE...

I'm not sure which approach is correct.
I will follow Maintainer's decision

Best regards
---
Kuninori Morimoto

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 11/17] mmc: SDHI: add SoC specific workaround via HW version
@ 2013-11-15  0:16         ` Kuninori Morimoto
  0 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-15  0:16 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: Chris Ball, Simon, Laurent, Magnus, Linux-SH, Kuninori Morimoto,
	linux-mmc


Hi

> > One of Renesas SDHI chip needs workaround to use it,
> > and, we can judge it based on chip version.
> > This patch adds very quick-hack workaround method,
> > since we still don't know how many chips
> > need workaround in the future.
> 
> > Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> > ---
> >   drivers/mmc/host/sh_mobile_sdhi.c |   11 +++++++++++
> >   include/linux/mmc/tmio.h          |    1 +
> >   2 files changed, 12 insertions(+)
> >
> > diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
> > index f1e35a7..d241d86 100644
> > --- a/drivers/mmc/host/sh_mobile_sdhi.c
> > +++ b/drivers/mmc/host/sh_mobile_sdhi.c
> > @@ -33,6 +33,8 @@
> >
> >   #include "tmio_mmc.h"
> >
> > +#define EXT_ACC           0xe4
> > +
> 
>     Why not #define it in the tmio.h? It already contains SDHI specific 
> register, CTL_DMA_ENABLE...

I'm not sure which approach is correct.
I will follow Maintainer's decision

Best regards
---
Kuninori Morimoto

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 01/16] gpio: rcar: use postcore_init()
  2013-11-14 13:42       ` Laurent Pinchart
@ 2013-11-15  0:26         ` Kuninori Morimoto
  -1 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-15  0:26 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Simon, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc


Hi Laurent

> > Renesas GPIO is being interlocked with PFC, and GPIO is
> > very basic system for R-Car.
> > GPIO should be initialised in same timing as PFC.
> > The GPIO based system doesn't work correctly without this patch.
> 
> Could you please describe the failure in a bit more details ?

Real kernel log is better than my explain :P
These series needs gpio-regulator.
*before* case, sh_mobile_sdhi can't use gpio-regulator because of timing issue.

----------------- before ---------------------
...
sh-pfc pfc-r8a7790: r8a77900_pfc support registered
...
SDHI0Vcc: Failed to request enable GPIO184: -517
reg-fixed-voltage reg-fixed-voltage.1: Failed to register regulator: -517
platform reg-fixed-voltage.1: Driver reg-fixed-voltage requests probe deferral
SDHI2Vcc: Failed to request enable GPIO185: -517
reg-fixed-voltage reg-fixed-voltage.2: Failed to register regulator: -517
platform reg-fixed-voltage.2: Driver reg-fixed-voltage requests probe deferral
gpio-regulator gpio-regulator.0: Could not obtain regulator setting GPIOs: -517
platform gpio-regulator.0: Driver gpio-regulator requests probe deferral
gpio-regulator gpio-regulator.1: Could not obtain regulator setting GPIOs: -517
platform gpio-regulator.1: Driver gpio-regulator requests probe deferral
...
gpio_rcar gpio_rcar.0: driving 32 GPIOs
gpio_rcar gpio_rcar.1: driving 32 GPIOs
gpio_rcar gpio_rcar.2: driving 32 GPIOs
gpio_rcar gpio_rcar.3: driving 32 GPIOs
gpio_rcar gpio_rcar.4: driving 32 GPIOs
gpio_rcar gpio_rcar.5: driving 32 GPIOs
...
sh_mobile_sdhi sh_mobile_sdhi.0: mmc0 base at 0xee100000 clock rate 97 MHz
sh_mobile_sdhi sh_mobile_sdhi.2: mmc1 base at 0xee140000 clock rate 48 MHz
...
SDHI0Vcc: 3300 mV 
SDHI2Vcc: 3300 mV 
vqmmc: 1800 <--> 3300 mV at 3300 mV 
vqmmc: 1800 <--> 3300 mV at 3300 mV 
...

---------------- after ------------------
...
sh-pfc pfc-r8a7790: r8a77900_pfc support registered
gpio_rcar gpio_rcar.0: driving 32 GPIOs
gpio_rcar gpio_rcar.1: driving 32 GPIOs
gpio_rcar gpio_rcar.2: driving 32 GPIOs
gpio_rcar gpio_rcar.3: driving 32 GPIOs
gpio_rcar gpio_rcar.4: driving 32 GPIOs
gpio_rcar gpio_rcar.5: driving 32 GPIOs
...
SDHI0Vcc: 3300 mV 
SDHI2Vcc: 3300 mV 
vqmmc: 1800 <--> 3300 mV at 3300 mV 
vqmmc: 1800 <--> 3300 mV at 3300 mV 
...
sh_mobile_sdhi sh_mobile_sdhi.0: mmc0 base at 0xee100000 clock rate 97 MHz
sh_mobile_sdhi sh_mobile_sdhi.2: mmc1 base at 0xee140000 clock rate 48 MHz


Best regards
---
Kuninori Morimoto

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 01/16] gpio: rcar: use postcore_init()
@ 2013-11-15  0:26         ` Kuninori Morimoto
  0 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-15  0:26 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Simon, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc


Hi Laurent

> > Renesas GPIO is being interlocked with PFC, and GPIO is
> > very basic system for R-Car.
> > GPIO should be initialised in same timing as PFC.
> > The GPIO based system doesn't work correctly without this patch.
> 
> Could you please describe the failure in a bit more details ?

Real kernel log is better than my explain :P
These series needs gpio-regulator.
*before* case, sh_mobile_sdhi can't use gpio-regulator because of timing issue.

----------------- before ---------------------
...
sh-pfc pfc-r8a7790: r8a77900_pfc support registered
...
SDHI0Vcc: Failed to request enable GPIO184: -517
reg-fixed-voltage reg-fixed-voltage.1: Failed to register regulator: -517
platform reg-fixed-voltage.1: Driver reg-fixed-voltage requests probe deferral
SDHI2Vcc: Failed to request enable GPIO185: -517
reg-fixed-voltage reg-fixed-voltage.2: Failed to register regulator: -517
platform reg-fixed-voltage.2: Driver reg-fixed-voltage requests probe deferral
gpio-regulator gpio-regulator.0: Could not obtain regulator setting GPIOs: -517
platform gpio-regulator.0: Driver gpio-regulator requests probe deferral
gpio-regulator gpio-regulator.1: Could not obtain regulator setting GPIOs: -517
platform gpio-regulator.1: Driver gpio-regulator requests probe deferral
...
gpio_rcar gpio_rcar.0: driving 32 GPIOs
gpio_rcar gpio_rcar.1: driving 32 GPIOs
gpio_rcar gpio_rcar.2: driving 32 GPIOs
gpio_rcar gpio_rcar.3: driving 32 GPIOs
gpio_rcar gpio_rcar.4: driving 32 GPIOs
gpio_rcar gpio_rcar.5: driving 32 GPIOs
...
sh_mobile_sdhi sh_mobile_sdhi.0: mmc0 base at 0xee100000 clock rate 97 MHz
sh_mobile_sdhi sh_mobile_sdhi.2: mmc1 base at 0xee140000 clock rate 48 MHz
...
SDHI0Vcc: 3300 mV 
SDHI2Vcc: 3300 mV 
vqmmc: 1800 <--> 3300 mV at 3300 mV 
vqmmc: 1800 <--> 3300 mV at 3300 mV 
...

---------------- after ------------------
...
sh-pfc pfc-r8a7790: r8a77900_pfc support registered
gpio_rcar gpio_rcar.0: driving 32 GPIOs
gpio_rcar gpio_rcar.1: driving 32 GPIOs
gpio_rcar gpio_rcar.2: driving 32 GPIOs
gpio_rcar gpio_rcar.3: driving 32 GPIOs
gpio_rcar gpio_rcar.4: driving 32 GPIOs
gpio_rcar gpio_rcar.5: driving 32 GPIOs
...
SDHI0Vcc: 3300 mV 
SDHI2Vcc: 3300 mV 
vqmmc: 1800 <--> 3300 mV at 3300 mV 
vqmmc: 1800 <--> 3300 mV at 3300 mV 
...
sh_mobile_sdhi sh_mobile_sdhi.0: mmc0 base at 0xee100000 clock rate 97 MHz
sh_mobile_sdhi sh_mobile_sdhi.2: mmc1 base at 0xee140000 clock rate 48 MHz


Best regards
---
Kuninori Morimoto

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 17/17] ARM: shmobile: lager: use gpio/fixed regulator for SDHI
  2013-11-14 13:51       ` Laurent Pinchart
@ 2013-11-15  0:42         ` Kuninori Morimoto
  -1 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-15  0:42 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Simon, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc


Hi Laurent

Thank you for your feedback

> > +/* SDHI regulator macro */
> > +#define SDHI_REGULATOR(idx, vdd_pin, vccq_pin)				\
> > +static struct regulator_consumer_supply vcc_sdhi##idx##_consumer =	\
> > +	REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi." #idx);		\
> > +									\
> > +static struct regulator_init_data vcc_sdhi##idx##_init_data = {		\
> > +	.constraints = {						\
> > +		.valid_ops_mask = REGULATOR_CHANGE_STATUS,		\
> > +	},								\
> > +	.consumer_supplies	= &vcc_sdhi##idx##_consumer,		\
> > +	.num_consumer_supplies	= 1,					\
> > +};									\
> > +									\
> > +static struct fixed_voltage_config vcc_sdhi##idx##_info = {		\
> > +	.supply_name	= "SDHI" #idx "Vcc",				\
> > +	.microvolts	= 3300000,					\
> > +	.gpio		= vdd_pin,					\
> > +	.enable_high	= 1,						\
> > +	.init_data	= &vcc_sdhi##idx##_init_data,			\
> > +};									\
> > +									\
> > +static struct regulator_consumer_supply vccq_sdhi##idx##_consumer=	\
> > +	REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi." #idx);		\
> > +									\
> > +static struct regulator_init_data vccq_sdhi##idx##_init_data = {	\
> > +	.constraints = {						\
> > +		.input_uV	= 3300000,				\
> > +		.min_uV		= 1800000,				\
> > +		.max_uV		= 3300000,				\
> > +		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |		\
> > +				  REGULATOR_CHANGE_STATUS,		\
> > +	},								\
> > +	.consumer_supplies	= &vccq_sdhi##idx##_consumer,		\
> > +	.num_consumer_supplies	= 1,					\
> > +};									\
> > +									\
> > +static struct gpio vccq_sdhi##idx##_gpio =				\
> > +	{ vccq_pin, GPIOF_OUT_INIT_HIGH, "vccq-sdhi" #idx };		\
> > +									\
> > +static struct gpio_regulator_state vccq_sdhi##idx##_states[] = {	\
> > +	{ .value = 1800000, .gpios = 0 },				\
> > +	{ .value = 3300000, .gpios = 1 },				\
> > +};									\
> > +									\
> > +static struct gpio_regulator_config vccq_sdhi##idx##_info = {		\
> > +	.supply_name	= "vqmmc",					\
> > +	.gpios		= &vccq_sdhi##idx##_gpio,			\
> > +	.nr_gpios	= 1,						\
> > +	.states		= vccq_sdhi##idx##_states,			\
> > +	.nr_states	= ARRAY_SIZE(vccq_sdhi##idx##_states),		\
> > +	.type		= REGULATOR_VOLTAGE,				\
> > +	.init_data	= &vccq_sdhi##idx##_init_data,			\
> > +};
> 
> The vmmc regulator looks fine to me at first sight, but I'm less sure about 
> the vqmmc regulator. The vqmmc supplies are provided by the PMIC, we should 
> ideally use the existing da9063 mfd driver. As this might require a 
> significant amount of work I'm fine with this approach as a quick fix, but I'd 
> like a comment in the source code stating that vqmmc should be handled by the 
> da9063 driver.

Nice catch.
I agree. will do in v2 patch

Best regards
---
Kuninori Morimoto

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 17/17] ARM: shmobile: lager: use gpio/fixed regulator for SDHI
@ 2013-11-15  0:42         ` Kuninori Morimoto
  0 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-15  0:42 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Simon, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc


Hi Laurent

Thank you for your feedback

> > +/* SDHI regulator macro */
> > +#define SDHI_REGULATOR(idx, vdd_pin, vccq_pin)				\
> > +static struct regulator_consumer_supply vcc_sdhi##idx##_consumer =	\
> > +	REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi." #idx);		\
> > +									\
> > +static struct regulator_init_data vcc_sdhi##idx##_init_data = {		\
> > +	.constraints = {						\
> > +		.valid_ops_mask = REGULATOR_CHANGE_STATUS,		\
> > +	},								\
> > +	.consumer_supplies	= &vcc_sdhi##idx##_consumer,		\
> > +	.num_consumer_supplies	= 1,					\
> > +};									\
> > +									\
> > +static struct fixed_voltage_config vcc_sdhi##idx##_info = {		\
> > +	.supply_name	= "SDHI" #idx "Vcc",				\
> > +	.microvolts	= 3300000,					\
> > +	.gpio		= vdd_pin,					\
> > +	.enable_high	= 1,						\
> > +	.init_data	= &vcc_sdhi##idx##_init_data,			\
> > +};									\
> > +									\
> > +static struct regulator_consumer_supply vccq_sdhi##idx##_consumer=	\
> > +	REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi." #idx);		\
> > +									\
> > +static struct regulator_init_data vccq_sdhi##idx##_init_data = {	\
> > +	.constraints = {						\
> > +		.input_uV	= 3300000,				\
> > +		.min_uV		= 1800000,				\
> > +		.max_uV		= 3300000,				\
> > +		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |		\
> > +				  REGULATOR_CHANGE_STATUS,		\
> > +	},								\
> > +	.consumer_supplies	= &vccq_sdhi##idx##_consumer,		\
> > +	.num_consumer_supplies	= 1,					\
> > +};									\
> > +									\
> > +static struct gpio vccq_sdhi##idx##_gpio =				\
> > +	{ vccq_pin, GPIOF_OUT_INIT_HIGH, "vccq-sdhi" #idx };		\
> > +									\
> > +static struct gpio_regulator_state vccq_sdhi##idx##_states[] = {	\
> > +	{ .value = 1800000, .gpios = 0 },				\
> > +	{ .value = 3300000, .gpios = 1 },				\
> > +};									\
> > +									\
> > +static struct gpio_regulator_config vccq_sdhi##idx##_info = {		\
> > +	.supply_name	= "vqmmc",					\
> > +	.gpios		= &vccq_sdhi##idx##_gpio,			\
> > +	.nr_gpios	= 1,						\
> > +	.states		= vccq_sdhi##idx##_states,			\
> > +	.nr_states	= ARRAY_SIZE(vccq_sdhi##idx##_states),		\
> > +	.type		= REGULATOR_VOLTAGE,				\
> > +	.init_data	= &vccq_sdhi##idx##_init_data,			\
> > +};
> 
> The vmmc regulator looks fine to me at first sight, but I'm less sure about 
> the vqmmc regulator. The vqmmc supplies are provided by the PMIC, we should 
> ideally use the existing da9063 mfd driver. As this might require a 
> significant amount of work I'm fine with this approach as a quick fix, but I'd 
> like a comment in the source code stating that vqmmc should be handled by the 
> da9063 driver.

Nice catch.
I agree. will do in v2 patch

Best regards
---
Kuninori Morimoto

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 0/16] ARM: shmobile: SDHI support for r8a7790
  2013-11-14 13:46     ` Laurent Pinchart
@ 2013-11-15  0:43       ` Kuninori Morimoto
  -1 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-15  0:43 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Simon, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc


Hi Laurent, Simon

> > These are SDHI support for r8a7790.
> > 
> > Kuninori Morimoto (14):
> >       ARM: shmobile: lager: add SDHI0/2 support
> >       ARM: shmobile: lager: use gpio/fixed regulator for SDHI
> 
> As the second patches fixes a problem in the first one, I'd like to split them 
> differently. Could you please submit a first patch that adds the regulators, 
> and a second patch that adds SDHI0/2 support using the regulators ?

OK, will do in v2 patches.

> Simon

I will resend these 2 patch-set. (= not all 16 patches)

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 0/16] ARM: shmobile: SDHI support for r8a7790
@ 2013-11-15  0:43       ` Kuninori Morimoto
  0 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-15  0:43 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Simon, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc


Hi Laurent, Simon

> > These are SDHI support for r8a7790.
> > 
> > Kuninori Morimoto (14):
> >       ARM: shmobile: lager: add SDHI0/2 support
> >       ARM: shmobile: lager: use gpio/fixed regulator for SDHI
> 
> As the second patches fixes a problem in the first one, I'd like to split them 
> differently. Could you please submit a first patch that adds the regulators, 
> and a second patch that adds SDHI0/2 support using the regulators ?

OK, will do in v2 patches.

> Simon

I will resend these 2 patch-set. (= not all 16 patches)

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 0/16] ARM: shmobile: SDHI support for r8a7790
  2013-11-14 10:34   ` Kuninori Morimoto
@ 2013-11-15  1:53     ` Kuninori Morimoto
  -1 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-15  1:53 UTC (permalink / raw)
  To: Simon; +Cc: Laurent, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc


Hi Simon

These are v2 of SDHI support for r8a7790.

Kuninori Morimoto (2):
      ARM: shmobile: lager: add gpio/fixed regulator for SDHI
      ARM: shmobile: lager: add SDHI0/2 support

 arch/arm/mach-shmobile/board-lager.c |  149 +++++++++++++++++++++++++++++++++-
 1 file changed, 148 insertions(+), 1 deletion(-)

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 0/16] ARM: shmobile: SDHI support for r8a7790
@ 2013-11-15  1:53     ` Kuninori Morimoto
  0 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-15  1:53 UTC (permalink / raw)
  To: Simon; +Cc: Laurent, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc


Hi Simon

These are v2 of SDHI support for r8a7790.

Kuninori Morimoto (2):
      ARM: shmobile: lager: add gpio/fixed regulator for SDHI
      ARM: shmobile: lager: add SDHI0/2 support

 arch/arm/mach-shmobile/board-lager.c |  149 +++++++++++++++++++++++++++++++++-
 1 file changed, 148 insertions(+), 1 deletion(-)

^ permalink raw reply	[flat|nested] 113+ messages in thread

* [PATCH 1/2 v2] ARM: shmobile: lager: add gpio/fixed regulator for SDHI
  2013-11-15  1:53     ` Kuninori Morimoto
@ 2013-11-15  1:55       ` Kuninori Morimoto
  -1 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-15  1:55 UTC (permalink / raw)
  To: Simon; +Cc: Laurent, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

Fixed regulator is used for SDHI0/2 Vcc.
We should use da9063 driver for Vccq,
but, it doesn't have regulator support at this point.
This patch uses gpio-regulator for it as quick-hack.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
v1 -> v2

 - 2/2 become 1/2
 - FIXME comment was added

 arch/arm/mach-shmobile/board-lager.c |   83 +++++++++++++++++++++++++++++++++-
 1 file changed, 82 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-shmobile/board-lager.c b/arch/arm/mach-shmobile/board-lager.c
index fcf06fd..3d1640f 100644
--- a/arch/arm/mach-shmobile/board-lager.c
+++ b/arch/arm/mach-shmobile/board-lager.c
@@ -31,7 +31,9 @@
 #include <linux/platform_data/rcar-du.h>
 #include <linux/platform_device.h>
 #include <linux/phy.h>
+#include <linux/regulator/driver.h>
 #include <linux/regulator/fixed.h>
+#include <linux/regulator/gpio-regulator.h>
 #include <linux/regulator/machine.h>
 #include <linux/sh_eth.h>
 #include <mach/common.h>
@@ -141,6 +143,71 @@ static struct regulator_consumer_supply fixed3v3_power_consumers[]  	REGULATOR_SUPPLY("vmmc", "sh_mmcif.1"),
 };
 
+/*
+ * SDHI regulator macro
+ *
+ ** FIXME**
+ * Lager board vqmmc is provided via DA9063 PMIC chip,
+ * and we should use ${LINK}/drivers/mfd/da9063-* driver for it.
+ * but, it doesn't have regulator support at this point.
+ * It uses gpio-regulator for vqmmc as quick-hack.
+ */
+#define SDHI_REGULATOR(idx, vdd_pin, vccq_pin)				\
+static struct regulator_consumer_supply vcc_sdhi##idx##_consumer =	\
+	REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi." #idx);		\
+									\
+static struct regulator_init_data vcc_sdhi##idx##_init_data = {		\
+	.constraints = {						\
+		.valid_ops_mask = REGULATOR_CHANGE_STATUS,		\
+	},								\
+	.consumer_supplies	= &vcc_sdhi##idx##_consumer,		\
+	.num_consumer_supplies	= 1,					\
+};									\
+									\
+static struct fixed_voltage_config vcc_sdhi##idx##_info = {		\
+	.supply_name	= "SDHI" #idx "Vcc",				\
+	.microvolts	= 3300000,					\
+	.gpio		= vdd_pin,					\
+	.enable_high	= 1,						\
+	.init_data	= &vcc_sdhi##idx##_init_data,			\
+};									\
+									\
+static struct regulator_consumer_supply vccq_sdhi##idx##_consumer=	\
+	REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi." #idx);		\
+									\
+static struct regulator_init_data vccq_sdhi##idx##_init_data = {	\
+	.constraints = {						\
+		.input_uV	= 3300000,				\
+		.min_uV		= 1800000,				\
+		.max_uV		= 3300000,				\
+		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |		\
+				  REGULATOR_CHANGE_STATUS,		\
+	},								\
+	.consumer_supplies	= &vccq_sdhi##idx##_consumer,		\
+	.num_consumer_supplies	= 1,					\
+};									\
+									\
+static struct gpio vccq_sdhi##idx##_gpio =				\
+	{ vccq_pin, GPIOF_OUT_INIT_HIGH, "vccq-sdhi" #idx };		\
+									\
+static struct gpio_regulator_state vccq_sdhi##idx##_states[] = {	\
+	{ .value = 1800000, .gpios = 0 },				\
+	{ .value = 3300000, .gpios = 1 },				\
+};									\
+									\
+static struct gpio_regulator_config vccq_sdhi##idx##_info = {		\
+	.supply_name	= "vqmmc",					\
+	.gpios		= &vccq_sdhi##idx##_gpio,			\
+	.nr_gpios	= 1,						\
+	.states		= vccq_sdhi##idx##_states,			\
+	.nr_states	= ARRAY_SIZE(vccq_sdhi##idx##_states),		\
+	.type		= REGULATOR_VOLTAGE,				\
+	.init_data	= &vccq_sdhi##idx##_init_data,			\
+};
+
+SDHI_REGULATOR(0, RCAR_GP_PIN(5, 24), RCAR_GP_PIN(5, 29));
+SDHI_REGULATOR(2, RCAR_GP_PIN(5, 25), RCAR_GP_PIN(5, 30));
+
 /* MMCIF */
 static const struct sh_mmcif_plat_data mmcif1_pdata __initconst = {
 	.caps		= MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE,
@@ -198,6 +265,9 @@ static const struct pinctrl_map lager_pinctrl_map[] = {
 
 static void __init lager_add_standard_devices(void)
 {
+	int fixed_regulator_idx = 0;
+	int gpio_regulator_idx = 0;
+
 	r8a7790_clock_init();
 
 	pinctrl_register_mappings(lager_pinctrl_map,
@@ -211,7 +281,8 @@ static void __init lager_add_standard_devices(void)
 	platform_device_register_data(&platform_bus, "gpio-keys", -1,
 				      &lager_keys_pdata,
 				      sizeof(lager_keys_pdata));
-	regulator_register_always_on(0, "fixed-3.3V", fixed3v3_power_consumers,
+	regulator_register_always_on(fixed_regulator_idx++,
+				     "fixed-3.3V", fixed3v3_power_consumers,
 				     ARRAY_SIZE(fixed3v3_power_consumers), 3300000);
 	platform_device_register_resndata(&platform_bus, "sh_mmcif", 1,
 					  mmcif1_resources, ARRAY_SIZE(mmcif1_resources),
@@ -223,6 +294,16 @@ static void __init lager_add_standard_devices(void)
 					  &ether_pdata, sizeof(ether_pdata));
 
 	lager_add_du_device();
+
+	platform_device_register_data(&platform_bus, "reg-fixed-voltage", fixed_regulator_idx++,
+				      &vcc_sdhi0_info, sizeof(struct fixed_voltage_config));
+	platform_device_register_data(&platform_bus, "reg-fixed-voltage", fixed_regulator_idx++,
+				      &vcc_sdhi2_info, sizeof(struct fixed_voltage_config));
+
+	platform_device_register_data(&platform_bus, "gpio-regulator", gpio_regulator_idx++,
+				      &vccq_sdhi0_info, sizeof(struct gpio_regulator_config));
+	platform_device_register_data(&platform_bus, "gpio-regulator", gpio_regulator_idx++,
+				      &vccq_sdhi2_info, sizeof(struct gpio_regulator_config));
 }
 
 /*
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH 1/2 v2] ARM: shmobile: lager: add gpio/fixed regulator for SDHI
@ 2013-11-15  1:55       ` Kuninori Morimoto
  0 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-15  1:55 UTC (permalink / raw)
  To: Simon; +Cc: Laurent, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

Fixed regulator is used for SDHI0/2 Vcc.
We should use da9063 driver for Vccq,
but, it doesn't have regulator support at this point.
This patch uses gpio-regulator for it as quick-hack.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
v1 -> v2

 - 2/2 become 1/2
 - FIXME comment was added

 arch/arm/mach-shmobile/board-lager.c |   83 +++++++++++++++++++++++++++++++++-
 1 file changed, 82 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-shmobile/board-lager.c b/arch/arm/mach-shmobile/board-lager.c
index fcf06fd..3d1640f 100644
--- a/arch/arm/mach-shmobile/board-lager.c
+++ b/arch/arm/mach-shmobile/board-lager.c
@@ -31,7 +31,9 @@
 #include <linux/platform_data/rcar-du.h>
 #include <linux/platform_device.h>
 #include <linux/phy.h>
+#include <linux/regulator/driver.h>
 #include <linux/regulator/fixed.h>
+#include <linux/regulator/gpio-regulator.h>
 #include <linux/regulator/machine.h>
 #include <linux/sh_eth.h>
 #include <mach/common.h>
@@ -141,6 +143,71 @@ static struct regulator_consumer_supply fixed3v3_power_consumers[] =
 	REGULATOR_SUPPLY("vmmc", "sh_mmcif.1"),
 };
 
+/*
+ * SDHI regulator macro
+ *
+ ** FIXME**
+ * Lager board vqmmc is provided via DA9063 PMIC chip,
+ * and we should use ${LINK}/drivers/mfd/da9063-* driver for it.
+ * but, it doesn't have regulator support at this point.
+ * It uses gpio-regulator for vqmmc as quick-hack.
+ */
+#define SDHI_REGULATOR(idx, vdd_pin, vccq_pin)				\
+static struct regulator_consumer_supply vcc_sdhi##idx##_consumer =	\
+	REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi." #idx);		\
+									\
+static struct regulator_init_data vcc_sdhi##idx##_init_data = {		\
+	.constraints = {						\
+		.valid_ops_mask = REGULATOR_CHANGE_STATUS,		\
+	},								\
+	.consumer_supplies	= &vcc_sdhi##idx##_consumer,		\
+	.num_consumer_supplies	= 1,					\
+};									\
+									\
+static struct fixed_voltage_config vcc_sdhi##idx##_info = {		\
+	.supply_name	= "SDHI" #idx "Vcc",				\
+	.microvolts	= 3300000,					\
+	.gpio		= vdd_pin,					\
+	.enable_high	= 1,						\
+	.init_data	= &vcc_sdhi##idx##_init_data,			\
+};									\
+									\
+static struct regulator_consumer_supply vccq_sdhi##idx##_consumer=	\
+	REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi." #idx);		\
+									\
+static struct regulator_init_data vccq_sdhi##idx##_init_data = {	\
+	.constraints = {						\
+		.input_uV	= 3300000,				\
+		.min_uV		= 1800000,				\
+		.max_uV		= 3300000,				\
+		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |		\
+				  REGULATOR_CHANGE_STATUS,		\
+	},								\
+	.consumer_supplies	= &vccq_sdhi##idx##_consumer,		\
+	.num_consumer_supplies	= 1,					\
+};									\
+									\
+static struct gpio vccq_sdhi##idx##_gpio =				\
+	{ vccq_pin, GPIOF_OUT_INIT_HIGH, "vccq-sdhi" #idx };		\
+									\
+static struct gpio_regulator_state vccq_sdhi##idx##_states[] = {	\
+	{ .value = 1800000, .gpios = 0 },				\
+	{ .value = 3300000, .gpios = 1 },				\
+};									\
+									\
+static struct gpio_regulator_config vccq_sdhi##idx##_info = {		\
+	.supply_name	= "vqmmc",					\
+	.gpios		= &vccq_sdhi##idx##_gpio,			\
+	.nr_gpios	= 1,						\
+	.states		= vccq_sdhi##idx##_states,			\
+	.nr_states	= ARRAY_SIZE(vccq_sdhi##idx##_states),		\
+	.type		= REGULATOR_VOLTAGE,				\
+	.init_data	= &vccq_sdhi##idx##_init_data,			\
+};
+
+SDHI_REGULATOR(0, RCAR_GP_PIN(5, 24), RCAR_GP_PIN(5, 29));
+SDHI_REGULATOR(2, RCAR_GP_PIN(5, 25), RCAR_GP_PIN(5, 30));
+
 /* MMCIF */
 static const struct sh_mmcif_plat_data mmcif1_pdata __initconst = {
 	.caps		= MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE,
@@ -198,6 +265,9 @@ static const struct pinctrl_map lager_pinctrl_map[] = {
 
 static void __init lager_add_standard_devices(void)
 {
+	int fixed_regulator_idx = 0;
+	int gpio_regulator_idx = 0;
+
 	r8a7790_clock_init();
 
 	pinctrl_register_mappings(lager_pinctrl_map,
@@ -211,7 +281,8 @@ static void __init lager_add_standard_devices(void)
 	platform_device_register_data(&platform_bus, "gpio-keys", -1,
 				      &lager_keys_pdata,
 				      sizeof(lager_keys_pdata));
-	regulator_register_always_on(0, "fixed-3.3V", fixed3v3_power_consumers,
+	regulator_register_always_on(fixed_regulator_idx++,
+				     "fixed-3.3V", fixed3v3_power_consumers,
 				     ARRAY_SIZE(fixed3v3_power_consumers), 3300000);
 	platform_device_register_resndata(&platform_bus, "sh_mmcif", 1,
 					  mmcif1_resources, ARRAY_SIZE(mmcif1_resources),
@@ -223,6 +294,16 @@ static void __init lager_add_standard_devices(void)
 					  &ether_pdata, sizeof(ether_pdata));
 
 	lager_add_du_device();
+
+	platform_device_register_data(&platform_bus, "reg-fixed-voltage", fixed_regulator_idx++,
+				      &vcc_sdhi0_info, sizeof(struct fixed_voltage_config));
+	platform_device_register_data(&platform_bus, "reg-fixed-voltage", fixed_regulator_idx++,
+				      &vcc_sdhi2_info, sizeof(struct fixed_voltage_config));
+
+	platform_device_register_data(&platform_bus, "gpio-regulator", gpio_regulator_idx++,
+				      &vccq_sdhi0_info, sizeof(struct gpio_regulator_config));
+	platform_device_register_data(&platform_bus, "gpio-regulator", gpio_regulator_idx++,
+				      &vccq_sdhi2_info, sizeof(struct gpio_regulator_config));
 }
 
 /*
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH 2/2 v2] ARM: shmobile: lager: add SDHI0/2 support
  2013-11-15  1:53     ` Kuninori Morimoto
@ 2013-11-15  1:56       ` Kuninori Morimoto
  -1 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-15  1:56 UTC (permalink / raw)
  To: Simon; +Cc: Laurent, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

SDHI0 (CN8) needs JP/SW settings

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
v1 -> v2

 - 1/2 patch become 2/2

 arch/arm/mach-shmobile/board-lager.c |   66 ++++++++++++++++++++++++++++++++++
 1 file changed, 66 insertions(+)

diff --git a/arch/arm/mach-shmobile/board-lager.c b/arch/arm/mach-shmobile/board-lager.c
index 3d1640f..f32679a 100644
--- a/arch/arm/mach-shmobile/board-lager.c
+++ b/arch/arm/mach-shmobile/board-lager.c
@@ -24,8 +24,10 @@
 #include <linux/interrupt.h>
 #include <linux/kernel.h>
 #include <linux/leds.h>
+#include <linux/mfd/tmio.h>
 #include <linux/mmc/host.h>
 #include <linux/mmc/sh_mmcif.h>
+#include <linux/mmc/sh_mobile_sdhi.h>
 #include <linux/pinctrl/machine.h>
 #include <linux/platform_data/gpio-rcar.h>
 #include <linux/platform_data/rcar-du.h>
@@ -42,6 +44,19 @@
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 
+/*
+ * SDHI0 (CN8)
+ *
+ * JP3:  pin1
+ * SW20: pin1
+
+ * GP5_24:	1:  VDD  3.3V (defult)
+ *		0:  VDD  0.0V
+ * GP5_29:	1:  VccQ 3.3V (defult)
+ *		0:  VccQ 1.8V
+ *
+ */
+
 /* DU */
 static struct rcar_du_encoder_data lager_du_encoders[] = {
 	{
@@ -233,6 +248,34 @@ static const struct resource ether_resources[] __initconst = {
 	DEFINE_RES_IRQ(gic_spi(162)),
 };
 
+/* SDHI0 */
+static struct sh_mobile_sdhi_info sdhi0_info __initdata = {
+	.tmio_caps	= MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
+			  MMC_CAP_POWER_OFF_CARD,
+	.tmio_caps2	= MMC_CAP2_NO_MULTI_READ,
+	.tmio_flags	= TMIO_MMC_HAS_IDLE_WAIT |
+			  TMIO_MMC_WRPROTECT_DISABLE,
+};
+
+static struct resource sdhi0_resources[] __initdata = {
+	DEFINE_RES_MEM(0xee100000, 0x200),
+	DEFINE_RES_IRQ(gic_spi(165)),
+};
+
+/* SDHI2 */
+static struct sh_mobile_sdhi_info sdhi2_info __initdata = {
+	.tmio_caps	= MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
+			  MMC_CAP_POWER_OFF_CARD,
+	.tmio_caps2	= MMC_CAP2_NO_MULTI_READ,
+	.tmio_flags	= TMIO_MMC_HAS_IDLE_WAIT |
+			  TMIO_MMC_WRPROTECT_DISABLE,
+};
+
+static struct resource sdhi2_resources[] __initdata = {
+	DEFINE_RES_MEM(0xee140000, 0x100),
+	DEFINE_RES_IRQ(gic_spi(167)),
+};
+
 static const struct pinctrl_map lager_pinctrl_map[] = {
 	/* DU (CN10: ARGB0, CN13: LVDS) */
 	PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7790", "pfc-r8a7790",
@@ -241,6 +284,22 @@ static const struct pinctrl_map lager_pinctrl_map[] = {
 				  "du_sync_1", "du"),
 	PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7790", "pfc-r8a7790",
 				  "du_clk_out_0", "du"),
+	/* SDHI */
+	PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7790",
+				  "sdhi0_data4", "sdhi0"),
+	PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7790",
+				  "sdhi0_ctrl", "sdhi0"),
+	PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7790",
+				  "sdhi0_cd", "sdhi0"),
+
+	/* SDHI2 */
+	PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.2", "pfc-r8a7790",
+				  "sdhi2_data4", "sdhi2"),
+	PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.2", "pfc-r8a7790",
+				  "sdhi2_ctrl", "sdhi2"),
+	PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.2", "pfc-r8a7790",
+				  "sdhi2_cd", "sdhi2"),
+
 	/* SCIF0 (CN19: DEBUG SERIAL0) */
 	PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.6", "pfc-r8a7790",
 				  "scif0_data", "scif0"),
@@ -304,6 +363,13 @@ static void __init lager_add_standard_devices(void)
 				      &vccq_sdhi0_info, sizeof(struct gpio_regulator_config));
 	platform_device_register_data(&platform_bus, "gpio-regulator", gpio_regulator_idx++,
 				      &vccq_sdhi2_info, sizeof(struct gpio_regulator_config));
+
+	platform_device_register_resndata(&platform_bus, "sh_mobile_sdhi", 0,
+					  sdhi0_resources, ARRAY_SIZE(sdhi0_resources),
+					  &sdhi0_info, sizeof(struct sh_mobile_sdhi_info));
+	platform_device_register_resndata(&platform_bus, "sh_mobile_sdhi", 2,
+					  sdhi2_resources, ARRAY_SIZE(sdhi2_resources),
+					  &sdhi2_info, sizeof(struct sh_mobile_sdhi_info));
 }
 
 /*
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH 2/2 v2] ARM: shmobile: lager: add SDHI0/2 support
@ 2013-11-15  1:56       ` Kuninori Morimoto
  0 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-15  1:56 UTC (permalink / raw)
  To: Simon; +Cc: Laurent, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

SDHI0 (CN8) needs JP/SW settings

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
v1 -> v2

 - 1/2 patch become 2/2

 arch/arm/mach-shmobile/board-lager.c |   66 ++++++++++++++++++++++++++++++++++
 1 file changed, 66 insertions(+)

diff --git a/arch/arm/mach-shmobile/board-lager.c b/arch/arm/mach-shmobile/board-lager.c
index 3d1640f..f32679a 100644
--- a/arch/arm/mach-shmobile/board-lager.c
+++ b/arch/arm/mach-shmobile/board-lager.c
@@ -24,8 +24,10 @@
 #include <linux/interrupt.h>
 #include <linux/kernel.h>
 #include <linux/leds.h>
+#include <linux/mfd/tmio.h>
 #include <linux/mmc/host.h>
 #include <linux/mmc/sh_mmcif.h>
+#include <linux/mmc/sh_mobile_sdhi.h>
 #include <linux/pinctrl/machine.h>
 #include <linux/platform_data/gpio-rcar.h>
 #include <linux/platform_data/rcar-du.h>
@@ -42,6 +44,19 @@
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 
+/*
+ * SDHI0 (CN8)
+ *
+ * JP3:  pin1
+ * SW20: pin1
+
+ * GP5_24:	1:  VDD  3.3V (defult)
+ *		0:  VDD  0.0V
+ * GP5_29:	1:  VccQ 3.3V (defult)
+ *		0:  VccQ 1.8V
+ *
+ */
+
 /* DU */
 static struct rcar_du_encoder_data lager_du_encoders[] = {
 	{
@@ -233,6 +248,34 @@ static const struct resource ether_resources[] __initconst = {
 	DEFINE_RES_IRQ(gic_spi(162)),
 };
 
+/* SDHI0 */
+static struct sh_mobile_sdhi_info sdhi0_info __initdata = {
+	.tmio_caps	= MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
+			  MMC_CAP_POWER_OFF_CARD,
+	.tmio_caps2	= MMC_CAP2_NO_MULTI_READ,
+	.tmio_flags	= TMIO_MMC_HAS_IDLE_WAIT |
+			  TMIO_MMC_WRPROTECT_DISABLE,
+};
+
+static struct resource sdhi0_resources[] __initdata = {
+	DEFINE_RES_MEM(0xee100000, 0x200),
+	DEFINE_RES_IRQ(gic_spi(165)),
+};
+
+/* SDHI2 */
+static struct sh_mobile_sdhi_info sdhi2_info __initdata = {
+	.tmio_caps	= MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
+			  MMC_CAP_POWER_OFF_CARD,
+	.tmio_caps2	= MMC_CAP2_NO_MULTI_READ,
+	.tmio_flags	= TMIO_MMC_HAS_IDLE_WAIT |
+			  TMIO_MMC_WRPROTECT_DISABLE,
+};
+
+static struct resource sdhi2_resources[] __initdata = {
+	DEFINE_RES_MEM(0xee140000, 0x100),
+	DEFINE_RES_IRQ(gic_spi(167)),
+};
+
 static const struct pinctrl_map lager_pinctrl_map[] = {
 	/* DU (CN10: ARGB0, CN13: LVDS) */
 	PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7790", "pfc-r8a7790",
@@ -241,6 +284,22 @@ static const struct pinctrl_map lager_pinctrl_map[] = {
 				  "du_sync_1", "du"),
 	PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7790", "pfc-r8a7790",
 				  "du_clk_out_0", "du"),
+	/* SDHI */
+	PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7790",
+				  "sdhi0_data4", "sdhi0"),
+	PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7790",
+				  "sdhi0_ctrl", "sdhi0"),
+	PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7790",
+				  "sdhi0_cd", "sdhi0"),
+
+	/* SDHI2 */
+	PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.2", "pfc-r8a7790",
+				  "sdhi2_data4", "sdhi2"),
+	PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.2", "pfc-r8a7790",
+				  "sdhi2_ctrl", "sdhi2"),
+	PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.2", "pfc-r8a7790",
+				  "sdhi2_cd", "sdhi2"),
+
 	/* SCIF0 (CN19: DEBUG SERIAL0) */
 	PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.6", "pfc-r8a7790",
 				  "scif0_data", "scif0"),
@@ -304,6 +363,13 @@ static void __init lager_add_standard_devices(void)
 				      &vccq_sdhi0_info, sizeof(struct gpio_regulator_config));
 	platform_device_register_data(&platform_bus, "gpio-regulator", gpio_regulator_idx++,
 				      &vccq_sdhi2_info, sizeof(struct gpio_regulator_config));
+
+	platform_device_register_resndata(&platform_bus, "sh_mobile_sdhi", 0,
+					  sdhi0_resources, ARRAY_SIZE(sdhi0_resources),
+					  &sdhi0_info, sizeof(struct sh_mobile_sdhi_info));
+	platform_device_register_resndata(&platform_bus, "sh_mobile_sdhi", 2,
+					  sdhi2_resources, ARRAY_SIZE(sdhi2_resources),
+					  &sdhi2_info, sizeof(struct sh_mobile_sdhi_info));
 }
 
 /*
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 113+ messages in thread

* Re: [PATCH 0/16] ARM: shmobile: SDHI support for r8a7790
  2013-11-15  1:53     ` Kuninori Morimoto
@ 2013-11-18  7:21       ` Simon Horman
  -1 siblings, 0 replies; 113+ messages in thread
From: Simon Horman @ 2013-11-18  7:21 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Laurent, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

On Thu, Nov 14, 2013 at 05:53:21PM -0800, Kuninori Morimoto wrote:
> 
> Hi Simon
> 
> These are v2 of SDHI support for r8a7790.
> 
> Kuninori Morimoto (2):
>       ARM: shmobile: lager: add gpio/fixed regulator for SDHI
>       ARM: shmobile: lager: add SDHI0/2 support
> 
>  arch/arm/mach-shmobile/board-lager.c |  149 +++++++++++++++++++++++++++++++++-

Hi Morimoto-san,

I assume that these two patches depend on at least
some of the first 14 patches. Is that correct?

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 0/16] ARM: shmobile: SDHI support for r8a7790
@ 2013-11-18  7:21       ` Simon Horman
  0 siblings, 0 replies; 113+ messages in thread
From: Simon Horman @ 2013-11-18  7:21 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Laurent, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

On Thu, Nov 14, 2013 at 05:53:21PM -0800, Kuninori Morimoto wrote:
> 
> Hi Simon
> 
> These are v2 of SDHI support for r8a7790.
> 
> Kuninori Morimoto (2):
>       ARM: shmobile: lager: add gpio/fixed regulator for SDHI
>       ARM: shmobile: lager: add SDHI0/2 support
> 
>  arch/arm/mach-shmobile/board-lager.c |  149 +++++++++++++++++++++++++++++++++-

Hi Morimoto-san,

I assume that these two patches depend on at least
some of the first 14 patches. Is that correct?

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 0/16] ARM: shmobile: SDHI support for r8a7790
  2013-11-18  7:21       ` Simon Horman
@ 2013-11-18  7:42         ` Kuninori Morimoto
  -1 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-18  7:42 UTC (permalink / raw)
  To: Simon Horman
  Cc: Laurent, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc


Hi Simon

> > These are v2 of SDHI support for r8a7790.
> > 
> > Kuninori Morimoto (2):
> >       ARM: shmobile: lager: add gpio/fixed regulator for SDHI
> >       ARM: shmobile: lager: add SDHI0/2 support
> > 
> >  arch/arm/mach-shmobile/board-lager.c |  149 +++++++++++++++++++++++++++++++++-
> 
> Hi Morimoto-san,
> 
> I assume that these two patches depend on at least
> some of the first 14 patches. Is that correct?

Compile itself is not depend on first 14 patches,
but, it doesn't work correctly without these patches.
So, yes, it depend on 14 patches.

Best regards
---
Kuninori Morimoto

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 0/16] ARM: shmobile: SDHI support for r8a7790
@ 2013-11-18  7:42         ` Kuninori Morimoto
  0 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-18  7:42 UTC (permalink / raw)
  To: Simon Horman
  Cc: Laurent, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc


Hi Simon

> > These are v2 of SDHI support for r8a7790.
> > 
> > Kuninori Morimoto (2):
> >       ARM: shmobile: lager: add gpio/fixed regulator for SDHI
> >       ARM: shmobile: lager: add SDHI0/2 support
> > 
> >  arch/arm/mach-shmobile/board-lager.c |  149 +++++++++++++++++++++++++++++++++-
> 
> Hi Morimoto-san,
> 
> I assume that these two patches depend on at least
> some of the first 14 patches. Is that correct?

Compile itself is not depend on first 14 patches,
but, it doesn't work correctly without these patches.
So, yes, it depend on 14 patches.

Best regards
---
Kuninori Morimoto

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 1/2 v2] ARM: shmobile: lager: add gpio/fixed regulator for SDHI
  2013-11-15  1:55       ` Kuninori Morimoto
@ 2013-11-18 11:35         ` Laurent Pinchart
  -1 siblings, 0 replies; 113+ messages in thread
From: Laurent Pinchart @ 2013-11-18 11:35 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Simon, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

Hi Morimoto-san,

Thank you for the patch.

On Thursday 14 November 2013 17:55:12 Kuninori Morimoto wrote:
> Fixed regulator is used for SDHI0/2 Vcc.
> We should use da9063 driver for Vccq,
> but, it doesn't have regulator support at this point.
> This patch uses gpio-regulator for it as quick-hack.
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
> v1 -> v2
> 
>  - 2/2 become 1/2
>  - FIXME comment was added
> 
>  arch/arm/mach-shmobile/board-lager.c |   83 ++++++++++++++++++++++++++++++-
>  1 file changed, 82 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/mach-shmobile/board-lager.c
> b/arch/arm/mach-shmobile/board-lager.c index fcf06fd..3d1640f 100644
> --- a/arch/arm/mach-shmobile/board-lager.c
> +++ b/arch/arm/mach-shmobile/board-lager.c
> @@ -31,7 +31,9 @@
>  #include <linux/platform_data/rcar-du.h>
>  #include <linux/platform_device.h>
>  #include <linux/phy.h>
> +#include <linux/regulator/driver.h>

I might be mistaken, but is this header really needed ?

>  #include <linux/regulator/fixed.h>
> +#include <linux/regulator/gpio-regulator.h>
>  #include <linux/regulator/machine.h>
>  #include <linux/sh_eth.h>
>  #include <mach/common.h>
> @@ -141,6 +143,71 @@ static struct regulator_consumer_supply
> fixed3v3_power_consumers[] = REGULATOR_SUPPLY("vmmc", "sh_mmcif.1"),
>  };
> 
> +/*
> + * SDHI regulator macro
> + *
> + ** FIXME**
> + * Lager board vqmmc is provided via DA9063 PMIC chip,
> + * and we should use ${LINK}/drivers/mfd/da9063-* driver for it.
> + * but, it doesn't have regulator support at this point.
> + * It uses gpio-regulator for vqmmc as quick-hack.
> + */
> +#define SDHI_REGULATOR(idx, vdd_pin, vccq_pin)				\
> +static struct regulator_consumer_supply vcc_sdhi##idx##_consumer =	\
> +	REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi." #idx);		\
> +									\
> +static struct regulator_init_data vcc_sdhi##idx##_init_data = {		\
> +	.constraints = {						\
> +		.valid_ops_mask = REGULATOR_CHANGE_STATUS,		\
> +	},								\
> +	.consumer_supplies	= &vcc_sdhi##idx##_consumer,		\
> +	.num_consumer_supplies	= 1,					\
> +};									\
> +									\
> +static struct fixed_voltage_config vcc_sdhi##idx##_info = {		\

You can make this structure const.

> +	.supply_name	= "SDHI" #idx "Vcc",				\
> +	.microvolts	= 3300000,					\
> +	.gpio		= vdd_pin,					\
> +	.enable_high	= 1,						\
> +	.init_data	= &vcc_sdhi##idx##_init_data,			\
> +};									\
> +									\
> +static struct regulator_consumer_supply vccq_sdhi##idx##_consumer=	\
> +	REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi." #idx);		\
> +									\
> +static struct regulator_init_data vccq_sdhi##idx##_init_data = {	\
> +	.constraints = {						\
> +		.input_uV	= 3300000,				\
> +		.min_uV		= 1800000,				\
> +		.max_uV		= 3300000,				\
> +		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |		\
> +				  REGULATOR_CHANGE_STATUS,		\
> +	},								\
> +	.consumer_supplies	= &vccq_sdhi##idx##_consumer,		\
> +	.num_consumer_supplies	= 1,					\
> +};									\
> +									\
> +static struct gpio vccq_sdhi##idx##_gpio =				\
> +	{ vccq_pin, GPIOF_OUT_INIT_HIGH, "vccq-sdhi" #idx };		\
> +									\
> +static struct gpio_regulator_state vccq_sdhi##idx##_states[] = {	\
> +	{ .value = 1800000, .gpios = 0 },				\
> +	{ .value = 3300000, .gpios = 1 },				\
> +};									\
> +									\
> +static struct gpio_regulator_config vccq_sdhi##idx##_info = {		\

You can make this structure const.

> +	.supply_name	= "vqmmc",					\
> +	.gpios		= &vccq_sdhi##idx##_gpio,			\
> +	.nr_gpios	= 1,						\
> +	.states		= vccq_sdhi##idx##_states,			\
> +	.nr_states	= ARRAY_SIZE(vccq_sdhi##idx##_states),		\
> +	.type		= REGULATOR_VOLTAGE,				\
> +	.init_data	= &vccq_sdhi##idx##_init_data,			\
> +};
> +
> +SDHI_REGULATOR(0, RCAR_GP_PIN(5, 24), RCAR_GP_PIN(5, 29));
> +SDHI_REGULATOR(2, RCAR_GP_PIN(5, 25), RCAR_GP_PIN(5, 30));
> +
>  /* MMCIF */
>  static const struct sh_mmcif_plat_data mmcif1_pdata __initconst = {
>  	.caps		= MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE,
> @@ -198,6 +265,9 @@ static const struct pinctrl_map lager_pinctrl_map[] = {
> 
>  static void __init lager_add_standard_devices(void)
>  {
> +	int fixed_regulator_idx = 0;
> +	int gpio_regulator_idx = 0;
> +
>  	r8a7790_clock_init();
> 
>  	pinctrl_register_mappings(lager_pinctrl_map,
> @@ -211,7 +281,8 @@ static void __init lager_add_standard_devices(void)
>  	platform_device_register_data(&platform_bus, "gpio-keys", -1,
>  				      &lager_keys_pdata,
>  				      sizeof(lager_keys_pdata));
> -	regulator_register_always_on(0, "fixed-3.3V", fixed3v3_power_consumers,
> +	regulator_register_always_on(fixed_regulator_idx++,
> +				     "fixed-3.3V", fixed3v3_power_consumers,
>  				     ARRAY_SIZE(fixed3v3_power_consumers), 3300000);
>  	platform_device_register_resndata(&platform_bus, "sh_mmcif", 1,
>  					  mmcif1_resources, ARRAY_SIZE(mmcif1_resources),
> @@ -223,6 +294,16 @@ static void __init lager_add_standard_devices(void)
>  					  &ether_pdata, sizeof(ether_pdata));
> 
>  	lager_add_du_device();
> +
> +	platform_device_register_data(&platform_bus, "reg-fixed-voltage",
> fixed_regulator_idx++,
> +				      &vcc_sdhi0_info, sizeof(struct fixed_voltage_config));
> +	platform_device_register_data(&platform_bus, "reg-fixed-voltage",
> fixed_regulator_idx++,
> +				      &vcc_sdhi2_info, sizeof(struct fixed_voltage_config));
> +
> +	platform_device_register_data(&platform_bus, "gpio-regulator",
> gpio_regulator_idx++,
> +				      &vccq_sdhi0_info, sizeof(struct
> gpio_regulator_config));
> +	platform_device_register_data(&platform_bus, "gpio-regulator",
> gpio_regulator_idx++,
> +				      &vccq_sdhi2_info, sizeof(struct
> gpio_regulator_config)); }
> 
>  /*
-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 1/2 v2] ARM: shmobile: lager: add gpio/fixed regulator for SDHI
@ 2013-11-18 11:35         ` Laurent Pinchart
  0 siblings, 0 replies; 113+ messages in thread
From: Laurent Pinchart @ 2013-11-18 11:35 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Simon, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

Hi Morimoto-san,

Thank you for the patch.

On Thursday 14 November 2013 17:55:12 Kuninori Morimoto wrote:
> Fixed regulator is used for SDHI0/2 Vcc.
> We should use da9063 driver for Vccq,
> but, it doesn't have regulator support at this point.
> This patch uses gpio-regulator for it as quick-hack.
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
> v1 -> v2
> 
>  - 2/2 become 1/2
>  - FIXME comment was added
> 
>  arch/arm/mach-shmobile/board-lager.c |   83 ++++++++++++++++++++++++++++++-
>  1 file changed, 82 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/mach-shmobile/board-lager.c
> b/arch/arm/mach-shmobile/board-lager.c index fcf06fd..3d1640f 100644
> --- a/arch/arm/mach-shmobile/board-lager.c
> +++ b/arch/arm/mach-shmobile/board-lager.c
> @@ -31,7 +31,9 @@
>  #include <linux/platform_data/rcar-du.h>
>  #include <linux/platform_device.h>
>  #include <linux/phy.h>
> +#include <linux/regulator/driver.h>

I might be mistaken, but is this header really needed ?

>  #include <linux/regulator/fixed.h>
> +#include <linux/regulator/gpio-regulator.h>
>  #include <linux/regulator/machine.h>
>  #include <linux/sh_eth.h>
>  #include <mach/common.h>
> @@ -141,6 +143,71 @@ static struct regulator_consumer_supply
> fixed3v3_power_consumers[] = REGULATOR_SUPPLY("vmmc", "sh_mmcif.1"),
>  };
> 
> +/*
> + * SDHI regulator macro
> + *
> + ** FIXME**
> + * Lager board vqmmc is provided via DA9063 PMIC chip,
> + * and we should use ${LINK}/drivers/mfd/da9063-* driver for it.
> + * but, it doesn't have regulator support at this point.
> + * It uses gpio-regulator for vqmmc as quick-hack.
> + */
> +#define SDHI_REGULATOR(idx, vdd_pin, vccq_pin)				\
> +static struct regulator_consumer_supply vcc_sdhi##idx##_consumer =	\
> +	REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi." #idx);		\
> +									\
> +static struct regulator_init_data vcc_sdhi##idx##_init_data = {		\
> +	.constraints = {						\
> +		.valid_ops_mask = REGULATOR_CHANGE_STATUS,		\
> +	},								\
> +	.consumer_supplies	= &vcc_sdhi##idx##_consumer,		\
> +	.num_consumer_supplies	= 1,					\
> +};									\
> +									\
> +static struct fixed_voltage_config vcc_sdhi##idx##_info = {		\

You can make this structure const.

> +	.supply_name	= "SDHI" #idx "Vcc",				\
> +	.microvolts	= 3300000,					\
> +	.gpio		= vdd_pin,					\
> +	.enable_high	= 1,						\
> +	.init_data	= &vcc_sdhi##idx##_init_data,			\
> +};									\
> +									\
> +static struct regulator_consumer_supply vccq_sdhi##idx##_consumer=	\
> +	REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi." #idx);		\
> +									\
> +static struct regulator_init_data vccq_sdhi##idx##_init_data = {	\
> +	.constraints = {						\
> +		.input_uV	= 3300000,				\
> +		.min_uV		= 1800000,				\
> +		.max_uV		= 3300000,				\
> +		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |		\
> +				  REGULATOR_CHANGE_STATUS,		\
> +	},								\
> +	.consumer_supplies	= &vccq_sdhi##idx##_consumer,		\
> +	.num_consumer_supplies	= 1,					\
> +};									\
> +									\
> +static struct gpio vccq_sdhi##idx##_gpio =				\
> +	{ vccq_pin, GPIOF_OUT_INIT_HIGH, "vccq-sdhi" #idx };		\
> +									\
> +static struct gpio_regulator_state vccq_sdhi##idx##_states[] = {	\
> +	{ .value = 1800000, .gpios = 0 },				\
> +	{ .value = 3300000, .gpios = 1 },				\
> +};									\
> +									\
> +static struct gpio_regulator_config vccq_sdhi##idx##_info = {		\

You can make this structure const.

> +	.supply_name	= "vqmmc",					\
> +	.gpios		= &vccq_sdhi##idx##_gpio,			\
> +	.nr_gpios	= 1,						\
> +	.states		= vccq_sdhi##idx##_states,			\
> +	.nr_states	= ARRAY_SIZE(vccq_sdhi##idx##_states),		\
> +	.type		= REGULATOR_VOLTAGE,				\
> +	.init_data	= &vccq_sdhi##idx##_init_data,			\
> +};
> +
> +SDHI_REGULATOR(0, RCAR_GP_PIN(5, 24), RCAR_GP_PIN(5, 29));
> +SDHI_REGULATOR(2, RCAR_GP_PIN(5, 25), RCAR_GP_PIN(5, 30));
> +
>  /* MMCIF */
>  static const struct sh_mmcif_plat_data mmcif1_pdata __initconst = {
>  	.caps		= MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE,
> @@ -198,6 +265,9 @@ static const struct pinctrl_map lager_pinctrl_map[] = {
> 
>  static void __init lager_add_standard_devices(void)
>  {
> +	int fixed_regulator_idx = 0;
> +	int gpio_regulator_idx = 0;
> +
>  	r8a7790_clock_init();
> 
>  	pinctrl_register_mappings(lager_pinctrl_map,
> @@ -211,7 +281,8 @@ static void __init lager_add_standard_devices(void)
>  	platform_device_register_data(&platform_bus, "gpio-keys", -1,
>  				      &lager_keys_pdata,
>  				      sizeof(lager_keys_pdata));
> -	regulator_register_always_on(0, "fixed-3.3V", fixed3v3_power_consumers,
> +	regulator_register_always_on(fixed_regulator_idx++,
> +				     "fixed-3.3V", fixed3v3_power_consumers,
>  				     ARRAY_SIZE(fixed3v3_power_consumers), 3300000);
>  	platform_device_register_resndata(&platform_bus, "sh_mmcif", 1,
>  					  mmcif1_resources, ARRAY_SIZE(mmcif1_resources),
> @@ -223,6 +294,16 @@ static void __init lager_add_standard_devices(void)
>  					  &ether_pdata, sizeof(ether_pdata));
> 
>  	lager_add_du_device();
> +
> +	platform_device_register_data(&platform_bus, "reg-fixed-voltage",
> fixed_regulator_idx++,
> +				      &vcc_sdhi0_info, sizeof(struct fixed_voltage_config));
> +	platform_device_register_data(&platform_bus, "reg-fixed-voltage",
> fixed_regulator_idx++,
> +				      &vcc_sdhi2_info, sizeof(struct fixed_voltage_config));
> +
> +	platform_device_register_data(&platform_bus, "gpio-regulator",
> gpio_regulator_idx++,
> +				      &vccq_sdhi0_info, sizeof(struct
> gpio_regulator_config));
> +	platform_device_register_data(&platform_bus, "gpio-regulator",
> gpio_regulator_idx++,
> +				      &vccq_sdhi2_info, sizeof(struct
> gpio_regulator_config)); }
> 
>  /*
-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 01/16] gpio: rcar: use postcore_init()
  2013-11-15  0:26         ` Kuninori Morimoto
@ 2013-11-18 14:00           ` Laurent Pinchart
  -1 siblings, 0 replies; 113+ messages in thread
From: Laurent Pinchart @ 2013-11-18 13:59 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Simon, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto,
	linux-mmc, linus.walleij

Hi Morimoto-san,

(CC'ing Linus Walleij)

On Thursday 14 November 2013 16:26:53 Kuninori Morimoto wrote:
> Hi Laurent
> 
> > > Renesas GPIO is being interlocked with PFC, and GPIO is
> > > very basic system for R-Car.
> > > GPIO should be initialised in same timing as PFC.
> > > The GPIO based system doesn't work correctly without this patch.
> > 
> > Could you please describe the failure in a bit more details ?
> 
> Real kernel log is better than my explain :P
> These series needs gpio-regulator.
> *before* case, sh_mobile_sdhi can't use gpio-regulator because of timing
> issue.
> 
> ----------------- before ---------------------
> ...
> sh-pfc pfc-r8a7790: r8a77900_pfc support registered
> ...
> SDHI0Vcc: Failed to request enable GPIO184: -517
> reg-fixed-voltage reg-fixed-voltage.1: Failed to register regulator: -517
> platform reg-fixed-voltage.1: Driver reg-fixed-voltage requests probe
> deferral SDHI2Vcc: Failed to request enable GPIO185: -517
> reg-fixed-voltage reg-fixed-voltage.2: Failed to register regulator: -517
> platform reg-fixed-voltage.2: Driver reg-fixed-voltage requests probe
> deferral gpio-regulator gpio-regulator.0: Could not obtain regulator
> setting GPIOs: -517 platform gpio-regulator.0: Driver gpio-regulator
> requests probe deferral gpio-regulator gpio-regulator.1: Could not obtain
> regulator setting GPIOs: -517 platform gpio-regulator.1: Driver
> gpio-regulator requests probe deferral ...

Except for the verbosity of the error messages, this looks pretty sane to me. 
Regulator probe gets deferred because the required GPIO isn't accessible yet, 
and the device gets reprobed later on.

I'm not against moving the gpio-rcar initialization to postcore or subsys 
initcall, but in that case I believe we should standardize (or at least try 
to) this across the GPIO drivers. We currently have

$ cat drivers/gpio/gpio-*.c | grep _initcall | grep '^[a-z]' | sed 's/(.*//' | 
sort | uniq -c
      2 arch_initcall
      1 core_initcall
      1 device_initcall
      1 late_initcall
     11 postcore_initcall
      2 pure_initcall
     31 subsys_initcall

$ cat drivers/gpio/gpio-*.c | grep 'module_.*_driver' | sed 's/(.*//' | sort | 
uniq -c
      3 module_i2c_driver
      4 module_pci_driver
     23 module_platform_driver
      1 module_spi_driver

Linus, do you have any guidelines on this ?

> gpio_rcar gpio_rcar.0: driving 32 GPIOs
> gpio_rcar gpio_rcar.1: driving 32 GPIOs
> gpio_rcar gpio_rcar.2: driving 32 GPIOs
> gpio_rcar gpio_rcar.3: driving 32 GPIOs
> gpio_rcar gpio_rcar.4: driving 32 GPIOs
> gpio_rcar gpio_rcar.5: driving 32 GPIOs
> ...
> sh_mobile_sdhi sh_mobile_sdhi.0: mmc0 base at 0xee100000 clock rate 97 MHz
> sh_mobile_sdhi sh_mobile_sdhi.2: mmc1 base at 0xee140000 clock rate 48 MHz
> ...
> SDHI0Vcc: 3300 mV
> SDHI2Vcc: 3300 mV
> vqmmc: 1800 <--> 3300 mV at 3300 mV
> vqmmc: 1800 <--> 3300 mV at 3300 mV
> ...
> 
> ---------------- after ------------------
> ...
> sh-pfc pfc-r8a7790: r8a77900_pfc support registered
> gpio_rcar gpio_rcar.0: driving 32 GPIOs
> gpio_rcar gpio_rcar.1: driving 32 GPIOs
> gpio_rcar gpio_rcar.2: driving 32 GPIOs
> gpio_rcar gpio_rcar.3: driving 32 GPIOs
> gpio_rcar gpio_rcar.4: driving 32 GPIOs
> gpio_rcar gpio_rcar.5: driving 32 GPIOs
> ...
> SDHI0Vcc: 3300 mV
> SDHI2Vcc: 3300 mV
> vqmmc: 1800 <--> 3300 mV at 3300 mV
> vqmmc: 1800 <--> 3300 mV at 3300 mV
> ...
> sh_mobile_sdhi sh_mobile_sdhi.0: mmc0 base at 0xee100000 clock rate 97 MHz
> sh_mobile_sdhi sh_mobile_sdhi.2: mmc1 base at 0xee140000 clock rate 48 MHz

-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 01/16] gpio: rcar: use postcore_init()
@ 2013-11-18 14:00           ` Laurent Pinchart
  0 siblings, 0 replies; 113+ messages in thread
From: Laurent Pinchart @ 2013-11-18 14:00 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Simon, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto,
	linux-mmc, linus.walleij

Hi Morimoto-san,

(CC'ing Linus Walleij)

On Thursday 14 November 2013 16:26:53 Kuninori Morimoto wrote:
> Hi Laurent
> 
> > > Renesas GPIO is being interlocked with PFC, and GPIO is
> > > very basic system for R-Car.
> > > GPIO should be initialised in same timing as PFC.
> > > The GPIO based system doesn't work correctly without this patch.
> > 
> > Could you please describe the failure in a bit more details ?
> 
> Real kernel log is better than my explain :P
> These series needs gpio-regulator.
> *before* case, sh_mobile_sdhi can't use gpio-regulator because of timing
> issue.
> 
> ----------------- before ---------------------
> ...
> sh-pfc pfc-r8a7790: r8a77900_pfc support registered
> ...
> SDHI0Vcc: Failed to request enable GPIO184: -517
> reg-fixed-voltage reg-fixed-voltage.1: Failed to register regulator: -517
> platform reg-fixed-voltage.1: Driver reg-fixed-voltage requests probe
> deferral SDHI2Vcc: Failed to request enable GPIO185: -517
> reg-fixed-voltage reg-fixed-voltage.2: Failed to register regulator: -517
> platform reg-fixed-voltage.2: Driver reg-fixed-voltage requests probe
> deferral gpio-regulator gpio-regulator.0: Could not obtain regulator
> setting GPIOs: -517 platform gpio-regulator.0: Driver gpio-regulator
> requests probe deferral gpio-regulator gpio-regulator.1: Could not obtain
> regulator setting GPIOs: -517 platform gpio-regulator.1: Driver
> gpio-regulator requests probe deferral ...

Except for the verbosity of the error messages, this looks pretty sane to me. 
Regulator probe gets deferred because the required GPIO isn't accessible yet, 
and the device gets reprobed later on.

I'm not against moving the gpio-rcar initialization to postcore or subsys 
initcall, but in that case I believe we should standardize (or at least try 
to) this across the GPIO drivers. We currently have

$ cat drivers/gpio/gpio-*.c | grep _initcall | grep '^[a-z]' | sed 's/(.*//' | 
sort | uniq -c
      2 arch_initcall
      1 core_initcall
      1 device_initcall
      1 late_initcall
     11 postcore_initcall
      2 pure_initcall
     31 subsys_initcall

$ cat drivers/gpio/gpio-*.c | grep 'module_.*_driver' | sed 's/(.*//' | sort | 
uniq -c
      3 module_i2c_driver
      4 module_pci_driver
     23 module_platform_driver
      1 module_spi_driver

Linus, do you have any guidelines on this ?

> gpio_rcar gpio_rcar.0: driving 32 GPIOs
> gpio_rcar gpio_rcar.1: driving 32 GPIOs
> gpio_rcar gpio_rcar.2: driving 32 GPIOs
> gpio_rcar gpio_rcar.3: driving 32 GPIOs
> gpio_rcar gpio_rcar.4: driving 32 GPIOs
> gpio_rcar gpio_rcar.5: driving 32 GPIOs
> ...
> sh_mobile_sdhi sh_mobile_sdhi.0: mmc0 base at 0xee100000 clock rate 97 MHz
> sh_mobile_sdhi sh_mobile_sdhi.2: mmc1 base at 0xee140000 clock rate 48 MHz
> ...
> SDHI0Vcc: 3300 mV
> SDHI2Vcc: 3300 mV
> vqmmc: 1800 <--> 3300 mV at 3300 mV
> vqmmc: 1800 <--> 3300 mV at 3300 mV
> ...
> 
> ---------------- after ------------------
> ...
> sh-pfc pfc-r8a7790: r8a77900_pfc support registered
> gpio_rcar gpio_rcar.0: driving 32 GPIOs
> gpio_rcar gpio_rcar.1: driving 32 GPIOs
> gpio_rcar gpio_rcar.2: driving 32 GPIOs
> gpio_rcar gpio_rcar.3: driving 32 GPIOs
> gpio_rcar gpio_rcar.4: driving 32 GPIOs
> gpio_rcar gpio_rcar.5: driving 32 GPIOs
> ...
> SDHI0Vcc: 3300 mV
> SDHI2Vcc: 3300 mV
> vqmmc: 1800 <--> 3300 mV at 3300 mV
> vqmmc: 1800 <--> 3300 mV at 3300 mV
> ...
> sh_mobile_sdhi sh_mobile_sdhi.0: mmc0 base at 0xee100000 clock rate 97 MHz
> sh_mobile_sdhi sh_mobile_sdhi.2: mmc1 base at 0xee140000 clock rate 48 MHz

-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 1/2 v2] ARM: shmobile: lager: add gpio/fixed regulator for SDHI
  2013-11-18 11:35         ` Laurent Pinchart
@ 2013-11-19  5:14           ` Kuninori Morimoto
  -1 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-19  5:14 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Simon, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc


Hi Laurent

> >  #include <linux/platform_data/rcar-du.h>
> >  #include <linux/platform_device.h>
> >  #include <linux/phy.h>
> > +#include <linux/regulator/driver.h>
> 
> I might be mistaken, but is this header really needed ?

Unfortunately, the compile will error without it.
regulator_xxx / REGULATOR_XXX need it

> > +static struct fixed_voltage_config vcc_sdhi##idx##_info = {		\
> 
> You can make this structure const.
(snip)
> > +static struct gpio_regulator_config vccq_sdhi##idx##_info = {		\
> 
> You can make this structure const.

I see.
Thank you

Best regards
---
Kuninori Morimoto

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 1/2 v2] ARM: shmobile: lager: add gpio/fixed regulator for SDHI
@ 2013-11-19  5:14           ` Kuninori Morimoto
  0 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-19  5:14 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Simon, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc


Hi Laurent

> >  #include <linux/platform_data/rcar-du.h>
> >  #include <linux/platform_device.h>
> >  #include <linux/phy.h>
> > +#include <linux/regulator/driver.h>
> 
> I might be mistaken, but is this header really needed ?

Unfortunately, the compile will error without it.
regulator_xxx / REGULATOR_XXX need it

> > +static struct fixed_voltage_config vcc_sdhi##idx##_info = {		\
> 
> You can make this structure const.
(snip)
> > +static struct gpio_regulator_config vccq_sdhi##idx##_info = {		\
> 
> You can make this structure const.

I see.
Thank you

Best regards
---
Kuninori Morimoto

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 01/16] gpio: rcar: use postcore_init()
  2013-11-18 14:00           ` Laurent Pinchart
@ 2013-11-19  9:57             ` Linus Walleij
  -1 siblings, 0 replies; 113+ messages in thread
From: Linus Walleij @ 2013-11-19  9:57 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Kuninori Morimoto, Simon, Chris Ball, Magnus, Linux-SH,
	Kuninori Morimoto, linux-mmc

On Mon, Nov 18, 2013 at 3:00 PM, Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:

> I'm not against moving the gpio-rcar initialization to postcore or subsys
> initcall, but in that case I believe we should standardize (or at least try
> to) this across the GPIO drivers. We currently have
>
> $ cat drivers/gpio/gpio-*.c | grep _initcall | grep '^[a-z]' | sed 's/(.*//' |
> sort | uniq -c
>       2 arch_initcall
>       1 core_initcall
>       1 device_initcall
>       1 late_initcall
>      11 postcore_initcall
>       2 pure_initcall
>      31 subsys_initcall
>
> $ cat drivers/gpio/gpio-*.c | grep 'module_.*_driver' | sed 's/(.*//' | sort |
> uniq -c
>       3 module_i2c_driver
>       4 module_pci_driver
>      23 module_platform_driver
>       1 module_spi_driver
>
> Linus, do you have any guidelines on this ?

The general guideline, as everybody should be aware ;-) is that we
should always use module_init(), i.e. device_initcall() and let deferred
probe handle any dependencies.

The only exception would be things like timers and interrupt
controllers...

Usually not relying on deferred probe is a sign of bugs in the
deferral probe path.

I know "my" drivers have this problem too, I would prefer that we
try to fix the root issue instead of trying to shovel initcalls around.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 01/16] gpio: rcar: use postcore_init()
@ 2013-11-19  9:57             ` Linus Walleij
  0 siblings, 0 replies; 113+ messages in thread
From: Linus Walleij @ 2013-11-19  9:57 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Kuninori Morimoto, Simon, Chris Ball, Magnus, Linux-SH,
	Kuninori Morimoto, linux-mmc

On Mon, Nov 18, 2013 at 3:00 PM, Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:

> I'm not against moving the gpio-rcar initialization to postcore or subsys
> initcall, but in that case I believe we should standardize (or at least try
> to) this across the GPIO drivers. We currently have
>
> $ cat drivers/gpio/gpio-*.c | grep _initcall | grep '^[a-z]' | sed 's/(.*//' |
> sort | uniq -c
>       2 arch_initcall
>       1 core_initcall
>       1 device_initcall
>       1 late_initcall
>      11 postcore_initcall
>       2 pure_initcall
>      31 subsys_initcall
>
> $ cat drivers/gpio/gpio-*.c | grep 'module_.*_driver' | sed 's/(.*//' | sort |
> uniq -c
>       3 module_i2c_driver
>       4 module_pci_driver
>      23 module_platform_driver
>       1 module_spi_driver
>
> Linus, do you have any guidelines on this ?

The general guideline, as everybody should be aware ;-) is that we
should always use module_init(), i.e. device_initcall() and let deferred
probe handle any dependencies.

The only exception would be things like timers and interrupt
controllers...

Usually not relying on deferred probe is a sign of bugs in the
deferral probe path.

I know "my" drivers have this problem too, I would prefer that we
try to fix the root issue instead of trying to shovel initcalls around.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 01/16] gpio: rcar: use postcore_init()
  2013-11-19  9:57             ` Linus Walleij
@ 2013-11-19 12:36               ` Laurent Pinchart
  -1 siblings, 0 replies; 113+ messages in thread
From: Laurent Pinchart @ 2013-11-19 12:36 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Kuninori Morimoto, Simon, Chris Ball, Magnus, Linux-SH,
	Kuninori Morimoto, linux-mmc

Hi Linus,

On Tuesday 19 November 2013 10:57:43 Linus Walleij wrote:
> On Mon, Nov 18, 2013 at 3:00 PM, Laurent Pinchart wrote:
> > I'm not against moving the gpio-rcar initialization to postcore or subsys
> > initcall, but in that case I believe we should standardize (or at least
> > try
> > to) this across the GPIO drivers. We currently have
> > 
> > $ cat drivers/gpio/gpio-*.c | grep _initcall | grep '^[a-z]' | sed
> > 's/(.*//' | sort | uniq -c
> >       2 arch_initcall
> >       1 core_initcall
> >       1 device_initcall
> >       1 late_initcall
> >      11 postcore_initcall
> >       2 pure_initcall
> >      31 subsys_initcall
> > 
> > $ cat drivers/gpio/gpio-*.c | grep 'module_.*_driver' | sed 's/(.*//' |
> > sort | uniq -c
> >       3 module_i2c_driver
> >       4 module_pci_driver
> >      23 module_platform_driver
> >       1 module_spi_driver
> > 
> > Linus, do you have any guidelines on this ?
> 
> The general guideline, as everybody should be aware ;-) is that we
> should always use module_init(), i.e. device_initcall() and let deferred
> probe handle any dependencies.

Thought so, good :-)

> The only exception would be things like timers and interrupt controllers...

I wouldn't be against moving regulators and gpios one level up in the initcall 
order, given that they provide resources used by a very large number of 
drivers. That would be an optimization only though, and not a work around 
broken probe deferral paths.

> Usually not relying on deferred probe is a sign of bugs in the deferral
> probe path.
> 
> I know "my" drivers have this problem too, I would prefer that we try to fix
> the root issue instead of trying to shovel initcalls around.

Sounds good to me.

-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 01/16] gpio: rcar: use postcore_init()
@ 2013-11-19 12:36               ` Laurent Pinchart
  0 siblings, 0 replies; 113+ messages in thread
From: Laurent Pinchart @ 2013-11-19 12:36 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Kuninori Morimoto, Simon, Chris Ball, Magnus, Linux-SH,
	Kuninori Morimoto, linux-mmc

Hi Linus,

On Tuesday 19 November 2013 10:57:43 Linus Walleij wrote:
> On Mon, Nov 18, 2013 at 3:00 PM, Laurent Pinchart wrote:
> > I'm not against moving the gpio-rcar initialization to postcore or subsys
> > initcall, but in that case I believe we should standardize (or at least
> > try
> > to) this across the GPIO drivers. We currently have
> > 
> > $ cat drivers/gpio/gpio-*.c | grep _initcall | grep '^[a-z]' | sed
> > 's/(.*//' | sort | uniq -c
> >       2 arch_initcall
> >       1 core_initcall
> >       1 device_initcall
> >       1 late_initcall
> >      11 postcore_initcall
> >       2 pure_initcall
> >      31 subsys_initcall
> > 
> > $ cat drivers/gpio/gpio-*.c | grep 'module_.*_driver' | sed 's/(.*//' |
> > sort | uniq -c
> >       3 module_i2c_driver
> >       4 module_pci_driver
> >      23 module_platform_driver
> >       1 module_spi_driver
> > 
> > Linus, do you have any guidelines on this ?
> 
> The general guideline, as everybody should be aware ;-) is that we
> should always use module_init(), i.e. device_initcall() and let deferred
> probe handle any dependencies.

Thought so, good :-)

> The only exception would be things like timers and interrupt controllers...

I wouldn't be against moving regulators and gpios one level up in the initcall 
order, given that they provide resources used by a very large number of 
drivers. That would be an optimization only though, and not a work around 
broken probe deferral paths.

> Usually not relying on deferred probe is a sign of bugs in the deferral
> probe path.
> 
> I know "my" drivers have this problem too, I would prefer that we try to fix
> the root issue instead of trying to shovel initcalls around.

Sounds good to me.

-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 1/2 v2] ARM: shmobile: lager: add gpio/fixed regulator for SDHI
  2013-11-19  5:14           ` Kuninori Morimoto
@ 2013-11-19 12:45             ` Laurent Pinchart
  -1 siblings, 0 replies; 113+ messages in thread
From: Laurent Pinchart @ 2013-11-19 12:45 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Simon, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

Hi Morimoto-san,

On Monday 18 November 2013 21:14:15 Kuninori Morimoto wrote:
> Hi Laurent
> 
> > >  #include <linux/platform_data/rcar-du.h>
> > >  #include <linux/platform_device.h>
> > >  #include <linux/phy.h>
> > > 
> > > +#include <linux/regulator/driver.h>
> > 
> > I might be mistaken, but is this header really needed ?
> 
> Unfortunately, the compile will error without it.
> regulator_xxx / REGULATOR_XXX need it

I believe you should include regulator/machine.h instead of 
regulator/driver.h.

> > > +static struct fixed_voltage_config vcc_sdhi##idx##_info = {		\
> > 
> > You can make this structure const.
> 
> (snip)
> 
> > > +static struct gpio_regulator_config vccq_sdhi##idx##_info = {		\
> > 
> > You can make this structure const.
> 
> I see.
> Thank you

-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 1/2 v2] ARM: shmobile: lager: add gpio/fixed regulator for SDHI
@ 2013-11-19 12:45             ` Laurent Pinchart
  0 siblings, 0 replies; 113+ messages in thread
From: Laurent Pinchart @ 2013-11-19 12:45 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Simon, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

Hi Morimoto-san,

On Monday 18 November 2013 21:14:15 Kuninori Morimoto wrote:
> Hi Laurent
> 
> > >  #include <linux/platform_data/rcar-du.h>
> > >  #include <linux/platform_device.h>
> > >  #include <linux/phy.h>
> > > 
> > > +#include <linux/regulator/driver.h>
> > 
> > I might be mistaken, but is this header really needed ?
> 
> Unfortunately, the compile will error without it.
> regulator_xxx / REGULATOR_XXX need it

I believe you should include regulator/machine.h instead of 
regulator/driver.h.

> > > +static struct fixed_voltage_config vcc_sdhi##idx##_info = {		\
> > 
> > You can make this structure const.
> 
> (snip)
> 
> > > +static struct gpio_regulator_config vccq_sdhi##idx##_info = {		\
> > 
> > You can make this structure const.
> 
> I see.
> Thank you

-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 0/16] SDHI support for r8a7790
  2013-11-14 10:16 ` Kuninori Morimoto
@ 2013-11-20  0:43   ` Kuninori Morimoto
  -1 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-20  0:43 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Simon, Laurent, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto,
	linux-mmc


Hi Simon, Chris, Laurent

I will send v2 patch series for these patches.
At that time, these are separated into small patch-set,
not full-patch-set.

> These are SDHI support for r8a7790.
> But, these are
> 
> 1. bug fix patchset for mmc/sdhi
> 2. bug fix for SH-ARM
> 3. new feature for mmc
> 4. new feature for SH-ARM
> 
> all these patches are needed, but, to different maintainer.
> I send these with separate set
> 
> Kuninori Morimoto (14):
>       gpio: rcar: use postcore_init()
>       mmc: tmio: don't overwrite caps2
>       ARM: shmobile: marzen: remove SDHI0 WP pin setting from DTS
>       ARM: shmobile: marzen: remove SDHI0 WP pin setting
>       ARM: shmobile: sh73a0: fixup sdhi compatible name
>       mmc: tmio: bus_shift become tmio_mmc_data member
>       mmc: tmio: add new TMIO_MMC_HAVE_HIGH_REG flags
>       mmc: SDHI: add SoC specific workaround via HW version
>       mmc: SDHI: tidyup sh_mobile_sdhi_of_match position
>       mmc: SDHI: updata sh_mobile_sdhi_of_data for r8a7778
>       mmc: SDHI: updata sh_mobile_sdhi_of_data for r8a7779
>       mmc: SDHI: updata sh_mobile_sdhi_of_data for r8a7790
>       ARM: shmobile: lager: add SDHI0/2 support
>       ARM: shmobile: lager: use gpio/fixed regulator for SDHI
> 
> Shinobu Uehara (2):
>       mmc: tmio: Fix odd size access
>       mmc: tmio: Add error IRQ status clear
> 
>  arch/arm/boot/dts/r8a7778-bockw-reference.dts  |    4 +-
>  arch/arm/boot/dts/r8a7778.dtsi                 |    6 -
>  arch/arm/boot/dts/r8a7779-marzen-reference.dts |    3 +-
>  arch/arm/boot/dts/r8a7779.dtsi                 |    8 --
>  arch/arm/boot/dts/sh73a0.dtsi                  |    6 +-
>  arch/arm/mach-shmobile/board-lager.c           |  144 +++++++++++++++++++++++-
>  arch/arm/mach-shmobile/board-marzen.c          |    2 -
>  arch/sh/boards/board-sh7757lcr.c               |    2 +-
>  drivers/gpio/gpio-rcar.c                       |   12 +-
>  drivers/mmc/host/sh_mobile_sdhi.c              |   60 +++++++---
>  drivers/mmc/host/tmio_mmc.c                    |    9 ++
>  drivers/mmc/host/tmio_mmc.h                    |   17 ++-
>  drivers/mmc/host/tmio_mmc_dma.c                |    2 +-
>  drivers/mmc/host/tmio_mmc_pio.c                |   28 ++---
>  include/linux/mfd/tmio.h                       |    8 ++
>  include/linux/mmc/tmio.h                       |    1 +
>  16 files changed, 247 insertions(+), 65 deletions(-)


Best regards
---
Kuninori Morimoto

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 0/16] SDHI support for r8a7790
@ 2013-11-20  0:43   ` Kuninori Morimoto
  0 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-20  0:43 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Simon, Laurent, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto,
	linux-mmc


Hi Simon, Chris, Laurent

I will send v2 patch series for these patches.
At that time, these are separated into small patch-set,
not full-patch-set.

> These are SDHI support for r8a7790.
> But, these are
> 
> 1. bug fix patchset for mmc/sdhi
> 2. bug fix for SH-ARM
> 3. new feature for mmc
> 4. new feature for SH-ARM
> 
> all these patches are needed, but, to different maintainer.
> I send these with separate set
> 
> Kuninori Morimoto (14):
>       gpio: rcar: use postcore_init()
>       mmc: tmio: don't overwrite caps2
>       ARM: shmobile: marzen: remove SDHI0 WP pin setting from DTS
>       ARM: shmobile: marzen: remove SDHI0 WP pin setting
>       ARM: shmobile: sh73a0: fixup sdhi compatible name
>       mmc: tmio: bus_shift become tmio_mmc_data member
>       mmc: tmio: add new TMIO_MMC_HAVE_HIGH_REG flags
>       mmc: SDHI: add SoC specific workaround via HW version
>       mmc: SDHI: tidyup sh_mobile_sdhi_of_match position
>       mmc: SDHI: updata sh_mobile_sdhi_of_data for r8a7778
>       mmc: SDHI: updata sh_mobile_sdhi_of_data for r8a7779
>       mmc: SDHI: updata sh_mobile_sdhi_of_data for r8a7790
>       ARM: shmobile: lager: add SDHI0/2 support
>       ARM: shmobile: lager: use gpio/fixed regulator for SDHI
> 
> Shinobu Uehara (2):
>       mmc: tmio: Fix odd size access
>       mmc: tmio: Add error IRQ status clear
> 
>  arch/arm/boot/dts/r8a7778-bockw-reference.dts  |    4 +-
>  arch/arm/boot/dts/r8a7778.dtsi                 |    6 -
>  arch/arm/boot/dts/r8a7779-marzen-reference.dts |    3 +-
>  arch/arm/boot/dts/r8a7779.dtsi                 |    8 --
>  arch/arm/boot/dts/sh73a0.dtsi                  |    6 +-
>  arch/arm/mach-shmobile/board-lager.c           |  144 +++++++++++++++++++++++-
>  arch/arm/mach-shmobile/board-marzen.c          |    2 -
>  arch/sh/boards/board-sh7757lcr.c               |    2 +-
>  drivers/gpio/gpio-rcar.c                       |   12 +-
>  drivers/mmc/host/sh_mobile_sdhi.c              |   60 +++++++---
>  drivers/mmc/host/tmio_mmc.c                    |    9 ++
>  drivers/mmc/host/tmio_mmc.h                    |   17 ++-
>  drivers/mmc/host/tmio_mmc_dma.c                |    2 +-
>  drivers/mmc/host/tmio_mmc_pio.c                |   28 ++---
>  include/linux/mfd/tmio.h                       |    8 ++
>  include/linux/mmc/tmio.h                       |    1 +
>  16 files changed, 247 insertions(+), 65 deletions(-)


Best regards
---
Kuninori Morimoto

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 1/2 v2] ARM: shmobile: lager: add gpio/fixed regulator for SDHI
  2013-11-19 12:45             ` Laurent Pinchart
@ 2013-11-20  7:37               ` Kuninori Morimoto
  -1 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-20  7:37 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Simon, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc


Hi Laurent

> > > >  #include <linux/platform_data/rcar-du.h>
> > > >  #include <linux/platform_device.h>
> > > >  #include <linux/phy.h>
> > > > 
> > > > +#include <linux/regulator/driver.h>
> > > 
> > > I might be mistaken, but is this header really needed ?
> > 
> > Unfortunately, the compile will error without it.
> > regulator_xxx / REGULATOR_XXX need it
> 
> I believe you should include regulator/machine.h instead of 
> regulator/driver.h.

This is the result.
What is your opinion ?

--- with regulator/machine.h --------
  CC      arch/arm/mach-shmobile/board-lager.o
In file included from /opt/usr/src/WORK/morimoto/gitlinux/linux/arch/arm/mach-shmobile/board-lager.c:36:0:
/opt/usr/src/WORK/morimoto/gitlinux/linux/include/linux/regulator/gpio-regulator.h:83:22: error: field 'type' has incomplete type
/opt/usr/src/WORK/morimoto/gitlinux/linux/arch/arm/mach-shmobile/board-lager.c:208:1: error: 'REGULATOR_VOLTAGE' undeclared here (not in a function)

--- with regulator/driver.h ------
  CC      arch/arm/mach-shmobile/board-lager.o
(no error)

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 1/2 v2] ARM: shmobile: lager: add gpio/fixed regulator for SDHI
@ 2013-11-20  7:37               ` Kuninori Morimoto
  0 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-20  7:37 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Simon, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc


Hi Laurent

> > > >  #include <linux/platform_data/rcar-du.h>
> > > >  #include <linux/platform_device.h>
> > > >  #include <linux/phy.h>
> > > > 
> > > > +#include <linux/regulator/driver.h>
> > > 
> > > I might be mistaken, but is this header really needed ?
> > 
> > Unfortunately, the compile will error without it.
> > regulator_xxx / REGULATOR_XXX need it
> 
> I believe you should include regulator/machine.h instead of 
> regulator/driver.h.

This is the result.
What is your opinion ?

--- with regulator/machine.h --------
  CC      arch/arm/mach-shmobile/board-lager.o
In file included from /opt/usr/src/WORK/morimoto/gitlinux/linux/arch/arm/mach-shmobile/board-lager.c:36:0:
/opt/usr/src/WORK/morimoto/gitlinux/linux/include/linux/regulator/gpio-regulator.h:83:22: error: field 'type' has incomplete type
/opt/usr/src/WORK/morimoto/gitlinux/linux/arch/arm/mach-shmobile/board-lager.c:208:1: error: 'REGULATOR_VOLTAGE' undeclared here (not in a function)

--- with regulator/driver.h ------
  CC      arch/arm/mach-shmobile/board-lager.o
(no error)

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 1/2 v2] ARM: shmobile: lager: add gpio/fixed regulator for SDHI
  2013-11-20  7:37               ` Kuninori Morimoto
@ 2013-11-20 10:57                 ` Laurent Pinchart
  -1 siblings, 0 replies; 113+ messages in thread
From: Laurent Pinchart @ 2013-11-20 10:57 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Simon, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

Hi Morimoto-san,

On Tuesday 19 November 2013 23:37:32 Kuninori Morimoto wrote:
> Hi Laurent
> 
> > > > >  #include <linux/platform_data/rcar-du.h>
> > > > >  #include <linux/platform_device.h>
> > > > >  #include <linux/phy.h>
> > > > > 
> > > > > +#include <linux/regulator/driver.h>
> > > > 
> > > > I might be mistaken, but is this header really needed ?
> > > 
> > > Unfortunately, the compile will error without it.
> > > regulator_xxx / REGULATOR_XXX need it
> > 
> > I believe you should include regulator/machine.h instead of
> > regulator/driver.h.
> 
> This is the result.
> What is your opinion ?
> 
> --- with regulator/machine.h --------
>   CC      arch/arm/mach-shmobile/board-lager.o
> In file included from
> /opt/usr/src/WORK/morimoto/gitlinux/linux/arch/arm/mach-shmobile/board-lage
> r.c:36:0:
> /opt/usr/src/WORK/morimoto/gitlinux/linux/include/linux/regulator/gpio-regu
> lator.h:83:22: error: field 'type' has incomplete type
> /opt/usr/src/WORK/morimoto/gitlinux/linux/arch/arm/mach-shmobile/board-lage
> r.c:208:1: error: 'REGULATOR_VOLTAGE' undeclared here (not in a function)
> 
> --- with regulator/driver.h ------
>   CC      arch/arm/mach-shmobile/board-lager.o
> (no error)

I believe the enum regulator_type definition should be moved out of 
regulator/driver.h, but that's out of scope of this patch set, so I'm fine 
with including regulator/driver.h for now.

-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 1/2 v2] ARM: shmobile: lager: add gpio/fixed regulator for SDHI
@ 2013-11-20 10:57                 ` Laurent Pinchart
  0 siblings, 0 replies; 113+ messages in thread
From: Laurent Pinchart @ 2013-11-20 10:57 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Simon, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

Hi Morimoto-san,

On Tuesday 19 November 2013 23:37:32 Kuninori Morimoto wrote:
> Hi Laurent
> 
> > > > >  #include <linux/platform_data/rcar-du.h>
> > > > >  #include <linux/platform_device.h>
> > > > >  #include <linux/phy.h>
> > > > > 
> > > > > +#include <linux/regulator/driver.h>
> > > > 
> > > > I might be mistaken, but is this header really needed ?
> > > 
> > > Unfortunately, the compile will error without it.
> > > regulator_xxx / REGULATOR_XXX need it
> > 
> > I believe you should include regulator/machine.h instead of
> > regulator/driver.h.
> 
> This is the result.
> What is your opinion ?
> 
> --- with regulator/machine.h --------
>   CC      arch/arm/mach-shmobile/board-lager.o
> In file included from
> /opt/usr/src/WORK/morimoto/gitlinux/linux/arch/arm/mach-shmobile/board-lage
> r.c:36:0:
> /opt/usr/src/WORK/morimoto/gitlinux/linux/include/linux/regulator/gpio-regu
> lator.h:83:22: error: field 'type' has incomplete type
> /opt/usr/src/WORK/morimoto/gitlinux/linux/arch/arm/mach-shmobile/board-lage
> r.c:208:1: error: 'REGULATOR_VOLTAGE' undeclared here (not in a function)
> 
> --- with regulator/driver.h ------
>   CC      arch/arm/mach-shmobile/board-lager.o
> (no error)

I believe the enum regulator_type definition should be moved out of 
regulator/driver.h, but that's out of scope of this patch set, so I'm fine 
with including regulator/driver.h for now.

-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 1/2 v2] ARM: shmobile: lager: add gpio/fixed regulator for SDHI
  2013-11-20 10:57                 ` Laurent Pinchart
@ 2013-11-21  1:53                   ` Kuninori Morimoto
  -1 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-21  1:53 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Simon, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc


Hi Laurent

> > --- with regulator/machine.h --------
> >   CC      arch/arm/mach-shmobile/board-lager.o
> > In file included from
> > /opt/usr/src/WORK/morimoto/gitlinux/linux/arch/arm/mach-shmobile/board-lage
> > r.c:36:0:
> > /opt/usr/src/WORK/morimoto/gitlinux/linux/include/linux/regulator/gpio-regu
> > lator.h:83:22: error: field 'type' has incomplete type
> > /opt/usr/src/WORK/morimoto/gitlinux/linux/arch/arm/mach-shmobile/board-lage
> > r.c:208:1: error: 'REGULATOR_VOLTAGE' undeclared here (not in a function)
> > 
> > --- with regulator/driver.h ------
> >   CC      arch/arm/mach-shmobile/board-lager.o
> > (no error)
> 
> I believe the enum regulator_type definition should be moved out of 
> regulator/driver.h, but that's out of scope of this patch set, so I'm fine 
> with including regulator/driver.h for now.

Thank you

Best regards
---
Kuninori Morimoto

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 1/2 v2] ARM: shmobile: lager: add gpio/fixed regulator for SDHI
@ 2013-11-21  1:53                   ` Kuninori Morimoto
  0 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-21  1:53 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Simon, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc


Hi Laurent

> > --- with regulator/machine.h --------
> >   CC      arch/arm/mach-shmobile/board-lager.o
> > In file included from
> > /opt/usr/src/WORK/morimoto/gitlinux/linux/arch/arm/mach-shmobile/board-lage
> > r.c:36:0:
> > /opt/usr/src/WORK/morimoto/gitlinux/linux/include/linux/regulator/gpio-regu
> > lator.h:83:22: error: field 'type' has incomplete type
> > /opt/usr/src/WORK/morimoto/gitlinux/linux/arch/arm/mach-shmobile/board-lage
> > r.c:208:1: error: 'REGULATOR_VOLTAGE' undeclared here (not in a function)
> > 
> > --- with regulator/driver.h ------
> >   CC      arch/arm/mach-shmobile/board-lager.o
> > (no error)
> 
> I believe the enum regulator_type definition should be moved out of 
> regulator/driver.h, but that's out of scope of this patch set, so I'm fine 
> with including regulator/driver.h for now.

Thank you

Best regards
---
Kuninori Morimoto

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 01/16] gpio: rcar: use postcore_init()
  2013-11-19 12:36               ` Laurent Pinchart
@ 2013-11-21  2:02                 ` Kuninori Morimoto
  -1 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-21  2:02 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Linus Walleij, Simon, Chris Ball, Magnus, Linux-SH,
	Kuninori Morimoto, linux-mmc


Hi Laurent, Linus,

> > The general guideline, as everybody should be aware ;-) is that we
> > should always use module_init(), i.e. device_initcall() and let deferred
> > probe handle any dependencies.
> 
> Thought so, good :-)
> 
> > The only exception would be things like timers and interrupt controllers...
> 
> I wouldn't be against moving regulators and gpios one level up in the initcall 
> order, given that they provide resources used by a very large number of 
> drivers. That would be an optimization only though, and not a work around 
> broken probe deferral paths.
> 
> > Usually not relying on deferred probe is a sign of bugs in the deferral
> > probe path.
> > 
> > I know "my" drivers have this problem too, I would prefer that we try to fix
> > the root issue instead of trying to shovel initcalls around.

I see.
I will fixup driver side.
Thank you

Best regards
---
Kuninori Morimoto

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 01/16] gpio: rcar: use postcore_init()
@ 2013-11-21  2:02                 ` Kuninori Morimoto
  0 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-21  2:02 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Linus Walleij, Simon, Chris Ball, Magnus, Linux-SH,
	Kuninori Morimoto, linux-mmc


Hi Laurent, Linus,

> > The general guideline, as everybody should be aware ;-) is that we
> > should always use module_init(), i.e. device_initcall() and let deferred
> > probe handle any dependencies.
> 
> Thought so, good :-)
> 
> > The only exception would be things like timers and interrupt controllers...
> 
> I wouldn't be against moving regulators and gpios one level up in the initcall 
> order, given that they provide resources used by a very large number of 
> drivers. That would be an optimization only though, and not a work around 
> broken probe deferral paths.
> 
> > Usually not relying on deferred probe is a sign of bugs in the deferral
> > probe path.
> > 
> > I know "my" drivers have this problem too, I would prefer that we try to fix
> > the root issue instead of trying to shovel initcalls around.

I see.
I will fixup driver side.
Thank you

Best regards
---
Kuninori Morimoto

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 0/16] ARM: shmobile: SDHI support for r8a7790
  2013-11-18  7:42         ` Kuninori Morimoto
@ 2013-11-21  3:53           ` Simon Horman
  -1 siblings, 0 replies; 113+ messages in thread
From: Simon Horman @ 2013-11-21  3:53 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Laurent, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

On Sun, Nov 17, 2013 at 11:42:02PM -0800, Kuninori Morimoto wrote:
> 
> Hi Simon
> 
> > > These are v2 of SDHI support for r8a7790.
> > > 
> > > Kuninori Morimoto (2):
> > >       ARM: shmobile: lager: add gpio/fixed regulator for SDHI
> > >       ARM: shmobile: lager: add SDHI0/2 support
> > > 
> > >  arch/arm/mach-shmobile/board-lager.c |  149 +++++++++++++++++++++++++++++++++-
> > 
> > Hi Morimoto-san,
> > 
> > I assume that these two patches depend on at least
> > some of the first 14 patches. Is that correct?
> 
> Compile itself is not depend on first 14 patches,
> but, it doesn't work correctly without these patches.
> So, yes, it depend on 14 patches.

What is the run-time effect of these 2 patches without the other 14.
Is it

a) Things get worse and will only get better with the other 14 patches or;
b) Things stay the same and will  get better with the other 14 patches?

In the case of b I am inclined to queue these patches up once/if
Chris has indicated that the other 14 patches are ok.

In the case of a I would like to wait and queue up these patches
on top of the other 14 patches once/if they are available in a
stable branch.

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 0/16] ARM: shmobile: SDHI support for r8a7790
@ 2013-11-21  3:53           ` Simon Horman
  0 siblings, 0 replies; 113+ messages in thread
From: Simon Horman @ 2013-11-21  3:53 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Laurent, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

On Sun, Nov 17, 2013 at 11:42:02PM -0800, Kuninori Morimoto wrote:
> 
> Hi Simon
> 
> > > These are v2 of SDHI support for r8a7790.
> > > 
> > > Kuninori Morimoto (2):
> > >       ARM: shmobile: lager: add gpio/fixed regulator for SDHI
> > >       ARM: shmobile: lager: add SDHI0/2 support
> > > 
> > >  arch/arm/mach-shmobile/board-lager.c |  149 +++++++++++++++++++++++++++++++++-
> > 
> > Hi Morimoto-san,
> > 
> > I assume that these two patches depend on at least
> > some of the first 14 patches. Is that correct?
> 
> Compile itself is not depend on first 14 patches,
> but, it doesn't work correctly without these patches.
> So, yes, it depend on 14 patches.

What is the run-time effect of these 2 patches without the other 14.
Is it

a) Things get worse and will only get better with the other 14 patches or;
b) Things stay the same and will  get better with the other 14 patches?

In the case of b I am inclined to queue these patches up once/if
Chris has indicated that the other 14 patches are ok.

In the case of a I would like to wait and queue up these patches
on top of the other 14 patches once/if they are available in a
stable branch.

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 0/16] ARM: shmobile: SDHI support for r8a7790
  2013-11-21  3:53           ` Simon Horman
@ 2013-11-21  5:20             ` Kuninori Morimoto
  -1 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-21  5:20 UTC (permalink / raw)
  To: Simon Horman
  Cc: Laurent, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc


Hi Simon

> > > > These are v2 of SDHI support for r8a7790.
> > > > 
> > > > Kuninori Morimoto (2):
> > > >       ARM: shmobile: lager: add gpio/fixed regulator for SDHI
> > > >       ARM: shmobile: lager: add SDHI0/2 support
> > > > 
> > > >  arch/arm/mach-shmobile/board-lager.c |  149 +++++++++++++++++++++++++++++++++-
> > > 
> > > Hi Morimoto-san,
> > > 
> > > I assume that these two patches depend on at least
> > > some of the first 14 patches. Is that correct?
> > 
> > Compile itself is not depend on first 14 patches,
> > but, it doesn't work correctly without these patches.
> > So, yes, it depend on 14 patches.
> 
> What is the run-time effect of these 2 patches without the other 14.
> Is it
> 
> a) Things get worse and will only get better with the other 14 patches or;
> b) Things stay the same and will  get better with the other 14 patches?
> 
> In the case of b I am inclined to queue these patches up once/if
> Chris has indicated that the other 14 patches are ok.
> 
> In the case of a I would like to wait and queue up these patches
> on top of the other 14 patches once/if they are available in a
> stable branch.

Thank you. I think b)
But, my current plan is that I will re-send these patches
again in good-timing (when I can indicate the necessary branch).
I guess it doesn't have complex relationship.
What do you think ?

Best regards
---
Kuninori Morimoto

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 0/16] ARM: shmobile: SDHI support for r8a7790
@ 2013-11-21  5:20             ` Kuninori Morimoto
  0 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-11-21  5:20 UTC (permalink / raw)
  To: Simon Horman
  Cc: Laurent, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc


Hi Simon

> > > > These are v2 of SDHI support for r8a7790.
> > > > 
> > > > Kuninori Morimoto (2):
> > > >       ARM: shmobile: lager: add gpio/fixed regulator for SDHI
> > > >       ARM: shmobile: lager: add SDHI0/2 support
> > > > 
> > > >  arch/arm/mach-shmobile/board-lager.c |  149 +++++++++++++++++++++++++++++++++-
> > > 
> > > Hi Morimoto-san,
> > > 
> > > I assume that these two patches depend on at least
> > > some of the first 14 patches. Is that correct?
> > 
> > Compile itself is not depend on first 14 patches,
> > but, it doesn't work correctly without these patches.
> > So, yes, it depend on 14 patches.
> 
> What is the run-time effect of these 2 patches without the other 14.
> Is it
> 
> a) Things get worse and will only get better with the other 14 patches or;
> b) Things stay the same and will  get better with the other 14 patches?
> 
> In the case of b I am inclined to queue these patches up once/if
> Chris has indicated that the other 14 patches are ok.
> 
> In the case of a I would like to wait and queue up these patches
> on top of the other 14 patches once/if they are available in a
> stable branch.

Thank you. I think b)
But, my current plan is that I will re-send these patches
again in good-timing (when I can indicate the necessary branch).
I guess it doesn't have complex relationship.
What do you think ?

Best regards
---
Kuninori Morimoto

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 0/16] ARM: shmobile: SDHI support for r8a7790
  2013-11-21  5:20             ` Kuninori Morimoto
@ 2013-11-21  8:48               ` Simon Horman
  -1 siblings, 0 replies; 113+ messages in thread
From: Simon Horman @ 2013-11-21  8:48 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Laurent, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

On Wed, Nov 20, 2013 at 09:20:10PM -0800, Kuninori Morimoto wrote:
> 
> Hi Simon
> 
> > > > > These are v2 of SDHI support for r8a7790.
> > > > > 
> > > > > Kuninori Morimoto (2):
> > > > >       ARM: shmobile: lager: add gpio/fixed regulator for SDHI
> > > > >       ARM: shmobile: lager: add SDHI0/2 support
> > > > > 
> > > > >  arch/arm/mach-shmobile/board-lager.c |  149 +++++++++++++++++++++++++++++++++-
> > > > 
> > > > Hi Morimoto-san,
> > > > 
> > > > I assume that these two patches depend on at least
> > > > some of the first 14 patches. Is that correct?
> > > 
> > > Compile itself is not depend on first 14 patches,
> > > but, it doesn't work correctly without these patches.
> > > So, yes, it depend on 14 patches.
> > 
> > What is the run-time effect of these 2 patches without the other 14.
> > Is it
> > 
> > a) Things get worse and will only get better with the other 14 patches or;
> > b) Things stay the same and will  get better with the other 14 patches?
> > 
> > In the case of b I am inclined to queue these patches up once/if
> > Chris has indicated that the other 14 patches are ok.
> > 
> > In the case of a I would like to wait and queue up these patches
> > on top of the other 14 patches once/if they are available in a
> > stable branch.
> 
> Thank you. I think b)
> But, my current plan is that I will re-send these patches
> again in good-timing (when I can indicate the necessary branch).
> I guess it doesn't have complex relationship.
> What do you think ?

Sure, that is fine for me.

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 0/16] ARM: shmobile: SDHI support for r8a7790
@ 2013-11-21  8:48               ` Simon Horman
  0 siblings, 0 replies; 113+ messages in thread
From: Simon Horman @ 2013-11-21  8:48 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Laurent, Chris Ball, Magnus, Linux-SH, Kuninori Morimoto, linux-mmc

On Wed, Nov 20, 2013 at 09:20:10PM -0800, Kuninori Morimoto wrote:
> 
> Hi Simon
> 
> > > > > These are v2 of SDHI support for r8a7790.
> > > > > 
> > > > > Kuninori Morimoto (2):
> > > > >       ARM: shmobile: lager: add gpio/fixed regulator for SDHI
> > > > >       ARM: shmobile: lager: add SDHI0/2 support
> > > > > 
> > > > >  arch/arm/mach-shmobile/board-lager.c |  149 +++++++++++++++++++++++++++++++++-
> > > > 
> > > > Hi Morimoto-san,
> > > > 
> > > > I assume that these two patches depend on at least
> > > > some of the first 14 patches. Is that correct?
> > > 
> > > Compile itself is not depend on first 14 patches,
> > > but, it doesn't work correctly without these patches.
> > > So, yes, it depend on 14 patches.
> > 
> > What is the run-time effect of these 2 patches without the other 14.
> > Is it
> > 
> > a) Things get worse and will only get better with the other 14 patches or;
> > b) Things stay the same and will  get better with the other 14 patches?
> > 
> > In the case of b I am inclined to queue these patches up once/if
> > Chris has indicated that the other 14 patches are ok.
> > 
> > In the case of a I would like to wait and queue up these patches
> > on top of the other 14 patches once/if they are available in a
> > stable branch.
> 
> Thank you. I think b)
> But, my current plan is that I will re-send these patches
> again in good-timing (when I can indicate the necessary branch).
> I guess it doesn't have complex relationship.
> What do you think ?

Sure, that is fine for me.

^ permalink raw reply	[flat|nested] 113+ messages in thread

* [PATCH 1/2 v2] ARM: shmobile: lager: add gpio/fixed regulator for SDHI
  2013-11-15  1:55       ` Kuninori Morimoto
  (?)
  (?)
@ 2013-12-05  6:11       ` Kuninori Morimoto
  -1 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2013-12-05  6:11 UTC (permalink / raw)
  To: linux-sh

Fixed regulator is used for SDHI0/2 Vcc.
We should use da9063 driver for Vccq,
but, it doesn't have regulator support at this point.
This patch uses gpio-regulator for it as quick-hack.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
v1 -> v2

 - fixup conflict on Simon branch
 - fixup space before 
 arch/arm/mach-shmobile/board-lager.c |   83 +++++++++++++++++++++++++++++++++-
 1 file changed, 82 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-shmobile/board-lager.c b/arch/arm/mach-shmobile/board-lager.c
index ce0ba7df..f20c10a 100644
--- a/arch/arm/mach-shmobile/board-lager.c
+++ b/arch/arm/mach-shmobile/board-lager.c
@@ -31,7 +31,9 @@
 #include <linux/platform_data/rcar-du.h>
 #include <linux/platform_device.h>
 #include <linux/phy.h>
+#include <linux/regulator/driver.h>
 #include <linux/regulator/fixed.h>
+#include <linux/regulator/gpio-regulator.h>
 #include <linux/regulator/machine.h>
 #include <linux/sh_eth.h>
 #include <mach/common.h>
@@ -146,6 +148,71 @@ static struct regulator_consumer_supply fixed3v3_power_consumers[]  	REGULATOR_SUPPLY("vmmc", "sh_mmcif.1"),
 };
 
+/*
+ * SDHI regulator macro
+ *
+ ** FIXME**
+ * Lager board vqmmc is provided via DA9063 PMIC chip,
+ * and we should use ${LINK}/drivers/mfd/da9063-* driver for it.
+ * but, it doesn't have regulator support at this point.
+ * It uses gpio-regulator for vqmmc as quick-hack.
+ */
+#define SDHI_REGULATOR(idx, vdd_pin, vccq_pin)				\
+static struct regulator_consumer_supply vcc_sdhi##idx##_consumer =	\
+	REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi." #idx);		\
+									\
+static struct regulator_init_data vcc_sdhi##idx##_init_data = {		\
+	.constraints = {						\
+		.valid_ops_mask = REGULATOR_CHANGE_STATUS,		\
+	},								\
+	.consumer_supplies	= &vcc_sdhi##idx##_consumer,		\
+	.num_consumer_supplies	= 1,					\
+};									\
+									\
+static const struct fixed_voltage_config vcc_sdhi##idx##_info __initconst = {\
+	.supply_name	= "SDHI" #idx "Vcc",				\
+	.microvolts	= 3300000,					\
+	.gpio		= vdd_pin,					\
+	.enable_high	= 1,						\
+	.init_data	= &vcc_sdhi##idx##_init_data,			\
+};									\
+									\
+static struct regulator_consumer_supply vccq_sdhi##idx##_consumer =	\
+	REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi." #idx);		\
+									\
+static struct regulator_init_data vccq_sdhi##idx##_init_data = {	\
+	.constraints = {						\
+		.input_uV	= 3300000,				\
+		.min_uV		= 1800000,				\
+		.max_uV		= 3300000,				\
+		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |		\
+				  REGULATOR_CHANGE_STATUS,		\
+	},								\
+	.consumer_supplies	= &vccq_sdhi##idx##_consumer,		\
+	.num_consumer_supplies	= 1,					\
+};									\
+									\
+static struct gpio vccq_sdhi##idx##_gpio =				\
+	{ vccq_pin, GPIOF_OUT_INIT_HIGH, "vccq-sdhi" #idx };		\
+									\
+static struct gpio_regulator_state vccq_sdhi##idx##_states[] = {	\
+	{ .value = 1800000, .gpios = 0 },				\
+	{ .value = 3300000, .gpios = 1 },				\
+};									\
+									\
+static const struct gpio_regulator_config vccq_sdhi##idx##_info __initconst = {\
+	.supply_name	= "vqmmc",					\
+	.gpios		= &vccq_sdhi##idx##_gpio,			\
+	.nr_gpios	= 1,						\
+	.states		= vccq_sdhi##idx##_states,			\
+	.nr_states	= ARRAY_SIZE(vccq_sdhi##idx##_states),		\
+	.type		= REGULATOR_VOLTAGE,				\
+	.init_data	= &vccq_sdhi##idx##_init_data,			\
+};
+
+SDHI_REGULATOR(0, RCAR_GP_PIN(5, 24), RCAR_GP_PIN(5, 29));
+SDHI_REGULATOR(2, RCAR_GP_PIN(5, 25), RCAR_GP_PIN(5, 30));
+
 /* MMCIF */
 static const struct sh_mmcif_plat_data mmcif1_pdata __initconst = {
 	.caps		= MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE,
@@ -256,6 +323,9 @@ static const struct pinctrl_map lager_pinctrl_map[] = {
 
 static void __init lager_add_standard_devices(void)
 {
+	int fixed_regulator_idx = 0;
+	int gpio_regulator_idx = 0;
+
 	r8a7790_clock_init();
 
 	pinctrl_register_mappings(lager_pinctrl_map,
@@ -269,7 +339,8 @@ static void __init lager_add_standard_devices(void)
 	platform_device_register_data(&platform_bus, "gpio-keys", -1,
 				      &lager_keys_pdata,
 				      sizeof(lager_keys_pdata));
-	regulator_register_always_on(0, "fixed-3.3V", fixed3v3_power_consumers,
+	regulator_register_always_on(fixed_regulator_idx++,
+				     "fixed-3.3V", fixed3v3_power_consumers,
 				     ARRAY_SIZE(fixed3v3_power_consumers), 3300000);
 	platform_device_register_resndata(&platform_bus, "sh_mmcif", 1,
 					  mmcif1_resources, ARRAY_SIZE(mmcif1_resources),
@@ -287,6 +358,16 @@ static void __init lager_add_standard_devices(void)
 					  ARRAY_SIZE(qspi_resources),
 					  &qspi_pdata, sizeof(qspi_pdata));
 	spi_register_board_info(spi_info, ARRAY_SIZE(spi_info));
+
+	platform_device_register_data(&platform_bus, "reg-fixed-voltage", fixed_regulator_idx++,
+				      &vcc_sdhi0_info, sizeof(struct fixed_voltage_config));
+	platform_device_register_data(&platform_bus, "reg-fixed-voltage", fixed_regulator_idx++,
+				      &vcc_sdhi2_info, sizeof(struct fixed_voltage_config));
+
+	platform_device_register_data(&platform_bus, "gpio-regulator", gpio_regulator_idx++,
+				      &vccq_sdhi0_info, sizeof(struct gpio_regulator_config));
+	platform_device_register_data(&platform_bus, "gpio-regulator", gpio_regulator_idx++,
+				      &vccq_sdhi2_info, sizeof(struct gpio_regulator_config));
 }
 
 /*
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 113+ messages in thread

* Re: [PATCH 1/2 v2] ARM: shmobile: lager: add gpio/fixed regulator for SDHI
  2013-11-15  1:55       ` Kuninori Morimoto
                         ` (2 preceding siblings ...)
  (?)
@ 2013-12-05  6:59       ` Simon Horman
  -1 siblings, 0 replies; 113+ messages in thread
From: Simon Horman @ 2013-12-05  6:59 UTC (permalink / raw)
  To: linux-sh

On Wed, Dec 04, 2013 at 10:11:06PM -0800, Kuninori Morimoto wrote:
> Fixed regulator is used for SDHI0/2 Vcc.
> We should use da9063 driver for Vccq,
> but, it doesn't have regulator support at this point.
> This patch uses gpio-regulator for it as quick-hack.
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
> v1 -> v2
> 
>  - fixup conflict on Simon branch
>  - fixup space before > 
>  arch/arm/mach-shmobile/board-lager.c |   83 +++++++++++++++++++++++++++++++++-
>  1 file changed, 82 insertions(+), 1 deletion(-)

Thanks, I will queue this up.

> 
> diff --git a/arch/arm/mach-shmobile/board-lager.c b/arch/arm/mach-shmobile/board-lager.c
> index ce0ba7df..f20c10a 100644
> --- a/arch/arm/mach-shmobile/board-lager.c
> +++ b/arch/arm/mach-shmobile/board-lager.c
> @@ -31,7 +31,9 @@
>  #include <linux/platform_data/rcar-du.h>
>  #include <linux/platform_device.h>
>  #include <linux/phy.h>
> +#include <linux/regulator/driver.h>
>  #include <linux/regulator/fixed.h>
> +#include <linux/regulator/gpio-regulator.h>
>  #include <linux/regulator/machine.h>
>  #include <linux/sh_eth.h>
>  #include <mach/common.h>
> @@ -146,6 +148,71 @@ static struct regulator_consumer_supply fixed3v3_power_consumers[] >  	REGULATOR_SUPPLY("vmmc", "sh_mmcif.1"),
>  };
>  
> +/*
> + * SDHI regulator macro
> + *
> + ** FIXME**
> + * Lager board vqmmc is provided via DA9063 PMIC chip,
> + * and we should use ${LINK}/drivers/mfd/da9063-* driver for it.
> + * but, it doesn't have regulator support at this point.
> + * It uses gpio-regulator for vqmmc as quick-hack.
> + */
> +#define SDHI_REGULATOR(idx, vdd_pin, vccq_pin)				\
> +static struct regulator_consumer_supply vcc_sdhi##idx##_consumer =	\
> +	REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi." #idx);		\
> +									\
> +static struct regulator_init_data vcc_sdhi##idx##_init_data = {		\
> +	.constraints = {						\
> +		.valid_ops_mask = REGULATOR_CHANGE_STATUS,		\
> +	},								\
> +	.consumer_supplies	= &vcc_sdhi##idx##_consumer,		\
> +	.num_consumer_supplies	= 1,					\
> +};									\
> +									\
> +static const struct fixed_voltage_config vcc_sdhi##idx##_info __initconst = {\
> +	.supply_name	= "SDHI" #idx "Vcc",				\
> +	.microvolts	= 3300000,					\
> +	.gpio		= vdd_pin,					\
> +	.enable_high	= 1,						\
> +	.init_data	= &vcc_sdhi##idx##_init_data,			\
> +};									\
> +									\
> +static struct regulator_consumer_supply vccq_sdhi##idx##_consumer =	\
> +	REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi." #idx);		\
> +									\
> +static struct regulator_init_data vccq_sdhi##idx##_init_data = {	\
> +	.constraints = {						\
> +		.input_uV	= 3300000,				\
> +		.min_uV		= 1800000,				\
> +		.max_uV		= 3300000,				\
> +		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |		\
> +				  REGULATOR_CHANGE_STATUS,		\
> +	},								\
> +	.consumer_supplies	= &vccq_sdhi##idx##_consumer,		\
> +	.num_consumer_supplies	= 1,					\
> +};									\
> +									\
> +static struct gpio vccq_sdhi##idx##_gpio =				\
> +	{ vccq_pin, GPIOF_OUT_INIT_HIGH, "vccq-sdhi" #idx };		\
> +									\
> +static struct gpio_regulator_state vccq_sdhi##idx##_states[] = {	\
> +	{ .value = 1800000, .gpios = 0 },				\
> +	{ .value = 3300000, .gpios = 1 },				\
> +};									\
> +									\
> +static const struct gpio_regulator_config vccq_sdhi##idx##_info __initconst = {\
> +	.supply_name	= "vqmmc",					\
> +	.gpios		= &vccq_sdhi##idx##_gpio,			\
> +	.nr_gpios	= 1,						\
> +	.states		= vccq_sdhi##idx##_states,			\
> +	.nr_states	= ARRAY_SIZE(vccq_sdhi##idx##_states),		\
> +	.type		= REGULATOR_VOLTAGE,				\
> +	.init_data	= &vccq_sdhi##idx##_init_data,			\
> +};
> +
> +SDHI_REGULATOR(0, RCAR_GP_PIN(5, 24), RCAR_GP_PIN(5, 29));
> +SDHI_REGULATOR(2, RCAR_GP_PIN(5, 25), RCAR_GP_PIN(5, 30));
> +
>  /* MMCIF */
>  static const struct sh_mmcif_plat_data mmcif1_pdata __initconst = {
>  	.caps		= MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE,
> @@ -256,6 +323,9 @@ static const struct pinctrl_map lager_pinctrl_map[] = {
>  
>  static void __init lager_add_standard_devices(void)
>  {
> +	int fixed_regulator_idx = 0;
> +	int gpio_regulator_idx = 0;
> +
>  	r8a7790_clock_init();
>  
>  	pinctrl_register_mappings(lager_pinctrl_map,
> @@ -269,7 +339,8 @@ static void __init lager_add_standard_devices(void)
>  	platform_device_register_data(&platform_bus, "gpio-keys", -1,
>  				      &lager_keys_pdata,
>  				      sizeof(lager_keys_pdata));
> -	regulator_register_always_on(0, "fixed-3.3V", fixed3v3_power_consumers,
> +	regulator_register_always_on(fixed_regulator_idx++,
> +				     "fixed-3.3V", fixed3v3_power_consumers,
>  				     ARRAY_SIZE(fixed3v3_power_consumers), 3300000);
>  	platform_device_register_resndata(&platform_bus, "sh_mmcif", 1,
>  					  mmcif1_resources, ARRAY_SIZE(mmcif1_resources),
> @@ -287,6 +358,16 @@ static void __init lager_add_standard_devices(void)
>  					  ARRAY_SIZE(qspi_resources),
>  					  &qspi_pdata, sizeof(qspi_pdata));
>  	spi_register_board_info(spi_info, ARRAY_SIZE(spi_info));
> +
> +	platform_device_register_data(&platform_bus, "reg-fixed-voltage", fixed_regulator_idx++,
> +				      &vcc_sdhi0_info, sizeof(struct fixed_voltage_config));
> +	platform_device_register_data(&platform_bus, "reg-fixed-voltage", fixed_regulator_idx++,
> +				      &vcc_sdhi2_info, sizeof(struct fixed_voltage_config));
> +
> +	platform_device_register_data(&platform_bus, "gpio-regulator", gpio_regulator_idx++,
> +				      &vccq_sdhi0_info, sizeof(struct gpio_regulator_config));
> +	platform_device_register_data(&platform_bus, "gpio-regulator", gpio_regulator_idx++,
> +				      &vccq_sdhi2_info, sizeof(struct gpio_regulator_config));
>  }
>  
>  /*
> -- 
> 1.7.9.5
> 

^ permalink raw reply	[flat|nested] 113+ messages in thread

* [PATCH 1/2 v2] ARM: shmobile: lager: add SDHI0/2 support
  2013-11-15  1:55       ` Kuninori Morimoto
                         ` (3 preceding siblings ...)
  (?)
@ 2014-02-12  6:25       ` Kuninori Morimoto
  -1 siblings, 0 replies; 113+ messages in thread
From: Kuninori Morimoto @ 2014-02-12  6:25 UTC (permalink / raw)
  To: linux-sh

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

SDHI0 (CN8) needs JP/SW settings

Acked-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
v1 -> v2

 - add Acked-by: Magnus Damm <damm@opensource.se>

 arch/arm/mach-shmobile/board-lager.c |   64 ++++++++++++++++++++++++++++++++++
 1 file changed, 64 insertions(+)

diff --git a/arch/arm/mach-shmobile/board-lager.c b/arch/arm/mach-shmobile/board-lager.c
index 3175748..90d7e81 100644
--- a/arch/arm/mach-shmobile/board-lager.c
+++ b/arch/arm/mach-shmobile/board-lager.c
@@ -26,8 +26,10 @@
 #include <linux/irq.h>
 #include <linux/kernel.h>
 #include <linux/leds.h>
+#include <linux/mfd/tmio.h>
 #include <linux/mmc/host.h>
 #include <linux/mmc/sh_mmcif.h>
+#include <linux/mmc/sh_mobile_sdhi.h>
 #include <linux/pinctrl/machine.h>
 #include <linux/platform_data/camera-rcar.h>
 #include <linux/platform_data/gpio-rcar.h>
@@ -68,6 +70,19 @@
  * # amixer set "LINEOUT Mixer DACL" on
  */
 
+/*
+ * SDHI0 (CN8)
+ *
+ * JP3:  pin1
+ * SW20: pin1
+
+ * GP5_24:	1:  VDD  3.3V (defult)
+ *		0:  VDD  0.0V
+ * GP5_29:	1:  VccQ 3.3V (defult)
+ *		0:  VccQ 1.8V
+ *
+ */
+
 /* DU */
 static struct rcar_du_encoder_data lager_du_encoders[] = {
 	{
@@ -595,6 +610,34 @@ static void __init lager_add_rsnd_device(void)
 	platform_device_register_full(&cardinfo);
 }
 
+/* SDHI0 */
+static struct sh_mobile_sdhi_info sdhi0_info __initdata = {
+	.tmio_caps	= MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
+			  MMC_CAP_POWER_OFF_CARD,
+	.tmio_caps2	= MMC_CAP2_NO_MULTI_READ,
+	.tmio_flags	= TMIO_MMC_HAS_IDLE_WAIT |
+			  TMIO_MMC_WRPROTECT_DISABLE,
+};
+
+static struct resource sdhi0_resources[] __initdata = {
+	DEFINE_RES_MEM(0xee100000, 0x200),
+	DEFINE_RES_IRQ(gic_spi(165)),
+};
+
+/* SDHI2 */
+static struct sh_mobile_sdhi_info sdhi2_info __initdata = {
+	.tmio_caps	= MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
+			  MMC_CAP_POWER_OFF_CARD,
+	.tmio_caps2	= MMC_CAP2_NO_MULTI_READ,
+	.tmio_flags	= TMIO_MMC_HAS_IDLE_WAIT |
+			  TMIO_MMC_WRPROTECT_DISABLE,
+};
+
+static struct resource sdhi2_resources[] __initdata = {
+	DEFINE_RES_MEM(0xee140000, 0x100),
+	DEFINE_RES_IRQ(gic_spi(167)),
+};
+
 static const struct pinctrl_map lager_pinctrl_map[] = {
 	/* DU (CN10: ARGB0, CN13: LVDS) */
 	PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7790", "pfc-r8a7790",
@@ -612,6 +655,20 @@ static const struct pinctrl_map lager_pinctrl_map[] = {
 	/* SCIF1 (CN20: DEBUG SERIAL1) */
 	PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.7", "pfc-r8a7790",
 				  "scif1_data", "scif1"),
+	/* SDHI0 */
+	PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7790",
+				  "sdhi0_data4", "sdhi0"),
+	PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7790",
+				  "sdhi0_ctrl", "sdhi0"),
+	PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7790",
+				  "sdhi0_cd", "sdhi0"),
+	/* SDHI2 */
+	PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.2", "pfc-r8a7790",
+				  "sdhi2_data4", "sdhi2"),
+	PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.2", "pfc-r8a7790",
+				  "sdhi2_ctrl", "sdhi2"),
+	PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.2", "pfc-r8a7790",
+				  "sdhi2_cd", "sdhi2"),
 	/* SSI (CN17: sound) */
 	PIN_MAP_MUX_GROUP_DEFAULT("rcar_sound", "pfc-r8a7790",
 				  "ssi0129_ctrl", "ssi"),
@@ -716,6 +773,13 @@ static void __init lager_add_standard_devices(void)
 	lager_register_usbhs();
 
 	lager_add_rsnd_device();
+
+	platform_device_register_resndata(&platform_bus, "sh_mobile_sdhi", 0,
+					  sdhi0_resources, ARRAY_SIZE(sdhi0_resources),
+					  &sdhi0_info, sizeof(struct sh_mobile_sdhi_info));
+	platform_device_register_resndata(&platform_bus, "sh_mobile_sdhi", 2,
+					  sdhi2_resources, ARRAY_SIZE(sdhi2_resources),
+					  &sdhi2_info, sizeof(struct sh_mobile_sdhi_info));
 }
 
 /*
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 113+ messages in thread

end of thread, other threads:[~2014-02-12  6:25 UTC | newest]

Thread overview: 113+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-14 10:16 [PATCH 0/16] SDHI support for r8a7790 Kuninori Morimoto
2013-11-14 10:16 ` Kuninori Morimoto
2013-11-14 10:18 ` [PATCH 0/16]: gpio-rcar fixup Kuninori Morimoto
2013-11-14 10:18   ` Kuninori Morimoto
2013-11-14 10:19   ` [PATCH 01/16] gpio: rcar: use postcore_init() Kuninori Morimoto
2013-11-14 10:19     ` Kuninori Morimoto
2013-11-14 13:42     ` Laurent Pinchart
2013-11-14 13:42       ` Laurent Pinchart
2013-11-15  0:26       ` Kuninori Morimoto
2013-11-15  0:26         ` Kuninori Morimoto
2013-11-18 13:59         ` Laurent Pinchart
2013-11-18 14:00           ` Laurent Pinchart
2013-11-19  9:57           ` Linus Walleij
2013-11-19  9:57             ` Linus Walleij
2013-11-19 12:36             ` Laurent Pinchart
2013-11-19 12:36               ` Laurent Pinchart
2013-11-21  2:02               ` Kuninori Morimoto
2013-11-21  2:02                 ` Kuninori Morimoto
2013-11-14 10:21 ` [PATCH 0/16] mmc: bug fix patches Kuninori Morimoto
2013-11-14 10:21   ` Kuninori Morimoto
2013-11-14 10:23   ` [PATCH 03/17] mmc: tmio: Fix odd size access Kuninori Morimoto
2013-11-14 10:23     ` Kuninori Morimoto
2013-11-14 13:32     ` Laurent Pinchart
2013-11-14 13:32       ` Laurent Pinchart
2013-11-14 10:24   ` [PATCH 04/17] mmc: tmio: Add error IRQ status clear Kuninori Morimoto
2013-11-14 10:24     ` Kuninori Morimoto
2013-11-14 13:34     ` Laurent Pinchart
2013-11-14 13:34       ` Laurent Pinchart
2013-11-14 10:24   ` [PATCH 05/17] mmc: tmio: don't overwrite caps2 Kuninori Morimoto
2013-11-14 10:24     ` Kuninori Morimoto
2013-11-14 13:36     ` Laurent Pinchart
2013-11-14 13:36       ` Laurent Pinchart
2013-11-14 10:26 ` [PATCH 0/16] ARM: shmobile: bug fix Kuninori Morimoto
2013-11-14 10:26   ` Kuninori Morimoto
2013-11-14 10:27   ` [PATCH 06/17] ARM: shmobile: marzen: remove SDHI0 WP pin setting from DTS Kuninori Morimoto
2013-11-14 10:27     ` Kuninori Morimoto
2013-11-14 13:38     ` Laurent Pinchart
2013-11-14 13:38       ` Laurent Pinchart
2013-11-14 10:27   ` [PATCH 07/17] ARM: shmobile: marzen: remove SDHI0 WP pin setting Kuninori Morimoto
2013-11-14 10:27     ` Kuninori Morimoto
2013-11-14 13:38     ` Laurent Pinchart
2013-11-14 13:38       ` Laurent Pinchart
2013-11-14 10:27   ` [PATCH 08/17] ARM: shmobile: sh73a0: fixup sdhi compatible name Kuninori Morimoto
2013-11-14 10:27     ` Kuninori Morimoto
2013-11-14 13:39     ` Laurent Pinchart
2013-11-14 13:39       ` Laurent Pinchart
2013-11-14 10:29 ` [PATCH 0/16] mmc: SDHI: add new feature Kuninori Morimoto
2013-11-14 10:29   ` Kuninori Morimoto
2013-11-14 10:30   ` [PATCH 09/17] mmc: tmio: bus_shift become tmio_mmc_data member Kuninori Morimoto
2013-11-14 10:30     ` Kuninori Morimoto
2013-11-14 10:31   ` [PATCH 10/17] mmc: tmio: add new TMIO_MMC_HAVE_HIGH_REG flags Kuninori Morimoto
2013-11-14 10:31     ` Kuninori Morimoto
2013-11-14 10:31   ` [PATCH 11/17] mmc: SDHI: add SoC specific workaround via HW version Kuninori Morimoto
2013-11-14 10:31     ` Kuninori Morimoto
2013-11-14 14:03     ` Sergei Shtylyov
2013-11-14 14:03       ` Sergei Shtylyov
2013-11-15  0:16       ` Kuninori Morimoto
2013-11-15  0:16         ` Kuninori Morimoto
2013-11-14 10:31   ` [PATCH 12/17] mmc: SDHI: tidyup sh_mobile_sdhi_of_match position Kuninori Morimoto
2013-11-14 10:31     ` Kuninori Morimoto
2013-11-14 10:32   ` [PATCH 13/17] mmc: SDHI: updata sh_mobile_sdhi_of_data for r8a7778 Kuninori Morimoto
2013-11-14 10:32     ` Kuninori Morimoto
2013-11-14 10:32   ` [PATCH 14/17] mmc: SDHI: updata sh_mobile_sdhi_of_data for r8a7779 Kuninori Morimoto
2013-11-14 10:32     ` Kuninori Morimoto
2013-11-14 10:32   ` [PATCH 15/17] mmc: SDHI: updata sh_mobile_sdhi_of_data for r8a7790 Kuninori Morimoto
2013-11-14 10:32     ` Kuninori Morimoto
2013-11-14 10:34 ` [PATCH 0/16] ARM: shmobile: SDHI support " Kuninori Morimoto
2013-11-14 10:34   ` Kuninori Morimoto
2013-11-14 10:34   ` [PATCH 16/17] ARM: shmobile: lager: add SDHI0/2 support Kuninori Morimoto
2013-11-14 10:34     ` Kuninori Morimoto
2013-11-14 10:35   ` [PATCH 17/17] ARM: shmobile: lager: use gpio/fixed regulator for SDHI Kuninori Morimoto
2013-11-14 10:35     ` Kuninori Morimoto
2013-11-14 13:51     ` Laurent Pinchart
2013-11-14 13:51       ` Laurent Pinchart
2013-11-15  0:42       ` Kuninori Morimoto
2013-11-15  0:42         ` Kuninori Morimoto
2013-11-14 13:46   ` [PATCH 0/16] ARM: shmobile: SDHI support for r8a7790 Laurent Pinchart
2013-11-14 13:46     ` Laurent Pinchart
2013-11-15  0:43     ` Kuninori Morimoto
2013-11-15  0:43       ` Kuninori Morimoto
2013-11-15  1:53   ` Kuninori Morimoto
2013-11-15  1:53     ` Kuninori Morimoto
2013-11-15  1:55     ` [PATCH 1/2 v2] ARM: shmobile: lager: add gpio/fixed regulator for SDHI Kuninori Morimoto
2013-11-15  1:55       ` Kuninori Morimoto
2013-11-18 11:35       ` Laurent Pinchart
2013-11-18 11:35         ` Laurent Pinchart
2013-11-19  5:14         ` Kuninori Morimoto
2013-11-19  5:14           ` Kuninori Morimoto
2013-11-19 12:45           ` Laurent Pinchart
2013-11-19 12:45             ` Laurent Pinchart
2013-11-20  7:37             ` Kuninori Morimoto
2013-11-20  7:37               ` Kuninori Morimoto
2013-11-20 10:57               ` Laurent Pinchart
2013-11-20 10:57                 ` Laurent Pinchart
2013-11-21  1:53                 ` Kuninori Morimoto
2013-11-21  1:53                   ` Kuninori Morimoto
2013-12-05  6:11       ` Kuninori Morimoto
2013-12-05  6:59       ` Simon Horman
2014-02-12  6:25       ` [PATCH 1/2 v2] ARM: shmobile: lager: add SDHI0/2 support Kuninori Morimoto
2013-11-15  1:56     ` [PATCH 2/2 " Kuninori Morimoto
2013-11-15  1:56       ` Kuninori Morimoto
2013-11-18  7:21     ` [PATCH 0/16] ARM: shmobile: SDHI support for r8a7790 Simon Horman
2013-11-18  7:21       ` Simon Horman
2013-11-18  7:42       ` Kuninori Morimoto
2013-11-18  7:42         ` Kuninori Morimoto
2013-11-21  3:53         ` Simon Horman
2013-11-21  3:53           ` Simon Horman
2013-11-21  5:20           ` Kuninori Morimoto
2013-11-21  5:20             ` Kuninori Morimoto
2013-11-21  8:48             ` Simon Horman
2013-11-21  8:48               ` Simon Horman
2013-11-20  0:43 ` [PATCH 0/16] " Kuninori Morimoto
2013-11-20  0:43   ` Kuninori Morimoto

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.