xref: /openbmc/linux/drivers/pinctrl/spear/pinctrl-spear3xx.c (revision e5451c8f8330e03ad3cfa16048b4daf961af434f)
152130b60SViresh Kumar /*
252130b60SViresh Kumar  * Driver for the ST Microelectronics SPEAr3xx pinmux
352130b60SViresh Kumar  *
452130b60SViresh Kumar  * Copyright (C) 2012 ST Microelectronics
5*da89947bSViresh 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/pinctrl/pinctrl.h>
1352130b60SViresh Kumar 
1452130b60SViresh Kumar #include "pinctrl-spear3xx.h"
1552130b60SViresh Kumar 
1652130b60SViresh Kumar /* pins */
1752130b60SViresh Kumar static const struct pinctrl_pin_desc spear3xx_pins[] = {
18d1e77afeSViresh Kumar 	SPEAR_PIN_0_TO_101,
1952130b60SViresh Kumar };
2052130b60SViresh Kumar 
2152130b60SViresh Kumar /* firda_pins */
2252130b60SViresh Kumar static const unsigned firda_pins[] = { 0, 1 };
2352130b60SViresh Kumar static struct spear_muxreg firda_muxreg[] = {
2452130b60SViresh Kumar 	{
2552130b60SViresh Kumar 		.reg = -1,
2652130b60SViresh Kumar 		.mask = PMX_FIRDA_MASK,
2752130b60SViresh Kumar 		.val = PMX_FIRDA_MASK,
2852130b60SViresh Kumar 	},
2952130b60SViresh Kumar };
3052130b60SViresh Kumar 
3152130b60SViresh Kumar static struct spear_modemux firda_modemux[] = {
3252130b60SViresh Kumar 	{
3352130b60SViresh Kumar 		.modes = ~0,
3452130b60SViresh Kumar 		.muxregs = firda_muxreg,
3552130b60SViresh Kumar 		.nmuxregs = ARRAY_SIZE(firda_muxreg),
3652130b60SViresh Kumar 	},
3752130b60SViresh Kumar };
3852130b60SViresh Kumar 
3952130b60SViresh Kumar struct spear_pingroup spear3xx_firda_pingroup = {
4052130b60SViresh Kumar 	.name = "firda_grp",
4152130b60SViresh Kumar 	.pins = firda_pins,
4252130b60SViresh Kumar 	.npins = ARRAY_SIZE(firda_pins),
4352130b60SViresh Kumar 	.modemuxs = firda_modemux,
4452130b60SViresh Kumar 	.nmodemuxs = ARRAY_SIZE(firda_modemux),
4552130b60SViresh Kumar };
4652130b60SViresh Kumar 
4752130b60SViresh Kumar static const char *const firda_grps[] = { "firda_grp" };
4852130b60SViresh Kumar struct spear_function spear3xx_firda_function = {
4952130b60SViresh Kumar 	.name = "firda",
5052130b60SViresh Kumar 	.groups = firda_grps,
5152130b60SViresh Kumar 	.ngroups = ARRAY_SIZE(firda_grps),
5252130b60SViresh Kumar };
5352130b60SViresh Kumar 
5452130b60SViresh Kumar /* i2c_pins */
5552130b60SViresh Kumar static const unsigned i2c_pins[] = { 4, 5 };
5652130b60SViresh Kumar static struct spear_muxreg i2c_muxreg[] = {
5752130b60SViresh Kumar 	{
5852130b60SViresh Kumar 		.reg = -1,
5952130b60SViresh Kumar 		.mask = PMX_I2C_MASK,
6052130b60SViresh Kumar 		.val = PMX_I2C_MASK,
6152130b60SViresh Kumar 	},
6252130b60SViresh Kumar };
6352130b60SViresh Kumar 
6452130b60SViresh Kumar static struct spear_modemux i2c_modemux[] = {
6552130b60SViresh Kumar 	{
6652130b60SViresh Kumar 		.modes = ~0,
6752130b60SViresh Kumar 		.muxregs = i2c_muxreg,
6852130b60SViresh Kumar 		.nmuxregs = ARRAY_SIZE(i2c_muxreg),
6952130b60SViresh Kumar 	},
7052130b60SViresh Kumar };
7152130b60SViresh Kumar 
7252130b60SViresh Kumar struct spear_pingroup spear3xx_i2c_pingroup = {
7352130b60SViresh Kumar 	.name = "i2c0_grp",
7452130b60SViresh Kumar 	.pins = i2c_pins,
7552130b60SViresh Kumar 	.npins = ARRAY_SIZE(i2c_pins),
7652130b60SViresh Kumar 	.modemuxs = i2c_modemux,
7752130b60SViresh Kumar 	.nmodemuxs = ARRAY_SIZE(i2c_modemux),
7852130b60SViresh Kumar };
7952130b60SViresh Kumar 
8052130b60SViresh Kumar static const char *const i2c_grps[] = { "i2c0_grp" };
8152130b60SViresh Kumar struct spear_function spear3xx_i2c_function = {
8252130b60SViresh Kumar 	.name = "i2c0",
8352130b60SViresh Kumar 	.groups = i2c_grps,
8452130b60SViresh Kumar 	.ngroups = ARRAY_SIZE(i2c_grps),
8552130b60SViresh Kumar };
8652130b60SViresh Kumar 
8752130b60SViresh Kumar /* ssp_cs_pins */
8852130b60SViresh Kumar static const unsigned ssp_cs_pins[] = { 34, 35, 36 };
8952130b60SViresh Kumar static struct spear_muxreg ssp_cs_muxreg[] = {
9052130b60SViresh Kumar 	{
9152130b60SViresh Kumar 		.reg = -1,
9252130b60SViresh Kumar 		.mask = PMX_SSP_CS_MASK,
9352130b60SViresh Kumar 		.val = PMX_SSP_CS_MASK,
9452130b60SViresh Kumar 	},
9552130b60SViresh Kumar };
9652130b60SViresh Kumar 
9752130b60SViresh Kumar static struct spear_modemux ssp_cs_modemux[] = {
9852130b60SViresh Kumar 	{
9952130b60SViresh Kumar 		.modes = ~0,
10052130b60SViresh Kumar 		.muxregs = ssp_cs_muxreg,
10152130b60SViresh Kumar 		.nmuxregs = ARRAY_SIZE(ssp_cs_muxreg),
10252130b60SViresh Kumar 	},
10352130b60SViresh Kumar };
10452130b60SViresh Kumar 
10552130b60SViresh Kumar struct spear_pingroup spear3xx_ssp_cs_pingroup = {
10652130b60SViresh Kumar 	.name = "ssp_cs_grp",
10752130b60SViresh Kumar 	.pins = ssp_cs_pins,
10852130b60SViresh Kumar 	.npins = ARRAY_SIZE(ssp_cs_pins),
10952130b60SViresh Kumar 	.modemuxs = ssp_cs_modemux,
11052130b60SViresh Kumar 	.nmodemuxs = ARRAY_SIZE(ssp_cs_modemux),
11152130b60SViresh Kumar };
11252130b60SViresh Kumar 
11352130b60SViresh Kumar static const char *const ssp_cs_grps[] = { "ssp_cs_grp" };
11452130b60SViresh Kumar struct spear_function spear3xx_ssp_cs_function = {
11552130b60SViresh Kumar 	.name = "ssp_cs",
11652130b60SViresh Kumar 	.groups = ssp_cs_grps,
11752130b60SViresh Kumar 	.ngroups = ARRAY_SIZE(ssp_cs_grps),
11852130b60SViresh Kumar };
11952130b60SViresh Kumar 
12052130b60SViresh Kumar /* ssp_pins */
12152130b60SViresh Kumar static const unsigned ssp_pins[] = { 6, 7, 8, 9 };
12252130b60SViresh Kumar static struct spear_muxreg ssp_muxreg[] = {
12352130b60SViresh Kumar 	{
12452130b60SViresh Kumar 		.reg = -1,
12552130b60SViresh Kumar 		.mask = PMX_SSP_MASK,
12652130b60SViresh Kumar 		.val = PMX_SSP_MASK,
12752130b60SViresh Kumar 	},
12852130b60SViresh Kumar };
12952130b60SViresh Kumar 
13052130b60SViresh Kumar static struct spear_modemux ssp_modemux[] = {
13152130b60SViresh Kumar 	{
13252130b60SViresh Kumar 		.modes = ~0,
13352130b60SViresh Kumar 		.muxregs = ssp_muxreg,
13452130b60SViresh Kumar 		.nmuxregs = ARRAY_SIZE(ssp_muxreg),
13552130b60SViresh Kumar 	},
13652130b60SViresh Kumar };
13752130b60SViresh Kumar 
13852130b60SViresh Kumar struct spear_pingroup spear3xx_ssp_pingroup = {
13952130b60SViresh Kumar 	.name = "ssp0_grp",
14052130b60SViresh Kumar 	.pins = ssp_pins,
14152130b60SViresh Kumar 	.npins = ARRAY_SIZE(ssp_pins),
14252130b60SViresh Kumar 	.modemuxs = ssp_modemux,
14352130b60SViresh Kumar 	.nmodemuxs = ARRAY_SIZE(ssp_modemux),
14452130b60SViresh Kumar };
14552130b60SViresh Kumar 
14652130b60SViresh Kumar static const char *const ssp_grps[] = { "ssp0_grp" };
14752130b60SViresh Kumar struct spear_function spear3xx_ssp_function = {
14852130b60SViresh Kumar 	.name = "ssp0",
14952130b60SViresh Kumar 	.groups = ssp_grps,
15052130b60SViresh Kumar 	.ngroups = ARRAY_SIZE(ssp_grps),
15152130b60SViresh Kumar };
15252130b60SViresh Kumar 
15352130b60SViresh Kumar /* mii_pins */
15452130b60SViresh Kumar static const unsigned mii_pins[] = { 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
15552130b60SViresh Kumar 	21, 22, 23, 24, 25, 26, 27 };
15652130b60SViresh Kumar static struct spear_muxreg mii_muxreg[] = {
15752130b60SViresh Kumar 	{
15852130b60SViresh Kumar 		.reg = -1,
15952130b60SViresh Kumar 		.mask = PMX_MII_MASK,
16052130b60SViresh Kumar 		.val = PMX_MII_MASK,
16152130b60SViresh Kumar 	},
16252130b60SViresh Kumar };
16352130b60SViresh Kumar 
16452130b60SViresh Kumar static struct spear_modemux mii_modemux[] = {
16552130b60SViresh Kumar 	{
16652130b60SViresh Kumar 		.modes = ~0,
16752130b60SViresh Kumar 		.muxregs = mii_muxreg,
16852130b60SViresh Kumar 		.nmuxregs = ARRAY_SIZE(mii_muxreg),
16952130b60SViresh Kumar 	},
17052130b60SViresh Kumar };
17152130b60SViresh Kumar 
17252130b60SViresh Kumar struct spear_pingroup spear3xx_mii_pingroup = {
17352130b60SViresh Kumar 	.name = "mii0_grp",
17452130b60SViresh Kumar 	.pins = mii_pins,
17552130b60SViresh Kumar 	.npins = ARRAY_SIZE(mii_pins),
17652130b60SViresh Kumar 	.modemuxs = mii_modemux,
17752130b60SViresh Kumar 	.nmodemuxs = ARRAY_SIZE(mii_modemux),
17852130b60SViresh Kumar };
17952130b60SViresh Kumar 
18052130b60SViresh Kumar static const char *const mii_grps[] = { "mii0_grp" };
18152130b60SViresh Kumar struct spear_function spear3xx_mii_function = {
18252130b60SViresh Kumar 	.name = "mii0",
18352130b60SViresh Kumar 	.groups = mii_grps,
18452130b60SViresh Kumar 	.ngroups = ARRAY_SIZE(mii_grps),
18552130b60SViresh Kumar };
18652130b60SViresh Kumar 
18752130b60SViresh Kumar /* gpio0_pin0_pins */
18852130b60SViresh Kumar static const unsigned gpio0_pin0_pins[] = { 28 };
18952130b60SViresh Kumar static struct spear_muxreg gpio0_pin0_muxreg[] = {
19052130b60SViresh Kumar 	{
19152130b60SViresh Kumar 		.reg = -1,
19252130b60SViresh Kumar 		.mask = PMX_GPIO_PIN0_MASK,
19352130b60SViresh Kumar 		.val = PMX_GPIO_PIN0_MASK,
19452130b60SViresh Kumar 	},
19552130b60SViresh Kumar };
19652130b60SViresh Kumar 
19752130b60SViresh Kumar static struct spear_modemux gpio0_pin0_modemux[] = {
19852130b60SViresh Kumar 	{
19952130b60SViresh Kumar 		.modes = ~0,
20052130b60SViresh Kumar 		.muxregs = gpio0_pin0_muxreg,
20152130b60SViresh Kumar 		.nmuxregs = ARRAY_SIZE(gpio0_pin0_muxreg),
20252130b60SViresh Kumar 	},
20352130b60SViresh Kumar };
20452130b60SViresh Kumar 
20552130b60SViresh Kumar struct spear_pingroup spear3xx_gpio0_pin0_pingroup = {
20652130b60SViresh Kumar 	.name = "gpio0_pin0_grp",
20752130b60SViresh Kumar 	.pins = gpio0_pin0_pins,
20852130b60SViresh Kumar 	.npins = ARRAY_SIZE(gpio0_pin0_pins),
20952130b60SViresh Kumar 	.modemuxs = gpio0_pin0_modemux,
21052130b60SViresh Kumar 	.nmodemuxs = ARRAY_SIZE(gpio0_pin0_modemux),
21152130b60SViresh Kumar };
21252130b60SViresh Kumar 
21352130b60SViresh Kumar /* gpio0_pin1_pins */
21452130b60SViresh Kumar static const unsigned gpio0_pin1_pins[] = { 29 };
21552130b60SViresh Kumar static struct spear_muxreg gpio0_pin1_muxreg[] = {
21652130b60SViresh Kumar 	{
21752130b60SViresh Kumar 		.reg = -1,
21852130b60SViresh Kumar 		.mask = PMX_GPIO_PIN1_MASK,
21952130b60SViresh Kumar 		.val = PMX_GPIO_PIN1_MASK,
22052130b60SViresh Kumar 	},
22152130b60SViresh Kumar };
22252130b60SViresh Kumar 
22352130b60SViresh Kumar static struct spear_modemux gpio0_pin1_modemux[] = {
22452130b60SViresh Kumar 	{
22552130b60SViresh Kumar 		.modes = ~0,
22652130b60SViresh Kumar 		.muxregs = gpio0_pin1_muxreg,
22752130b60SViresh Kumar 		.nmuxregs = ARRAY_SIZE(gpio0_pin1_muxreg),
22852130b60SViresh Kumar 	},
22952130b60SViresh Kumar };
23052130b60SViresh Kumar 
23152130b60SViresh Kumar struct spear_pingroup spear3xx_gpio0_pin1_pingroup = {
23252130b60SViresh Kumar 	.name = "gpio0_pin1_grp",
23352130b60SViresh Kumar 	.pins = gpio0_pin1_pins,
23452130b60SViresh Kumar 	.npins = ARRAY_SIZE(gpio0_pin1_pins),
23552130b60SViresh Kumar 	.modemuxs = gpio0_pin1_modemux,
23652130b60SViresh Kumar 	.nmodemuxs = ARRAY_SIZE(gpio0_pin1_modemux),
23752130b60SViresh Kumar };
23852130b60SViresh Kumar 
23952130b60SViresh Kumar /* gpio0_pin2_pins */
24052130b60SViresh Kumar static const unsigned gpio0_pin2_pins[] = { 30 };
24152130b60SViresh Kumar static struct spear_muxreg gpio0_pin2_muxreg[] = {
24252130b60SViresh Kumar 	{
24352130b60SViresh Kumar 		.reg = -1,
24452130b60SViresh Kumar 		.mask = PMX_GPIO_PIN2_MASK,
24552130b60SViresh Kumar 		.val = PMX_GPIO_PIN2_MASK,
24652130b60SViresh Kumar 	},
24752130b60SViresh Kumar };
24852130b60SViresh Kumar 
24952130b60SViresh Kumar static struct spear_modemux gpio0_pin2_modemux[] = {
25052130b60SViresh Kumar 	{
25152130b60SViresh Kumar 		.modes = ~0,
25252130b60SViresh Kumar 		.muxregs = gpio0_pin2_muxreg,
25352130b60SViresh Kumar 		.nmuxregs = ARRAY_SIZE(gpio0_pin2_muxreg),
25452130b60SViresh Kumar 	},
25552130b60SViresh Kumar };
25652130b60SViresh Kumar 
25752130b60SViresh Kumar struct spear_pingroup spear3xx_gpio0_pin2_pingroup = {
25852130b60SViresh Kumar 	.name = "gpio0_pin2_grp",
25952130b60SViresh Kumar 	.pins = gpio0_pin2_pins,
26052130b60SViresh Kumar 	.npins = ARRAY_SIZE(gpio0_pin2_pins),
26152130b60SViresh Kumar 	.modemuxs = gpio0_pin2_modemux,
26252130b60SViresh Kumar 	.nmodemuxs = ARRAY_SIZE(gpio0_pin2_modemux),
26352130b60SViresh Kumar };
26452130b60SViresh Kumar 
26552130b60SViresh Kumar /* gpio0_pin3_pins */
26652130b60SViresh Kumar static const unsigned gpio0_pin3_pins[] = { 31 };
26752130b60SViresh Kumar static struct spear_muxreg gpio0_pin3_muxreg[] = {
26852130b60SViresh Kumar 	{
26952130b60SViresh Kumar 		.reg = -1,
27052130b60SViresh Kumar 		.mask = PMX_GPIO_PIN3_MASK,
27152130b60SViresh Kumar 		.val = PMX_GPIO_PIN3_MASK,
27252130b60SViresh Kumar 	},
27352130b60SViresh Kumar };
27452130b60SViresh Kumar 
27552130b60SViresh Kumar static struct spear_modemux gpio0_pin3_modemux[] = {
27652130b60SViresh Kumar 	{
27752130b60SViresh Kumar 		.modes = ~0,
27852130b60SViresh Kumar 		.muxregs = gpio0_pin3_muxreg,
27952130b60SViresh Kumar 		.nmuxregs = ARRAY_SIZE(gpio0_pin3_muxreg),
28052130b60SViresh Kumar 	},
28152130b60SViresh Kumar };
28252130b60SViresh Kumar 
28352130b60SViresh Kumar struct spear_pingroup spear3xx_gpio0_pin3_pingroup = {
28452130b60SViresh Kumar 	.name = "gpio0_pin3_grp",
28552130b60SViresh Kumar 	.pins = gpio0_pin3_pins,
28652130b60SViresh Kumar 	.npins = ARRAY_SIZE(gpio0_pin3_pins),
28752130b60SViresh Kumar 	.modemuxs = gpio0_pin3_modemux,
28852130b60SViresh Kumar 	.nmodemuxs = ARRAY_SIZE(gpio0_pin3_modemux),
28952130b60SViresh Kumar };
29052130b60SViresh Kumar 
29152130b60SViresh Kumar /* gpio0_pin4_pins */
29252130b60SViresh Kumar static const unsigned gpio0_pin4_pins[] = { 32 };
29352130b60SViresh Kumar static struct spear_muxreg gpio0_pin4_muxreg[] = {
29452130b60SViresh Kumar 	{
29552130b60SViresh Kumar 		.reg = -1,
29652130b60SViresh Kumar 		.mask = PMX_GPIO_PIN4_MASK,
29752130b60SViresh Kumar 		.val = PMX_GPIO_PIN4_MASK,
29852130b60SViresh Kumar 	},
29952130b60SViresh Kumar };
30052130b60SViresh Kumar 
30152130b60SViresh Kumar static struct spear_modemux gpio0_pin4_modemux[] = {
30252130b60SViresh Kumar 	{
30352130b60SViresh Kumar 		.modes = ~0,
30452130b60SViresh Kumar 		.muxregs = gpio0_pin4_muxreg,
30552130b60SViresh Kumar 		.nmuxregs = ARRAY_SIZE(gpio0_pin4_muxreg),
30652130b60SViresh Kumar 	},
30752130b60SViresh Kumar };
30852130b60SViresh Kumar 
30952130b60SViresh Kumar struct spear_pingroup spear3xx_gpio0_pin4_pingroup = {
31052130b60SViresh Kumar 	.name = "gpio0_pin4_grp",
31152130b60SViresh Kumar 	.pins = gpio0_pin4_pins,
31252130b60SViresh Kumar 	.npins = ARRAY_SIZE(gpio0_pin4_pins),
31352130b60SViresh Kumar 	.modemuxs = gpio0_pin4_modemux,
31452130b60SViresh Kumar 	.nmodemuxs = ARRAY_SIZE(gpio0_pin4_modemux),
31552130b60SViresh Kumar };
31652130b60SViresh Kumar 
31752130b60SViresh Kumar /* gpio0_pin5_pins */
31852130b60SViresh Kumar static const unsigned gpio0_pin5_pins[] = { 33 };
31952130b60SViresh Kumar static struct spear_muxreg gpio0_pin5_muxreg[] = {
32052130b60SViresh Kumar 	{
32152130b60SViresh Kumar 		.reg = -1,
32252130b60SViresh Kumar 		.mask = PMX_GPIO_PIN5_MASK,
32352130b60SViresh Kumar 		.val = PMX_GPIO_PIN5_MASK,
32452130b60SViresh Kumar 	},
32552130b60SViresh Kumar };
32652130b60SViresh Kumar 
32752130b60SViresh Kumar static struct spear_modemux gpio0_pin5_modemux[] = {
32852130b60SViresh Kumar 	{
32952130b60SViresh Kumar 		.modes = ~0,
33052130b60SViresh Kumar 		.muxregs = gpio0_pin5_muxreg,
33152130b60SViresh Kumar 		.nmuxregs = ARRAY_SIZE(gpio0_pin5_muxreg),
33252130b60SViresh Kumar 	},
33352130b60SViresh Kumar };
33452130b60SViresh Kumar 
33552130b60SViresh Kumar struct spear_pingroup spear3xx_gpio0_pin5_pingroup = {
33652130b60SViresh Kumar 	.name = "gpio0_pin5_grp",
33752130b60SViresh Kumar 	.pins = gpio0_pin5_pins,
33852130b60SViresh Kumar 	.npins = ARRAY_SIZE(gpio0_pin5_pins),
33952130b60SViresh Kumar 	.modemuxs = gpio0_pin5_modemux,
34052130b60SViresh Kumar 	.nmodemuxs = ARRAY_SIZE(gpio0_pin5_modemux),
34152130b60SViresh Kumar };
34252130b60SViresh Kumar 
34352130b60SViresh Kumar static const char *const gpio0_grps[] = { "gpio0_pin0_grp", "gpio0_pin1_grp",
34452130b60SViresh Kumar 	"gpio0_pin2_grp", "gpio0_pin3_grp", "gpio0_pin4_grp", "gpio0_pin5_grp",
34552130b60SViresh Kumar };
34652130b60SViresh Kumar struct spear_function spear3xx_gpio0_function = {
34752130b60SViresh Kumar 	.name = "gpio0",
34852130b60SViresh Kumar 	.groups = gpio0_grps,
34952130b60SViresh Kumar 	.ngroups = ARRAY_SIZE(gpio0_grps),
35052130b60SViresh Kumar };
35152130b60SViresh Kumar 
35252130b60SViresh Kumar /* uart0_ext_pins */
35352130b60SViresh Kumar static const unsigned uart0_ext_pins[] = { 37, 38, 39, 40, 41, 42 };
35452130b60SViresh Kumar static struct spear_muxreg uart0_ext_muxreg[] = {
35552130b60SViresh Kumar 	{
35652130b60SViresh Kumar 		.reg = -1,
35752130b60SViresh Kumar 		.mask = PMX_UART0_MODEM_MASK,
35852130b60SViresh Kumar 		.val = PMX_UART0_MODEM_MASK,
35952130b60SViresh Kumar 	},
36052130b60SViresh Kumar };
36152130b60SViresh Kumar 
36252130b60SViresh Kumar static struct spear_modemux uart0_ext_modemux[] = {
36352130b60SViresh Kumar 	{
36452130b60SViresh Kumar 		.modes = ~0,
36552130b60SViresh Kumar 		.muxregs = uart0_ext_muxreg,
36652130b60SViresh Kumar 		.nmuxregs = ARRAY_SIZE(uart0_ext_muxreg),
36752130b60SViresh Kumar 	},
36852130b60SViresh Kumar };
36952130b60SViresh Kumar 
37052130b60SViresh Kumar struct spear_pingroup spear3xx_uart0_ext_pingroup = {
37152130b60SViresh Kumar 	.name = "uart0_ext_grp",
37252130b60SViresh Kumar 	.pins = uart0_ext_pins,
37352130b60SViresh Kumar 	.npins = ARRAY_SIZE(uart0_ext_pins),
37452130b60SViresh Kumar 	.modemuxs = uart0_ext_modemux,
37552130b60SViresh Kumar 	.nmodemuxs = ARRAY_SIZE(uart0_ext_modemux),
37652130b60SViresh Kumar };
37752130b60SViresh Kumar 
37852130b60SViresh Kumar static const char *const uart0_ext_grps[] = { "uart0_ext_grp" };
37952130b60SViresh Kumar struct spear_function spear3xx_uart0_ext_function = {
38052130b60SViresh Kumar 	.name = "uart0_ext",
38152130b60SViresh Kumar 	.groups = uart0_ext_grps,
38252130b60SViresh Kumar 	.ngroups = ARRAY_SIZE(uart0_ext_grps),
38352130b60SViresh Kumar };
38452130b60SViresh Kumar 
38552130b60SViresh Kumar /* uart0_pins */
38652130b60SViresh Kumar static const unsigned uart0_pins[] = { 2, 3 };
38752130b60SViresh Kumar static struct spear_muxreg uart0_muxreg[] = {
38852130b60SViresh Kumar 	{
38952130b60SViresh Kumar 		.reg = -1,
39052130b60SViresh Kumar 		.mask = PMX_UART0_MASK,
39152130b60SViresh Kumar 		.val = PMX_UART0_MASK,
39252130b60SViresh Kumar 	},
39352130b60SViresh Kumar };
39452130b60SViresh Kumar 
39552130b60SViresh Kumar static struct spear_modemux uart0_modemux[] = {
39652130b60SViresh Kumar 	{
39752130b60SViresh Kumar 		.modes = ~0,
39852130b60SViresh Kumar 		.muxregs = uart0_muxreg,
39952130b60SViresh Kumar 		.nmuxregs = ARRAY_SIZE(uart0_muxreg),
40052130b60SViresh Kumar 	},
40152130b60SViresh Kumar };
40252130b60SViresh Kumar 
40352130b60SViresh Kumar struct spear_pingroup spear3xx_uart0_pingroup = {
40452130b60SViresh Kumar 	.name = "uart0_grp",
40552130b60SViresh Kumar 	.pins = uart0_pins,
40652130b60SViresh Kumar 	.npins = ARRAY_SIZE(uart0_pins),
40752130b60SViresh Kumar 	.modemuxs = uart0_modemux,
40852130b60SViresh Kumar 	.nmodemuxs = ARRAY_SIZE(uart0_modemux),
40952130b60SViresh Kumar };
41052130b60SViresh Kumar 
41152130b60SViresh Kumar static const char *const uart0_grps[] = { "uart0_grp" };
41252130b60SViresh Kumar struct spear_function spear3xx_uart0_function = {
41352130b60SViresh Kumar 	.name = "uart0",
41452130b60SViresh Kumar 	.groups = uart0_grps,
41552130b60SViresh Kumar 	.ngroups = ARRAY_SIZE(uart0_grps),
41652130b60SViresh Kumar };
41752130b60SViresh Kumar 
41852130b60SViresh Kumar /* timer_0_1_pins */
41952130b60SViresh Kumar static const unsigned timer_0_1_pins[] = { 43, 44, 47, 48 };
42052130b60SViresh Kumar static struct spear_muxreg timer_0_1_muxreg[] = {
42152130b60SViresh Kumar 	{
42252130b60SViresh Kumar 		.reg = -1,
42352130b60SViresh Kumar 		.mask = PMX_TIMER_0_1_MASK,
42452130b60SViresh Kumar 		.val = PMX_TIMER_0_1_MASK,
42552130b60SViresh Kumar 	},
42652130b60SViresh Kumar };
42752130b60SViresh Kumar 
42852130b60SViresh Kumar static struct spear_modemux timer_0_1_modemux[] = {
42952130b60SViresh Kumar 	{
43052130b60SViresh Kumar 		.modes = ~0,
43152130b60SViresh Kumar 		.muxregs = timer_0_1_muxreg,
43252130b60SViresh Kumar 		.nmuxregs = ARRAY_SIZE(timer_0_1_muxreg),
43352130b60SViresh Kumar 	},
43452130b60SViresh Kumar };
43552130b60SViresh Kumar 
43652130b60SViresh Kumar struct spear_pingroup spear3xx_timer_0_1_pingroup = {
43752130b60SViresh Kumar 	.name = "timer_0_1_grp",
43852130b60SViresh Kumar 	.pins = timer_0_1_pins,
43952130b60SViresh Kumar 	.npins = ARRAY_SIZE(timer_0_1_pins),
44052130b60SViresh Kumar 	.modemuxs = timer_0_1_modemux,
44152130b60SViresh Kumar 	.nmodemuxs = ARRAY_SIZE(timer_0_1_modemux),
44252130b60SViresh Kumar };
44352130b60SViresh Kumar 
44452130b60SViresh Kumar static const char *const timer_0_1_grps[] = { "timer_0_1_grp" };
44552130b60SViresh Kumar struct spear_function spear3xx_timer_0_1_function = {
44652130b60SViresh Kumar 	.name = "timer_0_1",
44752130b60SViresh Kumar 	.groups = timer_0_1_grps,
44852130b60SViresh Kumar 	.ngroups = ARRAY_SIZE(timer_0_1_grps),
44952130b60SViresh Kumar };
45052130b60SViresh Kumar 
45152130b60SViresh Kumar /* timer_2_3_pins */
45252130b60SViresh Kumar static const unsigned timer_2_3_pins[] = { 45, 46, 49, 50 };
45352130b60SViresh Kumar static struct spear_muxreg timer_2_3_muxreg[] = {
45452130b60SViresh Kumar 	{
45552130b60SViresh Kumar 		.reg = -1,
45652130b60SViresh Kumar 		.mask = PMX_TIMER_2_3_MASK,
45752130b60SViresh Kumar 		.val = PMX_TIMER_2_3_MASK,
45852130b60SViresh Kumar 	},
45952130b60SViresh Kumar };
46052130b60SViresh Kumar 
46152130b60SViresh Kumar static struct spear_modemux timer_2_3_modemux[] = {
46252130b60SViresh Kumar 	{
46352130b60SViresh Kumar 		.modes = ~0,
46452130b60SViresh Kumar 		.muxregs = timer_2_3_muxreg,
46552130b60SViresh Kumar 		.nmuxregs = ARRAY_SIZE(timer_2_3_muxreg),
46652130b60SViresh Kumar 	},
46752130b60SViresh Kumar };
46852130b60SViresh Kumar 
46952130b60SViresh Kumar struct spear_pingroup spear3xx_timer_2_3_pingroup = {
47052130b60SViresh Kumar 	.name = "timer_2_3_grp",
47152130b60SViresh Kumar 	.pins = timer_2_3_pins,
47252130b60SViresh Kumar 	.npins = ARRAY_SIZE(timer_2_3_pins),
47352130b60SViresh Kumar 	.modemuxs = timer_2_3_modemux,
47452130b60SViresh Kumar 	.nmodemuxs = ARRAY_SIZE(timer_2_3_modemux),
47552130b60SViresh Kumar };
47652130b60SViresh Kumar 
47752130b60SViresh Kumar static const char *const timer_2_3_grps[] = { "timer_2_3_grp" };
47852130b60SViresh Kumar struct spear_function spear3xx_timer_2_3_function = {
47952130b60SViresh Kumar 	.name = "timer_2_3",
48052130b60SViresh Kumar 	.groups = timer_2_3_grps,
48152130b60SViresh Kumar 	.ngroups = ARRAY_SIZE(timer_2_3_grps),
48252130b60SViresh Kumar };
48352130b60SViresh Kumar 
484f4f8e563SViresh Kumar /* Define muxreg arrays */
485f4f8e563SViresh Kumar DEFINE_MUXREG(firda_pins, 0, PMX_FIRDA_MASK, 0);
486f4f8e563SViresh Kumar DEFINE_MUXREG(i2c_pins, 0, PMX_I2C_MASK, 0);
487f4f8e563SViresh Kumar DEFINE_MUXREG(ssp_cs_pins, 0, PMX_SSP_CS_MASK, 0);
488f4f8e563SViresh Kumar DEFINE_MUXREG(ssp_pins, 0, PMX_SSP_MASK, 0);
489f4f8e563SViresh Kumar DEFINE_MUXREG(mii_pins, 0, PMX_MII_MASK, 0);
490f4f8e563SViresh Kumar DEFINE_MUXREG(gpio0_pin0_pins, 0, PMX_GPIO_PIN0_MASK, 0);
491f4f8e563SViresh Kumar DEFINE_MUXREG(gpio0_pin1_pins, 0, PMX_GPIO_PIN1_MASK, 0);
492f4f8e563SViresh Kumar DEFINE_MUXREG(gpio0_pin2_pins, 0, PMX_GPIO_PIN2_MASK, 0);
493f4f8e563SViresh Kumar DEFINE_MUXREG(gpio0_pin3_pins, 0, PMX_GPIO_PIN3_MASK, 0);
494f4f8e563SViresh Kumar DEFINE_MUXREG(gpio0_pin4_pins, 0, PMX_GPIO_PIN4_MASK, 0);
495f4f8e563SViresh Kumar DEFINE_MUXREG(gpio0_pin5_pins, 0, PMX_GPIO_PIN5_MASK, 0);
496f4f8e563SViresh Kumar DEFINE_MUXREG(uart0_ext_pins, 0, PMX_UART0_MODEM_MASK, 0);
497f4f8e563SViresh Kumar DEFINE_MUXREG(uart0_pins, 0, PMX_UART0_MASK, 0);
498f4f8e563SViresh Kumar DEFINE_MUXREG(timer_0_1_pins, 0, PMX_TIMER_0_1_MASK, 0);
499f4f8e563SViresh Kumar DEFINE_MUXREG(timer_2_3_pins, 0, PMX_TIMER_2_3_MASK, 0);
500f4f8e563SViresh Kumar 
501f4f8e563SViresh Kumar static struct spear_gpio_pingroup spear3xx_gpio_pingroup[] = {
502f4f8e563SViresh Kumar 	GPIO_PINGROUP(firda_pins),
503f4f8e563SViresh Kumar 	GPIO_PINGROUP(i2c_pins),
504f4f8e563SViresh Kumar 	GPIO_PINGROUP(ssp_cs_pins),
505f4f8e563SViresh Kumar 	GPIO_PINGROUP(ssp_pins),
506f4f8e563SViresh Kumar 	GPIO_PINGROUP(mii_pins),
507f4f8e563SViresh Kumar 	GPIO_PINGROUP(gpio0_pin0_pins),
508f4f8e563SViresh Kumar 	GPIO_PINGROUP(gpio0_pin1_pins),
509f4f8e563SViresh Kumar 	GPIO_PINGROUP(gpio0_pin2_pins),
510f4f8e563SViresh Kumar 	GPIO_PINGROUP(gpio0_pin3_pins),
511f4f8e563SViresh Kumar 	GPIO_PINGROUP(gpio0_pin4_pins),
512f4f8e563SViresh Kumar 	GPIO_PINGROUP(gpio0_pin5_pins),
513f4f8e563SViresh Kumar 	GPIO_PINGROUP(uart0_ext_pins),
514f4f8e563SViresh Kumar 	GPIO_PINGROUP(uart0_pins),
515f4f8e563SViresh Kumar 	GPIO_PINGROUP(timer_0_1_pins),
516f4f8e563SViresh Kumar 	GPIO_PINGROUP(timer_2_3_pins),
517f4f8e563SViresh Kumar };
518f4f8e563SViresh Kumar 
51952130b60SViresh Kumar struct spear_pinctrl_machdata spear3xx_machdata = {
52052130b60SViresh Kumar 	.pins = spear3xx_pins,
52152130b60SViresh Kumar 	.npins = ARRAY_SIZE(spear3xx_pins),
522f4f8e563SViresh Kumar 	.gpio_pingroups = spear3xx_gpio_pingroup,
523f4f8e563SViresh Kumar 	.ngpio_pingroups = ARRAY_SIZE(spear3xx_gpio_pingroup),
52452130b60SViresh Kumar };
525