aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl/pinctrl-rockchip.c
diff options
context:
space:
mode:
authorHeiko Stübner <heiko@sntech.de>2014-06-15 19:38:14 -0400
committerLinus Walleij <linus.walleij@linaro.org>2014-07-11 08:08:29 -0400
commit304f077d4c07d315b9325cb101fc47ba2ffc5466 (patch)
tree741fff4a851a473f9d75bd3fc48f6c171f4dca77 /drivers/pinctrl/pinctrl-rockchip.c
parent62f49226b03b6464b6fa71ad926932f9b3c8232a (diff)
pinctrl: rockchip: add support for rk3288 pin-controller
The pin-controller of the new RK3288 contains all the quirks just added in the previous patches. Signed-off-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/pinctrl-rockchip.c')
-rw-r--r--drivers/pinctrl/pinctrl-rockchip.c73
1 files changed, 73 insertions, 0 deletions
diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c
index 65b73217c2c3..192aaee8de07 100644
--- a/drivers/pinctrl/pinctrl-rockchip.c
+++ b/drivers/pinctrl/pinctrl-rockchip.c
@@ -543,6 +543,35 @@ static void rk3188_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank,
543 } 543 }
544} 544}
545 545
546#define RK3288_PULL_OFFSET 0x140
547static void rk3288_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank,
548 int pin_num, struct regmap **regmap,
549 int *reg, u8 *bit)
550{
551 struct rockchip_pinctrl *info = bank->drvdata;
552
553 /* The first 24 pins of the first bank are located in PMU */
554 if (bank->bank_num == 0) {
555 *regmap = info->regmap_pmu;
556 *reg = RK3188_PULL_PMU_OFFSET;
557
558 *reg += ((pin_num / RK3188_PULL_PINS_PER_REG) * 4);
559 *bit = pin_num % RK3188_PULL_PINS_PER_REG;
560 *bit *= RK3188_PULL_BITS_PER_PIN;
561 } else {
562 *regmap = info->regmap_base;
563 *reg = RK3288_PULL_OFFSET;
564
565 /* correct the offset, as we're starting with the 2nd bank */
566 *reg -= 0x10;
567 *reg += bank->bank_num * RK3188_PULL_BANK_STRIDE;
568 *reg += ((pin_num / RK3188_PULL_PINS_PER_REG) * 4);
569
570 *bit = (pin_num % RK3188_PULL_PINS_PER_REG);
571 *bit *= RK3188_PULL_BITS_PER_PIN;
572 }
573}
574
546static int rockchip_get_pull(struct rockchip_pin_bank *bank, int pin_num) 575static int rockchip_get_pull(struct rockchip_pin_bank *bank, int pin_num)
547{ 576{
548 struct rockchip_pinctrl *info = bank->drvdata; 577 struct rockchip_pinctrl *info = bank->drvdata;
@@ -1780,6 +1809,48 @@ static struct rockchip_pin_ctrl rk3188_pin_ctrl = {
1780 .pull_calc_reg = rk3188_calc_pull_reg_and_bit, 1809 .pull_calc_reg = rk3188_calc_pull_reg_and_bit,
1781}; 1810};
1782 1811
1812static struct rockchip_pin_bank rk3288_pin_banks[] = {
1813 PIN_BANK_IOMUX_FLAGS(0, 24, "gpio0", IOMUX_SOURCE_PMU,
1814 IOMUX_SOURCE_PMU,
1815 IOMUX_SOURCE_PMU,
1816 IOMUX_UNROUTED
1817 ),
1818 PIN_BANK_IOMUX_FLAGS(1, 32, "gpio1", IOMUX_UNROUTED,
1819 IOMUX_UNROUTED,
1820 IOMUX_UNROUTED,
1821 0
1822 ),
1823 PIN_BANK_IOMUX_FLAGS(2, 32, "gpio2", 0, 0, 0, IOMUX_UNROUTED),
1824 PIN_BANK_IOMUX_FLAGS(3, 32, "gpio3", 0, 0, 0, IOMUX_WIDTH_4BIT),
1825 PIN_BANK_IOMUX_FLAGS(4, 32, "gpio4", IOMUX_WIDTH_4BIT,
1826 IOMUX_WIDTH_4BIT,
1827 0,
1828 0
1829 ),
1830 PIN_BANK_IOMUX_FLAGS(5, 32, "gpio5", IOMUX_UNROUTED,
1831 0,
1832 0,
1833 IOMUX_UNROUTED
1834 ),
1835 PIN_BANK_IOMUX_FLAGS(6, 32, "gpio6", 0, 0, 0, IOMUX_UNROUTED),
1836 PIN_BANK_IOMUX_FLAGS(7, 32, "gpio7", 0,
1837 0,
1838 IOMUX_WIDTH_4BIT,
1839 IOMUX_UNROUTED
1840 ),
1841 PIN_BANK(8, 16, "gpio8"),
1842};
1843
1844static struct rockchip_pin_ctrl rk3288_pin_ctrl = {
1845 .pin_banks = rk3288_pin_banks,
1846 .nr_banks = ARRAY_SIZE(rk3288_pin_banks),
1847 .label = "RK3288-GPIO",
1848 .type = RK3188,
1849 .grf_mux_offset = 0x0,
1850 .pmu_mux_offset = 0x84,
1851 .pull_calc_reg = rk3288_calc_pull_reg_and_bit,
1852};
1853
1783static const struct of_device_id rockchip_pinctrl_dt_match[] = { 1854static const struct of_device_id rockchip_pinctrl_dt_match[] = {
1784 { .compatible = "rockchip,rk2928-pinctrl", 1855 { .compatible = "rockchip,rk2928-pinctrl",
1785 .data = (void *)&rk2928_pin_ctrl }, 1856 .data = (void *)&rk2928_pin_ctrl },
@@ -1789,6 +1860,8 @@ static const struct of_device_id rockchip_pinctrl_dt_match[] = {
1789 .data = (void *)&rk3066b_pin_ctrl }, 1860 .data = (void *)&rk3066b_pin_ctrl },
1790 { .compatible = "rockchip,rk3188-pinctrl", 1861 { .compatible = "rockchip,rk3188-pinctrl",
1791 .data = (void *)&rk3188_pin_ctrl }, 1862 .data = (void *)&rk3188_pin_ctrl },
1863 { .compatible = "rockchip,rk3288-pinctrl",
1864 .data = (void *)&rk3288_pin_ctrl },
1792 {}, 1865 {},
1793}; 1866};
1794MODULE_DEVICE_TABLE(of, rockchip_pinctrl_dt_match); 1867MODULE_DEVICE_TABLE(of, rockchip_pinctrl_dt_match);