@@ -72,6 +72,22 @@ intc3: interrupt-controller@1fd01088 {
interrupts = <5>;
};
+ gpio0: gpio@1fd010c0 {
+ compatible = "loongson,ls1x-gpio";
+ reg = <0x1fd010c0 0x4>;
+
+ gpio-controller;
+ #gpio-cells = <2>;
+ };
+
+ gpio1: gpio@1fd010c4 {
+ compatible = "loongson,ls1x-gpio";
+ reg = <0x1fd010c4 0x4>;
+
+ gpio-controller;
+ #gpio-cells = <2>;
+ };
+
gmac0: ethernet@1fe10000 {
compatible = "snps,dwmac-3.70a";
reg = <0x1fe10000 0x10000>;
@@ -10,6 +10,8 @@ / {
aliases {
ethernet0 = &gmac0;
ethernet1 = &gmac1;
+ gpio0 = &gpio0;
+ gpio1 = &gpio1;
};
cpus {
@@ -110,6 +112,14 @@ phy1: ethernet-phy@0 {
};
};
+&gpio0 {
+ ngpios = <31>;
+};
+
+&gpio1 {
+ ngpios = <30>;
+};
+
&gmac0 {
interrupts = <2 IRQ_TYPE_LEVEL_HIGH>;
@@ -7,6 +7,13 @@
#include "loongson1.dtsi"
/ {
+ aliases {
+ gpio0 = &gpio0;
+ gpio1 = &gpio1;
+ gpio2 = &gpio2;
+ gpio3 = &gpio3;
+ };
+
cpus {
#address-cells = <1>;
#size-cells = <0>;
@@ -39,6 +46,34 @@ intc4: interrupt-controller@1fd010a0 {
interrupt-parent = <&cpu_intc>;
interrupts = <6>;
};
+
+ gpio2: gpio@1fd010c8 {
+ compatible = "loongson,ls1x-gpio";
+ reg = <0x1fd010c8 0x4>;
+
+ gpio-controller;
+ #gpio-cells = <2>;
+
+ ngpios = <32>;
+ };
+
+ gpio3: gpio@1fd010cc {
+ compatible = "loongson,ls1x-gpio";
+ reg = <0x1fd010cc 0x4>;
+
+ gpio-controller;
+ #gpio-cells = <2>;
+
+ ngpios = <32>;
+ };
+};
+
+&gpio0 {
+ ngpios = <32>;
+};
+
+&gpio1 {
+ ngpios = <32>;
};
&gmac0 {
@@ -16,37 +16,6 @@
#include <nand.h>
#include <irq.h>
-/* GPIO */
-static struct resource ls1x_gpio0_resources[] = {
- [0] = {
- .start = LS1X_GPIO0_BASE,
- .end = LS1X_GPIO0_BASE + SZ_4 - 1,
- .flags = IORESOURCE_MEM,
- },
-};
-
-struct platform_device ls1x_gpio0_pdev = {
- .name = "ls1x-gpio",
- .id = 0,
- .num_resources = ARRAY_SIZE(ls1x_gpio0_resources),
- .resource = ls1x_gpio0_resources,
-};
-
-static struct resource ls1x_gpio1_resources[] = {
- [0] = {
- .start = LS1X_GPIO1_BASE,
- .end = LS1X_GPIO1_BASE + SZ_4 - 1,
- .flags = IORESOURCE_MEM,
- },
-};
-
-struct platform_device ls1x_gpio1_pdev = {
- .name = "ls1x-gpio",
- .id = 1,
- .num_resources = ARRAY_SIZE(ls1x_gpio1_resources),
- .resource = ls1x_gpio1_resources,
-};
-
/* USB EHCI */
static u64 ls1x_ehci_dmamask = DMA_BIT_MASK(32);
@@ -35,8 +35,6 @@ static const struct gpio_led_platform_data ls1x_led_pdata __initconst = {
static struct platform_device *ls1b_platform_devices[] __initdata = {
&ls1x_ehci_pdev,
- &ls1x_gpio0_pdev,
- &ls1x_gpio1_pdev,
&ls1x_rtc_pdev,
&ls1x_wdt_pdev,
};
Add GPIO device nodes for Loongson-1 boards, and drop the legacy platform devices and data accordingly. Signed-off-by: Keguang Zhang <keguang.zhang@gmail.com> --- arch/mips/boot/dts/loongson/loongson1.dtsi | 16 ++++++++++ arch/mips/boot/dts/loongson/loongson1b.dtsi | 10 ++++++ arch/mips/boot/dts/loongson/loongson1c.dtsi | 35 +++++++++++++++++++++ arch/mips/loongson32/common/platform.c | 31 ------------------ arch/mips/loongson32/ls1b/board.c | 2 -- 5 files changed, 61 insertions(+), 33 deletions(-)