Skip to content

Commit a49a871

Browse files
parakalinusw
authored andcommitted
pinctrl: ralink: move RT288X SoC pinmux config into a new 'pinctrl-rt288x.c' file
Move all related code for SoC RT288X into a new driver located in 'pinctrl-rt288x.c' source file. Signed-off-by: Sergio Paracuellos <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
1 parent 745ec43 commit a49a871

File tree

5 files changed

+66
-30
lines changed

5 files changed

+66
-30
lines changed

arch/mips/include/asm/mach-ralink/rt288x.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,6 @@
3333
#define SYSTEM_CONFIG_CPUCLK_280 0x2
3434
#define SYSTEM_CONFIG_CPUCLK_300 0x3
3535

36-
#define RT2880_GPIO_MODE_I2C BIT(0)
37-
#define RT2880_GPIO_MODE_UART0 BIT(1)
38-
#define RT2880_GPIO_MODE_SPI BIT(2)
39-
#define RT2880_GPIO_MODE_UART1 BIT(3)
40-
#define RT2880_GPIO_MODE_JTAG BIT(4)
41-
#define RT2880_GPIO_MODE_MDIO BIT(5)
42-
#define RT2880_GPIO_MODE_SDRAM BIT(6)
43-
#define RT2880_GPIO_MODE_PCI BIT(7)
44-
4536
#define CLKCFG_SRAM_CS_N_WDT BIT(9)
4637

4738
#define RT2880_SDRAM_BASE 0x08000000

arch/mips/ralink/rt288x.c

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,29 +14,9 @@
1414
#include <asm/mipsregs.h>
1515
#include <asm/mach-ralink/ralink_regs.h>
1616
#include <asm/mach-ralink/rt288x.h>
17-
#include <asm/mach-ralink/pinmux.h>
1817

1918
#include "common.h"
2019

21-
static struct rt2880_pmx_func i2c_func[] = { FUNC("i2c", 0, 1, 2) };
22-
static struct rt2880_pmx_func spi_func[] = { FUNC("spi", 0, 3, 4) };
23-
static struct rt2880_pmx_func uartlite_func[] = { FUNC("uartlite", 0, 7, 8) };
24-
static struct rt2880_pmx_func jtag_func[] = { FUNC("jtag", 0, 17, 5) };
25-
static struct rt2880_pmx_func mdio_func[] = { FUNC("mdio", 0, 22, 2) };
26-
static struct rt2880_pmx_func sdram_func[] = { FUNC("sdram", 0, 24, 16) };
27-
static struct rt2880_pmx_func pci_func[] = { FUNC("pci", 0, 40, 32) };
28-
29-
static struct rt2880_pmx_group rt2880_pinmux_data_act[] = {
30-
GRP("i2c", i2c_func, 1, RT2880_GPIO_MODE_I2C),
31-
GRP("spi", spi_func, 1, RT2880_GPIO_MODE_SPI),
32-
GRP("uartlite", uartlite_func, 1, RT2880_GPIO_MODE_UART0),
33-
GRP("jtag", jtag_func, 1, RT2880_GPIO_MODE_JTAG),
34-
GRP("mdio", mdio_func, 1, RT2880_GPIO_MODE_MDIO),
35-
GRP("sdram", sdram_func, 1, RT2880_GPIO_MODE_SDRAM),
36-
GRP("pci", pci_func, 1, RT2880_GPIO_MODE_PCI),
37-
{ 0 }
38-
};
39-
4020
void __init ralink_clk_init(void)
4121
{
4222
unsigned long cpu_rate, wmac_rate = 40000000;
@@ -106,6 +86,5 @@ void __init prom_soc_init(struct ralink_soc_info *soc_info)
10686
soc_info->mem_size_min = RT2880_MEM_SIZE_MIN;
10787
soc_info->mem_size_max = RT2880_MEM_SIZE_MAX;
10888

109-
rt2880_pinmux_data = rt2880_pinmux_data_act;
11089
ralink_soc = RT2880_SOC;
11190
}

drivers/pinctrl/ralink/Kconfig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ config PINCTRL_MT7621
2121
depends on RALINK && SOC_MT7621
2222
select PINCTRL_RT2880
2323

