Merge branch 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
[firefly-linux-kernel-4.4.55.git] / drivers / pinctrl / pinctrl-tegra124.c
index e80797e200177e96f69c330a36a2cbf522147257..2f9b75c14967e508557a8ccf72159ff2bdd6a318 100644 (file)
 #define TEGRA_PIN_OWR                          _PIN(5)
 #define TEGRA_PIN_CLK_32K_IN                   _PIN(6)
 #define TEGRA_PIN_JTAG_RTCK                    _PIN(7)
+#define TEGRA_PIN_DSI_B_CLK_P                  _PIN(8)
+#define TEGRA_PIN_DSI_B_CLK_N                  _PIN(9)
+#define TEGRA_PIN_DSI_B_D0_P                   _PIN(10)
+#define TEGRA_PIN_DSI_B_D0_N                   _PIN(11)
+#define TEGRA_PIN_DSI_B_D1_P                   _PIN(12)
+#define TEGRA_PIN_DSI_B_D1_N                   _PIN(13)
+#define TEGRA_PIN_DSI_B_D2_P                   _PIN(14)
+#define TEGRA_PIN_DSI_B_D2_N                   _PIN(15)
+#define TEGRA_PIN_DSI_B_D3_P                   _PIN(16)
+#define TEGRA_PIN_DSI_B_D3_N                   _PIN(17)
 
 static const struct pinctrl_pin_desc tegra124_pins[] = {
        PINCTRL_PIN(TEGRA_PIN_CLK_32K_OUT_PA0, "CLK_32K_OUT PA0"),
@@ -417,6 +427,16 @@ static const struct pinctrl_pin_desc tegra124_pins[] = {
        PINCTRL_PIN(TEGRA_PIN_OWR, "OWR"),
        PINCTRL_PIN(TEGRA_PIN_CLK_32K_IN, "CLK_32K_IN"),
        PINCTRL_PIN(TEGRA_PIN_JTAG_RTCK, "JTAG_RTCK"),
+       PINCTRL_PIN(TEGRA_PIN_DSI_B_CLK_P, "DSI_B_CLK_P"),
+       PINCTRL_PIN(TEGRA_PIN_DSI_B_CLK_N, "DSI_B_CLK_N"),
+       PINCTRL_PIN(TEGRA_PIN_DSI_B_D0_P, "DSI_B_D0_P"),
+       PINCTRL_PIN(TEGRA_PIN_DSI_B_D0_N, "DSI_B_D0_N"),
+       PINCTRL_PIN(TEGRA_PIN_DSI_B_D1_P, "DSI_B_D1_P"),
+       PINCTRL_PIN(TEGRA_PIN_DSI_B_D1_N, "DSI_B_D1_N"),
+       PINCTRL_PIN(TEGRA_PIN_DSI_B_D2_P, "DSI_B_D2_P"),
+       PINCTRL_PIN(TEGRA_PIN_DSI_B_D2_N, "DSI_B_D2_N"),
+       PINCTRL_PIN(TEGRA_PIN_DSI_B_D3_P, "DSI_B_D3_P"),
+       PINCTRL_PIN(TEGRA_PIN_DSI_B_D3_N, "DSI_B_D3_N"),
 };
 
 static const unsigned clk_32k_out_pa0_pins[] = {
@@ -1495,6 +1515,19 @@ static const unsigned drive_ao4_pins[] = {
        TEGRA_PIN_JTAG_RTCK,
 };
 
+static const unsigned mipi_pad_ctrl_dsi_b_pins[] = {
+       TEGRA_PIN_DSI_B_CLK_P,
+       TEGRA_PIN_DSI_B_CLK_N,
+       TEGRA_PIN_DSI_B_D0_P,
+       TEGRA_PIN_DSI_B_D0_N,
+       TEGRA_PIN_DSI_B_D1_P,
+       TEGRA_PIN_DSI_B_D1_N,
+       TEGRA_PIN_DSI_B_D2_P,
+       TEGRA_PIN_DSI_B_D2_N,
+       TEGRA_PIN_DSI_B_D3_P,
+       TEGRA_PIN_DSI_B_D3_N,
+};
+
 enum tegra_mux {
        TEGRA_MUX_BLINK,
        TEGRA_MUX_CCLA,
@@ -1580,6 +1613,8 @@ enum tegra_mux {
        TEGRA_MUX_VI_ALT3,
        TEGRA_MUX_VIMCLK2,
        TEGRA_MUX_VIMCLK2_ALT,
+       TEGRA_MUX_CSI,
+       TEGRA_MUX_DSI_B,
 };
 
 #define FUNCTION(fname)                                        \
@@ -1672,10 +1707,13 @@ static struct tegra_function tegra124_functions[] = {
        FUNCTION(vi_alt3),
        FUNCTION(vimclk2),
        FUNCTION(vimclk2_alt),
+       FUNCTION(csi),
+       FUNCTION(dsi_b),
 };
 
 #define DRV_PINGROUP_REG_A             0x868   /* bank 0 */
 #define PINGROUP_REG_A                 0x3000  /* bank 1 */
+#define MIPI_PAD_CTRL_PINGROUP_REG_A   0x820   /* bank 2 */
 
 #define PINGROUP_REG(r)                        ((r) - PINGROUP_REG_A)
 
@@ -1744,6 +1782,32 @@ static struct tegra_function tegra124_functions[] = {
                .drvtype_bit = PINGROUP_BIT_##drvtype(6),               \
        }
 
+#define MIPI_PAD_CTRL_PINGROUP_REG_Y(r)        ((r) - MIPI_PAD_CTRL_PINGROUP_REG_A)
+
+#define MIPI_PAD_CTRL_PINGROUP(pg_name, r, b, f0, f1)                  \
+       {                                                               \
+               .name = "mipi_pad_ctrl_" #pg_name,                      \
+               .pins = mipi_pad_ctrl_##pg_name##_pins,                 \
+               .npins = ARRAY_SIZE(mipi_pad_ctrl_##pg_name##_pins),    \
+               .funcs = {                                              \
+                       TEGRA_MUX_ ## f0,                               \
+                       TEGRA_MUX_ ## f1,                               \
+                       TEGRA_MUX_RSVD3,                                \
+                       TEGRA_MUX_RSVD4,                                \
+               },                                                      \
+               .mux_reg = MIPI_PAD_CTRL_PINGROUP_REG_Y(r),             \
+               .mux_bank = 2,                                          \
+               .mux_bit = b,                                           \
+               .pupd_reg = -1,                                         \
+               .tri_reg = -1,                                          \
+               .einput_bit = -1,                                       \
+               .odrain_bit = -1,                                       \
+               .lock_bit = -1,                                         \
+               .ioreset_bit = -1,                                      \
+               .rcv_sel_bit = -1,                                      \
+               .drv_reg = -1,                                          \
+       }
+
 static const struct tegra_pingroup tegra124_groups[] = {
        /*       pg_name,                f0,         f1,         f2,           f3,          r,      od, ior, rcv_sel */
        PINGROUP(ulpi_data0_po1,         SPI3,       HSI,        UARTA,        ULPI,        0x3000, N,   N,  N),
@@ -1979,6 +2043,9 @@ static const struct tegra_pingroup tegra124_groups[] = {
        DRV_PINGROUP(hv0,         0x9b4,  2,  3,  4,  12,  5,  -1, -1,  28,  2,  -1, -1,  N),
        DRV_PINGROUP(sdio4,       0x9c4,  2,  3,  4,  12,  5,  20,  5,  28,  2,  30,  2,  N),
        DRV_PINGROUP(ao4,         0x9c8,  2,  3,  4,  12,  7,  20,  7,  28,  2,  30,  2,  Y),
+
+       /*                     pg_name, r      b  f0,  f1 */
+       MIPI_PAD_CTRL_PINGROUP(dsi_b,   0x820, 1, CSI, DSI_B)
 };
 
 static const struct tegra_pinctrl_soc_data tegra124_pinctrl = {
@@ -1996,7 +2063,7 @@ static int tegra124_pinctrl_probe(struct platform_device *pdev)
        return tegra_pinctrl_probe(pdev, &tegra124_pinctrl);
 }
 
-static struct of_device_id tegra124_pinctrl_of_match[] = {
+static const struct of_device_id tegra124_pinctrl_of_match[] = {
        { .compatible = "nvidia,tegra124-pinmux", },
        { },
 };