From: Keguang Zhang <keguang.zhang@gmail.com>
To: linux-mips@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Conor Dooley <conor+dt@kernel.org>,
Keguang Zhang <keguang.zhang@gmail.com>
Subject: [PATCH 09/17] MIPS: loongson32: Convert GPIO platform device to DT
Date: Sat, 29 Jul 2023 21:43:10 +0800 [thread overview]
Message-ID: <20230729134318.1694467-10-keguang.zhang@gmail.com> (raw)
In-Reply-To: <20230729134318.1694467-1-keguang.zhang@gmail.com>
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(-)
diff --git a/arch/mips/boot/dts/loongson/loongson1.dtsi b/arch/mips/boot/dts/loongson/loongson1.dtsi
index 48bb786bbf10..abe8170fa1b1 100644
--- a/arch/mips/boot/dts/loongson/loongson1.dtsi
+++ b/arch/mips/boot/dts/loongson/loongson1.dtsi
@@ -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>;
diff --git a/arch/mips/boot/dts/loongson/loongson1b.dtsi b/arch/mips/boot/dts/loongson/loongson1b.dtsi
index 42b96c557660..7010d3f3511b 100644
--- a/arch/mips/boot/dts/loongson/loongson1b.dtsi
+++ b/arch/mips/boot/dts/loongson/loongson1b.dtsi
@@ -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>;
diff --git a/arch/mips/boot/dts/loongson/loongson1c.dtsi b/arch/mips/boot/dts/loongson/loongson1c.dtsi
index 5b3e0f9280f6..a5bc2c5093ca 100644
--- a/arch/mips/boot/dts/loongson/loongson1c.dtsi
+++ b/arch/mips/boot/dts/loongson/loongson1c.dtsi
@@ -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 {
diff --git a/arch/mips/loongson32/common/platform.c b/arch/mips/loongson32/common/platform.c
index 817518531b9b..37302bcfb9ab 100644
--- a/arch/mips/loongson32/common/platform.c
+++ b/arch/mips/loongson32/common/platform.c
@@ -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);
diff --git a/arch/mips/loongson32/ls1b/board.c b/arch/mips/loongson32/ls1b/board.c
index f23e4e5c96ee..baadc524cc88 100644
--- a/arch/mips/loongson32/ls1b/board.c
+++ b/arch/mips/loongson32/ls1b/board.c
@@ -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,
};
--
2.39.2
next prev parent reply other threads:[~2023-07-29 13:45 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-29 13:43 [PATCH 00/17] MIPS: loongson32: Convert all platform devices to DT Keguang Zhang
2023-07-29 13:43 ` [PATCH 01/17] MIPS: loongson32: Get the system type from DT Keguang Zhang
2023-07-29 13:43 ` [PATCH 02/17] MIPS: Modify the Loongson1 PRID_REV Keguang Zhang
2023-08-01 13:52 ` Philippe Mathieu-Daudé
2023-07-29 13:43 ` [PATCH 03/17] MIPS: dts: Add basic DT support for Loongson-1 boards Keguang Zhang
2023-07-30 17:11 ` Du Huanpeng
2023-07-31 3:06 ` Keguang Zhang
2023-07-29 13:43 ` [PATCH 04/17] MIPS: loongson32: Modify Loongson-1B/1C related Kconfig options Keguang Zhang
2023-07-29 13:43 ` [PATCH 05/17] MIPS: loongson32: Adapt the common code to support DT Keguang Zhang
2023-07-29 13:43 ` [PATCH 06/17] MIPS: loongson32: Convert platform IRQ driver to DT Keguang Zhang
2023-07-30 8:24 ` Krzysztof Kozlowski
2023-07-31 2:52 ` Keguang Zhang
2023-07-29 13:43 ` [PATCH 07/17] MIPS: loongson32: Convert UART platform device " Keguang Zhang
2023-07-30 8:26 ` Krzysztof Kozlowski
2023-07-31 3:04 ` Keguang Zhang
2023-07-31 3:32 ` Keguang Zhang
2023-07-31 6:56 ` Krzysztof Kozlowski
2023-07-29 13:43 ` [PATCH 08/17] MIPS: loongson32: Convert Ethernet " Keguang Zhang
2023-08-01 18:21 ` Serge Semin
2023-08-02 3:10 ` Keguang Zhang
2023-08-02 9:44 ` Serge Semin
2023-08-02 11:19 ` Keguang Zhang
2023-08-02 12:42 ` Serge Semin
2023-08-02 10:31 ` Du Huanpeng
2023-08-02 11:30 ` Keguang Zhang
2023-07-29 13:43 ` Keguang Zhang [this message]
2023-07-29 13:43 ` [PATCH 10/17] MIPS: loongson32: Convert GPIO LED " Keguang Zhang
2023-07-29 13:43 ` [PATCH 11/17] MIPS: loongson32: Convert USB host " Keguang Zhang
2023-07-29 13:43 ` [PATCH 12/17] MIPS: loongson32: Convert RTC " Keguang Zhang
2023-07-29 13:43 ` [PATCH 13/17] MIPS: loongson32: Convert watchdog " Keguang Zhang
2023-07-29 13:43 ` [PATCH 14/17] mips: dts: loongson1b: Add PWM timer clocksource Keguang Zhang
2023-07-30 8:27 ` Krzysztof Kozlowski
2023-07-29 13:43 ` [PATCH 15/17] MIPS: loongson32: Remove all the obsolete code of platform device Keguang Zhang
2023-07-29 13:43 ` [PATCH 16/17] MIPS: configs: Update and rename loongson1b_defconfig Keguang Zhang
2023-07-29 13:43 ` [PATCH 17/17] MIPS: configs: Update and rename loongson1c_defconfig Keguang Zhang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230729134318.1694467-10-keguang.zhang@gmail.com \
--to=keguang.zhang@gmail.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=robh+dt@kernel.org \
--cc=tsbogend@alpha.franken.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).