Skip to content

Commit cf75b8f

Browse files
thierryredinglinusw
authored andcommitted
pinctrl: tegra: Add bitmask support for parked bits
Some pin groups have park bits for multiple pins in one register. Support this by turning the parked bit field into a parked bitmask field. If no parked bits are supported, the bitmask can be 0. Update the pingroup table on Tegra210, which is the only generation where this is supported, with the parked bitmask. Signed-off-by: Thierry Reding <[email protected]> Tested-by: Dmitry Osipenko <[email protected]> Reviewed-by: Dmitry Osipenko <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
1 parent 55bd054 commit cf75b8f

File tree

8 files changed

+57
-47
lines changed

8 files changed

+57
-47
lines changed

drivers/pinctrl/tegra/pinctrl-tegra.c

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -621,10 +621,20 @@ static void tegra_pinctrl_clear_parked_bits(struct tegra_pmx *pmx)
621621

622622
for (i = 0; i < pmx->soc->ngroups; ++i) {
623623
g = &pmx->soc->groups[i];
624-
if (g->parked_bit >= 0) {
625-
val = pmx_readl(pmx, g->mux_bank, g->mux_reg);
626-
val &= ~(1 << g->parked_bit);
627-
pmx_writel(pmx, val, g->mux_bank, g->mux_reg);
624+
if (g->parked_bitmask > 0) {
625+
unsigned int bank, reg;
626+
627+
if (g->mux_reg != -1) {
628+
bank = g->mux_bank;
629+
reg = g->mux_reg;
630+
} else {
631+
bank = g->drv_bank;
632+
reg = g->drv_reg;
633+
}
634+
635+
val = pmx_readl(pmx, bank, reg);
636+
val &= ~g->parked_bitmask;
637+
pmx_writel(pmx, val, bank, reg);
628638
}
629639
}
630640
}

