From patchwork Mon Jan 4 14:02:45 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: 562403 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 904FB1402D8 for ; Tue, 5 Jan 2016 01:05:11 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 71B194B86C; Mon, 4 Jan 2016 15:04:04 +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 9Dv9zxlHDQkJ; Mon, 4 Jan 2016 15:04:04 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 1E6714B829; Mon, 4 Jan 2016 15:04:04 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 264694B7CC for ; Mon, 4 Jan 2016 15:04:00 +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 lvfhcWRAvKe6 for ; Mon, 4 Jan 2016 15:04:00 +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 (exsmtp03.microchip.com [198.175.253.49]) by theia.denx.de (Postfix) with ESMTPS id 685CC4B855 for ; Mon, 4 Jan 2016 15:03:54 +0100 (CET) Received: from centos7pc (10.10.76.4) by chn-sv-exch03.mchp-main.com (10.10.76.49) with Microsoft SMTP Server id 14.3.181.6; Mon, 4 Jan 2016 07:03:52 -0700 Message-ID: <1451916165.27601.132.camel@microchip.com> From: Purna Chandra Mandal To: Date: Mon, 4 Jan 2016 19:32:45 +0530 Organization: Microchip India Technology Pvt Ltd X-Mailer: Evolution 3.12.11 (3.12.11-15.el7) MIME-Version: 1.0 Cc: purna.mandal@microchip.com Subject: [U-Boot] [PATCH v2 13/13] board: Add gpio and ethernet 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" Signed-off-by: Purna Chandra Mandal --- 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 | 93 ++++++++++++++++++++++++++++++++++++++++++ arch/mips/dts/pic32mzda_sk.dts | 5 +++ configs/pic32mzdask_defconfig | 11 ++++- include/configs/pic32mzdask.h | 30 +++++++++++++- 4 files changed, 136 insertions(+), 3 deletions(-) diff --git a/arch/mips/dts/pic32mzda.dtsi b/arch/mips/dts/pic32mzda.dtsi index bdddb93..a354037 100644 --- a/arch/mips/dts/pic32mzda.dtsi +++ b/arch/mips/dts/pic32mzda.dtsi @@ -5,6 +5,7 @@ * SPDX-License-Identifier: GPL-2.0+ */ +#include #include #include #include "skeleton.dtsi" @@ -12,6 +13,19 @@ / { compatible = "microchip,pic32mzda", "microchip,pic32mz"; + aliases { + gpio0 = &gpioA; + gpio1 = &gpioB; + gpio2 = &gpioC; + gpio3 = &gpioD; + gpio4 = &gpioE; + gpio5 = &gpioF; + gpio6 = &gpioG; + gpio7 = &gpioH; + gpio8 = &gpioJ; + gpio9 = &gpioK; + }; + cpus { cpu@0 { compatible = "mips,mips14kc"; @@ -62,6 +76,76 @@ status = "disabled"; }; + gpioA: gpio0@1f860000 { + compatible = "microchip,pic32mzda-gpio"; + reg = <0x1f860000 0x24>; + gpio-controller; + #gpio-cells = <2>; + }; + + gpioB: gpio1@1f860100 { + compatible = "microchip,pic32mzda-gpio"; + reg = <0x1f860100 0x24>; + gpio-controller; + #gpio-cells = <2>; + }; + + gpioC: gpio2@1f860200 { + compatible = "microchip,pic32mzda-gpio"; + reg = <0x1f860200 0x24>; + gpio-controller; + #gpio-cells = <2>; + }; + + gpioD: gpio3@1f860300 { + compatible = "microchip,pic32mzda-gpio"; + reg = <0x1f860300 0x24>; + gpio-controller; + #gpio-cells = <2>; + }; + + gpioE: gpio4@1f860400 { + compatible = "microchip,pic32mzda-gpio"; + reg = <0x1f860400 0x24>; + gpio-controller; + #gpio-cells = <2>; + }; + + gpioF: gpio5@1f860500 { + compatible = "microchip,pic32mzda-gpio"; + reg = <0x1f860500 0x24>; + gpio-controller; + #gpio-cells = <2>; + }; + + gpioG: gpio6@1f860600 { + compatible = "microchip,pic32mzda-gpio"; + reg = <0x1f860600 0x24>; + gpio-controller; + #gpio-cells = <2>; + }; + + gpioH: gpio7@1f860700 { + compatible = "microchip,pic32mzda-gpio"; + reg = <0x1f860700 0x24>; + gpio-controller; + #gpio-cells = <2>; + }; + + gpioJ: gpio8@1f860800 { + compatible = "microchip,pic32mzda-gpio"; + reg = <0x1f860800 0x24>; + gpio-controller; + #gpio-cells = <2>; + }; + + gpioK: gpio9@1f860900 { + compatible = "microchip,pic32mzda-gpio"; + reg = <0x1f860900 0x24>; + gpio-controller; + #gpio-cells = <2>; + }; + sdhci: sdhci@1f8ec000 { compatible = "microchip,pic32mzda-sdhci"; reg = <0x1f8ec000 0x100>; @@ -74,4 +158,13 @@ clock-irq-pins = <1>,<1>; status = "disabled"; }; + + ethernet: ethernet@1f882000 { + compatible = "microchip,pic32mzda-eth"; + reg = <0x1f882000 0x1000>; + interrupts = <153 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&clock PB5CLK>; + phy-mode = "rmii"; + status = "disabled"; + }; }; diff --git a/arch/mips/dts/pic32mzda_sk.dts b/arch/mips/dts/pic32mzda_sk.dts index f886a0f..fb69a4c 100644 --- a/arch/mips/dts/pic32mzda_sk.dts +++ b/arch/mips/dts/pic32mzda_sk.dts @@ -42,4 +42,9 @@ &sdhci { status = "okay"; +}; + +ðernet { + reset-gpios = <&gpioJ 15 0>; + status = "okay"; }; \ No newline at end of file diff --git a/configs/pic32mzdask_defconfig b/configs/pic32mzdask_defconfig index d11eddd..6b20e68 100644 --- a/configs/pic32mzdask_defconfig +++ b/configs/pic32mzdask_defconfig @@ -6,6 +6,7 @@ CONFIG_SYS_LITTLE_ENDIAN=y CONFIG_HUSH_PARSER=y CONFIG_SYS_HUSH_PARSER=y CONFIG_SYS_PROMPT="dask # " +CONFIG_CMD_NET=y CONFIG_CMD_TIME=y # CONFIG_CMD_IMLS is not set CONFIG_SUPPORT_OF_CONTROL=y @@ -20,4 +21,12 @@ CONFIG_PINCTRL=y # CONFIG_PINCTRL_FULL is not set CONFIG_PIC32_PINCTRL=y CONFIG_DM_MMC=y -CONFIG_PIC32_SDHCI=y \ No newline at end of file +CONFIG_PIC32_SDHCI=y +CONFIG_DM_GPIO=y +CONFIG_CMD_GPIO=y +CONFIG_PIC32_GPIO=y +CONFIG_NET=y +CONFIG_DM_ETH=y +CONFIG_PHYLIB=y +CONFIG_NETDEVICES=y +CONFIG_PIC32_ETH=y \ No newline at end of file diff --git a/include/configs/pic32mzdask.h b/include/configs/pic32mzdask.h index 52e53e9..d08f6ad 100644 --- a/include/configs/pic32mzdask.h +++ b/include/configs/pic32mzdask.h @@ -79,6 +79,28 @@ (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16) #define CONFIG_CMDLINE_EDITING 1 +/*----------------------------------------------------------------------- + * Networking Configuration + */ +#define CONFIG_MII +#define CONFIG_PHY_SMSC +#define CONFIG_PHY_ADDR 0 /* LAN87XX */ +#define CONFIG_SYS_RX_ETH_BUFFER 8 +#define CONFIG_NET_RETRY_COUNT 20 +#define CONFIG_ARP_TIMEOUT 500 /* millisec */ + +#define CONFIG_CMD_MII +#define CONFIG_CMD_PING +#define CONFIG_CMD_DHCP + +/* + * 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 */ @@ -133,12 +155,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}; " \