From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9CCE1C433F5 for ; Mon, 2 May 2022 06:49:13 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4D8C783F28; Mon, 2 May 2022 08:49:06 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1651474146; bh=1yaUXAmy8t0vlPuqNDuvRf00fGdLe0KJiey3gMJQfpY=; h=Date:Subject:To:Cc:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=rvPkoDok/GPKaipa6NX0KFCsPqRE4igkQjOCLEEc4lZKieqLDigE49B0jMAWkGjzc QXyigGM4YR1pvqY8TkP8T8SWg4PcRGI2gBr3VCe8EHRXiW7IQIib8KLwy+LMVKs3tC 51Mn84oAALAs3dkV9+cgcn0bQQSWueINc7eDY+7bCTP0eTRZoKhCSXR8GYpO/mpgsp ZnqZYfa14Qbx1CqNrFzhVkE/ycJ4xEvU+Ae7kKu3ktEeOX28GbEBi6WqILNe4fR3oT Oo/TpLnVdIr32a6fQeC/k9aAabzptwb2BwwnJj4oIMykxn1TKBrNh0Y3UG2Aej0j3B gxfoj++V/PiQA== Received: by phobos.denx.de (Postfix, from userid 109) id CF73C83F28; Mon, 2 May 2022 08:49:01 +0200 (CEST) Received: from mout-u-107.mailbox.org (mout-u-107.mailbox.org [91.198.250.252]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 27D7983F18 for ; Mon, 2 May 2022 08:48:59 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=sr@denx.de Received: from smtp1.mailbox.org (smtp1.mailbox.org [80.241.60.240]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-u-107.mailbox.org (Postfix) with ESMTPS id 4KsDG25LJLz9sVw; Mon, 2 May 2022 08:48:58 +0200 (CEST) Message-ID: <84cc39a4-32d5-76aa-e8f4-32acbec4a5d0@denx.de> Date: Mon, 2 May 2022 08:48:54 +0200 MIME-Version: 1.0 Subject: Re: [PATCH u-boot-marvell 05/19] arm: mvebu: Espressobin: Use DM registered MDIO to configure switch Content-Language: en-US To: =?UTF-8?Q?Marek_Beh=c3=ban?= Cc: Robert Marko , =?UTF-8?Q?Pali_Roh=c3=a1r?= , U-Boot-Denx , Ramon Fried , Joe Hershberger , =?UTF-8?Q?Marek_Beh=c3=ban?= , Konstantin Porotchkin , Rogier Stam , Mark Kettenis References: <20220427104202.1205-1-kabel@kernel.org> <20220427104202.1205-6-kabel@kernel.org> From: Stefan Roese In-Reply-To: <20220427104202.1205-6-kabel@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean On 27.04.22 12:41, Marek Behún wrote: > From: Marek Behún > > In order to be able to get rid of the non-DM MDIO bus registered in > mvneta driver, we need to stop using board_network_enable() and instead > use the DM registered MDIO device to configure switch in > last_stage_init(). > > Signed-off-by: Marek Behún Reviewed-by: Stefan Roese Thanks, Stefan > --- > board/Marvell/mvebu_armada-37xx/board.c | 26 ++++++++++++++++----- > configs/mvebu_espressobin-88f3720_defconfig | 1 + > 2 files changed, 21 insertions(+), 6 deletions(-) > > diff --git a/board/Marvell/mvebu_armada-37xx/board.c b/board/Marvell/mvebu_armada-37xx/board.c > index 98e1b36d11..3e5e0a0b5c 100644 > --- a/board/Marvell/mvebu_armada-37xx/board.c > +++ b/board/Marvell/mvebu_armada-37xx/board.c > @@ -11,6 +11,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -254,14 +255,15 @@ int board_xhci_enable(fdt_addr_t base) > return 0; > } > > +#ifdef CONFIG_LAST_STAGE_INIT > /* Helper function for accessing switch devices in multi-chip connection mode */ > -static int mii_multi_chip_mode_write(struct mii_dev *bus, int dev_smi_addr, > +static int mii_multi_chip_mode_write(struct udevice *bus, int dev_smi_addr, > int smi_addr, int reg, u16 value) > { > u16 smi_cmd = 0; > > - if (bus->write(bus, dev_smi_addr, 0, > - MVEBU_SW_SMI_DATA_REG, value) != 0) { > + if (dm_mdio_write(bus, dev_smi_addr, MDIO_DEVAD_NONE, > + MVEBU_SW_SMI_DATA_REG, value) != 0) { > printf("Error writing to the PHY addr=%02x reg=%02x\n", > smi_addr, reg); > return -EFAULT; > @@ -272,8 +274,8 @@ static int mii_multi_chip_mode_write(struct mii_dev *bus, int dev_smi_addr, > (1 << SW_SMI_CMD_SMI_OP_OFF) | > (smi_addr << SW_SMI_CMD_DEV_ADDR_OFF) | > (reg << SW_SMI_CMD_REG_ADDR_OFF); > - if (bus->write(bus, dev_smi_addr, 0, > - MVEBU_SW_SMI_CMD_REG, smi_cmd) != 0) { > + if (dm_mdio_write(bus, dev_smi_addr, MDIO_DEVAD_NONE, > + MVEBU_SW_SMI_CMD_REG, smi_cmd) != 0) { > printf("Error writing to the PHY addr=%02x reg=%02x\n", > smi_addr, reg); > return -EFAULT; > @@ -283,11 +285,22 @@ static int mii_multi_chip_mode_write(struct mii_dev *bus, int dev_smi_addr, > } > > /* Bring-up board-specific network stuff */ > -int board_network_enable(struct mii_dev *bus) > +int last_stage_init(void) > { > + struct udevice *bus; > + ofnode node; > + > if (!of_machine_is_compatible("globalscale,espressobin")) > return 0; > > + node = ofnode_by_compatible(ofnode_null(), "marvell,orion-mdio"); > + if (!ofnode_valid(node) || > + uclass_get_device_by_ofnode(UCLASS_MDIO, node, &bus) || > + device_probe(bus)) { > + printf("Cannot find MDIO bus\n"); > + return 0; > + } > + > /* > * FIXME: remove this code once Topaz driver gets available > * A3720 Community Board Only > @@ -327,6 +340,7 @@ int board_network_enable(struct mii_dev *bus) > > return 0; > } > +#endif > > #ifdef CONFIG_OF_BOARD_SETUP > int ft_board_setup(void *blob, struct bd_info *bd) > diff --git a/configs/mvebu_espressobin-88f3720_defconfig b/configs/mvebu_espressobin-88f3720_defconfig > index af30f1b363..37e4fdc41e 100644 > --- a/configs/mvebu_espressobin-88f3720_defconfig > +++ b/configs/mvebu_espressobin-88f3720_defconfig > @@ -25,6 +25,7 @@ CONFIG_DISPLAY_BOARDINFO_LATE=y > CONFIG_ARCH_EARLY_INIT_R=y > CONFIG_BOARD_EARLY_INIT_F=y > CONFIG_BOARD_LATE_INIT=y > +CONFIG_LAST_STAGE_INIT=y > # CONFIG_CMD_FLASH is not set > CONFIG_CMD_FUSE=y > CONFIG_CMD_GPIO=y Viele Grüße, Stefan Roese -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de