Skip to contentSkip to conversation

mmc: sdhci-esdhc-imx: remove unused enum cd_types

PATCH Superseded [email protected] 2 participants 6 messages May 5, 2023

Subsystems (6)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 1/4 mmc: sdhci-esdhc-imx: remove unused enum cd_types

From: Haibo Chen <[email protected]>

enum cd_types is no more used, so remove it here.

---
 drivers/mmc/host/sdhci-esdhc-imx.c | 9 ---------
 1 file changed, 9 deletions(-)
drivers/mmc/host/sdhci-esdhc-imx.c +0 -9
index eebf94604a7f..c7db742f729c 100644
@@ -207,25 +207,16 @@ enum wp_types {
 	ESDHC_WP_GPIO,		/* external gpio pin for WP */
 };
 
-enum cd_types {
-	ESDHC_CD_NONE,		/* no CD, neither controller nor gpio */
-	ESDHC_CD_CONTROLLER,	/* mmc controller internal CD */
-	ESDHC_CD_GPIO,		/* external gpio pin for CD */
-	ESDHC_CD_PERMANENT,	/* no CD, card permanently wired to host */
-};
-
 /*
  * struct esdhc_platform_data - platform data for esdhc on i.MX
  *
  * ESDHC_WP(CD)_CONTROLLER type is not available on i.MX25/35.
  *
  * @wp_type:	type of write_protect method (see wp_types enum above)
- * @cd_type:	type of card_detect method (see cd_types enum above)
  */
 
 struct esdhc_platform_data {
 	enum wp_types wp_type;
-	enum cd_types cd_type;
 	int max_bus_width;
 	unsigned int delay_line;
 	unsigned int tuning_step;       /* The delay cell steps in tuning procedure */
Signature · 1 line
2.34.1
author maintainer
#1 lore raw

PATCH 2/4 mmc: sdhci-esdhc-imx: remove redundant write protect code

From: Haibo Chen <[email protected]>

The logic of the esdhc_pltfm_get_ro() is just the same with common code sdhci_check_ro(). So remove this redundant code, depends on mmc_of_parse() and sdhci_check_ro() to cover the write protect logic.

---
 drivers/mmc/host/sdhci-esdhc-imx.c | 47 +-----------------------------
 1 file changed, 1 insertion(+), 46 deletions(-)
drivers/mmc/host/sdhci-esdhc-imx.c +1 -46
index c7db742f729c..54531aab70f0 100644
@@ -201,22 +201,8 @@
 /* ERR004536 is not applicable for the IP  */
 #define ESDHC_FLAG_SKIP_ERR004536	BIT(17)
 
-enum wp_types {
-	ESDHC_WP_NONE,		/* no WP, neither controller nor gpio */
-	ESDHC_WP_CONTROLLER,	/* mmc controller internal WP */
-	ESDHC_WP_GPIO,		/* external gpio pin for WP */
-};
-
-/*
- * struct esdhc_platform_data - platform data for esdhc on i.MX
- *
- * ESDHC_WP(CD)_CONTROLLER type is not available on i.MX25/35.
- *
- * @wp_type:	type of write_protect method (see wp_types enum above)
- */
-
+/* struct esdhc_platform_data - platform data for esdhc on i.MX */
 struct esdhc_platform_data {
-	enum wp_types wp_type;
 	int max_bus_width;
 	unsigned int delay_line;
 	unsigned int tuning_step;       /* The delay cell steps in tuning procedure */
@@ -994,25 +980,6 @@ static inline void esdhc_pltfm_set_clock(struct sdhci_host *host,
 
 }
 
-static unsigned int esdhc_pltfm_get_ro(struct sdhci_host *host)
-{
-	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
-	struct esdhc_platform_data *boarddata = &imx_data->boarddata;
-
-	switch (boarddata->wp_type) {
-	case ESDHC_WP_GPIO:
-		return mmc_gpio_get_ro(host->mmc);
-	case ESDHC_WP_CONTROLLER:
-		return !(readl(host->ioaddr + SDHCI_PRESENT_STATE) &
-			       SDHCI_WRITE_PROTECT);
-	case ESDHC_WP_NONE:
-		break;
-	}
-
-	return -ENOSYS;
-}
-
 static void esdhc_pltfm_set_bus_width(struct sdhci_host *host, int width)
 {
 	u32 ctrl;
@@ -1380,7 +1347,6 @@ static struct sdhci_ops sdhci_esdhc_ops = {
 	.get_max_clock = esdhc_pltfm_get_max_clock,
 	.get_min_clock = esdhc_pltfm_get_min_clock,
 	.get_max_timeout_count = esdhc_get_max_timeout_count,
-	.get_ro = esdhc_pltfm_get_ro,
 	.set_timeout = esdhc_set_timeout,
 	.set_bus_width = esdhc_pltfm_set_bus_width,
 	.set_uhs_signaling = esdhc_set_uhs_signaling,
@@ -1588,17 +1554,6 @@ sdhci_esdhc_imx_probe_dt(struct platform_device *pdev,
 	struct esdhc_platform_data *boarddata = &imx_data->boarddata;
 	int ret;
 
-	if (of_property_read_bool(np, "fsl,wp-controller"))
-		boarddata->wp_type = ESDHC_WP_CONTROLLER;
-
-	/*
-	 * If we have this property, then activate WP check.
-	 * Retrieveing and requesting the actual WP GPIO will happen
-	 * in the call to mmc_of_parse().
-	 */
-	if (of_property_read_bool(np, "wp-gpios"))
-		boarddata->wp_type = ESDHC_WP_GPIO;
-
 	of_property_read_u32(np, "fsl,tuning-step", &boarddata->tuning_step);
 	of_property_read_u32(np, "fsl,tuning-start-tap",
 			     &boarddata->tuning_start_tap);
Signature · 1 line
2.34.1
author maintainer
#2 lore raw

PATCH 3/4 dt-bindings: mmc: fsl-imx-esdhc: remove property "fsl,wp-controller"

In reply to [email protected]

From: Haibo Chen <[email protected]>

Driver do not use this property, so remove it here.

---
 Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.yaml | 5 -----
 1 file changed, 5 deletions(-)
Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.yaml +0 -5
index fbfd822b9270..831eadecc7e4 100644
@@ -96,11 +96,6 @@ properties:
   interrupts:
     maxItems: 1
 
-  fsl,wp-controller:
-    description: |
-      boolean, if present, indicate to use controller internal write protection.
-    type: boolean
-
   fsl,delay-line:
     $ref: /schemas/types.yaml#/definitions/uint32
     description: |
Signature · 1 line
2.34.1
maintainer
#3 lore raw

Re: [PATCH 3/4] dt-bindings: mmc: fsl-imx-esdhc: remove property "fsl,wp-controller"

Quoted 9 lines · On Fri, 05 May 2023 16:49:54 +0800, [email protected] wrote:

From: Haibo Chen <[email protected]>

Driver do not use this property, so remove it here.

---
 Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.yaml | 5 -----
 1 file changed, 5 deletions(-)

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.example.dtb: mmc@70004000: Unevaluated properties are not allowed ('fsl,wp-controller' was unexpected)
From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.yaml

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]

The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.

author maintainer
#4 lore raw

RE: [PATCH 3/4] dt-bindings: mmc: fsl-imx-esdhc: remove property "fsl,wp-controller"

Quoted 30 lines

-----Original Message-----
From: Rob Herring <[email protected]>
Sent: 2023年5月5日 17:33
To: Bough Chen <[email protected]>
Cc: dl-linux-imx <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 3/4] dt-bindings: mmc: fsl-imx-esdhc: remove property "fsl,wp-controller"

Quoted 9 lines · On Fri, 05 May 2023 16:49:54 +0800, [email protected] wrote:

From: Haibo Chen <[email protected]>

Driver do not use this property, so remove it here.

---
 Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.yaml | 5 -----
 1 file changed, 5 deletions(-)

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

Quoted 7 lines

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/mmc /fsl-imx-esdhc.example.dtb: mmc@70004000: Unevaluated properties are not allowed ('fsl,wp-controller' was unexpected)
From schema:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/mmc /fsl-imx-esdhc.yaml

Sorry, my bad, I forget to run dt_binding_check and dtbs_check, will send v2 patch which pass these checks.

Best Regards
Haibo Chen

Quoted 25 lines

doc reference errors (make refcheckdocs):

See
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatchwor
k.ozlabs.org%2Fproject%2Fdevicetree-bindings%2Fpatch%2F20230505084955. 238940-3-haibo.chen%40nxp.com&data=05%7C01%7Chaibo.chen%40nxp.com %7C3056027b14354464981408db4d4bbbbe%7C686ea1d3bc2b4c6fa92cd99c5c 301635%7C0%7C0%7C638188759886680874%7CUnknown%7CTWFpbGZsb3d8 eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D% 7C3000%7C%7C%7C&sdata=GcuoWB8pDeia%2Fv7Rp7%2FA5gsa0lu9A3qaUcin K95qz%2B0%3D&reserved=0

The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.

author maintainer
#5 lore raw

PATCH 4/4 arm: dts: imx: remove "fsl,wp-controller" since it is dropped

In reply to [email protected]

From: Haibo Chen <[email protected]>

The driver sdhci-esdhc-imx.c drop the "fsl,wp-controller", so do a clean up in the dts file.

Now the logic of write protect is:
if want to use gpio method to implement the write protect, need to add "wp-gpios" in dts file, otherwise will use the controller internal logic to implement the write protect. This controller method need to config one pin as a specific write protect function used for the controller. If not do this config or the board do not has this pin connect to card socket, then the write is enabled.

So now remove "fsl,wp-controller" will not involve any logic change.

---
 arch/arm/boot/dts/imx53-sk-imx53.dts         | 1 -
 arch/arm/boot/dts/imx53-tx53.dtsi            | 2 --
 arch/arm/boot/dts/imx6dl-tx6s-8035.dts       | 1 -
 arch/arm/boot/dts/imx6dl-tx6u-8033.dts       | 1 -
 arch/arm/boot/dts/imx6q-bosch-acc.dts        | 2 --
 arch/arm/boot/dts/imx6q-tx6q-1020-comtft.dts | 1 -
 arch/arm/boot/dts/imx6q-tx6q-1020.dts        | 1 -
 arch/arm/boot/dts/imx6q-tx6q-1036.dts        | 1 -
 arch/arm/boot/dts/imx6qdl-dhcom-som.dtsi     | 1 -
 arch/arm/boot/dts/imx6qdl-emcon.dtsi         | 2 --
 arch/arm/boot/dts/imx6qdl-ts4900.dtsi        | 1 -
 arch/arm/boot/dts/imx6qdl-ts7970.dtsi        | 1 -
 arch/arm/boot/dts/imx6qdl-tx6.dtsi           | 2 --
 arch/arm/boot/dts/imx6qp-tx6qp-8037.dts      | 1 -
 arch/arm/boot/dts/imx6qp-tx6qp-8137.dts      | 1 -
 arch/arm/boot/dts/imx6ul-tx6ul-0011.dts      | 1 -
 arch/arm/boot/dts/imx6ul-tx6ul.dtsi          | 1 -
 arch/arm/boot/dts/imxrt1050.dtsi             | 1 -
 18 files changed, 22 deletions(-)
arch/arm/boot/dts/imx53-sk-imx53.dts +0 -1
index 103e73176e47..071e8b4b0a7e 100644
@@ -76,7 +76,6 @@ &ecspi2 {
 
 &esdhc1 {
 	cd-gpios = <&gpio3 14 GPIO_ACTIVE_LOW>;
-	fsl,wp-controller;
 	pinctrl-names = "default";
 	pinctrl-0 = <&pinctrl_esdhc1>;
 	status = "okay";
arch/arm/boot/dts/imx53-tx53.dtsi +0 -2
index a439a47fb65a..4bef504008cc 100644
@@ -196,7 +196,6 @@ &gpio3 19 GPIO_ACTIVE_HIGH
 
 &esdhc1 {
 	cd-gpios = <&gpio3 24 GPIO_ACTIVE_LOW>;
-	fsl,wp-controller;
 	pinctrl-names = "default";
 	pinctrl-0 = <&pinctrl_esdhc1>;
 	status = "okay";
@@ -204,7 +203,6 @@ &esdhc1 {
 
 &esdhc2 {
 	cd-gpios = <&gpio3 25 GPIO_ACTIVE_LOW>;
-	fsl,wp-controller;
 	pinctrl-names = "default";
 	pinctrl-0 = <&pinctrl_esdhc2>;
 	status = "okay";
arch/arm/boot/dts/imx6dl-tx6s-8035.dts +0 -1
index a5532ecc18c5..63f043372931 100644
@@ -67,7 +67,6 @@ &usdhc4 {
 	bus-width = <4>;
 	non-removable;
 	no-1-8-v;
-	fsl,wp-controller;
 	status = "okay";
 };
 
arch/arm/boot/dts/imx6dl-tx6u-8033.dts +0 -1
index 7030b2654bbd..2d24dae7dbfc 100644
@@ -63,7 +63,6 @@ &usdhc4 {
 	bus-width = <4>;
 	non-removable;
 	no-1-8-v;
-	fsl,wp-controller;
 	status = "okay";
 };
 
arch/arm/boot/dts/imx6q-bosch-acc.dts +0 -2
index 8263bfef9bf8..26794f425a59 100644
@@ -573,7 +573,6 @@ &usdhc2 {
 	wakeup-source;
 	voltage-ranges = <3300 3300>;
 	vmmc-supply = <&reg_sw4>;
-	fsl,wp-controller;
 	status = "okay";
 };
 
@@ -586,7 +585,6 @@ &usdhc4 {
 	keep-power-in-suspend;
 	voltage-ranges = <3300 3300>;
 	vmmc-supply = <&reg_sw4>;
-	fsl,wp-controller;
 	status = "okay";
 };
 
arch/arm/boot/dts/imx6q-tx6q-1020-comtft.dts +0 -1
index a773f252816c..15956a92fe8b 100644
@@ -91,7 +91,6 @@ &usdhc4 {
 	pinctrl-0 = <&pinctrl_usdhc4>;
 	bus-width = <4>;
 	no-1-8-v;
-	fsl,wp-controller;
 	status = "okay";
 };
 
arch/arm/boot/dts/imx6q-tx6q-1020.dts +0 -1
index 0a4daec8d3ad..9dc92773c2f1 100644
@@ -67,7 +67,6 @@ &usdhc4 {
 	bus-width = <4>;
 	non-removable;
 	no-1-8-v;
-	fsl,wp-controller;
 	status = "okay";
 };
 
arch/arm/boot/dts/imx6q-tx6q-1036.dts +0 -1
index cb2fcb4896c6..24eba1d2afd9 100644
@@ -67,7 +67,6 @@ &usdhc4 {
 	bus-width = <4>;
 	non-removable;
 	no-1-8-v;
-	fsl,wp-controller;
 	status = "okay";
 };
 
arch/arm/boot/dts/imx6qdl-dhcom-som.dtsi +0 -1
index eaa87b333164..f8b985029f51 100644
@@ -412,7 +412,6 @@ &usdhc2 { /* External SD card via DHCOM */
 
 &usdhc3 { /* Micro SD card on module */
 	cd-gpios = <&gpio7 8 GPIO_ACTIVE_LOW>;
-	fsl,wp-controller;
 	keep-power-in-suspend;
 	pinctrl-0 = <&pinctrl_usdhc3>;
 	pinctrl-names = "default";
arch/arm/boot/dts/imx6qdl-emcon.dtsi +0 -2
index ee2dd75cead6..61306e6da6bd 100644
@@ -792,13 +792,11 @@ &usbotg {
 &usdhc1 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&pinctrl_usdhc1>;
-	fsl,wp-controller;
 };
 
 &usdhc2 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&pinctrl_usdhc2>;
-	fsl,wp-controller;
 };
 
 &usdhc3 {
arch/arm/boot/dts/imx6qdl-ts4900.dtsi +0 -1
index f88da757edda..6d2f04434d6c 100644
@@ -464,7 +464,6 @@ &usdhc2 {
 	pinctrl-0 = <&pinctrl_usdhc2>;
 	vmmc-supply = <&reg_3p3v>;
 	bus-width = <4>;
-	fsl,wp-controller;
 	status = "okay";
 };
 
arch/arm/boot/dts/imx6qdl-ts7970.dtsi +0 -1
index 1e0a041e9f60..d4c967971f6a 100644
@@ -579,7 +579,6 @@ &usdhc2 {
 	pinctrl-0 = <&pinctrl_usdhc2>;
 	vmmc-supply = <&reg_3p3v>;
 	bus-width = <4>;
-	fsl,wp-controller;
 	status = "okay";
 };
 
arch/arm/boot/dts/imx6qdl-tx6.dtsi +0 -2
index a197bac95cba..e74fb3171656 100644
@@ -777,7 +777,6 @@ &usdhc1 {
 	bus-width = <4>;
 	no-1-8-v;
 	cd-gpios = <&gpio7 2 GPIO_ACTIVE_LOW>;
-	fsl,wp-controller;
 	status = "okay";
 };
 
@@ -787,6 +786,5 @@ &usdhc2 {
 	bus-width = <4>;
 	no-1-8-v;
 	cd-gpios = <&gpio7 3 GPIO_ACTIVE_LOW>;
-	fsl,wp-controller;
 	status = "okay";
 };
arch/arm/boot/dts/imx6qp-tx6qp-8037.dts +0 -1
index ffc0f2ee11d2..18cda0d42826 100644
@@ -67,7 +67,6 @@ &usdhc4 {
 	bus-width = <4>;
 	non-removable;
 	no-1-8-v;
-	fsl,wp-controller;
 	status = "okay";
 };
 
arch/arm/boot/dts/imx6qp-tx6qp-8137.dts +0 -1
index dd494d587014..7478ae7535f4 100644
@@ -71,7 +71,6 @@ &usdhc4 {
 	bus-width = <4>;
 	non-removable;
 	no-1-8-v;
-	fsl,wp-controller;
 	status = "okay";
 };
 
arch/arm/boot/dts/imx6ul-tx6ul-0011.dts +0 -1
index d82698e7d50f..5a2e8edf149e 100644
@@ -63,6 +63,5 @@ &usdhc2 {
 	bus-width = <4>;
 	no-1-8-v;
 	non-removable;
-	fsl,wp-controller;
 	status = "okay";
 };
arch/arm/boot/dts/imx6ul-tx6ul.dtsi +0 -1
index 70cef5e817bd..62c96884bfda 100644
@@ -575,7 +575,6 @@ &usdhc1 {
 	bus-width = <4>;
 	no-1-8-v;
 	cd-gpios = <&gpio4 14 GPIO_ACTIVE_LOW>;
-	fsl,wp-controller;
 	status = "okay";
 };
 
arch/arm/boot/dts/imxrt1050.dtsi +0 -1
index 852861558b47..7e983c52ebcd 100644
@@ -91,7 +91,6 @@ usdhc1: mmc@402c0000 {
 				<&clks IMXRT1050_CLK_USDHC1>;
 			clock-names = "ipg", "ahb", "per";
 			bus-width = <4>;
-			fsl,wp-controller;
 			no-1-8-v;
 			max-frequency = <200000000>;
 			fsl,tuning-start-tap = <20>;
Signature · 1 line
2.34.1