Remove platform callbacks from mmc_spi, sh_mmcif and sh_mobile_sdhi drivers
Subsystems (9)
cover Remove platform callbacks from mmc_spi, sh_mmcif and sh_mobile_sdhi drivers
Hello,
This patch set replaces callbacks to board code with regulators and GPIOs in the mmc_spi, sh_mmcif and sh_mobile_sdhi MMC drivers.
Most of the required infrastructure is in place already on the drivers side, except for CD/RO GPIOs support in the mmc_spi driver. The series thus starts with patch 01/12 that adds this feature to the mmc_spi driver.
Patches 02/12 to 05/12 remove the board callbacks from the ecovec24 and vision_ep9307 boards. The code has been compile-tested only as I don't have access to those boards.
Patches 06/12 to 07/12 then proceed to remove the callbacks from the drivers themselves and from the platform data structures.
This will be a bit messy to merge, as the series interleaves patches for drivers and board files. Given that the mmc_spi driver is marked as orphan in MAINTAINERS and that the vision_ep9307 hasn't seen any board-specific modification in the last couple of kernel versions one option would be to merge all patches (or at least patches 01/12 to 06/12) through Simon's tree if all involved maintainers agree.
The series is based on tag renesas-devel-20130725 fromgit://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas.git
Laurent Pinchart (12):
mmc: mmc_spi: Support CD/RO GPIOs
ARM: ep93xx: vision_ep9307: Use MMC CD and RO GPIO
sh: ecovec24: Use MMC/SDHI CD and RO GPIO
sh: ecovec24: Remove mmcif .down_pwr() callback
sh: ecovec24: Remove MMCIF and SDHI .set_pwr() callbacks
mmc: mmc_spi: Remove platform data .get_cd() and .get_ro() callbacks
mmc: sh_mmcif: Remove .down_pwr() callback from platform data
mmc: sh_mmcif: Remove .set_pwr() callback from platform data
mmc: sh_mobile_sdhi: Remove .get_cd() callback from platform data
mmc: sh_mobile_sdhi: Remove .set_pwr() callback from platform data
mmc: tmio-mmc: Remove .get_cd() callback from platform data
mmc: tmio-mmc: Remove .set_pwr() callback from platform data
arch/arm/mach-ep93xx/vision_ep9307.c | 56 ++--------------------- arch/sh/boards/mach-ecovec24/setup.c | 89 ++++-------------------------------- drivers/mmc/host/mmc_spi.c | 48 +++++++++---------- drivers/mmc/host/of_mmc_spi.c | 46 +++++-------------- drivers/mmc/host/sh_mmcif.c | 3 -- drivers/mmc/host/sh_mobile_sdhi.c | 18 -------- drivers/mmc/host/tmio_mmc.h | 1 - drivers/mmc/host/tmio_mmc_pio.c | 23 +--------- include/linux/mfd/tmio.h | 2 - include/linux/mmc/sh_mmcif.h | 2 - include/linux/mmc/sh_mobile_sdhi.h | 2 - include/linux/spi/mmc_spi.h | 18 ++++---- 12 files changed, 56 insertions(+), 252 deletions(-)
Signature · 3 lines
Regards, Laurent Pinchart
PATCH 1/12 mmc: mmc_spi: Support CD/RO GPIOs
Add support for passing CD/RO GPIO numbers directly to the mmc_spi driver instead of relying solely on board code callbacks to retrieve the CD/RO signals values.
--- drivers/mmc/host/mmc_spi.c | 32 +++++++++++++++++++++--------- drivers/mmc/host/of_mmc_spi.c | 46 +++++++++++-------------------------------- include/linux/spi/mmc_spi.h | 11 +++++++++++ 3 files changed, 46 insertions(+), 43 deletions(-)
drivers/mmc/host/mmc_spi.c +23 -9
@@ -36,6 +36,7 @@#include <linux/mmc/host.h> #include <linux/mmc/mmc.h> /* for R1_SPI_* bit values */ +#include <linux/mmc/slot-gpio.h> #include <linux/spi/spi.h> #include <linux/spi/mmc_spi.h>
@@ -1278,11 +1279,8 @@ static int mmc_spi_get_ro(struct mmc_host *mmc)if (host->pdata && host->pdata->get_ro)return !!host->pdata->get_ro (mmc->parent); -/* -* Board doesn't support read only detection; let the mmc core -* decide what to do. -*/ -return -ENOSYS ; +else +return mmc_gpio_get_ro (mmc); }static int mmc_spi_get_cd (struct mmc_host *mmc)
@@ -1291,7 +1289,8 @@ static int mmc_spi_get_cd(struct mmc_host *mmc)if (host->pdata && host->pdata->get_cd)return !!host->pdata->get_cd (mmc->parent); -return -ENOSYS ; +else +return mmc_gpio_get_cd (mmc); }static const struct mmc_host_ops mmc_spi_ops = {
@@ -1324,6 +1323,7 @@ static int mmc_spi_probe(struct spi_device *spi)struct mmc_host *mmc;struct mmc_spi_host *host;int status; +bool has_ro = false;/* We rely on full duplex transfers, mostly to reduce * per-transfer overheads (by making fewer transfers).
@@ -1448,18 +1448,32 @@ static int mmc_spi_probe(struct spi_device *spi) }/* pass platform capabilities, if any */ -if (host->pdata) +if (host->pdata) { mmc->caps |= host->pdata->caps; + mmc->caps2 |= host->pdata->caps2; + } status =mmc_add_host (mmc);if (status !=0 ) goto fail_add_host; +if (host->pdata && host->pdata->flags &MMC_SPI_USE_CD_GPIO ) { + status =mmc_gpio_request_cd (mmc, host->pdata->cd_gpio); +if (status !=0 ) + goto fail_add_host; + } + +if (host->pdata && host->pdata->flags &MMC_SPI_USE_RO_GPIO ) { + has_ro = true; + status =mmc_gpio_request_ro (mmc, host->pdata->ro_gpio); +if (status !=0 ) + goto fail_add_host; + } +dev_info (&spi->dev,"SD/MMC host %s%s%s%s%s\n" ,dev_name (&mmc->class_dev), host->dma_dev ?"" :", no DMA" , - (host->pdata && host->pdata->get_ro) - ?"" :", no WP" , + has_ro ?"" :", no WP" , (host->pdata && host->pdata->setpower) ?"" :", no poweroff" , (mmc->caps & MMC_CAP_NEEDS_POLL)
drivers/mmc/host/of_mmc_spi.c +12 -34
72 lines not on this page · raw message
include/linux/spi/mmc_spi.h +11 -0
@@ -7,6 +7,11 @@struct device ;struct mmc_host ; +#define MMC_SPI_USE_CD_GPIO (1 << 0) +#define MMC_SPI_USE_RO_GPIO (1 << 1) +#define MMC_SPI_CD_GPIO_ACTIVE_LOW (1 << 2) +#define MMC_SPI_RO_GPIO_ACTIVE_LOW (1 << 3) +/* Put this in platform_data of a device being used to manage an MMC/SD * card slot. (Modeled after PXA mmc glue; see that for usage examples.) *
@@ -30,8 +35,14 @@ struct mmc_spi_platform_data {*/ int (*get_cd)(struct device *); +/* Card Detect and Read Only GPIOs */ +unsigned int flags; +unsigned int cd_gpio; +unsigned int ro_gpio; +/* Capabilities to pass into mmc core (e.g. MMC_CAP_NEEDS_POLL). */ unsigned long caps; +unsigned long caps2;/* how long to debounce card detect, in msecs */ u16 detect_delay;
Signature · 1 line
1.8.1.5
PATCH 1/12 mmc: mmc_spi: Support CD/RO GPIOs
Quoted 24 lines · Laurent Pinchart
Add support for passing CD/RO GPIO numbers directly to the
mmc_spidriver instead of relying solely on board code callbacks to retrieve the CD/RO signals values.Signed-off-by Laurent Pinchart <[email protected]>--- drivers/mmc/host/mmc_spi.c | 32 +++++++++++++++++++++--------- drivers/mmc/host/of_mmc_spi.c | 46 +++++++++++-------------------------------- include/linux/spi/mmc_spi.h | 11 +++++++++++ 3 files changed, 46 insertions(+), 43 deletions(-)drivers/mmc/host/mmc_spi.c +1
-0@@ -36,6 +36,7 @@#include <linux/mmc/host.h> #include <linux/mmc/mmc.h> /* for R1_SPI_* bit values */ +#include <linux/mmc/slot-gpio.h> #include <linux/spi/spi.h> #include <linux/spi/mmc_spi.h>
drivers/mmc/host/mmc_spi.c static int mmc_spi_get_ro(struct mmc_host *mmc) · line 1283
Quoted 10 lines
drivers/mmc/host/mmc_spi.c +2
-5@@ -1278,11 +1279,8 @@ static int mmc_spi_get_ro(struct mmc_host *mmc)if (host->pdata && host->pdata->get_ro)return !!host->pdata->get_ro (mmc->parent); -/* -* Board doesn't support read only detection; let the mmc core -* decide what to do. -*/ -return -ENOSYS ; +else +return mmc_gpio_get_ro (mmc);
Why not just have the board file assign mmc_gpio_get_ro as host->pdata->get_ro? This would eliminate the need for the MMC_SPI_USE_RO_GPIO flag.
Also, if host->pdata->get_ro is not set then this will assume mmc_gpio_get_ro is valid, even if MMC_SPI_USE_RO_GPIO is not set. I'm guessing it will end up returning -ENOSYS, but they way the code reads is that if the host doesn't have get_ro function set, then it is must be a gpio.
Same applies for the other callbacks.
~Ryan
PATCH 1/12 mmc: mmc_spi: Support CD/RO GPIOs
Hi Ryan,
Quoted 30 lines · On Friday 26 July 2013 09:45:26 Ryan Mallon wrote:
Quoted 29 lines · Laurent Pinchart
Add support for passing CD/RO GPIO numbers directly to the
mmc_spidriver instead of relying solely on board code callbacks to retrieve the CD/RO signals values.Signed-off-by: Laurent Pinchart
<[email protected]>
---drivers/mmc/host/mmc_spi.c | 32 +++++++++++++++++++++--------- drivers/mmc/host/of_mmc_spi.c | 46 ++++++++++---------------------------- include/linux/spi/mmc_spi.h | 11 +++++++++++ 3 files changed, 46 insertions(+), 43 deletions(-)drivers/mmc/host/mmc_spi.c +1
-0@@ -36,6 +36,7 @@#include <linux/mmc/host.h> #include <linux/mmc/mmc.h> /* for R1_SPI_* bit values */ +#include <linux/mmc/slot-gpio.h> #include <linux/spi/spi.h> #include <linux/spi/mmc_spi.h> @@ -1278,11 +1279,8 @@ static int mmc_spi_get_ro(struct mmc_host *mmc)if (host->pdata && host->pdata->get_ro)return !!host->pdata->get_ro (mmc->parent);
Quoted 11 lines
drivers/mmc/host/mmc_spi.c static int mmc_spi_get_ro(struct mmc_host *mmc) · line 1283
Quoted 7 lines
drivers/mmc/host/mmc_spi.c +2
-5-/* -* Board doesn't support read only detection; let the mmc core -* decide what to do. -*/ -return -ENOSYS ; +else +return mmc_gpio_get_ro (mmc);Why not just have the board file assign
mmc_gpio_get_roashost->pdata->get_ro? This would eliminate the need for theMMC_SPI_USE_RO_GPIOflag.
Because the idea is to get rid of board callbacks and rely on proper kernel abstraction layers such as the GPIO subsystem. This will be especially important when adding device tree support to the mmc_spi driver.
Quoted 5 lines
Also, if
host->pdata->get_rois not set then this will assumemmc_gpio_get_rois valid, even ifMMC_SPI_USE_RO_GPIOis not set. I'm guessing it will end up returning-ENOSYS, but they way the code reads is that if the host doesn't haveget_rofunction set, then it is must be a gpio.
mmc_gpio_get_ro() will indeed return -ENOSYS when the MMC_SPI_USE_RO_GPIO flag isn't set, as the mmc_spi driver will not call mmc_gpio_request_ro() in that case.
This patch hides the -ENOSYS value from the mmc_spi_get_ro() and mmc_spi_get_cd() functions, perhaps making them slightly confusing, but patch 06/12 then gets rid of those functions, so I don't think it's a bit issue.
Quoted 1 line
Same applies for the other callbacks.
Signature · 3 lines
Regards, Laurent Pinchart
PATCH 1/12 mmc: mmc_spi: Support CD/RO GPIOs
Quoted 55 lines · Laurent Pinchart
Hi Ryan,
Quoted 30 lines · On Friday 26 July 2013 09:45:26 Ryan Mallon wrote:
Quoted 29 lines · Laurent Pinchart
Add support for passing CD/RO GPIO numbers directly to the
mmc_spidriver instead of relying solely on board code callbacks to retrieve the CD/RO signals values.Signed-off-by: Laurent Pinchart
<[email protected]>
---drivers/mmc/host/mmc_spi.c | 32 +++++++++++++++++++++--------- drivers/mmc/host/of_mmc_spi.c | 46 ++++++++++---------------------------- include/linux/spi/mmc_spi.h | 11 +++++++++++ 3 files changed, 46 insertions(+), 43 deletions(-)drivers/mmc/host/mmc_spi.c +1
-0@@ -36,6 +36,7 @@#include <linux/mmc/host.h> #include <linux/mmc/mmc.h> /* for R1_SPI_* bit values */ +#include <linux/mmc/slot-gpio.h> #include <linux/spi/spi.h> #include <linux/spi/mmc_spi.h> @@ -1278,11 +1279,8 @@ static int mmc_spi_get_ro(struct mmc_host *mmc)if (host->pdata && host->pdata->get_ro)return !!host->pdata->get_ro (mmc->parent);Quoted 11 lines
drivers/mmc/host/mmc_spi.c static int mmc_spi_get_ro(struct mmc_host *mmc) · line 1283
Quoted 7 lines
drivers/mmc/host/mmc_spi.c +2
-5-/* -* Board doesn't support read only detection; let the mmc core -* decide what to do. -*/ -return -ENOSYS ; +else +return mmc_gpio_get_ro (mmc);Why not just have the board file assign
mmc_gpio_get_roashost->pdata->get_ro? This would eliminate the need for theMMC_SPI_USE_RO_GPIOflag.Because the idea is to get rid of board callbacks and rely on proper kernel abstraction layers such as the GPIO subsystem. This will be especially important when adding device tree support to the
mmc_spidriver.Quoted 5 lines
Also, if
host->pdata->get_rois not set then this will assumemmc_gpio_get_rois valid, even ifMMC_SPI_USE_RO_GPIOis not set. I'm guessing it will end up returning-ENOSYS, but they way the code reads is that if the host doesn't haveget_rofunction set, then it is must be a gpio.
Quoted 7 lines
mmc_gpio_get_ro()will indeed return-ENOSYSwhen theMMC_SPI_USE_RO_GPIOflag isn't set, as themmc_spidriver will not callmmc_gpio_request_ro()in that case.This patch hides the
-ENOSYSvalue from themmc_spi_get_ro()andmmc_spi_get_cd()functions, perhaps making them slightly confusing, but patch 06/12 then gets rid of those functions, so I don't think it's a bit issue.
Ah, I didn't read far enough along in the patch series :-). So all mmc spi ro/cd controls are now assumed to be gpios?
~Ryan
PATCH 1/12 mmc: mmc_spi: Support CD/RO GPIOs
Hi Ryan,
Quoted 59 lines · On Friday 26 July 2013 10:23:01 Ryan Mallon wrote:
Quoted 58 lines · Laurent Pinchart
Quoted 30 lines · On Friday 26 July 2013 09:45:26 Ryan Mallon wrote:
Quoted 29 lines · Laurent Pinchart
Add support for passing CD/RO GPIO numbers directly to the
mmc_spidriver instead of relying solely on board code callbacks to retrieve the CD/RO signals values.Signed-off-by: Laurent Pinchart
<[email protected]>
---drivers/mmc/host/mmc_spi.c | 32 +++++++++++++++++++++--------- drivers/mmc/host/of_mmc_spi.c | 46 ++++++++++-------------------------- include/linux/spi/mmc_spi.h | 11 +++++++++++ 3 files changed, 46 insertions(+), 43 deletions(-)drivers/mmc/host/mmc_spi.c +1
-0@@ -36,6 +36,7 @@#include <linux/mmc/host.h> #include <linux/mmc/mmc.h> /* for R1_SPI_* bit values */ +#include <linux/mmc/slot-gpio.h> #include <linux/spi/spi.h> #include <linux/spi/mmc_spi.h> @@ -1278,11 +1279,8 @@ static int mmc_spi_get_ro(struct mmc_host *mmc)if (host->pdata && host->pdata->get_ro)return !!host->pdata->get_ro (mmc->parent);Quoted 11 lines
drivers/mmc/host/mmc_spi.c static int mmc_spi_get_ro(struct mmc_host *mmc) · line 1283
Quoted 7 lines
drivers/mmc/host/mmc_spi.c +2
-5-/* -* Board doesn't support read only detection; let the mmc core -* decide what to do. -*/ -return -ENOSYS ; +else +return mmc_gpio_get_ro (mmc);Why not just have the board file assign
mmc_gpio_get_roashost->pdata->get_ro? This would eliminate the need for theMMC_SPI_USE_RO_GPIOflag.Because the idea is to get rid of board callbacks and rely on proper kernel abstraction layers such as the GPIO subsystem. This will be especially important when adding device tree support to the
mmc_spidriver.Quoted 5 lines
Also, if
host->pdata->get_rois not set then this will assumemmc_gpio_get_rois valid, even ifMMC_SPI_USE_RO_GPIOis not set. I'm guessing it will end up returning-ENOSYS, but they way the code reads is that if the host doesn't haveget_rofunction set, then it is must be a gpio.
mmc_gpio_get_ro()will indeed return-ENOSYSwhen theMMC_SPI_USE_RO_GPIOflag isn't set, as themmc_spidriver will not callmmc_gpio_request_ro()in that case.
Quoted 7 lines
Quoted 4 lines
This patch hides the
-ENOSYSvalue from themmc_spi_get_ro()andmmc_spi_get_cd()functions, perhaps making them slightly confusing, but patch 06/12 then gets rid of those functions, so I don't think it's a bit issue.Ah, I didn't read far enough along in the patch series :-). So all mmc spi ro/cd controls are now assumed to be gpios?
That's correct. It's the case in practice for all the boards we support in mainline. If the situation changes in the future for a new board (hardware engineers tend to have strange design ideas sometimes) a custom GPIO driver might be needed (for FPGA/CPLD-controlled GPIOs for instance).
Signature · 3 lines
Regards, Laurent Pinchart
PATCH 2/12 ARM: ep93xx: vision_ep9307: Use MMC CD and RO GPIO
In reply to Laurent PinchartPass the CD and RO GPIO numbers to the MMC SPI driver and remove the custom .get_cd() and .get_ro() callback functions.
--- arch/arm/mach-ep93xx/vision_ep9307.c | 56 +++--------------------------------- 1 file changed, 4 insertions(+), 52 deletions(-)
arch/arm/mach-ep93xx/vision_ep9307.c +4 -52
@@ -224,62 +224,14 @@ static struct ep93xx_spi_chip_ops vision_spi_flash_hw = {#define VISION_SPI_MMC_WP EP93XX_GPIO_LINE_F(0)#define VISION_SPI_MMC_CD EP93XX_GPIO_LINE_EGPIO15 -static struct gpio vision_spi_mmc_gpios[] = { - {VISION_SPI_MMC_WP ,GPIOF_DIR_IN ,"mmc_spi:wp" }, - {VISION_SPI_MMC_CD ,GPIOF_DIR_IN ,"mmc_spi:cd" }, -}; - -static int vision_spi_mmc_init (struct device *pdev, -irqreturn_t (*func)(int ,void *),void *pdata) -{ -int err; - - err =gpio_request_array (vision_spi_mmc_gpios, -ARRAY_SIZE (vision_spi_mmc_gpios)); -if (err) -return err; - - err =gpio_set_debounce (VISION_SPI_MMC_CD ,1 ); -if (err) - goto exit_err; - - err =request_irq (gpio_to_irq (VISION_SPI_MMC_CD ), func, -IRQ_TYPE_EDGE_BOTH ,"mmc_spi:cd" , pdata); -if (err) - goto exit_err; - -return 0 ; - -exit_err: -gpio_free_array (vision_spi_mmc_gpios,ARRAY_SIZE (vision_spi_mmc_gpios)); -return err; - -} - -static void vision_spi_mmc_exit (struct device *pdev,void *pdata) -{ -free_irq (gpio_to_irq (VISION_SPI_MMC_CD ), pdata); -gpio_free_array (vision_spi_mmc_gpios,ARRAY_SIZE (vision_spi_mmc_gpios)); -} - -static int vision_spi_mmc_get_ro (struct device *pdev) -{ -return !!gpio_get_value (VISION_SPI_MMC_WP ); -} - -static int vision_spi_mmc_get_cd (struct device *pdev) -{ -return !gpio_get_value (VISION_SPI_MMC_CD ); -} -static struct mmc_spi_platform_data vision_spi_mmc_data = { - .init = vision_spi_mmc_init, - .exit = vision_spi_mmc_exit, - .get_ro = vision_spi_mmc_get_ro, - .get_cd = vision_spi_mmc_get_cd, .detect_delay =100 , .powerup_msecs =100 , .ocr_mask =MMC_VDD_32_33 |MMC_VDD_33_34 , + .flags =MMC_SPI_USE_CD_GPIO |MMC_SPI_USE_RO_GPIO , + .cd_gpio =VISION_SPI_MMC_CD , + .ro_gpio =VISION_SPI_MMC_WP , + .caps2 =MMC_CAP2_RO_ACTIVE_HIGH , };static int vision_spi_mmc_hw_setup (struct spi_device *spi)
Signature · 1 line
1.8.1.5
PATCH 2/12 ARM: ep93xx: vision_ep9307: Use MMC CD and RO GPIO
Quoted 8 lines · Laurent Pinchart
Pass the CD and RO GPIO numbers to the MMC SPI driver and remove the custom .get_cd() and .get_ro() callback functions.
Signed-off-by Laurent Pinchart <[email protected]>--- arch/arm/mach-ep93xx/vision_ep9307.c | 56 +++--------------------------------- 1 file changed, 4 insertions(+), 52 deletions(-)
I'll try testing this tomorrow.
Thanks,
Hartley
PATCH 2/12 ARM: ep93xx: vision_ep9307: Use MMC CD and RO GPIO
In reply to Laurent PinchartQuoted 25 lines · Laurent Pinchart
Pass the CD and RO GPIO numbers to the MMC SPI driver and remove the custom .get_cd() and .get_ro() callback functions.
Signed-off-by Laurent Pinchart <[email protected]>--- arch/arm/mach-ep93xx/vision_ep9307.c | 56 +++--------------------------------- 1 file changed, 4 insertions(+), 52 deletions(-)arch/arm/mach-ep93xx/vision_ep9307.c +0
-8@@ -224,62 +224,14 @@ static struct ep93xx_spi_chip_ops vision_spi_flash_hw = {#define VISION_SPI_MMC_WP EP93XX_GPIO_LINE_F(0)#define VISION_SPI_MMC_CD EP93XX_GPIO_LINE_EGPIO15 -static struct gpio vision_spi_mmc_gpios[] = { - {VISION_SPI_MMC_WP ,GPIOF_DIR_IN ,"mmc_spi:wp" }, - {VISION_SPI_MMC_CD ,GPIOF_DIR_IN ,"mmc_spi:cd" }, -}; - -static int vision_spi_mmc_init (struct device *pdev, -irqreturn_t (*func)(int ,void *),void *pdata) -{
arch/arm/mach-ep93xx/vision_ep9307.c static struct ep93xx_spi_chip_ops vision_spi_flash_hw = { · line 244
Quoted 10 lines
arch/arm/mach-ep93xx/vision_ep9307.c +0
-10-int err; - - err =gpio_request_array (vision_spi_mmc_gpios, -ARRAY_SIZE (vision_spi_mmc_gpios)); -if (err) -return err; - - err =gpio_set_debounce (VISION_SPI_MMC_CD ,1 ); -if (err) - goto exit_err;
I tested this and it _kind_ of works.
The card detect is a bit flaky due to the gpio interrupt debounce not being enabled.
The only way I can see to fix this is add the following to this patch:
@@ -233,8 +233,31 @@ static struct mmc_spi_platform_data vision_spi_mmc_data = {
.caps2 = MMC_CAP2_RO_ACTIVE_HIGH,
};
+static int vision_spi_mmc_enable_cd_debounce(struct spi_device *spi) +{
+ int ret;
+
+ ret = gpio_request_one(VISION_SPI_MMC_CD, GPIOF_DIR_IN, spi->modalias);
+ if (ret)
+ return ret;
+
+ ret = gpio_set_debounce(VISION_SPI_MMC_CD, 1);
+ if (ret)
+ return ret;
+
+ gpio_free(VISION_SPI_MMC_CD);
+
+ return 0;
+}
+
static int vision_spi_mmc_hw_setup(struct spi_device *spi) {
+ int ret;
+
+ ret = vision_spi_mmc_enable_cd_debounce(spi);
+ if (ret)
+ return ret;
+
return gpio_request_one(VISION_SPI_MMC_CS, GPIOF_INIT_HIGH,
spi->modalias);
}
Regards,
Hartley
PATCH 2/12 ARM: ep93xx: vision_ep9307: Use MMC CD and RO GPIO
Hi Hartley,
Quoted 78 lines · On Thursday 25 July 2013 19:19:52 H Hartley Sweeten wrote:
Quoted 27 lines · Laurent Pinchart
Pass the CD and RO GPIO numbers to the MMC SPI driver and remove the custom .get_cd() and .get_ro() callback functions.
Signed-off-by: Laurent Pinchart
<[email protected]>
---arch/arm/mach-ep93xx/vision_ep9307.c | 56 +++--------------------------- 1 file changed, 4 insertions(+), 52 deletions(-)(quoted diff) +0
-0
b/arch/arm/mach-ep93xx/vision_ep9307.cindex 605956f..ab94dc5 100644arch/arm/mach-ep93xx/vision_ep9307.c +0
-0@@ -224,62 +224,14 @@ static struct ep93xx_spi_chip_ops
vision_spi_flash_hw= {>
#defineVISION_SPI_MMC_WPEP93XX_GPIO_LINE_F(0)
#defineVISION_SPI_MMC_CDEP93XX_GPIO_LINE_EGPIO15arch/arm/mach-ep93xx/vision_ep9307.c +0
-8-static struct gpio vision_spi_mmc_gpios[] = { - {VISION_SPI_MMC_WP ,GPIOF_DIR_IN ,"mmc_spi:wp" }, - {VISION_SPI_MMC_CD ,GPIOF_DIR_IN ,"mmc_spi:cd" }, -}; - -static int vision_spi_mmc_init (struct device *pdev, -irqreturn_t (*func)(int ,void *),void *pdata) -{arch/arm/mach-ep93xx/vision_ep9307.c static struct ep93xx_spi_chip_ops vision_spi_flash_hw = { · line 244
Quoted 10 lines
arch/arm/mach-ep93xx/vision_ep9307.c +0
-10-int err; - - err =gpio_request_array (vision_spi_mmc_gpios, -ARRAY_SIZE (vision_spi_mmc_gpios)); -if (err) -return err; - - err =gpio_set_debounce (VISION_SPI_MMC_CD ,1 ); -if (err) - goto exit_err;I tested this and it _kind_ of works.
The card detect is a bit flaky due to the gpio interrupt debounce not being enabled.
The only way I can see to fix this is add the following to this patch:
(quoted diff) +23
-0@@ -233,8 +233,31 @@ static struct mmc_spi_platform_data vision_spi_mmc_data = { .caps2 = MMC_CAP2_RO_ACTIVE_HIGH, }; +static int vision_spi_mmc_enable_cd_debounce(struct spi_device *spi) +{ + int ret; + + ret = gpio_request_one(VISION_SPI_MMC_CD, GPIOF_DIR_IN, spi->modalias); + if (ret) + return ret; + + ret = gpio_set_debounce(VISION_SPI_MMC_CD, 1); + if (ret) + return ret; + + gpio_free(VISION_SPI_MMC_CD); + + return 0; +} + static int vision_spi_mmc_hw_setup(struct spi_device *spi) { + int ret; + + ret = vision_spi_mmc_enable_cd_debounce(spi); + if (ret) + return ret; + return gpio_request_one(VISION_SPI_MMC_CS, GPIOF_INIT_HIGH, spi->modalias);
Quoted 1 line
}
What about extending the mmc_spi and MMC core with GPIO debounce support ? The mmc_spi driver would get a new cd_gpio_debounce field, which would be passed to mmc_gpio_request_cd(). I can cook up a patch.
Signature · 3 lines
Regards, Laurent Pinchart
PATCH 2/12 ARM: ep93xx: vision_ep9307: Use MMC CD and RO GPIO
Quoted 11 lines · Laurent Pinchart
Quoted 10 lines · On Thursday 25 July 2013 19:19:52 H Hartley Sweeten wrote:
Quoted 9 lines · Laurent Pinchart
Pass the CD and RO GPIO numbers to the MMC SPI driver and remove the custom .get_cd() and .get_ro() callback functions.
Signed-off-by: Laurent Pinchart
<[email protected]>
---arch/arm/mach-ep93xx/vision_ep9307.c | 56 +++--------------------------- 1 file changed, 4 insertions(+), 52 deletions(-)
<snip>
Quoted 6 lines
Quoted 6 lines
I tested this and it _kind_ of works.
The card detect is a bit flaky due to the gpio interrupt debounce not being enabled.
The only way I can see to fix this is add the following to this patch:
<snip>
Quoted 3 lines
What about extending the
mmc_spiand MMC core with GPIO debounce support ? Themmc_spidriver would get a newcd_gpio_debouncefield, which would be passed tommc_gpio_request_cd(). I can cook up a patch.
Works for me. That would also remove the need for the platform init to request then free the GPIO just to set the debounce.
Make sure you do the gpiu_set_debounce() after the GPIO has been requested or you trigger a WARN due to the auto-requested GPIO. Then, of course, the drivers gpio request will fail...
I'll give it a test when you post it.
Thanks,
Hartley
PATCH 3/12 sh: ecovec24: Use MMC/SDHI CD and RO GPIO
In reply to Laurent PinchartPass the CD and RO GPIO numbers to the MMC SPI and SDHI drivers and remove the custom .get_cd() and .get_ro() callback functions.
--- arch/sh/boards/mach-ecovec24/setup.c | 42 +++++++----------------------------- 1 file changed, 8 insertions(+), 34 deletions(-)
arch/sh/boards/mach-ecovec24/setup.c +8 -34
@@ -620,18 +620,14 @@ static void sdhi0_set_pwr(struct platform_device *pdev, int state)gpio_set_value (GPIO_PTB6 , state); } -static int sdhi0_get_cd (struct platform_device *pdev) -{ -return !gpio_get_value (GPIO_PTY7 ); -} -static struct sh_mobile_sdhi_info sdhi0_info = { .dma_slave_tx =SHDMA_SLAVE_SDHI0_TX , .dma_slave_rx =SHDMA_SLAVE_SDHI0_RX , .set_pwr = sdhi0_set_pwr, .tmio_caps =MMC_CAP_SDIO_IRQ |MMC_CAP_POWER_OFF_CARD |MMC_CAP_NEEDS_POLL , - .get_cd = sdhi0_get_cd, + .tmio_flags =TMIO_MMC_USE_GPIO_CD , + .cd_gpio =GPIO_PTY7 , };static struct resource sdhi0_resources[] = {
@@ -678,18 +674,14 @@ static void cn12_set_pwr(struct platform_device *pdev, int state)#if !defined(CONFIG_MMC_SH_MMCIF ) && !defined(CONFIG_MMC_SH_MMCIF_MODULE )/* SDHI1 */ -static int sdhi1_get_cd (struct platform_device *pdev) -{ -return !gpio_get_value (GPIO_PTW7 ); -} -static struct sh_mobile_sdhi_info sdhi1_info = { .dma_slave_tx =SHDMA_SLAVE_SDHI1_TX , .dma_slave_rx =SHDMA_SLAVE_SDHI1_RX , .tmio_caps =MMC_CAP_SDIO_IRQ |MMC_CAP_POWER_OFF_CARD |MMC_CAP_NEEDS_POLL , + .tmio_flags =TMIO_MMC_USE_GPIO_CD , + .cd_gpio =GPIO_PTW7 , .set_pwr = cn12_set_pwr, - .get_cd = sdhi1_get_cd, }; static struct resource sdhi1_resources[] = {
@@ -719,27 +711,19 @@ static struct platform_device sdhi1_device = {#else /* MMC SPI */ -static int mmc_spi_get_ro (struct device *dev) -{ -return gpio_get_value (GPIO_PTY6 ); -} - -static int mmc_spi_get_cd (struct device *dev) -{ -return !gpio_get_value (GPIO_PTY7 ); -} -static void mmc_spi_setpower (struct device *dev,unsigned int maskval) {gpio_set_value (GPIO_PTB6 , maskval ?1 :0 ); }static struct mmc_spi_platform_data mmc_spi_info = { - .get_ro = mmc_spi_get_ro, - .get_cd = mmc_spi_get_cd, .caps =MMC_CAP_NEEDS_POLL , + .caps2 =MMC_CAP2_RO_ACTIVE_HIGH , .ocr_mask =MMC_VDD_32_33 |MMC_VDD_33_34 ,/* 3.3V only */ .setpower = mmc_spi_setpower, + .flags =MMC_SPI_USE_CD_GPIO |MMC_SPI_USE_RO_GPIO , + .cd_gpio =GPIO_PTY7 , + .ro_gpio =GPIO_PTY6 , }; static struct spi_board_info spi_bus[] = {
@@ -1342,10 +1326,6 @@ static int __init arch_setup(void)gpio_direction_input (GPIO_PTR6 );/* SD-card slot CN11 */ -/* Card-detect, used on CN11, either with SDHI0 or with SPI */ -gpio_request (GPIO_PTY7 ,NULL ); -gpio_direction_input (GPIO_PTY7 ); -#if defined(CONFIG_MMC_SDHI ) || defined(CONFIG_MMC_SDHI_MODULE )/* enable SDHI0 on CN11 (needs DS2.4 set to ON) */ gpio_request (GPIO_FN_SDHI0WP ,NULL );
@@ -1364,8 +1344,6 @@ static int __init arch_setup(void)gpio_direction_output (GPIO_PTM4 ,1 );/* active low CS */ gpio_request (GPIO_PTB6 ,NULL );/* 3.3V power control */ gpio_direction_output (GPIO_PTB6 ,0 );/* disable power by default */ -gpio_request (GPIO_PTY6 ,NULL );/* write protect */ -gpio_direction_input (GPIO_PTY6 );spi_register_board_info (spi_bus,ARRAY_SIZE (spi_bus));#endif
@@ -1395,10 +1373,6 @@ static int __init arch_setup(void)gpio_request (GPIO_FN_SDHI1D1 ,NULL );gpio_request (GPIO_FN_SDHI1D0 ,NULL ); -/* Card-detect, used on CN12 with SDHI1 */ -gpio_request (GPIO_PTW7 ,NULL ); -gpio_direction_input (GPIO_PTW7 ); - cn12_enabled = true;#endif
Signature · 1 line
1.8.1.5
PATCH 4/12 sh: ecovec24: Remove mmcif .down_pwr() callback
In reply to Laurent PinchartThe callback isn't used by the mmcif driver, don't initialize it in board code.
--- arch/sh/boards/mach-ecovec24/setup.c | 6 ------ 1 file changed, 6 deletions(-)
arch/sh/boards/mach-ecovec24/setup.c +0 -6
@@ -983,11 +983,6 @@ static struct platform_device vou_device = { #if defined(CONFIG_MMC_SH_MMCIF) || defined(CONFIG_MMC_SH_MMCIF_MODULE) /* SH_MMCIF */ -static void mmcif_down_pwr(struct platform_device *pdev) -{ - cn12_set_pwr(pdev, 0); -} - static struct resource sh_mmcif_resources[] = { [0] = { .name = "SH_MMCIF",
@@ -1009,7 +1004,6 @@ static struct resource sh_mmcif_resources[] = {static struct sh_mmcif_plat_data sh_mmcif_plat = { .set_pwr = cn12_set_pwr, - .down_pwr = mmcif_down_pwr, .sup_pclk =0 ,/* SH7724: Max Pclk/2 */ .caps =MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA |
Signature · 1 line
1.8.1.5
PATCH 5/12 sh: ecovec24: Remove MMCIF and SDHI .set_pwr() callbacks
In reply to Laurent PinchartThe MMCIF and SHDI platform data .set_pwr() callbacks are used to control the vmmc/vqmmc power supplies. As the power supplies already register control GPIOs there's no need to perform the operation manually. Remove the callback functions.
--- arch/sh/boards/mach-ecovec24/setup.c | 41 ------------------------------------ 1 file changed, 41 deletions(-)
arch/sh/boards/mach-ecovec24/setup.c +0 -41
@@ -601,29 +601,9 @@ static struct platform_device sdhi0_power = { }, }; -static void sdhi0_set_pwr (struct platform_device *pdev,int state) -{ -static int power_gpio = -EINVAL ; - -if (power_gpio <0 ) { -int ret =gpio_request (GPIO_PTB6 ,NULL ); -if (!ret) { - power_gpio =GPIO_PTB6 ; -gpio_direction_output (power_gpio,0 ); - } - } - -/* -* Toggle the GPIO regardless, whether we managed to grab it above or -* the fixed regulator driver did. -*/ -gpio_set_value (GPIO_PTB6 , state); -} -static struct sh_mobile_sdhi_info sdhi0_info = { .dma_slave_tx =SHDMA_SLAVE_SDHI0_TX , .dma_slave_rx =SHDMA_SLAVE_SDHI0_RX , - .set_pwr = sdhi0_set_pwr, .tmio_caps =MMC_CAP_SDIO_IRQ |MMC_CAP_POWER_OFF_CARD |MMC_CAP_NEEDS_POLL , .tmio_flags =TMIO_MMC_USE_GPIO_CD ,
@@ -653,25 +633,6 @@ static struct platform_device sdhi0_device = { }, }; -static void cn12_set_pwr (struct platform_device *pdev,int state) -{ -static int power_gpio = -EINVAL ; - -if (power_gpio <0 ) { -int ret =gpio_request (GPIO_PTB7 ,NULL ); -if (!ret) { - power_gpio =GPIO_PTB7 ; -gpio_direction_output (power_gpio,0 ); - } - } - -/* -* Toggle the GPIO regardless, whether we managed to grab it above or -* the fixed regulator driver did. -*/ -gpio_set_value (GPIO_PTB7 , state); -} -#if !defined(CONFIG_MMC_SH_MMCIF ) && !defined(CONFIG_MMC_SH_MMCIF_MODULE )/* SDHI1 */ static struct sh_mobile_sdhi_info sdhi1_info = {
@@ -681,7 +642,6 @@ static struct sh_mobile_sdhi_info sdhi1_info = { MMC_CAP_NEEDS_POLL, .tmio_flags = TMIO_MMC_USE_GPIO_CD, .cd_gpio = GPIO_PTW7, - .set_pwr = cn12_set_pwr, };static struct resource sdhi1_resources[] = {
@@ -1003,7 +963,6 @@ static struct resource sh_mmcif_resources[] = { };static struct sh_mmcif_plat_data sh_mmcif_plat = { - .set_pwr = cn12_set_pwr, .sup_pclk =0 ,/* SH7724: Max Pclk/2 */ .caps =MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA |
Signature · 1 line
1.8.1.5
PATCH 6/12 mmc: mmc_spi: Remove platform data .get_cd() and .get_ro() callbacks
In reply to Laurent PinchartAll platforms now pass the CD and RO GPIOs to the MMC SPI driver, those callbacks are not used anymore. Remove them.
--- drivers/mmc/host/mmc_spi.c | 24 ++---------------------- include/linux/spi/mmc_spi.h | 9 --------- 2 files changed, 2 insertions(+), 31 deletions(-)
drivers/mmc/host/mmc_spi.c +2 -22
@@ -1273,31 +1273,11 @@ static void mmc_spi_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) } } -static int mmc_spi_get_ro (struct mmc_host *mmc) -{ -struct mmc_spi_host *host =mmc_priv (mmc); - -if (host->pdata && host->pdata->get_ro) -return !!host->pdata->get_ro (mmc->parent); -else -return mmc_gpio_get_ro (mmc); -} - -static int mmc_spi_get_cd (struct mmc_host *mmc) -{ -struct mmc_spi_host *host =mmc_priv (mmc); - -if (host->pdata && host->pdata->get_cd) -return !!host->pdata->get_cd (mmc->parent); -else -return mmc_gpio_get_cd (mmc); -} -static const struct mmc_host_ops mmc_spi_ops = { .request = mmc_spi_request, .set_ios = mmc_spi_set_ios, - .get_ro = mmc_spi_get_ro, - .get_cd = mmc_spi_get_cd, + .get_ro = mmc_gpio_get_ro, + .get_cd = mmc_gpio_get_cd, };
include/linux/spi/mmc_spi.h +0 -9
@@ -26,15 +26,6 @@ struct mmc_spi_platform_data { void *);void (*exit)(struct device *,void *); -/* sense switch on sd cards */ -int (*get_ro)(struct device *); - -/* -* If board does not use CD interrupts, driver can optimize polling -* using this function. -*/ -int (*get_cd)(struct device *); -/* Card Detect and Read Only GPIOs */ unsigned int flags;unsigned int cd_gpio;
Signature · 1 line
1.8.1.5
PATCH 7/12 mmc: sh_mmcif: Remove .down_pwr() callback from platform data
In reply to Laurent PinchartThe callback isn't used by the driver and isn't initialized by board code. Remove it.
--- include/linux/mmc/sh_mmcif.h | 1 - 1 file changed, 1 deletion(-)
include/linux/mmc/sh_mmcif.h +0 -1
@@ -34,7 +34,6 @@struct sh_mmcif_plat_data {void (*set_pwr)(struct platform_device *pdev,int state); -void (*down_pwr)(struct platform_device *pdev);int (*get_cd)(struct platform_device *pdef);unsigned int slave_id_tx;/* embedded slave_id_[tr]x */ unsigned int slave_id_rx;
Signature · 1 line
1.8.1.5
PATCH 8/12 mmc: sh_mmcif: Remove .set_pwr() callback from platform data
In reply to Laurent PinchartThe .set_pwr() callback isn't used anymore as all platforms register GPIO-controlled regulators. Remove it.
--- drivers/mmc/host/sh_mmcif.c | 3 --- include/linux/mmc/sh_mmcif.h | 1 - 2 files changed, 4 deletions(-)
drivers/mmc/host/sh_mmcif.c +0 -3
@@ -956,11 +956,8 @@ static int sh_mmcif_clk_update(struct sh_mmcif_host *host)static void sh_mmcif_set_power (struct sh_mmcif_host *host,struct mmc_ios *ios) { -struct sh_mmcif_plat_data *pd = host->pd->dev.platform_data;struct mmc_host *mmc = host->mmc; -if (pd && pd->set_pwr) - pd->set_pwr (host->pd, ios->power_mode !=MMC_POWER_OFF );if (!IS_ERR (mmc->supply.vmmc))/* Errors ignored... */ mmc_regulator_set_ocr(mmc, mmc->supply.vmmc,
include/linux/mmc/sh_mmcif.h +0 -1
@@ -33,7 +33,6 @@*/ struct sh_mmcif_plat_data { -void (*set_pwr)(struct platform_device *pdev,int state);int (*get_cd)(struct platform_device *pdef);unsigned int slave_id_tx;/* embedded slave_id_[tr]x */ unsigned int slave_id_rx;
Signature · 1 line
1.8.1.5
PATCH 9/12 mmc: sh_mobile_sdhi: Remove .get_cd() callback from platform data
In reply to Laurent PinchartAll platforms pass the CD GPIO number to the driver in the .cd_gpio field. The .get_cd() callback isn't used anymore, remove it.
--- drivers/mmc/host/sh_mobile_sdhi.c | 9 --------- include/linux/mmc/sh_mobile_sdhi.h | 1 - 2 files changed, 10 deletions(-)
drivers/mmc/host/sh_mobile_sdhi.c +0 -9
@@ -77,13 +77,6 @@ static void sh_mobile_sdhi_set_pwr(struct platform_device *pdev, int state) p->set_pwr (pdev, state); } -static int sh_mobile_sdhi_get_cd (struct platform_device *pdev) -{ -struct sh_mobile_sdhi_info *p = pdev->dev.platform_data; - -return p->get_cd (pdev); -} -static int sh_mobile_sdhi_wait_idle (struct tmio_mmc_host *host) {int timeout =1000 ;
@@ -182,8 +175,6 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev) mmc_data->cd_gpio = p->cd_gpio;if (p->set_pwr) mmc_data->set_pwr = sh_mobile_sdhi_set_pwr; -if (p->get_cd) - mmc_data->get_cd = sh_mobile_sdhi_get_cd;if (p->dma_slave_tx >0 && p->dma_slave_rx >0 ) {/*
include/linux/mmc/sh_mobile_sdhi.h +0 -1
@@ -26,7 +26,6 @@ struct sh_mobile_sdhi_info {u32 tmio_ocr_mask;/* available MMC voltages */ unsigned int cd_gpio;void (*set_pwr)(struct platform_device *pdev,int state); -int (*get_cd)(struct platform_device *pdev);/* callbacks for board specific setup code */ int (*init)(struct platform_device *pdev,
Signature · 1 line
1.8.1.5
PATCH 10/12 mmc: sh_mobile_sdhi: Remove .set_pwr() callback from platform data
In reply to Laurent PinchartThe .set_pwr() callback isn't used anymore as all platforms register GPIO-controlled regulators. Remove it.
--- drivers/mmc/host/sh_mobile_sdhi.c | 9 --------- include/linux/mmc/sh_mobile_sdhi.h | 1 - 2 files changed, 10 deletions(-)
drivers/mmc/host/sh_mobile_sdhi.c +0 -9
@@ -70,13 +70,6 @@ static void sh_mobile_sdhi_clk_disable(struct platform_device *pdev)clk_disable (priv->clk); } -static void sh_mobile_sdhi_set_pwr (struct platform_device *pdev,int state) -{ -struct sh_mobile_sdhi_info *p = pdev->dev.platform_data; - - p->set_pwr (pdev, state); -} -static int sh_mobile_sdhi_wait_idle (struct tmio_mmc_host *host) {int timeout =1000 ;
@@ -173,8 +166,6 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev) mmc_data->capabilities |= p->tmio_caps; mmc_data->capabilities2 |= p->tmio_caps2; mmc_data->cd_gpio = p->cd_gpio; -if (p->set_pwr) - mmc_data->set_pwr = sh_mobile_sdhi_set_pwr;if (p->dma_slave_tx >0 && p->dma_slave_rx >0 ) {/*
include/linux/mmc/sh_mobile_sdhi.h +0 -1
@@ -25,7 +25,6 @@ struct sh_mobile_sdhi_info {unsigned long tmio_caps2;u32 tmio_ocr_mask;/* available MMC voltages */ unsigned int cd_gpio; -void (*set_pwr)(struct platform_device *pdev,int state);/* callbacks for board specific setup code */ int (*init)(struct platform_device *pdev,
Signature · 1 line
1.8.1.5
PATCH 11/12 mmc: tmio-mmc: Remove .get_cd() callback from platform data
In reply to Laurent PinchartAll platforms pass the CD GPIO number to the driver in the .cd_gpio field. The .get_cd() callback isn't used anymore, remove it
--- drivers/mmc/host/tmio_mmc_pio.c | 16 +--------------- include/linux/mfd/tmio.h | 1 - 2 files changed, 1 insertion(+), 16 deletions(-)
drivers/mmc/host/tmio_mmc_pio.c +1 -15
@@ -932,25 +932,11 @@ static int tmio_mmc_get_ro(struct mmc_host *mmc) (sd_ctrl_read32(host, CTL_STATUS) & TMIO_STAT_WRPROTECT)); } -static int tmio_mmc_get_cd (struct mmc_host *mmc) -{ -struct tmio_mmc_host *host =mmc_priv (mmc); -struct tmio_mmc_data *pdata = host->pdata; -int ret =mmc_gpio_get_cd (mmc); -if (ret >=0 ) -return ret; - -if (!pdata->get_cd) -return -ENOSYS ; -else -return pdata->get_cd (host->pdev); -} -static const struct mmc_host_ops tmio_mmc_ops = { .request = tmio_mmc_request, .set_ios = tmio_mmc_set_ios, .get_ro = tmio_mmc_get_ro, - .get_cd = tmio_mmc_get_cd, + .get_cd = mmc_gpio_get_cd, .enable_sdio_irq = tmio_mmc_enable_sdio_irq, };
include/linux/mfd/tmio.h +0 -1
@@ -108,7 +108,6 @@ struct tmio_mmc_data {unsigned int cd_gpio;void (*set_pwr)(struct platform_device *host,int state);void (*set_clk_div)(struct platform_device *host,int state); -int (*get_cd)(struct platform_device *host);int (*write16_hook)(struct tmio_mmc_host *host,int addr);/* clock management callbacks */ int (*clk_enable)(struct platform_device *pdev,unsigned int *f);
Signature · 1 line
1.8.1.5
PATCH 12/12 mmc: tmio-mmc: Remove .set_pwr() callback from platform data
In reply to Laurent PinchartThe .set_pwr() callback isn't used anymore as all platforms register GPIO-controlled regulators. Remove it.
--- drivers/mmc/host/tmio_mmc.h | 1 - drivers/mmc/host/tmio_mmc_pio.c | 7 ------- include/linux/mfd/tmio.h | 1 - 3 files changed, 9 deletions(-)
drivers/mmc/host/tmio_mmc.h +0 -1
@@ -68,7 +68,6 @@ struct tmio_mmc_host {enum tmio_mmc_power power;/* Callbacks for clock / power control */ -void (*set_pwr)(struct platform_device *host,int state);void (*set_clk_div)(struct platform_device *host,int state);/* pio related stuff */
drivers/mmc/host/tmio_mmc_pio.c +0 -7
@@ -777,9 +777,6 @@ static void tmio_mmc_power_on(struct tmio_mmc_host *host, unsigned short vdd)/* .set_ios() is returning void, so, no chance to report an error */ -if (host->set_pwr) - host->set_pwr (host->pdev,1 ); -if (!IS_ERR (mmc->supply.vmmc)) { ret =mmc_regulator_set_ocr (mmc, mmc->supply.vmmc, vdd);/*
@@ -809,9 +806,6 @@ static void tmio_mmc_power_off(struct tmio_mmc_host *host)if (!IS_ERR (mmc->supply.vmmc))mmc_regulator_set_ocr (mmc, mmc->supply.vmmc,0 ); - -if (host->set_pwr) - host->set_pwr (host->pdev,0 ); }/* Set MMC clock / power.
@@ -998,7 +992,6 @@ int tmio_mmc_host_probe(struct tmio_mmc_host **host, _host->pdev = pdev;platform_set_drvdata (pdev, mmc); - _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 */
include/linux/mfd/tmio.h +0 -1
@@ -106,7 +106,6 @@ struct tmio_mmc_data {struct tmio_mmc_dma *dma;struct device *dev;unsigned int cd_gpio; -void (*set_pwr)(struct platform_device *host,int state);void (*set_clk_div)(struct platform_device *host,int state);int (*write16_hook)(struct tmio_mmc_host *host,int addr);/* clock management callbacks */
Signature · 1 line
1.8.1.5
cover Remove platform callbacks from mmc_spi, sh_mmcif and sh_mobile_sdhi drivers
In reply to Laurent PinchartQuoted 16 lines · Laurent Pinchart
Hello,
This patch set replaces callbacks to board code with regulators and GPIOs in the
mmc_spi,sh_mmcifandsh_mobile_sdhiMMC drivers.Most of the required infrastructure is in place already on the drivers side, except for CD/RO GPIOs support in the
mmc_spidriver. The series thus starts with patch 01/12 that adds this feature to themmc_spidriver.Patches 02/12 to 05/12 remove the board callbacks from the ecovec24 and
vision_ep9307boards. The code has been compile-tested only as I don't have access to those boards.Patches 06/12 to 07/12 then proceed to remove the callbacks from the drivers themselves and from the platform data structures.
Quoted 6 lines
This will be a bit messy to merge, as the series interleaves patches for drivers and board files. Given that the
mmc_spidriver is marked as orphan inMAINTAINERSand that thevision_ep9307hasn't seen any board-specific modification in the last couple of kernel versions one option would be to merge all patches (or at least patches 01/12 to 06/12) through Simon's tree if all involved maintainers agree.
I'm fine with this. The ep93xx tree sees very few patches, so it would be easier. As long as you get Ack's from Hartley, and please also check with the arm-soc team (Arnd and Olof, Cc'ed) so that they are aware of the patches.
Quoted 32 lines
The series is based on tag renesas-devel-20130725 from
git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas.gitLaurent Pinchart (12):
mmc:mmc_spi: Support CD/RO GPIOs
ARM: ep93xx:vision_ep9307: Use MMC CD and RO GPIO
sh: ecovec24: Use MMC/SDHI CD and RO GPIO
sh: ecovec24: Remove mmcif .down_pwr() callback
sh: ecovec24: Remove MMCIF and SDHI .set_pwr() callbacks
mmc:mmc_spi: Remove platform data .get_cd() and .get_ro() callbacks
mmc:sh_mmcif: Remove .down_pwr() callback from platform data
mmc:sh_mmcif: Remove .set_pwr() callback from platform data
mmc:sh_mobile_sdhi: Remove .get_cd() callback from platform data
mmc:sh_mobile_sdhi: Remove .set_pwr() callback from platform data
mmc: tmio-mmc: Remove .get_cd() callback from platform data
mmc: tmio-mmc: Remove .set_pwr() callback from platform dataarch/arm/mach-ep93xx/vision_ep9307.c | 56 ++--------------------- arch/sh/boards/mach-ecovec24/setup.c | 89 ++++-------------------------------- drivers/mmc/host/mmc_spi.c | 48 +++++++++---------- drivers/mmc/host/of_mmc_spi.c | 46 +++++-------------- drivers/mmc/host/sh_mmcif.c | 3 -- drivers/mmc/host/sh_mobile_sdhi.c | 18 -------- drivers/mmc/host/tmio_mmc.h | 1 - drivers/mmc/host/tmio_mmc_pio.c | 23 +--------- include/linux/mfd/tmio.h | 2 - include/linux/mmc/sh_mmcif.h | 2 - include/linux/mmc/sh_mobile_sdhi.h | 2 - include/linux/spi/mmc_spi.h | 18 ++++---- 12 files changed, 56 insertions(+), 252 deletions(-)
cover Remove platform callbacks from mmc_spi, sh_mmcif and sh_mobile_sdhi drivers
In reply to Laurent PinchartHi Laurent
Quoted 26 lines · Laurent Pinchart
Hello,
This patch set replaces callbacks to board code with regulators and GPIOs in the
mmc_spi,sh_mmcifandsh_mobile_sdhiMMC drivers.Most of the required infrastructure is in place already on the drivers side, except for CD/RO GPIOs support in the
mmc_spidriver. The series thus starts with patch 01/12 that adds this feature to themmc_spidriver.Patches 02/12 to 05/12 remove the board callbacks from the ecovec24 and
vision_ep9307boards. The code has been compile-tested only as I don't have access to those boards.Patches 06/12 to 07/12 then proceed to remove the callbacks from the drivers themselves and from the platform data structures.
This will be a bit messy to merge, as the series interleaves patches for drivers and board files. Given that the
mmc_spidriver is marked as orphan inMAINTAINERSand that thevision_ep9307hasn't seen any board-specific modification in the last couple of kernel versions one option would be to merge all patches (or at least patches 01/12 to 06/12) through Simon's tree if all involved maintainers agree.The series is based on tag renesas-devel-20130725 from
git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas.git
Quoted 13 lines
Laurent Pinchart (12):
mmc:mmc_spi: Support CD/RO GPIOs
ARM: ep93xx:vision_ep9307: Use MMC CD and RO GPIO
sh: ecovec24: Use MMC/SDHI CD and RO GPIO
sh: ecovec24: Remove mmcif .down_pwr() callback
sh: ecovec24: Remove MMCIF and SDHI .set_pwr() callbacks
mmc:mmc_spi: Remove platform data .get_cd() and .get_ro() callbacks
mmc:sh_mmcif: Remove .down_pwr() callback from platform data
mmc:sh_mmcif: Remove .set_pwr() callback from platform data
mmc:sh_mobile_sdhi: Remove .get_cd() callback from platform data
mmc:sh_mobile_sdhi: Remove .set_pwr() callback from platform data
mmc: tmio-mmc: Remove .get_cd() callback from platform data
mmc: tmio-mmc: Remove .set_pwr() callback from platform data
For #3-5, 7-12
Thanks
Guennadi
Quoted 5 lines
arch/arm/mach-ep93xx/vision_ep9307.c | 56 ++--------------------- arch/sh/boards/mach-ecovec24/setup.c | 89 ++++-------------------------------- drivers/mmc/host/mmc_spi.c | 48 +++++++++---------- drivers/mmc/host/of_mmc_spi.c | 46 +++++-------------- drivers/mmc/host/sh_mmcif.c | 3 --
Quoted 13 lines
drivers/mmc/host/sh_mobile_sdhi.c | 18 -------- drivers/mmc/host/tmio_mmc.h | 1 - drivers/mmc/host/tmio_mmc_pio.c | 23 +--------- include/linux/mfd/tmio.h | 2 - include/linux/mmc/sh_mmcif.h | 2 - include/linux/mmc/sh_mobile_sdhi.h | 2 - include/linux/spi/mmc_spi.h | 18 ++++---- 12 files changed, 56 insertions(+), 252 deletions(-)Signature · 3 lines
Regards, Laurent Pinchart
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/