Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Heiko Stübner and committed by
Linus Walleij
304f077d 62f49226

+74
+1
Documentation/devicetree/bindings/pinctrl/rockchip,pinctrl.txt
··· 21 21 Required properties for iomux controller: 22 22 - compatible: one of "rockchip,rk2928-pinctrl", "rockchip,rk3066a-pinctrl" 23 23 "rockchip,rk3066b-pinctrl", "rockchip,rk3188-pinctrl" 24 + "rockchip,rk3288-pinctrl" 24 25 - rockchip,grf: phandle referencing a syscon providing the 25 26 "general register files" 26 27
+73
drivers/pinctrl/pinctrl-rockchip.c
··· 543 543 } 544 544 } 545 545 546 + #define RK3288_PULL_OFFSET 0x140 547 + static 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 + 546 575 static int rockchip_get_pull(struct rockchip_pin_bank *bank, int pin_num) 547 576 { 548 577 struct rockchip_pinctrl *info = bank->drvdata; ··· 1809 1780 .pull_calc_reg = rk3188_calc_pull_reg_and_bit, 1810 1781 }; 1811 1782 1783 + static struct rockchip_pin_bank rk3288_pin_banks[] = { 1784 + PIN_BANK_IOMUX_FLAGS(0, 24, "gpio0", IOMUX_SOURCE_PMU, 1785 + IOMUX_SOURCE_PMU, 1786 + IOMUX_SOURCE_PMU, 1787 + IOMUX_UNROUTED 1788 + ), 1789 + PIN_BANK_IOMUX_FLAGS(1, 32, "gpio1", IOMUX_UNROUTED, 1790 + IOMUX_UNROUTED, 1791 + IOMUX_UNROUTED, 1792 + 0 1793 + ), 1794 + PIN_BANK_IOMUX_FLAGS(2, 32, "gpio2", 0, 0, 0, IOMUX_UNROUTED), 1795 + PIN_BANK_IOMUX_FLAGS(3, 32, "gpio3", 0, 0, 0, IOMUX_WIDTH_4BIT), 1796 + PIN_BANK_IOMUX_FLAGS(4, 32, "gpio4", IOMUX_WIDTH_4BIT, 1797 + IOMUX_WIDTH_4BIT, 1798 + 0, 1799 + 0 1800 + ), 1801 + PIN_BANK_IOMUX_FLAGS(5, 32, "gpio5", IOMUX_UNROUTED, 1802 + 0, 1803 + 0, 1804 + IOMUX_UNROUTED 1805 + ), 1806 + PIN_BANK_IOMUX_FLAGS(6, 32, "gpio6", 0, 0, 0, IOMUX_UNROUTED), 1807 + PIN_BANK_IOMUX_FLAGS(7, 32, "gpio7", 0, 1808 + 0, 1809 + IOMUX_WIDTH_4BIT, 1810 + IOMUX_UNROUTED 1811 + ), 1812 + PIN_BANK(8, 16, "gpio8"), 1813 + }; 1814 + 1815 + static struct rockchip_pin_ctrl rk3288_pin_ctrl = { 1816 + .pin_banks = rk3288_pin_banks, 1817 + .nr_banks = ARRAY_SIZE(rk3288_pin_banks), 1818 + .label = "RK3288-GPIO", 1819 + .type = RK3188, 1820 + .grf_mux_offset = 0x0, 1821 + .pmu_mux_offset = 0x84, 1822 + .pull_calc_reg = rk3288_calc_pull_reg_and_bit, 1823 + }; 1824 + 1812 1825 static const struct of_device_id rockchip_pinctrl_dt_match[] = { 1813 1826 { .compatible = "rockchip,rk2928-pinctrl", 1814 1827 .data = (void *)&rk2928_pin_ctrl }, ··· 1860 1789 .data = (void *)&rk3066b_pin_ctrl }, 1861 1790 { .compatible = "rockchip,rk3188-pinctrl", 1862 1791 .data = (void *)&rk3188_pin_ctrl }, 1792 + { .compatible = "rockchip,rk3288-pinctrl", 1793 + .data = (void *)&rk3288_pin_ctrl }, 1863 1794 {}, 1864 1795 }; 1865 1796 MODULE_DEVICE_TABLE(of, rockchip_pinctrl_dt_match);