linux/drivers/pinctrl/mediatek/pinctrl-mt7623.c

// SPDX-License-Identifier: GPL-2.0
/*
 * The MT7623 driver based on Linux generic pinctrl binding.
 *
 * Copyright (C) 2015 - 2018 MediaTek Inc.
 * Author: Biao Huang <[email protected]>
 *	   Ryder Lee <[email protected]>
 *	   Sean Wang <[email protected]>
 */

#include "pinctrl-moore.h"

#define PIN_BOND_REG0
#define PIN_BOND_REG1
#define PIN_BOND_REG2
#define BOND_PCIE_CLR
#define BOND_I2S_CLR
#define BOND_MSDC0E_CLR

#define PIN_FIELD15(_s_pin, _e_pin, _s_addr, _x_addrs, _s_bit, _x_bits)

#define PIN_FIELD16(_s_pin, _e_pin, _s_addr, _x_addrs, _s_bit, _x_bits)

#define PINS_FIELD16(_s_pin, _e_pin, _s_addr, _x_addrs, _s_bit, _x_bits)

#define MT7623_PIN(_number, _name, _eint_n, _drv_grp)

static const struct mtk_pin_field_calc mt7623_pin_mode_range[] =;

static const struct mtk_pin_field_calc mt7623_pin_dir_range[] =;

static const struct mtk_pin_field_calc mt7623_pin_di_range[] =;

static const struct mtk_pin_field_calc mt7623_pin_do_range[] =;

static const struct mtk_pin_field_calc mt7623_pin_ies_range[] =;

static const struct mtk_pin_field_calc mt7623_pin_smt_range[] =;

static const struct mtk_pin_field_calc mt7623_pin_pullen_range[] =;

static const struct mtk_pin_field_calc mt7623_pin_pullsel_range[] =;

static const struct mtk_pin_field_calc mt7623_pin_drv_range[] =;

static const struct mtk_pin_field_calc mt7623_pin_tdsel_range[] =;

static const struct mtk_pin_field_calc mt7623_pin_pupd_range[] =;

static const struct mtk_pin_field_calc mt7623_pin_r1_range[] =;

static const struct mtk_pin_field_calc mt7623_pin_r0_range[] =;

static const struct mtk_pin_reg_calc mt7623_reg_cals[] =;

static const struct mtk_pin_desc mt7623_pins[] =;

/* List all groups consisting of these pins dedicated to the enablement of
 * certain hardware block and the corresponding mode for all of the pins.
 * The hardware probably has multiple combinations of these pinouts.
 */

/* AUDIO EXT CLK */
static int mt7623_aud_ext_clk0_pins[] =;
static int mt7623_aud_ext_clk0_funcs[] =;
static int mt7623_aud_ext_clk1_pins[] =;
static int mt7623_aud_ext_clk1_funcs[] =;

/* DISP PWM */
static int mt7623_disp_pwm_0_pins[] =;
static int mt7623_disp_pwm_0_funcs[] =;
static int mt7623_disp_pwm_1_pins[] =;
static int mt7623_disp_pwm_1_funcs[] =;
static int mt7623_disp_pwm_2_pins[] =;
static int mt7623_disp_pwm_2_funcs[] =;

/* ESW */
static int mt7623_esw_int_pins[] =;
static int mt7623_esw_int_funcs[] =;
static int mt7623_esw_rst_pins[] =;
static int mt7623_esw_rst_funcs[] =;

/* EPHY */
static int mt7623_ephy_pins[] =;
static int mt7623_ephy_funcs[] =;

/* EXT_SDIO */
static int mt7623_ext_sdio_pins[] =;
static int mt7623_ext_sdio_funcs[] =;

/* HDMI RX */
static int mt7623_hdmi_rx_pins[] =;
static int mt7623_hdmi_rx_funcs[] =;
static int mt7623_hdmi_rx_i2c_pins[] =;
static int mt7623_hdmi_rx_i2c_funcs[] =;

