From patchwork Tue Jan 12 10:18:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Purna Chandra Mandal X-Patchwork-Id: 566462 X-Patchwork-Delegate: daniel.schwierzeck@googlemail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id CD96D1402C4 for ; Tue, 12 Jan 2016 21:23:21 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id E6AB7A74DE; Tue, 12 Jan 2016 11:21:43 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3q67EaMA6R3e; Tue, 12 Jan 2016 11:21:43 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 844EAA74E3; Tue, 12 Jan 2016 11:21:29 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B87134BFA6 for ; Tue, 12 Jan 2016 11:21:20 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bK1BsMBMRx8w for ; Tue, 12 Jan 2016 11:21:20 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from email.microchip.com (exsmtp01.microchip.com [198.175.253.37]) by theia.denx.de (Postfix) with ESMTPS id 068434BFD8 for ; Tue, 12 Jan 2016 11:20:58 +0100 (CET) Received: from mx.microchip.com (10.10.76.4) by CHN-SV-EXCH01.mchp-main.com (10.10.76.37) with Microsoft SMTP Server id 14.3.181.6; Tue, 12 Jan 2016 03:20:55 -0700 Received: by mx.microchip.com (sSMTP sendmail emulation); Tue, 12 Jan 2016 15:49:44 +0530 From: Purna Chandra Mandal To: Date: Tue, 12 Jan 2016 15:48:29 +0530 Message-ID: <1452593909-16184-15-git-send-email-purna.mandal@microchip.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1452593909-16184-1-git-send-email-purna.mandal@microchip.com> References: <1452593909-16184-1-git-send-email-purna.mandal@microchip.com> MIME-Version: 1.0 Cc: Purna Chandra Mandal Subject: [U-Boot] [PATCH v3 14/14] board: Enable ethernet, tftpboot support to pic32mzdask board. X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 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" This adds ethernet, TFTP support for PIC32MZ[DA] Starter Kit. Also custom environment variables/scripts are added to help boot from network. Signed-off-by: Purna Chandra Mandal Reviewed-by: Tom Rini --- Changes in v3: None Changes in v2: - replace unbounded loop with wait_for_bit() - replace register access as readl/writel(base + offset) - translate (dts provided) physical address to MIPS kseg1 address before use arch/mips/dts/pic32mzda.dtsi | 10 ++++++++++ arch/mips/dts/pic32mzda_sk.dts | 10 ++++++++++ configs/pic32mzdask_defconfig | 26 +++++++++++++++++--------- include/configs/pic32mzdask.h | 27 +++++++++++++++++++++++++-- 4 files changed, 62 insertions(+), 11 deletions(-) diff --git a/arch/mips/dts/pic32mzda.dtsi b/arch/mips/dts/pic32mzda.dtsi index 3d62a17..57612bc 100644 --- a/arch/mips/dts/pic32mzda.dtsi +++ b/arch/mips/dts/pic32mzda.dtsi @@ -161,4 +161,14 @@ bus-width = <4>; status = "disabled"; }; + + ethernet: ethernet@1f882000 { + compatible = "microchip,pic32mzda-eth"; + reg = <0x1f882000 0x1000>; + interrupts = <153 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&clock PB5CLK>; + status = "disabled"; + #address-cells = <1>; + #size-cells = <0>; + }; }; diff --git a/arch/mips/dts/pic32mzda_sk.dts b/arch/mips/dts/pic32mzda_sk.dts index f886a0f..e5ce0bd 100644 --- a/arch/mips/dts/pic32mzda_sk.dts +++ b/arch/mips/dts/pic32mzda_sk.dts @@ -42,4 +42,14 @@ &sdhci { status = "okay"; +}; + +ðernet { + reset-gpios = <&gpioJ 15 0>; + status = "okay"; + phy-mode = "rmii"; + phy-handle = <ðernet_phy>; + ethernet_phy: lan8740_phy@0 { + reg = <0>; + }; }; \ No newline at end of file diff --git a/configs/pic32mzdask_defconfig b/configs/pic32mzdask_defconfig index 6981cf7..5e78e14 100644 --- a/configs/pic32mzdask_defconfig +++ b/configs/pic32mzdask_defconfig @@ -165,13 +165,13 @@ CONFIG_CMD_SETEXPR=y # # Network commands # -# CONFIG_CMD_NET is not set +CONFIG_CMD_NET=y # CONFIG_CMD_TFTPPUT is not set # CONFIG_CMD_TFTPSRV is not set -# CONFIG_CMD_RARP is not set -# CONFIG_CMD_DHCP is not set -# CONFIG_CMD_NFS is not set -# CONFIG_CMD_PING is not set +CONFIG_CMD_RARP=y +CONFIG_CMD_DHCP=y +CONFIG_CMD_NFS=y +CONFIG_CMD_PING=y # CONFIG_CMD_CDP is not set # CONFIG_CMD_SNTP is not set # CONFIG_CMD_DNS is not set @@ -208,7 +208,10 @@ CONFIG_SUPPORT_OF_CONTROL=y CONFIG_OF_CONTROL=y # CONFIG_OF_SEPARATE is not set CONFIG_OF_EMBED=y -# CONFIG_NET is not set +CONFIG_NET=y +CONFIG_NET_RANDOM_ETHADDR=y +# CONFIG_NETCONSOLE is not set +CONFIG_NET_TFTP_VARS=y # # Device Drivers @@ -308,8 +311,13 @@ CONFIG_PIC32_SDHCI=y # SPI Flash Support # # CONFIG_SPI_FLASH is not set -# CONFIG_DM_ETH is not set -# CONFIG_PHYLIB is not set +CONFIG_DM_ETH=y +CONFIG_PHYLIB=y +CONFIG_NETDEVICES=y +# CONFIG_ALTERA_TSE is not set +# CONFIG_E1000 is not set +# CONFIG_ETH_DESIGNWARE is not set +CONFIG_PIC32_ETH=y # # PCI @@ -398,7 +406,7 @@ CONFIG_SYS_HZ=1000 CONFIG_SYS_VSNPRINTF=y CONFIG_USE_TINY_PRINTF=y CONFIG_REGEX=y -# CONFIG_LIB_RAND is not set +CONFIG_LIB_RAND=y CONFIG_CMD_DHRYSTONE=y # CONFIG_RSA is not set # CONFIG_TPM is not set diff --git a/include/configs/pic32mzdask.h b/include/configs/pic32mzdask.h index 224b21c..7339f0f 100644 --- a/include/configs/pic32mzdask.h +++ b/include/configs/pic32mzdask.h @@ -73,6 +73,25 @@ (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16) #define CONFIG_CMDLINE_EDITING 1 +/*----------------------------------------------------------------------- + * Networking Configuration + */ +#define CONFIG_MII +#define CONFIG_PHY_SMSC +#define CONFIG_SYS_RX_ETH_BUFFER 8 +#define CONFIG_NET_RETRY_COUNT 20 +#define CONFIG_ARP_TIMEOUT 500 /* millisec */ + +#define CONFIG_CMD_MII + +/* + * BOOTP options + */ +#define CONFIG_BOOTP_BOOTFILESIZE +#define CONFIG_BOOTP_BOOTPATH +#define CONFIG_BOOTP_GATEWAY +#define CONFIG_BOOTP_HOSTNAME + /* * Handover flattened device tree (dtb file) to Linux kernel */ @@ -127,12 +146,16 @@ "importbootenv= " \ "env import -t -r ${uenvaddr} ${filesize};\0" \ \ + "tftploadenv=tftp ${uenvaddr} ${uenvfile} \0" \ + "tftploadscr=tftp ${uenvaddr} ${scriptfile} \0" \ + "tftploadub=tftp ${loadaddr} ${ubootfile} \0" \ + \ "mmcloadenv=fatload mmc 0 ${uenvaddr} ${uenvfile}\0" \ "mmcloadscr=fatload mmc 0 ${uenvaddr} ${scriptfile}\0" \ "mmcloadub=fatload mmc 0 ${loadaddr} ${ubootfile}\0" \ \ - "loadbootenv=run mmcloadenv\0" \ - "loadbootscr=run mmcloadscr\0" \ + "loadbootenv=run mmcloadenv || run tftploadenv\0" \ + "loadbootscr=run mmcloadscr || run tftploadscr\0" \ "bootcmd_root= " \ "if run loadbootenv; then " \ "echo Loaded environment ${uenvfile}; " \