Skip to contentSkip to conversation

SDHI support for r8a7790

PATCH In review Kuninori Morimoto 6 participants 58 messages Nov 14, 2013 – Feb 12, 2014

Subsystems (9)
lore
Share & tools
lore
#0 lore raw

cover SDHI support for r8a7790

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(-)
#1 lore raw

cover : gpio-rcar fixup

Hi Laurent

This is fixup patch for R-Car GPIO driver

Kuninori Morimoto:
gpio: rcar: use postcore_init()

Best regards
---
Kuninori Morimoto

#2 lore raw

PATCH 1/16 gpio: rcar: use postcore_init()

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.

---
 drivers/gpio/gpio-rcar.c |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/gpio/gpio-rcar.c +11 -1
index 6038966..0a10325 100644
@@ -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");
Signature · 1 line
1.7.9.5
#3 lore raw

Re: [PATCH 01/16] gpio: rcar: use postcore_init()

Hi Morimoto-san,

Thank you for the patch.

Quoted 4 lines · 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 ?

Quoted 29 lines
---
 drivers/gpio/gpio-rcar.c |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/gpio/gpio-rcar.c +11 -1
index 6038966..0a10325 100644
@@ -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");
Signature · 3 lines
Regards,

Laurent Pinchart
#4 lore raw

Re: [PATCH 01/16] gpio: rcar: use postcore_init()

Hi Laurent

Quoted 6 lines
Quoted 4 lines

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

#5 lore raw

Re: [PATCH 01/16] gpio: rcar: use postcore_init()

Hi Morimoto-san,

(CC'ing Linus Walleij)

Quoted 14 lines · On Thursday 14 November 2013 16:26:53 Kuninori Morimoto wrote:

Hi Laurent

Quoted 6 lines
Quoted 4 lines

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.

Quoted 15 lines

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

Quoted 33 lines

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

Signature · 3 lines
Regards,

Laurent Pinchart
#6 lore raw

Re: [PATCH 01/16] gpio: rcar: use postcore_init()

Quoted 14 lines · Laurent Pinchart

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
Quoted 8 lines
$ 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

#7 lore raw

Re: [PATCH 01/16] gpio: rcar: use postcore_init()

Hi Linus,

Quoted 23 lines · On Tuesday 19 November 2013 10:57:43 Linus Walleij wrote:
Quoted 22 lines · Laurent Pinchart

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
Quoted 5 lines
Quoted 1 line

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

Quoted 1 line

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.

Quoted 5 lines

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.

Signature · 3 lines
Regards,

Laurent Pinchart
#8 lore raw

Re: [PATCH 01/16] gpio: rcar: use postcore_init()

Hi Laurent, Linus,

Quoted 4 lines
Quoted 3 lines

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.

Quoted 14 lines

Thought so, good :-)

Quoted 1 line

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.

Quoted 5 lines

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

#9 lore raw

Re: [PATCH 0/16] mmc: bug fix patches

In reply to Kuninori Morimoto

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

#10 lore raw

PATCH 3/17 mmc: tmio: Fix odd size access

From: Shinobu Uehara <[email protected]>

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

---
 drivers/mmc/host/tmio_mmc_pio.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/mmc/host/tmio_mmc_pio.c +4 -2
index b380225..05ae15c 100644
@@ -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;
 
Signature · 1 line
1.7.9.5
#11 lore raw

Re: [PATCH 03/17] mmc: tmio: Fix odd size access

Hi Morimoto-san,

Thank you for the patch.

Quoted 17 lines · On Thursday 14 November 2013 02:23:23 Kuninori Morimoto wrote:

From: Shinobu Uehara <[email protected]>

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

---
 drivers/mmc/host/tmio_mmc_pio.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/drivers/mmc/host/tmio_mmc_pio.c index b380225..05ae15c 100644

drivers/mmc/host/tmio_mmc_pio.c +0 -0
@@ -386,9 +386,11 @@ static void tmio_mmc_pio_irq(struct tmio_mmc_host
 *host)

