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 56B46C433F5 for ; Wed, 9 Feb 2022 02:56:42 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8E29483D9B; Wed, 9 Feb 2022 03:56:39 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com 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=gmail.com header.i=@gmail.com header.b="paYT7hc0"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1E9AC83DA6; Wed, 9 Feb 2022 03:56:38 +0100 (CET) Received: from mail-qk1-x729.google.com (mail-qk1-x729.google.com [IPv6:2607:f8b0:4864:20::729]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id D91C183D81 for ; Wed, 9 Feb 2022 03:56:33 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=mibodhi@gmail.com Received: by mail-qk1-x729.google.com with SMTP id bs32so651089qkb.1 for ; Tue, 08 Feb 2022 18:56:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=kfQPSeaJmzkzj/V9DPV+Zn9h3NN66l+ajOy7RYaUcJY=; b=paYT7hc08sjwd67TvNgWBgbEx0HQimaJIdVHYz9H4OuZQAmQJRoeIN+Futcha/POMj QEpB8nNehpPdtdUe9j3gmXnn2nPwDq29qdNWQ6LriUdzAY9xAkcxI4I7TORA5157ezi7 VrDpLfY9IUxpCFvOtTQ9g3Aj9Z6i2CwN0cNeMJm7oUgO6iD/OIh400v7Rs+Xu8L0ElxZ FOZT4ppoqM5vMHh5pIkmuVGx97i684K7qilb2DQrSqKd3Ju3hsKILLxwmshFAKjUoVWs EO2GqGTr/od+o5k3UZ8PaXVvbvTCJmRHR2lAqFiszjV1Oxn4qQV08YdYcSppibWpWbV9 sfIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=kfQPSeaJmzkzj/V9DPV+Zn9h3NN66l+ajOy7RYaUcJY=; b=wrsPUHJnYQWudzvBf3ImmkFFOSKuXq6QdLvUG81Hrvbbu4NvRufgo3O8lti8FvxoH0 Dm3aWhSPEvYri9UzkHRvW+S3IWAFGjqT1x0eOc33zBWP7XbYMrUOUJgPRCUuC90GeW6a 1cDWJhqS5CXSF5v0Tgy/RVQt3/BP0Qj5hQxKIXvz/A2caAm7yuOkh003Qvv2+EyrppMA DpQyRg5hMxgGMI6vFuEZrXVEh95maidmNKQYlS7aq3hKoiYA6Jf17leBvDNBoGTSWVz9 39Vu1+TcL8Oh5N5uKWAuSF9geJ4lmYI1v59KY1u6RBr03zZiWN3PoGMwHPtwMHWQ+l9s SHyQ== X-Gm-Message-State: AOAM533kxC43GjwF4/PBsUNkUGiZnUd+Ck7EIL4xBQLux/gQAcgT/s4i VbcwpkWZ6bIzUIBHse7LCbNzHPMVT6c= X-Google-Smtp-Source: ABdhPJxqIQksIotuKbIPXr46E0pZIH9a+UbmLYt7AMapxrXE4U/CipwNHqiymzy+FDisWWdSpFpi2A== X-Received: by 2002:a05:620a:4411:: with SMTP id v17mr110102qkp.163.1644375392511; Tue, 08 Feb 2022 18:56:32 -0800 (PST) Received: from localhost.localdomain (76-229-100-169.lightspeed.irvnca.sbcglobal.net. [76.229.100.169]) by smtp.gmail.com with ESMTPSA id e17sm8423385qte.94.2022.02.08.18.56.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Feb 2022 18:56:32 -0800 (PST) From: Tony Dinh To: U-Boot Mailing List , Stefan Roese Cc: Tom Rini , David Purdy , Tony Dinh Subject: [PATCH] arm: kirkwood: Pogoplug E02 : Convert Ethernet to Driver Model Date: Tue, 8 Feb 2022 18:56:22 -0800 Message-Id: <20220209025623.30988-1-mibodhi@gmail.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 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 The Pogoplug E02 board has the network chip Marvell 88E1116R. Convert to Driver Model and use uclass mvgbe and the compatible driver M88E1118R to bring up Ethernet. - Add board_eth_init(), CONFIG_DM_ETH, and CONFIG_PHY_MARVELL to bring up Ethernet. - Currently, CONFIG_RESET_PHY_R symbol is used in arch/arm/mach-kirkwood/include/mach/config.h for all Kirkwood boards with mv8831116 PHY, with each board defines the function reset_phy(). Undefine it for this board. - As the result of the migration to Driver Model, this u-boot image has grown substantially (about 100K, give or take). The old envs location at 0x60000 (384k) is no longer possible. Move it to 0xC0000 (768K). - Miscellaneous changes: Move constants to .c file and remove header file board/cloudengines/pogo_e02/pogo_e02.h, use CONFIG_SYS_THUMB_BUILD to keep u-boot image under 512K, use BIT macro, and cleanup comments. Signed-off-by: Tony Dinh --- board/cloudengines/pogo_e02/pogo_e02.c | 51 +++++++------------------- board/cloudengines/pogo_e02/pogo_e02.h | 29 --------------- configs/pogo_e02_defconfig | 6 ++- include/configs/pogo_e02.h | 13 ++----- 4 files changed, 22 insertions(+), 77 deletions(-) delete mode 100644 board/cloudengines/pogo_e02/pogo_e02.h diff --git a/board/cloudengines/pogo_e02/pogo_e02.c b/board/cloudengines/pogo_e02/pogo_e02.c index 039fd6e3dd..59e1218b41 100644 --- a/board/cloudengines/pogo_e02/pogo_e02.c +++ b/board/cloudengines/pogo_e02/pogo_e02.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: GPL-2.0+ /* + * Copyright (C) 2022 Tony Dinh * Copyright (C) 2012 * David Purdy * @@ -12,16 +13,21 @@ #include #include #include -#include -#include +#include #include #include #include #include -#include "pogo_e02.h" +#include DECLARE_GLOBAL_DATA_PTR; +/* GPIO configuration */ +#define POGO_E02_OE_LOW (~(0)) +#define POGO_E02_OE_HIGH (~(0)) +#define POGO_E02_OE_VAL_LOW BIT(29) +#define POGO_E02_OE_VAL_HIGH 0 + int board_early_init_f(void) { /* @@ -64,6 +70,11 @@ int board_early_init_f(void) return 0; } +int board_eth_init(struct bd_info *bis) +{ + return cpu_eth_init(bis); +} + int board_init(void) { /* Boot parameters address */ @@ -71,37 +82,3 @@ int board_init(void) return 0; } - -#ifdef CONFIG_RESET_PHY_R -/* Configure and initialize PHY */ -void reset_phy(void) -{ - u16 reg; - u16 devadr; - char *name = "egiga0"; - - if (miiphy_set_current_dev(name)) - return; - - /* command to read PHY dev address */ - if (miiphy_read(name, 0xEE, 0xEE, (u16 *) &devadr)) { - printf("Err..(%s) could not read PHY dev address\n", __func__); - return; - } - - /* - * Enable RGMII delay on Tx and Rx for CPU port - * Ref: sec 4.7.2 of chip datasheet - */ - miiphy_write(name, devadr, MV88E1116_PGADR_REG, 2); - miiphy_read(name, devadr, MV88E1116_MAC_CTRL_REG, ®); - reg |= (MV88E1116_RGMII_RXTM_CTRL | MV88E1116_RGMII_TXTM_CTRL); - miiphy_write(name, devadr, MV88E1116_MAC_CTRL_REG, reg); - miiphy_write(name, devadr, MV88E1116_PGADR_REG, 0); - - /* reset the phy */ - miiphy_reset(name, devadr); - - debug("88E1116 Initialized on %s\n", name); -} -#endif /* CONFIG_RESET_PHY_R */ diff --git a/board/cloudengines/pogo_e02/pogo_e02.h b/board/cloudengines/pogo_e02/pogo_e02.h deleted file mode 100644 index c8397b4d4f..0000000000 --- a/board/cloudengines/pogo_e02/pogo_e02.h +++ /dev/null @@ -1,29 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ */ -/* - * Copyright (C) 2012 - * David Purdy - * - * Based on Kirkwood support: - * (C) Copyright 2009 - * Marvell Semiconductor - * Written-by: Prafulla Wadaskar - */ - -#ifndef __POGO_E02_H -#define __POGO_E02_H - -/* GPIO configuration */ -#define POGO_E02_OE_LOW (~(0)) -#define POGO_E02_OE_HIGH (~(0)) -#define POGO_E02_OE_VAL_LOW (1 << 29) -#define POGO_E02_OE_VAL_HIGH 0 - -/* PHY related */ -#define MV88E1116_LED_FCTRL_REG 10 -#define MV88E1116_CPRSP_CR3_REG 21 -#define MV88E1116_MAC_CTRL_REG 21 -#define MV88E1116_PGADR_REG 22 -#define MV88E1116_RGMII_TXTM_CTRL (1 << 4) -#define MV88E1116_RGMII_RXTM_CTRL (1 << 5) - -#endif /* __POGO_E02_H */ diff --git a/configs/pogo_e02_defconfig b/configs/pogo_e02_defconfig index 10f08a515d..7853cc7b24 100644 --- a/configs/pogo_e02_defconfig +++ b/configs/pogo_e02_defconfig @@ -2,13 +2,14 @@ CONFIG_ARM=y CONFIG_SKIP_LOWLEVEL_INIT=y CONFIG_SYS_DCACHE_OFF=y CONFIG_ARCH_CPU_INIT=y +CONFIG_SYS_THUMB_BUILD=y CONFIG_ARCH_KIRKWOOD=y CONFIG_SYS_KWD_CONFIG="board/cloudengines/pogo_e02/kwbimage.cfg" CONFIG_SYS_TEXT_BASE=0x600000 CONFIG_NR_DRAM_BANKS=2 CONFIG_TARGET_POGO_E02=y CONFIG_ENV_SIZE=0x20000 -CONFIG_ENV_OFFSET=0x60000 +CONFIG_ENV_OFFSET=0xC0000 CONFIG_DEFAULT_DEVICE_TREE="kirkwood-pogo_e02" CONFIG_IDENT_STRING="\nPogo E02" # CONFIG_SYS_MALLOC_F is not set @@ -36,11 +37,14 @@ CONFIG_OF_CONTROL=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_NAND=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_NET_RANDOM_ETHADDR=y CONFIG_NETCONSOLE=y CONFIG_DM=y # CONFIG_MMC is not set CONFIG_MTD=y CONFIG_MTD_RAW_NAND=y +CONFIG_PHY_MARVELL=y +CONFIG_DM_ETH=y CONFIG_MVGBE=y CONFIG_MII=y CONFIG_SYS_NS16550=y diff --git a/include/configs/pogo_e02.h b/include/configs/pogo_e02.h index 3e94125cb3..51c802f2b3 100644 --- a/include/configs/pogo_e02.h +++ b/include/configs/pogo_e02.h @@ -14,10 +14,6 @@ #include "mv-common.h" -/* - * Environment variables configurations - */ - /* * Default environment variables */ @@ -33,13 +29,10 @@ /* * Ethernet Driver configuration */ -#ifdef CONFIG_CMD_NET #define CONFIG_MVGBE_PORTS {1, 0} /* enable port 0 only */ #define CONFIG_PHY_BASE_ADR 0 -#endif /* CONFIG_CMD_NET */ - -/* - * File system - */ +#ifdef CONFIG_RESET_PHY_R +#undef CONFIG_RESET_PHY_R /* remove legacy reset_phy() */ +#endif #endif /* _CONFIG_POGO_E02_H */ -- 2.30.2