From 214fc309d1387e822d606a33a10e31cacfe83520 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Thu, 8 Aug 2013 12:38:31 +0200 Subject: mmc: slot-gpio: Add debouncing capability to mmc_gpio_request_cd() Add a debounce parameter to the mmc_gpio_request_cd() function that enables GPIO debouncing when set to a non-zero value. This can be used by MMC host drivers to enable debouncing on the card detect signal. Signed-off-by: Laurent Pinchart Reviewed-by: H Hartley Sweeten Signed-off-by: Chris Ball --- include/linux/mmc/slot-gpio.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/linux/mmc/slot-gpio.h b/include/linux/mmc/slot-gpio.h index 7d88d27bfafa..b0c73e4cacea 100644 --- a/include/linux/mmc/slot-gpio.h +++ b/include/linux/mmc/slot-gpio.h @@ -18,7 +18,8 @@ int mmc_gpio_request_ro(struct mmc_host *host, unsigned int gpio); void mmc_gpio_free_ro(struct mmc_host *host); int mmc_gpio_get_cd(struct mmc_host *host); -int mmc_gpio_request_cd(struct mmc_host *host, unsigned int gpio); +int mmc_gpio_request_cd(struct mmc_host *host, unsigned int gpio, + unsigned int debounce); void mmc_gpio_free_cd(struct mmc_host *host); #endif -- cgit v1.2.3 From bf287a90ceedf86e3313ba0dcff606ac5399b39a Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Thu, 8 Aug 2013 12:38:32 +0200 Subject: 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. The driver will enable debouncing on the card detect GPIO if the cd_debounce field is set to a non-zero value. Signed-off-by: Laurent Pinchart Reviewed-by: H Hartley Sweeten Signed-off-by: Chris Ball --- include/linux/spi/mmc_spi.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'include') diff --git a/include/linux/spi/mmc_spi.h b/include/linux/spi/mmc_spi.h index 32be8dbdf191..87cdb35bedda 100644 --- a/include/linux/spi/mmc_spi.h +++ b/include/linux/spi/mmc_spi.h @@ -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,19 @@ struct mmc_spi_platform_data { */ int (*get_cd)(struct device *); + /* + * Card Detect and Read Only GPIOs. To enable debouncing on the card + * detect GPIO, set the cd_debounce to the debounce time in + * microseconds. + */ + unsigned int flags; + unsigned int cd_gpio; + unsigned int cd_debounce; + 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; -- cgit v1.2.3 From 62b6af5c7ee28a3faf9638e509fd2da85a97229d Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Thu, 8 Aug 2013 12:38:38 +0200 Subject: mmc: mmc_spi: Remove platform data .get_cd() and .get_ro() callbacks All platforms now pass the CD and RO GPIOs to the MMC SPI driver, those callbacks are not used anymore. Remove them. Signed-off-by: Laurent Pinchart Reviewed-by: H Hartley Sweeten Signed-off-by: Chris Ball --- include/linux/spi/mmc_spi.h | 9 --------- 1 file changed, 9 deletions(-) (limited to 'include') diff --git a/include/linux/spi/mmc_spi.h b/include/linux/spi/mmc_spi.h index 87cdb35bedda..274bc0fa00af 100644 --- a/include/linux/spi/mmc_spi.h +++ b/include/linux/spi/mmc_spi.h @@ -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. To enable debouncing on the card * detect GPIO, set the cd_debounce to the debounce time in -- cgit v1.2.3 From dcbfaf36c1933d88565501ff13feb0f4b2d38735 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Thu, 8 Aug 2013 12:38:39 +0200 Subject: mmc: sh_mmcif: Remove .down_pwr() callback from platform data The callback isn't used by the driver and isn't initialized by board code. Remove it. Signed-off-by: Laurent Pinchart Acked-by: Guennadi Liakhovetski Signed-off-by: Chris Ball --- include/linux/mmc/sh_mmcif.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include') diff --git a/include/linux/mmc/sh_mmcif.h b/include/linux/mmc/sh_mmcif.h index e7d5dd67bb74..39011eb42930 100644 --- a/include/linux/mmc/sh_mmcif.h +++ b/include/linux/mmc/sh_mmcif.h @@ -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; -- cgit v1.2.3 From 83a0c7797e96e103bb3b6fcf8afb7b65dc7fc68e Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Thu, 8 Aug 2013 12:38:40 +0200 Subject: mmc: sh_mmcif: Remove .set_pwr() callback from platform data The .set_pwr() callback isn't used anymore as all platforms register GPIO-controlled regulators. Remove it. Signed-off-by: Laurent Pinchart Acked-by: Guennadi Liakhovetski Signed-off-by: Chris Ball --- include/linux/mmc/sh_mmcif.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include') diff --git a/include/linux/mmc/sh_mmcif.h b/include/linux/mmc/sh_mmcif.h index 39011eb42930..767fac5a7d93 100644 --- a/include/linux/mmc/sh_mmcif.h +++ b/include/linux/mmc/sh_mmcif.h @@ -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; -- cgit v1.2.3 From 57fcb523e5fce1c24e9c28b64f6e6dc3edf55073 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Thu, 8 Aug 2013 12:38:41 +0200 Subject: mmc: sh_mobile_sdhi: Remove .get_cd() callback from platform data All platforms pass the CD GPIO number to the driver in the .cd_gpio field. The .get_cd() callback isn't used anymore, remove it. Signed-off-by: Laurent Pinchart Acked-by: Guennadi Liakhovetski Signed-off-by: Chris Ball --- include/linux/mmc/sh_mobile_sdhi.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include') diff --git a/include/linux/mmc/sh_mobile_sdhi.h b/include/linux/mmc/sh_mobile_sdhi.h index b76bcf0621f6..f31c69262232 100644 --- a/include/linux/mmc/sh_mobile_sdhi.h +++ b/include/linux/mmc/sh_mobile_sdhi.h @@ -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, -- cgit v1.2.3 From 1036563e1417c050993bbd48f20a84ff7c7cef99 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Thu, 8 Aug 2013 12:38:42 +0200 Subject: mmc: sh_mobile_sdhi: Remove .set_pwr() callback from platform data The .set_pwr() callback isn't used anymore as all platforms register GPIO-controlled regulators. Remove it. Signed-off-by: Laurent Pinchart Acked-by: Guennadi Liakhovetski Signed-off-by: Chris Ball --- include/linux/mmc/sh_mobile_sdhi.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include') diff --git a/include/linux/mmc/sh_mobile_sdhi.h b/include/linux/mmc/sh_mobile_sdhi.h index f31c69262232..68927ae50845 100644 --- a/include/linux/mmc/sh_mobile_sdhi.h +++ b/include/linux/mmc/sh_mobile_sdhi.h @@ -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, -- cgit v1.2.3 From 2b63b341d42cd64ff40062447320d46cf3e7f0bb Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Thu, 8 Aug 2013 12:38:43 +0200 Subject: mmc: tmio-mmc: Remove .get_cd() callback from platform data All platforms pass the CD GPIO number to the driver in the .cd_gpio field. The .get_cd() callback isn't used anymore, remove it Signed-off-by: Laurent Pinchart Acked-by: Guennadi Liakhovetski Signed-off-by: Chris Ball --- include/linux/mfd/tmio.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include') diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h index ce3511326f80..b22883d60500 100644 --- a/include/linux/mfd/tmio.h +++ b/include/linux/mfd/tmio.h @@ -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); -- cgit v1.2.3 From 3af9d15c719017feb63fa99f89ac6009a5a3d467 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Thu, 8 Aug 2013 12:38:44 +0200 Subject: mmc: tmio-mmc: Remove .set_pwr() callback from platform data The .set_pwr() callback isn't used anymore as all platforms register GPIO-controlled regulators. Remove it. Signed-off-by: Laurent Pinchart Acked-by: Guennadi Liakhovetski Signed-off-by: Chris Ball --- include/linux/mfd/tmio.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include') diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h index b22883d60500..baa23464a1e6 100644 --- a/include/linux/mfd/tmio.h +++ b/include/linux/mfd/tmio.h @@ -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 */ -- cgit v1.2.3 From d00cadacbe47d4883b0d5e38aa73a3f4e171d37e Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Fri, 2 Aug 2013 14:48:02 +0200 Subject: mmc: sh_mmcif: move header include from header into .c sh_dma.h isn't needed in sh_mmcif.h, move it into sh_mmcif.c. Signed-off-by: Guennadi Liakhovetski Signed-off-by: Chris Ball --- include/linux/mmc/sh_mmcif.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include') diff --git a/include/linux/mmc/sh_mmcif.h b/include/linux/mmc/sh_mmcif.h index 767fac5a7d93..c4880ffb6cce 100644 --- a/include/linux/mmc/sh_mmcif.h +++ b/include/linux/mmc/sh_mmcif.h @@ -16,7 +16,6 @@ #include #include -#include /* * MMCIF : CE_CLK_CTRL [19:16] -- cgit v1.2.3 From 967bcb77177cda1a426fdb2350e6ec61bcf5b5eb Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Wed, 10 Jul 2013 21:21:12 +0200 Subject: mmc: sh_mmcif: revision-specific Command Completion Signal handling Some earlier MMCIF IP revisions contained Command Completion Signal support, which has been dropped again in modern versions. Sopport for this feature is added in a way to preserve the current behaviour by default, i.e. when it is not enabled in platform data. Patch is based on work by Nobuyuki HIRAI. Signed-off-by: Guennadi Liakhovetski Signed-off-by: Chris Ball --- include/linux/mmc/sh_mmcif.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/linux/mmc/sh_mmcif.h b/include/linux/mmc/sh_mmcif.h index c4880ffb6cce..197ed91f6a0c 100644 --- a/include/linux/mmc/sh_mmcif.h +++ b/include/linux/mmc/sh_mmcif.h @@ -36,6 +36,7 @@ struct sh_mmcif_plat_data { unsigned int slave_id_tx; /* embedded slave_id_[tr]x */ unsigned int slave_id_rx; bool use_cd_gpio : 1; + bool ccs_unsupported : 1; unsigned int cd_gpio; u8 sup_pclk; /* 1 :SH7757, 0: SH7724/SH7372 */ unsigned long caps; -- cgit v1.2.3 From 6d6fd3674259d16b735c961743ff28870c46cedc Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Wed, 10 Jul 2013 21:21:13 +0200 Subject: mmc: sh_mmcif: revision-specific CLK_CTRL2 handling Some newer MMCIF IP revisions contain a CE_CLK_CTRL2 register, that has to be set for proper operation. Support for this feature is added in a way to preserve the current behaviour by default, i.e. when it is not enabled in platform data. Patch is based on work by Nobuyuki HIRAI. Signed-off-by: Guennadi Liakhovetski Signed-off-by: Chris Ball --- include/linux/mmc/sh_mmcif.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/linux/mmc/sh_mmcif.h b/include/linux/mmc/sh_mmcif.h index 197ed91f6a0c..ccd8fb2cad52 100644 --- a/include/linux/mmc/sh_mmcif.h +++ b/include/linux/mmc/sh_mmcif.h @@ -37,6 +37,7 @@ struct sh_mmcif_plat_data { unsigned int slave_id_rx; bool use_cd_gpio : 1; bool ccs_unsupported : 1; + bool clk_ctrl2_present : 1; unsigned int cd_gpio; u8 sup_pclk; /* 1 :SH7757, 0: SH7724/SH7372 */ unsigned long caps; @@ -60,6 +61,7 @@ struct sh_mmcif_plat_data { #define MMCIF_CE_INT_MASK 0x00000044 #define MMCIF_CE_HOST_STS1 0x00000048 #define MMCIF_CE_HOST_STS2 0x0000004C +#define MMCIF_CE_CLK_CTRL2 0x00000070 #define MMCIF_CE_VERSION 0x0000007C /* CE_BUF_ACC */ -- cgit v1.2.3 From 6e9e318b304fd7373a0754805a76a02ddbc69a41 Mon Sep 17 00:00:00 2001 From: Haijun Zhang Date: Mon, 26 Aug 2013 09:19:22 +0800 Subject: mmc: core: parse voltage from device-tree Add function to support getting voltage from device-tree. If voltage-range is specified in device-tree node, this function will parse it and return the available voltage mask. Signed-off-by: Haijun Zhang Acked-by: Anton Vorontsov Signed-off-by: Chris Ball --- include/linux/mmc/core.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h index 443243b241d5..da51bec578c3 100644 --- a/include/linux/mmc/core.h +++ b/include/linux/mmc/core.h @@ -208,6 +208,8 @@ static inline void mmc_claim_host(struct mmc_host *host) __mmc_claim_host(host, NULL); } +struct device_node; extern u32 mmc_vddrange_to_ocrmask(int vdd_min, int vdd_max); +extern int mmc_of_parse_voltage(struct device_node *np, u32 *mask); #endif /* LINUX_MMC_CORE_H */ -- cgit v1.2.3 From c0b887b66c95fe5abaac071b8332b8c21113d84b Mon Sep 17 00:00:00 2001 From: Haijun Zhang Date: Mon, 26 Aug 2013 09:19:23 +0800 Subject: mmc: sdhci: get voltage from sdhc host We use host->ocr_mask to hold the voltage get from device-tree node, In case host->ocr_mask was available, we use host->ocr_mask as the final available voltage can be used by MMC/SD/SDIO card. Signed-off-by: Haijun Zhang Reviewed-by: Anton Vorontsov Signed-off-by: Chris Ball --- include/linux/mmc/sdhci.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h index e3c6a74d980a..3e781b8c0be7 100644 --- a/include/linux/mmc/sdhci.h +++ b/include/linux/mmc/sdhci.h @@ -171,6 +171,7 @@ struct sdhci_host { unsigned int ocr_avail_sdio; /* OCR bit masks */ unsigned int ocr_avail_sd; unsigned int ocr_avail_mmc; + u32 ocr_mask; /* available voltages */ wait_queue_head_t buf_ready_int; /* Waitqueue for Buffer Read Ready interrupt */ unsigned int tuning_done; /* Condition flag set when CMD19 succeeds */ -- cgit v1.2.3 From 9d731e7539713acc0ec7b67a5a91357c455d2334 Mon Sep 17 00:00:00 2001 From: Chris Ball Date: Fri, 6 Sep 2013 07:29:05 -0400 Subject: Revert "mmc: tmio-mmc: Remove .set_pwr() callback from platform data" This reverts commit 3af9d15c719017feb63fa99f89ac6009a5a3d467, which causes a build failure: drivers/mfd/asic3.c:724:2: error: unknown field 'set_pwr' specified in initializer --- include/linux/mfd/tmio.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h index baa23464a1e6..b22883d60500 100644 --- a/include/linux/mfd/tmio.h +++ b/include/linux/mfd/tmio.h @@ -106,6 +106,7 @@ 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 */ -- cgit v1.2.3