drivers/mmc/host/tmio_mmc_pio.c static void tmio_mmc_pio_irq(struct tmio_mmc_host · line 394

Quoted 10 lines
drivers/mmc/host/tmio_mmc_pio.c +4 -2
 
 	/* 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 ?

Quoted 1 line
drivers/mmc/host/tmio_mmc_pio.c +0 -0
 	host->sg_off += count;
Signature · 3 lines
Regards,

Laurent Pinchart
#12 lore raw

PATCH 4/17 mmc: tmio: Add error IRQ status clear

In reply to Kuninori Morimoto

From: Shinobu Uehara <[email protected]>

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

---
 drivers/mmc/host/tmio_mmc_pio.c |    3 +++
 1 file changed, 3 insertions(+)
drivers/mmc/host/tmio_mmc_pio.c +3 -0
index 05ae15c..99f6d29 100644
@@ -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,
Signature · 1 line
1.7.9.5
#13 lore raw

Re: [PATCH 04/17] mmc: tmio: Add error IRQ status clear

Hi Morimoto-san,

Thank you for the patch.

Quoted 18 lines · On Thursday 14 November 2013 02:24:37 Kuninori Morimoto wrote:

From: Shinobu Uehara <[email protected]>

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

---
 drivers/mmc/host/tmio_mmc_pio.c |    3 +++
 1 file changed, 3 insertions(+)
(quoted diff) +0 -0

b/drivers/mmc/host/tmio_mmc_pio.c index 05ae15c..99f6d29 100644

drivers/mmc/host/tmio_mmc_pio.c static void tmio_mmc_card_irq_status(struct · line 571

Quoted 7 lines
drivers/mmc/host/tmio_mmc_pio.c +3 -0
@@ -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.

Quoted 3 lines
drivers/mmc/host/tmio_mmc_pio.c +0 -0
 }
 

static bool __tmio_mmc_card_detect_irq(struct tmio_mmc_host *host,

Signature · 3 lines
Regards,

Laurent Pinchart
#14 lore raw

PATCH 5/17 mmc: tmio: don't overwrite caps2

In reply to Kuninori Morimoto

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

---
 drivers/mmc/host/tmio_mmc_pio.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/tmio_mmc_pio.c +1 -1
index 99f6d29..1f5f2ba 100644
@@ -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) *
Signature · 1 line
1.7.9.5
Acked-by on v1 5/17
#15 lore raw

Re: [PATCH 05/17] mmc: tmio: don't overwrite caps2

Hi Morimoto-san,

Thank you for the patch.

Quoted 6 lines · 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

Quoted 17 lines
---
 drivers/mmc/host/tmio_mmc_pio.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/mmc/host/tmio_mmc_pio.c index 99f6d29..1f5f2ba 100644

drivers/mmc/host/tmio_mmc_pio.c +1 -1
@@ -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) *
Signature · 3 lines
Regards,

Laurent Pinchart
#16 lore raw

Re: [PATCH 0/16] ARM: shmobile: bug fix

In reply to Kuninori Morimoto

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

#17 lore raw

PATCH 6/17 ARM: shmobile: marzen: remove SDHI0 WP pin setting from DTS

WP pin is not implemented on Marzen

---
 arch/arm/boot/dts/r8a7779-marzen-reference.dts |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/arm/boot/dts/r8a7779-marzen-reference.dts +1 -2
index ce3fe9e..cd063cd 100644
@@ -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";
 	};
 };
Signature · 1 line
1.7.9.5
Acked-by on v1 6/17
#18 lore raw

Re: [PATCH 06/17] ARM: shmobile: marzen: remove SDHI0 WP pin setting from DTS

Hi Morimoto-san,

Thank you for the patch.

Quoted 3 lines · On Thursday 14 November 2013 02:27:16 Kuninori Morimoto wrote:

WP pin is not implemented on Marzen

Quoted 19 lines
---
 arch/arm/boot/dts/r8a7779-marzen-reference.dts |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
(quoted diff) +0 -0

b/arch/arm/boot/dts/r8a7779-marzen-reference.dts index ce3fe9e..cd063cd 100644

arch/arm/boot/dts/r8a7779-marzen-reference.dts +1 -2
@@ -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";
 	};
 };
Signature · 3 lines
Regards,

Laurent Pinchart
#19 lore raw

PATCH 7/17 ARM: shmobile: marzen: remove SDHI0 WP pin setting

In reply to Kuninori Morimoto

WP pin is not implemented on Marzen

---
 arch/arm/mach-shmobile/board-marzen.c |    2 --
 1 file changed, 2 deletions(-)
arch/arm/mach-shmobile/board-marzen.c +0 -2
index fa102f7..2288dc2 100644
@@ -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"),
Signature · 1 line
1.7.9.5
Acked-by on v1 7/17
#20 lore raw

Re: [PATCH 07/17] ARM: shmobile: marzen: remove SDHI0 WP pin setting

Hi Morimoto-san,

Thank you for the patch.

Quoted 3 lines · On Thursday 14 November 2013 02:27:32 Kuninori Morimoto wrote:

WP pin is not implemented on Marzen

Quoted 17 lines
---
 arch/arm/mach-shmobile/board-marzen.c |    2 --
 1 file changed, 2 deletions(-)
(quoted diff) +0 -0

b/arch/arm/mach-shmobile/board-marzen.c index fa102f7..2288dc2 100644

arch/arm/mach-shmobile/board-marzen.c +0 -2
@@ -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"),
Signature · 3 lines
Regards,

Laurent Pinchart
#21 lore raw

PATCH 8/17 ARM: shmobile: sh73a0: fixup sdhi compatible name

In reply to Kuninori Morimoto

sh73a0 != r8a7740

---
 arch/arm/boot/dts/sh73a0.dtsi |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm/boot/dts/sh73a0.dtsi +3 -3
index 78f7201a..6e23fb4 100644
@@ -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
Signature · 1 line
1.7.9.5
Acked-by on v1 8/17
#22 lore raw

Re: [PATCH 08/17] ARM: shmobile: sh73a0: fixup sdhi compatible name

Hi Morimoto-san,

Thank you for the patch.

Quoted 3 lines · On Thursday 14 November 2013 02:27:50 Kuninori Morimoto wrote:

sh73a0 != r8a7740

Quoted 35 lines
---
 arch/arm/boot/dts/sh73a0.dtsi |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm/boot/dts/sh73a0.dtsi +3 -3
index 78f7201a..6e23fb4 100644
@@ -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
Signature · 3 lines
Regards,

Laurent Pinchart
#23 lore raw

Re: [PATCH 0/16] mmc: SDHI: add new feature

In reply to Kuninori Morimoto

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

#24 lore raw

PATCH 9/17 mmc: tmio: bus_shift become tmio_mmc_data member

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

---
 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(-)
drivers/mmc/host/sh_mobile_sdhi.c +8 -0
index f344659..f1e35a7 100644
@@ -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;
drivers/mmc/host/tmio_mmc.c +8 -0
index 8860d4d..6cfb2d5 100644
@@ -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;
drivers/mmc/host/tmio_mmc.h +8 -9
index 86fd21e..aaa9c7e 100644
@@ -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));
 }
 
 
drivers/mmc/host/tmio_mmc_dma.c +1 -1
index 65edb4a..03e7b28 100644
@@ -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)
drivers/mmc/host/tmio_mmc_pio.c +0 -3
index 1f5f2ba..ed8fd5a 100644
@@ -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;
include/linux/mfd/tmio.h +1 -0
index b22883d..92f72cf 100644
@@ -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;
Signature · 1 line
1.7.9.5
#25 lore raw

PATCH 10/17 mmc: tmio: add new TMIO_MMC_HAVE_HIGH_REG flags

In reply to Kuninori Morimoto

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.

---
 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(-)
drivers/mmc/host/tmio_mmc.c +1 -0
index 6cfb2d5..8a781e2 100644
@@ -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)
drivers/mmc/host/tmio_mmc_pio.c +4 -10
index ed8fd5a..a55fe06 100644
@@ -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);
 }
include/linux/mfd/tmio.h +7 -0
index 92f72cf..8f6f2e9 100644
@@ -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);
Signature · 1 line
1.7.9.5
#26 lore raw

PATCH 11/17 mmc: SDHI: add SoC specific workaround via HW version

In reply to Kuninori Morimoto

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.

---
 drivers/mmc/host/sh_mobile_sdhi.c |   11 +++++++++++
 include/linux/mmc/tmio.h          |    1 +
 2 files changed, 12 insertions(+)
drivers/mmc/host/sh_mobile_sdhi.c +11 -0
index f1e35a7..d241d86 100644
@@ -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.
 	 */
include/linux/mmc/tmio.h +1 -0
index a1c1f32..84d9053 100644
@@ -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
Signature · 1 line
1.7.9.5
#27 lore raw

Re: [PATCH 11/17] mmc: SDHI: add SoC specific workaround via HW version

Hello.

Quoted 17 lines · Kuninori Morimoto

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.

---
  drivers/mmc/host/sh_mobile_sdhi.c |   11 +++++++++++
  include/linux/mmc/tmio.h          |    1 +
  2 files changed, 12 insertions(+)
drivers/mmc/host/sh_mobile_sdhi.c +0 -0
index f1e35a7..d241d86 100644

drivers/mmc/host/sh_mobile_sdhi.c line 37

Quoted 5 lines
drivers/mmc/host/sh_mobile_sdhi.c +2 -0
@@ -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...

[...]

include/linux/mmc/tmio.h line 39

Quoted 12 lines
include/linux/mmc/tmio.h +1 -0
index a1c1f32..84d9053 100644
@@ -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

#28 lore raw

Re: [PATCH 11/17] mmc: SDHI: add SoC specific workaround via HW version

Hi

Quoted 18 lines
Quoted 18 lines

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.

---
  drivers/mmc/host/sh_mobile_sdhi.c |   11 +++++++++++
  include/linux/mmc/tmio.h          |    1 +
  2 files changed, 12 insertions(+)
drivers/mmc/host/sh_mobile_sdhi.c +0 -0
index f1e35a7..d241d86 100644
@@ -33,6 +33,8 @@
 
Quoted 7 lines

drivers/mmc/host/sh_mobile_sdhi.c line 37

Quoted 4 lines
drivers/mmc/host/sh_mobile_sdhi.c +2 -0
  #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

#29 lore raw

PATCH 12/17 mmc: SDHI: tidyup sh_mobile_sdhi_of_match position

In reply to Kuninori Morimoto

it is easy to read if sh_mobile_sdhi_of_cfg and
sh_mobile_sdhi_of_match are closer

---
 drivers/mmc/host/sh_mobile_sdhi.c |   26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)
