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

pinctrl: airoha: add support for Airoha AN7583 PINs

Add all the required entry to add suppot for Airoha AN7583 PINs.

Where possible the same function group are used from Airoha EN7581 to
reduce code duplication.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Christian Marangi and committed by
Linus Walleij
3ffeb17a e6e47d31

+740 -7
+740 -7
drivers/pinctrl/mediatek/pinctrl-airoha.c
··· 70 70 #define GPIO_PCM_SPI_CS3_MODE_MASK BIT(20) 71 71 #define GPIO_PCM_SPI_CS2_MODE_P156_MASK BIT(19) 72 72 #define GPIO_PCM_SPI_CS2_MODE_P128_MASK BIT(18) 73 + #define AN7583_GPIO_PCM_SPI_CS2_MODE_MASK BIT(18) 73 74 #define GPIO_PCM_SPI_CS1_MODE_MASK BIT(17) 74 75 #define GPIO_PCM_SPI_MODE_MASK BIT(16) 75 76 #define GPIO_PCM2_MODE_MASK BIT(13) ··· 128 127 129 128 /* CONF */ 130 129 #define REG_I2C_SDA_E2 0x001c 130 + #define AN7583_I2C1_SCL_E2_MASK BIT(16) 131 + #define AN7583_I2C1_SDA_E2_MASK BIT(15) 131 132 #define SPI_MISO_E2_MASK BIT(14) 132 133 #define SPI_MOSI_E2_MASK BIT(13) 133 134 #define SPI_CLK_E2_MASK BIT(12) ··· 137 134 #define PCIE2_RESET_E2_MASK BIT(10) 138 135 #define PCIE1_RESET_E2_MASK BIT(9) 139 136 #define PCIE0_RESET_E2_MASK BIT(8) 137 + #define AN7583_MDIO_0_E2_MASK BIT(5) 138 + #define AN7583_MDC_0_E2_MASK BIT(4) 140 139 #define UART1_RXD_E2_MASK BIT(3) 141 140 #define UART1_TXD_E2_MASK BIT(2) 142 141 #define I2C_SCL_E2_MASK BIT(1) 143 142 #define I2C_SDA_E2_MASK BIT(0) 144 143 145 144 #define REG_I2C_SDA_E4 0x0020 145 + #define AN7583_I2C1_SCL_E4_MASK BIT(16) 146 + #define AN7583_I2C1_SDA_E4_MASK BIT(15) 146 147 #define SPI_MISO_E4_MASK BIT(14) 147 148 #define SPI_MOSI_E4_MASK BIT(13) 148 149 #define SPI_CLK_E4_MASK BIT(12) ··· 154 147 #define PCIE2_RESET_E4_MASK BIT(10) 155 148 #define PCIE1_RESET_E4_MASK BIT(9) 156 149 #define PCIE0_RESET_E4_MASK BIT(8) 150 + #define AN7583_MDIO_0_E4_MASK BIT(5) 151 + #define AN7583_MDC_0_E4_MASK BIT(4) 157 152 #define UART1_RXD_E4_MASK BIT(3) 158 153 #define UART1_TXD_E4_MASK BIT(2) 159 154 #define I2C_SCL_E4_MASK BIT(1) ··· 167 158 #define REG_GPIO_H_E4 0x0030 168 159 169 160 #define REG_I2C_SDA_PU 0x0044 161 + #define AN7583_I2C1_SCL_PU_MASK BIT(16) 162 + #define AN7583_I2C1_SDA_PU_MASK BIT(15) 170 163 #define SPI_MISO_PU_MASK BIT(14) 171 164 #define SPI_MOSI_PU_MASK BIT(13) 172 165 #define SPI_CLK_PU_MASK BIT(12) ··· 176 165 #define PCIE2_RESET_PU_MASK BIT(10) 177 166 #define PCIE1_RESET_PU_MASK BIT(9) 178 167 #define PCIE0_RESET_PU_MASK BIT(8) 168 + #define AN7583_MDIO_0_PU_MASK BIT(5) 169 + #define AN7583_MDC_0_PU_MASK BIT(4) 179 170 #define UART1_RXD_PU_MASK BIT(3) 180 171 #define UART1_TXD_PU_MASK BIT(2) 181 172 #define I2C_SCL_PU_MASK BIT(1) 182 173 #define I2C_SDA_PU_MASK BIT(0) 183 174 184 175 #define REG_I2C_SDA_PD 0x0048 176 + #define AN7583_I2C1_SDA_PD_MASK BIT(16) 177 + #define AN7583_I2C1_SCL_PD_MASK BIT(15) 185 178 #define SPI_MISO_PD_MASK BIT(14) 186 179 #define SPI_MOSI_PD_MASK BIT(13) 187 180 #define SPI_CLK_PD_MASK BIT(12) ··· 193 178 #define PCIE2_RESET_PD_MASK BIT(10) 194 179 #define PCIE1_RESET_PD_MASK BIT(9) 195 180 #define PCIE0_RESET_PD_MASK BIT(8) 181 + #define AN7583_MDIO_0_PD_MASK BIT(5) 182 + #define AN7583_MDC_0_PD_MASK BIT(4) 196 183 #define UART1_RXD_PD_MASK BIT(3) 197 184 #define UART1_TXD_PD_MASK BIT(2) 198 185 #define I2C_SCL_PD_MASK BIT(1) ··· 642 625 PINCTRL_PIN_GROUP("pcie_reset2", en7581_pcie_reset2), 643 626 }; 644 627 628 + static struct pinctrl_pin_desc an7583_pinctrl_pins[] = { 629 + PINCTRL_PIN(2, "gpio0"), 630 + PINCTRL_PIN(3, "gpio1"), 631 + PINCTRL_PIN(4, "gpio2"), 632 + PINCTRL_PIN(5, "gpio3"), 633 + PINCTRL_PIN(6, "gpio4"), 634 + PINCTRL_PIN(7, "gpio5"), 635 + PINCTRL_PIN(8, "gpio6"), 636 + PINCTRL_PIN(9, "gpio7"), 637 + PINCTRL_PIN(10, "gpio8"), 638 + PINCTRL_PIN(11, "gpio9"), 639 + PINCTRL_PIN(12, "gpio10"), 640 + PINCTRL_PIN(13, "gpio11"), 641 + PINCTRL_PIN(14, "gpio12"), 642 + PINCTRL_PIN(15, "gpio13"), 643 + PINCTRL_PIN(16, "gpio14"), 644 + PINCTRL_PIN(17, "gpio15"), 645 + PINCTRL_PIN(18, "gpio16"), 646 + PINCTRL_PIN(19, "gpio17"), 647 + PINCTRL_PIN(20, "gpio18"), 648 + PINCTRL_PIN(21, "gpio19"), 649 + PINCTRL_PIN(22, "gpio20"), 650 + PINCTRL_PIN(23, "gpio21"), 651 + PINCTRL_PIN(24, "gpio22"), 652 + PINCTRL_PIN(25, "gpio23"), 653 + PINCTRL_PIN(26, "gpio24"), 654 + PINCTRL_PIN(27, "gpio25"), 655 + PINCTRL_PIN(28, "gpio26"), 656 + PINCTRL_PIN(29, "gpio27"), 657 + PINCTRL_PIN(30, "gpio28"), 658 + PINCTRL_PIN(31, "gpio29"), 659 + PINCTRL_PIN(32, "gpio30"), 660 + PINCTRL_PIN(33, "gpio31"), 661 + PINCTRL_PIN(34, "gpio32"), 662 + PINCTRL_PIN(35, "gpio33"), 663 + PINCTRL_PIN(36, "gpio34"), 664 + PINCTRL_PIN(37, "gpio35"), 665 + PINCTRL_PIN(38, "gpio36"), 666 + PINCTRL_PIN(39, "gpio37"), 667 + PINCTRL_PIN(40, "gpio38"), 668 + PINCTRL_PIN(41, "i2c0_scl"), 669 + PINCTRL_PIN(42, "i2c0_sda"), 670 + PINCTRL_PIN(43, "i2c1_scl"), 671 + PINCTRL_PIN(44, "i2c1_sda"), 672 + PINCTRL_PIN(45, "spi_clk"), 673 + PINCTRL_PIN(46, "spi_cs"), 674 + PINCTRL_PIN(47, "spi_mosi"), 675 + PINCTRL_PIN(48, "spi_miso"), 676 + PINCTRL_PIN(49, "uart_txd"), 677 + PINCTRL_PIN(50, "uart_rxd"), 678 + PINCTRL_PIN(51, "pcie_reset0"), 679 + PINCTRL_PIN(52, "pcie_reset1"), 680 + PINCTRL_PIN(53, "mdc_0"), 681 + PINCTRL_PIN(54, "mdio_0"), 682 + }; 683 + 684 + static const int an7583_pon_pins[] = { 15, 16, 17, 18, 19, 20 }; 685 + static const int an7583_pon_tod_1pps_pins[] = { 32 }; 686 + static const int an7583_gsw_tod_1pps_pins[] = { 32 }; 687 + static const int an7583_sipo_pins[] = { 34, 35 }; 688 + static const int an7583_sipo_rclk_pins[] = { 34, 35, 33 }; 689 + static const int an7583_mdio_pins[] = { 43, 44 }; 690 + static const int an7583_uart2_pins[] = { 34, 35 }; 691 + static const int an7583_uart2_cts_rts_pins[] = { 32, 33 }; 692 + static const int an7583_hsuart_pins[] = { 30, 31 }; 693 + static const int an7583_hsuart_cts_rts_pins[] = { 28, 29 }; 694 + static const int an7583_npu_uart_pins[] = { 7, 8 }; 695 + static const int an7583_uart4_pins[] = { 7, 8 }; 696 + static const int an7583_uart5_pins[] = { 23, 24 }; 697 + static const int an7583_i2c0_pins[] = { 41, 42 }; 698 + static const int an7583_i2c1_pins[] = { 43, 44 }; 699 + static const int an7583_jtag_udi_pins[] = { 23, 24, 22, 25, 26 }; 700 + static const int an7583_jtag_dfd_pins[] = { 23, 24, 22, 25, 26 }; 701 + static const int an7583_pcm1_pins[] = { 10, 11, 12, 13, 14 }; 702 + static const int an7583_pcm2_pins[] = { 28, 29, 30, 31, 24 }; 703 + static const int an7583_spi_pins[] = { 28, 29, 30, 31 }; 704 + static const int an7583_spi_quad_pins[] = { 25, 26 }; 705 + static const int an7583_spi_cs1_pins[] = { 27 }; 706 + static const int an7583_pcm_spi_pins[] = { 28, 29, 30, 31, 10, 11, 12, 13 }; 707 + static const int an7583_pcm_spi_rst_pins[] = { 14 }; 708 + static const int an7583_pcm_spi_cs1_pins[] = { 24 }; 709 + static const int an7583_emmc_pins[] = { 7, 8, 9, 22, 23, 24, 25, 26, 45, 46, 47 }; 710 + static const int an7583_pnand_pins[] = { 7, 8, 9, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 45, 46, 47, 48 }; 711 + static const int an7583_gpio0_pins[] = { 2 }; 712 + static const int an7583_gpio1_pins[] = { 3 }; 713 + static const int an7583_gpio2_pins[] = { 4 }; 714 + static const int an7583_gpio3_pins[] = { 5 }; 715 + static const int an7583_gpio4_pins[] = { 6 }; 716 + static const int an7583_gpio5_pins[] = { 7 }; 717 + static const int an7583_gpio6_pins[] = { 8 }; 718 + static const int an7583_gpio7_pins[] = { 9 }; 719 + static const int an7583_gpio8_pins[] = { 10 }; 720 + static const int an7583_gpio9_pins[] = { 11 }; 721 + static const int an7583_gpio10_pins[] = { 12 }; 722 + static const int an7583_gpio11_pins[] = { 13 }; 723 + static const int an7583_gpio12_pins[] = { 14 }; 724 + static const int an7583_gpio13_pins[] = { 15 }; 725 + static const int an7583_gpio14_pins[] = { 16 }; 726 + static const int an7583_gpio15_pins[] = { 17 }; 727 + static const int an7583_gpio16_pins[] = { 18 }; 728 + static const int an7583_gpio17_pins[] = { 19 }; 729 + static const int an7583_gpio18_pins[] = { 20 }; 730 + static const int an7583_gpio19_pins[] = { 21 }; 731 + static const int an7583_gpio20_pins[] = { 22 }; 732 + static const int an7583_gpio21_pins[] = { 24 }; 733 + static const int an7583_gpio23_pins[] = { 25 }; 734 + static const int an7583_gpio24_pins[] = { 26 }; 735 + static const int an7583_gpio25_pins[] = { 27 }; 736 + static const int an7583_gpio26_pins[] = { 28 }; 737 + static const int an7583_gpio27_pins[] = { 29 }; 738 + static const int an7583_gpio28_pins[] = { 30 }; 739 + static const int an7583_gpio29_pins[] = { 31 }; 740 + static const int an7583_gpio30_pins[] = { 32 }; 741 + static const int an7583_gpio31_pins[] = { 33 }; 742 + static const int an7583_gpio33_pins[] = { 35 }; 743 + static const int an7583_gpio34_pins[] = { 36 }; 744 + static const int an7583_gpio35_pins[] = { 37 }; 745 + static const int an7583_gpio36_pins[] = { 38 }; 746 + static const int an7583_gpio37_pins[] = { 39 }; 747 + static const int an7583_gpio38_pins[] = { 40 }; 748 + static const int an7583_gpio39_pins[] = { 41 }; 749 + static const int an7583_gpio40_pins[] = { 42 }; 750 + static const int an7583_gpio41_pins[] = { 43 }; 751 + static const int an7583_gpio42_pins[] = { 44 }; 752 + static const int an7583_gpio43_pins[] = { 45 }; 753 + static const int an7583_gpio44_pins[] = { 46 }; 754 + static const int an7583_gpio45_pins[] = { 47 }; 755 + static const int an7583_gpio46_pins[] = { 48 }; 756 + static const int an7583_gpio47_pins[] = { 49 }; 757 + static const int an7583_gpio48_pins[] = { 50 }; 758 + static const int an7583_pcie_reset0_pins[] = { 51 }; 759 + static const int an7583_pcie_reset1_pins[] = { 52 }; 760 + 761 + static const struct pingroup an7583_pinctrl_groups[] = { 762 + PINCTRL_PIN_GROUP("pon", an7583_pon), 763 + PINCTRL_PIN_GROUP("pon_tod_1pps", an7583_pon_tod_1pps), 764 + PINCTRL_PIN_GROUP("gsw_tod_1pps", an7583_gsw_tod_1pps), 765 + PINCTRL_PIN_GROUP("sipo", an7583_sipo), 766 + PINCTRL_PIN_GROUP("sipo_rclk", an7583_sipo_rclk), 767 + PINCTRL_PIN_GROUP("mdio", an7583_mdio), 768 + PINCTRL_PIN_GROUP("uart2", an7583_uart2), 769 + PINCTRL_PIN_GROUP("uart2_cts_rts", an7583_uart2_cts_rts), 770 + PINCTRL_PIN_GROUP("hsuart", an7583_hsuart), 771 + PINCTRL_PIN_GROUP("hsuart_cts_rts", an7583_hsuart_cts_rts), 772 + PINCTRL_PIN_GROUP("npu_uart", an7583_npu_uart), 773 + PINCTRL_PIN_GROUP("uart4", an7583_uart4), 774 + PINCTRL_PIN_GROUP("uart5", an7583_uart5), 775 + PINCTRL_PIN_GROUP("i2c0", an7583_i2c0), 776 + PINCTRL_PIN_GROUP("i2c1", an7583_i2c1), 777 + PINCTRL_PIN_GROUP("jtag_udi", an7583_jtag_udi), 778 + PINCTRL_PIN_GROUP("jtag_dfd", an7583_jtag_dfd), 779 + PINCTRL_PIN_GROUP("pcm1", an7583_pcm1), 780 + PINCTRL_PIN_GROUP("pcm2", an7583_pcm2), 781 + PINCTRL_PIN_GROUP("spi", an7583_spi), 782 + PINCTRL_PIN_GROUP("spi_quad", an7583_spi_quad), 783 + PINCTRL_PIN_GROUP("spi_cs1", an7583_spi_cs1), 784 + PINCTRL_PIN_GROUP("pcm_spi", an7583_pcm_spi), 785 + PINCTRL_PIN_GROUP("pcm_spi_rst", an7583_pcm_spi_rst), 786 + PINCTRL_PIN_GROUP("pcm_spi_cs1", an7583_pcm_spi_cs1), 787 + PINCTRL_PIN_GROUP("emmc", an7583_emmc), 788 + PINCTRL_PIN_GROUP("pnand", an7583_pnand), 789 + PINCTRL_PIN_GROUP("gpio0", an7583_gpio0), 790 + PINCTRL_PIN_GROUP("gpio1", an7583_gpio1), 791 + PINCTRL_PIN_GROUP("gpio2", an7583_gpio2), 792 + PINCTRL_PIN_GROUP("gpio3", an7583_gpio3), 793 + PINCTRL_PIN_GROUP("gpio4", an7583_gpio4), 794 + PINCTRL_PIN_GROUP("gpio5", an7583_gpio5), 795 + PINCTRL_PIN_GROUP("gpio6", an7583_gpio6), 796 + PINCTRL_PIN_GROUP("gpio7", an7583_gpio7), 797 + PINCTRL_PIN_GROUP("gpio8", an7583_gpio8), 798 + PINCTRL_PIN_GROUP("gpio9", an7583_gpio9), 799 + PINCTRL_PIN_GROUP("gpio10", an7583_gpio10), 800 + PINCTRL_PIN_GROUP("gpio11", an7583_gpio11), 801 + PINCTRL_PIN_GROUP("gpio12", an7583_gpio12), 802 + PINCTRL_PIN_GROUP("gpio13", an7583_gpio13), 803 + PINCTRL_PIN_GROUP("gpio14", an7583_gpio14), 804 + PINCTRL_PIN_GROUP("gpio15", an7583_gpio15), 805 + PINCTRL_PIN_GROUP("gpio16", an7583_gpio16), 806 + PINCTRL_PIN_GROUP("gpio17", an7583_gpio17), 807 + PINCTRL_PIN_GROUP("gpio18", an7583_gpio18), 808 + PINCTRL_PIN_GROUP("gpio19", an7583_gpio19), 809 + PINCTRL_PIN_GROUP("gpio20", an7583_gpio20), 810 + PINCTRL_PIN_GROUP("gpio21", an7583_gpio21), 811 + PINCTRL_PIN_GROUP("gpio23", an7583_gpio23), 812 + PINCTRL_PIN_GROUP("gpio24", an7583_gpio24), 813 + PINCTRL_PIN_GROUP("gpio25", an7583_gpio25), 814 + PINCTRL_PIN_GROUP("gpio26", an7583_gpio26), 815 + PINCTRL_PIN_GROUP("gpio27", an7583_gpio27), 816 + PINCTRL_PIN_GROUP("gpio28", an7583_gpio28), 817 + PINCTRL_PIN_GROUP("gpio29", an7583_gpio29), 818 + PINCTRL_PIN_GROUP("gpio30", an7583_gpio30), 819 + PINCTRL_PIN_GROUP("gpio31", an7583_gpio31), 820 + PINCTRL_PIN_GROUP("gpio33", an7583_gpio33), 821 + PINCTRL_PIN_GROUP("gpio34", an7583_gpio34), 822 + PINCTRL_PIN_GROUP("gpio35", an7583_gpio35), 823 + PINCTRL_PIN_GROUP("gpio36", an7583_gpio36), 824 + PINCTRL_PIN_GROUP("gpio37", an7583_gpio37), 825 + PINCTRL_PIN_GROUP("gpio38", an7583_gpio38), 826 + PINCTRL_PIN_GROUP("gpio39", an7583_gpio39), 827 + PINCTRL_PIN_GROUP("gpio40", an7583_gpio40), 828 + PINCTRL_PIN_GROUP("gpio41", an7583_gpio41), 829 + PINCTRL_PIN_GROUP("gpio42", an7583_gpio42), 830 + PINCTRL_PIN_GROUP("gpio43", an7583_gpio43), 831 + PINCTRL_PIN_GROUP("gpio44", an7583_gpio44), 832 + PINCTRL_PIN_GROUP("gpio45", an7583_gpio45), 833 + PINCTRL_PIN_GROUP("gpio46", an7583_gpio46), 834 + PINCTRL_PIN_GROUP("gpio47", an7583_gpio47), 835 + PINCTRL_PIN_GROUP("gpio48", an7583_gpio48), 836 + PINCTRL_PIN_GROUP("pcie_reset0", an7583_pcie_reset0), 837 + PINCTRL_PIN_GROUP("pcie_reset1", an7583_pcie_reset1), 838 + }; 839 + 645 840 static const char *const pon_groups[] = { "pon" }; 646 841 static const char *const tod_1pps_groups[] = { "pon_tod_1pps", "gsw_tod_1pps" }; 647 842 static const char *const sipo_groups[] = { "sipo", "sipo_rclk" }; 648 843 static const char *const mdio_groups[] = { "mdio" }; 844 + static const char *const an7583_mdio_groups[] = { "mdio" }; 649 845 static const char *const uart_groups[] = { "uart2", "uart2_cts_rts", "hsuart", 650 846 "hsuart_cts_rts", "uart4", 651 847 "uart5" }; ··· 871 641 "pcm_spi_cs2_p156", 872 642 "pcm_spi_cs2_p128", 873 643 "pcm_spi_cs3", "pcm_spi_cs4" }; 644 + static const char *const an7583_pcm_spi_groups[] = { "pcm_spi", "pcm_spi_int", 645 + "pcm_spi_rst", "pcm_spi_cs1", 646 + "pcm_spi_cs2", "pcm_spi_cs3", 647 + "pcm_spi_cs4" }; 874 648 static const char *const i2s_groups[] = { "i2s" }; 875 649 static const char *const emmc_groups[] = { "emmc" }; 876 650 static const char *const pnand_groups[] = { "pnand" }; 877 651 static const char *const pcie_reset_groups[] = { "pcie_reset0", "pcie_reset1", 878 652 "pcie_reset2" }; 653 + static const char *const an7583_pcie_reset_groups[] = { "pcie_reset0", "pcie_reset1" }; 879 654 static const char *const pwm_groups[] = { "gpio0", "gpio1", 880 655 "gpio2", "gpio3", 881 656 "gpio4", "gpio5", ··· 919 684 "gpio45", "gpio46" }; 920 685 static const char *const phy4_led1_groups[] = { "gpio43", "gpio44", 921 686 "gpio45", "gpio46" }; 687 + static const char *const an7583_phy1_led0_groups[] = { "gpio1", "gpio2", 688 + "gpio3", "gpio4" }; 689 + static const char *const an7583_phy2_led0_groups[] = { "gpio1", "gpio2", 690 + "gpio3", "gpio4" }; 691 + static const char *const an7583_phy3_led0_groups[] = { "gpio1", "gpio2", 692 + "gpio3", "gpio4" }; 693 + static const char *const an7583_phy4_led0_groups[] = { "gpio1", "gpio2", 694 + "gpio3", "gpio4" }; 695 + static const char *const an7583_phy1_led1_groups[] = { "gpio8", "gpio9", 696 + "gpio10", "gpio11" }; 697 + static const char *const an7583_phy2_led1_groups[] = { "gpio8", "gpio9", 698 + "gpio10", "gpio11" }; 699 + static const char *const an7583_phy3_led1_groups[] = { "gpio8", "gpio9", 700 + "gpio10", "gpio11" }; 701 + static const char *const an7583_phy4_led1_groups[] = { "gpio8", "gpio9", 702 + "gpio10", "gpio11" }; 922 703 923 704 static const struct airoha_pinctrl_func_group pon_func_group[] = { 924 705 { ··· 1007 756 REG_FORCE_GPIO_EN, 1008 757 FORCE_GPIO_EN(1) | FORCE_GPIO_EN(2), 1009 758 FORCE_GPIO_EN(1) | FORCE_GPIO_EN(2) 759 + }, 760 + .regmap_size = 2, 761 + }, 762 + }; 763 + 764 + static const struct airoha_pinctrl_func_group an7583_mdio_func_group[] = { 765 + { 766 + .name = "mdio", 767 + .regmap[0] = { 768 + AIROHA_FUNC_MUX, 769 + REG_GPIO_PON_MODE, 770 + GPIO_SGMII_MDIO_MODE_MASK, 771 + GPIO_SGMII_MDIO_MODE_MASK 772 + }, 773 + .regmap[1] = { 774 + AIROHA_FUNC_MUX, 775 + REG_GPIO_SPI_CS1_MODE, 776 + GPIO_MDC_IO_MASTER_MODE_MODE, 777 + GPIO_MDC_IO_MASTER_MODE_MODE 1010 778 }, 1011 779 .regmap_size = 2, 1012 780 }, ··· 1272 1002 }, 1273 1003 }; 1274 1004 1005 + static const struct airoha_pinctrl_func_group an7583_pcm_spi_func_group[] = { 1006 + { 1007 + .name = "pcm_spi", 1008 + .regmap[0] = { 1009 + AIROHA_FUNC_MUX, 1010 + REG_GPIO_SPI_CS1_MODE, 1011 + GPIO_PCM_SPI_MODE_MASK, 1012 + GPIO_PCM_SPI_MODE_MASK 1013 + }, 1014 + .regmap_size = 1, 1015 + }, { 1016 + .name = "pcm_spi_int", 1017 + .regmap[0] = { 1018 + AIROHA_FUNC_MUX, 1019 + REG_GPIO_SPI_CS1_MODE, 1020 + GPIO_PCM_INT_MODE_MASK, 1021 + GPIO_PCM_INT_MODE_MASK 1022 + }, 1023 + .regmap_size = 1, 1024 + }, { 1025 + .name = "pcm_spi_rst", 1026 + .regmap[0] = { 1027 + AIROHA_FUNC_MUX, 1028 + REG_GPIO_SPI_CS1_MODE, 1029 + GPIO_PCM_RESET_MODE_MASK, 1030 + GPIO_PCM_RESET_MODE_MASK 1031 + }, 1032 + .regmap_size = 1, 1033 + }, { 1034 + .name = "pcm_spi_cs1", 1035 + .regmap[0] = { 1036 + AIROHA_FUNC_MUX, 1037 + REG_GPIO_SPI_CS1_MODE, 1038 + GPIO_PCM_SPI_CS1_MODE_MASK, 1039 + GPIO_PCM_SPI_CS1_MODE_MASK 1040 + }, 1041 + .regmap_size = 1, 1042 + }, { 1043 + .name = "pcm_spi_cs2", 1044 + .regmap[0] = { 1045 + AIROHA_FUNC_MUX, 1046 + REG_GPIO_SPI_CS1_MODE, 1047 + AN7583_GPIO_PCM_SPI_CS2_MODE_MASK, 1048 + AN7583_GPIO_PCM_SPI_CS2_MODE_MASK 1049 + }, 1050 + .regmap_size = 1, 1051 + }, { 1052 + .name = "pcm_spi_cs3", 1053 + .regmap[0] = { 1054 + AIROHA_FUNC_MUX, 1055 + REG_GPIO_SPI_CS1_MODE, 1056 + GPIO_PCM_SPI_CS3_MODE_MASK, 1057 + GPIO_PCM_SPI_CS3_MODE_MASK 1058 + }, 1059 + .regmap_size = 1, 1060 + }, { 1061 + .name = "pcm_spi_cs4", 1062 + .regmap[0] = { 1063 + AIROHA_FUNC_MUX, 1064 + REG_GPIO_SPI_CS1_MODE, 1065 + GPIO_PCM_SPI_CS4_MODE_MASK, 1066 + GPIO_PCM_SPI_CS4_MODE_MASK 1067 + }, 1068 + .regmap_size = 1, 1069 + }, 1070 + }; 1071 + 1275 1072 static const struct airoha_pinctrl_func_group i2s_func_group[] = { 1276 1073 { 1277 1074 .name = "i2s", ··· 1404 1067 REG_GPIO_PON_MODE, 1405 1068 GPIO_PCIE_RESET2_MASK, 1406 1069 GPIO_PCIE_RESET2_MASK 1070 + }, 1071 + .regmap_size = 1, 1072 + }, 1073 + }; 1074 + 1075 + static const struct airoha_pinctrl_func_group an7583_pcie_reset_func_group[] = { 1076 + { 1077 + .name = "pcie_reset0", 1078 + .regmap[0] = { 1079 + AIROHA_FUNC_MUX, 1080 + REG_GPIO_PON_MODE, 1081 + GPIO_PCIE_RESET0_MASK, 1082 + GPIO_PCIE_RESET0_MASK 1083 + }, 1084 + .regmap_size = 1, 1085 + }, { 1086 + .name = "pcie_reset1", 1087 + .regmap[0] = { 1088 + AIROHA_FUNC_MUX, 1089 + REG_GPIO_PON_MODE, 1090 + GPIO_PCIE_RESET1_MASK, 1091 + GPIO_PCIE_RESET1_MASK 1407 1092 }, 1408 1093 .regmap_size = 1, 1409 1094 }, ··· 1627 1268 LAN3_LED_MAPPING_MASK, LAN3_PHY_LED_MAP(2)), 1628 1269 }; 1629 1270 1271 + static const struct airoha_pinctrl_func_group an7583_phy1_led0_func_group[] = { 1272 + AIROHA_PINCTRL_PHY_LED0("gpio1", GPIO_LAN0_LED0_MODE_MASK, 1273 + LAN0_LED_MAPPING_MASK, LAN0_PHY_LED_MAP(0)), 1274 + AIROHA_PINCTRL_PHY_LED0("gpio2", GPIO_LAN1_LED0_MODE_MASK, 1275 + LAN1_LED_MAPPING_MASK, LAN1_PHY_LED_MAP(0)), 1276 + AIROHA_PINCTRL_PHY_LED0("gpio3", GPIO_LAN2_LED0_MODE_MASK, 1277 + LAN2_LED_MAPPING_MASK, LAN2_PHY_LED_MAP(0)), 1278 + AIROHA_PINCTRL_PHY_LED0("gpio4", GPIO_LAN3_LED0_MODE_MASK, 1279 + LAN3_LED_MAPPING_MASK, LAN3_PHY_LED_MAP(0)), 1280 + }; 1281 + 1282 + static const struct airoha_pinctrl_func_group an7583_phy2_led0_func_group[] = { 1283 + AIROHA_PINCTRL_PHY_LED0("gpio1", GPIO_LAN0_LED0_MODE_MASK, 1284 + LAN0_LED_MAPPING_MASK, LAN0_PHY_LED_MAP(1)), 1285 + AIROHA_PINCTRL_PHY_LED0("gpio2", GPIO_LAN1_LED0_MODE_MASK, 1286 + LAN1_LED_MAPPING_MASK, LAN1_PHY_LED_MAP(1)), 1287 + AIROHA_PINCTRL_PHY_LED0("gpio3", GPIO_LAN2_LED0_MODE_MASK, 1288 + LAN2_LED_MAPPING_MASK, LAN2_PHY_LED_MAP(1)), 1289 + AIROHA_PINCTRL_PHY_LED0("gpio4", GPIO_LAN3_LED0_MODE_MASK, 1290 + LAN3_LED_MAPPING_MASK, LAN3_PHY_LED_MAP(1)), 1291 + }; 1292 + 1293 + static const struct airoha_pinctrl_func_group an7583_phy3_led0_func_group[] = { 1294 + AIROHA_PINCTRL_PHY_LED0("gpio1", GPIO_LAN0_LED0_MODE_MASK, 1295 + LAN0_LED_MAPPING_MASK, LAN0_PHY_LED_MAP(2)), 1296 + AIROHA_PINCTRL_PHY_LED0("gpio2", GPIO_LAN1_LED0_MODE_MASK, 1297 + LAN1_LED_MAPPING_MASK, LAN1_PHY_LED_MAP(2)), 1298 + AIROHA_PINCTRL_PHY_LED0("gpio3", GPIO_LAN2_LED0_MODE_MASK, 1299 + LAN2_LED_MAPPING_MASK, LAN2_PHY_LED_MAP(2)), 1300 + AIROHA_PINCTRL_PHY_LED0("gpio4", GPIO_LAN3_LED0_MODE_MASK, 1301 + LAN3_LED_MAPPING_MASK, LAN3_PHY_LED_MAP(2)), 1302 + }; 1303 + 1304 + static const struct airoha_pinctrl_func_group an7583_phy4_led0_func_group[] = { 1305 + AIROHA_PINCTRL_PHY_LED0("gpio1", GPIO_LAN0_LED0_MODE_MASK, 1306 + LAN0_LED_MAPPING_MASK, LAN0_PHY_LED_MAP(3)), 1307 + AIROHA_PINCTRL_PHY_LED0("gpio2", GPIO_LAN1_LED0_MODE_MASK, 1308 + LAN1_LED_MAPPING_MASK, LAN1_PHY_LED_MAP(3)), 1309 + AIROHA_PINCTRL_PHY_LED0("gpio3", GPIO_LAN2_LED0_MODE_MASK, 1310 + LAN2_LED_MAPPING_MASK, LAN2_PHY_LED_MAP(3)), 1311 + AIROHA_PINCTRL_PHY_LED0("gpio4", GPIO_LAN3_LED0_MODE_MASK, 1312 + LAN3_LED_MAPPING_MASK, LAN3_PHY_LED_MAP(3)), 1313 + }; 1314 + 1315 + static const struct airoha_pinctrl_func_group an7583_phy1_led1_func_group[] = { 1316 + AIROHA_PINCTRL_PHY_LED1("gpio8", GPIO_LAN0_LED1_MODE_MASK, 1317 + LAN0_LED_MAPPING_MASK, LAN0_PHY_LED_MAP(0)), 1318 + AIROHA_PINCTRL_PHY_LED1("gpio9", GPIO_LAN1_LED1_MODE_MASK, 1319 + LAN1_LED_MAPPING_MASK, LAN1_PHY_LED_MAP(0)), 1320 + AIROHA_PINCTRL_PHY_LED1("gpio10", GPIO_LAN2_LED1_MODE_MASK, 1321 + LAN2_LED_MAPPING_MASK, LAN2_PHY_LED_MAP(0)), 1322 + AIROHA_PINCTRL_PHY_LED1("gpio1", GPIO_LAN3_LED1_MODE_MASK, 1323 + LAN3_LED_MAPPING_MASK, LAN3_PHY_LED_MAP(0)), 1324 + }; 1325 + 1326 + static const struct airoha_pinctrl_func_group an7583_phy2_led1_func_group[] = { 1327 + AIROHA_PINCTRL_PHY_LED1("gpio8", GPIO_LAN0_LED1_MODE_MASK, 1328 + LAN0_LED_MAPPING_MASK, LAN0_PHY_LED_MAP(1)), 1329 + AIROHA_PINCTRL_PHY_LED1("gpio9", GPIO_LAN1_LED1_MODE_MASK, 1330 + LAN1_LED_MAPPING_MASK, LAN1_PHY_LED_MAP(1)), 1331 + AIROHA_PINCTRL_PHY_LED1("gpio10", GPIO_LAN2_LED1_MODE_MASK, 1332 + LAN2_LED_MAPPING_MASK, LAN2_PHY_LED_MAP(1)), 1333 + AIROHA_PINCTRL_PHY_LED1("gpio11", GPIO_LAN3_LED1_MODE_MASK, 1334 + LAN3_LED_MAPPING_MASK, LAN3_PHY_LED_MAP(1)), 1335 + }; 1336 + 1337 + static const struct airoha_pinctrl_func_group an7583_phy3_led1_func_group[] = { 1338 + AIROHA_PINCTRL_PHY_LED1("gpio8", GPIO_LAN0_LED1_MODE_MASK, 1339 + LAN0_LED_MAPPING_MASK, LAN0_PHY_LED_MAP(2)), 1340 + AIROHA_PINCTRL_PHY_LED1("gpio9", GPIO_LAN1_LED1_MODE_MASK, 1341 + LAN1_LED_MAPPING_MASK, LAN1_PHY_LED_MAP(2)), 1342 + AIROHA_PINCTRL_PHY_LED1("gpio10", GPIO_LAN2_LED1_MODE_MASK, 1343 + LAN2_LED_MAPPING_MASK, LAN2_PHY_LED_MAP(2)), 1344 + AIROHA_PINCTRL_PHY_LED1("gpio11", GPIO_LAN3_LED1_MODE_MASK, 1345 + LAN3_LED_MAPPING_MASK, LAN3_PHY_LED_MAP(2)), 1346 + }; 1347 + 1348 + static const struct airoha_pinctrl_func_group an7583_phy4_led1_func_group[] = { 1349 + AIROHA_PINCTRL_PHY_LED1("gpio8", GPIO_LAN0_LED1_MODE_MASK, 1350 + LAN0_LED_MAPPING_MASK, LAN0_PHY_LED_MAP(2)), 1351 + AIROHA_PINCTRL_PHY_LED1("gpio9", GPIO_LAN1_LED1_MODE_MASK, 1352 + LAN1_LED_MAPPING_MASK, LAN1_PHY_LED_MAP(2)), 1353 + AIROHA_PINCTRL_PHY_LED1("gpio10", GPIO_LAN2_LED1_MODE_MASK, 1354 + LAN2_LED_MAPPING_MASK, LAN2_PHY_LED_MAP(2)), 1355 + AIROHA_PINCTRL_PHY_LED1("gpio11", GPIO_LAN3_LED1_MODE_MASK, 1356 + LAN3_LED_MAPPING_MASK, LAN3_PHY_LED_MAP(2)), 1357 + }; 1358 + 1630 1359 static const struct airoha_pinctrl_func en7581_pinctrl_funcs[] = { 1631 1360 PINCTRL_FUNC_DESC("pon", pon), 1632 1361 PINCTRL_FUNC_DESC("tod_1pps", tod_1pps), ··· 1739 1292 PINCTRL_FUNC_DESC("phy2_led1", phy2_led1), 1740 1293 PINCTRL_FUNC_DESC("phy3_led1", phy3_led1), 1741 1294 PINCTRL_FUNC_DESC("phy4_led1", phy4_led1), 1295 + }; 1296 + 1297 + static const struct airoha_pinctrl_func an7583_pinctrl_funcs[] = { 1298 + PINCTRL_FUNC_DESC("pon", pon), 1299 + PINCTRL_FUNC_DESC("tod_1pps", tod_1pps), 1300 + PINCTRL_FUNC_DESC("sipo", sipo), 1301 + PINCTRL_FUNC_DESC("mdio", an7583_mdio), 1302 + PINCTRL_FUNC_DESC("uart", uart), 1303 + PINCTRL_FUNC_DESC("i2c", i2c), 1304 + PINCTRL_FUNC_DESC("jtag", jtag), 1305 + PINCTRL_FUNC_DESC("pcm", pcm), 1306 + PINCTRL_FUNC_DESC("spi", spi), 1307 + PINCTRL_FUNC_DESC("pcm_spi", an7583_pcm_spi), 1308 + PINCTRL_FUNC_DESC("emmc", emmc), 1309 + PINCTRL_FUNC_DESC("pnand", pnand), 1310 + PINCTRL_FUNC_DESC("pcie_reset", an7583_pcie_reset), 1311 + PINCTRL_FUNC_DESC("pwm", pwm), 1312 + PINCTRL_FUNC_DESC("phy1_led0", an7583_phy1_led0), 1313 + PINCTRL_FUNC_DESC("phy2_led0", an7583_phy2_led0), 1314 + PINCTRL_FUNC_DESC("phy3_led0", an7583_phy3_led0), 1315 + PINCTRL_FUNC_DESC("phy4_led0", an7583_phy4_led0), 1316 + PINCTRL_FUNC_DESC("phy1_led1", an7583_phy1_led1), 1317 + PINCTRL_FUNC_DESC("phy2_led1", an7583_phy2_led1), 1318 + PINCTRL_FUNC_DESC("phy3_led1", an7583_phy3_led1), 1319 + PINCTRL_FUNC_DESC("phy4_led1", an7583_phy4_led1), 1742 1320 }; 1743 1321 1744 1322 static const struct airoha_pinctrl_conf en7581_pinctrl_pullup_conf[] = { ··· 1827 1355 PINCTRL_CONF_DESC(63, REG_I2C_SDA_PU, PCIE2_RESET_PU_MASK), 1828 1356 }; 1829 1357 1358 + static const struct airoha_pinctrl_conf an7583_pinctrl_pullup_conf[] = { 1359 + PINCTRL_CONF_DESC(2, REG_GPIO_L_PU, BIT(0)), 1360 + PINCTRL_CONF_DESC(3, REG_GPIO_L_PU, BIT(1)), 1361 + PINCTRL_CONF_DESC(4, REG_GPIO_L_PU, BIT(2)), 1362 + PINCTRL_CONF_DESC(5, REG_GPIO_L_PU, BIT(3)), 1363 + PINCTRL_CONF_DESC(6, REG_GPIO_L_PU, BIT(4)), 1364 + PINCTRL_CONF_DESC(7, REG_GPIO_L_PU, BIT(5)), 1365 + PINCTRL_CONF_DESC(8, REG_GPIO_L_PU, BIT(6)), 1366 + PINCTRL_CONF_DESC(9, REG_GPIO_L_PU, BIT(7)), 1367 + PINCTRL_CONF_DESC(10, REG_GPIO_L_PU, BIT(8)), 1368 + PINCTRL_CONF_DESC(11, REG_GPIO_L_PU, BIT(9)), 1369 + PINCTRL_CONF_DESC(12, REG_GPIO_L_PU, BIT(10)), 1370 + PINCTRL_CONF_DESC(13, REG_GPIO_L_PU, BIT(11)), 1371 + PINCTRL_CONF_DESC(14, REG_GPIO_L_PU, BIT(12)), 1372 + PINCTRL_CONF_DESC(15, REG_GPIO_L_PU, BIT(13)), 1373 + PINCTRL_CONF_DESC(16, REG_GPIO_L_PU, BIT(14)), 1374 + PINCTRL_CONF_DESC(17, REG_GPIO_L_PU, BIT(15)), 1375 + PINCTRL_CONF_DESC(18, REG_GPIO_L_PU, BIT(16)), 1376 + PINCTRL_CONF_DESC(19, REG_GPIO_L_PU, BIT(17)), 1377 + PINCTRL_CONF_DESC(20, REG_GPIO_L_PU, BIT(18)), 1378 + PINCTRL_CONF_DESC(21, REG_GPIO_L_PU, BIT(18)), 1379 + PINCTRL_CONF_DESC(22, REG_GPIO_L_PU, BIT(20)), 1380 + PINCTRL_CONF_DESC(23, REG_GPIO_L_PU, BIT(21)), 1381 + PINCTRL_CONF_DESC(24, REG_GPIO_L_PU, BIT(22)), 1382 + PINCTRL_CONF_DESC(25, REG_GPIO_L_PU, BIT(23)), 1383 + PINCTRL_CONF_DESC(26, REG_GPIO_L_PU, BIT(24)), 1384 + PINCTRL_CONF_DESC(27, REG_GPIO_L_PU, BIT(25)), 1385 + PINCTRL_CONF_DESC(28, REG_GPIO_L_PU, BIT(26)), 1386 + PINCTRL_CONF_DESC(29, REG_GPIO_L_PU, BIT(27)), 1387 + PINCTRL_CONF_DESC(30, REG_GPIO_L_PU, BIT(28)), 1388 + PINCTRL_CONF_DESC(31, REG_GPIO_L_PU, BIT(29)), 1389 + PINCTRL_CONF_DESC(32, REG_GPIO_L_PU, BIT(30)), 1390 + PINCTRL_CONF_DESC(33, REG_GPIO_L_PU, BIT(31)), 1391 + PINCTRL_CONF_DESC(34, REG_GPIO_H_PU, BIT(0)), 1392 + PINCTRL_CONF_DESC(35, REG_GPIO_H_PU, BIT(1)), 1393 + PINCTRL_CONF_DESC(36, REG_GPIO_H_PU, BIT(2)), 1394 + PINCTRL_CONF_DESC(37, REG_GPIO_H_PU, BIT(3)), 1395 + PINCTRL_CONF_DESC(38, REG_GPIO_H_PU, BIT(4)), 1396 + PINCTRL_CONF_DESC(39, REG_GPIO_H_PU, BIT(5)), 1397 + PINCTRL_CONF_DESC(40, REG_GPIO_H_PU, BIT(6)), 1398 + PINCTRL_CONF_DESC(41, REG_I2C_SDA_PU, I2C_SCL_PU_MASK), 1399 + PINCTRL_CONF_DESC(42, REG_I2C_SDA_PU, I2C_SDA_PU_MASK), 1400 + PINCTRL_CONF_DESC(43, REG_I2C_SDA_PU, AN7583_I2C1_SCL_PU_MASK), 1401 + PINCTRL_CONF_DESC(44, REG_I2C_SDA_PU, AN7583_I2C1_SDA_PU_MASK), 1402 + PINCTRL_CONF_DESC(45, REG_I2C_SDA_PU, SPI_CLK_PU_MASK), 1403 + PINCTRL_CONF_DESC(46, REG_I2C_SDA_PU, SPI_CS0_PU_MASK), 1404 + PINCTRL_CONF_DESC(47, REG_I2C_SDA_PU, SPI_MOSI_PU_MASK), 1405 + PINCTRL_CONF_DESC(48, REG_I2C_SDA_PU, SPI_MISO_PU_MASK), 1406 + PINCTRL_CONF_DESC(49, REG_I2C_SDA_PU, UART1_TXD_PU_MASK), 1407 + PINCTRL_CONF_DESC(50, REG_I2C_SDA_PU, UART1_RXD_PU_MASK), 1408 + PINCTRL_CONF_DESC(51, REG_I2C_SDA_PU, PCIE0_RESET_PU_MASK), 1409 + PINCTRL_CONF_DESC(52, REG_I2C_SDA_PU, PCIE1_RESET_PU_MASK), 1410 + PINCTRL_CONF_DESC(53, REG_I2C_SDA_PU, AN7583_MDC_0_PU_MASK), 1411 + PINCTRL_CONF_DESC(54, REG_I2C_SDA_PU, AN7583_MDIO_0_PU_MASK), 1412 + }; 1413 + 1830 1414 static const struct airoha_pinctrl_conf en7581_pinctrl_pulldown_conf[] = { 1831 1415 PINCTRL_CONF_DESC(0, REG_I2C_SDA_PD, UART1_TXD_PD_MASK), 1832 1416 PINCTRL_CONF_DESC(1, REG_I2C_SDA_PD, UART1_RXD_PD_MASK), ··· 1942 1414 PINCTRL_CONF_DESC(61, REG_I2C_SDA_PD, PCIE0_RESET_PD_MASK), 1943 1415 PINCTRL_CONF_DESC(62, REG_I2C_SDA_PD, PCIE1_RESET_PD_MASK), 1944 1416 PINCTRL_CONF_DESC(63, REG_I2C_SDA_PD, PCIE2_RESET_PD_MASK), 1417 + }; 1418 + 1419 + static const struct airoha_pinctrl_conf an7583_pinctrl_pulldown_conf[] = { 1420 + PINCTRL_CONF_DESC(2, REG_GPIO_L_PD, BIT(0)), 1421 + PINCTRL_CONF_DESC(3, REG_GPIO_L_PD, BIT(1)), 1422 + PINCTRL_CONF_DESC(4, REG_GPIO_L_PD, BIT(2)), 1423 + PINCTRL_CONF_DESC(5, REG_GPIO_L_PD, BIT(3)), 1424 + PINCTRL_CONF_DESC(6, REG_GPIO_L_PD, BIT(4)), 1425 + PINCTRL_CONF_DESC(7, REG_GPIO_L_PD, BIT(5)), 1426 + PINCTRL_CONF_DESC(8, REG_GPIO_L_PD, BIT(6)), 1427 + PINCTRL_CONF_DESC(9, REG_GPIO_L_PD, BIT(7)), 1428 + PINCTRL_CONF_DESC(10, REG_GPIO_L_PD, BIT(8)), 1429 + PINCTRL_CONF_DESC(11, REG_GPIO_L_PD, BIT(9)), 1430 + PINCTRL_CONF_DESC(12, REG_GPIO_L_PD, BIT(10)), 1431 + PINCTRL_CONF_DESC(13, REG_GPIO_L_PD, BIT(11)), 1432 + PINCTRL_CONF_DESC(14, REG_GPIO_L_PD, BIT(12)), 1433 + PINCTRL_CONF_DESC(15, REG_GPIO_L_PD, BIT(13)), 1434 + PINCTRL_CONF_DESC(16, REG_GPIO_L_PD, BIT(14)), 1435 + PINCTRL_CONF_DESC(17, REG_GPIO_L_PD, BIT(15)), 1436 + PINCTRL_CONF_DESC(18, REG_GPIO_L_PD, BIT(16)), 1437 + PINCTRL_CONF_DESC(19, REG_GPIO_L_PD, BIT(17)), 1438 + PINCTRL_CONF_DESC(20, REG_GPIO_L_PD, BIT(18)), 1439 + PINCTRL_CONF_DESC(21, REG_GPIO_L_PD, BIT(18)), 1440 + PINCTRL_CONF_DESC(22, REG_GPIO_L_PD, BIT(20)), 1441 + PINCTRL_CONF_DESC(23, REG_GPIO_L_PD, BIT(21)), 1442 + PINCTRL_CONF_DESC(24, REG_GPIO_L_PD, BIT(22)), 1443 + PINCTRL_CONF_DESC(25, REG_GPIO_L_PD, BIT(23)), 1444 + PINCTRL_CONF_DESC(26, REG_GPIO_L_PD, BIT(24)), 1445 + PINCTRL_CONF_DESC(27, REG_GPIO_L_PD, BIT(25)), 1446 + PINCTRL_CONF_DESC(28, REG_GPIO_L_PD, BIT(26)), 1447 + PINCTRL_CONF_DESC(29, REG_GPIO_L_PD, BIT(27)), 1448 + PINCTRL_CONF_DESC(30, REG_GPIO_L_PD, BIT(28)), 1449 + PINCTRL_CONF_DESC(31, REG_GPIO_L_PD, BIT(29)), 1450 + PINCTRL_CONF_DESC(32, REG_GPIO_L_PD, BIT(30)), 1451 + PINCTRL_CONF_DESC(33, REG_GPIO_L_PD, BIT(31)), 1452 + PINCTRL_CONF_DESC(34, REG_GPIO_H_PD, BIT(0)), 1453 + PINCTRL_CONF_DESC(35, REG_GPIO_H_PD, BIT(1)), 1454 + PINCTRL_CONF_DESC(36, REG_GPIO_H_PD, BIT(2)), 1455 + PINCTRL_CONF_DESC(37, REG_GPIO_H_PD, BIT(3)), 1456 + PINCTRL_CONF_DESC(38, REG_GPIO_H_PD, BIT(4)), 1457 + PINCTRL_CONF_DESC(39, REG_GPIO_H_PD, BIT(5)), 1458 + PINCTRL_CONF_DESC(40, REG_GPIO_H_PD, BIT(6)), 1459 + PINCTRL_CONF_DESC(41, REG_I2C_SDA_PD, I2C_SCL_PD_MASK), 1460 + PINCTRL_CONF_DESC(42, REG_I2C_SDA_PD, I2C_SDA_PD_MASK), 1461 + PINCTRL_CONF_DESC(43, REG_I2C_SDA_PD, AN7583_I2C1_SCL_PD_MASK), 1462 + PINCTRL_CONF_DESC(44, REG_I2C_SDA_PD, AN7583_I2C1_SDA_PD_MASK), 1463 + PINCTRL_CONF_DESC(45, REG_I2C_SDA_PD, SPI_CLK_PD_MASK), 1464 + PINCTRL_CONF_DESC(46, REG_I2C_SDA_PD, SPI_CS0_PD_MASK), 1465 + PINCTRL_CONF_DESC(47, REG_I2C_SDA_PD, SPI_MOSI_PD_MASK), 1466 + PINCTRL_CONF_DESC(48, REG_I2C_SDA_PD, SPI_MISO_PD_MASK), 1467 + PINCTRL_CONF_DESC(49, REG_I2C_SDA_PD, UART1_TXD_PD_MASK), 1468 + PINCTRL_CONF_DESC(50, REG_I2C_SDA_PD, UART1_RXD_PD_MASK), 1469 + PINCTRL_CONF_DESC(51, REG_I2C_SDA_PD, PCIE0_RESET_PD_MASK), 1470 + PINCTRL_CONF_DESC(52, REG_I2C_SDA_PD, PCIE1_RESET_PD_MASK), 1471 + PINCTRL_CONF_DESC(53, REG_I2C_SDA_PD, AN7583_MDC_0_PD_MASK), 1472 + PINCTRL_CONF_DESC(54, REG_I2C_SDA_PD, AN7583_MDIO_0_PD_MASK), 1945 1473 }; 1946 1474 1947 1475 static const struct airoha_pinctrl_conf en7581_pinctrl_drive_e2_conf[] = { ··· 2061 1477 PINCTRL_CONF_DESC(63, REG_I2C_SDA_E2, PCIE2_RESET_E2_MASK), 2062 1478 }; 2063 1479 1480 + static const struct airoha_pinctrl_conf an7583_pinctrl_drive_e2_conf[] = { 1481 + PINCTRL_CONF_DESC(2, REG_GPIO_L_E2, BIT(0)), 1482 + PINCTRL_CONF_DESC(3, REG_GPIO_L_E2, BIT(1)), 1483 + PINCTRL_CONF_DESC(4, REG_GPIO_L_E2, BIT(2)), 1484 + PINCTRL_CONF_DESC(5, REG_GPIO_L_E2, BIT(3)), 1485 + PINCTRL_CONF_DESC(6, REG_GPIO_L_E2, BIT(4)), 1486 + PINCTRL_CONF_DESC(7, REG_GPIO_L_E2, BIT(5)), 1487 + PINCTRL_CONF_DESC(8, REG_GPIO_L_E2, BIT(6)), 1488 + PINCTRL_CONF_DESC(9, REG_GPIO_L_E2, BIT(7)), 1489 + PINCTRL_CONF_DESC(10, REG_GPIO_L_E2, BIT(8)), 1490 + PINCTRL_CONF_DESC(11, REG_GPIO_L_E2, BIT(9)), 1491 + PINCTRL_CONF_DESC(12, REG_GPIO_L_E2, BIT(10)), 1492 + PINCTRL_CONF_DESC(13, REG_GPIO_L_E2, BIT(11)), 1493 + PINCTRL_CONF_DESC(14, REG_GPIO_L_E2, BIT(12)), 1494 + PINCTRL_CONF_DESC(15, REG_GPIO_L_E2, BIT(13)), 1495 + PINCTRL_CONF_DESC(16, REG_GPIO_L_E2, BIT(14)), 1496 + PINCTRL_CONF_DESC(17, REG_GPIO_L_E2, BIT(15)), 1497 + PINCTRL_CONF_DESC(18, REG_GPIO_L_E2, BIT(16)), 1498 + PINCTRL_CONF_DESC(19, REG_GPIO_L_E2, BIT(17)), 1499 + PINCTRL_CONF_DESC(20, REG_GPIO_L_E2, BIT(18)), 1500 + PINCTRL_CONF_DESC(21, REG_GPIO_L_E2, BIT(18)), 1501 + PINCTRL_CONF_DESC(22, REG_GPIO_L_E2, BIT(20)), 1502 + PINCTRL_CONF_DESC(23, REG_GPIO_L_E2, BIT(21)), 1503 + PINCTRL_CONF_DESC(24, REG_GPIO_L_E2, BIT(22)), 1504 + PINCTRL_CONF_DESC(25, REG_GPIO_L_E2, BIT(23)), 1505 + PINCTRL_CONF_DESC(26, REG_GPIO_L_E2, BIT(24)), 1506 + PINCTRL_CONF_DESC(27, REG_GPIO_L_E2, BIT(25)), 1507 + PINCTRL_CONF_DESC(28, REG_GPIO_L_E2, BIT(26)), 1508 + PINCTRL_CONF_DESC(29, REG_GPIO_L_E2, BIT(27)), 1509 + PINCTRL_CONF_DESC(30, REG_GPIO_L_E2, BIT(28)), 1510 + PINCTRL_CONF_DESC(31, REG_GPIO_L_E2, BIT(29)), 1511 + PINCTRL_CONF_DESC(32, REG_GPIO_L_E2, BIT(30)), 1512 + PINCTRL_CONF_DESC(33, REG_GPIO_L_E2, BIT(31)), 1513 + PINCTRL_CONF_DESC(34, REG_GPIO_H_E2, BIT(0)), 1514 + PINCTRL_CONF_DESC(35, REG_GPIO_H_E2, BIT(1)), 1515 + PINCTRL_CONF_DESC(36, REG_GPIO_H_E2, BIT(2)), 1516 + PINCTRL_CONF_DESC(37, REG_GPIO_H_E2, BIT(3)), 1517 + PINCTRL_CONF_DESC(38, REG_GPIO_H_E2, BIT(4)), 1518 + PINCTRL_CONF_DESC(39, REG_GPIO_H_E2, BIT(5)), 1519 + PINCTRL_CONF_DESC(40, REG_GPIO_H_E2, BIT(6)), 1520 + PINCTRL_CONF_DESC(41, REG_I2C_SDA_E2, I2C_SCL_E2_MASK), 1521 + PINCTRL_CONF_DESC(42, REG_I2C_SDA_E2, I2C_SDA_E2_MASK), 1522 + PINCTRL_CONF_DESC(43, REG_I2C_SDA_E2, AN7583_I2C1_SCL_E2_MASK), 1523 + PINCTRL_CONF_DESC(44, REG_I2C_SDA_E2, AN7583_I2C1_SDA_E2_MASK), 1524 + PINCTRL_CONF_DESC(45, REG_I2C_SDA_E2, SPI_CLK_E2_MASK), 1525 + PINCTRL_CONF_DESC(46, REG_I2C_SDA_E2, SPI_CS0_E2_MASK), 1526 + PINCTRL_CONF_DESC(47, REG_I2C_SDA_E2, SPI_MOSI_E2_MASK), 1527 + PINCTRL_CONF_DESC(48, REG_I2C_SDA_E2, SPI_MISO_E2_MASK), 1528 + PINCTRL_CONF_DESC(49, REG_I2C_SDA_E2, UART1_TXD_E2_MASK), 1529 + PINCTRL_CONF_DESC(50, REG_I2C_SDA_E2, UART1_RXD_E2_MASK), 1530 + PINCTRL_CONF_DESC(51, REG_I2C_SDA_E2, PCIE0_RESET_E2_MASK), 1531 + PINCTRL_CONF_DESC(52, REG_I2C_SDA_E2, PCIE1_RESET_E2_MASK), 1532 + PINCTRL_CONF_DESC(53, REG_I2C_SDA_E2, AN7583_MDC_0_E2_MASK), 1533 + PINCTRL_CONF_DESC(54, REG_I2C_SDA_E2, AN7583_MDIO_0_E2_MASK), 1534 + }; 1535 + 2064 1536 static const struct airoha_pinctrl_conf en7581_pinctrl_drive_e4_conf[] = { 2065 1537 PINCTRL_CONF_DESC(0, REG_I2C_SDA_E4, UART1_TXD_E4_MASK), 2066 1538 PINCTRL_CONF_DESC(1, REG_I2C_SDA_E4, UART1_RXD_E4_MASK), ··· 2178 1538 PINCTRL_CONF_DESC(63, REG_I2C_SDA_E4, PCIE2_RESET_E4_MASK), 2179 1539 }; 2180 1540 1541 + static const struct airoha_pinctrl_conf an7583_pinctrl_drive_e4_conf[] = { 1542 + PINCTRL_CONF_DESC(2, REG_GPIO_L_E4, BIT(0)), 1543 + PINCTRL_CONF_DESC(3, REG_GPIO_L_E4, BIT(1)), 1544 + PINCTRL_CONF_DESC(4, REG_GPIO_L_E4, BIT(2)), 1545 + PINCTRL_CONF_DESC(5, REG_GPIO_L_E4, BIT(3)), 1546 + PINCTRL_CONF_DESC(6, REG_GPIO_L_E4, BIT(4)), 1547 + PINCTRL_CONF_DESC(7, REG_GPIO_L_E4, BIT(5)), 1548 + PINCTRL_CONF_DESC(8, REG_GPIO_L_E4, BIT(6)), 1549 + PINCTRL_CONF_DESC(9, REG_GPIO_L_E4, BIT(7)), 1550 + PINCTRL_CONF_DESC(10, REG_GPIO_L_E4, BIT(8)), 1551 + PINCTRL_CONF_DESC(11, REG_GPIO_L_E4, BIT(9)), 1552 + PINCTRL_CONF_DESC(12, REG_GPIO_L_E4, BIT(10)), 1553 + PINCTRL_CONF_DESC(13, REG_GPIO_L_E4, BIT(11)), 1554 + PINCTRL_CONF_DESC(14, REG_GPIO_L_E4, BIT(12)), 1555 + PINCTRL_CONF_DESC(15, REG_GPIO_L_E4, BIT(13)), 1556 + PINCTRL_CONF_DESC(16, REG_GPIO_L_E4, BIT(14)), 1557 + PINCTRL_CONF_DESC(17, REG_GPIO_L_E4, BIT(15)), 1558 + PINCTRL_CONF_DESC(18, REG_GPIO_L_E4, BIT(16)), 1559 + PINCTRL_CONF_DESC(19, REG_GPIO_L_E4, BIT(17)), 1560 + PINCTRL_CONF_DESC(20, REG_GPIO_L_E4, BIT(18)), 1561 + PINCTRL_CONF_DESC(21, REG_GPIO_L_E4, BIT(18)), 1562 + PINCTRL_CONF_DESC(22, REG_GPIO_L_E4, BIT(20)), 1563 + PINCTRL_CONF_DESC(23, REG_GPIO_L_E4, BIT(21)), 1564 + PINCTRL_CONF_DESC(24, REG_GPIO_L_E4, BIT(22)), 1565 + PINCTRL_CONF_DESC(25, REG_GPIO_L_E4, BIT(23)), 1566 + PINCTRL_CONF_DESC(26, REG_GPIO_L_E4, BIT(24)), 1567 + PINCTRL_CONF_DESC(27, REG_GPIO_L_E4, BIT(25)), 1568 + PINCTRL_CONF_DESC(28, REG_GPIO_L_E4, BIT(26)), 1569 + PINCTRL_CONF_DESC(29, REG_GPIO_L_E4, BIT(27)), 1570 + PINCTRL_CONF_DESC(30, REG_GPIO_L_E4, BIT(28)), 1571 + PINCTRL_CONF_DESC(31, REG_GPIO_L_E4, BIT(29)), 1572 + PINCTRL_CONF_DESC(32, REG_GPIO_L_E4, BIT(30)), 1573 + PINCTRL_CONF_DESC(33, REG_GPIO_L_E4, BIT(31)), 1574 + PINCTRL_CONF_DESC(34, REG_GPIO_H_E4, BIT(0)), 1575 + PINCTRL_CONF_DESC(35, REG_GPIO_H_E4, BIT(1)), 1576 + PINCTRL_CONF_DESC(36, REG_GPIO_H_E4, BIT(2)), 1577 + PINCTRL_CONF_DESC(37, REG_GPIO_H_E4, BIT(3)), 1578 + PINCTRL_CONF_DESC(38, REG_GPIO_H_E4, BIT(4)), 1579 + PINCTRL_CONF_DESC(39, REG_GPIO_H_E4, BIT(5)), 1580 + PINCTRL_CONF_DESC(40, REG_GPIO_H_E4, BIT(6)), 1581 + PINCTRL_CONF_DESC(41, REG_I2C_SDA_E4, I2C_SCL_E4_MASK), 1582 + PINCTRL_CONF_DESC(42, REG_I2C_SDA_E4, I2C_SDA_E4_MASK), 1583 + PINCTRL_CONF_DESC(43, REG_I2C_SDA_E4, AN7583_I2C1_SCL_E4_MASK), 1584 + PINCTRL_CONF_DESC(44, REG_I2C_SDA_E4, AN7583_I2C1_SDA_E4_MASK), 1585 + PINCTRL_CONF_DESC(45, REG_I2C_SDA_E4, SPI_CLK_E4_MASK), 1586 + PINCTRL_CONF_DESC(46, REG_I2C_SDA_E4, SPI_CS0_E4_MASK), 1587 + PINCTRL_CONF_DESC(47, REG_I2C_SDA_E4, SPI_MOSI_E4_MASK), 1588 + PINCTRL_CONF_DESC(48, REG_I2C_SDA_E4, SPI_MISO_E4_MASK), 1589 + PINCTRL_CONF_DESC(49, REG_I2C_SDA_E4, UART1_TXD_E4_MASK), 1590 + PINCTRL_CONF_DESC(50, REG_I2C_SDA_E4, UART1_RXD_E4_MASK), 1591 + PINCTRL_CONF_DESC(51, REG_I2C_SDA_E4, PCIE0_RESET_E4_MASK), 1592 + PINCTRL_CONF_DESC(52, REG_I2C_SDA_E4, PCIE1_RESET_E4_MASK), 1593 + PINCTRL_CONF_DESC(53, REG_I2C_SDA_E4, AN7583_MDC_0_E4_MASK), 1594 + PINCTRL_CONF_DESC(54, REG_I2C_SDA_E4, AN7583_MDIO_0_E4_MASK), 1595 + }; 1596 + 2181 1597 static const struct airoha_pinctrl_conf en7581_pinctrl_pcie_rst_od_conf[] = { 2182 1598 PINCTRL_CONF_DESC(61, REG_PCIE_RESET_OD, PCIE0_RESET_OD_MASK), 2183 1599 PINCTRL_CONF_DESC(62, REG_PCIE_RESET_OD, PCIE1_RESET_OD_MASK), 2184 1600 PINCTRL_CONF_DESC(63, REG_PCIE_RESET_OD, PCIE2_RESET_OD_MASK), 1601 + }; 1602 + 1603 + static const struct airoha_pinctrl_conf an7583_pinctrl_pcie_rst_od_conf[] = { 1604 + PINCTRL_CONF_DESC(51, REG_PCIE_RESET_OD, PCIE0_RESET_OD_MASK), 1605 + PINCTRL_CONF_DESC(52, REG_PCIE_RESET_OD, PCIE1_RESET_OD_MASK), 2185 1606 }; 2186 1607 2187 1608 static int airoha_convert_pin_to_reg_offset(struct pinctrl_dev *pctrl_dev, ··· 2409 1708 }; 2410 1709 2411 1710 static int airoha_pinctrl_add_gpiochip(struct airoha_pinctrl *pinctrl, 2412 - struct platform_device *pdev) 1711 + struct platform_device *pdev) 2413 1712 { 2414 1713 struct airoha_pinctrl_gpiochip *chip = &pinctrl->gpiochip; 2415 1714 struct gpio_chip *gc = &chip->chip; ··· 2444 1743 return irq; 2445 1744 2446 1745 err = devm_request_irq(dev, irq, airoha_irq_handler, IRQF_SHARED, 2447 - dev_name(dev), pinctrl); 1746 + dev_name(dev), pinctrl); 2448 1747 if (err) { 2449 1748 dev_err(dev, "error requesting irq %d: %d\n", irq, err); 2450 1749 return err; ··· 2508 1807 } 2509 1808 2510 1809 static int airoha_pinmux_set_direction(struct pinctrl_dev *pctrl_dev, 2511 - struct pinctrl_gpio_range *range, 2512 - unsigned int p, bool input) 1810 + struct pinctrl_gpio_range *range, 1811 + unsigned int p, bool input) 2513 1812 { 2514 1813 struct airoha_pinctrl *pinctrl = pinctrl_dev_get_drvdata(pctrl_dev); 2515 1814 u32 mask, index; ··· 2599 1898 2600 1899 2601 1900 if (regmap_update_bits(pinctrl->chip_scu, reg->offset, reg->mask, 2602 - val << __ffs(reg->mask))) 1901 + val << __ffs(reg->mask))) 2603 1902 return -EINVAL; 2604 1903 2605 1904 return 0; ··· 2816 2115 2817 2116 for (i = 0; i < pinctrl->grps[group].npins; i++) { 2818 2117 if (airoha_pinconf_get(pctrl_dev, 2819 - pinctrl->grps[group].pins[i], 2820 - config)) 2118 + pinctrl->grps[group].pins[i], 2119 + config)) 2821 2120 return -ENOTSUPP; 2822 2121 2823 2122 if (i && cur_config != *config) ··· 2976 2275 }, 2977 2276 }; 2978 2277 2278 + static const struct airoha_pinctrl_match_data an7583_pinctrl_match_data = { 2279 + .pins = an7583_pinctrl_pins, 2280 + .num_pins = ARRAY_SIZE(an7583_pinctrl_pins), 2281 + .grps = an7583_pinctrl_groups, 2282 + .num_grps = ARRAY_SIZE(an7583_pinctrl_groups), 2283 + .funcs = an7583_pinctrl_funcs, 2284 + .num_funcs = ARRAY_SIZE(an7583_pinctrl_funcs), 2285 + .confs_info = { 2286 + [AIROHA_PINCTRL_CONFS_PULLUP] = { 2287 + .confs = an7583_pinctrl_pullup_conf, 2288 + .num_confs = ARRAY_SIZE(an7583_pinctrl_pullup_conf), 2289 + }, 2290 + [AIROHA_PINCTRL_CONFS_PULLDOWN] = { 2291 + .confs = an7583_pinctrl_pulldown_conf, 2292 + .num_confs = ARRAY_SIZE(an7583_pinctrl_pulldown_conf), 2293 + }, 2294 + [AIROHA_PINCTRL_CONFS_DRIVE_E2] = { 2295 + .confs = en7581_pinctrl_drive_e2_conf, 2296 + .num_confs = ARRAY_SIZE(an7583_pinctrl_drive_e2_conf), 2297 + }, 2298 + [AIROHA_PINCTRL_CONFS_DRIVE_E4] = { 2299 + .confs = an7583_pinctrl_drive_e4_conf, 2300 + .num_confs = ARRAY_SIZE(an7583_pinctrl_drive_e4_conf), 2301 + }, 2302 + [AIROHA_PINCTRL_CONFS_PCIE_RST_OD] = { 2303 + .confs = an7583_pinctrl_pcie_rst_od_conf, 2304 + .num_confs = ARRAY_SIZE(an7583_pinctrl_pcie_rst_od_conf), 2305 + }, 2306 + }, 2307 + }; 2308 + 2979 2309 static const struct of_device_id airoha_pinctrl_of_match[] = { 2980 2310 { .compatible = "airoha,en7581-pinctrl", .data = &en7581_pinctrl_match_data }, 2311 + { .compatible = "airoha,an7583-pinctrl", .data = &an7583_pinctrl_match_data }, 2981 2312 { /* sentinel */ } 2982 2313 }; 2983 2314 MODULE_DEVICE_TABLE(of, airoha_pinctrl_of_match);