/* HDMI TX */
static int mt7623_hdmi_cec_pins[] =;
static int mt7623_hdmi_cec_funcs[] =;
static int mt7623_hdmi_htplg_pins[] =;
static int mt7623_hdmi_htplg_funcs[] =;
static int mt7623_hdmi_i2c_pins[] =;
static int mt7623_hdmi_i2c_funcs[] =;

/* I2C */
static int mt7623_i2c0_pins[] =;
static int mt7623_i2c0_funcs[] =;
static int mt7623_i2c1_0_pins[] =;
static int mt7623_i2c1_0_funcs[] =;
static int mt7623_i2c1_1_pins[] =;
static int mt7623_i2c1_1_funcs[] =;
static int mt7623_i2c1_2_pins[] =;
static int mt7623_i2c1_2_funcs[] =;
static int mt7623_i2c1_3_pins[] =;
static int mt7623_i2c1_3_funcs[] =;
static int mt7623_i2c1_4_pins[] =;
static int mt7623_i2c1_4_funcs[] =;
static int mt7623_i2c2_0_pins[] =;
static int mt7623_i2c2_0_funcs[] =;
static int mt7623_i2c2_1_pins[] =;
static int mt7623_i2c2_1_funcs[] =;
static int mt7623_i2c2_2_pins[] =;
static int mt7623_i2c2_2_funcs[] =;
static int mt7623_i2c2_3_pins[] =;
static int mt7623_i2c2_3_funcs[] =;

/* I2S */
static int mt7623_i2s0_pins[] =;
static int mt7623_i2s0_funcs[] =;
static int mt7623_i2s1_pins[] =;
static int mt7623_i2s1_funcs[] =;
static int mt7623_i2s2_bclk_lrclk_mclk_pins[] =;
static int mt7623_i2s2_bclk_lrclk_mclk_funcs[] =;
static int mt7623_i2s2_data_in_pins[] =;
static int mt7623_i2s2_data_in_funcs[] =;
static int mt7623_i2s2_data_0_pins[] =;
static int mt7623_i2s2_data_0_funcs[] =;
static int mt7623_i2s2_data_1_pins[] =;
static int mt7623_i2s2_data_1_funcs[] =;
static int mt7623_i2s3_bclk_lrclk_mclk_pins[] =;
static int mt7623_i2s3_bclk_lrclk_mclk_funcs[] =;
static int mt7623_i2s3_data_in_pins[] =;
static int mt7623_i2s3_data_in_funcs[] =;
static int mt7623_i2s3_data_0_pins[] =;
static int mt7623_i2s3_data_0_funcs[] =;
static int mt7623_i2s3_data_1_pins[] =;
static int mt7623_i2s3_data_1_funcs[] =;
static int mt7623_i2s4_pins[] =;
static int mt7623_i2s4_funcs[] =;
static int mt7623_i2s5_pins[] =;
static int mt7623_i2s5_funcs[] =;

/* IR */
static int mt7623_ir_pins[] =;
static int mt7623_ir_funcs[] =;

/* LCD */
static int mt7623_mipi_tx_pins[] =;
static int mt7623_mipi_tx_funcs[] =;
static int mt7623_dsi_te_pins[] =;
static int mt7623_dsi_te_funcs[] =;
static int mt7623_lcm_rst_pins[] =;
static int mt7623_lcm_rst_funcs[] =;

/* MDC/MDIO */
static int mt7623_mdc_mdio_pins[] =;
static int mt7623_mdc_mdio_funcs[] =;

/* MSDC */
static int mt7623_msdc0_pins[] =;
static int mt7623_msdc0_funcs[] =;
static int mt7623_msdc1_pins[] =;
static int mt7623_msdc1_funcs[] =;
static int mt7623_msdc1_ins_pins[] =;
static int mt7623_msdc1_ins_funcs[] =;
static int mt7623_msdc1_wp_0_pins[] =;
static int mt7623_msdc1_wp_0_funcs[] =;
static int mt7623_msdc1_wp_1_pins[] =;
static int mt7623_msdc1_wp_1_funcs[] =;
static int mt7623_msdc1_wp_2_pins[] =;
static int mt7623_msdc1_wp_2_funcs[] =;
static int mt7623_msdc2_pins[] =;
static int mt7623_msdc2_funcs[] =;
static int mt7623_msdc3_pins[] =;
static int mt7623_msdc3_funcs[] =;