drivers/mmc/host/sh_mobile_sdhi.c +13 -13
index d241d86..1a3bd0b 100644
@@ -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 =
Signature · 1 line
1.7.9.5
#30 lore raw

PATCH 13/17 mmc: SDHI: updata sh_mobile_sdhi_of_data for r8a7778

In reply to Kuninori Morimoto

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.

---
 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(-)
arch/arm/boot/dts/r8a7778-bockw-reference.dts +3 -1
index 9c8bd37..6e58077 100644
@@ -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>;
 };
arch/arm/boot/dts/r8a7778.dtsi +0 -6
index 698809f..bfb7030 100644
@@ -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";
 	};
 
drivers/mmc/host/sh_mobile_sdhi.c +8 -1
index 1a3bd0b..dc97027 100644
@@ -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 */
Signature · 1 line
1.7.9.5
#31 lore raw

PATCH 14/17 mmc: SDHI: updata sh_mobile_sdhi_of_data for r8a7779

In reply to Kuninori Morimoto

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.

---
 arch/arm/boot/dts/r8a7779.dtsi    |    8 --------
 drivers/mmc/host/sh_mobile_sdhi.c |    2 +-
 2 files changed, 1 insertion(+), 9 deletions(-)
arch/arm/boot/dts/r8a7779.dtsi +0 -8
index 05fd41c..084132e 100644
@@ -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";
 	};
 };
