hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/arch/mips/alchemy/board-mtx1.c
....@@ -1,21 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * MTX-1 platform devices registration (Au1500)
34 *
45 * Copyright (C) 2007-2009, Florian Fainelli <florian@openwrt.org>
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation; either version 2 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License
17
- * along with this program; if not, write to the Free Software
18
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
196 */
207
218 #include <linux/init.h>
....@@ -24,6 +11,7 @@
2411 #include <linux/platform_device.h>
2512 #include <linux/leds.h>
2613 #include <linux/gpio.h>
14
+#include <linux/gpio/machine.h>
2715 #include <linux/gpio_keys.h>
2816 #include <linux/input.h>
2917 #include <linux/mtd/partitions.h>
....@@ -40,23 +28,6 @@
4028 const char *get_system_type(void)
4129 {
4230 return "MTX-1";
43
-}
44
-
45
-void __init prom_init(void)
46
-{
47
- unsigned char *memsize_str;
48
- unsigned long memsize;
49
-
50
- prom_argc = fw_arg0;
51
- prom_argv = (char **)fw_arg1;
52
- prom_envp = (char **)fw_arg2;
53
-
54
- prom_init_cmdline();
55
-
56
- memsize_str = prom_getenv("memsize");
57
- if (!memsize_str || kstrtoul(memsize_str, 0, &memsize))
58
- memsize = 0x04000000;
59
- add_memory_region(0, memsize, BOOT_MEM_RAM);
6031 }
6132
6233 void prom_putchar(char c)
....@@ -130,20 +101,18 @@
130101 }
131102 };
132103
133
-static struct resource mtx1_wdt_res[] = {
134
- [0] = {
135
- .start = 215,
136
- .end = 215,
137
- .name = "mtx1-wdt-gpio",
138
- .flags = IORESOURCE_IRQ,
139
- }
104
+static struct gpiod_lookup_table mtx1_wdt_gpio_table = {
105
+ .dev_id = "mtx1-wdt.0",
106
+ .table = {
107
+ /* Global number 215 is offset 15 on Alchemy GPIO 2 */
108
+ GPIO_LOOKUP("alchemy-gpio2", 15, NULL, GPIO_ACTIVE_HIGH),
109
+ { },
110
+ },
140111 };
141112
142113 static struct platform_device mtx1_wdt = {
143114 .name = "mtx1-wdt",
144115 .id = 0,
145
- .num_resources = ARRAY_SIZE(mtx1_wdt_res),
146
- .resource = mtx1_wdt_res,
147116 };
148117
149118 static const struct gpio_led default_leds[] = {
....@@ -310,6 +279,7 @@
310279 }
311280 gpio_direction_input(mtx1_gpio_button[0].gpio);
312281 out:
282
+ gpiod_add_lookup_table(&mtx1_wdt_gpio_table);
313283 return platform_add_devices(mtx1_devs, ARRAY_SIZE(mtx1_devs));
314284 }
315285 arch_initcall(mtx1_register_devices);