24+
config PINCTRL_RT288X
25+
bool "RT288X pinctrl driver for RALINK/Mediatek SOCs"
26+
depends on RALINK && SOC_RT288X
27+
select PINCTRL_RT2880
28+
2429
config PINCTRL_RT305X
2530
bool "RT305X pinctrl driver for RALINK/Mediatek SOCs"
2631
depends on RALINK && SOC_RT305X

drivers/pinctrl/ralink/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ obj-$(CONFIG_PINCTRL_RT2880) += pinctrl-rt2880.o
33

44
obj-$(CONFIG_PINCTRL_MT7620) += pinctrl-mt7620.o
55
obj-$(CONFIG_PINCTRL_MT7621) += pinctrl-mt7621.o
6+
obj-$(CONFIG_PINCTRL_RT288X) += pinctrl-rt288x.o
67
obj-$(CONFIG_PINCTRL_RT305X) += pinctrl-rt305x.o
78
obj-$(CONFIG_PINCTRL_RT3883) += pinctrl-rt3883.o
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
// SPDX-License-Identifier: GPL-2.0-only
2+
3+
#include <linux/bitops.h>
4+
#include <linux/module.h>
5+
#include <linux/platform_device.h>
6+
#include <linux/of.h>
7+
#include "pinmux.h"
8+
9+
#define RT2880_GPIO_MODE_I2C BIT(0)
10+
#define RT2880_GPIO_MODE_UART0 BIT(1)
11+
#define RT2880_GPIO_MODE_SPI BIT(2)
12+
#define RT2880_GPIO_MODE_UART1 BIT(3)
13+
#define RT2880_GPIO_MODE_JTAG BIT(4)
14+
#define RT2880_GPIO_MODE_MDIO BIT(5)
15+
#define RT2880_GPIO_MODE_SDRAM BIT(6)
16+
#define RT2880_GPIO_MODE_PCI BIT(7)
17+
18+
static struct rt2880_pmx_func i2c_func[] = { FUNC("i2c", 0, 1, 2) };
19+
static struct rt2880_pmx_func spi_func[] = { FUNC("spi", 0, 3, 4) };
20+
static struct rt2880_pmx_func uartlite_func[] = { FUNC("uartlite", 0, 7, 8) };
21+
static struct rt2880_pmx_func jtag_func[] = { FUNC("jtag", 0, 17, 5) };
22+
static struct rt2880_pmx_func mdio_func[] = { FUNC("mdio", 0, 22, 2) };
23+
static struct rt2880_pmx_func sdram_func[] = { FUNC("sdram", 0, 24, 16) };
24+
static struct rt2880_pmx_func pci_func[] = { FUNC("pci", 0, 40, 32) };
25+
26+
static struct rt2880_pmx_group rt2880_pinmux_data_act[] = {
27+
GRP("i2c", i2c_func, 1, RT2880_GPIO_MODE_I2C),
28+
GRP("spi", spi_func, 1, RT2880_GPIO_MODE_SPI),
29+
GRP("uartlite", uartlite_func, 1, RT2880_GPIO_MODE_UART0),
30+
GRP("jtag", jtag_func, 1, RT2880_GPIO_MODE_JTAG),
31+
GRP("mdio", mdio_func, 1, RT2880_GPIO_MODE_MDIO),
32+
GRP("sdram", sdram_func, 1, RT2880_GPIO_MODE_SDRAM),
33+
GRP("pci", pci_func, 1, RT2880_GPIO_MODE_PCI),
34+
{ 0 }
35+
};
36+
37+
static int rt288x_pinmux_probe(struct platform_device *pdev)
38+
{
39+
return rt2880_pinmux_init(pdev, rt2880_pinmux_data_act);
40+
}
41+
42+
static const struct of_device_id rt288x_pinmux_match[] = {
43+
{ .compatible = "ralink,rt2880-pinmux" },
44+
{}
45+
};
46+
MODULE_DEVICE_TABLE(of, rt288x_pinmux_match);
47+
48+
static struct platform_driver rt288x_pinmux_driver = {
49+
.probe = rt288x_pinmux_probe,
50+
.driver = {
51+
.name = "rt2880-pinmux",
52+
.of_match_table = rt288x_pinmux_match,
53+
},
54+
};
55+
56+
static int __init rt288x_pinmux_init(void)
57+
{
58+
return platform_driver_register(&rt288x_pinmux_driver);
59+
}
60+
core_initcall_sync(rt288x_pinmux_init);

0 commit comments

Comments
 (0)