From: Stefan Roese Date: Fri, 30 Nov 2018 08:44:24 +0100 Subject: [U-Boot] [PATCH v2 6/6] arm: mvebu: helios4: Reset uSOM onboard phy during board init In-Reply-To: <1543546499-106725-7-git-send-email-aditya@kobol.io> References: <1543546499-106725-1-git-send-email-aditya@kobol.io> <1543546499-106725-7-git-send-email-aditya@kobol.io> Message-ID: <26c7ad39-601d-105c-7cc1-9bb653bb7005@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 30.11.18 03:54, Aditya Prayoga wrote: > Similar to Clearfog rev 2.1, GPIO 19 also used to reset onboard ethernet > PHY. > > Signed-off-by: Aditya Prayoga > --- > v2: > * Use generic gpio_* API (Baruch Siach) > --- > board/kobol/helios4/helios4.c | 31 +++++++++++++++++++++++++++++++ > 1 file changed, 31 insertions(+) > > diff --git a/board/kobol/helios4/helios4.c b/board/kobol/helios4/helios4.c > index 37c46a5..e535d7b 100644 > --- a/board/kobol/helios4/helios4.c > +++ b/board/kobol/helios4/helios4.c > @@ -8,6 +8,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -111,9 +112,39 @@ int board_early_init_f(void) > > int board_init(void) > { > + struct udevice *gpio0; > + struct gpio_desc phy_reset; > + int ret; > + > /* Address of boot parameters */ > gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100; > > + ret = uclass_get_device_by_name(UCLASS_GPIO, > + "gpio at 18100", > + &gpio0); > + if (ret < 0) { > + printf("Failed to find gpio at 18100 node.\n"); > + return ret; > + } > + > + phy_reset.dev = gpio0; > + > + /* MPP19 controls the uSOM onboard phy reset */ > + phy_reset.offset = 19; > + > + ret = dm_gpio_request(&phy_reset, "phy-reset"); > + if (ret) > + return ret; > + > + dm_gpio_set_dir_flags(&phy_reset, > + GPIOD_IS_OUT | > + GPIOD_ACTIVE_LOW | > + GPIOD_IS_OUT_ACTIVE); > + > + mdelay(10); > + dm_gpio_set_value(&phy_reset, 0); > + mdelay(10); > + Hmm, this is a pretty complex and unusual way to use the GPIO. Please use the DT to describe the PHY reset GPIO instead. And since it seems to be a common issue to have such a PHY reset GPIO, it would be better to integrate this into the ethernet driver instead. Here an example from the mvpp2 driver: https://patchwork.ozlabs.org/patch/799654/ Could you try to integrate something similar into the mvneta driver? Thanks, Stefan