Skip to contentSkip to conversation

arm: dts: imx8mq-evk: add phy-reset-gpios for fec1

PATCH Superseded Alifer Moraes 2 participants 3 messages Feb 14, 2020 1 message not in the archive

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm: dts: imx8mq-evk: add phy-reset-gpios for fec1

Let the driver reset the phy via dts description instead of doing it through functions in imx8mq_evk.c

---
 arch/arm/dts/imx8mq-evk.dts             |  2 ++
 board/freescale/imx8mq_evk/imx8mq_evk.c | 18 ------------------
 2 files changed, 2 insertions(+), 18 deletions(-)
arch/arm/dts/imx8mq-evk.dts +2 -0
index 3693933451..55294ba9c8 100644
@@ -104,6 +104,8 @@
 	pinctrl-0 = <&pinctrl_fec1>;
 	phy-mode = "rgmii-id";
 	phy-handle = <&ethphy0>;
+	phy-reset-gpios = <&gpio1 9 GPIO_ACTIVE_LOW>;
+	phy-reset-duration = <10>;
 	fsl,magic-packet;
 	status = "okay";
 
board/freescale/imx8mq_evk/imx8mq_evk.c +0 -18
index cb39d0f2d6..b2f464abb1 100644
@@ -64,29 +64,11 @@ int dram_init(void)
 }
 
 #ifdef CONFIG_FEC_MXC
-#define FEC_RST_PAD IMX_GPIO_NR(1, 9)
-static iomux_v3_cfg_t const fec1_rst_pads[] = {
-	IMX8MQ_PAD_GPIO1_IO09__GPIO1_IO9 | MUX_PAD_CTRL(NO_PAD_CTRL),
-};
-
-static void setup_iomux_fec(void)
-{
-	imx_iomux_v3_setup_multiple_pads(fec1_rst_pads,
-					 ARRAY_SIZE(fec1_rst_pads));
-
-	gpio_request(IMX_GPIO_NR(1, 9), "fec1_rst");
-	gpio_direction_output(IMX_GPIO_NR(1, 9), 0);
-	udelay(500);
-	gpio_direction_output(IMX_GPIO_NR(1, 9), 1);
-}
-
 static int setup_fec(void)
 {
 	struct iomuxc_gpr_base_regs *gpr =
 		(struct iomuxc_gpr_base_regs *)IOMUXC_GPR_BASE_ADDR;
 
-	setup_iomux_fec();
-
 	/* Use 125M anatop REF_CLK1 for ENET1, not from external */
 	clrsetbits_le32(&gpr->gpr[1], BIT(13) | BIT(17), 0);
 	return set_clk_enet(ENET_125MHZ);
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/1 arm: dts: imx8mq-evk: add phy-reset-gpios for fec1

Hi

Quoted 15 lines · Alifer Moraes

Let the driver reset the phy via dts description instead of doing it through functions in imx8mq_evk.c

---
 arch/arm/dts/imx8mq-evk.dts             |  2 ++
 board/freescale/imx8mq_evk/imx8mq_evk.c | 18 ------------------
 2 files changed, 2 insertions(+), 18 deletions(-)
arch/arm/dts/imx8mq-evk.dts +0 -0
index 3693933451..55294ba9c8 100644

arch/arm/dts/imx8mq-evk.dts line 108

Quoted 5 lines
arch/arm/dts/imx8mq-evk.dts +2 -0
@@ -104,6 +104,8 @@
        pinctrl-0 = <&pinctrl_fec1>;
        phy-mode = "rgmii-id";
        phy-handle = <&ethphy0>;
+       phy-reset-gpios = <&gpio1 9 GPIO_ACTIVE_LOW>;
+       phy-reset-duration = <10>;

Where is the relative pinctrl change to mux the pin? why now is 10 the reset duration

Michael

Quoted 40 lines
arch/arm/dts/imx8mq-evk.dts +0 -0
        fsl,magic-packet;
        status = "okay";
 
board/freescale/imx8mq_evk/imx8mq_evk.c +0 -19
index cb39d0f2d6..b2f464abb1 100644
@@ -64,29 +64,11 @@ int dram_init(void)
 }
 
 #ifdef CONFIG_FEC_MXC
-#define FEC_RST_PAD IMX_GPIO_NR(1, 9)
-static iomux_v3_cfg_t const fec1_rst_pads[] = {
-       IMX8MQ_PAD_GPIO1_IO09__GPIO1_IO9 | MUX_PAD_CTRL(NO_PAD_CTRL),
-};
-
-static void setup_iomux_fec(void)
-{
-       imx_iomux_v3_setup_multiple_pads(fec1_rst_pads,
-                                        ARRAY_SIZE(fec1_rst_pads));
-
-       gpio_request(IMX_GPIO_NR(1, 9), "fec1_rst");
-       gpio_direction_output(IMX_GPIO_NR(1, 9), 0);
-       udelay(500);
-       gpio_direction_output(IMX_GPIO_NR(1, 9), 1);
-}
-
 static int setup_fec(void)
 {
        struct iomuxc_gpr_base_regs *gpr =
                (struct iomuxc_gpr_base_regs *)IOMUXC_GPR_BASE_ADDR;
 
-       setup_iomux_fec();
-
        /* Use 125M anatop REF_CLK1 for ENET1, not from external */
        clrsetbits_le32(&gpr->gpr[1], BIT(13) | BIT(17), 0);
        return set_clk_enet(ENET_125MHZ);
--

2.17.1

Signature · 4 lines
| Michael Nazzareno Trimarchi                     Amarula Solutions BV |
| COO  -  Founder                                      Cruquiuskade 47 |
| +31(0)851119172                                 Amsterdam 1018 AM NL |
|                  [`as] http://www.amarulasolutions.com               |

A message that is not in the archive (sent off-list or not yet received): CA+W=15b025G3HQFMZH-N+yvgr4aYUUFH0zTw2Aq7T8+ETx3nGw@mail.gmail.com

#3 lore raw

PATCH 1/1 arm: dts: imx8mq-evk: add phy-reset-gpios for fec1

Hi

Quoted 8 lines · Alifer Moraes

Hello, Michael,

Quoted 2 lines

Where is the relative pinctrl change to mux the pin? why now is 10 the reset duration

The pinctrl change is described in arch/arm/dts/imx8mq-evk.dts in the subnode pinctrl_fec1.

Ok, so was already defined the pinmux there.

Quoted 2 lines

The ethernet phy used by this board is an atheros 8031, its datasheet says that the reset duration should be 10ms.

Please upload the commit message with this information

Michael

PS: this way to reset is deprecated but uboot I think does not have the reset at mdio bus level

Quoted 4 lines

Regards,

Alifer

Signature · 4 lines
| Michael Nazzareno Trimarchi                     Amarula Solutions BV |
| COO  -  Founder                                      Cruquiuskade 47 |
| +31(0)851119172                                 Amsterdam 1018 AM NL |
|                  [`as] http://www.amarulasolutions.com               |