All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] sunxi: Skip MMC0 init when its pinmux conflicts with UART0
@ 2022-04-10  5:13 Samuel Holland
  2022-04-10  5:13 ` [PATCH 2/2] mmc: sunxi: Remove unnecessary pinmux option dependency Samuel Holland
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Samuel Holland @ 2022-04-10  5:13 UTC (permalink / raw)
  To: u-boot, Jagan Teki, Andre Przywara; +Cc: Icenowy Zheng, Samuel Holland

Currently, selecting UART0_PORT_F entirely disables MMC support on sunxi
platforms. But this is a bigger hammer then needed. Muxing UART0 to the
pins on port F only causes a conflict with MMC0, so minimize the impact
by specifically skipping MMC0 init. We can continue to use MMC1/2 if
those are enabled.

Let's also remove the preprocessor check while refacting this function.

Signed-off-by: Samuel Holland <samuel@sholland.org>
---

 board/sunxi/board.c | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index 89324159d5..7822001d99 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -516,19 +516,17 @@ static void mmc_pinmux_setup(int sdc)
 
 int board_mmc_init(struct bd_info *bis)
 {
-	__maybe_unused struct mmc *mmc0, *mmc1;
-
-	mmc_pinmux_setup(CONFIG_MMC_SUNXI_SLOT);
-	mmc0 = sunxi_mmc_init(CONFIG_MMC_SUNXI_SLOT);
-	if (!mmc0)
-		return -1;
+	if (!IS_ENABLED(CONFIG_UART0_PORT_F)) {
+		mmc_pinmux_setup(CONFIG_MMC_SUNXI_SLOT);
+		if (!sunxi_mmc_init(CONFIG_MMC_SUNXI_SLOT))
+			return -1;
+	}
 
-#if CONFIG_MMC_SUNXI_SLOT_EXTRA != -1
-	mmc_pinmux_setup(CONFIG_MMC_SUNXI_SLOT_EXTRA);
-	mmc1 = sunxi_mmc_init(CONFIG_MMC_SUNXI_SLOT_EXTRA);
-	if (!mmc1)
-		return -1;
-#endif
+	if (CONFIG_MMC_SUNXI_SLOT_EXTRA != -1) {
+		mmc_pinmux_setup(CONFIG_MMC_SUNXI_SLOT_EXTRA);
+		if (!sunxi_mmc_init(CONFIG_MMC_SUNXI_SLOT_EXTRA))
+			return -1;
+	}
 
 	return 0;
 }
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] mmc: sunxi: Remove unnecessary pinmux option dependency
  2022-04-10  5:13 [PATCH 1/2] sunxi: Skip MMC0 init when its pinmux conflicts with UART0 Samuel Holland
@ 2022-04-10  5:13 ` Samuel Holland
  2022-04-11  2:03   ` Peng Fan (OSS)
  2022-05-24 16:15   ` Andre Przywara
  2022-04-26 12:58 ` [PATCH 1/2] sunxi: Skip MMC0 init when its pinmux conflicts with UART0 Andre Przywara
  2022-05-24 16:14 ` Andre Przywara
  2 siblings, 2 replies; 6+ messages in thread
From: Samuel Holland @ 2022-04-10  5:13 UTC (permalink / raw)
  To: u-boot, Jagan Teki, Andre Przywara
  Cc: Icenowy Zheng, Samuel Holland, Jaehoon Chung, Peng Fan

Now that the pinmux conflict is handled in the board code (by skipping
setup for the one conflicting MMC controller), the driver does not need
to be entirely disabled based on the UART pinmux.

Signed-off-by: Samuel Holland <samuel@sholland.org>
---

 drivers/mmc/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig
index f04cc44e19..5e2921ce41 100644
--- a/drivers/mmc/Kconfig
+++ b/drivers/mmc/Kconfig
@@ -727,7 +727,7 @@ config ZYNQ_HISPD_BROKEN
 
 config MMC_SUNXI
 	bool "Allwinner sunxi SD/MMC Host Controller support"
