From 856b5ae841870054cb475e4dd89f5526c160a7ce Mon Sep 17 00:00:00 2001 From: kasperiio <101901857+kasperiio@users.noreply.github.com> Date: Sat, 5 Sep 2026 13:10:32 +0300 Subject: [PATCH] fh8856: fix JL1101 PHY detection, PHY reset GPIO and SD1 pinctrl on V100 boards Three fixes for the FH8856 (V100) as fitted to the Vatilon PB1 / Asecam board, each verified on that hardware. Squashed from three commits; their messages: fh_gmac: recognise JLSemi JL1101 PHY id 0x937c4024 The JL1101 stepping fitted on FH8856 boards such as the Asecam PB1 (IF5653-V2) reports PHY id 0x937c4024 instead of 0x937c4023. Without this the RMII/page-7 setup is skipped and the link never comes up. fh8856: let a board declare the PHY reset GPIO unwired CONFIG_GPIO_EMACPHY_RESET maps to pad 46, which is PWM7 on the Asecam PB1 and not connected to the PHY. Toggling it during boot left the JL1101 dead on MDIO (no PHY found, no network). U-Boot has already configured the PHY, and the vendor kernel never resets it either. board-fh8856.c is shared by every machine built with CONFIG_ARCH_FH8856, so the reset is skipped only where the board config defines CONFIG_GPIO_EMACPHY_RESET_UNWIRED. That is set in the FH8856 configs and deliberately not in board_config.fh8852.appboard, which documents GPIO11 as the EMAC PHY reset and keeps the existing sequence. fh8856: drop SD1_NO_WP from the default pinctrl selection Muxing the SD1 pads at boot hangs the SoC on the Asecam PB1 (IF5653-V2), which has no SD1 slot and uses those pads for other functions (the pad-51 GPIO16 path is where fh_pinctrl_init_devices() stalls). No supported FH8856 target uses SD1. --- arch/arm/mach-fh/board-fh8856.c | 15 ++++++++++++++- .../include/mach/board_config.fh8856.appboard | 9 ++++++++- .../include/mach/board_config.fh8856.testboard | 9 ++++++++- arch/arm/mach-fh/include/mach/board_config.h | 9 ++++++++- drivers/net/fh_gmac/fh_gmac_phyt.c | 2 ++ drivers/net/fh_gmac/fh_gmac_phyt.h | 3 +++ 6 files changed, 43 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-fh/board-fh8856.c b/arch/arm/mach-fh/board-fh8856.c index fabbf37871..93a46ccc32 100644 --- a/arch/arm/mach-fh/board-fh8856.c +++ b/arch/arm/mach-fh/board-fh8856.c @@ -410,6 +410,19 @@ static void fh_set_rmii_speed(int speed) static void fh_phy_reset(void) { +#ifdef CONFIG_GPIO_EMACPHY_RESET_UNWIRED + /* + * The board config declares CONFIG_GPIO_EMACPHY_RESET as not routed to + * the PHY. On FH8856 boards such as the Asecam PB1 (IF5653-V2) that + * GPIO is pad 46, which is PWM7 there; pulsing it while the RXDV strap + * floats leaves the JL1101 unresponsive on MDIO. The vendor firmware + * does not reset the PHY either, and U-Boot has already brought it up. + * + * Boards that do wire the line - FH8852 among them - keep the reset + * sequence below. + */ + return; +#else /* * RXDV must be low during phy reset */ @@ -428,7 +441,7 @@ static void fh_phy_reset(void) gpio_free(CONFIG_GPIO_EMACPHY_RXDV); fh_pmu_set_reg(0xe8, 0x00101030); - +#endif } static struct fh_gmac_platform_data fh_gmac_data = { diff --git a/arch/arm/mach-fh/include/mach/board_config.fh8856.appboard b/arch/arm/mach-fh/include/mach/board_config.fh8856.appboard index 1cd8c86cb7..b4d726f801 100644 --- a/arch/arm/mach-fh/include/mach/board_config.fh8856.appboard +++ b/arch/arm/mach-fh/include/mach/board_config.fh8856.appboard @@ -27,6 +27,13 @@ * GPIO55 -> SD1 WIFI Interrupt */ +/* + * GPIO11 is pad 46 (PWM7) on this board and is not routed to the PHY reset + * pin; see fh_phy_reset() in board-fh8856.c. Boards that do wire it, such as + * the FH8852 appboard, must not define this. + */ +#define CONFIG_GPIO_EMACPHY_RESET_UNWIRED 1 + #define CONFIG_GPIO_EMACPHY_RESET 11 #define CONFIG_GPIO_EMACPHY_RXDV 41 @@ -39,7 +46,7 @@ #define FH_BOARD_8856 #define CONFIG_PINCTRL_SELECT \ "I2C0", "I2C1", "MIPI", "RMII", "SD0_NO_WP", \ - "SD1_NO_WP", "SSI0_4BIT", "UART0", "GPIO0", "GPIO1", \ + "SSI0_4BIT", "UART0", "GPIO0", "GPIO1", \ "GPIO2", "GPIO3", "GPIO11", "GPIO13", "GPIO14", \ "GPIO19", "GPIO20", "GPIO24", "GPIO25", "GPIO26", \ "GPIO27", "GPIO28", "GPIO53", "GPIO55" diff --git a/arch/arm/mach-fh/include/mach/board_config.fh8856.testboard b/arch/arm/mach-fh/include/mach/board_config.fh8856.testboard index 1cd8c86cb7..b4d726f801 100644 --- a/arch/arm/mach-fh/include/mach/board_config.fh8856.testboard +++ b/arch/arm/mach-fh/include/mach/board_config.fh8856.testboard @@ -27,6 +27,13 @@ * GPIO55 -> SD1 WIFI Interrupt */ +/* + * GPIO11 is pad 46 (PWM7) on this board and is not routed to the PHY reset + * pin; see fh_phy_reset() in board-fh8856.c. Boards that do wire it, such as + * the FH8852 appboard, must not define this. + */ +#define CONFIG_GPIO_EMACPHY_RESET_UNWIRED 1 + #define CONFIG_GPIO_EMACPHY_RESET 11 #define CONFIG_GPIO_EMACPHY_RXDV 41 @@ -39,7 +46,7 @@ #define FH_BOARD_8856 #define CONFIG_PINCTRL_SELECT \ "I2C0", "I2C1", "MIPI", "RMII", "SD0_NO_WP", \ - "SD1_NO_WP", "SSI0_4BIT", "UART0", "GPIO0", "GPIO1", \ + "SSI0_4BIT", "UART0", "GPIO0", "GPIO1", \ "GPIO2", "GPIO3", "GPIO11", "GPIO13", "GPIO14", \ "GPIO19", "GPIO20", "GPIO24", "GPIO25", "GPIO26", \ "GPIO27", "GPIO28", "GPIO53", "GPIO55" diff --git a/arch/arm/mach-fh/include/mach/board_config.h b/arch/arm/mach-fh/include/mach/board_config.h index 1cd8c86cb7..b4d726f801 100644 --- a/arch/arm/mach-fh/include/mach/board_config.h +++ b/arch/arm/mach-fh/include/mach/board_config.h @@ -27,6 +27,13 @@ * GPIO55 -> SD1 WIFI Interrupt */ +/* + * GPIO11 is pad 46 (PWM7) on this board and is not routed to the PHY reset + * pin; see fh_phy_reset() in board-fh8856.c. Boards that do wire it, such as + * the FH8852 appboard, must not define this. + */ +#define CONFIG_GPIO_EMACPHY_RESET_UNWIRED 1 + #define CONFIG_GPIO_EMACPHY_RESET 11 #define CONFIG_GPIO_EMACPHY_RXDV 41 @@ -39,7 +46,7 @@ #define FH_BOARD_8856 #define CONFIG_PINCTRL_SELECT \ "I2C0", "I2C1", "MIPI", "RMII", "SD0_NO_WP", \ - "SD1_NO_WP", "SSI0_4BIT", "UART0", "GPIO0", "GPIO1", \ + "SSI0_4BIT", "UART0", "GPIO0", "GPIO1", \ "GPIO2", "GPIO3", "GPIO11", "GPIO13", "GPIO14", \ "GPIO19", "GPIO20", "GPIO24", "GPIO25", "GPIO26", \ "GPIO27", "GPIO28", "GPIO53", "GPIO55" diff --git a/drivers/net/fh_gmac/fh_gmac_phyt.c b/drivers/net/fh_gmac/fh_gmac_phyt.c index b2ff4eb0b7..c9342dd919 100644 --- a/drivers/net/fh_gmac/fh_gmac_phyt.c +++ b/drivers/net/fh_gmac/fh_gmac_phyt.c @@ -84,6 +84,7 @@ int fh_mdio_set_mii(struct mii_bus *bus) switch (pGmac->phydev->phy_id) { case FH_GMAC_PHY_RTL8201: case FH_GMAC_PHY_JL1101: + case FH_GMAC_PHY_JL1101_B: fh_mdio_write(bus, phyid, gmac_phyt_rtl8201_page_select, 7); fh_mdio_write(bus, phyid, @@ -118,6 +119,7 @@ int fh_mdio_set_mii(struct mii_bus *bus) switch (pGmac->phydev->phy_id) { case FH_GMAC_PHY_RTL8201: case FH_GMAC_PHY_JL1101: + case FH_GMAC_PHY_JL1101_B: fh_mdio_write(bus, phyid, gmac_phyt_rtl8201_page_select, 7); fh_mdio_write(bus, phyid, diff --git a/drivers/net/fh_gmac/fh_gmac_phyt.h b/drivers/net/fh_gmac/fh_gmac_phyt.h index f7256ff31a..c6d7535bae 100755 --- a/drivers/net/fh_gmac/fh_gmac_phyt.h +++ b/drivers/net/fh_gmac/fh_gmac_phyt.h @@ -12,6 +12,9 @@ #define FH_GMAC_PHY_RTL8201 0x001CC816 #define FH_GMAC_PHY_TI83848 0xFFFFFFFF #define FH_GMAC_PHY_JL1101 0x937c4023 +/* JLSemi JL1101, newer stepping (e.g. Asecam PB1 / IF5653-V2 with FH8856). + Same RMII setup as 0x937c4023. */ +#define FH_GMAC_PHY_JL1101_B 0x937c4024 enum {