Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 913413c3 authored by Shawn Guo's avatar Shawn Guo
Browse files

mmc: sdhci-esdhc-imx: extend card_detect and write_protect support for mx5



The patch extends card_detect and write_protect support to get mx5
family and more scenarios supported.  The changes include:

 * Turn platform_data from optional to mandatory
 * Add cd_types and wp_types into platform_data to cover more use
   cases
 * Remove the use of flag ESDHC_FLAG_GPIO_FOR_CD
 * Adjust some machine codes to adopt the platform_data changes
 * Work around the issue that software reset will get card detection
   circuit stop working

With this patch, card_detect and write_protect gets supported on
mx5 based platforms.

Signed-off-by: default avatarShawn Guo <shawn.guo@linaro.org>
Cc: Chris Ball <cjb@laptop.org>
Acked-by: default avatarWolfram Sang <w.sang@pengutronix.de>
Tested-by: default avatarArnaud Patard <arnaud.patard@rtp-net.org>
Acked-by: default avatarChris Ball <cjb@laptop.org>
parent ca2cc333
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -225,7 +225,8 @@ struct imx_ssi_platform_data eukrea_mbimxsd_ssi_pdata __initconst = {

static struct esdhc_platform_data sd1_pdata = {
	.cd_gpio = GPIO_SD1CD,
	.wp_gpio = -EINVAL,
	.cd_type = ESDHC_CD_GPIO,
	.wp_type = ESDHC_WP_NONE,
};

/*
+2 −1
Original line number Diff line number Diff line
@@ -236,7 +236,8 @@ struct imx_ssi_platform_data eukrea_mbimxsd_ssi_pdata __initconst = {

static struct esdhc_platform_data sd1_pdata = {
	.cd_gpio = GPIO_SD1CD,
	.wp_gpio = -EINVAL,
	.cd_type = ESDHC_CD_GPIO,
	.wp_type = ESDHC_WP_NONE,
};

/*
+2 −0
Original line number Diff line number Diff line
@@ -215,6 +215,8 @@ static const struct imxi2c_platform_data mx25_3ds_i2c0_data __initconst = {
static const struct esdhc_platform_data mx25pdk_esdhc_pdata __initconst = {
	.wp_gpio = SD1_GPIO_WP,
	.cd_gpio = SD1_GPIO_CD,
	.wp_type = ESDHC_WP_GPIO,
	.cd_type = ESDHC_CD_GPIO,
};

static void __init mx25pdk_init(void)
+2 −0
Original line number Diff line number Diff line
@@ -349,6 +349,8 @@ __setup("otg_mode=", pcm043_otg_mode);
static struct esdhc_platform_data sd1_pdata = {
	.wp_gpio = SD1_GPIO_WP,
	.cd_gpio = SD1_GPIO_CD,
	.wp_type = ESDHC_WP_GPIO,
	.cd_type = ESDHC_CD_GPIO,
};

/*
+8 −6
Original line number Diff line number Diff line
@@ -41,8 +41,6 @@
#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)

@@ -146,8 +144,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,
	/* CD/WP from controller */
	MX51_PAD_GPIO1_0__SD1_CD,
	MX51_PAD_GPIO1_1__SD1_WP,

	/* SD 2 */
	MX51_PAD_SD2_CMD__SD2_CMD,
@@ -156,6 +155,7 @@ 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,
	/* CD/WP gpio */
	MX51_PAD_GPIO1_6__GPIO1_6,
	MX51_PAD_GPIO1_5__GPIO1_5,

@@ -340,13 +340,15 @@ static const struct spi_imx_master mx51_babbage_spi_pdata __initconst = {
};

static const struct esdhc_platform_data mx51_babbage_sd1_data __initconst = {
	.cd_gpio = BABBAGE_SD1_CD,
	.wp_gpio = BABBAGE_SD1_WP,
	.cd_type = ESDHC_CD_CONTROLLER,
	.wp_type = ESDHC_WP_CONTROLLER,
};

static const struct esdhc_platform_data mx51_babbage_sd2_data __initconst = {
	.cd_gpio = BABBAGE_SD2_CD,
	.wp_gpio = BABBAGE_SD2_WP,
	.cd_type = ESDHC_CD_GPIO,
	.wp_type = ESDHC_WP_GPIO,
};

/*
Loading