ARM:mach-mx5/board-mx53_loco: Add CD and WP GPIOs
Subsystems (2)
PATCH 2/2 ARM:mach-mx5/board-mx53_loco: Add CD and WP GPIOs
--- arch/arm/mach-mx5/board-mx53_loco.c | 18 ++++++++++++++++-- 1 files changed, 16 insertions(+), 2 deletions(-)
arch/arm/mach-mx5/board-mx53_loco.c +16 -2
@@ -39,6 +39,9 @@#define MX53_LOCO_UI2 IMX_GPIO_NR(2, 15)#define LOCO_FEC_PHY_RST IMX_GPIO_NR(7, 6)#define LOCO_LED IMX_GPIO_NR(7, 7) +#define LOCO_SD3_CD IMX_GPIO_NR(3, 11) +#define LOCO_SD3_WP IMX_GPIO_NR(3, 12) +#define LOCO_SD1_CD IMX_GPIO_NR(3, 13)static iomux_v3_cfg_t mx53_loco_pads[] = {/* FEC */
@@ -71,6 +74,8 @@ static iomux_v3_cfg_t mx53_loco_pads[] = {MX53_PAD_SD1_DATA1__ESDHC1_DAT1 ,MX53_PAD_SD1_DATA2__ESDHC1_DAT2 ,MX53_PAD_SD1_DATA3__ESDHC1_DAT3 , +/* SD1_CD */ +MX53_PAD_EIM_DA13__GPIO3_13 ,/* SD3 */ MX53_PAD_PATA_DATA8__ESDHC3_DAT0 , MX53_PAD_PATA_DATA9__ESDHC3_DAT1,
@@ -203,6 +208,15 @@ static const struct gpio_keys_platform_data loco_button_data __initconst = { .nbuttons = ARRAY_SIZE(loco_buttons), }; +static const struct esdhc_platform_data mx53_loco_sd1_data__initconst = { + .cd_gpio =LOCO_SD1_CD , +}; + +static const struct esdhc_platform_data mx53_loco_sd3_data__initconst = { + .cd_gpio =LOCO_SD3_CD , + .wp_gpio =LOCO_SD3_WP , +}; +static inline void mx53_loco_fec_reset (void ) {int ret;
@@ -249,8 +263,8 @@ static void __init mx53_loco_board_init(void)imx53_add_imx2_wdt (0 ,NULL );imx53_add_imx_i2c (0 , &mx53_loco_i2c_data);imx53_add_imx_i2c (1 , &mx53_loco_i2c_data); -imx53_add_sdhci_esdhc_imx (0 ,NULL ); -imx53_add_sdhci_esdhc_imx (2 ,NULL ); +imx53_add_sdhci_esdhc_imx (0 , &mx53_loco_sd1_data); +imx53_add_sdhci_esdhc_imx (2 , &mx53_loco_sd3_data);imx_add_gpio_keys (&loco_button_data);gpio_led_register_device (-1 , &mx53loco_leds_data); }
Signature · 1 line
1.7.1
PATCH 1/2 ARM:mach-mx5/board-mx51_babbage: Add CD and WP GPIOs
--- arch/arm/mach-mx5/board-mx51_babbage.c | 24 +++++++++++++++++++++--- 1 files changed, 21 insertions(+), 3 deletions(-)
arch/arm/mach-mx5/board-mx51_babbage.c +21 -3
@@ -41,6 +41,10 @@#define BABBAGE_POWER_KEY IMX_GPIO_NR(2, 21)#define BABBAGE_ECSPI1_CS0 IMX_GPIO_NR(4, 24)#define BABBAGE_ECSPI1_CS1 IMX_GPIO_NR(4, 25) +#define BABBAGE_SD1_CD IMX_GPIO_NR(1, 0) +#define BABBAGE_SD1_WP IMX_GPIO_NR(1, 1) +#define BABBAGE_SD2_CD IMX_GPIO_NR(1, 6) +#define BABBAGE_SD2_WP IMX_GPIO_NR(1, 5)/* USB_CTRL_1 */ #define MX51_USB_CTRL_1_OFFSET 0x10
@@ -142,7 +146,9 @@ static iomux_v3_cfg_t mx51babbage_pads[] = {MX51_PAD_SD1_DATA1__SD1_DATA1 ,MX51_PAD_SD1_DATA2__SD1_DATA2 ,MX51_PAD_SD1_DATA3__SD1_DATA3 , - +MX51_PAD_GPIO1_0__GPIO1_0 , +MX51_PAD_GPIO1_1__GPIO1_1 , +/* SD 2 */ MX51_PAD_SD2_CMD__SD2_CMD , MX51_PAD_SD2_CLK__SD2_CLK,
@@ -150,6 +156,8 @@ static iomux_v3_cfg_t mx51babbage_pads[] = {MX51_PAD_SD2_DATA1__SD2_DATA1 ,MX51_PAD_SD2_DATA2__SD2_DATA2 ,MX51_PAD_SD2_DATA3__SD2_DATA3 , +MX51_PAD_GPIO1_6__GPIO1_6 , +MX51_PAD_GPIO1_5__GPIO1_5 ,/* eCSPI1 */ MX51_PAD_CSPI1_MISO__ECSPI1_MISO,
@@ -331,6 +339,16 @@ static const struct spi_imx_master mx51_babbage_spi_pdata __initconst = { .num_chipselect = ARRAY_SIZE(mx51_babbage_spi_cs), }; +static const struct esdhc_platform_data mx51_babbage_sd1_data__initconst = { + .cd_gpio =BABBAGE_SD1_CD , + .wp_gpio =BABBAGE_SD1_WP , +}; + +static const struct esdhc_platform_data mx51_babbage_sd2_data__initconst = { + .cd_gpio =BABBAGE_SD2_CD , + .wp_gpio =BABBAGE_SD2_WP , +}; +/* * Board specific initialization. */
@@ -374,8 +392,8 @@ static void __init mx51_babbage_init(void)mxc_iomux_v3_setup_pad (usbh1stp);babbage_usbhub_reset (); -imx51_add_sdhci_esdhc_imx (0 ,NULL ); -imx51_add_sdhci_esdhc_imx (1 ,NULL ); +imx51_add_sdhci_esdhc_imx (0 , &mx51_babbage_sd1_data); +imx51_add_sdhci_esdhc_imx (1 , &mx51_babbage_sd2_data);spi_register_board_info (mx51_babbage_spi_board_info,ARRAY_SIZE (mx51_babbage_spi_board_info));
Signature · 1 line
1.7.1
PATCH 1/2 ARM:mach-mx5/board-mx51_babbage: Add CD and WP GPIOs
Hi Andre,
Quoted 72 lines · Andre Silva
Signed-off-by Andre Silva <[email protected]>--- arch/arm/mach-mx5/board-mx51_babbage.c | 24 +++++++++++++++++++++--- 1 files changed, 21 insertions(+), 3 deletions(-)arch/arm/mach-mx5/board-mx51_babbage.c +21
-3@@ -41,6 +41,10 @@#define BABBAGE_POWER_KEY IMX_GPIO_NR(2, 21)#define BABBAGE_ECSPI1_CS0 IMX_GPIO_NR(4, 24)#define BABBAGE_ECSPI1_CS1 IMX_GPIO_NR(4, 25) +#define BABBAGE_SD1_CD IMX_GPIO_NR(1, 0) +#define BABBAGE_SD1_WP IMX_GPIO_NR(1, 1) +#define BABBAGE_SD2_CD IMX_GPIO_NR(1, 6) +#define BABBAGE_SD2_WP IMX_GPIO_NR(1, 5)/* USB_CTRL_1 */ #define MX51_USB_CTRL_1_OFFSET 0x10@@ -142,7 +146,9 @@ static iomux_v3_cfg_t mx51babbage_pads[] = {MX51_PAD_SD1_DATA1__SD1_DATA1 ,MX51_PAD_SD1_DATA2__SD1_DATA2 ,MX51_PAD_SD1_DATA3__SD1_DATA3 , - +MX51_PAD_GPIO1_0__GPIO1_0 , +MX51_PAD_GPIO1_1__GPIO1_1 , +/* SD 2 */ MX51_PAD_SD2_CMD__SD2_CMD , MX51_PAD_SD2_CLK__SD2_CLK,@@ -150,6 +156,8 @@ static iomux_v3_cfg_t mx51babbage_pads[] = {MX51_PAD_SD2_DATA1__SD2_DATA1 ,MX51_PAD_SD2_DATA2__SD2_DATA2 ,MX51_PAD_SD2_DATA3__SD2_DATA3 , +MX51_PAD_GPIO1_6__GPIO1_6 , +MX51_PAD_GPIO1_5__GPIO1_5 ,/* eCSPI1 */ MX51_PAD_CSPI1_MISO__ECSPI1_MISO,@@ -331,6 +339,16 @@ static const struct spi_imx_master mx51_babbage_spi_pdata __initconst = { .num_chipselect = ARRAY_SIZE(mx51_babbage_spi_cs), }; +static const struct esdhc_platform_data mx51_babbage_sd1_data__initconst = { + .cd_gpio =BABBAGE_SD1_CD , + .wp_gpio =BABBAGE_SD1_WP , +}; + +static const struct esdhc_platform_data mx51_babbage_sd2_data__initconst = { + .cd_gpio =BABBAGE_SD2_CD , + .wp_gpio =BABBAGE_SD2_WP , +}; +/* * Board specific initialization. */ @@ -374,8 +392,8 @@ static void __init mx51_babbage_init(void)mxc_iomux_v3_setup_pad (usbh1stp);babbage_usbhub_reset (); -imx51_add_sdhci_esdhc_imx (0 ,NULL ); -imx51_add_sdhci_esdhc_imx (1 ,NULL ); +imx51_add_sdhci_esdhc_imx (0 , &mx51_babbage_sd1_data); +imx51_add_sdhci_esdhc_imx (1 , &mx51_babbage_sd2_data);spi_register_board_info (mx51_babbage_spi_board_info,ARRAY_SIZE (mx51_babbage_spi_board_info));Signature · 1 line
1.7.1
I'm wondering how you tested the patches, as CD and WP has not been supported by sdhci-esdhc-imx driver yet.
PS. I'm adding the support with the patch set below.
[PATCH 0/4] Extend sdhci-esdhc-imx card_detect and write_protect support for mx5
Signature · 2 lines
Regards, Shawn
PATCH 2/2 ARM:mach-mx5/board-mx53_loco: Add CD and WP GPIOs
In reply to Andre SilvaQuoted 59 lines · Andre Silva
Signed-off-by Andre Silva <[email protected]>--- arch/arm/mach-mx5/board-mx53_loco.c | 18 ++++++++++++++++-- 1 files changed, 16 insertions(+), 2 deletions(-)arch/arm/mach-mx5/board-mx53_loco.c +16
-2@@ -39,6 +39,9 @@#define MX53_LOCO_UI2 IMX_GPIO_NR(2, 15)#define LOCO_FEC_PHY_RST IMX_GPIO_NR(7, 6)#define LOCO_LED IMX_GPIO_NR(7, 7) +#define LOCO_SD3_CD IMX_GPIO_NR(3, 11) +#define LOCO_SD3_WP IMX_GPIO_NR(3, 12) +#define LOCO_SD1_CD IMX_GPIO_NR(3, 13)static iomux_v3_cfg_t mx53_loco_pads[] = {/* FEC */ @@ -71,6 +74,8 @@ static iomux_v3_cfg_t mx53_loco_pads[] = {MX53_PAD_SD1_DATA1__ESDHC1_DAT1 ,MX53_PAD_SD1_DATA2__ESDHC1_DAT2 ,MX53_PAD_SD1_DATA3__ESDHC1_DAT3 , +/* SD1_CD */ +MX53_PAD_EIM_DA13__GPIO3_13 ,/* SD3 */ MX53_PAD_PATA_DATA8__ESDHC3_DAT0 , MX53_PAD_PATA_DATA9__ESDHC3_DAT1,@@ -203,6 +208,15 @@ static const struct gpio_keys_platform_data loco_button_data __initconst = { .nbuttons = ARRAY_SIZE(loco_buttons), }; +static const struct esdhc_platform_data mx53_loco_sd1_data__initconst = { + .cd_gpio =LOCO_SD1_CD , +}; + +static const struct esdhc_platform_data mx53_loco_sd3_data__initconst = { + .cd_gpio =LOCO_SD3_CD , + .wp_gpio =LOCO_SD3_WP , +}; +static inline void mx53_loco_fec_reset (void ) {int ret;@@ -249,8 +263,8 @@ static void __init mx53_loco_board_init(void)imx53_add_imx2_wdt (0 ,NULL );imx53_add_imx_i2c (0 , &mx53_loco_i2c_data);imx53_add_imx_i2c (1 , &mx53_loco_i2c_data); -imx53_add_sdhci_esdhc_imx (0 ,NULL ); -imx53_add_sdhci_esdhc_imx (2 ,NULL ); +imx53_add_sdhci_esdhc_imx (0 , &mx53_loco_sd1_data); +imx53_add_sdhci_esdhc_imx (2 , &mx53_loco_sd3_data);imx_add_gpio_keys (&loco_button_data);gpio_led_register_device (-1 , &mx53loco_leds_data); }Signature · 1 line
1.7.1
The sdhci-esdhc-imx driver currently only supports CD and WP for mx25 and mx35. How did you test the patch?
Signature · 2 lines
Regards, Shawn
PATCH 2/2 ARM:mach-mx5/board-mx53_loco: Add CD and WP GPIOs
Hi Shawn,
The tests was done simpling inserting and removing the SD card,
since before no parameters were passed to the imx53_add_sdhci_esdhc_imx and the controller was able to detect the card via software. When setting up the iomux (CD) pin and passing it to the imx53_add_sdhci_esdhc_imx function, it should be able to start detecting the card using the pin instead.
the same test was made for [PATCH1/2].
regards,
Andre
________________________________________
From: Guo Shawn-R65073
Sent: Saturday, June 11, 2011 1:58 PM
To: Silva Andre-B22958
Cc: linux-arm-kernel at lists.infradead.org; kernel at pengutronix.de
Subject: Re: [PATCH 2/2] ARM:mach-mx5/board-mx53_loco: Add CD and WP GPIOs
Quoted 57 lines · Andre Silva
Signed-off-by Andre Silva <[email protected]>--- arch/arm/mach-mx5/board-mx53_loco.c | 18 ++++++++++++++++-- 1 files changed, 16 insertions(+), 2 deletions(-)arch/arm/mach-mx5/board-mx53_loco.c +16
-3@@ -39,6 +39,9 @@#define MX53_LOCO_UI2 IMX_GPIO_NR(2, 15)#define LOCO_FEC_PHY_RST IMX_GPIO_NR(7, 6)#define LOCO_LED IMX_GPIO_NR(7, 7) +#define LOCO_SD3_CD IMX_GPIO_NR(3, 11) +#define LOCO_SD3_WP IMX_GPIO_NR(3, 12) +#define LOCO_SD1_CD IMX_GPIO_NR(3, 13)static iomux_v3_cfg_t mx53_loco_pads[] = {/* FEC */ @@ -71,6 +74,8 @@ static iomux_v3_cfg_t mx53_loco_pads[] = {MX53_PAD_SD1_DATA1__ESDHC1_DAT1 ,MX53_PAD_SD1_DATA2__ESDHC1_DAT2 ,MX53_PAD_SD1_DATA3__ESDHC1_DAT3 , +/* SD1_CD */ +MX53_PAD_EIM_DA13__GPIO3_13 ,/* SD3 */ MX53_PAD_PATA_DATA8__ESDHC3_DAT0 , MX53_PAD_PATA_DATA9__ESDHC3_DAT1,@@ -203,6 +208,15 @@ static const struct gpio_keys_platform_data loco_button_data __initconst = { .nbuttons = ARRAY_SIZE(loco_buttons), }; +static const struct esdhc_platform_data mx53_loco_sd1_data__initconst = { + .cd_gpio =LOCO_SD1_CD , +}; + +static const struct esdhc_platform_data mx53_loco_sd3_data__initconst = { + .cd_gpio =LOCO_SD3_CD , + .wp_gpio =LOCO_SD3_WP , +}; +static inline void mx53_loco_fec_reset (void ) {int ret;@@ -249,8 +263,8 @@ static void __init mx53_loco_board_init(void)imx53_add_imx2_wdt (0 ,NULL );imx53_add_imx_i2c (0 , &mx53_loco_i2c_data);imx53_add_imx_i2c (1 , &mx53_loco_i2c_data); -imx53_add_sdhci_esdhc_imx (0 ,NULL ); -imx53_add_sdhci_esdhc_imx (2 ,NULL ); +imx53_add_sdhci_esdhc_imx (0 , &mx53_loco_sd1_data); +imx53_add_sdhci_esdhc_imx (2 , &mx53_loco_sd3_data);imx_add_gpio_keys (&loco_button_data);gpio_led_register_device (-1 , &mx53loco_leds_data); } --
Quoted 2 lines
1.7.1
The sdhci-esdhc-imx driver currently only supports CD and WP for mx25 and mx35. How did you test the patch?
--
Regards,
Shawn
PATCH 2/2 ARM:mach-mx5/board-mx53_loco: Add CD and WP GPIOs
Quoted 3 lines · On Sun, Jun 12, 2011 at 12:59:39AM +0800, Silva Andre-B22958 wrote:
Hi Shawn,
The tests was done simpling inserting and removing the SD card,
That said you saw CD working, and what about WP?
Quoted 2 lines
since before no parameters were passed to the
imx53_add_sdhci_esdhc_imxand the controller was able to detect the card via software. When setting up the iomux (CD) pin and passing it to theimx53_add_sdhci_esdhc_imxfunction, it should be able to start detecting the card using the pin instead.
No, your CD gpio setup does not make any change. The CD is working in the exactly same way before you patch. If you check function esdhc_pltfm_init of sdhci-esdhc-imx driver, you will find the following.
/* i.MX5x has issues to be researched */
if (!cpu_is_mx25() && !cpu_is_mx35())
goto not_supported;CD gpio interrupt only gets supported on mx25 and mx35 currently, and mx5 CD works with flag SDHCI_QUIRK_BROKEN_CARD_DETECTION set, in which case a very expensive method is being used to poll card present by sdhci driver.
Signature · 2 lines
Regards, Shawn
PATCH 1/2 ARM:mach-mx5/board-mx51_babbage: Add CD and WP GPIOs
In reply to Andre SilvaHi Sascha,
Just let you know that SD/MMC driver on your for-next is broken for all mx5 based boards, because adding esdhc platform data for mx5 will get sdhci-esdhc-imx driver probe function fail on "goto not_supported".
Hopefully, Chris will get the series below applied soon, which will get the driver back to work for mx5.
[PATCH v4 0/4] Extend sdhci-esdhc-imx card_detect and write_protect support for mx5
Regards,
Shawn
Quoted 79 lines · Andre Silva
Signed-off-by Andre Silva <[email protected]>--- arch/arm/mach-mx5/board-mx51_babbage.c | 24 +++++++++++++++++++++--- 1 files changed, 21 insertions(+), 3 deletions(-)arch/arm/mach-mx5/board-mx51_babbage.c +21
-3@@ -41,6 +41,10 @@#define BABBAGE_POWER_KEY IMX_GPIO_NR(2, 21)#define BABBAGE_ECSPI1_CS0 IMX_GPIO_NR(4, 24)#define BABBAGE_ECSPI1_CS1 IMX_GPIO_NR(4, 25) +#define BABBAGE_SD1_CD IMX_GPIO_NR(1, 0) +#define BABBAGE_SD1_WP IMX_GPIO_NR(1, 1) +#define BABBAGE_SD2_CD IMX_GPIO_NR(1, 6) +#define BABBAGE_SD2_WP IMX_GPIO_NR(1, 5)/* USB_CTRL_1 */ #define MX51_USB_CTRL_1_OFFSET 0x10@@ -142,7 +146,9 @@ static iomux_v3_cfg_t mx51babbage_pads[] = {MX51_PAD_SD1_DATA1__SD1_DATA1 ,MX51_PAD_SD1_DATA2__SD1_DATA2 ,MX51_PAD_SD1_DATA3__SD1_DATA3 , - +MX51_PAD_GPIO1_0__GPIO1_0 , +MX51_PAD_GPIO1_1__GPIO1_1 , +/* SD 2 */ MX51_PAD_SD2_CMD__SD2_CMD , MX51_PAD_SD2_CLK__SD2_CLK,@@ -150,6 +156,8 @@ static iomux_v3_cfg_t mx51babbage_pads[] = {MX51_PAD_SD2_DATA1__SD2_DATA1 ,MX51_PAD_SD2_DATA2__SD2_DATA2 ,MX51_PAD_SD2_DATA3__SD2_DATA3 , +MX51_PAD_GPIO1_6__GPIO1_6 , +MX51_PAD_GPIO1_5__GPIO1_5 ,/* eCSPI1 */ MX51_PAD_CSPI1_MISO__ECSPI1_MISO,@@ -331,6 +339,16 @@ static const struct spi_imx_master mx51_babbage_spi_pdata __initconst = { .num_chipselect = ARRAY_SIZE(mx51_babbage_spi_cs), }; +static const struct esdhc_platform_data mx51_babbage_sd1_data__initconst = { + .cd_gpio =BABBAGE_SD1_CD , + .wp_gpio =BABBAGE_SD1_WP , +}; + +static const struct esdhc_platform_data mx51_babbage_sd2_data__initconst = { + .cd_gpio =BABBAGE_SD2_CD , + .wp_gpio =BABBAGE_SD2_WP , +}; +/* * Board specific initialization. */ @@ -374,8 +392,8 @@ static void __init mx51_babbage_init(void)mxc_iomux_v3_setup_pad (usbh1stp);babbage_usbhub_reset (); -imx51_add_sdhci_esdhc_imx (0 ,NULL ); -imx51_add_sdhci_esdhc_imx (1 ,NULL ); +imx51_add_sdhci_esdhc_imx (0 , &mx51_babbage_sd1_data); +imx51_add_sdhci_esdhc_imx (1 , &mx51_babbage_sd2_data);spi_register_board_info (mx51_babbage_spi_board_info,ARRAY_SIZE (mx51_babbage_spi_board_info));Signature · 8 lines
1.7.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel at lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel