[U-Boot] [PATCH v1 14/18] board: Add gpio and ethernet support to pic32mzdask board.

Purna Chandra Mandal purna.mandal at microchip.com
Thu Dec 17 18:32:59 CET 2015


Add GPIO and network (DHCP. BOOTP, TFTP protocol) support.

Signed-off-by: Purna Chandra Mandal <purna.mandal at microchip.com>
---

 arch/mips/dts/pic32mzda.dtsi   | 92 ++++++++++++++++++++++++++++++++++++++++++
 arch/mips/dts/pic32mzda_sk.dts |  5 +++
 configs/pic32mzdask_defconfig  |  9 +++++
 include/configs/pic32mzdask.h  | 22 ++++++++++
 4 files changed, 128 insertions(+)

diff --git a/arch/mips/dts/pic32mzda.dtsi b/arch/mips/dts/pic32mzda.dtsi
index 1333573..cf76825 100644
--- a/arch/mips/dts/pic32mzda.dtsi
+++ b/arch/mips/dts/pic32mzda.dtsi
@@ -5,12 +5,26 @@
  * SPDX-License-Identifier:    GPL-2.0+
  */
 
+#include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/interrupt-controller/irq.h>
 #include "skeleton.dtsi"
 
 / {
     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 at 0 {
             compatible = "mips,mips14kc";
@@ -56,4 +70,82 @@
               <0xbf801500 0x200>; /* out */
         status = "disabled";
     };
+
+    gpioA: gpio0 at 1f860000 {
+        compatible = "microchip,gpio-bank";
+        reg = <0xbf860000 0x24>;
+        gpio-controller;
+        #gpio-cells = <2>;
+    };
+
+    gpioB: gpio1 at 1f860100 {
+        compatible = "microchip,gpio-bank";
+        reg = <0xbf860100 0x24>;
+        gpio-controller;
+        #gpio-cells = <2>;
+    };
+
+    gpioC: gpio2 at 1f860200 {
+        compatible = "microchip,gpio-bank";
+        reg = <0xbf860200 0x24>;
+        gpio-controller;
+        #gpio-cells = <2>;
+    };
+
+    gpioD: gpio3 at 1f860300 {
+        compatible = "microchip,gpio-bank";
+        reg = <0xbf860300 0x24>;
+        gpio-controller;
+        #gpio-cells = <2>;
+    };
+
+    gpioE: gpio4 at 1f860400 {
+        compatible = "microchip,gpio-bank";
+        reg = <0xbf860400 0x24>;
+        gpio-controller;
+        #gpio-cells = <2>;
+    };
+
+    gpioF: gpio5 at 1f860500 {
+        compatible = "microchip,gpio-bank";
+        reg = <0xbf860500 0x24>;
+        gpio-controller;
+        #gpio-cells = <2>;
+    };
+
+    gpioG: gpio6 at 1f860600 {
+        compatible = "microchip,gpio-bank";
+        reg = <0xbf860600 0x24>;
+        gpio-controller;
+        #gpio-cells = <2>;
+    };
+
+    gpioH: gpio7 at 1f860700 {
+        compatible = "microchip,gpio-bank";
+        reg = <0xbf860700 0x24>;
+        gpio-controller;
+        #gpio-cells = <2>;
+    };
+
+    gpioJ: gpio8 at 1f860800 {
+        compatible = "microchip,gpio-bank";
+        reg = <0xbf860800 0x24>;
+        gpio-controller;
+        #gpio-cells = <2>;
+    };
+
+    gpioK: gpio9 at 1f860900 {
+        compatible = "microchip,gpio-bank";
+        reg = <0xbf860900 0x24>;
+        gpio-controller;
+        #gpio-cells = <2>;
+    };
+
+    ethernet: ethernet at 1f882000 {
+        compatible = "microchip,pic32mzda-eth";
+        reg = <0xbf882000 0x1000>;
+        interrupts = <153 IRQ_TYPE_LEVEL_HIGH>;
+        phy-mode = "rmii";
+        status = "disabled";
+    };
 };
diff --git a/arch/mips/dts/pic32mzda_sk.dts b/arch/mips/dts/pic32mzda_sk.dts
index 99e7f64..38ef9c0 100644
--- a/arch/mips/dts/pic32mzda_sk.dts
+++ b/arch/mips/dts/pic32mzda_sk.dts
@@ -36,3 +36,8 @@
     status = "okay";
     u-boot,dm-pre-reloc;
 };
+
+&ethernet {
+    reset-gpios = <&gpioJ 15 0>;
+    status = "okay";
+};
diff --git a/configs/pic32mzdask_defconfig b/configs/pic32mzdask_defconfig
index df06f8b..d74d169 100644
--- a/configs/pic32mzdask_defconfig
+++ b/configs/pic32mzdask_defconfig
@@ -7,6 +7,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,3 +21,11 @@ CONFIG_CLK=y
 CONFIG_PINCTRL=y
 # CONFIG_PINCTRL_FULL is not set
 CONFIG_PIC32_PINCTRL=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
diff --git a/include/configs/pic32mzdask.h b/include/configs/pic32mzdask.h
index 89925f6..8e5c31b 100644
--- a/include/configs/pic32mzdask.h
+++ b/include/configs/pic32mzdask.h
@@ -100,6 +100,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_CMD_MII
+#define CONFIG_CMD_PING
+#define CONFIG_CMD_DHCP
+#define CONFIG_PHY_ADDR            0 /* LAN87XX */
+#define CONFIG_ARP_TIMEOUT        500 /* millisec */
+#define CONFIG_NET_RETRY_COUNT        20
+#define CONFIG_SYS_RX_ETH_BUFFER    8
+
+/*
+ * 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
  */
-- 
1.8.3.1



More information about the U-Boot mailing list