/* NAND */
static int mt7623_nandc_pins[] =;
static int mt7623_nandc_funcs[] =;
static int mt7623_nandc_ceb0_pins[] =;
static int mt7623_nandc_ceb0_funcs[] =;
static int mt7623_nandc_ceb1_pins[] =;
static int mt7623_nandc_ceb1_funcs[] =;

/* RTC */
static int mt7623_rtc_pins[] =;
static int mt7623_rtc_funcs[] =;

/* OTG */
static int mt7623_otg_iddig0_0_pins[] =;
static int mt7623_otg_iddig0_0_funcs[] =;
static int mt7623_otg_iddig0_1_pins[] =;
static int mt7623_otg_iddig0_1_funcs[] =;
static int mt7623_otg_iddig0_2_pins[] =;
static int mt7623_otg_iddig0_2_funcs[] =;
static int mt7623_otg_iddig1_0_pins[] =;
static int mt7623_otg_iddig1_0_funcs[] =;
static int mt7623_otg_iddig1_1_pins[] =;
static int mt7623_otg_iddig1_1_funcs[] =;
static int mt7623_otg_iddig1_2_pins[] =;
static int mt7623_otg_iddig1_2_funcs[] =;
static int mt7623_otg_drv_vbus0_0_pins[] =;
static int mt7623_otg_drv_vbus0_0_funcs[] =;
static int mt7623_otg_drv_vbus0_1_pins[] =;
static int mt7623_otg_drv_vbus0_1_funcs[] =;
static int mt7623_otg_drv_vbus0_2_pins[] =;
static int mt7623_otg_drv_vbus0_2_funcs[] =;
static int mt7623_otg_drv_vbus1_0_pins[] =;
static int mt7623_otg_drv_vbus1_0_funcs[] =;
static int mt7623_otg_drv_vbus1_1_pins[] =;
static int mt7623_otg_drv_vbus1_1_funcs[] =;
static int mt7623_otg_drv_vbus1_2_pins[] =;
static int mt7623_otg_drv_vbus1_2_funcs[] =;

/* PCIE */
static int mt7623_pcie0_0_perst_pins[] =;
static int mt7623_pcie0_0_perst_funcs[] =;
static int mt7623_pcie0_1_perst_pins[] =;
static int mt7623_pcie0_1_perst_funcs[] =;
static int mt7623_pcie1_0_perst_pins[] =;
static int mt7623_pcie1_0_perst_funcs[] =;
static int mt7623_pcie1_1_perst_pins[] =;
static int mt7623_pcie1_1_perst_funcs[] =;
static int mt7623_pcie2_0_perst_pins[] =;
static int mt7623_pcie2_0_perst_funcs[] =;
static int mt7623_pcie2_1_perst_pins[] =;
static int mt7623_pcie2_1_perst_funcs[] =;
static int mt7623_pcie0_0_wake_pins[] =;
static int mt7623_pcie0_0_wake_funcs[] =;
static int mt7623_pcie0_1_wake_pins[] =;
static int mt7623_pcie0_1_wake_funcs[] =;
static int mt7623_pcie1_0_wake_pins[] =;
static int mt7623_pcie1_0_wake_funcs[] =;
static int mt7623_pcie1_1_wake_pins[] =;
static int mt7623_pcie1_1_wake_funcs[] =;
static int mt7623_pcie2_0_wake_pins[] =;
static int mt7623_pcie2_0_wake_funcs[] =;
static int mt7623_pcie2_1_wake_pins[] =;
static int mt7623_pcie2_1_wake_funcs[] =;
static int mt7623_pcie0_clkreq_pins[] =;
static int mt7623_pcie0_clkreq_funcs[] =;
static int mt7623_pcie1_clkreq_pins[] =;
static int mt7623_pcie1_clkreq_funcs[] =;
static int mt7623_pcie2_clkreq_pins[] =;
static int mt7623_pcie2_clkreq_funcs[] =;

