diff mbox series

U-Boot atheros PHY support and cubox ethernet

Message ID CAOMZO5Ds0L4TaXOE=mp7B4UF1GJoRLSK0=Y+P+8Pq5Ca=UuLTw@mail.gmail.com
State New
Headers show
Series U-Boot atheros PHY support and cubox ethernet | expand

Commit Message

Fabio Estevam June 17, 2020, 7:09 p.m. UTC
On Wed, Jun 17, 2020 at 4:00 PM Tom Rini <trini at konsulko.com> wrote:

> +#ifdef CONFIG_FEC_MXC
> +static int setup_fec(void)
> +{
> +       struct iomuxc *const iomuxc_regs = (struct iomuxc *)IOMUXC_BASE_ADDR;
> +       struct gpio_desc desc;
> +
> +       int ret = enable_fec_anatop_clock(0, ENET_25MHZ);
> +       if (ret)
> +               return ret;
> +
> +       /* set gpr1[ENET_CLK_SEL] */
> +       setbits_le32(&iomuxc_regs->gpr[1], IOMUXC_GPR1_ENET_CLK_SEL_MASK);
> +
> +       /* Reset PHY */
> +       ret = dm_gpio_lookup_name("GPIO4_15", &desc);
> +       if (ret) {
> +               printf("%s: phy reset lookup failed\n", __func__);
> +               return ret;
> +       }
> +
> +       ret = dm_gpio_request(&desc, "phy-reset");
> +       if (ret) {
> +               printf("%s: phy reset request failed\n", __func__);
> +               return ret;
> +       }
> +
> +       gpio_direction_output(ETH_PHY_RESET, 0);
> +       mdelay(10);
> +       gpio_set_value(ETH_PHY_RESET, 1);
> +       udelay(100);

The Ethernet PHY reset can be done via device tree.

It seems we need to change it like this:


Does it still probe if you remove the PHY reset from the board code?

Comments

Fabio Estevam June 17, 2020, 7:18 p.m. UTC | #1
On Wed, Jun 17, 2020 at 4:09 PM Fabio Estevam <festevam at gmail.com> wrote:

> Does it still probe if you remove the PHY reset from the board code?

Another suggestion: please use the ar8031_phy_fixup() and
board_phy_config() from mx6sabresd into cubox board file to see if
Ethernet works.
Tom Rini June 17, 2020, 7:19 p.m. UTC | #2
On Wed, Jun 17, 2020 at 04:09:19PM -0300, Fabio Estevam wrote:
> On Wed, Jun 17, 2020 at 4:00 PM Tom Rini <trini at konsulko.com> wrote:
> 
> > +#ifdef CONFIG_FEC_MXC
> > +static int setup_fec(void)
> > +{
> > +       struct iomuxc *const iomuxc_regs = (struct iomuxc *)IOMUXC_BASE_ADDR;
> > +       struct gpio_desc desc;
> > +
> > +       int ret = enable_fec_anatop_clock(0, ENET_25MHZ);
> > +       if (ret)
> > +               return ret;
> > +
> > +       /* set gpr1[ENET_CLK_SEL] */
> > +       setbits_le32(&iomuxc_regs->gpr[1], IOMUXC_GPR1_ENET_CLK_SEL_MASK);
> > +
> > +       /* Reset PHY */
> > +       ret = dm_gpio_lookup_name("GPIO4_15", &desc);
> > +       if (ret) {
> > +               printf("%s: phy reset lookup failed\n", __func__);
> > +               return ret;
> > +       }
> > +
> > +       ret = dm_gpio_request(&desc, "phy-reset");
> > +       if (ret) {
> > +               printf("%s: phy reset request failed\n", __func__);
> > +               return ret;
> > +       }
> > +
> > +       gpio_direction_output(ETH_PHY_RESET, 0);
> > +       mdelay(10);
> > +       gpio_set_value(ETH_PHY_RESET, 1);
> > +       udelay(100);
> 
> The Ethernet PHY reset can be done via device tree.
> 
> It seems we need to change it like this:
> 
> --- a/arch/arm/dts/imx6qdl-sr-som.dtsi
> +++ b/arch/arm/dts/imx6qdl-sr-som.dtsi
> @@ -54,7 +54,8 @@
>         pinctrl-names = "default";
>         pinctrl-0 = <&pinctrl_microsom_enet_ar8035>;
>         phy-mode = "rgmii-id";
> -       phy-reset-duration = <2>;
> +       phy-reset-duration = <10>;
> +       phy-reset-post-delay = <1>;
>         phy-reset-gpios = <&gpio4 15 GPIO_ACTIVE_LOW>;
>         status = "okay";
>  };
> 
> Does it still probe if you remove the PHY reset from the board code?

Nope, same "Could not get PHY for FEC0: addr 0".  I gather from another
part of this thread there's some further breakage / unexpected changes,
so I'll chime in there next.
Tom Rini June 17, 2020, 7:24 p.m. UTC | #3
On Wed, Jun 17, 2020 at 04:18:27PM -0300, Fabio Estevam wrote:
> On Wed, Jun 17, 2020 at 4:09 PM Fabio Estevam <festevam at gmail.com> wrote:
> 
> > Does it still probe if you remove the PHY reset from the board code?
> 
> Another suggestion: please use the ar8031_phy_fixup() and
> board_phy_config() from mx6sabresd into cubox board file to see if
> Ethernet works.

Literal copy and paste and same failure.
diff mbox series

Patch

--- a/arch/arm/dts/imx6qdl-sr-som.dtsi
+++ b/arch/arm/dts/imx6qdl-sr-som.dtsi
@@ -54,7 +54,8 @@ 
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_microsom_enet_ar8035>;
        phy-mode = "rgmii-id";
-       phy-reset-duration = <2>;
+       phy-reset-duration = <10>;
+       phy-reset-post-delay = <1>;
        phy-reset-gpios = <&gpio4 15 GPIO_ACTIVE_LOW>;
        status = "okay";
 };