summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2026-07-23 13:59:04 +0100
committerMark Brown <broonie@kernel.org>2026-07-23 13:59:04 +0100
commitebe8b67bf96d542176643b6e42dc56386b43b9ff (patch)
tree03031672bf775e9182e869522e034bddc6a82afb
parent8343cefa76858433a6fccf457f2590eedbc6bf5f (diff)
parent27c61f8565a438b2d1dea6f6a47af0e6dc12c112 (diff)
downloadlinux-next-ebe8b67bf96d542176643b6e42dc56386b43b9ff.tar.gz
linux-next-ebe8b67bf96d542176643b6e42dc56386b43b9ff.zip
Merge branch 'mips-next' of https://git.kernel.org/pub/scm/linux/kernel/git/mips/linux.git
-rw-r--r--arch/mips/bcm47xx/buttons.c442
-rw-r--r--arch/mips/include/asm/gio_device.h1
-rw-r--r--arch/mips/include/asm/txx9/generic.h9
-rw-r--r--arch/mips/include/asm/txx9/tx4938.h1
-rw-r--r--arch/mips/include/asm/txx9pio.h3
-rw-r--r--arch/mips/kernel/gpio_txx9.c5
-rw-r--r--arch/mips/kernel/proc.c4
-rw-r--r--arch/mips/txx9/Kconfig1
-rw-r--r--arch/mips/txx9/generic/setup.c45
-rw-r--r--arch/mips/txx9/generic/setup_tx4938.c6
-rw-r--r--arch/mips/txx9/rbtx4927/setup.c41
-rw-r--r--drivers/bcma/driver_gpio.c43
-rw-r--r--drivers/ssb/driver_gpio.c48
-rw-r--r--include/linux/bcma/bcma.h2
-rw-r--r--include/linux/ssb/ssb.h2
15 files changed, 392 insertions, 261 deletions
diff --git a/arch/mips/bcm47xx/buttons.c b/arch/mips/bcm47xx/buttons.c
index 46994f9bb821..151a4ee2803f 100644
--- a/arch/mips/bcm47xx/buttons.c
+++ b/arch/mips/bcm47xx/buttons.c
@@ -1,9 +1,14 @@
// SPDX-License-Identifier: GPL-2.0
#include "bcm47xx_private.h"
-#include <linux/input.h>
-#include <linux/gpio_keys.h>
+#include "linux/err.h"
+#include <linux/gpio/machine.h>
+#include <linux/gpio/property.h>
+#include <linux/input-event-codes.h>
#include <linux/interrupt.h>
+#include <linux/platform_device.h>
+#include <linux/property.h>
+
#include <bcm47xx_board.h>
#include <bcm47xx.h>
@@ -11,29 +16,34 @@
* Database
**************************************************/
-#define BCM47XX_GPIO_KEY(_gpio, _code) \
- { \
- .code = _code, \
- .gpio = _gpio, \
- .active_low = 1, \
+struct bcm47xx_gpio_key {
+ u16 code;
+ u8 pin;
+ u8 flags;
+};
+
+#define BCM47XX_GPIO_KEY(_gpio, _code) \
+ { \
+ .code = _code, \
+ .pin = _gpio, \
+ .flags = GPIO_ACTIVE_LOW, \
}
-#define BCM47XX_GPIO_KEY_H(_gpio, _code) \
- { \
- .code = _code, \
- .gpio = _gpio, \
+#define BCM47XX_GPIO_KEY_H(_gpio, _code) \
+ { \
+ .code = _code, \
+ .pin = _gpio, \
+ .flags = GPIO_ACTIVE_HIGH, \
}
/* Asus */
-static const struct gpio_keys_button
-bcm47xx_buttons_asus_rtn10u[] __initconst = {
+static const struct bcm47xx_gpio_key bcm47xx_buttons_asus_rtn10u[] __initconst = {
BCM47XX_GPIO_KEY(20, KEY_WPS_BUTTON),
BCM47XX_GPIO_KEY(21, KEY_RESTART),
};
-static const struct gpio_keys_button
-bcm47xx_buttons_asus_rtn12[] __initconst = {
+static const struct bcm47xx_gpio_key bcm47xx_buttons_asus_rtn12[] __initconst = {
BCM47XX_GPIO_KEY(0, KEY_WPS_BUTTON),
BCM47XX_GPIO_KEY(1, KEY_RESTART),
BCM47XX_GPIO_KEY(4, BTN_0), /* Router mode */
@@ -41,74 +51,73 @@ bcm47xx_buttons_asus_rtn12[] __initconst = {
BCM47XX_GPIO_KEY(6, BTN_2), /* AP mode */
};
-static const struct gpio_keys_button
-bcm47xx_buttons_asus_rtn16[] __initconst = {
+static const struct bcm47xx_gpio_key bcm47xx_buttons_asus_rtn16[] __initconst = {
BCM47XX_GPIO_KEY(6, KEY_WPS_BUTTON),
BCM47XX_GPIO_KEY(8, KEY_RESTART),
};
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_asus_rtn66u[] __initconst = {
BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON),
BCM47XX_GPIO_KEY(9, KEY_RESTART),
};
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_asus_wl300g[] __initconst = {
BCM47XX_GPIO_KEY(6, KEY_RESTART),
};
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_asus_wl320ge[] __initconst = {
BCM47XX_GPIO_KEY(6, KEY_RESTART),
};
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_asus_wl330ge[] __initconst = {
BCM47XX_GPIO_KEY(2, KEY_RESTART),
};
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_asus_wl500g[] __initconst = {
BCM47XX_GPIO_KEY(6, KEY_RESTART),
};
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_asus_wl500gd[] __initconst = {
BCM47XX_GPIO_KEY(6, KEY_RESTART),
};
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_asus_wl500gpv1[] __initconst = {
BCM47XX_GPIO_KEY(0, KEY_RESTART),
BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON),
};
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_asus_wl500gpv2[] __initconst = {
BCM47XX_GPIO_KEY(2, KEY_RESTART),
BCM47XX_GPIO_KEY(3, KEY_WPS_BUTTON),
};
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_asus_wl500w[] __initconst = {
BCM47XX_GPIO_KEY_H(6, KEY_RESTART),
BCM47XX_GPIO_KEY_H(7, KEY_WPS_BUTTON),
};
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_asus_wl520gc[] __initconst = {
BCM47XX_GPIO_KEY(2, KEY_RESTART),
BCM47XX_GPIO_KEY(3, KEY_WPS_BUTTON),
};
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_asus_wl520gu[] __initconst = {
BCM47XX_GPIO_KEY(2, KEY_RESTART),
BCM47XX_GPIO_KEY(3, KEY_WPS_BUTTON),
};
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_asus_wl700ge[] __initconst = {
BCM47XX_GPIO_KEY(0, KEY_POWER), /* Hard disk power switch */
BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON), /* EZSetup */
@@ -116,21 +125,21 @@ bcm47xx_buttons_asus_wl700ge[] __initconst = {
BCM47XX_GPIO_KEY(7, KEY_RESTART), /* Hard reset */
};
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_asus_wlhdd[] __initconst = {
BCM47XX_GPIO_KEY(6, KEY_RESTART),
};
/* Huawei */
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_huawei_e970[] __initconst = {
BCM47XX_GPIO_KEY(6, KEY_RESTART),
};
/* Belkin */
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_belkin_f7d4301[] __initconst = {
BCM47XX_GPIO_KEY(6, KEY_RESTART),
BCM47XX_GPIO_KEY(8, KEY_WPS_BUTTON),
@@ -138,44 +147,44 @@ bcm47xx_buttons_belkin_f7d4301[] __initconst = {
/* Buffalo */
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_buffalo_whr2_a54g54[] __initconst = {
BCM47XX_GPIO_KEY(4, KEY_RESTART),
};
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_buffalo_whr_g125[] __initconst = {
BCM47XX_GPIO_KEY(0, KEY_WPS_BUTTON),
BCM47XX_GPIO_KEY(4, KEY_RESTART),
BCM47XX_GPIO_KEY(5, BTN_0), /* Router / AP mode switch */
};
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_buffalo_whr_g54s[] __initconst = {
BCM47XX_GPIO_KEY(0, KEY_WPS_BUTTON),
BCM47XX_GPIO_KEY_H(4, KEY_RESTART),
BCM47XX_GPIO_KEY(5, BTN_0), /* Router / AP mode switch */
};
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_buffalo_whr_hp_g54[] __initconst = {
BCM47XX_GPIO_KEY(0, KEY_WPS_BUTTON),
BCM47XX_GPIO_KEY(4, KEY_RESTART),
BCM47XX_GPIO_KEY(5, BTN_0), /* Router / AP mode switch */
};
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_buffalo_wzr_g300n[] __initconst = {
BCM47XX_GPIO_KEY(4, KEY_RESTART),
};
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_buffalo_wzr_rs_g54[] __initconst = {
BCM47XX_GPIO_KEY(0, KEY_WPS_BUTTON),
BCM47XX_GPIO_KEY(4, KEY_RESTART),
};
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_buffalo_wzr_rs_g54hp[] __initconst = {
BCM47XX_GPIO_KEY(0, KEY_WPS_BUTTON),
BCM47XX_GPIO_KEY(4, KEY_RESTART),
@@ -183,20 +192,20 @@ bcm47xx_buttons_buffalo_wzr_rs_g54hp[] __initconst = {
/* Dell */
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_dell_tm2300[] __initconst = {
BCM47XX_GPIO_KEY(0, KEY_RESTART),
};
/* D-Link */
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_dlink_dir130[] __initconst = {
BCM47XX_GPIO_KEY(3, KEY_RESTART),
BCM47XX_GPIO_KEY(7, KEY_UNKNOWN),
};
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_dlink_dir330[] __initconst = {
BCM47XX_GPIO_KEY(3, KEY_RESTART),
BCM47XX_GPIO_KEY(7, KEY_UNKNOWN),
@@ -204,127 +213,127 @@ bcm47xx_buttons_dlink_dir330[] __initconst = {
/* Linksys */
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_linksys_e1000v1[] __initconst = {
BCM47XX_GPIO_KEY(5, KEY_WPS_BUTTON),
BCM47XX_GPIO_KEY(6, KEY_RESTART),
};
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_linksys_e1000v21[] __initconst = {
BCM47XX_GPIO_KEY(9, KEY_WPS_BUTTON),
BCM47XX_GPIO_KEY(10, KEY_RESTART),
};
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_linksys_e2000v1[] __initconst = {
BCM47XX_GPIO_KEY(5, KEY_WPS_BUTTON),
BCM47XX_GPIO_KEY(8, KEY_RESTART),
};
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_linksys_e2500v3[] __initconst = {
BCM47XX_GPIO_KEY(9, KEY_WPS_BUTTON),
BCM47XX_GPIO_KEY(10, KEY_RESTART),
};
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_linksys_e3000v1[] __initconst = {
BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON),
BCM47XX_GPIO_KEY(6, KEY_RESTART),
};
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_linksys_e3200v1[] __initconst = {
BCM47XX_GPIO_KEY(5, KEY_RESTART),
BCM47XX_GPIO_KEY(8, KEY_WPS_BUTTON),
};
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_linksys_e4200v1[] __initconst = {
BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON),
BCM47XX_GPIO_KEY(6, KEY_RESTART),
};
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_linksys_wrt150nv1[] __initconst = {
BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON),
BCM47XX_GPIO_KEY(6, KEY_RESTART),
};
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_linksys_wrt150nv11[] __initconst = {
BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON),
BCM47XX_GPIO_KEY(6, KEY_RESTART),
};
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_linksys_wrt160nv1[] __initconst = {
BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON),
BCM47XX_GPIO_KEY(6, KEY_RESTART),
};
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_linksys_wrt160nv3[] __initconst = {
BCM47XX_GPIO_KEY(5, KEY_WPS_BUTTON),
BCM47XX_GPIO_KEY(6, KEY_RESTART),
};
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_linksys_wrt300n_v1[] __initconst = {
BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON),
BCM47XX_GPIO_KEY(6, KEY_RESTART),
};
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_linksys_wrt300nv11[] __initconst = {
BCM47XX_GPIO_KEY(4, KEY_UNKNOWN),
BCM47XX_GPIO_KEY(6, KEY_RESTART),
};
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_linksys_wrt310nv1[] __initconst = {
BCM47XX_GPIO_KEY(6, KEY_RESTART),
BCM47XX_GPIO_KEY(8, KEY_UNKNOWN),
};
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_linksys_wrt310n_v2[] __initconst = {
BCM47XX_GPIO_KEY(5, KEY_WPS_BUTTON),
BCM47XX_GPIO_KEY(6, KEY_RESTART),
};
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_linksys_wrt320n_v1[] __initconst = {
BCM47XX_GPIO_KEY(5, KEY_WPS_BUTTON),
BCM47XX_GPIO_KEY(8, KEY_RESTART),
};
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_linksys_wrt54g3gv2[] __initconst = {
BCM47XX_GPIO_KEY(5, KEY_WIMAX),
BCM47XX_GPIO_KEY(6, KEY_RESTART),
};
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_linksys_wrt54g_generic[] __initconst = {
BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON),
BCM47XX_GPIO_KEY(6, KEY_RESTART),
};
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_linksys_wrt610nv1[] __initconst = {
BCM47XX_GPIO_KEY(6, KEY_RESTART),
BCM47XX_GPIO_KEY(8, KEY_WPS_BUTTON),
};
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_linksys_wrt610nv2[] __initconst = {
BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON),
BCM47XX_GPIO_KEY(6, KEY_RESTART),
};
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_linksys_wrtsl54gs[] __initconst = {
BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON),
BCM47XX_GPIO_KEY(6, KEY_RESTART),
@@ -332,154 +341,154 @@ bcm47xx_buttons_linksys_wrtsl54gs[] __initconst = {
/* Luxul */
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_luxul_abr_4400_v1[] = {
BCM47XX_GPIO_KEY(14, KEY_RESTART),
};
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_luxul_xap_310_v1[] = {
BCM47XX_GPIO_KEY(20, KEY_RESTART),
};
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_luxul_xap_1210_v1[] = {
BCM47XX_GPIO_KEY(8, KEY_RESTART),
};
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_luxul_xap_1230_v1[] = {
BCM47XX_GPIO_KEY(8, KEY_RESTART),
};
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_luxul_xap_1240_v1[] = {
BCM47XX_GPIO_KEY(8, KEY_RESTART),
};
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_luxul_xap_1500_v1[] = {
BCM47XX_GPIO_KEY(14, KEY_RESTART),
};
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_luxul_xbr_4400_v1[] = {
BCM47XX_GPIO_KEY(14, KEY_RESTART),
};
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_luxul_xvw_p30_v1[] = {
BCM47XX_GPIO_KEY(20, KEY_RESTART),
};
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_luxul_xwr_600_v1[] = {
BCM47XX_GPIO_KEY(8, KEY_RESTART),
};
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_luxul_xwr_1750_v1[] = {
BCM47XX_GPIO_KEY(14, KEY_RESTART),
};
/* Microsoft */
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_microsoft_nm700[] __initconst = {
BCM47XX_GPIO_KEY(7, KEY_RESTART),
};
/* Motorola */
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_motorola_we800g[] __initconst = {
BCM47XX_GPIO_KEY(0, KEY_RESTART),
};
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_motorola_wr850gp[] __initconst = {
BCM47XX_GPIO_KEY(5, KEY_RESTART),
};
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_motorola_wr850gv2v3[] __initconst = {
BCM47XX_GPIO_KEY(5, KEY_RESTART),
};
/* Netgear */
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_netgear_r6200_v1[] __initconst = {
BCM47XX_GPIO_KEY(2, KEY_RFKILL),
BCM47XX_GPIO_KEY(3, KEY_RESTART),
BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON),
};
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_netgear_r6300_v1[] __initconst = {
BCM47XX_GPIO_KEY(6, KEY_RESTART),
};
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_netgear_wn2500rp_v1[] __initconst = {
BCM47XX_GPIO_KEY(12, KEY_RESTART),
BCM47XX_GPIO_KEY(31, KEY_WPS_BUTTON),
};
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_netgear_wndr3400v1[] __initconst = {
BCM47XX_GPIO_KEY(4, KEY_RESTART),
BCM47XX_GPIO_KEY(6, KEY_WPS_BUTTON),
BCM47XX_GPIO_KEY(8, KEY_RFKILL),
};
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_netgear_wndr3400_v3[] __initconst = {
BCM47XX_GPIO_KEY(12, KEY_RESTART),
BCM47XX_GPIO_KEY(23, KEY_WPS_BUTTON),
};
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_netgear_wndr3700v3[] __initconst = {
BCM47XX_GPIO_KEY(2, KEY_RFKILL),
BCM47XX_GPIO_KEY(3, KEY_RESTART),
BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON),
};
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_netgear_wndr4500v1[] __initconst = {
BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON),
BCM47XX_GPIO_KEY(5, KEY_RFKILL),
BCM47XX_GPIO_KEY(6, KEY_RESTART),
};
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_netgear_wnr1000_v3[] __initconst = {
BCM47XX_GPIO_KEY(2, KEY_WPS_BUTTON),
BCM47XX_GPIO_KEY(3, KEY_RESTART),
};
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_netgear_wnr3500lv1[] __initconst = {
BCM47XX_GPIO_KEY(4, KEY_RESTART),
BCM47XX_GPIO_KEY(6, KEY_WPS_BUTTON),
};
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_netgear_wnr3500lv2[] __initconst = {
BCM47XX_GPIO_KEY(4, KEY_RESTART),
BCM47XX_GPIO_KEY(6, KEY_WPS_BUTTON),
BCM47XX_GPIO_KEY(8, KEY_RFKILL),
};
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_netgear_wnr834bv2[] __initconst = {
BCM47XX_GPIO_KEY(6, KEY_RESTART),
};
/* SimpleTech */
-static const struct gpio_keys_button
+static const struct bcm47xx_gpio_key
bcm47xx_buttons_simpletech_simpleshare[] __initconst = {
BCM47XX_GPIO_KEY(0, KEY_RESTART),
};
@@ -488,31 +497,96 @@ bcm47xx_buttons_simpletech_simpleshare[] __initconst = {
* Init
**************************************************/
-static struct gpio_keys_platform_data bcm47xx_button_pdata;
-
-static struct platform_device bcm47xx_buttons_gpio_keys = {
- .name = "gpio-keys",
- .dev = {
- .platform_data = &bcm47xx_button_pdata,
+static int __init
+bcm47xx_buttons_add(const struct bcm47xx_gpio_key *buttons, int nbuttons)
+{
+ struct platform_device *pdev;
+ const struct software_node *gpio_swnode;
+ struct property_entry *p;
+ int error;
+ int i;
+
+ switch (bcm47xx_bus_type) {
+#ifdef CONFIG_BCM47XX_BCMA
+ case BCM47XX_BUS_TYPE_BCMA:
+ gpio_swnode = &bcma_gpio_swnode;
+ break;
+#endif
+#ifdef CONFIG_BCM47XX_SSB
+ case BCM47XX_BUS_TYPE_SSB:
+ gpio_swnode = &ssb_gpio_swnode;
+ break;
+#endif
+ default:
+ return -ENODEV;
}
-};
-/* Copy data from __initconst */
-static int __init bcm47xx_buttons_copy(const struct gpio_keys_button *buttons,
- size_t nbuttons)
-{
- size_t size = nbuttons * sizeof(*buttons);
+ /* 1 node for gpio-keys device, 1 node for each button, 1 terminator */
+ const struct software_node **node_group __free(kfree) =
+ kcalloc(1 + nbuttons + 1, sizeof(*node_group), GFP_KERNEL);
+ if (!node_group)
+ return -ENOMEM;
- bcm47xx_button_pdata.buttons = kmemdup(buttons, size, GFP_KERNEL);
- if (!bcm47xx_button_pdata.buttons)
+ /* 1 code property, 1 gpio property, 1 terminator */
+ struct property_entry *props __free(kfree) =
+ kcalloc(nbuttons * 3, sizeof(*props), GFP_KERNEL);
+ if (!props)
return -ENOMEM;
- bcm47xx_button_pdata.nbuttons = nbuttons;
+ /* 1 node for gpio-keys device, 1 node for each button */
+ struct software_node *nodes __free(kfree) =
+ kcalloc(1 + nbuttons, sizeof(*nodes), GFP_KERNEL);
+ if (!nodes)
+ return -ENOMEM;
+
+ struct software_node_ref_args *ref_args __free(kfree) =
+ kcalloc(nbuttons, sizeof(*ref_args), GFP_KERNEL);
+ if (!ref_args)
+ return -ENOMEM;
+
+ /* gpio-keys node */
+ nodes[0].name = "bcm47xx-gpio-buttons";
+
+ p = props;
+ for (i = 0; i < nbuttons; i++) {
+ const struct bcm47xx_gpio_key *button = &buttons[i];
+ struct software_node *node = &nodes[1 + i];
+ struct software_node_ref_args *ref = &ref_args[i];
+
+ node->parent = &nodes[0];
+ node->properties = p;
+
+ *ref = SOFTWARE_NODE_REFERENCE(gpio_swnode, button->pin, button->flags);
+ *p++ = PROPERTY_ENTRY_REF("gpios", &ref_args[i]);
+ *p++ = PROPERTY_ENTRY_U32("linux,code", button->code);
+ p++;
+ }
+
+ for (i = 0; i < nbuttons + 1; i++)
+ node_group[i] = &nodes[i];
+
+ error = software_node_register_node_group(node_group);
+ if (error)
+ return error;
+
+ pdev = platform_device_register_full(&(struct platform_device_info){
+ .name = "gpio-keys",
+ .swnode = &nodes[0],
+ });
+ error = PTR_ERR_OR_ZERO(pdev);
+ if (error) {
+ software_node_unregister_node_group(node_group);
+ return error;
+ }
+
+ retain_and_null_ptr(props);
+ retain_and_null_ptr(nodes);
+ retain_and_null_ptr(ref_args);
return 0;
}
-#define bcm47xx_copy_bdata(dev_buttons) \
- bcm47xx_buttons_copy(dev_buttons, ARRAY_SIZE(dev_buttons));
+#define bcm47xx_add_bdata(dev_buttons) \
+ bcm47xx_buttons_add(dev_buttons, ARRAY_SIZE(dev_buttons))
int __init bcm47xx_buttons_register(void)
{
@@ -521,52 +595,52 @@ int __init bcm47xx_buttons_register(void)
switch (board) {
case BCM47XX_BOARD_ASUS_RTN10U:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_rtn10u);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_asus_rtn10u);
break;
case BCM47XX_BOARD_ASUS_RTN12:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_rtn12);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_asus_rtn12);
break;
case BCM47XX_BOARD_ASUS_RTN16:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_rtn16);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_asus_rtn16);
break;
case BCM47XX_BOARD_ASUS_RTN66U:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_rtn66u);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_asus_rtn66u);
break;
case BCM47XX_BOARD_ASUS_WL300G:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl300g);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_asus_wl300g);
break;
case BCM47XX_BOARD_ASUS_WL320GE:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl320ge);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_asus_wl320ge);
break;
case BCM47XX_BOARD_ASUS_WL330GE:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl330ge);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_asus_wl330ge);
break;
case BCM47XX_BOARD_ASUS_WL500G:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl500g);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_asus_wl500g);
break;
case BCM47XX_BOARD_ASUS_WL500GD:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl500gd);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_asus_wl500gd);
break;
case BCM47XX_BOARD_ASUS_WL500GPV1:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl500gpv1);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_asus_wl500gpv1);
break;
case BCM47XX_BOARD_ASUS_WL500GPV2:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl500gpv2);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_asus_wl500gpv2);
break;
case BCM47XX_BOARD_ASUS_WL500W:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl500w);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_asus_wl500w);
break;
case BCM47XX_BOARD_ASUS_WL520GC:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl520gc);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_asus_wl520gc);
break;
case BCM47XX_BOARD_ASUS_WL520GU:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl520gu);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_asus_wl520gu);
break;
case BCM47XX_BOARD_ASUS_WL700GE:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl700ge);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_asus_wl700ge);
break;
case BCM47XX_BOARD_ASUS_WLHDD:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wlhdd);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_asus_wlhdd);
break;
case BCM47XX_BOARD_BELKIN_F7D3301:
@@ -574,193 +648,193 @@ int __init bcm47xx_buttons_register(void)
case BCM47XX_BOARD_BELKIN_F7D4301:
case BCM47XX_BOARD_BELKIN_F7D4302:
case BCM47XX_BOARD_BELKIN_F7D4401:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_belkin_f7d4301);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_belkin_f7d4301);
break;
case BCM47XX_BOARD_BUFFALO_WHR2_A54G54:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_buffalo_whr2_a54g54);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_buffalo_whr2_a54g54);
break;
case BCM47XX_BOARD_BUFFALO_WHR_G125:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_buffalo_whr_g125);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_buffalo_whr_g125);
break;
case BCM47XX_BOARD_BUFFALO_WHR_G54S:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_buffalo_whr_g54s);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_buffalo_whr_g54s);
break;
case BCM47XX_BOARD_BUFFALO_WHR_HP_G54:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_buffalo_whr_hp_g54);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_buffalo_whr_hp_g54);
break;
case BCM47XX_BOARD_BUFFALO_WZR_G300N:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_buffalo_wzr_g300n);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_buffalo_wzr_g300n);
break;
case BCM47XX_BOARD_BUFFALO_WZR_RS_G54:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_buffalo_wzr_rs_g54);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_buffalo_wzr_rs_g54);
break;
case BCM47XX_BOARD_BUFFALO_WZR_RS_G54HP:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_buffalo_wzr_rs_g54hp);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_buffalo_wzr_rs_g54hp);
break;
case BCM47XX_BOARD_DELL_TM2300:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_dell_tm2300);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_dell_tm2300);
break;
case BCM47XX_BOARD_DLINK_DIR130:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_dlink_dir130);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_dlink_dir130);
break;
case BCM47XX_BOARD_DLINK_DIR330:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_dlink_dir330);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_dlink_dir330);
break;
case BCM47XX_BOARD_HUAWEI_E970:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_huawei_e970);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_huawei_e970);
break;
case BCM47XX_BOARD_LINKSYS_E1000V1:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_e1000v1);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_linksys_e1000v1);
break;
case BCM47XX_BOARD_LINKSYS_E1000V21:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_e1000v21);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_linksys_e1000v21);
break;
case BCM47XX_BOARD_LINKSYS_E2000V1:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_e2000v1);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_linksys_e2000v1);
break;
case BCM47XX_BOARD_LINKSYS_E2500V3:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_e2500v3);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_linksys_e2500v3);
break;
case BCM47XX_BOARD_LINKSYS_E3000V1:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_e3000v1);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_linksys_e3000v1);
break;
case BCM47XX_BOARD_LINKSYS_E3200V1:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_e3200v1);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_linksys_e3200v1);
break;
case BCM47XX_BOARD_LINKSYS_E4200V1:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_e4200v1);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_linksys_e4200v1);
break;
case BCM47XX_BOARD_LINKSYS_WRT150NV1:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt150nv1);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_linksys_wrt150nv1);
break;
case BCM47XX_BOARD_LINKSYS_WRT150NV11:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt150nv11);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_linksys_wrt150nv11);
break;
case BCM47XX_BOARD_LINKSYS_WRT160NV1:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt160nv1);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_linksys_wrt160nv1);
break;
case BCM47XX_BOARD_LINKSYS_WRT160NV3:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt160nv3);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_linksys_wrt160nv3);
break;
case BCM47XX_BOARD_LINKSYS_WRT300N_V1:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt300n_v1);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_linksys_wrt300n_v1);
break;
case BCM47XX_BOARD_LINKSYS_WRT300NV11:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt300nv11);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_linksys_wrt300nv11);
break;
case BCM47XX_BOARD_LINKSYS_WRT310NV1:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt310nv1);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_linksys_wrt310nv1);
break;
case BCM47XX_BOARD_LINKSYS_WRT310NV2:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt310n_v2);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_linksys_wrt310n_v2);
break;
case BCM47XX_BOARD_LINKSYS_WRT320N_V1:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt320n_v1);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_linksys_wrt320n_v1);
break;
case BCM47XX_BOARD_LINKSYS_WRT54G3GV2:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt54g3gv2);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_linksys_wrt54g3gv2);
break;
case BCM47XX_BOARD_LINKSYS_WRT54G_TYPE_0101:
case BCM47XX_BOARD_LINKSYS_WRT54G_TYPE_0467:
case BCM47XX_BOARD_LINKSYS_WRT54G_TYPE_0708:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt54g_generic);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_linksys_wrt54g_generic);
break;
case BCM47XX_BOARD_LINKSYS_WRT610NV1:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt610nv1);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_linksys_wrt610nv1);
break;
case BCM47XX_BOARD_LINKSYS_WRT610NV2:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt610nv2);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_linksys_wrt610nv2);
break;
case BCM47XX_BOARD_LINKSYS_WRTSL54GS:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrtsl54gs);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_linksys_wrtsl54gs);
break;
case BCM47XX_BOARD_LUXUL_ABR_4400_V1:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_abr_4400_v1);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_luxul_abr_4400_v1);
break;
case BCM47XX_BOARD_LUXUL_XAP_310_V1:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xap_310_v1);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_luxul_xap_310_v1);
break;
case BCM47XX_BOARD_LUXUL_XAP_1210_V1:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xap_1210_v1);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_luxul_xap_1210_v1);
break;
case BCM47XX_BOARD_LUXUL_XAP_1230_V1:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xap_1230_v1);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_luxul_xap_1230_v1);
break;
case BCM47XX_BOARD_LUXUL_XAP_1240_V1:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xap_1240_v1);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_luxul_xap_1240_v1);
break;
case BCM47XX_BOARD_LUXUL_XAP_1500_V1:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xap_1500_v1);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_luxul_xap_1500_v1);
break;
case BCM47XX_BOARD_LUXUL_XBR_4400_V1:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xbr_4400_v1);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_luxul_xbr_4400_v1);
break;
case BCM47XX_BOARD_LUXUL_XVW_P30_V1:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xvw_p30_v1);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_luxul_xvw_p30_v1);
break;
case BCM47XX_BOARD_LUXUL_XWR_600_V1:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xwr_600_v1);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_luxul_xwr_600_v1);
break;
case BCM47XX_BOARD_LUXUL_XWR_1750_V1:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xwr_1750_v1);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_luxul_xwr_1750_v1);
break;
case BCM47XX_BOARD_MICROSOFT_MN700:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_microsoft_nm700);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_microsoft_nm700);
break;
case BCM47XX_BOARD_MOTOROLA_WE800G:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_motorola_we800g);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_motorola_we800g);
break;
case BCM47XX_BOARD_MOTOROLA_WR850GP:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_motorola_wr850gp);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_motorola_wr850gp);
break;
case BCM47XX_BOARD_MOTOROLA_WR850GV2V3:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_motorola_wr850gv2v3);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_motorola_wr850gv2v3);
break;
case BCM47XX_BOARD_NETGEAR_R6200_V1:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_r6200_v1);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_netgear_r6200_v1);
break;
case BCM47XX_BOARD_NETGEAR_R6300_V1:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_r6300_v1);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_netgear_r6300_v1);
break;
case BCM47XX_BOARD_NETGEAR_WN2500RP_V1:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wn2500rp_v1);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_netgear_wn2500rp_v1);
break;
case BCM47XX_BOARD_NETGEAR_WNDR3400V1:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wndr3400v1);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_netgear_wndr3400v1);
break;
case BCM47XX_BOARD_NETGEAR_WNDR3400_V3:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wndr3400_v3);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_netgear_wndr3400_v3);
break;
case BCM47XX_BOARD_NETGEAR_WNDR3700V3:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wndr3700v3);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_netgear_wndr3700v3);
break;
case BCM47XX_BOARD_NETGEAR_WNDR4500V1:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wndr4500v1);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_netgear_wndr4500v1);
break;
case BCM47XX_BOARD_NETGEAR_WNR1000_V3:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wnr1000_v3);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_netgear_wnr1000_v3);
break;
case BCM47XX_BOARD_NETGEAR_WNR3500L:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wnr3500lv1);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_netgear_wnr3500lv1);
break;
case BCM47XX_BOARD_NETGEAR_WNR3500L_V2:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wnr3500lv2);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_netgear_wnr3500lv2);
break;
case BCM47XX_BOARD_NETGEAR_WNR834BV2:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wnr834bv2);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_netgear_wnr834bv2);
break;
case BCM47XX_BOARD_SIMPLETECH_SIMPLESHARE:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_simpletech_simpleshare);
+ err = bcm47xx_add_bdata(bcm47xx_buttons_simpletech_simpleshare);
break;
default:
@@ -769,13 +843,7 @@ int __init bcm47xx_buttons_register(void)
}
if (err)
- return -ENOMEM;
-
- err = platform_device_register(&bcm47xx_buttons_gpio_keys);
- if (err) {
- pr_err("Failed to register platform device: %d\n", err);
return err;
- }
return 0;
}
diff --git a/arch/mips/include/asm/gio_device.h b/arch/mips/include/asm/gio_device.h
index f9c102f038d6..6e9d2897347d 100644
--- a/arch/mips/include/asm/gio_device.h
+++ b/arch/mips/include/asm/gio_device.h
@@ -1,6 +1,5 @@
/* SPDX-License-Identifier: GPL-2.0 */
#include <linux/device.h>
-#include <linux/mod_devicetable.h>
struct gio_device_id {
__u8 id;
diff --git a/arch/mips/include/asm/txx9/generic.h b/arch/mips/include/asm/txx9/generic.h
index 9a2c47bf3c40..653315fb6ca5 100644
--- a/arch/mips/include/asm/txx9/generic.h
+++ b/arch/mips/include/asm/txx9/generic.h
@@ -45,7 +45,6 @@ extern int (*txx9_irq_dispatch)(int pending);
const char *prom_getenv(const char *name);
void txx9_wdt_init(unsigned long base);
void txx9_wdt_now(unsigned long base);
-void txx9_spi_init(int busid, unsigned long base, int irq);
void txx9_ethaddr_init(unsigned int id, unsigned char *ethaddr);
void txx9_sio_init(unsigned long baseaddr, int irq,
unsigned int line, unsigned int sclk, int nocts);
@@ -80,15 +79,9 @@ static inline unsigned int __fls8(unsigned char x)
return r;
}
-void txx9_iocled_init(unsigned long baseaddr,
- int basenum, unsigned int num, int lowactive,
+void txx9_iocled_init(unsigned long baseaddr, unsigned int num,
const char *color, char **deftriggers);
-/* 7SEG LED */
-void txx9_7segled_init(unsigned int num,
- void (*putc)(unsigned int pos, unsigned char val));
-int txx9_7segled_putc(unsigned int pos, char c);
-
void __init txx9_aclc_init(unsigned long baseaddr, int irq,
unsigned int dmac_id,
unsigned int dma_chan_out,
diff --git a/arch/mips/include/asm/txx9/tx4938.h b/arch/mips/include/asm/txx9/tx4938.h
index 6ca767ee6467..765f7d6a44d3 100644
--- a/arch/mips/include/asm/txx9/tx4938.h
+++ b/arch/mips/include/asm/txx9/tx4938.h
@@ -281,7 +281,6 @@ void tx4938_wdt_init(void);
void tx4938_setup(void);
void tx4938_time_init(unsigned int tmrnr);
void tx4938_sio_init(unsigned int sclk, unsigned int cts_mask);
-void tx4938_spi_init(int busid);
void tx4938_ethaddr_init(unsigned char *addr0, unsigned char *addr1);
int tx4938_report_pciclk(void);
void tx4938_report_pci1clk(void);
diff --git a/arch/mips/include/asm/txx9pio.h b/arch/mips/include/asm/txx9pio.h
index 3d6fa9f8d513..c33a97724400 100644
--- a/arch/mips/include/asm/txx9pio.h
+++ b/arch/mips/include/asm/txx9pio.h
@@ -23,7 +23,6 @@ struct txx9_pio_reg {
__u32 maskext;
};
-int txx9_gpio_init(unsigned long baseaddr,
- unsigned int base, unsigned int num);
+int txx9_gpio_init(unsigned long baseaddr, unsigned int num);
#endif /* __ASM_TXX9PIO_H */
diff --git a/arch/mips/kernel/gpio_txx9.c b/arch/mips/kernel/gpio_txx9.c
index 96ac40d20c23..b2e73263d94c 100644
--- a/arch/mips/kernel/gpio_txx9.c
+++ b/arch/mips/kernel/gpio_txx9.c
@@ -76,13 +76,12 @@ static struct gpio_chip txx9_gpio_chip = {
.label = "TXx9",
};
-int __init txx9_gpio_init(unsigned long baseaddr,
- unsigned int base, unsigned int num)
+int __init txx9_gpio_init(unsigned long baseaddr, unsigned int num)
{
txx9_pioptr = ioremap(baseaddr, sizeof(struct txx9_pio_reg));
if (!txx9_pioptr)
return -ENODEV;
- txx9_gpio_chip.base = base;
+ txx9_gpio_chip.base = -1;
txx9_gpio_chip.ngpio = num;
return gpiochip_add_data(&txx9_gpio_chip, NULL);
}
diff --git a/arch/mips/kernel/proc.c b/arch/mips/kernel/proc.c
index 5401c679813a..5f49fd4653a7 100644
--- a/arch/mips/kernel/proc.c
+++ b/arch/mips/kernel/proc.c
@@ -109,7 +109,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
seq_puts(m, " mips64r5");
if (cpu_has_mips64r6)
seq_puts(m, " mips64r6");
- seq_puts(m, "\n");
+ seq_putc(m, '\n');
seq_puts(m, "ASEs implemented\t:");
if (cpu_has_mips16)
@@ -273,7 +273,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
seq_puts(m, " mm_sysad");
if (cpu_has_mm_full)
seq_puts(m, " mm_full");
- seq_puts(m, "\n");
+ seq_putc(m, '\n');
seq_printf(m, "shadow register sets\t: %d\n",
cpu_data[n].srsets);
diff --git a/arch/mips/txx9/Kconfig b/arch/mips/txx9/Kconfig
index 92b759a434c0..7335efa4d528 100644
--- a/arch/mips/txx9/Kconfig
+++ b/arch/mips/txx9/Kconfig
@@ -37,7 +37,6 @@ config SOC_TX4927
select IRQ_TXX9
select PCI_TX4927
select GPIO_TXX9
- select GPIOLIB_LEGACY
config SOC_TX4938
bool
diff --git a/arch/mips/txx9/generic/setup.c b/arch/mips/txx9/generic/setup.c
index 6c5025806914..5f66236038c8 100644
--- a/arch/mips/txx9/generic/setup.c
+++ b/arch/mips/txx9/generic/setup.c
@@ -19,6 +19,7 @@
#include <linux/clkdev.h>
#include <linux/err.h>
#include <linux/gpio/driver.h>
+#include <linux/gpio/machine.h>
#include <linux/platform_device.h>
#include <linux/platform_data/txx9/ndfmc.h>
#include <linux/serial_core.h>
@@ -341,23 +342,6 @@ void txx9_wdt_now(unsigned long base)
&tmrptr->tcr);
}
-/* SPI support */
-void __init txx9_spi_init(int busid, unsigned long base, int irq)
-{
- struct resource res[] = {
- {
- .start = base,
- .end = base + 0x20 - 1,
- .flags = IORESOURCE_MEM,
- }, {
- .start = irq,
- .flags = IORESOURCE_IRQ,
- },
- };
- platform_device_register_simple("spi_txx9", busid,
- res, ARRAY_SIZE(res));
-}
-
void __init txx9_ethaddr_init(unsigned int id, unsigned char *ethaddr)
{
struct platform_device *pdev =
@@ -586,7 +570,7 @@ void __init txx9_ndfmc_init(unsigned long baseaddr,
#if IS_ENABLED(CONFIG_LEDS_GPIO)
static DEFINE_SPINLOCK(txx9_iocled_lock);
-#define TXX9_IOCLED_MAXLEDS 8
+#define TXX9_IOCLED_MAXLEDS 3 /* rbtx4927 */
struct txx9_iocled_data {
struct gpio_chip chip;
@@ -632,8 +616,16 @@ static int txx9_iocled_dir_out(struct gpio_chip *chip, unsigned int offset,
return 0;
}
-void __init txx9_iocled_init(unsigned long baseaddr,
- int basenum, unsigned int num, int lowactive,
+static struct gpiod_lookup_table txx9_iocled_table = {
+ .table = {
+ GPIO_LOOKUP_IDX("iocled", 0, NULL, 0, GPIO_ACTIVE_LOW),
+ GPIO_LOOKUP_IDX("iocled", 1, NULL, 1, GPIO_ACTIVE_LOW),
+ GPIO_LOOKUP_IDX("iocled", 2, NULL, 2, GPIO_ACTIVE_LOW),
+ { },
+ },
+};
+
+void __init txx9_iocled_init(unsigned long baseaddr, unsigned int num,
const char *color, char **deftriggers)
{
struct txx9_iocled_data *iocled;
@@ -659,14 +651,12 @@ void __init txx9_iocled_init(unsigned long baseaddr,
iocled->chip.direction_input = txx9_iocled_dir_in;
iocled->chip.direction_output = txx9_iocled_dir_out;
iocled->chip.label = "iocled";
- iocled->chip.base = basenum;
+ iocled->chip.base = -1;
iocled->chip.ngpio = num;
if (gpiochip_add_data(&iocled->chip, iocled))
goto out_unmap;
- if (basenum < 0)
- basenum = iocled->chip.base;
- pdev = platform_device_alloc("leds-gpio", basenum);
+ pdev = platform_device_alloc("leds-gpio", iocled->chip.base);
if (!pdev)
goto out_gpio;
iocled->pdata.num_leds = num;
@@ -676,14 +666,14 @@ void __init txx9_iocled_init(unsigned long baseaddr,
snprintf(iocled->names[i], sizeof(iocled->names[i]),
"iocled:%s:%u", color, i);
led->name = iocled->names[i];
- led->gpio = basenum + i;
- led->active_low = lowactive;
if (deftriggers && *deftriggers)
led->default_trigger = *deftriggers++;
}
pdev->dev.platform_data = &iocled->pdata;
if (platform_device_add(pdev))
goto out_pdev;
+ txx9_iocled_table.dev_id = dev_name(&pdev->dev);
+ gpiod_add_lookup_table(&txx9_iocled_table);
return;
out_pdev:
@@ -696,8 +686,7 @@ out_free:
kfree(iocled);
}
#else /* CONFIG_LEDS_GPIO */
-void __init txx9_iocled_init(unsigned long baseaddr,
- int basenum, unsigned int num, int lowactive,
+void __init txx9_iocled_init(unsigned long baseaddr, unsigned int num,
const char *color, char **deftriggers)
{
}
diff --git a/arch/mips/txx9/generic/setup_tx4938.c b/arch/mips/txx9/generic/setup_tx4938.c
index ba646548c5f6..bfd6540f8f6a 100644
--- a/arch/mips/txx9/generic/setup_tx4938.c
+++ b/arch/mips/txx9/generic/setup_tx4938.c
@@ -301,12 +301,6 @@ void __init tx4938_sio_init(unsigned int sclk, unsigned int cts_mask)
}
}
-void __init tx4938_spi_init(int busid)
-{
- txx9_spi_init(busid, TX4938_SPI_REG & 0xfffffffffULL,
- TXX9_IRQ_BASE + TX4938_IR_SPI);
-}
-
void __init tx4938_ethaddr_init(unsigned char *addr0, unsigned char *addr1)
{
u64 pcfg = __raw_readq(&tx4938_ccfgptr->pcfg);
diff --git a/arch/mips/txx9/rbtx4927/setup.c b/arch/mips/txx9/rbtx4927/setup.c
index 31955c1d5555..223889c03186 100644
--- a/arch/mips/txx9/rbtx4927/setup.c
+++ b/arch/mips/txx9/rbtx4927/setup.c
@@ -49,6 +49,7 @@
#include <linux/platform_device.h>
#include <linux/delay.h>
#include <linux/gpio.h>
+#include <linux/gpio/machine.h>
#include <linux/leds.h>
#include <asm/io.h>
#include <asm/reboot.h>
@@ -157,18 +158,27 @@ static inline void tx4927_pci_setup(void) {}
static inline void tx4937_pci_setup(void) {}
#endif /* CONFIG_PCI */
+/* TX4927-SIO DTR on (PIO[15]) */
+GPIO_LOOKUP_SINGLE(sio_gpio_table, NULL, "TXx9", 15, "sio-dtr",
+ GPIO_ACTIVE_HIGH);
+
static void __init rbtx4927_gpio_init(void)
{
- /* TX4927-SIO DTR on (PIO[15]) */
- gpio_request(15, "sio-dtr");
- gpio_direction_output(15, 1);
+ struct gpio_desc *d;
+
+ gpiod_add_lookup_table(&sio_gpio_table);
+ d = gpiod_get(NULL, "sio-dtr", GPIOD_OUT_HIGH);
+ if (IS_ERR(d))
+ pr_err("Unable to get sio-dtr GPIO descriptor\n");
+ else
+ gpiod_put(d);
tx4927_sio_init(0, 0);
}
static void __init rbtx4927_arch_init(void)
{
- txx9_gpio_init(TX4927_PIO_REG & 0xfffffffffULL, 0, TX4927_NUM_PIO);
+ txx9_gpio_init(TX4927_PIO_REG & 0xfffffffffULL, TX4927_NUM_PIO);
rbtx4927_gpio_init();
@@ -177,7 +187,7 @@ static void __init rbtx4927_arch_init(void)
static void __init rbtx4937_arch_init(void)
{
- txx9_gpio_init(TX4938_PIO_REG & 0xfffffffffULL, 0, TX4938_NUM_PIO);
+ txx9_gpio_init(TX4938_PIO_REG & 0xfffffffffULL, TX4938_NUM_PIO);
rbtx4927_gpio_init();
@@ -317,11 +327,19 @@ static void __init rbtx4927_mtd_init(void)
tx4927_mtd_init(i);
}
+static struct gpiod_lookup_table rbtx4927_gpioled_table = {
+ .table = {
+ GPIO_LOOKUP_IDX("TXx9", 0, NULL, 0, GPIO_ACTIVE_LOW),
+ GPIO_LOOKUP_IDX("TXx9", 1, NULL, 1, GPIO_ACTIVE_LOW),
+ { },
+ },
+};
+
static void __init rbtx4927_gpioled_init(void)
{
static const struct gpio_led leds[] = {
- { .name = "gpioled:green:0", .gpio = 0, .active_low = 1, },
- { .name = "gpioled:green:1", .gpio = 1, .active_low = 1, },
+ { .name = "gpioled:green:0", },
+ { .name = "gpioled:green:1", },
};
static struct gpio_led_platform_data pdata = {
.num_leds = ARRAY_SIZE(leds),
@@ -332,8 +350,13 @@ static void __init rbtx4927_gpioled_init(void)
if (!pdev)
return;
pdev->dev.platform_data = &pdata;
- if (platform_device_add(pdev))
+ if (platform_device_add(pdev)) {
platform_device_put(pdev);
+ return;
+ }
+
+ rbtx4927_gpioled_table.dev_id = dev_name(&pdev->dev);
+ gpiod_add_lookup_table(&rbtx4927_gpioled_table);
}
static void __init rbtx4927_device_init(void)
@@ -350,7 +373,7 @@ static void __init rbtx4927_device_init(void)
tx4938_aclc_init();
}
platform_device_register_simple("txx9aclc-generic", -1, NULL, 0);
- txx9_iocled_init(RBTX4927_LED_ADDR - IO_BASE, -1, 3, 1, "green", NULL);
+ txx9_iocled_init(RBTX4927_LED_ADDR - IO_BASE, 3, "green", NULL);
rbtx4927_gpioled_init();
}
diff --git a/drivers/bcma/driver_gpio.c b/drivers/bcma/driver_gpio.c
index 658c7e2ac8bf..ea45222f2fa0 100644
--- a/drivers/bcma/driver_gpio.c
+++ b/drivers/bcma/driver_gpio.c
@@ -19,6 +19,11 @@
#define BCMA_GPIO_MAX_PINS 32
+const struct software_node bcma_gpio_swnode = {
+ .name = "bcma-gpio",
+};
+EXPORT_SYMBOL_GPL(bcma_gpio_swnode);
+
static int bcma_gpio_get_value(struct gpio_chip *chip, unsigned gpio)
{
struct bcma_drv_cc *cc = gpiochip_get_data(chip);
@@ -190,7 +195,20 @@ int bcma_gpio_init(struct bcma_drv_cc *cc)
chip->direction_input = bcma_gpio_direction_input;
chip->direction_output = bcma_gpio_direction_output;
chip->parent = bus->dev;
- chip->fwnode = dev_fwnode(&cc->core->dev);
+
+ /*
+ * Register software node only for the host SoC bus, unless there is
+ * already a firmware node assigned. There is only one SoC instance
+ * in the system, so there are no concerns with registration conflicts.
+ */
+ if (bus->hosttype == BCMA_HOSTTYPE_SOC && !dev_fwnode(&cc->core->dev)) {
+ err = software_node_register(&bcma_gpio_swnode);
+ if (err)
+ return err;
+ chip->fwnode = software_node_fwnode(&bcma_gpio_swnode);
+ } else {
+ chip->fwnode = dev_fwnode(&cc->core->dev);
+ }
switch (bus->chipinfo.id) {
case BCMA_CHIP_ID_BCM4707:
@@ -219,20 +237,33 @@ int bcma_gpio_init(struct bcma_drv_cc *cc)
err = bcma_gpio_irq_init(cc);
if (err)
- return err;
+ goto err_unregister_swnode;
err = gpiochip_add_data(chip, cc);
- if (err) {
- bcma_gpio_irq_exit(cc);
- return err;
- }
+ if (err)
+ goto err_irq_exit;
return 0;
+
+err_irq_exit:
+ bcma_gpio_irq_exit(cc);
+err_unregister_swnode:
+ if (bus->hosttype == BCMA_HOSTTYPE_SOC &&
+ chip->fwnode && is_software_node(chip->fwnode)) {
+ software_node_unregister(&bcma_gpio_swnode);
+ chip->fwnode = NULL;
+ }
+ return err;
}
int bcma_gpio_unregister(struct bcma_drv_cc *cc)
{
bcma_gpio_irq_exit(cc);
gpiochip_remove(&cc->gpio);
+ if (cc->core->bus->hosttype == BCMA_HOSTTYPE_SOC &&
+ cc->gpio.fwnode && is_software_node(cc->gpio.fwnode)) {
+ software_node_unregister(&bcma_gpio_swnode);
+ cc->gpio.fwnode = NULL;
+ }
return 0;
}
diff --git a/drivers/ssb/driver_gpio.c b/drivers/ssb/driver_gpio.c
index 905657c925bc..87922479946c 100644
--- a/drivers/ssb/driver_gpio.c
+++ b/drivers/ssb/driver_gpio.c
@@ -15,8 +15,14 @@
#include <linux/interrupt.h>
#include <linux/irqdomain.h>
#include <linux/export.h>
+#include <linux/property.h>
#include <linux/ssb/ssb.h>
+const struct software_node ssb_gpio_swnode = {
+ .name = "ssb-gpio",
+};
+EXPORT_SYMBOL_GPL(ssb_gpio_swnode);
+
/**************************************************
* Shared
@@ -232,6 +238,8 @@ static int ssb_gpio_chipco_init(struct ssb_bus *bus)
chip->to_irq = ssb_gpio_to_irq;
#endif
chip->ngpio = 16;
+ if (bus->bustype == SSB_BUSTYPE_SSB)
+ chip->fwnode = software_node_fwnode(&ssb_gpio_swnode);
/* There is just one SoC in one device and its GPIO addresses should be
* deterministic to address them more easily. The other buses could get
* a random base number.
@@ -433,10 +441,12 @@ static int ssb_gpio_extif_init(struct ssb_bus *bus)
* deterministic to address them more easily. The other buses could get
* a random base number.
*/
- if (bus->bustype == SSB_BUSTYPE_SSB)
- chip->base = 0;
- else
- chip->base = -1;
+ if (bus->bustype == SSB_BUSTYPE_SSB) {
+ chip->base = 0;
+ chip->fwnode = software_node_fwnode(&ssb_gpio_swnode);
+ } else {
+ chip->base = -1;
+ }
err = ssb_gpio_irq_extif_domain_init(bus);
if (err)
@@ -464,11 +474,33 @@ static int ssb_gpio_extif_init(struct ssb_bus *bus)
int ssb_gpio_init(struct ssb_bus *bus)
{
+ int err = 0;
+
+ /*
+ * Register software node only for the host SoC bus. There is only
+ * one SoC instance in the system, so there are no concerns with
+ * registration conflicts.
+ */
+ if (bus->bustype == SSB_BUSTYPE_SSB) {
+ err = software_node_register(&ssb_gpio_swnode);
+ if (err)
+ return err;
+ }
+
if (ssb_chipco_available(&bus->chipco))
- return ssb_gpio_chipco_init(bus);
+ err = ssb_gpio_chipco_init(bus);
else if (ssb_extif_available(&bus->extif))
- return ssb_gpio_extif_init(bus);
- return -1;
+ err = ssb_gpio_extif_init(bus);
+ else
+ err = -ENODEV;
+
+ if (err) {
+ if (bus->bustype == SSB_BUSTYPE_SSB)
+ software_node_unregister(&ssb_gpio_swnode);
+ return err;
+ }
+
+ return 0;
}
int ssb_gpio_unregister(struct ssb_bus *bus)
@@ -476,6 +508,8 @@ int ssb_gpio_unregister(struct ssb_bus *bus)
if (ssb_chipco_available(&bus->chipco) ||
ssb_extif_available(&bus->extif)) {
gpiochip_remove(&bus->gpio);
+ if (bus->bustype == SSB_BUSTYPE_SSB)
+ software_node_unregister(&ssb_gpio_swnode);
return 0;
}
return -1;
diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h
index f02cb3909375..17fc50190014 100644
--- a/include/linux/bcma/bcma.h
+++ b/include/linux/bcma/bcma.h
@@ -486,4 +486,6 @@ extern u32 bcma_core_dma_translation(struct bcma_device *core);
extern unsigned int bcma_core_irq(struct bcma_device *core, int num);
+extern const struct software_node bcma_gpio_swnode;
+
#endif /* LINUX_BCMA_H_ */
diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h
index 7fee9afa9458..67cb66f6f5ed 100644
--- a/include/linux/ssb/ssb.h
+++ b/include/linux/ssb/ssb.h
@@ -671,4 +671,6 @@ int ssb_pcibios_plat_dev_init(struct pci_dev *dev);
int ssb_pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin);
#endif /* CONFIG_SSB_EMBEDDED */
+extern const struct software_node ssb_gpio_swnode;
+
#endif /* LINUX_SSB_H_ */