/* the pcie_*_rev are only used for MT7623 */
static int mt7623_pcie0_0_rev_perst_pins[] =;
static int mt7623_pcie0_0_rev_perst_funcs[] =;
static int mt7623_pcie0_1_rev_perst_pins[] =;
static int mt7623_pcie0_1_rev_perst_funcs[] =;
static int mt7623_pcie1_0_rev_perst_pins[] =;
static int mt7623_pcie1_0_rev_perst_funcs[] =;
static int mt7623_pcie1_1_rev_perst_pins[] =;
static int mt7623_pcie1_1_rev_perst_funcs[] =;
static int mt7623_pcie2_0_rev_perst_pins[] =;
static int mt7623_pcie2_0_rev_perst_funcs[] =;
static int mt7623_pcie2_1_rev_perst_pins[] =;
static int mt7623_pcie2_1_rev_perst_funcs[] =;

/* PCM */
static int mt7623_pcm_clk_0_pins[] =;
static int mt7623_pcm_clk_0_funcs[] =;
static int mt7623_pcm_clk_1_pins[] =;
static int mt7623_pcm_clk_1_funcs[] =;
static int mt7623_pcm_clk_2_pins[] =;
static int mt7623_pcm_clk_2_funcs[] =;
static int mt7623_pcm_clk_3_pins[] =;
static int mt7623_pcm_clk_3_funcs[] =;
static int mt7623_pcm_clk_4_pins[] =;
static int mt7623_pcm_clk_4_funcs[] =;
static int mt7623_pcm_clk_5_pins[] =;
static int mt7623_pcm_clk_5_funcs[] =;
static int mt7623_pcm_clk_6_pins[] =;
static int mt7623_pcm_clk_6_funcs[] =;
static int mt7623_pcm_sync_0_pins[] =;
static int mt7623_pcm_sync_0_funcs[] =;
static int mt7623_pcm_sync_1_pins[] =;
static int mt7623_pcm_sync_1_funcs[] =;
static int mt7623_pcm_sync_2_pins[] =;
static int mt7623_pcm_sync_2_funcs[] =;
static int mt7623_pcm_sync_3_pins[] =;
static int mt7623_pcm_sync_3_funcs[] =;
static int mt7623_pcm_sync_4_pins[] =;
static int mt7623_pcm_sync_4_funcs[] =;
static int mt7623_pcm_sync_5_pins[] =;
static int mt7623_pcm_sync_5_funcs[] =;
static int mt7623_pcm_sync_6_pins[] =;
static int mt7623_pcm_sync_6_funcs[] =;
static int mt7623_pcm_rx_0_pins[] =;
static int mt7623_pcm_rx_0_funcs[] =;
static int mt7623_pcm_rx_1_pins[] =;
static int mt7623_pcm_rx_1_funcs[] =;
static int mt7623_pcm_rx_2_pins[] =;
static int mt7623_pcm_rx_2_funcs[] =;
static int mt7623_pcm_rx_3_pins[] =;
static int mt7623_pcm_rx_3_funcs[] =;
static int mt7623_pcm_rx_4_pins[] =;
static int mt7623_pcm_rx_4_funcs[] =;
static int mt7623_pcm_rx_5_pins[] =;
static int mt7623_pcm_rx_5_funcs[] =;
static int mt7623_pcm_rx_6_pins[] =;
static int mt7623_pcm_rx_6_funcs[] =;
static int mt7623_pcm_tx_0_pins[] =;
static int mt7623_pcm_tx_0_funcs[] =;
static int mt7623_pcm_tx_1_pins[] =;
static int mt7623_pcm_tx_1_funcs[] =;
static int mt7623_pcm_tx_2_pins[] =;
static int mt7623_pcm_tx_2_funcs[] =;
static int mt7623_pcm_tx_3_pins[] =;
static int mt7623_pcm_tx_3_funcs[] =;
static int mt7623_pcm_tx_4_pins[] =;
static int mt7623_pcm_tx_4_funcs[] =;
static int mt7623_pcm_tx_5_pins[] =;
static int mt7623_pcm_tx_5_funcs[] =;
static int mt7623_pcm_tx_6_pins[] =;
static int mt7623_pcm_tx_6_funcs[] =;

