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 C00C9C433F5 for ; Wed, 27 Apr 2022 10:43:28 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 42EA983EE5; Wed, 27 Apr 2022 12:42:53 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="iR0rk6a4"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DF99083E7F; Wed, 27 Apr 2022 12:42:34 +0200 (CEST) Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 6CD1B83EA1 for ; Wed, 27 Apr 2022 12:42:22 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=kabel@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 188BEB82576; Wed, 27 Apr 2022 10:42:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A31EFC385A9; Wed, 27 Apr 2022 10:42:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1651056140; bh=JT4zxmxpsc29np22VEQgDP0zmKIVwGjBeZADIdo6+3U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iR0rk6a4zSExydjD74tnhFhL6+IYmDjmpHKay68cmXR7NneRhlHKfO+OekMEuWBwf oBT87BnNVngntVg4Ghgg1Cy+SdS8mDdaETWCXssZVIq+wpzANvNEpcJH5iW2XNcAWZ u6/LTqRUeNL8VOwanzxSFRB53JHuahkyZ5SamM+077xOC+uCfhyFi08QR60WhG8S8W G4a2hExeQJLVVDfa3+PJt4eOQ5nhWGzFebNrjPiYbfUnIbcLSaRWlpuAVyF1F8HyGt yO7liUW/Gvys+Y3qpJ+mi4tOI+AN7zvf+wCTvCEfpjyQO5z5xB6c0gNEuFIZTwffpr +ToBrltJ23bHw== From: =?UTF-8?q?Marek=20Beh=C3=BAn?= To: Stefan Roese Cc: Robert Marko , =?UTF-8?q?Pali=20Roh=C3=A1r?= , U-Boot-Denx , Ramon Fried , Joe Hershberger , =?UTF-8?q?Marek=20Beh=C3=BAn?= , Konstantin Porotchkin , Rogier Stam , Mark Kettenis Subject: [PATCH u-boot-marvell 05/19] arm: mvebu: Espressobin: Use DM registered MDIO to configure switch Date: Wed, 27 Apr 2022 12:41:48 +0200 Message-Id: <20220427104202.1205-6-kabel@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220427104202.1205-1-kabel@kernel.org> References: <20220427104202.1205-1-kabel@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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 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 --- 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 -- 2.35.1