xref: /openbmc/linux/drivers/pinctrl/spear/pinctrl-spear310.c (revision c900529f3d9161bfde5cca0754f83b4d3c3e0220)
152130b60SViresh Kumar /*
252130b60SViresh Kumar  * Driver for the ST Microelectronics SPEAr310 pinmux
352130b60SViresh Kumar  *
452130b60SViresh Kumar  * Copyright (C) 2012 ST Microelectronics
5da89947bSViresh Kumar  * Viresh Kumar <vireshk@kernel.org>
652130b60SViresh Kumar  *
752130b60SViresh Kumar  * This file is licensed under the terms of the GNU General Public
852130b60SViresh Kumar  * License version 2. This program is licensed "as is" without any
952130b60SViresh Kumar  * warranty of any kind, whether express or implied.
1052130b60SViresh Kumar  */
1152130b60SViresh Kumar 
1252130b60SViresh Kumar #include <linux/err.h>
1352130b60SViresh Kumar #include <linux/init.h>
14*060f03e9SRob Herring #include <linux/mod_devicetable.h>
1552130b60SViresh Kumar #include <linux/platform_device.h>
1652130b60SViresh Kumar #include "pinctrl-spear3xx.h"
1752130b60SViresh Kumar 
1852130b60SViresh Kumar #define DRIVER_NAME "spear310-pinmux"
1952130b60SViresh Kumar 
2052130b60SViresh Kumar /* addresses */
2152130b60SViresh Kumar #define PMX_CONFIG_REG			0x08
2252130b60SViresh Kumar 
2352130b60SViresh Kumar /* emi_cs_0_to_5_pins */
2452130b60SViresh Kumar static const unsigned emi_cs_0_to_5_pins[] = { 45, 46, 47, 48, 49, 50 };
2552130b60SViresh Kumar static struct spear_muxreg emi_cs_0_to_5_muxreg[] = {
2652130b60SViresh Kumar 	{
2752130b60SViresh Kumar 		.reg = PMX_CONFIG_REG,
2852130b60SViresh Kumar 		.mask = PMX_TIMER_0_1_MASK | PMX_TIMER_2_3_MASK,
2952130b60SViresh Kumar 		.val = 0,
3052130b60SViresh Kumar 	},
3152130b60SViresh Kumar };
3252130b60SViresh Kumar 
3352130b60SViresh Kumar static struct spear_modemux emi_cs_0_to_5_modemux[] = {
3452130b60SViresh Kumar 	{
3552130b60SViresh Kumar 		.muxregs = emi_cs_0_to_5_muxreg,
3652130b60SViresh Kumar 		.nmuxregs = ARRAY_SIZE(emi_cs_0_to_5_muxreg),
3752130b60SViresh Kumar 	},
3852130b60SViresh Kumar };
3952130b60SViresh Kumar 
4052130b60SViresh Kumar static struct spear_pingroup emi_cs_0_to_5_pingroup = {
4152130b60SViresh Kumar 	.name = "emi_cs_0_to_5_grp",
4252130b60SViresh Kumar 	.pins = emi_cs_0_to_5_pins,
4352130b60SViresh Kumar 	.npins = ARRAY_SIZE(emi_cs_0_to_5_pins),
4452130b60SViresh Kumar 	.modemuxs = emi_cs_0_to_5_modemux,
4552130b60SViresh Kumar 	.nmodemuxs = ARRAY_SIZE(emi_cs_0_to_5_modemux),
4652130b60SViresh Kumar };
4752130b60SViresh Kumar 
4852130b60SViresh Kumar static const char *const emi_cs_0_to_5_grps[] = { "emi_cs_0_to_5_grp" };
4952130b60SViresh Kumar static struct spear_function emi_cs_0_to_5_function = {
5052130b60SViresh Kumar 	.name = "emi",
5152130b60SViresh Kumar 	.groups = emi_cs_0_to_5_grps,
5252130b60SViresh Kumar 	.ngroups = ARRAY_SIZE(emi_cs_0_to_5_grps),
5352130b60SViresh Kumar };
5452130b60SViresh Kumar 
5552130b60SViresh Kumar /* uart1_pins */
5652130b60SViresh Kumar static const unsigned uart1_pins[] = { 0, 1 };
5752130b60SViresh Kumar static struct spear_muxreg uart1_muxreg[] = {
5852130b60SViresh Kumar 	{
5952130b60SViresh Kumar 		.reg = PMX_CONFIG_REG,
6052130b60SViresh Kumar 		.mask = PMX_FIRDA_MASK,
6152130b60SViresh Kumar 		.val = 0,
6252130b60SViresh Kumar 	},
6352130b60SViresh Kumar };
6452130b60SViresh Kumar 
6552130b60SViresh Kumar static struct spear_modemux uart1_modemux[] = {
6652130b60SViresh Kumar 	{
6752130b60SViresh Kumar 		.muxregs = uart1_muxreg,
6852130b60SViresh Kumar 		.nmuxregs = ARRAY_SIZE(uart1_muxreg),
6952130b60SViresh Kumar 	},
7052130b60SViresh Kumar };
7152130b60SViresh Kumar 
7252130b60SViresh Kumar static struct spear_pingroup uart1_pingroup = {
7352130b60SViresh Kumar 	.name = "uart1_grp",
7452130b60SViresh Kumar 	.pins = uart1_pins,
7552130b60SViresh Kumar 	.npins = ARRAY_SIZE(uart1_pins),
7652130b60SViresh Kumar 	.modemuxs = uart1_modemux,
7752130b60SViresh Kumar 	.nmodemuxs = ARRAY_SIZE(uart1_modemux),
7852130b60SViresh Kumar };
7952130b60SViresh Kumar 
8052130b60SViresh Kumar static const char *const uart1_grps[] = { "uart1_grp" };
8152130b60SViresh Kumar static struct spear_function uart1_function = {
8252130b60SViresh Kumar 	.name = "uart1",
8352130b60SViresh Kumar 	.groups = uart1_grps,
8452130b60SViresh Kumar 	.ngroups = ARRAY_SIZE(uart1_grps),
8552130b60SViresh Kumar };
8652130b60SViresh Kumar 
8752130b60SViresh Kumar /* uart2_pins */
8852130b60SViresh Kumar static const unsigned uart2_pins[] = { 43, 44 };
8952130b60SViresh Kumar static struct spear_muxreg uart2_muxreg[] = {
9052130b60SViresh Kumar 	{
9152130b60SViresh Kumar 		.reg = PMX_CONFIG_REG,
9252130b60SViresh Kumar 		.mask = PMX_TIMER_0_1_MASK,
9352130b60SViresh Kumar 		.val = 0,
9452130b60SViresh Kumar 	},
9552130b60SViresh Kumar };
9652130b60SViresh Kumar 
9752130b60SViresh Kumar static struct spear_modemux uart2_modemux[] = {
9852130b60SViresh Kumar 	{
9952130b60SViresh Kumar 		.muxregs = uart2_muxreg,
10052130b60SViresh Kumar 		.nmuxregs = ARRAY_SIZE(uart2_muxreg),
10152130b60SViresh Kumar 	},
10252130b60SViresh Kumar };
10352130b60SViresh Kumar 
10452130b60SViresh Kumar static struct spear_pingroup uart2_pingroup = {
10552130b60SViresh Kumar 	.name = "uart2_grp",
10652130b60SViresh Kumar 	.pins = uart2_pins,
10752130b60SViresh Kumar 	.npins = ARRAY_SIZE(uart2_pins),
10852130b60SViresh Kumar 	.modemuxs = uart2_modemux,
10952130b60SViresh Kumar 	.nmodemuxs = ARRAY_SIZE(uart2_modemux),
11052130b60SViresh Kumar };
11152130b60SViresh Kumar 
11252130b60SViresh Kumar static const char *const uart2_grps[] = { "uart2_grp" };
11352130b60SViresh Kumar static struct spear_function uart2_function = {
11452130b60SViresh Kumar 	.name = "uart2",
11552130b60SViresh Kumar 	.groups = uart2_grps,
11652130b60SViresh Kumar 	.ngroups = ARRAY_SIZE(uart2_grps),
11752130b60SViresh Kumar };
11852130b60SViresh Kumar 
11952130b60SViresh Kumar /* uart3_pins */
12052130b60SViresh Kumar static const unsigned uart3_pins[] = { 37, 38 };
12152130b60SViresh Kumar static struct spear_muxreg uart3_muxreg[] = {
12252130b60SViresh Kumar 	{
12352130b60SViresh Kumar 		.reg = PMX_CONFIG_REG,
12452130b60SViresh Kumar 		.mask = PMX_UART0_MODEM_MASK,
12552130b60SViresh Kumar 		.val = 0,
12652130b60SViresh Kumar 	},
12752130b60SViresh Kumar };
12852130b60SViresh Kumar 
12952130b60SViresh Kumar static struct spear_modemux uart3_modemux[] = {
13052130b60SViresh Kumar 	{
13152130b60SViresh Kumar 		.muxregs = uart3_muxreg,
13252130b60SViresh Kumar 		.nmuxregs = ARRAY_SIZE(uart3_muxreg),
13352130b60SViresh Kumar 	},
13452130b60SViresh Kumar };
13552130b60SViresh Kumar 
13652130b60SViresh Kumar static struct spear_pingroup uart3_pingroup = {
13752130b60SViresh Kumar 	.name = "uart3_grp",
13852130b60SViresh Kumar 	.pins = uart3_pins,
13952130b60SViresh Kumar 	.npins = ARRAY_SIZE(uart3_pins),
14052130b60SViresh Kumar 	.modemuxs = uart3_modemux,
14152130b60SViresh Kumar 	.nmodemuxs = ARRAY_SIZE(uart3_modemux),
14252130b60SViresh Kumar };
14352130b60SViresh Kumar 
14452130b60SViresh Kumar static const char *const uart3_grps[] = { "uart3_grp" };
14552130b60SViresh Kumar static struct spear_function uart3_function = {
14652130b60SViresh Kumar 	.name = "uart3",
14752130b60SViresh Kumar 	.groups = uart3_grps,
14852130b60SViresh Kumar 	.ngroups = ARRAY_SIZE(uart3_grps),
14952130b60SViresh Kumar };
15052130b60SViresh Kumar 
15152130b60SViresh Kumar /* uart4_pins */
15252130b60SViresh Kumar static const unsigned uart4_pins[] = { 39, 40 };
15352130b60SViresh Kumar static struct spear_muxreg uart4_muxreg[] = {
15452130b60SViresh Kumar 	{
15552130b60SViresh Kumar 		.reg = PMX_CONFIG_REG,
15652130b60SViresh Kumar 		.mask = PMX_UART0_MODEM_MASK,
15752130b60SViresh Kumar 		.val = 0,
15852130b60SViresh Kumar 	},
15952130b60SViresh Kumar };
16052130b60SViresh Kumar 
16152130b60SViresh Kumar static struct spear_modemux uart4_modemux[] = {
16252130b60SViresh Kumar 	{
16352130b60SViresh Kumar 		.muxregs = uart4_muxreg,
16452130b60SViresh Kumar 		.nmuxregs = ARRAY_SIZE(uart4_muxreg),
16552130b60SViresh Kumar 	},
16652130b60SViresh Kumar };
16752130b60SViresh Kumar 
16852130b60SViresh Kumar static struct spear_pingroup uart4_pingroup = {
16952130b60SViresh Kumar 	.name = "uart4_grp",
17052130b60SViresh Kumar 	.pins = uart4_pins,
17152130b60SViresh Kumar 	.npins = ARRAY_SIZE(uart4_pins),
17252130b60SViresh Kumar 	.modemuxs = uart4_modemux,
17352130b60SViresh Kumar 	.nmodemuxs = ARRAY_SIZE(uart4_modemux),
17452130b60SViresh Kumar };
17552130b60SViresh Kumar 
17652130b60SViresh Kumar static const char *const uart4_grps[] = { "uart4_grp" };
17752130b60SViresh Kumar static struct spear_function uart4_function = {
17852130b60SViresh Kumar 	.name = "uart4",
17952130b60SViresh Kumar 	.groups = uart4_grps,
18052130b60SViresh Kumar 	.ngroups = ARRAY_SIZE(uart4_grps),
18152130b60SViresh Kumar };
18252130b60SViresh Kumar 
18352130b60SViresh Kumar /* uart5_pins */
18452130b60SViresh Kumar static const unsigned uart5_pins[] = { 41, 42 };
18552130b60SViresh Kumar static struct spear_muxreg uart5_muxreg[] = {
18652130b60SViresh Kumar 	{
18752130b60SViresh Kumar 		.reg = PMX_CONFIG_REG,
18852130b60SViresh Kumar 		.mask = PMX_UART0_MODEM_MASK,
18952130b60SViresh Kumar 		.val = 0,
19052130b60SViresh Kumar 	},
19152130b60SViresh Kumar };
19252130b60SViresh Kumar 
19352130b60SViresh Kumar static struct spear_modemux uart5_modemux[] = {
19452130b60SViresh Kumar 	{
19552130b60SViresh Kumar 		.muxregs = uart5_muxreg,
19652130b60SViresh Kumar 		.nmuxregs = ARRAY_SIZE(uart5_muxreg),
19752130b60SViresh Kumar 	},
19852130b60SViresh Kumar };
19952130b60SViresh Kumar 
20052130b60SViresh Kumar static struct spear_pingroup uart5_pingroup = {
20152130b60SViresh Kumar 	.name = "uart5_grp",
20252130b60SViresh Kumar 	.pins = uart5_pins,
20352130b60SViresh Kumar 	.npins = ARRAY_SIZE(uart5_pins),
20452130b60SViresh Kumar 	.modemuxs = uart5_modemux,
20552130b60SViresh Kumar 	.nmodemuxs = ARRAY_SIZE(uart5_modemux),
20652130b60SViresh Kumar };
20752130b60SViresh Kumar 
20852130b60SViresh Kumar static const char *const uart5_grps[] = { "uart5_grp" };
20952130b60SViresh Kumar static struct spear_function uart5_function = {
21052130b60SViresh Kumar 	.name = "uart5",
21152130b60SViresh Kumar 	.groups = uart5_grps,
21252130b60SViresh Kumar 	.ngroups = ARRAY_SIZE(uart5_grps),
21352130b60SViresh Kumar };
21452130b60SViresh Kumar 
21552130b60SViresh Kumar /* fsmc_pins */
21652130b60SViresh Kumar static const unsigned fsmc_pins[] = { 34, 35, 36 };
21752130b60SViresh Kumar static struct spear_muxreg fsmc_muxreg[] = {
21852130b60SViresh Kumar 	{
21952130b60SViresh Kumar 		.reg = PMX_CONFIG_REG,
22052130b60SViresh Kumar 		.mask = PMX_SSP_CS_MASK,
22152130b60SViresh Kumar 		.val = 0,
22252130b60SViresh Kumar 	},
22352130b60SViresh Kumar };
22452130b60SViresh Kumar 
22552130b60SViresh Kumar static struct spear_modemux fsmc_modemux[] = {
22652130b60SViresh Kumar 	{
22752130b60SViresh Kumar 		.muxregs = fsmc_muxreg,
22852130b60SViresh Kumar 		.nmuxregs = ARRAY_SIZE(fsmc_muxreg),
22952130b60SViresh Kumar 	},
23052130b60SViresh Kumar };
23152130b60SViresh Kumar 
23252130b60SViresh Kumar static struct spear_pingroup fsmc_pingroup = {
23352130b60SViresh Kumar 	.name = "fsmc_grp",
23452130b60SViresh Kumar 	.pins = fsmc_pins,
23552130b60SViresh Kumar 	.npins = ARRAY_SIZE(fsmc_pins),
23652130b60SViresh Kumar 	.modemuxs = fsmc_modemux,
23752130b60SViresh Kumar 	.nmodemuxs = ARRAY_SIZE(fsmc_modemux),
23852130b60SViresh Kumar };
23952130b60SViresh Kumar 
24052130b60SViresh Kumar static const char *const fsmc_grps[] = { "fsmc_grp" };
24152130b60SViresh Kumar static struct spear_function fsmc_function = {
24252130b60SViresh Kumar 	.name = "fsmc",
24352130b60SViresh Kumar 	.groups = fsmc_grps,
24452130b60SViresh Kumar 	.ngroups = ARRAY_SIZE(fsmc_grps),
24552130b60SViresh Kumar };
24652130b60SViresh Kumar 
24752130b60SViresh Kumar /* rs485_0_pins */
24852130b60SViresh Kumar static const unsigned rs485_0_pins[] = { 19, 20, 21, 22, 23 };
24952130b60SViresh Kumar static struct spear_muxreg rs485_0_muxreg[] = {
25052130b60SViresh Kumar 	{
25152130b60SViresh Kumar 		.reg = PMX_CONFIG_REG,
25252130b60SViresh Kumar 		.mask = PMX_MII_MASK,
25352130b60SViresh Kumar 		.val = 0,
25452130b60SViresh Kumar 	},
25552130b60SViresh Kumar };
25652130b60SViresh Kumar 
25752130b60SViresh Kumar static struct spear_modemux rs485_0_modemux[] = {
25852130b60SViresh Kumar 	{
25952130b60SViresh Kumar 		.muxregs = rs485_0_muxreg,
26052130b60SViresh Kumar 		.nmuxregs = ARRAY_SIZE(rs485_0_muxreg),
26152130b60SViresh Kumar 	},
26252130b60SViresh Kumar };
26352130b60SViresh Kumar 
26452130b60SViresh Kumar static struct spear_pingroup rs485_0_pingroup = {
26552130b60SViresh Kumar 	.name = "rs485_0_grp",
26652130b60SViresh Kumar 	.pins = rs485_0_pins,
26752130b60SViresh Kumar 	.npins = ARRAY_SIZE(rs485_0_pins),
26852130b60SViresh Kumar 	.modemuxs = rs485_0_modemux,
26952130b60SViresh Kumar 	.nmodemuxs = ARRAY_SIZE(rs485_0_modemux),
27052130b60SViresh Kumar };
27152130b60SViresh Kumar 
27252130b60SViresh Kumar static const char *const rs485_0_grps[] = { "rs485_0" };
27352130b60SViresh Kumar static struct spear_function rs485_0_function = {
27452130b60SViresh Kumar 	.name = "rs485_0",
27552130b60SViresh Kumar 	.groups = rs485_0_grps,
27652130b60SViresh Kumar 	.ngroups = ARRAY_SIZE(rs485_0_grps),
27752130b60SViresh Kumar };
27852130b60SViresh Kumar 
27952130b60SViresh Kumar /* rs485_1_pins */
28052130b60SViresh Kumar static const unsigned rs485_1_pins[] = { 14, 15, 16, 17, 18 };
28152130b60SViresh Kumar static struct spear_muxreg rs485_1_muxreg[] = {
28252130b60SViresh Kumar 	{
28352130b60SViresh Kumar 		.reg = PMX_CONFIG_REG,
28452130b60SViresh Kumar 		.mask = PMX_MII_MASK,
28552130b60SViresh Kumar 		.val = 0,
28652130b60SViresh Kumar 	},
28752130b60SViresh Kumar };
28852130b60SViresh Kumar 
28952130b60SViresh Kumar static struct spear_modemux rs485_1_modemux[] = {
29052130b60SViresh Kumar 	{
29152130b60SViresh Kumar 		.muxregs = rs485_1_muxreg,
29252130b60SViresh Kumar 		.nmuxregs = ARRAY_SIZE(rs485_1_muxreg),
29352130b60SViresh Kumar 	},
29452130b60SViresh Kumar };
29552130b60SViresh Kumar 
29652130b60SViresh Kumar static struct spear_pingroup rs485_1_pingroup = {
29752130b60SViresh Kumar 	.name = "rs485_1_grp",
29852130b60SViresh Kumar 	.pins = rs485_1_pins,
29952130b60SViresh Kumar 	.npins = ARRAY_SIZE(rs485_1_pins),
30052130b60SViresh Kumar 	.modemuxs = rs485_1_modemux,
30152130b60SViresh Kumar 	.nmodemuxs = ARRAY_SIZE(rs485_1_modemux),
30252130b60SViresh Kumar };
30352130b60SViresh Kumar 
30452130b60SViresh Kumar static const char *const rs485_1_grps[] = { "rs485_1" };
30552130b60SViresh Kumar static struct spear_function rs485_1_function = {
30652130b60SViresh Kumar 	.name = "rs485_1",
30752130b60SViresh Kumar 	.groups = rs485_1_grps,
30852130b60SViresh Kumar 	.ngroups = ARRAY_SIZE(rs485_1_grps),
30952130b60SViresh Kumar };
31052130b60SViresh Kumar 
31152130b60SViresh Kumar /* tdm_pins */
31252130b60SViresh Kumar static const unsigned tdm_pins[] = { 10, 11, 12, 13 };
31352130b60SViresh Kumar static struct spear_muxreg tdm_muxreg[] = {
31452130b60SViresh Kumar 	{
31552130b60SViresh Kumar 		.reg = PMX_CONFIG_REG,
31652130b60SViresh Kumar 		.mask = PMX_MII_MASK,
31752130b60SViresh Kumar 		.val = 0,
31852130b60SViresh Kumar 	},
31952130b60SViresh Kumar };
32052130b60SViresh Kumar 
32152130b60SViresh Kumar static struct spear_modemux tdm_modemux[] = {
32252130b60SViresh Kumar 	{
32352130b60SViresh Kumar 		.muxregs = tdm_muxreg,
32452130b60SViresh Kumar 		.nmuxregs = ARRAY_SIZE(tdm_muxreg),
32552130b60SViresh Kumar 	},
32652130b60SViresh Kumar };
32752130b60SViresh Kumar 
32852130b60SViresh Kumar static struct spear_pingroup tdm_pingroup = {
32952130b60SViresh Kumar 	.name = "tdm_grp",
33052130b60SViresh Kumar 	.pins = tdm_pins,
33152130b60SViresh Kumar 	.npins = ARRAY_SIZE(tdm_pins),
33252130b60SViresh Kumar 	.modemuxs = tdm_modemux,
33352130b60SViresh Kumar 	.nmodemuxs = ARRAY_SIZE(tdm_modemux),
33452130b60SViresh Kumar };
33552130b60SViresh Kumar 
33652130b60SViresh Kumar static const char *const tdm_grps[] = { "tdm_grp" };
33752130b60SViresh Kumar static struct spear_function tdm_function = {
33852130b60SViresh Kumar 	.name = "tdm",
33952130b60SViresh Kumar 	.groups = tdm_grps,
34052130b60SViresh Kumar 	.ngroups = ARRAY_SIZE(tdm_grps),
34152130b60SViresh Kumar };
34252130b60SViresh Kumar 
34352130b60SViresh Kumar /* pingroups */
34452130b60SViresh Kumar static struct spear_pingroup *spear310_pingroups[] = {
34552130b60SViresh Kumar 	SPEAR3XX_COMMON_PINGROUPS,
34652130b60SViresh Kumar 	&emi_cs_0_to_5_pingroup,
34752130b60SViresh Kumar 	&uart1_pingroup,
34852130b60SViresh Kumar 	&uart2_pingroup,
34952130b60SViresh Kumar 	&uart3_pingroup,
35052130b60SViresh Kumar 	&uart4_pingroup,
35152130b60SViresh Kumar 	&uart5_pingroup,
35252130b60SViresh Kumar 	&fsmc_pingroup,
35352130b60SViresh Kumar 	&rs485_0_pingroup,
35452130b60SViresh Kumar 	&rs485_1_pingroup,
35552130b60SViresh Kumar 	&tdm_pingroup,
35652130b60SViresh Kumar };
35752130b60SViresh Kumar 
35852130b60SViresh Kumar /* functions */
35952130b60SViresh Kumar static struct spear_function *spear310_functions[] = {
36052130b60SViresh Kumar 	SPEAR3XX_COMMON_FUNCTIONS,
36152130b60SViresh Kumar 	&emi_cs_0_to_5_function,
36252130b60SViresh Kumar 	&uart1_function,
36352130b60SViresh Kumar 	&uart2_function,
36452130b60SViresh Kumar 	&uart3_function,
36552130b60SViresh Kumar 	&uart4_function,
36652130b60SViresh Kumar 	&uart5_function,
36752130b60SViresh Kumar 	&fsmc_function,
36852130b60SViresh Kumar 	&rs485_0_function,
36952130b60SViresh Kumar 	&rs485_1_function,
37052130b60SViresh Kumar 	&tdm_function,
37152130b60SViresh Kumar };
37252130b60SViresh Kumar 
3735dfe10b4SKiran Padwal static const struct of_device_id spear310_pinctrl_of_match[] = {
37452130b60SViresh Kumar 	{
37552130b60SViresh Kumar 		.compatible = "st,spear310-pinmux",
37652130b60SViresh Kumar 	},
37752130b60SViresh Kumar 	{},
37852130b60SViresh Kumar };
37952130b60SViresh Kumar 
spear310_pinctrl_probe(struct platform_device * pdev)380150632b0SGreg Kroah-Hartman static int spear310_pinctrl_probe(struct platform_device *pdev)
38152130b60SViresh Kumar {
38252130b60SViresh Kumar 	spear3xx_machdata.groups = spear310_pingroups;
38352130b60SViresh Kumar 	spear3xx_machdata.ngroups = ARRAY_SIZE(spear310_pingroups);
38452130b60SViresh Kumar 	spear3xx_machdata.functions = spear310_functions;
38552130b60SViresh Kumar 	spear3xx_machdata.nfunctions = ARRAY_SIZE(spear310_functions);
38652130b60SViresh Kumar 
38752130b60SViresh Kumar 	pmx_init_addr(&spear3xx_machdata, PMX_CONFIG_REG);
388f4f8e563SViresh Kumar 	pmx_init_gpio_pingroup_addr(spear3xx_machdata.gpio_pingroups,
389f4f8e563SViresh Kumar 			spear3xx_machdata.ngpio_pingroups, PMX_CONFIG_REG);
39052130b60SViresh Kumar 
39152130b60SViresh Kumar 	spear3xx_machdata.modes_supported = false;
39252130b60SViresh Kumar 
39343b7229eSLiu Shixin 	return spear_pinctrl_probe(pdev, &spear3xx_machdata);
39452130b60SViresh Kumar }
39552130b60SViresh Kumar 
39652130b60SViresh Kumar static struct platform_driver spear310_pinctrl_driver = {
39752130b60SViresh Kumar 	.driver = {
39852130b60SViresh Kumar 		.name = DRIVER_NAME,
39952130b60SViresh Kumar 		.of_match_table = spear310_pinctrl_of_match,
40052130b60SViresh Kumar 	},
40152130b60SViresh Kumar 	.probe = spear310_pinctrl_probe,
40252130b60SViresh Kumar };
40352130b60SViresh Kumar 
spear310_pinctrl_init(void)40452130b60SViresh Kumar static int __init spear310_pinctrl_init(void)
40552130b60SViresh Kumar {
40652130b60SViresh Kumar 	return platform_driver_register(&spear310_pinctrl_driver);
40752130b60SViresh Kumar }
40852130b60SViresh Kumar arch_initcall(spear310_pinctrl_init);
409