drivers/mmc/host/sh_mobile_sdhi.c +1 -1
index dc97027..9cffca1 100644
@@ -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], },
 	{},
 };
Signature · 1 line
1.7.9.5
#32 lore raw

PATCH 15/17 mmc: SDHI: updata sh_mobile_sdhi_of_data for r8a7790

In reply to Kuninori Morimoto

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.

---
 drivers/mmc/host/sh_mobile_sdhi.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/mmc/host/sh_mobile_sdhi.c +9 -1
index 9cffca1..62dcb54 100644
@@ -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 */
Signature · 1 line
1.7.9.5
#33 lore raw

Re: [PATCH 0/16] ARM: shmobile: SDHI support for r8a7790

In reply to Kuninori Morimoto

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

#34 lore raw

PATCH 16/17 ARM: shmobile: lager: add SDHI0/2 support

SDHI0 (CN8) needs JP/SW settings

---
 arch/arm/mach-shmobile/board-lager.c |   75 +++++++++++++++++++++++++++++++++-
 1 file changed, 74 insertions(+), 1 deletion(-)
arch/arm/mach-shmobile/board-lager.c +74 -1
index fcf06fd..2e529dc 100644
@@ -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
Signature · 1 line
1.7.9.5
#35 lore raw

PATCH 17/17 ARM: shmobile: lager: use gpio/fixed regulator for SDHI