-	depends on ARCH_SUNXI && !UART0_PORT_F
+	depends on ARCH_SUNXI
 	default y
 	help
 	  This selects support for the SD/MMC Host Controller on
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] mmc: sunxi: Remove unnecessary pinmux option dependency
  2022-04-10  5:13 ` [PATCH 2/2] mmc: sunxi: Remove unnecessary pinmux option dependency Samuel Holland
@ 2022-04-11  2:03   ` Peng Fan (OSS)
  2022-05-24 16:15   ` Andre Przywara
  1 sibling, 0 replies; 6+ messages in thread
From: Peng Fan (OSS) @ 2022-04-11  2:03 UTC (permalink / raw)
  To: Samuel Holland, u-boot, Jagan Teki, Andre Przywara
  Cc: Icenowy Zheng, Jaehoon Chung, Peng Fan



On 2022/4/10 13:13, Samuel Holland wrote:
> Now that the pinmux conflict is handled in the board code (by skipping
> setup for the one conflicting MMC controller), the driver does not need
> to be entirely disabled based on the UART pinmux.
> 
> Signed-off-by: Samuel Holland <samuel@sholland.org>

Reviewed-by: Peng Fan <peng.fan@nxp.com>

> ---
> 
>   drivers/mmc/Kconfig | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig
> index f04cc44e19..5e2921ce41 100644
> --- a/drivers/mmc/Kconfig
> +++ b/drivers/mmc/Kconfig
> @@ -727,7 +727,7 @@ config ZYNQ_HISPD_BROKEN
>   
>   config MMC_SUNXI
>   	bool "Allwinner sunxi SD/MMC Host Controller support"
> -	depends on ARCH_SUNXI && !UART0_PORT_F
> +	depends on ARCH_SUNXI
>   	default y
>   	help
>   	  This selects support for the SD/MMC Host Controller on
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] sunxi: Skip MMC0 init when its pinmux conflicts with UART0
  2022-04-10  5:13 [PATCH 1/2] sunxi: Skip MMC0 init when its pinmux conflicts with UART0 Samuel Holland
  2022-04-10  5:13 ` [PATCH 2/2] mmc: sunxi: Remove unnecessary pinmux option dependency Samuel Holland
@ 2022-04-26 12:58 ` Andre Przywara
  2022-05-24 16:14 ` Andre Przywara
  2 siblings, 0 replies; 6+ messages in thread
From: Andre Przywara @ 2022-04-26 12:58 UTC (permalink / raw)
  To: Samuel Holland; +Cc: u-boot, Jagan Teki, Icenowy Zheng

On Sun, 10 Apr 2022 00:13:33 -0500
Samuel Holland <samuel@sholland.org> wrote:

> Currently, selecting UART0_PORT_F entirely disables MMC support on sunxi
> platforms. But this is a bigger hammer then needed. Muxing UART0 to the
> pins on port F only causes a conflict with MMC0, so minimize the impact
> by specifically skipping MMC0 init. We can continue to use MMC1/2 if
> those are enabled.
> 
> Let's also remove the preprocessor check while refacting this function.

I like this very much, that should solve a bunch of problems at once and
looks nicer.
I will need to test that, but plan on taking it as a fix ASAP.

Thanks,
Andre.

> 
> Signed-off-by: Samuel Holland <samuel@sholland.org>
> ---
> 
>  board/sunxi/board.c | 22 ++++++++++------------
>  1 file changed, 10 insertions(+), 12 deletions(-)
> 
> diff --git a/board/sunxi/board.c b/board/sunxi/board.c
> index 89324159d5..7822001d99 100644
> --- a/board/sunxi/board.c
> +++ b/board/sunxi/board.c
> @@ -516,19 +516,17 @@ static void mmc_pinmux_setup(int sdc)
>  
>  int board_mmc_init(struct bd_info *bis)
>  {
> -	__maybe_unused struct mmc *mmc0, *mmc1;
> -
> -	mmc_pinmux_setup(CONFIG_MMC_SUNXI_SLOT);
> -	mmc0 = sunxi_mmc_init(CONFIG_MMC_SUNXI_SLOT);
> -	if (!mmc0)
> -		return -1;
> +	if (!IS_ENABLED(CONFIG_UART0_PORT_F)) {
> +		mmc_pinmux_setup(CONFIG_MMC_SUNXI_SLOT);
> +		if (!sunxi_mmc_init(CONFIG_MMC_SUNXI_SLOT))
> +			return -1;
> +	}
>  
> -#if CONFIG_MMC_SUNXI_SLOT_EXTRA != -1
> -	mmc_pinmux_setup(CONFIG_MMC_SUNXI_SLOT_EXTRA);
> -	mmc1 = sunxi_mmc_init(CONFIG_MMC_SUNXI_SLOT_EXTRA);
> -	if (!mmc1)
> -		return -1;
> -#endif
> +	if (CONFIG_MMC_SUNXI_SLOT_EXTRA != -1) {
> +		mmc_pinmux_setup(CONFIG_MMC_SUNXI_SLOT_EXTRA);
> +		if (!sunxi_mmc_init(CONFIG_MMC_SUNXI_SLOT_EXTRA))
> +			return -1;
> +	}
>  
>  	return 0;
>  }


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] sunxi: Skip MMC0 init when its pinmux conflicts with UART0
  2022-04-10  5:13 [PATCH 1/2] sunxi: Skip MMC0 init when its pinmux conflicts with UART0 Samuel Holland
  2022-04-10  5:13 ` [PATCH 2/2] mmc: sunxi: Remove unnecessary pinmux option dependency Samuel Holland
  2022-04-26 12:58 ` [PATCH 1/2] sunxi: Skip MMC0 init when its pinmux conflicts with UART0 Andre Przywara
