[U-Boot] [PATCH v3 6/6] mmc: arm_pl180_mmci: Remove cd_inverted host's struct field

Tuomas Tynkkynen tuomas.tynkkynen at iki.fi
Wed Jul 25 11:42:08 UTC 2018


On 07/24/2018 03:37 PM, Patrice Chotard wrote:
> As platform uses GPIOs for card detection, it's
> simpler and more readable to use GPIO_ACTIVE_(LOW|HIGH)
> in the gpio flags instead of using the cd-inverted
> property.
> 
> 
> Reported-by: Tuomas Tynkkynen <tuomas.tynkkynen at iki.fi>
> Signed-off-by: Patrice Chotard <patrice.chotard at st.com>
> ---

Sounds good but doesn't this series need to also remove
the usage of cd-inverted from the DT? Like:

diff --git a/arch/arm/dts/stm32429i-eval.dts b/arch/arm/dts/stm32429i-eval.dts
index c16594b7e4..f6753a4d1a 100644
--- a/arch/arm/dts/stm32429i-eval.dts
+++ b/arch/arm/dts/stm32429i-eval.dts
@@ -223,8 +223,7 @@
  &sdio {
         status = "okay";
         vmmc-supply = <&mmc_vcard>;
-       cd-gpios = <&stmpegpio 15 GPIO_ACTIVE_HIGH>;
-       cd-inverted;
+       cd-gpios = <&stmpegpio 15 GPIO_ACTIVE_LOW>;
         pinctrl-names = "default", "opendrain";
         pinctrl-0 = <&sdio_pins>;
         pinctrl-1 = <&sdio_pins_od>;
diff --git a/arch/arm/dts/stm32f746-disco.dts b/arch/arm/dts/stm32f746-disco.dts
index e47f762e54..187c94b99b 100644
--- a/arch/arm/dts/stm32f746-disco.dts
+++ b/arch/arm/dts/stm32f746-disco.dts
@@ -307,8 +307,7 @@

  &sdio {
         status = "okay";
-       cd-gpios = <&gpioc 13 0>;
-       cd-inverted;
+       cd-gpios = <&gpioc 13 GPIO_ACTIVE_LOW>;
         pinctrl-names = "default", "opendrain";
         pinctrl-0 = <&sdio_pins>;
         pinctrl-1 = <&sdio_pins_od>;
diff --git a/arch/arm/dts/stm32f769-disco.dts b/arch/arm/dts/stm32f769-disco.dts
index 59c9d31c21..210be07ccc 100644
--- a/arch/arm/dts/stm32f769-disco.dts
+++ b/arch/arm/dts/stm32f769-disco.dts
@@ -256,8 +256,7 @@

  &sdio2 {
         status = "okay";
-       cd-gpios = <&gpioi 15 0>;
-       cd-inverted;
+       cd-gpios = <&gpioi 15 GPIO_ACTIVE_LOW>;
         pinctrl-names = "default", "opendrain";
         pinctrl-0 = <&sdio_pins_b>;
         pinctrl-1 = <&sdio_pins_od_b>;

> diff --git a/drivers/mmc/arm_pl180_mmci.c b/drivers/mmc/arm_pl180_mmci.c
> index 1cd780b3eec0..f71d79ecd6ba 100644
> --- a/drivers/mmc/arm_pl180_mmci.c
> +++ b/drivers/mmc/arm_pl180_mmci.c
> @@ -499,11 +499,8 @@ static int dm_mmc_getcd(struct udevice *dev)
>   	struct pl180_mmc_host *host = dev->priv;
>   	int value = 1;
>   
> -	if (dm_gpio_is_valid(&host->cd_gpio)) {
> +	if (dm_gpio_is_valid(&host->cd_gpio))
>   		value = dm_gpio_get_value(&host->cd_gpio);
> -		if (host->cd_inverted)
> -			return !value;
> -	}
>   
>   	return value;
>   }
> diff --git a/drivers/mmc/arm_pl180_mmci.h b/drivers/mmc/arm_pl180_mmci.h
> index 6b98db6cd978..36487be288b2 100644
> --- a/drivers/mmc/arm_pl180_mmci.h
> +++ b/drivers/mmc/arm_pl180_mmci.h
> @@ -192,7 +192,6 @@ struct pl180_mmc_host {
>   	struct mmc_config cfg;
>   #ifdef CONFIG_DM_MMC
>   	struct gpio_desc cd_gpio;
> -	bool cd_inverted;
>   #endif
>   };
>   
> 



More information about the U-Boot mailing list