aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Paul <seanpaul@chromium.org>2014-09-09 15:58:45 -0400
committerLinus Walleij <linus.walleij@linaro.org>2014-09-19 13:28:54 -0400
commit3ccc11f6b82c34646c8a4233278251d9e9e99390 (patch)
tree7c6e506fac1b64654289ad3b59dc4ea940b8004a
parent02b837ffe033ed3b50787e0f3e4103ea5a34636b (diff)
pinctrl: tegra: Add MIPI pad control
This patch adds MIPI CSI/DSIB pad control mux register from the APB misc block to tegra pinctrl. Without writing to this register, the dsib pads are muxed as csi, and cannot be used. The register is not yet documented in the TRM, here is the description: 70000820: APB_MISC_GP_MIPI_PAD_CTRL_0 [31:02] RESERVED [01:01] DSIB_MODE [CSI=0,DSIB=1] [00:00] RESERVED Signed-off-by: Sean Paul <seanpaul@chromium.org> Acked-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r--Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-pinmux.txt14
-rw-r--r--drivers/pinctrl/pinctrl-tegra124.c67
2 files changed, 78 insertions, 3 deletions
diff --git a/Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-pinmux.txt b/Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-pinmux.txt
index 6464bf769460..189814e7cdc7 100644
--- a/Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-pinmux.txt
+++ b/Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-pinmux.txt
@@ -10,6 +10,7 @@ Required properties:
10- reg: Should contain a list of base address and size pairs for: 10- reg: Should contain a list of base address and size pairs for:
11 -- first entry - the drive strength and pad control registers. 11 -- first entry - the drive strength and pad control registers.
12 -- second entry - the pinmux registers 12 -- second entry - the pinmux registers
13 -- third entry - the MIPI_PAD_CTRL register
13 14
14Tegra124 adds the following optional properties for pin configuration subnodes. 15Tegra124 adds the following optional properties for pin configuration subnodes.
15The macros for options are defined in the 16The macros for options are defined in the
@@ -91,6 +92,12 @@ Valid values for pin and group names are:
91 dbg, sdio3, spi, uaa, uab, uart2, uart3, sdio1, ddc, gma, gme, gmf, gmg, 92 dbg, sdio3, spi, uaa, uab, uart2, uart3, sdio1, ddc, gma, gme, gmf, gmg,
92 gmh, owr, uda, gpv, dev3, cec, usb_vbus_en, ao3, ao0, hv0, sdio4, ao4. 93 gmh, owr, uda, gpv, dev3, cec, usb_vbus_en, ao3, ao0, hv0, sdio4, ao4.
93 94
95 MIPI pad control groups:
96
97 These support only the nvidia,function property.
98
99 dsi_b
100
94Valid values for nvidia,functions are: 101Valid values for nvidia,functions are:
95 102
96 blink, cec, cldvfs, clk12, cpu, dap, dap1, dap2, dev3, displaya, 103 blink, cec, cldvfs, clk12, cpu, dap, dap1, dap2, dev3, displaya,
@@ -101,14 +108,15 @@ Valid values for nvidia,functions are:
101 sdmmc4, soc, spdif, spi1, spi2, spi3, spi4, spi5, spi6, trace, uarta, 108 sdmmc4, soc, spdif, spi1, spi2, spi3, spi4, spi5, spi6, trace, uarta,
102 uartb, uartc, uartd, ulpi, usb, vgp1, vgp2, vgp3, vgp4, vgp5, vgp6, 109 uartb, uartc, uartd, ulpi, usb, vgp1, vgp2, vgp3, vgp4, vgp5, vgp6,
103 vi, vi_alt1, vi_alt3, vimclk2, vimclk2_alt, sata, ccla, pe0, pe, pe1, 110 vi, vi_alt1, vi_alt3, vimclk2, vimclk2_alt, sata, ccla, pe0, pe, pe1,
104 dp, rtck, sys, clk tmds. 111 dp, rtck, sys, clk tmds, csi, dsi_b
105 112
106Example: 113Example:
107 114
108 pinmux: pinmux { 115 pinmux: pinmux {
109 compatible = "nvidia,tegra124-pinmux"; 116 compatible = "nvidia,tegra124-pinmux";
110 reg = <0x70000868 0x164 /* Pad control registers */ 117 reg = <0x0 0x70000868 0x0 0x164>, /* Pad control registers */
111 0x70003000 0x434>; /* PinMux registers */ 118 <0x0 0x70003000 0x0 0x434>, /* Mux registers */
119 <0x0 0x70000820 0x0 0x8>; /* MIPI pad control */
112 }; 120 };
113 121
114Example pinmux entries: 122Example pinmux entries:
diff --git a/drivers/pinctrl/pinctrl-tegra124.c b/drivers/pinctrl/pinctrl-tegra124.c
index cb3e596cade1..2f9b75c14967 100644
--- a/drivers/pinctrl/pinctrl-tegra124.c
+++ b/drivers/pinctrl/pinctrl-tegra124.c
@@ -224,6 +224,16 @@
224#define TEGRA_PIN_OWR _PIN(5) 224#define TEGRA_PIN_OWR _PIN(5)
225#define TEGRA_PIN_CLK_32K_IN _PIN(6) 225#define TEGRA_PIN_CLK_32K_IN _PIN(6)
226#define TEGRA_PIN_JTAG_RTCK _PIN(7) 226#define TEGRA_PIN_JTAG_RTCK _PIN(7)
227#define TEGRA_PIN_DSI_B_CLK_P _PIN(8)
228#define TEGRA_PIN_DSI_B_CLK_N _PIN(9)
229#define TEGRA_PIN_DSI_B_D0_P _PIN(10)
230#define TEGRA_PIN_DSI_B_D0_N _PIN(11)
231#define TEGRA_PIN_DSI_B_D1_P _PIN(12)
232#define TEGRA_PIN_DSI_B_D1_N _PIN(13)
233#define TEGRA_PIN_DSI_B_D2_P _PIN(14)
234#define TEGRA_PIN_DSI_B_D2_N _PIN(15)
235#define TEGRA_PIN_DSI_B_D3_P _PIN(16)
236#define TEGRA_PIN_DSI_B_D3_N _PIN(17)
227 237
228static const struct pinctrl_pin_desc tegra124_pins[] = { 238static const struct pinctrl_pin_desc tegra124_pins[] = {
229 PINCTRL_PIN(TEGRA_PIN_CLK_32K_OUT_PA0, "CLK_32K_OUT PA0"), 239 PINCTRL_PIN(TEGRA_PIN_CLK_32K_OUT_PA0, "CLK_32K_OUT PA0"),
@@ -417,6 +427,16 @@ static const struct pinctrl_pin_desc tegra124_pins[] = {
417 PINCTRL_PIN(TEGRA_PIN_OWR, "OWR"), 427 PINCTRL_PIN(TEGRA_PIN_OWR, "OWR"),
418 PINCTRL_PIN(TEGRA_PIN_CLK_32K_IN, "CLK_32K_IN"), 428 PINCTRL_PIN(TEGRA_PIN_CLK_32K_IN, "CLK_32K_IN"),
419 PINCTRL_PIN(TEGRA_PIN_JTAG_RTCK, "JTAG_RTCK"), 429 PINCTRL_PIN(TEGRA_PIN_JTAG_RTCK, "JTAG_RTCK"),
430 PINCTRL_PIN(TEGRA_PIN_DSI_B_CLK_P, "DSI_B_CLK_P"),
431 PINCTRL_PIN(TEGRA_PIN_DSI_B_CLK_N, "DSI_B_CLK_N"),
432 PINCTRL_PIN(TEGRA_PIN_DSI_B_D0_P, "DSI_B_D0_P"),
433 PINCTRL_PIN(TEGRA_PIN_DSI_B_D0_N, "DSI_B_D0_N"),
434 PINCTRL_PIN(TEGRA_PIN_DSI_B_D1_P, "DSI_B_D1_P"),
435 PINCTRL_PIN(TEGRA_PIN_DSI_B_D1_N, "DSI_B_D1_N"),
436 PINCTRL_PIN(TEGRA_PIN_DSI_B_D2_P, "DSI_B_D2_P"),
437 PINCTRL_PIN(TEGRA_PIN_DSI_B_D2_N, "DSI_B_D2_N"),
438 PINCTRL_PIN(TEGRA_PIN_DSI_B_D3_P, "DSI_B_D3_P"),
439 PINCTRL_PIN(TEGRA_PIN_DSI_B_D3_N, "DSI_B_D3_N"),
420}; 440};
421 441
422static const unsigned clk_32k_out_pa0_pins[] = { 442static const unsigned clk_32k_out_pa0_pins[] = {
@@ -1495,6 +1515,19 @@ static const unsigned drive_ao4_pins[] = {
1495 TEGRA_PIN_JTAG_RTCK, 1515 TEGRA_PIN_JTAG_RTCK,
1496}; 1516};
1497 1517
1518static const unsigned mipi_pad_ctrl_dsi_b_pins[] = {
1519 TEGRA_PIN_DSI_B_CLK_P,
1520 TEGRA_PIN_DSI_B_CLK_N,
1521 TEGRA_PIN_DSI_B_D0_P,
1522 TEGRA_PIN_DSI_B_D0_N,
1523 TEGRA_PIN_DSI_B_D1_P,
1524 TEGRA_PIN_DSI_B_D1_N,
1525 TEGRA_PIN_DSI_B_D2_P,
1526 TEGRA_PIN_DSI_B_D2_N,
1527 TEGRA_PIN_DSI_B_D3_P,
1528 TEGRA_PIN_DSI_B_D3_N,
1529};
1530
1498enum tegra_mux { 1531enum tegra_mux {
1499 TEGRA_MUX_BLINK, 1532 TEGRA_MUX_BLINK,
1500 TEGRA_MUX_CCLA, 1533 TEGRA_MUX_CCLA,
@@ -1580,6 +1613,8 @@ enum tegra_mux {
1580 TEGRA_MUX_VI_ALT3, 1613 TEGRA_MUX_VI_ALT3,
1581 TEGRA_MUX_VIMCLK2, 1614 TEGRA_MUX_VIMCLK2,
1582 TEGRA_MUX_VIMCLK2_ALT, 1615 TEGRA_MUX_VIMCLK2_ALT,
1616 TEGRA_MUX_CSI,
1617 TEGRA_MUX_DSI_B,
1583}; 1618};
1584 1619
1585#define FUNCTION(fname) \ 1620#define FUNCTION(fname) \
@@ -1672,10 +1707,13 @@ static struct tegra_function tegra124_functions[] = {
1672 FUNCTION(vi_alt3), 1707 FUNCTION(vi_alt3),
1673 FUNCTION(vimclk2), 1708 FUNCTION(vimclk2),
1674 FUNCTION(vimclk2_alt), 1709 FUNCTION(vimclk2_alt),
1710 FUNCTION(csi),
1711 FUNCTION(dsi_b),
1675}; 1712};
1676 1713
1677#define DRV_PINGROUP_REG_A 0x868 /* bank 0 */ 1714#define DRV_PINGROUP_REG_A 0x868 /* bank 0 */
1678#define PINGROUP_REG_A 0x3000 /* bank 1 */ 1715#define PINGROUP_REG_A 0x3000 /* bank 1 */
1716#define MIPI_PAD_CTRL_PINGROUP_REG_A 0x820 /* bank 2 */
1679 1717
1680#define PINGROUP_REG(r) ((r) - PINGROUP_REG_A) 1718#define PINGROUP_REG(r) ((r) - PINGROUP_REG_A)
1681 1719
@@ -1744,6 +1782,32 @@ static struct tegra_function tegra124_functions[] = {
1744 .drvtype_bit = PINGROUP_BIT_##drvtype(6), \ 1782 .drvtype_bit = PINGROUP_BIT_##drvtype(6), \
1745 } 1783 }
1746 1784
1785#define MIPI_PAD_CTRL_PINGROUP_REG_Y(r) ((r) - MIPI_PAD_CTRL_PINGROUP_REG_A)
1786
1787#define MIPI_PAD_CTRL_PINGROUP(pg_name, r, b, f0, f1) \
1788 { \
1789 .name = "mipi_pad_ctrl_" #pg_name, \
1790 .pins = mipi_pad_ctrl_##pg_name##_pins, \
1791 .npins = ARRAY_SIZE(mipi_pad_ctrl_##pg_name##_pins), \
1792 .funcs = { \
1793 TEGRA_MUX_ ## f0, \
1794 TEGRA_MUX_ ## f1, \
1795 TEGRA_MUX_RSVD3, \
1796 TEGRA_MUX_RSVD4, \
1797 }, \
1798 .mux_reg = MIPI_PAD_CTRL_PINGROUP_REG_Y(r), \
1799 .mux_bank = 2, \
1800 .mux_bit = b, \
1801 .pupd_reg = -1, \
1802 .tri_reg = -1, \
1803 .einput_bit = -1, \
1804 .odrain_bit = -1, \
1805 .lock_bit = -1, \
1806 .ioreset_bit = -1, \
1807 .rcv_sel_bit = -1, \
1808 .drv_reg = -1, \
1809 }
1810
1747static const struct tegra_pingroup tegra124_groups[] = { 1811static const struct tegra_pingroup tegra124_groups[] = {
1748 /* pg_name, f0, f1, f2, f3, r, od, ior, rcv_sel */ 1812 /* pg_name, f0, f1, f2, f3, r, od, ior, rcv_sel */
1749 PINGROUP(ulpi_data0_po1, SPI3, HSI, UARTA, ULPI, 0x3000, N, N, N), 1813 PINGROUP(ulpi_data0_po1, SPI3, HSI, UARTA, ULPI, 0x3000, N, N, N),
@@ -1979,6 +2043,9 @@ static const struct tegra_pingroup tegra124_groups[] = {
1979 DRV_PINGROUP(hv0, 0x9b4, 2, 3, 4, 12, 5, -1, -1, 28, 2, -1, -1, N), 2043 DRV_PINGROUP(hv0, 0x9b4, 2, 3, 4, 12, 5, -1, -1, 28, 2, -1, -1, N),
1980 DRV_PINGROUP(sdio4, 0x9c4, 2, 3, 4, 12, 5, 20, 5, 28, 2, 30, 2, N), 2044 DRV_PINGROUP(sdio4, 0x9c4, 2, 3, 4, 12, 5, 20, 5, 28, 2, 30, 2, N),
1981 DRV_PINGROUP(ao4, 0x9c8, 2, 3, 4, 12, 7, 20, 7, 28, 2, 30, 2, Y), 2045 DRV_PINGROUP(ao4, 0x9c8, 2, 3, 4, 12, 7, 20, 7, 28, 2, 30, 2, Y),
2046
2047 /* pg_name, r b f0, f1 */
2048 MIPI_PAD_CTRL_PINGROUP(dsi_b, 0x820, 1, CSI, DSI_B)
1982}; 2049};
1983 2050
1984static const struct tegra_pinctrl_soc_data tegra124_pinctrl = { 2051static const struct tegra_pinctrl_soc_data tegra124_pinctrl = {