Skip to content

Commit 0a98bf5

Browse files
ssekar15Linus Walleij
authored andcommitted
pinctrl: actions: define constructor generic to Actions Semi SoC's
Move generic defines common to the Owl family out of S900 driver. Signed-off-by: Parthiban Nallathambi <pn@denx.de> Signed-off-by: Saravanan Sekar <sravanhome@gmail.com> Acked-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
1 parent 97cfb6c commit 0a98bf5

2 files changed

Lines changed: 137 additions & 133 deletions

File tree

‎drivers/pinctrl/actions/pinctrl-owl.h‎

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,136 @@
1515
#define OWL_PINCONF_SLEW_SLOW 0
1616
#define OWL_PINCONF_SLEW_FAST 1
1717

18+
#define MUX_PG(group_name, reg, shift, width) \
19+
{ \
20+
.name = #group_name, \
21+
.pads = group_name##_pads, \
22+
.npads = ARRAY_SIZE(group_name##_pads), \
23+
.funcs = group_name##_funcs, \
24+
.nfuncs = ARRAY_SIZE(group_name##_funcs), \
25+
.mfpctl_reg = MFCTL##reg, \
26+
.mfpctl_shift = shift, \
27+
.mfpctl_width = width, \
28+
.drv_reg = -1, \
29+
.drv_shift = -1, \
30+
.drv_width = -1, \
31+
.sr_reg = -1, \
32+
.sr_shift = -1, \
33+
.sr_width = -1, \
34+
}
35+
36+
#define DRV_PG(group_name, reg, shift, width) \
37+
{ \
38+
.name = #group_name, \
39+
.pads = group_name##_pads, \
40+
.npads = ARRAY_SIZE(group_name##_pads), \
41+
.mfpctl_reg = -1, \
42+
.mfpctl_shift = -1, \
43+
.mfpctl_width = -1, \
44+
.drv_reg = PAD_DRV##reg, \
45+
.drv_shift = shift, \
46+
.drv_width = width, \
47+
.sr_reg = -1, \
48+
.sr_shift = -1, \
49+
.sr_width = -1, \
50+
}
51+
52+
#define SR_PG(group_name, reg, shift, width) \
53+
{ \
54+
.name = #group_name, \
55+
.pads = group_name##_pads, \
56+
.npads = ARRAY_SIZE(group_name##_pads), \
57+
.mfpctl_reg = -1, \
58+
.mfpctl_shift = -1, \
59+
.mfpctl_width = -1, \
60+
.drv_reg = -1, \
61+
.drv_shift = -1, \
62+
.drv_width = -1, \
63+
.sr_reg = PAD_SR##reg, \
64+
.sr_shift = shift, \
65+
.sr_width = width, \
66+
}
67+
68+
#define FUNCTION(fname) \
69+
{ \
70+
.name = #fname, \
71+
.groups = fname##_groups, \
72+
.ngroups = ARRAY_SIZE(fname##_groups), \
73+
}
74+
75+
/* PAD PULL UP/DOWN CONFIGURES */
76+
#define PULLCTL_CONF(pull_reg, pull_sft, pull_wdt) \
77+
{ \
78+
.reg = PAD_PULLCTL##pull_reg, \
79+
.shift = pull_sft, \
80+
.width = pull_wdt, \
81+
}
82+
83+
#define PAD_PULLCTL_CONF(pad_name, pull_reg, pull_sft, pull_wdt) \
84+
struct owl_pullctl pad_name##_pullctl_conf \
85+
= PULLCTL_CONF(pull_reg, pull_sft, pull_wdt)
86+
87+
#define ST_CONF(st_reg, st_sft, st_wdt) \
88+
{ \
89+
.reg = PAD_ST##st_reg, \
90+
.shift = st_sft, \
91+
.width = st_wdt, \
92+
}
93+
94+
#define PAD_ST_CONF(pad_name, st_reg, st_sft, st_wdt) \
95+
struct owl_st pad_name##_st_conf \
96+
= ST_CONF(st_reg, st_sft, st_wdt)
97+
98+
#define PAD_INFO(name) \
99+
{ \
100+
.pad = name, \
101+
.pullctl = NULL, \
102+
.st = NULL, \
103+
}
104+
105+
#define PAD_INFO_ST(name) \
106+
{ \
107+
.pad = name, \
108+
.pullctl = NULL, \
109+
.st = &name##_st_conf, \
110+
}
111+
112+
#define PAD_INFO_PULLCTL(name) \
113+
{ \
114+
.pad = name, \
115+
.pullctl = &name##_pullctl_conf, \
116+
.st = NULL, \
117+
}
118+
119+
#define PAD_INFO_PULLCTL_ST(name) \
120+
{ \
121+
.pad = name, \
122+
.pullctl = &name##_pullctl_conf, \
123+
.st = &name##_st_conf, \
124+
}
125+
126+
#define OWL_GPIO_PORT_A 0
127+
#define OWL_GPIO_PORT_B 1
128+
#define OWL_GPIO_PORT_C 2
129+
#define OWL_GPIO_PORT_D 3
130+
#define OWL_GPIO_PORT_E 4
131+
#define OWL_GPIO_PORT_F 5
132+
133+
#define OWL_GPIO_PORT(port, base, count, _outen, _inen, _dat, _intc_ctl,\
134+
_intc_pd, _intc_msk, _intc_type, _share) \
135+
[OWL_GPIO_PORT_##port] = { \
136+
.offset = base, \
137+
.pins = count, \
138+
.outen = _outen, \
139+
.inen = _inen, \
140+
.dat = _dat, \
141+
.intc_ctl = _intc_ctl, \
142+
.intc_pd = _intc_pd, \
143+
.intc_msk = _intc_msk, \
144+
.intc_type = _intc_type, \
145+
.shared_ctl_offset = _share, \
146+
}
147+
18148
enum owl_pinconf_pull {
19149
OWL_PINCONF_PULL_HIZ,
20150
OWL_PINCONF_PULL_DOWN,
@@ -148,6 +278,7 @@ struct owl_gpio_port {
148278
unsigned int intc_pd;
149279
unsigned int intc_msk;
150280
unsigned int intc_type;
281+
u8 shared_ctl_offset;
151282
};
152283

153284
/**

‎drivers/pinctrl/actions/pinctrl-s900.c‎

Lines changed: 6 additions & 133 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,6 @@
3333
#define PAD_SR1 (0x0274)
3434
#define PAD_SR2 (0x0278)
3535

36-
#define OWL_GPIO_PORT_A 0
37-
#define OWL_GPIO_PORT_B 1
38-
#define OWL_GPIO_PORT_C 2
39-
#define OWL_GPIO_PORT_D 3
40-
#define OWL_GPIO_PORT_E 4
41-
#define OWL_GPIO_PORT_F 5
42-
4336
#define _GPIOA(offset) (offset)
4437
#define _GPIOB(offset) (32 + (offset))
4538
#define _GPIOC(offset) (64 + (offset))
@@ -892,55 +885,6 @@ static unsigned int i2c2_sr_pads[] = { I2C2_SCLK, I2C2_SDATA };
892885
static unsigned int sensor0_sr_pads[] = { SENSOR0_PCLK,
893886
SENSOR0_CKOUT };
894887

895-
#define MUX_PG(group_name, reg, shift, width) \
896-
{ \
897-
.name = #group_name, \
898-
.pads = group_name##_pads, \
899-
.npads = ARRAY_SIZE(group_name##_pads), \
900-
.funcs = group_name##_funcs, \
901-
.nfuncs = ARRAY_SIZE(group_name##_funcs), \
902-
.mfpctl_reg = MFCTL##reg, \
903-
.mfpctl_shift = shift, \
904-
.mfpctl_width = width, \
905-
.drv_reg = -1, \
906-
.drv_shift = -1, \
907-
.drv_width = -1, \
908-
.sr_reg = -1, \
909-
.sr_shift = -1, \
910-
.sr_width = -1, \
911-
}
912-
913-
#define DRV_PG(group_name, reg, shift, width) \
914-
{ \
915-
.name = #group_name, \
916-
.pads = group_name##_pads, \
917-
.npads = ARRAY_SIZE(group_name##_pads), \
918-
.mfpctl_reg = -1, \
919-
.mfpctl_shift = -1, \
920-
.mfpctl_width = -1, \
921-
.drv_reg = PAD_DRV##reg, \
922-
.drv_shift = shift, \
923-
.drv_width = width, \
924-
.sr_reg = -1, \
925-
.sr_shift = -1, \
926-
.sr_width = -1, \
927-
}
928-
929-
#define SR_PG(group_name, reg, shift, width) \
930-
{ \
931-
.name = #group_name, \
932-
.pads = group_name##_pads, \
933-
.npads = ARRAY_SIZE(group_name##_pads), \
934-
.mfpctl_reg = -1, \
935-
.mfpctl_shift = -1, \
936-
.mfpctl_width = -1, \
937-
.drv_reg = -1, \
938-
.drv_shift = -1, \
939-
.drv_width = -1, \
940-
.sr_reg = PAD_SR##reg, \
941-
.sr_shift = shift, \
942-
.sr_width = width, \
943-
}
944888

945889
/* Pinctrl groups */
946890
static const struct owl_pingroup s900_groups[] = {
@@ -1442,13 +1386,6 @@ static const char * const sirq2_groups[] = {
14421386
"sirq2_dummy",
14431387
};
14441388

1445-
#define FUNCTION(fname) \
1446-
{ \
1447-
.name = #fname, \
1448-
.groups = fname##_groups, \
1449-
.ngroups = ARRAY_SIZE(fname##_groups), \
1450-
}
1451-
14521389
static const struct owl_pinmux_func s900_functions[] = {
14531390
[S900_MUX_ERAM] = FUNCTION(eram),
14541391
[S900_MUX_ETH_RMII] = FUNCTION(eth_rmii),
@@ -1500,28 +1437,6 @@ static const struct owl_pinmux_func s900_functions[] = {
15001437
[S900_MUX_SIRQ1] = FUNCTION(sirq1),
15011438
[S900_MUX_SIRQ2] = FUNCTION(sirq2)
15021439
};
1503-
/* PAD PULL UP/DOWN CONFIGURES */
1504-
#define PULLCTL_CONF(pull_reg, pull_sft, pull_wdt) \
1505-
{ \
1506-
.reg = PAD_PULLCTL##pull_reg, \
1507-
.shift = pull_sft, \
1508-
.width = pull_wdt, \
1509-
}
1510-
1511-
#define PAD_PULLCTL_CONF(pad_name, pull_reg, pull_sft, pull_wdt) \
1512-
struct owl_pullctl pad_name##_pullctl_conf \
1513-
= PULLCTL_CONF(pull_reg, pull_sft, pull_wdt)
1514-
1515-
#define ST_CONF(st_reg, st_sft, st_wdt) \
1516-
{ \
1517-
.reg = PAD_ST##st_reg, \
1518-
.shift = st_sft, \
1519-
.width = st_wdt, \
1520-
}
1521-
1522-
#define PAD_ST_CONF(pad_name, st_reg, st_sft, st_wdt) \
1523-
struct owl_st pad_name##_st_conf \
1524-
= ST_CONF(st_reg, st_sft, st_wdt)
15251440

15261441
/* PAD_PULLCTL0 */
15271442
static PAD_PULLCTL_CONF(ETH_RXER, 0, 18, 2);
@@ -1639,34 +1554,6 @@ static PAD_ST_CONF(SPI0_SS, 1, 2, 1);
16391554
static PAD_ST_CONF(I2S_BCLK0, 1, 1, 1);
16401555
static PAD_ST_CONF(I2S_MCLK0, 1, 0, 1);
16411556

1642-
#define PAD_INFO(name) \
1643-
{ \
1644-
.pad = name, \
1645-
.pullctl = NULL, \
1646-
.st = NULL, \
1647-
}
1648-
1649-
#define PAD_INFO_ST(name) \
1650-
{ \
1651-
.pad = name, \
1652-
.pullctl = NULL, \
1653-
.st = &name##_st_conf, \
1654-
}
1655-
1656-
#define PAD_INFO_PULLCTL(name) \
1657-
{ \
1658-
.pad = name, \
1659-
.pullctl = &name##_pullctl_conf, \
1660-
.st = NULL, \
1661-
}
1662-
1663-
#define PAD_INFO_PULLCTL_ST(name) \
1664-
{ \
1665-
.pad = name, \
1666-
.pullctl = &name##_pullctl_conf, \
1667-
.st = &name##_st_conf, \
1668-
}
1669-
16701557
/* Pad info table */
16711558
static struct owl_padinfo s900_padinfo[NUM_PADS] = {
16721559
[ETH_TXD0] = PAD_INFO_ST(ETH_TXD0),
@@ -1821,27 +1708,13 @@ static struct owl_padinfo s900_padinfo[NUM_PADS] = {
18211708
[SGPIO3] = PAD_INFO_PULLCTL_ST(SGPIO3)
18221709
};
18231710

1824-
#define OWL_GPIO_PORT(port, base, count, _outen, _inen, _dat, \
1825-
_intc_ctl, _intc_pd, _intc_msk, _intc_type) \
1826-
[OWL_GPIO_PORT_##port] = { \
1827-
.offset = base, \
1828-
.pins = count, \
1829-
.outen = _outen, \
1830-
.inen = _inen, \
1831-
.dat = _dat, \
1832-
.intc_ctl = _intc_ctl, \
1833-
.intc_pd = _intc_pd, \
1834-
.intc_msk = _intc_msk, \
1835-
.intc_type = _intc_type, \
1836-
}
1837-
18381711
static const struct owl_gpio_port s900_gpio_ports[] = {
1839-
OWL_GPIO_PORT(A, 0x0000, 32, 0x0, 0x4, 0x8, 0x204, 0x208, 0x20C, 0x240),
1840-
OWL_GPIO_PORT(B, 0x000C, 32, 0x0, 0x4, 0x8, 0x534, 0x204, 0x208, 0x23C),
1841-
OWL_GPIO_PORT(C, 0x0018, 12, 0x0, 0x4, 0x8, 0x52C, 0x200, 0x204, 0x238),
1842-
OWL_GPIO_PORT(D, 0x0024, 30, 0x0, 0x4, 0x8, 0x524, 0x1FC, 0x200, 0x234),
1843-
OWL_GPIO_PORT(E, 0x0030, 32, 0x0, 0x4, 0x8, 0x51C, 0x1F8, 0x1FC, 0x230),
1844-
OWL_GPIO_PORT(F, 0x00F0, 8, 0x0, 0x4, 0x8, 0x460, 0x140, 0x144, 0x178)
1712+
OWL_GPIO_PORT(A, 0x0000, 32, 0x0, 0x4, 0x8, 0x204, 0x208, 0x20C, 0x240, 0),
1713+
OWL_GPIO_PORT(B, 0x000C, 32, 0x0, 0x4, 0x8, 0x534, 0x204, 0x208, 0x23C, 0),
1714+
OWL_GPIO_PORT(C, 0x0018, 12, 0x0, 0x4, 0x8, 0x52C, 0x200, 0x204, 0x238, 0),
1715+
OWL_GPIO_PORT(D, 0x0024, 30, 0x0, 0x4, 0x8, 0x524, 0x1FC, 0x200, 0x234, 0),
1716+
OWL_GPIO_PORT(E, 0x0030, 32, 0x0, 0x4, 0x8, 0x51C, 0x1F8, 0x1FC, 0x230, 0),
1717+
OWL_GPIO_PORT(F, 0x00F0, 8, 0x0, 0x4, 0x8, 0x460, 0x140, 0x144, 0x178, 0)
18451718
};
18461719

18471720
static struct owl_pinctrl_soc_data s900_pinctrl_data = {

0 commit comments

Comments
 (0)