diff options
Diffstat (limited to 'arch/mips')
39 files changed, 657 insertions, 289 deletions
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 8555bbf47c63..d7c67cebe065 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -395,12 +395,8 @@ config MACH_DECSTATION config ECONET bool "EcoNet MIPS family" select BOOT_RAW - select CPU_BIG_ENDIAN select DEBUG_ZBOOT if DEBUG_KERNEL - select EARLY_PRINTK_8250 select ECONET_EN751221_TIMER - select SERIAL_8250 - select SERIAL_OF_PLATFORM select SYS_SUPPORTS_BIG_ENDIAN select SYS_HAS_CPU_MIPS32_R1 select SYS_HAS_CPU_MIPS32_R2 @@ -662,6 +658,7 @@ config EYEQ select USB_UHCI_BIG_ENDIAN_MMIO if CPU_BIG_ENDIAN select USE_OF select HOTPLUG_PARALLEL if HOTPLUG_CPU + select WEAK_REORDERING_BEYOND_LLSC help Select this to build a kernel supporting EyeQ SoC from Mobileye. @@ -3163,7 +3160,6 @@ config MIPS_EXTERNAL_TIMER config MIPS_GENERIC_GETTIMEOFDAY def_bool y select GENERIC_GETTIMEOFDAY - select HAVE_GENERIC_VDSO depends on CSRC_R4K || CLKSRC_MIPS_GIC # GCC (at least up to version 9.2) appears to emit function calls that make use # of the GOT when targeting microMIPS, which we can't use in the VDSO due to diff --git a/arch/mips/alchemy/board-xxs1500.c b/arch/mips/alchemy/board-xxs1500.c index f175bce2987f..a03762dde4e7 100644 --- a/arch/mips/alchemy/board-xxs1500.c +++ b/arch/mips/alchemy/board-xxs1500.c @@ -11,7 +11,7 @@ #include <linux/init.h> #include <linux/interrupt.h> #include <linux/platform_device.h> -#include <linux/gpio.h> +#include <linux/gpio/consumer.h> #include <linux/delay.h> #include <linux/pm.h> #include <asm/bootinfo.h> diff --git a/arch/mips/alchemy/devboards/db1000.c b/arch/mips/alchemy/devboards/db1000.c index 8fb24b220e3a..5eff34a8683b 100644 --- a/arch/mips/alchemy/devboards/db1000.c +++ b/arch/mips/alchemy/devboards/db1000.c @@ -8,7 +8,7 @@ #include <linux/clk.h> #include <linux/dma-mapping.h> -#include <linux/gpio.h> +#include <linux/gpio/legacy.h> #include <linux/gpio/machine.h> #include <linux/gpio/property.h> #include <linux/init.h> diff --git a/arch/mips/alchemy/devboards/db1200.c b/arch/mips/alchemy/devboards/db1200.c index de2a9083ed9a..539b311fc8af 100644 --- a/arch/mips/alchemy/devboards/db1200.c +++ b/arch/mips/alchemy/devboards/db1200.c @@ -7,7 +7,7 @@ #include <linux/clk.h> #include <linux/dma-mapping.h> -#include <linux/gpio.h> +#include <linux/gpio/legacy.h> #include <linux/i2c.h> #include <linux/init.h> #include <linux/interrupt.h> diff --git a/arch/mips/alchemy/devboards/db1550.c b/arch/mips/alchemy/devboards/db1550.c index b8295a5c2e9a..579fc8f1eaed 100644 --- a/arch/mips/alchemy/devboards/db1550.c +++ b/arch/mips/alchemy/devboards/db1550.c @@ -7,7 +7,7 @@ #include <linux/clk.h> #include <linux/dma-mapping.h> -#include <linux/gpio.h> +#include <linux/gpio/legacy.h> #include <linux/i2c.h> #include <linux/init.h> #include <linux/io.h> diff --git a/arch/mips/bcm47xx/buttons.c b/arch/mips/bcm47xx/buttons.c index 46994f9bb821..7bb338da8e42 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) = + kzalloc_objs(*node_group, 1 + nbuttons + 1); + 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) = + kzalloc_objs(*props, nbuttons * 3); + 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) = + kzalloc_objs(*nodes, 1 + nbuttons); + if (!nodes) + return -ENOMEM; + + struct software_node_ref_args *ref_args __free(kfree) = + kzalloc_objs(*ref_args, nbuttons); + 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/bcm47xx/workarounds.c b/arch/mips/bcm47xx/workarounds.c index 745c6228eb2c..dc9e5483347d 100644 --- a/arch/mips/bcm47xx/workarounds.c +++ b/arch/mips/bcm47xx/workarounds.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 #include "bcm47xx_private.h" -#include <linux/gpio.h> +#include <linux/gpio/legacy.h> #include <bcm47xx_board.h> #include <bcm47xx.h> diff --git a/arch/mips/bcm63xx/boards/board_bcm963xx.c b/arch/mips/bcm63xx/boards/board_bcm963xx.c index c5617b889b1c..71628dac6c26 100644 --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c @@ -7,6 +7,7 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #include <linux/init.h> +#include <linux/gpio/legacy.h> #include <linux/kernel.h> #include <linux/string.h> #include <linux/platform_device.h> diff --git a/arch/mips/boot/dts/econet/en751221.dtsi b/arch/mips/boot/dts/econet/en751221.dtsi index 72cb65654c34..57ae84a8a9f8 100644 --- a/arch/mips/boot/dts/econet/en751221.dtsi +++ b/arch/mips/boot/dts/econet/en751221.dtsi @@ -23,6 +23,12 @@ compatible = "mips,mips34Kc"; reg = <0>; }; + + cpu@1 { + device_type = "cpu"; + compatible = "mips,mips34Kc"; + reg = <1>; + }; }; cpuintc: interrupt-controller { @@ -65,6 +71,7 @@ interrupt-controller; #interrupt-cells = <1>; econet,shadow-interrupts = <7 2>, <8 3>, <13 12>, <30 29>; + econet,cpu-interrupt-map = <7 0>, <8 1>; }; pciecfg: pciecfg@1fb80000 { diff --git a/arch/mips/cavium-octeon/octeon-platform.c b/arch/mips/cavium-octeon/octeon-platform.c index 47677b5d7ed0..f53c98372e0b 100644 --- a/arch/mips/cavium-octeon/octeon-platform.c +++ b/arch/mips/cavium-octeon/octeon-platform.c @@ -18,7 +18,7 @@ #include <asm/octeon/octeon.h> #include <asm/octeon/cvmx-helper-board.h> -#ifdef CONFIG_USB +#if IS_ENABLED(CONFIG_USB) #include <linux/usb/ehci_def.h> #include <linux/usb/ehci_pdriver.h> #include <linux/usb/ohci_pdriver.h> @@ -1080,7 +1080,7 @@ end_led: ; } -#ifdef CONFIG_USB +#if IS_ENABLED(CONFIG_USB) /* OHCI/UHCI USB */ alias_prop = fdt_getprop(initial_boot_params, aliases, "uctl", NULL); diff --git a/arch/mips/configs/bigsur_defconfig b/arch/mips/configs/bigsur_defconfig index 611dc0dd392d..d2b18d5033be 100644 --- a/arch/mips/configs/bigsur_defconfig +++ b/arch/mips/configs/bigsur_defconfig @@ -140,7 +140,6 @@ CONFIG_EXT4_FS_SECURITY=y CONFIG_EXT4_FS=y CONFIG_QUOTA=y CONFIG_QUOTA_NETLINK_INTERFACE=y -# CONFIG_PRINT_QUOTA_WARNING is not set CONFIG_QFMT_V2=m CONFIG_AUTOFS_FS=m CONFIG_FUSE_FS=m diff --git a/arch/mips/configs/econet_en751221_defconfig b/arch/mips/configs/econet_en751221_defconfig new file mode 100644 index 000000000000..b35d33fe4044 --- /dev/null +++ b/arch/mips/configs/econet_en751221_defconfig @@ -0,0 +1,264 @@ +# CONFIG_LOCALVERSION_AUTO is not set +CONFIG_KERNEL_XZ=y +CONFIG_SYSVIPC=y +CONFIG_POSIX_MQUEUE=y +# CONFIG_CROSS_MEMORY_ATTACH is not set +CONFIG_HIGH_RES_TIMERS=y +CONFIG_BPF_SYSCALL=y +CONFIG_BPF_JIT=y +CONFIG_PREEMPT=y +CONFIG_CGROUPS=y +CONFIG_MEMCG=y +CONFIG_BLK_CGROUP=y +CONFIG_CGROUP_SCHED=y +CONFIG_CFS_BANDWIDTH=y +CONFIG_RT_GROUP_SCHED=y +CONFIG_CGROUP_PIDS=y +CONFIG_CGROUP_RDMA=y +CONFIG_CPUSETS=y +CONFIG_CGROUP_CPUACCT=y +CONFIG_CGROUP_BPF=y +CONFIG_NAMESPACES=y +# CONFIG_TIME_NS is not set +CONFIG_USER_NS=y +CONFIG_BLK_DEV_INITRD=y +# CONFIG_RD_GZIP is not set +# CONFIG_RD_BZIP2 is not set +# CONFIG_RD_LZMA is not set +# CONFIG_RD_XZ is not set +# CONFIG_RD_LZO is not set +# CONFIG_RD_LZ4 is not set +# CONFIG_RD_ZSTD is not set +# CONFIG_INITRAMFS_PRESERVE_MTIME is not set +CONFIG_LD_DEAD_CODE_DATA_ELIMINATION=y +CONFIG_EXPERT=y +# CONFIG_SGETMASK_SYSCALL is not set +# CONFIG_IO_URING is not set +# CONFIG_RSEQ is not set +# CONFIG_CACHESTAT_SYSCALL is not set +CONFIG_ECONET=y +CONFIG_CPU_MIPS32_R2=y +CONFIG_ZBOOT_LOAD_ADDRESS=0x80020000 +CONFIG_ARCH_FORCE_MAX_ORDER=11 +# CONFIG_MIPS_FP_SUPPORT is not set +CONFIG_NR_CPUS=2 +CONFIG_HZ_100=y +CONFIG_MIPS_RAW_APPENDED_DTB=y +# CONFIG_SCHED_SMT is not set +CONFIG_JUMP_LABEL=y +# CONFIG_STACKPROTECTOR_STRONG is not set +# CONFIG_GCC_PLUGINS is not set +CONFIG_MODULES=y +CONFIG_MODULE_UNLOAD=y +# CONFIG_BLOCK_LEGACY_AUTOLOAD is not set +CONFIG_BLK_DEV_THROTTLING=y +# CONFIG_BLK_DEBUG_FS is not set +CONFIG_PARTITION_ADVANCED=y +CONFIG_OF_PARTITION=y +# CONFIG_MQ_IOSCHED_DEADLINE is not set +# CONFIG_MQ_IOSCHED_KYBER is not set +# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set +CONFIG_SLAB_FREELIST_RANDOM=y +CONFIG_SLAB_FREELIST_HARDENED=y +# CONFIG_COMPAT_BRK is not set +CONFIG_LRU_GEN=y +CONFIG_LRU_GEN_ENABLED=y +CONFIG_NET=y +CONFIG_PACKET=y +CONFIG_UNIX=y +CONFIG_INET=y +CONFIG_IP_MULTICAST=y +CONFIG_IP_ADVANCED_ROUTER=y +CONFIG_IP_MULTIPLE_TABLES=y +CONFIG_IP_ROUTE_MULTIPATH=y +CONFIG_IP_ROUTE_VERBOSE=y +CONFIG_IP_MROUTE=y +CONFIG_IP_MROUTE_MULTIPLE_TABLES=y +CONFIG_IP_PIMSM_V1=y +CONFIG_IP_PIMSM_V2=y +CONFIG_SYN_COOKIES=y +# CONFIG_INET_DIAG is not set +CONFIG_TCP_CONG_ADVANCED=y +# CONFIG_TCP_CONG_BIC is not set +# CONFIG_TCP_CONG_WESTWOOD is not set +# CONFIG_TCP_CONG_HTCP is not set +# CONFIG_IPV6_SIT is not set +CONFIG_IPV6_SUBTREES=y +CONFIG_IPV6_MROUTE=y +CONFIG_IPV6_MROUTE_MULTIPLE_TABLES=y +CONFIG_IPV6_PIMSM_V2=y +CONFIG_IPV6_SEG6_LWTUNNEL=y +CONFIG_MPTCP=y +CONFIG_NETFILTER=y +# CONFIG_NETFILTER_EGRESS is not set +CONFIG_NF_CONNTRACK=m +CONFIG_NF_CONNTRACK_MARK=y +CONFIG_NF_CONNTRACK_ZONES=y +CONFIG_NF_CONNTRACK_PROCFS=y +CONFIG_NF_CONNTRACK_TIMEOUT=y +# CONFIG_NF_CT_PROTO_SCTP is not set +CONFIG_NF_TABLES=m +CONFIG_NF_TABLES_INET=y +CONFIG_NF_TABLES_NETDEV=y +CONFIG_NFT_NUMGEN=m +CONFIG_NFT_CT=m +CONFIG_NFT_FLOW_OFFLOAD=m +CONFIG_NFT_LOG=m +CONFIG_NFT_LIMIT=m +CONFIG_NFT_MASQ=m +CONFIG_NFT_REDIR=m +CONFIG_NFT_NAT=m +CONFIG_NFT_QUOTA=m +CONFIG_NFT_REJECT=m +CONFIG_NFT_HASH=m +CONFIG_NFT_FIB_INET=m +CONFIG_NF_FLOW_TABLE_INET=m +CONFIG_NF_FLOW_TABLE=m +CONFIG_NFT_FIB_IPV4=m +CONFIG_NF_TABLES_ARP=y +CONFIG_NF_LOG_IPV4=m +CONFIG_NFT_FIB_IPV6=m +CONFIG_NF_LOG_IPV6=m +CONFIG_NF_TABLES_BRIDGE=m +CONFIG_BRIDGE=y +CONFIG_BRIDGE_VLAN_FILTERING=y +CONFIG_VLAN_8021Q=y +CONFIG_NET_SCHED=y +CONFIG_NET_SCH_FQ_CODEL=y +CONFIG_NET_SCH_DEFAULT=y +CONFIG_DEFAULT_FQ_CODEL=y +CONFIG_NET_SWITCHDEV=y +CONFIG_NET_L3_MASTER_DEV=y +CONFIG_RFKILL=y +# CONFIG_LWTUNNEL_BPF is not set +CONFIG_PCI=y +CONFIG_PCIEPORTBUS=y +CONFIG_PCIEAER=y +# CONFIG_PCIEASPM is not set +CONFIG_PCI_MSI=y +# CONFIG_VGA_ARB is not set +CONFIG_PCIE_MEDIATEK=y +CONFIG_MTD=y +CONFIG_MTD_BLOCK=y +CONFIG_MTD_CFI=y +CONFIG_MTD_CFI_INTELEXT=y +CONFIG_MTD_CFI_AMDSTD=y +CONFIG_MTD_COMPLEX_MAPPINGS=y +CONFIG_MTD_SPI_NAND=y +CONFIG_MTD_UBI=y +CONFIG_MTD_UBI_BEB_LIMIT=13 +CONFIG_MTD_UBI_BLOCK=y +CONFIG_NETDEVICES=y +# CONFIG_NET_VENDOR_ASIX is not set +# CONFIG_NET_VENDOR_ENGLEDER is not set +# CONFIG_NET_VENDOR_FUNGIBLE is not set +# CONFIG_NET_VENDOR_LITEX is not set +# CONFIG_NET_VENDOR_MICROSOFT is not set +# CONFIG_NET_VENDOR_VERTEXCOM is not set +# CONFIG_NET_VENDOR_WANGXUN is not set +CONFIG_PPP=m +CONFIG_PPP_FILTER=y +CONFIG_PPP_MULTILINK=y +CONFIG_PPPOE=m +CONFIG_PPP_ASYNC=m +# CONFIG_WLAN_VENDOR_ADMTEK is not set +# CONFIG_WLAN_VENDOR_ATH is not set +# CONFIG_WLAN_VENDOR_ATMEL is not set +# CONFIG_WLAN_VENDOR_BROADCOM is not set +# CONFIG_WLAN_VENDOR_INTEL is not set +# CONFIG_WLAN_VENDOR_INTERSIL is not set +# CONFIG_WLAN_VENDOR_MARVELL is not set +# CONFIG_WLAN_VENDOR_MEDIATEK is not set +# CONFIG_WLAN_VENDOR_MICROCHIP is not set +# CONFIG_WLAN_VENDOR_PURELIFI is not set +# CONFIG_WLAN_VENDOR_RALINK is not set +# CONFIG_WLAN_VENDOR_REALTEK is not set +# CONFIG_WLAN_VENDOR_RSI is not set +# CONFIG_WLAN_VENDOR_SILABS is not set +# CONFIG_WLAN_VENDOR_ST is not set +# CONFIG_WLAN_VENDOR_TI is not set +# CONFIG_WLAN_VENDOR_ZYDAS is not set +# CONFIG_WLAN_VENDOR_QUANTENNA is not set +# CONFIG_INPUT is not set +# CONFIG_SERIO is not set +# CONFIG_VT is not set +# CONFIG_LEGACY_PTYS is not set +# CONFIG_LEGACY_TIOCSTI is not set +CONFIG_SERIAL_8250=y +CONFIG_SERIAL_8250_CONSOLE=y +CONFIG_SERIAL_OF_PLATFORM=y +# CONFIG_HW_RANDOM is not set +# CONFIG_DEVMEM is not set +CONFIG_SPI=y +# CONFIG_PTP_1588_CLOCK is not set +CONFIG_GPIOLIB=y +# CONFIG_HWMON is not set +CONFIG_WATCHDOG=y +CONFIG_MFD_SYSCON=y +# CONFIG_USB_PCI is not set +CONFIG_NEW_LEDS=y +CONFIG_LEDS_CLASS=y +CONFIG_LEDS_CLASS_MULTICOLOR=y +CONFIG_LEDS_GPIO=m +CONFIG_LEDS_TRIGGERS=y +CONFIG_LEDS_TRIGGER_TIMER=y +CONFIG_LEDS_TRIGGER_HEARTBEAT=y +CONFIG_LEDS_TRIGGER_DEFAULT_ON=y +CONFIG_LEDS_TRIGGER_NETDEV=y +CONFIG_STAGING=y +# CONFIG_MIPS_PLATFORM_DEVICES is not set +CONFIG_COMMON_CLK_EN7523=y +# CONFIG_IOMMU_SUPPORT is not set +CONFIG_RESET_CONTROLLER=y +CONFIG_PHY_ECONET_PCIE=y +# CONFIG_DNOTIFY is not set +CONFIG_FANOTIFY=y +CONFIG_OVERLAY_FS=y +# CONFIG_OVERLAY_FS_REDIRECT_ALWAYS_FOLLOW is not set +# CONFIG_PROC_PAGE_MONITOR is not set +CONFIG_TMPFS=y +CONFIG_TMPFS_POSIX_ACL=y +CONFIG_JFFS2_FS=y +CONFIG_JFFS2_SUMMARY=y +CONFIG_JFFS2_FS_XATTR=y +CONFIG_JFFS2_COMPRESSION_OPTIONS=y +CONFIG_UBIFS_FS=y +CONFIG_SQUASHFS=y +CONFIG_SQUASHFS_FILE_DIRECT=y +CONFIG_SQUASHFS_COMPILE_DECOMP_MULTI_PERCPU=y +# CONFIG_SQUASHFS_ZLIB is not set +CONFIG_SQUASHFS_XZ=y +CONFIG_SQUASHFS_EMBEDDED=y +CONFIG_KEYS=y +CONFIG_INIT_STACK_NONE=y +CONFIG_FORTIFY_SOURCE=y +CONFIG_HARDENED_USERCOPY=y +CONFIG_LIST_HARDENED=y +CONFIG_CRYPTO_NULL=y +CONFIG_CRYPTO_AES=y +CONFIG_CRYPTO_CCM=y +CONFIG_CRYPTO_GCM=y +# CONFIG_CRYPTO_HW is not set +# CONFIG_XZ_DEC_X86 is not set +# CONFIG_XZ_DEC_POWERPC is not set +# CONFIG_XZ_DEC_ARM is not set +# CONFIG_XZ_DEC_ARMTHUMB is not set +# CONFIG_XZ_DEC_ARM64 is not set +# CONFIG_XZ_DEC_SPARC is not set +# CONFIG_XZ_DEC_RISCV is not set +CONFIG_PRINTK_TIME=y +# CONFIG_DEBUG_MISC is not set +CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y +CONFIG_DEBUG_INFO_REDUCED=y +CONFIG_FRAME_WARN=1024 +CONFIG_STRIP_ASM_SYMS=y +CONFIG_MAGIC_SYSRQ=y +# CONFIG_MAGIC_SYSRQ_SERIAL is not set +CONFIG_DEBUG_FS=y +# CONFIG_SLUB_DEBUG is not set +CONFIG_SCHED_STACK_END_CHECK=y +CONFIG_PANIC_ON_OOPS=y +CONFIG_PANIC_TIMEOUT=1 +CONFIG_RCU_CPU_STALL_TIMEOUT=60 +# CONFIG_RCU_TRACE is not set +# CONFIG_FTRACE is not set diff --git a/arch/mips/configs/ip22_defconfig b/arch/mips/configs/ip22_defconfig index 009e66299b69..09a77e5b249c 100644 --- a/arch/mips/configs/ip22_defconfig +++ b/arch/mips/configs/ip22_defconfig @@ -238,7 +238,6 @@ CONFIG_XFS_FS=m CONFIG_XFS_QUOTA=y CONFIG_QUOTA=y CONFIG_QUOTA_NETLINK_INTERFACE=y -# CONFIG_PRINT_QUOTA_WARNING is not set CONFIG_QFMT_V2=m CONFIG_AUTOFS_FS=m CONFIG_FUSE_FS=m diff --git a/arch/mips/configs/loongson2k_defconfig b/arch/mips/configs/loongson2k_defconfig index ca534a6b66de..8fd863f4f7b0 100644 --- a/arch/mips/configs/loongson2k_defconfig +++ b/arch/mips/configs/loongson2k_defconfig @@ -303,7 +303,6 @@ CONFIG_XFS_FS=y CONFIG_XFS_QUOTA=y CONFIG_XFS_POSIX_ACL=y CONFIG_QUOTA=y -# CONFIG_PRINT_QUOTA_WARNING is not set CONFIG_AUTOFS_FS=y CONFIG_FUSE_FS=m CONFIG_ISO9660_FS=m diff --git a/arch/mips/configs/mtx1_defconfig b/arch/mips/configs/mtx1_defconfig index 46b40784a828..e28a0b1e6d52 100644 --- a/arch/mips/configs/mtx1_defconfig +++ b/arch/mips/configs/mtx1_defconfig @@ -234,7 +234,6 @@ CONFIG_TULIP=m CONFIG_WINBOND_840=m CONFIG_DM9102=m CONFIG_ULI526X=m -CONFIG_PCMCIA_XIRCOM=m CONFIG_DL2K=m CONFIG_SUNDANCE=m CONFIG_E100=m diff --git a/arch/mips/econet/Kconfig b/arch/mips/econet/Kconfig index b37b9d25d5a4..579fb5b01532 100644 --- a/arch/mips/econet/Kconfig +++ b/arch/mips/econet/Kconfig @@ -16,9 +16,7 @@ choice select HAVE_PCI select IRQ_MIPS_CPU select PCI_DRIVERS_GENERIC - select SMP - select SMP_UP - select SYS_SUPPORTS_SMP + select SYS_SUPPORTS_MULTITHREADING help The EN751221 family includes EN7512, RN7513, EN7521, EN7526. They are based on single core MIPS 34Kc processors. To boot diff --git a/arch/mips/econet/init.c b/arch/mips/econet/init.c index 6f43ffb209cb..ae45b8788504 100644 --- a/arch/mips/econet/init.c +++ b/arch/mips/econet/init.c @@ -28,6 +28,41 @@ static void hw_reset(char *command) iowrite32(RESET, CR_AHB_RSTCR); } +/* + * vsmp_init_secondary expects either GIC or cascading interrupt configuration. + * The EN751221 is a 34Kc with VEIC, but not GIC compatible. The cascading + * configuration enables lines 6 and 7 for performance counters, but when this + * is done on the EN751221 intc with VEIC enabled, it causes the whole intc to + * stop sending interrupts. + * Only unmask lines 0 and 1 (software interrupts) in init_secondary. + */ +#ifdef CONFIG_MIPS_MT_SMP +extern const struct plat_smp_ops vsmp_smp_ops; +static struct plat_smp_ops en75_smp_ops __ro_after_init; + +static void en751221_init_secondary(void) +{ + write_c0_status((read_c0_status() & ~ST0_IM) | + (STATUSF_IP0 | STATUSF_IP1)); +} + +static int __init en751221_register_vsmp_smp_ops(void) +{ + if (!cpu_has_mipsmt) + return -ENODEV; + + en75_smp_ops = vsmp_smp_ops; + en75_smp_ops.init_secondary = en751221_init_secondary; + register_smp_ops(&en75_smp_ops); + return 0; +} +#else +static int __init en751221_register_vsmp_smp_ops(void) +{ + return -ENODEV; +} +#endif /* CONFIG_MIPS_MT_SMP */ + /* 1. Bring up early printk. */ void __init prom_init(void) { @@ -51,11 +86,16 @@ void __init plat_mem_setup(void) early_init_dt_scan_memory(); } -/* 3. Overload __weak device_tree_init(), add SMP_UP ops */ +/* 3. Overload __weak device_tree_init(), add SMP ops */ void __init device_tree_init(void) { unflatten_and_copy_device_tree(); + /* EN751221 dual-vpe */ + if (!en751221_register_vsmp_smp_ops()) + return; + + /* EN751221 with MT_SMP disabled */ register_up_smp_ops(); } 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/mach-bcm63xx/board_bcm963xx.h b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h index 830f53f28e3f..428cf4508f9a 100644 --- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h +++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h @@ -3,7 +3,7 @@ #define BOARD_BCM963XX_H_ #include <linux/types.h> -#include <linux/gpio.h> +#include <linux/gpio/consumer.h> #include <linux/leds.h> #include <bcm63xx_dev_enet.h> #include <bcm63xx_dev_usb_usbd.h> diff --git a/arch/mips/include/asm/spinlock.h b/arch/mips/include/asm/spinlock.h index 6ce2117e49f6..c349162f15eb 100644 --- a/arch/mips/include/asm/spinlock.h +++ b/arch/mips/include/asm/spinlock.h @@ -13,12 +13,12 @@ #include <asm-generic/qspinlock_types.h> -#define queued_spin_unlock queued_spin_unlock +#define queued_spin_release queued_spin_release /** - * queued_spin_unlock - release a queued spinlock + * queued_spin_release - release a queued spinlock * @lock : Pointer to queued spinlock structure */ -static inline void queued_spin_unlock(struct qspinlock *lock) +static inline void queued_spin_release(struct qspinlock *lock) { /* This could be optimised with ARCH_HAS_MMIOWB */ mmiowb(); diff --git a/arch/mips/include/asm/timex.h b/arch/mips/include/asm/timex.h index 7ef06dcdc46e..daedc62f0fb8 100644 --- a/arch/mips/include/asm/timex.h +++ b/arch/mips/include/asm/timex.h @@ -19,14 +19,6 @@ #include <asm/cpu-type.h> /* - * This is the clock rate of the i8253 PIT. A MIPS system may not have - * a PIT by the symbol is used all over the kernel including some APIs. - * So keeping it defined to the number for the PIT is the only sane thing - * for now. - */ -#define CLOCK_TICK_RATE 1193182 - -/* * Standard way to access the cycle counter. * Currently only used on SMP for scheduling. * 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/include/uapi/asm/socket.h b/arch/mips/include/uapi/asm/socket.h index 72fb1b006da9..f1641dde135f 100644 --- a/arch/mips/include/uapi/asm/socket.h +++ b/arch/mips/include/uapi/asm/socket.h @@ -166,6 +166,8 @@ #define SO_INQ 84 #define SCM_INQ SO_INQ +#define SO_RIGHTS_NOTRUNC 85 + #if !defined(__KERNEL__) #if __BITS_PER_LONG == 64 diff --git a/arch/mips/kernel/csrc-r4k.c b/arch/mips/kernel/csrc-r4k.c index 241a934543a8..59eca397f297 100644 --- a/arch/mips/kernel/csrc-r4k.c +++ b/arch/mips/kernel/csrc-r4k.c @@ -126,14 +126,12 @@ int __init init_r4k_clocksource(void) clocksource_mips.rating = 200; clocksource_mips.rating += clamp(mips_hpt_frequency / 10000000, 0, 99); -#ifdef CONFIG_GENERIC_GETTIMEOFDAY /* * R2 onwards makes the count accessible to user mode so it can be used * by the VDSO (HWREna is configured by configure_hwrena()). */ if (cpu_has_mips_r2_r6 && rdhwr_count_usable()) clocksource_mips.vdso_clock_mode = VDSO_CLOCKMODE_R4K; -#endif clocksource_register_hz(&clocksource_mips, mips_hpt_frequency); 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/kernel/ptrace.c b/arch/mips/kernel/ptrace.c index 3f4c94c88124..17dc7249b8ca 100644 --- a/arch/mips/kernel/ptrace.c +++ b/arch/mips/kernel/ptrace.c @@ -1321,14 +1321,18 @@ long arch_ptrace(struct task_struct *child, long request, */ asmlinkage long syscall_trace_enter(struct pt_regs *regs) { + long syscall; + user_exit(); + syscall = current_thread_info()->syscall; + if (test_thread_flag(TIF_SYSCALL_TRACE)) { - if (ptrace_report_syscall_entry(regs)) + if (!ptrace_report_syscall_permit_entry(regs)) return -1; } - if (secure_computing()) + if (!seccomp_permit_syscall()) return -1; if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT))) @@ -1342,7 +1346,7 @@ asmlinkage long syscall_trace_enter(struct pt_regs *regs) * Negative syscall numbers are mistaken for rejected syscalls, but * won't have had the return value set appropriately, so we do so now. */ - if (current_thread_info()->syscall < 0) + if (syscall < 0) syscall_set_return_value(current, regs, -ENOSYS, 0); return current_thread_info()->syscall; } diff --git a/arch/mips/kernel/syscalls/syscall_n32.tbl b/arch/mips/kernel/syscalls/syscall_n32.tbl index 7430714e2b8f..9ae88e4eac61 100644 --- a/arch/mips/kernel/syscalls/syscall_n32.tbl +++ b/arch/mips/kernel/syscalls/syscall_n32.tbl @@ -410,3 +410,4 @@ 469 n32 file_setattr sys_file_setattr 470 n32 listns sys_listns 471 n32 rseq_slice_yield sys_rseq_slice_yield +472 n32 fchroot sys_fchroot diff --git a/arch/mips/kernel/syscalls/syscall_n64.tbl b/arch/mips/kernel/syscalls/syscall_n64.tbl index 630aab9e5425..83dc93a0712f 100644 --- a/arch/mips/kernel/syscalls/syscall_n64.tbl +++ b/arch/mips/kernel/syscalls/syscall_n64.tbl @@ -386,3 +386,4 @@ 469 n64 file_setattr sys_file_setattr 470 n64 listns sys_listns 471 n64 rseq_slice_yield sys_rseq_slice_yield +472 n64 fchroot sys_fchroot diff --git a/arch/mips/kernel/syscalls/syscall_o32.tbl b/arch/mips/kernel/syscalls/syscall_o32.tbl index 128653112284..9c62429c9b7b 100644 --- a/arch/mips/kernel/syscalls/syscall_o32.tbl +++ b/arch/mips/kernel/syscalls/syscall_o32.tbl @@ -459,3 +459,4 @@ 469 o32 file_setattr sys_file_setattr 470 o32 listns sys_listns 471 o32 rseq_slice_yield sys_rseq_slice_yield +472 o32 fchroot sys_fchroot diff --git a/arch/mips/kernel/vdso.c b/arch/mips/kernel/vdso.c index bd1fc17d3975..8165dd3fc1f8 100644 --- a/arch/mips/kernel/vdso.c +++ b/arch/mips/kernel/vdso.c @@ -91,8 +91,8 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp) /* Map delay slot emulation page */ base = do_mmap(NULL, STACK_TOP, PAGE_SIZE, PROT_READ | PROT_EXEC, - MAP_ANONYMOUS | MAP_PRIVATE | MAP_FIXED, 0, 0, &unused, - NULL); + MAP_ANONYMOUS | MAP_PRIVATE | MAP_FIXED, + EMPTY_VMA_FLAGS, 0, &unused, NULL); if (IS_ERR_VALUE(base)) { ret = base; goto out; @@ -129,7 +129,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp) * This ensures that when the kernel updates the VDSO data userland * will observe it without requiring cache invalidations. */ - if (cpu_has_dc_aliases && IS_ENABLED(CONFIG_HAVE_GENERIC_VDSO)) { + if (cpu_has_dc_aliases && IS_ENABLED(CONFIG_MIPS_GENERIC_GETTIMEOFDAY)) { base = __ALIGN_MASK(base, shm_align_mask); base += ((unsigned long)vdso_k_time_data - gic_size) & shm_align_mask; } @@ -137,7 +137,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp) data_addr = base + gic_size; vdso_addr = data_addr + VDSO_NR_PAGES * PAGE_SIZE; - if (IS_ENABLED(CONFIG_HAVE_GENERIC_VDSO)) { + if (IS_ENABLED(CONFIG_MIPS_GENERIC_GETTIMEOFDAY)) { vma = vdso_install_vvar_mapping(mm, data_addr); if (IS_ERR(vma)) { ret = PTR_ERR(vma); 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/arch/mips/vdso/vdso.lds.S b/arch/mips/vdso/vdso.lds.S index 278ab6444e98..b11ee493c67f 100644 --- a/arch/mips/vdso/vdso.lds.S +++ b/arch/mips/vdso/vdso.lds.S @@ -97,9 +97,11 @@ VERSION LINUX_2.6 { #ifdef CONFIG_GENERIC_GETTIMEOFDAY global: +#if _MIPS_SIM == _MIPS_SIM_ABI64 || defined(CONFIG_COMPAT_32BIT_TIME) __vdso_clock_gettime; __vdso_gettimeofday; __vdso_clock_getres; +#endif #if _MIPS_SIM != _MIPS_SIM_ABI64 __vdso_clock_gettime64; __vdso_clock_getres_time64; diff --git a/arch/mips/vdso/vgettimeofday.c b/arch/mips/vdso/vgettimeofday.c index 00f9fcfc327e..a1fb06b8973e 100644 --- a/arch/mips/vdso/vgettimeofday.c +++ b/arch/mips/vdso/vgettimeofday.c @@ -12,6 +12,8 @@ #include <vdso/gettime.h> #if _MIPS_SIM != _MIPS_SIM_ABI64 + +#ifdef CONFIG_COMPAT_32BIT_TIME int __vdso_clock_gettime(clockid_t clock, struct old_timespec32 *ts) { @@ -29,6 +31,7 @@ int __vdso_clock_getres(clockid_t clock_id, { return __cvdso_clock_getres_time32(clock_id, res); } +#endif /* CONFIG_COMPAT_32BIT_TIME */ int __vdso_clock_gettime64(clockid_t clock, struct __kernel_timespec *ts) |