drivers/pinctrl/tegra/pinctrl-tegra.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ struct tegra_function {
104104
* @tri_reg: Tri-state register offset.
105105
* @tri_bank: Tri-state register bank.
106106
* @tri_bit: Tri-state register bit.
107-
* @parked_bit: Parked register bit. -1 if unsupported.
108107
* @einput_bit: Enable-input register bit.
109108
* @odrain_bit: Open-drain register bit.
110109
* @lock_bit: Lock register bit.
@@ -126,6 +125,7 @@ struct tegra_function {
126125
* @slwf_bit: Slew Falling register bit.
127126
* @slwf_width: Slew Falling field width.
128127
* @drvtype_bit: Drive type register bit.
128+
* @parked_bitmask: Parked register mask. 0 if unsupported.
129129
*
130130
* -1 in a *_reg field means that feature is unsupported for this group.
131131
* *_bank and *_reg values are irrelevant when *_reg is -1.
@@ -154,7 +154,6 @@ struct tegra_pingroup {
154154
s32 mux_bit:6;
155155
s32 pupd_bit:6;
156156
s32 tri_bit:6;
157-
s32 parked_bit:6;
158157
s32 einput_bit:6;
159158
s32 odrain_bit:6;
160159
s32 lock_bit:6;
@@ -172,6 +171,7 @@ struct tegra_pingroup {
172171
s32 drvup_width:6;
173172
s32 slwr_width:6;
174173
s32 slwf_width:6;
174+
u32 parked_bitmask;
175175
};
176176

177177
/**

drivers/pinctrl/tegra/pinctrl-tegra114.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1580,8 +1580,8 @@ static struct tegra_function tegra114_functions[] = {
15801580
.lock_bit = 7, \
15811581
.ioreset_bit = PINGROUP_BIT_##ior(8), \
15821582
.rcv_sel_bit = PINGROUP_BIT_##rcv_sel(9), \
1583-
.parked_bit = -1, \
15841583
.drv_reg = -1, \
1584+
.parked_bitmask = 0, \
15851585
}
15861586

15871587
#define DRV_PINGROUP(pg_name, r, hsm_b, schmitt_b, lpmd_b, drvdn_b, \
@@ -1601,7 +1601,6 @@ static struct tegra_function tegra114_functions[] = {
16011601
.rcv_sel_bit = -1, \
16021602
.drv_reg = DRV_PINGROUP_REG(r), \
16031603
.drv_bank = 0, \
1604-
.parked_bit = -1, \
16051604
.hsm_bit = hsm_b, \
16061605
.schmitt_bit = schmitt_b, \
16071606
.lpmd_bit = lpmd_b, \
@@ -1614,6 +1613,7 @@ static struct tegra_function tegra114_functions[] = {
16141613
.slwf_bit = slwf_b, \
16151614
.slwf_width = slwf_w, \
16161615
.drvtype_bit = PINGROUP_BIT_##drvtype(6), \
1616+
.parked_bitmask = 0, \
16171617
}
16181618

16191619
static const struct tegra_pingroup tegra114_groups[] = {

drivers/pinctrl/tegra/pinctrl-tegra124.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1749,8 +1749,8 @@ static struct tegra_function tegra124_functions[] = {
17491749
.lock_bit = 7, \
17501750
.ioreset_bit = PINGROUP_BIT_##ior(8), \
17511751
.rcv_sel_bit = PINGROUP_BIT_##rcv_sel(9), \
1752-
.parked_bit = -1, \
17531752
.drv_reg = -1, \
1753+
.parked_bitmask = 0, \
17541754
}
17551755

17561756
#define DRV_PINGROUP(pg_name, r, hsm_b, schmitt_b, lpmd_b, drvdn_b, \
@@ -1770,7 +1770,6 @@ static struct tegra_function tegra124_functions[] = {
17701770
.rcv_sel_bit = -1, \
17711771
.drv_reg = DRV_PINGROUP_REG(r), \
17721772
.drv_bank = 0, \
1773-
.parked_bit = -1, \
17741773
.hsm_bit = hsm_b, \
17751774
.schmitt_bit = schmitt_b, \
17761775
.lpmd_bit = lpmd_b, \
@@ -1783,6 +1782,7 @@ static struct tegra_function tegra124_functions[] = {
17831782
.slwf_bit = slwf_b, \
17841783
.slwf_width = slwf_w, \
17851784
.drvtype_bit = PINGROUP_BIT_##drvtype(6), \
1785+
.parked_bitmask = 0, \
17861786
}
17871787

17881788
#define MIPI_PAD_CTRL_PINGROUP(pg_name, r, b, f0, f1) \

drivers/pinctrl/tegra/pinctrl-tegra194.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ static struct tegra_function tegra194_functions[] = {
8787
.lpmd_bit = -1, \
8888
.lock_bit = -1, \
8989
.hsm_bit = -1, \
90-
.parked_bit = -1, \
9190
.mux_bank = bank, \
9291
.mux_bit = 0, \
9392
.pupd_reg = ((r)), \
@@ -100,7 +99,8 @@ static struct tegra_function tegra194_functions[] = {
10099
.odrain_bit = e_od, \
101100
.schmitt_bit = schmitt_b, \
102101
.drvtype_bit = 13, \
103-
.drv_reg = -1
102+
.drv_reg = -1, \
103+
.parked_bitmask = 0
104104

105105
#define drive_pex_l5_clkreq_n_pgg0 \
106106
DRV_PINGROUP_ENTRY_Y(0x14004, 12, 5, 20, 5, -1, -1, -1, -1, 0)

drivers/pinctrl/tegra/pinctrl-tegra20.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1997,13 +1997,13 @@ static struct tegra_function tegra20_functions[] = {
19971997
.tri_reg = ((tri_r) - TRISTATE_REG_A), \
19981998
.tri_bank = 0, \
19991999
.tri_bit = tri_b, \
2000-
.parked_bit = -1, \
20012000
.einput_bit = -1, \
20022001
.odrain_bit = -1, \
20032002
.lock_bit = -1, \
20042003
.ioreset_bit = -1, \
20052004
.rcv_sel_bit = -1, \
20062005
.drv_reg = -1, \
2006+
.parked_bitmask = 0, \
20072007
}
20082008

20092009
/* Pin groups with only pull up and pull down control */
@@ -2017,7 +2017,7 @@ static struct tegra_function tegra20_functions[] = {
20172017
.pupd_bank = 2, \
20182018
.pupd_bit = pupd_b, \
20192019
.drv_reg = -1, \
2020-
.parked_bit = -1, \
2020+
.parked_bitmask = 0, \
20212021
}
20222022

20232023
/* Pin groups for drive strength registers (configurable version) */
@@ -2033,7 +2033,7 @@ static struct tegra_function tegra20_functions[] = {
20332033
.tri_reg = -1, \
20342034
.drv_reg = ((r) - PINGROUP_REG_A), \
20352035
.drv_bank = 3, \
2036-
.parked_bit = -1, \
2036+
.parked_bitmask = 0, \
20372037
.hsm_bit = hsm_b, \
20382038
.schmitt_bit = schmitt_b, \
20392039
.lpmd_bit = lpmd_b, \

drivers/pinctrl/tegra/pinctrl-tegra210.c

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1310,7 +1310,6 @@ static struct tegra_function tegra210_functions[] = {
13101310
.lock_bit = 7, \
13111311
.ioreset_bit = -1, \
13121312
.rcv_sel_bit = PINGROUP_BIT_##e_io_hv(10), \
1313-
.parked_bit = 5, \
13141313
.hsm_bit = PINGROUP_BIT_##hsm(9), \
13151314
.schmitt_bit = 12, \
13161315
.drvtype_bit = PINGROUP_BIT_##drvtype(13), \
@@ -1325,10 +1324,11 @@ static struct tegra_function tegra210_functions[] = {
13251324
.slwr_width = slwr_w, \
13261325
.slwf_bit = slwf_b, \
13271326
.slwf_width = slwf_w, \
1327+
.parked_bitmask = BIT(5), \
13281328
}
13291329

1330-
#define DRV_PINGROUP(pg_name, r, drvdn_b, drvdn_w, drvup_b, drvup_w, \
1331-
slwr_b, slwr_w, slwf_b, slwf_w) \
1330+
#define DRV_PINGROUP(pg_name, r, prk_mask, drvdn_b, drvdn_w, drvup_b, \
1331+
drvup_w, slwr_b, slwr_w, slwf_b, slwf_w) \
13321332
{ \
13331333
.name = "drive_" #pg_name, \
13341334
.pins = drive_##pg_name##_pins, \
@@ -1343,7 +1343,6 @@ static struct tegra_function tegra210_functions[] = {
13431343
.rcv_sel_bit = -1, \
13441344
.drv_reg = DRV_PINGROUP_REG(r), \
13451345
.drv_bank = 0, \
1346-
.parked_bit = -1, \
13471346
.hsm_bit = -1, \
13481347
.schmitt_bit = -1, \
13491348
.lpmd_bit = -1, \
@@ -1356,6 +1355,7 @@ static struct tegra_function tegra210_functions[] = {
13561355
.slwf_bit = slwf_b, \
13571356
.slwf_width = slwf_w, \
13581357
.drvtype_bit = -1, \
1358+
.parked_bitmask = prk_mask, \
13591359
}
13601360

13611361
static const struct tegra_pingroup tegra210_groups[] = {
@@ -1523,32 +1523,32 @@ static const struct tegra_pingroup tegra210_groups[] = {
15231523
PINGROUP(pz4, SDMMC1, RSVD1, RSVD2, RSVD3, 0x328c, N, N, N, -1, -1, -1, -1, -1, -1, -1, -1, -1),
15241524
PINGROUP(pz5, SOC, RSVD1, RSVD2, RSVD3, 0x3290, N, N, N, -1, -1, -1, -1, -1, -1, -1, -1, -1),
15251525

1526-
/* pg_name, r, drvdn_b, drvdn_w, drvup_b, drvup_w, slwr_b, slwr_w, slwf_b, slwf_w */
1527-
DRV_PINGROUP(pa6, 0x9c0, 12, 5, 20, 5, -1, -1, -1, -1),
1528-
DRV_PINGROUP(pcc7, 0x9c4, 12, 5, 20, 5, -1, -1, -1, -1),
1529-
DRV_PINGROUP(pe6, 0x9c8, 12, 5, 20, 5, -1, -1, -1, -1),
1530-
DRV_PINGROUP(pe7, 0x9cc, 12, 5, 20, 5, -1, -1, -1, -1),
1531-
DRV_PINGROUP(ph6, 0x9d0, 12, 5, 20, 5, -1, -1, -1, -1),
1532-
DRV_PINGROUP(pk0, 0x9d4, -1, -1, -1, -1, 28, 2, 30, 2),
1533-
DRV_PINGROUP(pk1, 0x9d8, -1, -1, -1, -1, 28, 2, 30, 2),
1534-
DRV_PINGROUP(pk2, 0x9dc, -1, -1, -1, -1, 28, 2, 30, 2),
1535-
DRV_PINGROUP(pk3, 0x9e0, -1, -1, -1, -1, 28, 2, 30, 2),
1536-
DRV_PINGROUP(pk4, 0x9e4, -1, -1, -1, -1, 28, 2, 30, 2),
1537-
DRV_PINGROUP(pk5, 0x9e8, -1, -1, -1, -1, 28, 2, 30, 2),
1538-
DRV_PINGROUP(pk6, 0x9ec, -1, -1, -1, -1, 28, 2, 30, 2),
1539-
DRV_PINGROUP(pk7, 0x9f0, -1, -1, -1, -1, 28, 2, 30, 2),
1540-
DRV_PINGROUP(pl0, 0x9f4, -1, -1, -1, -1, 28, 2, 30, 2),
1541-
DRV_PINGROUP(pl1, 0x9f8, -1, -1, -1, -1, 28, 2, 30, 2),
1542-
DRV_PINGROUP(pz0, 0x9fc, 12, 7, 20, 7, -1, -1, -1, -1),
1543-
DRV_PINGROUP(pz1, 0xa00, 12, 7, 20, 7, -1, -1, -1, -1),
1544-
DRV_PINGROUP(pz2, 0xa04, 12, 7, 20, 7, -1, -1, -1, -1),
1545-
DRV_PINGROUP(pz3, 0xa08, 12, 7, 20, 7, -1, -1, -1, -1),
1546-
DRV_PINGROUP(pz4, 0xa0c, 12, 7, 20, 7, -1, -1, -1, -1),
1547-
DRV_PINGROUP(pz5, 0xa10, 12, 7, 20, 7, -1, -1, -1, -1),
1548-
DRV_PINGROUP(sdmmc1, 0xa98, 12, 7, 20, 7, 28, 2, 30, 2),
1549-
DRV_PINGROUP(sdmmc2, 0xa9c, 2, 6, 8, 6, 28, 2, 30, 2),
1550-
DRV_PINGROUP(sdmmc3, 0xab0, 12, 7, 20, 7, 28, 2, 30, 2),
1551-
DRV_PINGROUP(sdmmc4, 0xab4, 2, 6, 8, 6, 28, 2, 30, 2),
1526+
/* pg_name, r, prk_mask, drvdn_b, drvdn_w, drvup_b, drvup_w, slwr_b, slwr_w, slwf_b, slwf_w */
1527+
DRV_PINGROUP(pa6, 0x9c0, 0x0, 12, 5, 20, 5, -1, -1, -1, -1),
1528+
DRV_PINGROUP(pcc7, 0x9c4, 0x0, 12, 5, 20, 5, -1, -1, -1, -1),
1529+
DRV_PINGROUP(pe6, 0x9c8, 0x0, 12, 5, 20, 5, -1, -1, -1, -1),
1530+
DRV_PINGROUP(pe7, 0x9cc, 0x0, 12, 5, 20, 5, -1, -1, -1, -1),
1531+
DRV_PINGROUP(ph6, 0x9d0, 0x0, 12, 5, 20, 5, -1, -1, -1, -1),
1532+
DRV_PINGROUP(pk0, 0x9d4, 0x0, -1, -1, -1, -1, 28, 2, 30, 2),
1533+
DRV_PINGROUP(pk1, 0x9d8, 0x0, -1, -1, -1, -1, 28, 2, 30, 2),
1534+
DRV_PINGROUP(pk2, 0x9dc, 0x0, -1, -1, -1, -1, 28, 2, 30, 2),
1535+
DRV_PINGROUP(pk3, 0x9e0, 0x0, -1, -1, -1, -1, 28, 2, 30, 2),
1536+
DRV_PINGROUP(pk4, 0x9e4, 0x0, -1, -1, -1, -1, 28, 2, 30, 2),
1537+
DRV_PINGROUP(pk5, 0x9e8, 0x0, -1, -1, -1, -1, 28, 2, 30, 2),
1538+
DRV_PINGROUP(pk6, 0x9ec, 0x0, -1, -1, -1, -1, 28, 2, 30, 2),
1539+
DRV_PINGROUP(pk7, 0x9f0, 0x0, -1, -1, -1, -1, 28, 2, 30, 2),
1540+
DRV_PINGROUP(pl0, 0x9f4, 0x0, -1, -1, -1, -1, 28, 2, 30, 2),
1541+
DRV_PINGROUP(pl1, 0x9f8, 0x0, -1, -1, -1, -1, 28, 2, 30, 2),
1542+
DRV_PINGROUP(pz0, 0x9fc, 0x0, 12, 7, 20, 7, -1, -1, -1, -1),
1543+
DRV_PINGROUP(pz1, 0xa00, 0x0, 12, 7, 20, 7, -1, -1, -1, -1),
1544+
DRV_PINGROUP(pz2, 0xa04, 0x0, 12, 7, 20, 7, -1, -1, -1, -1),
1545+
DRV_PINGROUP(pz3, 0xa08, 0x0, 12, 7, 20, 7, -1, -1, -1, -1),
1546+
DRV_PINGROUP(pz4, 0xa0c, 0x0, 12, 7, 20, 7, -1, -1, -1, -1),
1547+
DRV_PINGROUP(pz5, 0xa10, 0x0, 12, 7, 20, 7, -1, -1, -1, -1),
1548+
DRV_PINGROUP(sdmmc1, 0xa98, 0x0, 12, 7, 20, 7, 28, 2, 30, 2),
1549+
DRV_PINGROUP(sdmmc2, 0xa9c, 0x7ffc000, 2, 6, 8, 6, 28, 2, 30, 2),
1550+
DRV_PINGROUP(sdmmc3, 0xab0, 0x0, 12, 7, 20, 7, 28, 2, 30, 2),
1551+
DRV_PINGROUP(sdmmc4, 0xab4, 0x7ffc000, 2, 6, 8, 6, 28, 2, 30, 2),
15521552
};
15531553

15541554
static const struct tegra_pinctrl_soc_data tegra210_pinctrl = {

drivers/pinctrl/tegra/pinctrl-tegra30.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2141,8 +2141,8 @@ static struct tegra_function tegra30_functions[] = {
21412141
.lock_bit = 7, \
21422142
.ioreset_bit = PINGROUP_BIT_##ior(8), \
21432143
.rcv_sel_bit = -1, \
2144-
.parked_bit = -1, \
21452144
.drv_reg = -1, \
2145+
.parked_bitmask = 0, \
21462146
}
21472147

21482148
#define DRV_PINGROUP(pg_name, r, hsm_b, schmitt_b, lpmd_b, drvdn_b, \
@@ -2162,7 +2162,6 @@ static struct tegra_function tegra30_functions[] = {
21622162
.rcv_sel_bit = -1, \
21632163
.drv_reg = DRV_PINGROUP_REG(r), \
21642164
.drv_bank = 0, \
2165-
.parked_bit = -1, \
21662165
.hsm_bit = hsm_b, \
21672166
.schmitt_bit = schmitt_b, \
21682167
.lpmd_bit = lpmd_b, \
@@ -2175,6 +2174,7 @@ static struct tegra_function tegra30_functions[] = {
21752174
.slwf_bit = slwf_b, \
21762175
.slwf_width = slwf_w, \
21772176
.drvtype_bit = -1, \
2177+
.parked_bitmask = 0, \
21782178
}
21792179

21802180
static const struct tegra_pingroup tegra30_groups[] = {

0 commit comments

Comments
 (0)