@ 2022-05-24 16:14 ` Andre Przywara
  2 siblings, 0 replies; 6+ messages in thread
From: Andre Przywara @ 2022-05-24 16:14 UTC (permalink / raw)
  To: Samuel Holland; +Cc: u-boot, Jagan Teki, Icenowy Zheng

On Sun, 10 Apr 2022 00:13:33 -0500
Samuel Holland <samuel@sholland.org> wrote:

> Currently, selecting UART0_PORT_F entirely disables MMC support on sunxi
> platforms. But this is a bigger hammer then needed. Muxing UART0 to the
> pins on port F only causes a conflict with MMC0, so minimize the impact
> by specifically skipping MMC0 init. We can continue to use MMC1/2 if
> those are enabled.
> 
> Let's also remove the preprocessor check while refacting this function.
> 
> Signed-off-by: Samuel Holland <samuel@sholland.org>

Applied to sunxi/master.

Thanks,
Andre

> ---
> 
>  board/sunxi/board.c | 22 ++++++++++------------
>  1 file changed, 10 insertions(+), 12 deletions(-)
> 
> diff --git a/board/sunxi/board.c b/board/sunxi/board.c
> index 89324159d5..7822001d99 100644
> --- a/board/sunxi/board.c
> +++ b/board/sunxi/board.c
> @@ -516,19 +516,17 @@ static void mmc_pinmux_setup(int sdc)
>  
>  int board_mmc_init(struct bd_info *bis)
>  {
> -	__maybe_unused struct mmc *mmc0, *mmc1;
> -
> -	mmc_pinmux_setup(CONFIG_MMC_SUNXI_SLOT);
> -	mmc0 = sunxi_mmc_init(CONFIG_MMC_SUNXI_SLOT);
> -	if (!mmc0)
> -		return -1;
> +	if (!IS_ENABLED(CONFIG_UART0_PORT_F)) {
> +		mmc_pinmux_setup(CONFIG_MMC_SUNXI_SLOT);
> +		if (!sunxi_mmc_init(CONFIG_MMC_SUNXI_SLOT))
> +			return -1;
> +	}
>  
> -#if CONFIG_MMC_SUNXI_SLOT_EXTRA != -1
> -	mmc_pinmux_setup(CONFIG_MMC_SUNXI_SLOT_EXTRA);
> -	mmc1 = sunxi_mmc_init(CONFIG_MMC_SUNXI_SLOT_EXTRA);
> -	if (!mmc1)
> -		return -1;
> -#endif
> +	if (CONFIG_MMC_SUNXI_SLOT_EXTRA != -1) {
> +		mmc_pinmux_setup(CONFIG_MMC_SUNXI_SLOT_EXTRA);
> +		if (!sunxi_mmc_init(CONFIG_MMC_SUNXI_SLOT_EXTRA))
> +			return -1;
> +	}
>  
>  	return 0;
>  }


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] mmc: sunxi: Remove unnecessary pinmux option dependency
  2022-04-10  5:13 ` [PATCH 2/2] mmc: sunxi: Remove unnecessary pinmux option dependency Samuel Holland
  2022-04-11  2:03   ` Peng Fan (OSS)
@ 2022-05-24 16:15   ` Andre Przywara
  1 sibling, 0 replies; 6+ messages in thread
From: Andre Przywara @ 2022-05-24 16:15 UTC (permalink / raw)
  To: Samuel Holland; +Cc: u-boot, Jagan Teki, Icenowy Zheng, Jaehoon Chung, Peng Fan

On Sun, 10 Apr 2022 00:13:34 -0500
Samuel Holland <samuel@sholland.org> wrote:

> Now that the pinmux conflict is handled in the board code (by skipping
> setup for the one conflicting MMC controller), the driver does not need
> to be entirely disabled based on the UART pinmux.
> 
> Signed-off-by: Samuel Holland <samuel@sholland.org>

Applied to sunxi/master.

Thanks,
Andre

> ---
> 
>  drivers/mmc/Kconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig
> index f04cc44e19..5e2921ce41 100644
> --- a/drivers/mmc/Kconfig
> +++ b/drivers/mmc/Kconfig
> @@ -727,7 +727,7 @@ config ZYNQ_HISPD_BROKEN
>  
>  config MMC_SUNXI
>  	bool "Allwinner sunxi SD/MMC Host Controller support"
> -	depends on ARCH_SUNXI && !UART0_PORT_F
> +	depends on ARCH_SUNXI
>  	default y
>  	help
>  	  This selects support for the SD/MMC Host Controller on


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-05-24 16:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-10  5:13 [PATCH 1/2] sunxi: Skip MMC0 init when its pinmux conflicts with UART0 Samuel Holland
2022-04-10  5:13 ` [PATCH 2/2] mmc: sunxi: Remove unnecessary pinmux option dependency Samuel Holland
2022-04-11  2:03   ` Peng Fan (OSS)
2022-05-24 16:15   ` Andre Przywara
2022-04-26 12:58 ` [PATCH 1/2] sunxi: Skip MMC0 init when its pinmux conflicts with UART0 Andre Przywara
2022-05-24 16:14 ` Andre Przywara

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.