In reply to Kuninori Morimoto

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

---
 arch/arm/mach-shmobile/board-lager.c |   89 +++++++++++++++++++++++++++++-----
 1 file changed, 78 insertions(+), 11 deletions(-)
arch/arm/mach-shmobile/board-lager.c +78 -11
index 2e529dc..7c77521 100644
@@ -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));
Signature · 1 line
1.7.9.5
#36 lore raw

Re: [PATCH 17/17] ARM: shmobile: lager: use gpio/fixed regulator for SDHI

Hi Morimoto-san,

Thank you for the patch.

Quoted 79 lines · On Thursday 14 November 2013 02:35:08 Kuninori Morimoto wrote:

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

---
 arch/arm/mach-shmobile/board-lager.c |   89 ++++++++++++++++++++++++++-----
 1 file changed, 78 insertions(+), 11 deletions(-)
(quoted diff) +0 -0

b/arch/arm/mach-shmobile/board-lager.c index 2e529dc..7c77521 100644

arch/arm/mach-shmobile/board-lager.c +2 -0
@@ -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[] = {

arch/arm/mach-shmobile/board-lager.c +43 -4
 	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 },				\
+};									\

arch/arm/mach-shmobile/board-lager.c static const struct resource ether_resources[] · line 238

Quoted 10 lines
arch/arm/mach-shmobile/board-lager.c +10 -0
+									\
+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.

Quoted 50 lines
arch/arm/mach-shmobile/board-lager.c +12 -4
+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 */

arch/arm/mach-shmobile/board-lager.c +0 -1
-	gpio_request_one(RCAR_GP_PIN(5, 30), GPIOF_OUT_INIT_HIGH, NULL); /* SD2
Quoted 2 lines

VccQ 3.3V */ + platform_device_register_data(&platform_bus,
"reg-fixed-voltage", fixed_regulator_idx++, +

&vcc_sdhi0_info,

Quoted 9 lines

sizeof(struct fixed_voltage_config));

arch/arm/mach-shmobile/board-lager.c +1 -0
+	platform_device_register_data(&platform_bus, "reg-fixed-voltage",

fixed_regulator_idx++, + &vcc_sdhi2_info, sizeof(struct
fixed_voltage_config));

arch/arm/mach-shmobile/board-lager.c +2 -0
+
+	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,

Quoted 4 lines

sizeof(struct gpio_regulator_config)); +

arch/arm/mach-shmobile/board-lager.c +0 -0
 	platform_device_register_resndata(&platform_bus, "sh_mobile_sdhi", 0,
 					  sdhi0_resources, ARRAY_SIZE(sdhi0_resources),
 					  &sdhi0_info, sizeof(struct sh_mobile_sdhi_info));
Signature · 3 lines
Regards,

Laurent Pinchart
#37 lore raw

Re: [PATCH 17/17] ARM: shmobile: lager: use gpio/fixed regulator for SDHI

Hi Laurent

Thank you for your feedback

