SDHI support for r8a7790
Subsystems (9)
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(-)
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
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
@@ -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
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
Signed-off-by Kuninori Morimoto <[email protected]>--- drivers/gpio/gpio-rcar.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)drivers/gpio/gpio-rcar.c +11
-1@@ -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
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 GPIOsgpio_rcar gpio_rcar.1: driving 32 GPIOsgpio_rcar gpio_rcar.2: driving 32 GPIOsgpio_rcar gpio_rcar.3: driving 32 GPIOsgpio_rcar gpio_rcar.4: driving 32 GPIOsgpio_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 registeredgpio_rcar gpio_rcar.0: driving 32 GPIOsgpio_rcar gpio_rcar.1: driving 32 GPIOsgpio_rcar gpio_rcar.2: driving 32 GPIOsgpio_rcar gpio_rcar.3: driving 32 GPIOsgpio_rcar gpio_rcar.4: driving 32 GPIOsgpio_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
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_sdhican't use gpio-regulator because of timing issue.
Quoted 15 lines
----------------- before ---------------------
...
sh-pfc pfc-r8a7790:r8a77900_pfcsupport 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_driverLinus, do you have any guidelines on this ?
Quoted 33 lines
gpio_rcargpio_rcar.0: driving 32 GPIOsgpio_rcargpio_rcar.1: driving 32 GPIOsgpio_rcargpio_rcar.2: driving 32 GPIOsgpio_rcargpio_rcar.3: driving 32 GPIOsgpio_rcargpio_rcar.4: driving 32 GPIOsgpio_rcargpio_rcar.5: driving 32 GPIOs
...sh_mobile_sdhish_mobile_sdhi.0: mmc0 base at0xee100000clock rate 97 MHzsh_mobile_sdhish_mobile_sdhi.2: mmc1 base at0xee140000clock 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_pfcsupport registeredgpio_rcargpio_rcar.0: driving 32 GPIOsgpio_rcargpio_rcar.1: driving 32 GPIOsgpio_rcargpio_rcar.2: driving 32 GPIOsgpio_rcargpio_rcar.3: driving 32 GPIOsgpio_rcargpio_rcar.4: driving 32 GPIOsgpio_rcargpio_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_sdhish_mobile_sdhi.0: mmc0 base at0xee100000clock rate 97 MHzsh_mobile_sdhish_mobile_sdhi.2: mmc1 base at0xee140000clock rate 48 MHz
Signature · 3 lines
Regards, Laurent Pinchart
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_driverLinus, 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
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
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
Re: [PATCH 0/16] mmc: bug fix patches
In reply to Kuninori MorimotoHi 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
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
@@ -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
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
Signed-off-by Shinobu Uehara <[email protected]>Signed-off-by Ryo Kataoka <[email protected]>Signed-off-by Kuninori Morimoto <[email protected]>--- 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.cindex b380225..05ae15c 100644drivers/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
-0host->sg_off += count;
Signature · 3 lines
Regards, Laurent Pinchart
PATCH 4/17 mmc: tmio: Add error IRQ status clear
In reply to Kuninori MorimotoFrom: 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
@@ -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
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.
Signed-off-by Shinobu Uehara <[email protected]>Signed-off-by Ryo Kataoka <[email protected]>Signed-off-by Kuninori Morimoto <[email protected]>--- drivers/mmc/host/tmio_mmc_pio.c | 3 +++ 1 file changed, 3 insertions(+)(quoted diff) +0
-0
b/drivers/mmc/host/tmio_mmc_pio.cindex 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
PATCH 5/17 mmc: tmio: don't overwrite caps2
In reply to Kuninori Morimoto02cb3221d5bb351ad9f7469453dcca7594a0fabf (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
@@ -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
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 overwritesmmc_of_parse()settings. This patch fixes it upSigned-off-by Kuninori Morimoto <[email protected]>
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.cindex 99f6d29..1f5f2ba 100644drivers/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
Re: [PATCH 0/16] ARM: shmobile: bug fix
In reply to Kuninori MorimotoHi 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
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
@@ -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
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
Signed-off-by Kuninori Morimoto <[email protected]>
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.dtsindex ce3fe9e..cd063cd 100644arch/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
PATCH 7/17 ARM: shmobile: marzen: remove SDHI0 WP pin setting
In reply to Kuninori MorimotoWP 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
@@ -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
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
Signed-off-by Kuninori Morimoto <[email protected]>
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.cindex fa102f7..2288dc2 100644arch/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
PATCH 8/17 ARM: shmobile: sh73a0: fixup sdhi compatible name
In reply to Kuninori Morimotosh73a0 != r8a7740
--- arch/arm/boot/dts/sh73a0.dtsi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm/boot/dts/sh73a0.dtsi +3 -3
@@ -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
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
Signed-off-by Kuninori Morimoto <[email protected]>
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@@ -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
Re: [PATCH 0/16] mmc: SDHI: add new feature
In reply to Kuninori MorimotoHi 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
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
@@ -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
@@ -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
@@ -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
@@ -293,7 +293,7 @@ void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdatif (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
@@ -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
@@ -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
PATCH 10/17 mmc: tmio: add new TMIO_MMC_HAVE_HIGH_REG flags
In reply to Kuninori MorimotoThe 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
@@ -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
@@ -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
@@ -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
PATCH 11/17 mmc: SDHI: add SoC specific workaround via HW version
In reply to Kuninori MorimotoOne 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
@@ -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
@@ -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
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.
Signed-off-by Kuninori Morimoto <[email protected]>--- 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
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@@ -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
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.
Signed-off-by Kuninori Morimoto <[email protected]>--- 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@@ -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
PATCH 12/17 mmc: SDHI: tidyup sh_mobile_sdhi_of_match position
In reply to Kuninori Morimotoit is easy to read if sh_mobile_sdhi_of_cfg andsh_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
@@ -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
PATCH 13/17 mmc: SDHI: updata sh_mobile_sdhi_of_data for r8a7778
In reply to Kuninori MorimotoThis 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
@@ -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
@@ -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
@@ -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
PATCH 14/17 mmc: SDHI: updata sh_mobile_sdhi_of_data for r8a7779
In reply to Kuninori MorimotoThis 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
@@ -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
@@ -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
PATCH 15/17 mmc: SDHI: updata sh_mobile_sdhi_of_data for r8a7790
In reply to Kuninori MorimotoThis 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
@@ -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
Re: [PATCH 0/16] ARM: shmobile: SDHI support for r8a7790
In reply to Kuninori MorimotoHi 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
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
@@ -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) ðer_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
PATCH 17/17 ARM: shmobile: lager: use gpio/fixed regulator for SDHI
In reply to Kuninori MorimotoSDHI0/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
@@ -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
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
Signed-off-by Kuninori Morimoto <[email protected]>--- 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.cindex 2e529dc..7c77521 100644arch/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 structregulator_consumer_supplyfixed3v3_power_consumers[] = {arch/arm/mach-shmobile/board-lager.c +43
-4REGULATOR_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(structfixed_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(structgpio_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
-0platform_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
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
Re: [PATCH 0/16] ARM: shmobile: SDHI support for r8a7790
In reply to Kuninori MorimotoHi 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
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 SDHIAs 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)
Re: [PATCH 0/16] ARM: shmobile: SDHI support for r8a7790
In reply to Kuninori MorimotoHi 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(-)
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
@@ -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) ðer_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
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.Signed-off-by Kuninori Morimoto <[email protected]>---
v1 -> v2- 2/2 become 1/2
- FIXME comment was addedarch/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.cindex 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) ðer_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
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_configvcc_sdhi##idx##_info = { \You can make this structure const.
(snip)
Quoted 3 lines
Quoted 1 line
+static struct
gpio_regulator_configvccq_sdhi##idx##_info = { \You can make this structure const.
I see.
Thank you
Best regards
---
Kuninori Morimoto
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_XXXneed 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_configvcc_sdhi##idx##_info = { \You can make this structure const.
(snip)
Quoted 3 lines
Quoted 1 line
+static struct
gpio_regulator_configvccq_sdhi##idx##_info = { \You can make this structure const.
I see.
Thank you
Signature · 3 lines
Regards, Laurent Pinchart
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_XXXneed itI believe you should include
regulator/machine.hinstead ofregulator/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)
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_XXXneed itI believe you should include
regulator/machine.hinstead ofregulator/driver.h.This is the result.
What is your opinion ?--- with
regulator/machine.h--------
CCarch/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)
Quoted 3 lines
--- with
regulator/driver.h------
CCarch/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
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--------
CCarch/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)
Quoted 7 lines
Quoted 3 lines
--- with
regulator/driver.h------
CCarch/arm/mach-shmobile/board-lager.o
(no error)I believe the enum
regulator_typedefinition should be moved out ofregulator/driver.h, but that's out of scope of this patch set, so I'm fine with includingregulator/driver.hfor now.
Thank you
Best regards
---
Kuninori Morimoto
PATCH v2 1/2 ARM: shmobile: lager: add gpio/fixed regulator for SDHI
In reply to Kuninori MorimotoFixed 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
@@ -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
Re: [PATCH 1/2 v2] ARM: shmobile: lager: add gpio/fixed regulator for SDHI
In reply to Kuninori MorimotoQuoted 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
Signed-off-by Kuninori Morimoto <[email protected]>---
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@@ -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
PATCH v2 1/2 ARM: shmobile: lager: add SDHI0/2 support
In reply to Kuninori MorimotoFrom: 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
@@ -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
PATCH v2 2/2 ARM: shmobile: lager: add SDHI0/2 support
In reply to Kuninori MorimotoSDHI0 (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
@@ -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
Re: [PATCH 0/16] ARM: shmobile: SDHI support for r8a7790
In reply to Kuninori MorimotoQuoted 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 supportarch/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?
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
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 supportarch/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.
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 supportarch/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
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 supportarch/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.
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 are1. bug fix patchset for mmc/sdhi
2. bug fix for SH-ARM
3. new feature for mmc
4. new feature for SH-ARMall these patches are needed, but, to different maintainer. I send these with separate set
Kuninori Morimoto (14):
gpio: rcar: usepostcore_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_shiftbecometmio_mmc_datamember
mmc: tmio: add newTMIO_MMC_HAVE_HIGH_REGflags
mmc: SDHI: add SoC specific workaround via HW version
mmc: SDHI: tidyupsh_mobile_sdhi_of_matchposition
mmc: SDHI: updatash_mobile_sdhi_of_datafor r8a7778
mmc: SDHI: updatash_mobile_sdhi_of_datafor r8a7779
mmc: SDHI: updatash_mobile_sdhi_of_datafor r8a7790
ARM: shmobile: lager: add SDHI0/2 support
ARM: shmobile: lager: use gpio/fixed regulator for SDHIShinobu Uehara (2):
mmc: tmio: Fix odd size access
mmc: tmio: Add error IRQ status cleararch/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