/* PWM */
static int mt7623_pwm_ch1_0_pins[] =;
static int mt7623_pwm_ch1_0_funcs[] =;
static int mt7623_pwm_ch1_1_pins[] =;
static int mt7623_pwm_ch1_1_funcs[] =;
static int mt7623_pwm_ch1_2_pins[] =;
static int mt7623_pwm_ch1_2_funcs[] =;
static int mt7623_pwm_ch1_3_pins[] =;
static int mt7623_pwm_ch1_3_funcs[] =;
static int mt7623_pwm_ch1_4_pins[] =;
static int mt7623_pwm_ch1_4_funcs[] =;
static int mt7623_pwm_ch2_0_pins[] =;
static int mt7623_pwm_ch2_0_funcs[] =;
static int mt7623_pwm_ch2_1_pins[] =;
static int mt7623_pwm_ch2_1_funcs[] =;
static int mt7623_pwm_ch2_2_pins[] =;
static int mt7623_pwm_ch2_2_funcs[] =;
static int mt7623_pwm_ch2_3_pins[] =;
static int mt7623_pwm_ch2_3_funcs[] =;
static int mt7623_pwm_ch2_4_pins[] =;
static int mt7623_pwm_ch2_4_funcs[] =;
static int mt7623_pwm_ch3_0_pins[] =;
static int mt7623_pwm_ch3_0_funcs[] =;
static int mt7623_pwm_ch3_1_pins[] =;
static int mt7623_pwm_ch3_1_funcs[] =;
static int mt7623_pwm_ch3_2_pins[] =;
static int mt7623_pwm_ch3_2_funcs[] =;
static int mt7623_pwm_ch3_3_pins[] =;
static int mt7623_pwm_ch3_3_funcs[] =;
static int mt7623_pwm_ch4_0_pins[] =;
static int mt7623_pwm_ch4_0_funcs[] =;
static int mt7623_pwm_ch4_1_pins[] =;
static int mt7623_pwm_ch4_1_funcs[] =;
static int mt7623_pwm_ch4_2_pins[] =;
static int mt7623_pwm_ch4_2_funcs[] =;
static int mt7623_pwm_ch4_3_pins[] =;
static int mt7623_pwm_ch4_3_funcs[] =;
static int mt7623_pwm_ch5_0_pins[] =;
static int mt7623_pwm_ch5_0_funcs[] =;
static int mt7623_pwm_ch5_1_pins[] =;
static int mt7623_pwm_ch5_1_funcs[] =;

/* PWRAP */
static int mt7623_pwrap_pins[] =;
static int mt7623_pwrap_funcs[] =;

/* SPDIF */
static int mt7623_spdif_in0_0_pins[] =;
static int mt7623_spdif_in0_0_funcs[] =;
static int mt7623_spdif_in0_1_pins[] =;
static int mt7623_spdif_in0_1_funcs[] =;
static int mt7623_spdif_in1_0_pins[] =;
static int mt7623_spdif_in1_0_funcs[] =;
static int mt7623_spdif_in1_1_pins[] =;
static int mt7623_spdif_in1_1_funcs[] =;
static int mt7623_spdif_out_pins[] =;
static int mt7623_spdif_out_funcs[] =;

/* SPI */
static int mt7623_spi0_pins[] =;
static int mt7623_spi0_funcs[] =;
static int mt7623_spi1_pins[] =;
static int mt7623_spi1_funcs[] =;
static int mt7623_spi2_pins[] =;
static int mt7623_spi2_funcs[] =;