Quoted 52 lines
Quoted 52 lines
arch/arm/mach-shmobile/board-lager.c +52 -0
+/* 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,			\
Quoted 8 lines
Quoted 1 line

+};

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

#38 lore raw

Re: [PATCH 0/16] ARM: shmobile: SDHI support for r8a7790

In reply to Kuninori Morimoto

Hi Morimoto-san,

Thank you for the patches.

Quoted 7 lines · 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 ?

Signature · 3 lines
Regards,

Laurent Pinchart
#39 lore raw

Re: [PATCH 0/16] ARM: shmobile: SDHI support for r8a7790

Hi Laurent, Simon

Quoted 9 lines
Quoted 5 lines

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.

Quoted 1 line

Simon

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

#40 lore raw

Re: [PATCH 0/16] ARM: shmobile: SDHI support for r8a7790

In reply to Kuninori Morimoto

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(-)
#41 lore raw

PATCH v2 1/2 ARM: shmobile: lager: add gpio/fixed regulator for SDHI

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.

---
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(-)
arch/arm/mach-shmobile/board-lager.c +82 -1
index fcf06fd..3d1640f 100644
@@ -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));
 }
 
 /*
Signature · 1 line
1.7.9.5
#42 lore raw

Re: [PATCH 1/2 v2] ARM: shmobile: lager: add gpio/fixed regulator for SDHI

Hi Morimoto-san,

Thank you for the patch.

Quoted 20 lines · 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.

---
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(-)
(quoted diff) +0 -0

b/arch/arm/mach-shmobile/board-lager.c index fcf06fd..3d1640f 100644

arch/arm/mach-shmobile/board-lager.c line 34

Quoted 4 lines
arch/arm/mach-shmobile/board-lager.c +1 -0
@@ -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 ?

Quoted 21 lines
arch/arm/mach-shmobile/board-lager.c +13 -0
 #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);		\

arch/arm/mach-shmobile/board-lager.c static struct regulator_consumer_supply · line 167

Quoted 10 lines
arch/arm/mach-shmobile/board-lager.c +10 -0
+									\
+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.

Quoted 21 lines
arch/arm/mach-shmobile/board-lager.c +21 -0
+	.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,					\
+};									\

arch/arm/mach-shmobile/board-lager.c static struct regulator_consumer_supply fixed3v3_power_consumers[] = · line 198

Quoted 10 lines
arch/arm/mach-shmobile/board-lager.c +10 -0
+									\
+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.

Quoted 57 lines
arch/arm/mach-shmobile/board-lager.c +25 -1
+	.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));

arch/arm/mach-shmobile/board-lager.c +1 -0
+	platform_device_register_data(&platform_bus, "gpio-regulator",

gpio_regulator_idx++,

arch/arm/mach-shmobile/board-lager.c +1 -0
+				      &vccq_sdhi2_info, sizeof(struct

gpio_regulator_config)); }

/*

Signature · 3 lines
Regards,

Laurent Pinchart
#43 lore raw

Re: [PATCH 1/2 v2] ARM: shmobile: lager: add gpio/fixed regulator for SDHI

Hi Laurent

Quoted 6 lines
Quoted 4 lines

#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

Quoted 3 lines
Quoted 1 line

+static struct fixed_voltage_config vcc_sdhi##idx##_info = { \

You can make this structure const.

(snip)

Quoted 3 lines
Quoted 1 line

+static struct gpio_regulator_config vccq_sdhi##idx##_info = { \

You can make this structure const.

I see.
Thank you

Best regards
---
Kuninori Morimoto

#44 lore raw

Re: [PATCH 1/2 v2] ARM: shmobile: lager: add gpio/fixed regulator for SDHI

Hi Morimoto-san,

Quoted 6 lines · On Monday 18 November 2013 21:14:15 Kuninori Morimoto wrote:

Hi Laurent

Quoted 4 lines
Quoted 4 lines

#include <linux/platform_data/rcar-du.h>
#include <linux/platform_device.h>
#include <linux/phy.h>

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

+#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.

Quoted 12 lines
Quoted 3 lines
Quoted 1 line

+static struct fixed_voltage_config vcc_sdhi##idx##_info = { \

You can make this structure const.

(snip)

Quoted 3 lines
Quoted 1 line

+static struct gpio_regulator_config vccq_sdhi##idx##_info = { \

You can make this structure const.

I see.
Thank you

Signature · 3 lines
Regards,

Laurent Pinchart
#45 lore raw

Re: [PATCH 1/2 v2] ARM: shmobile: lager: add gpio/fixed regulator for SDHI

Hi Laurent

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

#include <linux/platform_data/rcar-du.h>
#include <linux/platform_device.h>
#include <linux/phy.h>

+#include <linux/regulator/driver.h>

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

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)

#46 lore raw

Re: [PATCH 1/2 v2] ARM: shmobile: lager: add gpio/fixed regulator for SDHI

Hi Morimoto-san,

Quoted 29 lines · On Tuesday 19 November 2013 23:37:32 Kuninori Morimoto wrote:

Hi Laurent

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

#include <linux/platform_data/rcar-du.h>
#include <linux/platform_device.h>
#include <linux/phy.h>

+#include <linux/regulator/driver.h>

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

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)

Quoted 3 lines

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

Signature · 3 lines
Regards,

Laurent Pinchart
#47 lore raw

Re: [PATCH 1/2 v2] ARM: shmobile: lager: add gpio/fixed regulator for SDHI

Hi Laurent

Quoted 10 lines
Quoted 10 lines

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

Quoted 7 lines
Quoted 3 lines

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

#48 lore raw

PATCH v2 1/2 ARM: shmobile: lager: add gpio/fixed regulator for SDHI

In reply to Kuninori Morimoto

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.

---
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(-)
arch/arm/mach-shmobile/board-lager.c +82 -1
index ce0ba7df..f20c10a 100644
@@ -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));
 }
 
 /*
Signature · 1 line
1.7.9.5
#49 lore raw

Re: [PATCH 1/2 v2] ARM: shmobile: lager: add gpio/fixed regulator for SDHI

In reply to Kuninori Morimoto
Quoted 5 lines · Kuninori Morimoto

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.

Quoted 8 lines

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

Quoted 126 lines
arch/arm/mach-shmobile/board-lager.c +82 -1
index ce0ba7df..f20c10a 100644
@@ -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));
 }
 
 /*
Signature · 1 line
1.7.9.5
#50 lore raw

PATCH v2 1/2 ARM: shmobile: lager: add SDHI0/2 support

In reply to Kuninori Morimoto

From: Kuninori Morimoto <[email protected]>

SDHI0 (CN8) needs JP/SW settings

---
v1 -> v2

- add Acked-by: Magnus Damm <[email protected]>

 arch/arm/mach-shmobile/board-lager.c |   64 ++++++++++++++++++++++++++++++++++
 1 file changed, 64 insertions(+)
arch/arm/mach-shmobile/board-lager.c +64 -0
index 3175748..90d7e81 100644
@@ -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));
 }
 
 /*
Signature · 1 line
1.7.9.5
#51 lore raw

PATCH v2 2/2 ARM: shmobile: lager: add SDHI0/2 support

In reply to Kuninori Morimoto

SDHI0 (CN8) needs JP/SW settings

---
v1 -> v2

- 1/2 patch become 2/2

 arch/arm/mach-shmobile/board-lager.c |   66 ++++++++++++++++++++++++++++++++++
 1 file changed, 66 insertions(+)
arch/arm/mach-shmobile/board-lager.c +66 -0
index 3d1640f..f32679a 100644
@@ -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));
 }
 
 /*
Signature · 1 line
1.7.9.5
#52 lore raw

Re: [PATCH 0/16] ARM: shmobile: SDHI support for r8a7790

In reply to Kuninori Morimoto
Quoted 10 lines · Kuninori Morimoto

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?

#53 lore raw

Re: [PATCH 0/16] ARM: shmobile: SDHI support for r8a7790

Hi Simon

Quoted 6 lines
Quoted 6 lines

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

Quoted 6 lines
Quoted 1 line
 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

#54 lore raw

Re: [PATCH 0/16] ARM: shmobile: SDHI support for r8a7790

Quoted 11 lines · Kuninori Morimoto

Hi Simon

Quoted 8 lines
Quoted 7 lines

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 +++++++++++++++++++++++++++++++++-
Quoted 8 lines
Quoted 4 lines

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.

#55 lore raw

Re: [PATCH 0/16] ARM: shmobile: SDHI support for r8a7790

Hi Simon

Quoted 23 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines

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 +++++++++++++++++++++++++++++++++-
Quoted 8 lines
Quoted 4 lines

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?

Quoted 6 lines

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

#56 lore raw

Re: [PATCH 0/16] ARM: shmobile: SDHI support for r8a7790

Quoted 33 lines · Kuninori Morimoto

Hi Simon

Quoted 23 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines

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 +++++++++++++++++++++++++++++++++-
Quoted 8 lines
Quoted 4 lines

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?

Quoted 6 lines

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.

Quoted 5 lines

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.

#57 lore raw
In reply to Kuninori Morimoto

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.

Quoted 40 lines

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 +-
Quoted 8 lines
 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