All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: sun8i-emac: Fix pinmux setup for Allwinner H5
@ 2021-04-16 11:05 Andre Przywara
  2021-04-16 15:01 ` Ramon Fried
  2021-04-18  6:45 ` [linux-sunxi] " Samuel Holland
  0 siblings, 2 replies; 3+ messages in thread
From: Andre Przywara @ 2021-04-16 11:05 UTC (permalink / raw)
  To: u-boot

Commit eb5a2b671075 ("net: sun8i-emac: Determine pinmux based on SoC,
not EMAC type") switched the pinmux setup over to look at
CONFIG_MACH_SUN* symbols, to find the appropriate mux value.
Unfortunately this patch missed to check for the H5, which is
pin-compatible to the H3, but uses a different Kconfig symbol (because
it has ARMv8 vs. ARMv7 cores).

Replace the pure SUN8I_H3 symbol with the joint SUNXI_H3_H5 one, which is
there to cover the peripherals common to both SoCs.
Also explicitly list each supported SoC, and have an error message in the
fallback case, to avoid those problems in the future.

This fixes Ethernet support on all H5 boards.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
---
 drivers/net/sun8i_emac.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/sun8i_emac.c b/drivers/net/sun8i_emac.c
index a6cdda81a76..5a1b38bf80f 100644
--- a/drivers/net/sun8i_emac.c
+++ b/drivers/net/sun8i_emac.c
@@ -554,7 +554,7 @@ static int parse_phy_pins(struct udevice *dev)
 	 * The GPIO pinmux value is an integration choice, so depends on the
 	 * SoC, not the EMAC variant.
 	 */
-	if (IS_ENABLED(CONFIG_MACH_SUN8I_H3))
+	if (IS_ENABLED(CONFIG_MACH_SUNXI_H3_H5))
 		iomux = SUN8I_IOMUX_H3;
 	else if (IS_ENABLED(CONFIG_MACH_SUN8I_R40))
 		iomux = SUN8I_IOMUX_R40;
@@ -562,8 +562,12 @@ static int parse_phy_pins(struct udevice *dev)
 		iomux = SUN8I_IOMUX_H6;
 	else if (IS_ENABLED(CONFIG_MACH_SUN50I_H616))
 		iomux = SUN8I_IOMUX_H616;
-	else
+	else if (IS_ENABLED(CONFIG_MACH_SUN8I_A83T))
+		iomux = SUN8I_IOMUX;
+	else if (IS_ENABLED(CONFIG_MACH_SUN50I))
 		iomux = SUN8I_IOMUX;
+	else
+		BUILD_BUG_ON_MSG(1, "missing pinmux value for Ethernet pins");
 
 	for (i = 0; ; i++) {
 		int pin;
-- 
2.17.5

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

* [PATCH] net: sun8i-emac: Fix pinmux setup for Allwinner H5
  2021-04-16 11:05 [PATCH] net: sun8i-emac: Fix pinmux setup for Allwinner H5 Andre Przywara
@ 2021-04-16 15:01 ` Ramon Fried
  2021-04-18  6:45 ` [linux-sunxi] " Samuel Holland
  1 sibling, 0 replies; 3+ messages in thread
From: Ramon Fried @ 2021-04-16 15:01 UTC (permalink / raw)
  To: u-boot

On Fri, Apr 16, 2021 at 2:06 PM Andre Przywara <andre.przywara@arm.com> wrote:
>
> Commit eb5a2b671075 ("net: sun8i-emac: Determine pinmux based on SoC,
> not EMAC type") switched the pinmux setup over to look at
> CONFIG_MACH_SUN* symbols, to find the appropriate mux value.
> Unfortunately this patch missed to check for the H5, which is
> pin-compatible to the H3, but uses a different Kconfig symbol (because
> it has ARMv8 vs. ARMv7 cores).
>
> Replace the pure SUN8I_H3 symbol with the joint SUNXI_H3_H5 one, which is
> there to cover the peripherals common to both SoCs.
> Also explicitly list each supported SoC, and have an error message in the
> fallback case, to avoid those problems in the future.
>
> This fixes Ethernet support on all H5 boards.
>
> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
> ---
>  drivers/net/sun8i_emac.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/sun8i_emac.c b/drivers/net/sun8i_emac.c
> index a6cdda81a76..5a1b38bf80f 100644
> --- a/drivers/net/sun8i_emac.c
> +++ b/drivers/net/sun8i_emac.c
> @@ -554,7 +554,7 @@ static int parse_phy_pins(struct udevice *dev)
>          * The GPIO pinmux value is an integration choice, so depends on the
>          * SoC, not the EMAC variant.
>          */
> -       if (IS_ENABLED(CONFIG_MACH_SUN8I_H3))
> +       if (IS_ENABLED(CONFIG_MACH_SUNXI_H3_H5))
>                 iomux = SUN8I_IOMUX_H3;
>         else if (IS_ENABLED(CONFIG_MACH_SUN8I_R40))
>                 iomux = SUN8I_IOMUX_R40;
> @@ -562,8 +562,12 @@ static int parse_phy_pins(struct udevice *dev)
>                 iomux = SUN8I_IOMUX_H6;
>         else if (IS_ENABLED(CONFIG_MACH_SUN50I_H616))
>                 iomux = SUN8I_IOMUX_H616;
> -       else
> +       else if (IS_ENABLED(CONFIG_MACH_SUN8I_A83T))
> +               iomux = SUN8I_IOMUX;
> +       else if (IS_ENABLED(CONFIG_MACH_SUN50I))
>                 iomux = SUN8I_IOMUX;
> +       else
> +               BUILD_BUG_ON_MSG(1, "missing pinmux value for Ethernet pins");
>
>         for (i = 0; ; i++) {
>                 int pin;
> --
> 2.17.5
>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>

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

* [linux-sunxi] [PATCH] net: sun8i-emac: Fix pinmux setup for Allwinner H5
  2021-04-16 11:05 [PATCH] net: sun8i-emac: Fix pinmux setup for Allwinner H5 Andre Przywara
  2021-04-16 15:01 ` Ramon Fried
@ 2021-04-18  6:45 ` Samuel Holland
  1 sibling, 0 replies; 3+ messages in thread
From: Samuel Holland @ 2021-04-18  6:45 UTC (permalink / raw)
  To: u-boot

On 4/16/21 6:05 AM, Andre Przywara wrote:
> Commit eb5a2b671075 ("net: sun8i-emac: Determine pinmux based on SoC,
> not EMAC type") switched the pinmux setup over to look at
> CONFIG_MACH_SUN* symbols, to find the appropriate mux value.
> Unfortunately this patch missed to check for the H5, which is
> pin-compatible to the H3, but uses a different Kconfig symbol (because
> it has ARMv8 vs. ARMv7 cores).
> 
> Replace the pure SUN8I_H3 symbol with the joint SUNXI_H3_H5 one, which is
> there to cover the peripherals common to both SoCs.
> Also explicitly list each supported SoC, and have an error message in the
> fallback case, to avoid those problems in the future.
> 
> This fixes Ethernet support on all H5 boards.
> 
> Signed-off-by: Andre Przywara <andre.przywara@arm.com>

Tested-by: Samuel Holland <samuel@sholland.org> # Orange Pi PC2

Also tested on H3 (Orange Pi Plus 2E) and A64 (Orange Pi Win) to verify
no regression.

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

end of thread, other threads:[~2021-04-18  6:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-16 11:05 [PATCH] net: sun8i-emac: Fix pinmux setup for Allwinner H5 Andre Przywara
2021-04-16 15:01 ` Ramon Fried
2021-04-18  6:45 ` [linux-sunxi] " Samuel Holland

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.