/* UART */
static int mt7623_uart0_0_txd_rxd_pins[] =;
static int mt7623_uart0_0_txd_rxd_funcs[] =;
static int mt7623_uart0_1_txd_rxd_pins[] =;
static int mt7623_uart0_1_txd_rxd_funcs[] =;
static int mt7623_uart0_2_txd_rxd_pins[] =;
static int mt7623_uart0_2_txd_rxd_funcs[] =;
static int mt7623_uart0_3_txd_rxd_pins[] =;
static int mt7623_uart0_3_txd_rxd_funcs[] =;
static int mt7623_uart0_rts_cts_pins[] =;
static int mt7623_uart0_rts_cts_funcs[] =;
static int mt7623_uart1_0_txd_rxd_pins[] =;
static int mt7623_uart1_0_txd_rxd_funcs[] =;
static int mt7623_uart1_1_txd_rxd_pins[] =;
static int mt7623_uart1_1_txd_rxd_funcs[] =;
static int mt7623_uart1_2_txd_rxd_pins[] =;
static int mt7623_uart1_2_txd_rxd_funcs[] =;
static int mt7623_uart1_rts_cts_pins[] =;
static int mt7623_uart1_rts_cts_funcs[] =;
static int mt7623_uart2_0_txd_rxd_pins[] =;
static int mt7623_uart2_0_txd_rxd_funcs[] =;
static int mt7623_uart2_1_txd_rxd_pins[] =;
static int mt7623_uart2_1_txd_rxd_funcs[] =;
static int mt7623_uart2_rts_cts_pins[] =;
static int mt7623_uart2_rts_cts_funcs[] =;
static int mt7623_uart3_txd_rxd_pins[] =;
static int mt7623_uart3_txd_rxd_funcs[] =;
static int mt7623_uart3_rts_cts_pins[] =;
static int mt7623_uart3_rts_cts_funcs[] =;

/* Watchdog */
static int mt7623_watchdog_0_pins[] =;
static int mt7623_watchdog_0_funcs[] =;
static int mt7623_watchdog_1_pins[] =;
static int mt7623_watchdog_1_funcs[] =;

static const struct group_desc mt7623_groups[] =;

/* Joint those groups owning the same capability in user point of view which
 * allows that people tend to use through the device tree.
 */
static const char *mt7623_aud_clk_groups[] =;
static const char *mt7623_disp_pwm_groups[] =;
static const char *mt7623_ethernet_groups[] =;
static const char *mt7623_ext_sdio_groups[] =;
static const char *mt7623_hdmi_groups[] =;
static const char *mt7623_i2c_groups[] =;
static const char *mt7623_i2s_groups[] =;
static const char *mt7623_ir_groups[] =;
static const char *mt7623_lcd_groups[] =;
static const char *mt7623_msdc_groups[] =;
static const char *mt7623_nandc_groups[] =;
static const char *mt7623_otg_groups[] =;
static const char *mt7623_pcie_groups[] =;
static const char *mt7623_pcm_groups[] =;
static const char *mt7623_pwm_groups[] =;
static const char *mt7623_pwrap_groups[] =;
static const char *mt7623_rtc_groups[] =;
static const char *mt7623_spi_groups[] =;
static const char *mt7623_spdif_groups[] =;
static const char *mt7623_uart_groups[] =;
static const char *mt7623_wdt_groups[] =;

static const struct function_desc mt7623_functions[] =;

static const struct mtk_eint_hw mt7623_eint_hw =;

static struct mtk_pin_soc mt7623_data =;

/*
 * There are some specific pins have mux functions greater than 8,
 * and if we want to switch thees high modes we need to disable
 * bonding constraints firstly.
 */
static void mt7623_bonding_disable(struct platform_device *pdev)
{}

static const struct of_device_id mt7623_pctrl_match[] =;

static int mt7623_pinctrl_probe(struct platform_device *pdev)
{}

static struct platform_driver mtk_pinctrl_driver =;

static int __init mtk_pinctrl_init(void)
{}
arch_initcall(mtk_pinctrl_init);