linux/drivers/pinctrl/bcm/pinctrl-bcm281xx.c

// SPDX-License-Identifier: GPL-2.0-only
// Copyright (C) 2013-2017 Broadcom

#include <linux/err.h>
#include <linux/init.h>
#include <linux/io.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
#include <linux/seq_file.h>
#include <linux/slab.h>

#include <linux/pinctrl/pinconf-generic.h>
#include <linux/pinctrl/pinconf.h>
#include <linux/pinctrl/pinctrl.h>
#include <linux/pinctrl/pinmux.h>

#include "../core.h"
#include "../pinctrl-utils.h"

/* BCM281XX Pin Control Registers Definitions */

/* Function Select bits are the same for all pin control registers */
#define BCM281XX_PIN_REG_F_SEL_MASK
#define BCM281XX_PIN_REG_F_SEL_SHIFT

/* Standard pin register */
#define BCM281XX_STD_PIN_REG_DRV_STR_MASK
#define BCM281XX_STD_PIN_REG_DRV_STR_SHIFT
#define BCM281XX_STD_PIN_REG_INPUT_DIS_MASK
#define BCM281XX_STD_PIN_REG_INPUT_DIS_SHIFT
#define BCM281XX_STD_PIN_REG_SLEW_MASK
#define BCM281XX_STD_PIN_REG_SLEW_SHIFT
#define BCM281XX_STD_PIN_REG_PULL_UP_MASK
#define BCM281XX_STD_PIN_REG_PULL_UP_SHIFT
#define BCM281XX_STD_PIN_REG_PULL_DN_MASK
#define BCM281XX_STD_PIN_REG_PULL_DN_SHIFT
#define BCM281XX_STD_PIN_REG_HYST_MASK
#define BCM281XX_STD_PIN_REG_HYST_SHIFT

/* I2C pin register */
#define BCM281XX_I2C_PIN_REG_INPUT_DIS_MASK
#define BCM281XX_I2C_PIN_REG_INPUT_DIS_SHIFT
#define BCM281XX_I2C_PIN_REG_SLEW_MASK
#define BCM281XX_I2C_PIN_REG_SLEW_SHIFT
#define BCM281XX_I2C_PIN_REG_PULL_UP_STR_MASK
#define BCM281XX_I2C_PIN_REG_PULL_UP_STR_SHIFT

/* HDMI pin register */
#define BCM281XX_HDMI_PIN_REG_INPUT_DIS_MASK
#define BCM281XX_HDMI_PIN_REG_INPUT_DIS_SHIFT
#define BCM281XX_HDMI_PIN_REG_MODE_MASK
#define BCM281XX_HDMI_PIN_REG_MODE_SHIFT

/*
 * bcm281xx_pin_type - types of pin register
 */
enum bcm281xx_pin_type {};

static enum bcm281xx_pin_type std_pin =;
static enum bcm281xx_pin_type i2c_pin =;
static enum bcm281xx_pin_type hdmi_pin =;

/*
 * bcm281xx_pin_function- define pin function
 */
struct bcm281xx_pin_function {};

/*
 * bcm281xx_pinctrl_data - Broadcom-specific pinctrl data
 * @reg_base - base of pinctrl registers
 */
struct bcm281xx_pinctrl_data {};

/*
 * Pin number definition.  The order here must be the same as defined in the
 * PADCTRLREG block in the RDB.
 */
#define BCM281XX_PIN_ADCSYNC
#define BCM281XX_PIN_BAT_RM
#define BCM281XX_PIN_BSC1_SCL
#define BCM281XX_PIN_BSC1_SDA
#define BCM281XX_PIN_BSC2_SCL
#define BCM281XX_PIN_BSC2_SDA
#define BCM281XX_PIN_CLASSGPWR
#define BCM281XX_PIN_CLK_CX8
#define BCM281XX_PIN_CLKOUT_0
#define BCM281XX_PIN_CLKOUT_1
#define BCM281XX_PIN_CLKOUT_2
#define BCM281XX_PIN_CLKOUT_3
#define BCM281XX_PIN_CLKREQ_IN_0
#define BCM281XX_PIN_CLKREQ_IN_1
#define BCM281XX_PIN_CWS_SYS_REQ1
#define BCM281XX_PIN_CWS_SYS_REQ2
#define BCM281XX_PIN_CWS_SYS_REQ3
#define BCM281XX_PIN_DIGMIC1_CLK
#define BCM281XX_PIN_DIGMIC1_DQ
#define BCM281XX_PIN_DIGMIC2_CLK
#define BCM281XX_PIN_DIGMIC2_DQ
#define BCM281XX_PIN_GPEN13
#define BCM281XX_PIN_GPEN14
#define BCM281XX_PIN_GPEN15
#define BCM281XX_PIN_GPIO00
#define BCM281XX_PIN_GPIO01
#define BCM281XX_PIN_GPIO02
#define BCM281XX_PIN_GPIO03
#define BCM281XX_PIN_GPIO04
#define BCM281XX_PIN_GPIO05
#define BCM281XX_PIN_GPIO06
#define BCM281XX_PIN_GPIO07
#define BCM281XX_PIN_GPIO08
#define BCM281XX_PIN_GPIO09
#define BCM281XX_PIN_GPIO10
#define BCM281XX_PIN_GPIO11
#define BCM281XX_PIN_GPIO12
#define BCM281XX_PIN_GPIO13
#define BCM281XX_PIN_GPIO14
#define BCM281XX_PIN_GPS_PABLANK
#define BCM281XX_PIN_GPS_TMARK
#define BCM281XX_PIN_HDMI_SCL
#define BCM281XX_PIN_HDMI_SDA
#define BCM281XX_PIN_IC_DM
#define BCM281XX_PIN_IC_DP
#define BCM281XX_PIN_KP_COL_IP_0
#define BCM281XX_PIN_KP_COL_IP_1
#define BCM281XX_PIN_KP_COL_IP_2
#define BCM281XX_PIN_KP_COL_IP_3
#define BCM281XX_PIN_KP_ROW_OP_0
#define BCM281XX_PIN_KP_ROW_OP_1
#define BCM281XX_PIN_KP_ROW_OP_2
#define BCM281XX_PIN_KP_ROW_OP_3
#define BCM281XX_PIN_LCD_B_0
#define BCM281XX_PIN_LCD_B_1
#define BCM281XX_PIN_LCD_B_2
#define BCM281XX_PIN_LCD_B_3
#define BCM281XX_PIN_LCD_B_4
#define BCM281XX_PIN_LCD_B_5
#define BCM281XX_PIN_LCD_B_6
#define BCM281XX_PIN_LCD_B_7
#define BCM281XX_PIN_LCD_G_0
#define BCM281XX_PIN_LCD_G_1
#define BCM281XX_PIN_LCD_G_2
#define BCM281XX_PIN_LCD_G_3
#define BCM281XX_PIN_LCD_G_4
#define BCM281XX_PIN_LCD_G_5
#define BCM281XX_PIN_LCD_G_6
#define BCM281XX_PIN_LCD_G_7
#define BCM281XX_PIN_LCD_HSYNC
#define BCM281XX_PIN_LCD_OE
#define BCM281XX_PIN_LCD_PCLK
#define BCM281XX_PIN_LCD_R_0
#define BCM281XX_PIN_LCD_R_1
#define BCM281XX_PIN_LCD_R_2
#define BCM281XX_PIN_LCD_R_3
#define BCM281XX_PIN_LCD_R_4
#define BCM281XX_PIN_LCD_R_5
#define BCM281XX_PIN_LCD_R_6
#define BCM281XX_PIN_LCD_R_7
#define BCM281XX_PIN_LCD_VSYNC
#define BCM281XX_PIN_MDMGPIO0
#define BCM281XX_PIN_MDMGPIO1
#define BCM281XX_PIN_MDMGPIO2
#define BCM281XX_PIN_MDMGPIO3
#define BCM281XX_PIN_MDMGPIO4
#define BCM281XX_PIN_MDMGPIO5
#define BCM281XX_PIN_MDMGPIO6
#define BCM281XX_PIN_MDMGPIO7
#define BCM281XX_PIN_MDMGPIO8
#define BCM281XX_PIN_MPHI_DATA_0
#define BCM281XX_PIN_MPHI_DATA_1
#define BCM281XX_PIN_MPHI_DATA_2
#define BCM281XX_PIN_MPHI_DATA_3
#define BCM281XX_PIN_MPHI_DATA_4
#define BCM281XX_PIN_MPHI_DATA_5
#define BCM281XX_PIN_MPHI_DATA_6
#define BCM281XX_PIN_MPHI_DATA_7
#define BCM281XX_PIN_MPHI_DATA_8
#define BCM281XX_PIN_MPHI_DATA_9
#define BCM281XX_PIN_MPHI_DATA_10
#define BCM281XX_PIN_MPHI_DATA_11
#define BCM281XX_PIN_MPHI_DATA_12
#define BCM281XX_PIN_MPHI_DATA_13
#define BCM281XX_PIN_MPHI_DATA_14
#define BCM281XX_PIN_MPHI_DATA_15
#define BCM281XX_PIN_MPHI_HA0
#define BCM281XX_PIN_MPHI_HAT0
#define BCM281XX_PIN_MPHI_HAT1
#define BCM281XX_PIN_MPHI_HCE0_N
#define BCM281XX_PIN_MPHI_HCE1_N
#define BCM281XX_PIN_MPHI_HRD_N
#define BCM281XX_PIN_MPHI_HWR_N
#define BCM281XX_PIN_MPHI_RUN0
#define BCM281XX_PIN_MPHI_RUN1
#define BCM281XX_PIN_MTX_SCAN_CLK
#define BCM281XX_PIN_MTX_SCAN_DATA
#define BCM281XX_PIN_NAND_AD_0
#define BCM281XX_PIN_NAND_AD_1
#define BCM281XX_PIN_NAND_AD_2
#define BCM281XX_PIN_NAND_AD_3
#define BCM281XX_PIN_NAND_AD_4
#define BCM281XX_PIN_NAND_AD_5
#define BCM281XX_PIN_NAND_AD_6
#define BCM281XX_PIN_NAND_AD_7
#define BCM281XX_PIN_NAND_ALE
#define BCM281XX_PIN_NAND_CEN_0
#define BCM281XX_PIN_NAND_CEN_1
#define BCM281XX_PIN_NAND_CLE
#define BCM281XX_PIN_NAND_OEN
#define BCM281XX_PIN_NAND_RDY_0
#define BCM281XX_PIN_NAND_RDY_1
#define BCM281XX_PIN_NAND_WEN
#define BCM281XX_PIN_NAND_WP
#define BCM281XX_PIN_PC1
#define BCM281XX_PIN_PC2
#define BCM281XX_PIN_PMU_INT
#define BCM281XX_PIN_PMU_SCL
#define BCM281XX_PIN_PMU_SDA
#define BCM281XX_PIN_RFST2G_MTSLOTEN3G
#define BCM281XX_PIN_RGMII_0_RX_CTL
#define BCM281XX_PIN_RGMII_0_RXC
#define BCM281XX_PIN_RGMII_0_RXD_0
#define BCM281XX_PIN_RGMII_0_RXD_1
#define BCM281XX_PIN_RGMII_0_RXD_2
#define BCM281XX_PIN_RGMII_0_RXD_3
#define BCM281XX_PIN_RGMII_0_TX_CTL
#define BCM281XX_PIN_RGMII_0_TXC
#define BCM281XX_PIN_RGMII_0_TXD_0
#define BCM281XX_PIN_RGMII_0_TXD_1
#define BCM281XX_PIN_RGMII_0_TXD_2
#define BCM281XX_PIN_RGMII_0_TXD_3
#define BCM281XX_PIN_RGMII_1_RX_CTL
#define BCM281XX_PIN_RGMII_1_RXC
#define BCM281XX_PIN_RGMII_1_RXD_0
#define BCM281XX_PIN_RGMII_1_RXD_1
#define BCM281XX_PIN_RGMII_1_RXD_2
#define BCM281XX_PIN_RGMII_1_RXD_3
#define BCM281XX_PIN_RGMII_1_TX_CTL
#define BCM281XX_PIN_RGMII_1_TXC
#define BCM281XX_PIN_RGMII_1_TXD_0
#define BCM281XX_PIN_RGMII_1_TXD_1
#define BCM281XX_PIN_RGMII_1_TXD_2
#define BCM281XX_PIN_RGMII_1_TXD_3
#define BCM281XX_PIN_RGMII_GPIO_0
#define BCM281XX_PIN_RGMII_GPIO_1
#define BCM281XX_PIN_RGMII_GPIO_2
#define BCM281XX_PIN_RGMII_GPIO_3
#define BCM281XX_PIN_RTXDATA2G_TXDATA3G1
#define BCM281XX_PIN_RTXEN2G_TXDATA3G2
#define BCM281XX_PIN_RXDATA3G0
#define BCM281XX_PIN_RXDATA3G1
#define BCM281XX_PIN_RXDATA3G2
#define BCM281XX_PIN_SDIO1_CLK
#define BCM281XX_PIN_SDIO1_CMD
#define BCM281XX_PIN_SDIO1_DATA_0
#define BCM281XX_PIN_SDIO1_DATA_1
#define BCM281XX_PIN_SDIO1_DATA_2
#define BCM281XX_PIN_SDIO1_DATA_3
#define BCM281XX_PIN_SDIO4_CLK
#define BCM281XX_PIN_SDIO4_CMD
#define BCM281XX_PIN_SDIO4_DATA_0
#define BCM281XX_PIN_SDIO4_DATA_1
#define BCM281XX_PIN_SDIO4_DATA_2
#define BCM281XX_PIN_SDIO4_DATA_3
#define BCM281XX_PIN_SIM_CLK
#define BCM281XX_PIN_SIM_DATA
#define BCM281XX_PIN_SIM_DET
#define BCM281XX_PIN_SIM_RESETN
#define BCM281XX_PIN_SIM2_CLK
#define BCM281XX_PIN_SIM2_DATA
#define BCM281XX_PIN_SIM2_DET
#define BCM281XX_PIN_SIM2_RESETN
#define BCM281XX_PIN_SRI_C
#define BCM281XX_PIN_SRI_D
#define BCM281XX_PIN_SRI_E
#define BCM281XX_PIN_SSP_EXTCLK
#define BCM281XX_PIN_SSP0_CLK
#define BCM281XX_PIN_SSP0_FS
#define BCM281XX_PIN_SSP0_RXD
#define BCM281XX_PIN_SSP0_TXD
#define BCM281XX_PIN_SSP2_CLK
#define BCM281XX_PIN_SSP2_FS_0
#define BCM281XX_PIN_SSP2_FS_1
#define BCM281XX_PIN_SSP2_FS_2
#define BCM281XX_PIN_SSP2_FS_3
#define BCM281XX_PIN_SSP2_RXD_0
#define BCM281XX_PIN_SSP2_RXD_1
#define BCM281XX_PIN_SSP2_TXD_0
#define BCM281XX_PIN_SSP2_TXD_1
#define BCM281XX_PIN_SSP3_CLK
#define BCM281XX_PIN_SSP3_FS
#define BCM281XX_PIN_SSP3_RXD
#define BCM281XX_PIN_SSP3_TXD
#define BCM281XX_PIN_SSP4_CLK
#define BCM281XX_PIN_SSP4_FS
#define BCM281XX_PIN_SSP4_RXD
#define BCM281XX_PIN_SSP4_TXD
#define BCM281XX_PIN_SSP5_CLK
#define BCM281XX_PIN_SSP5_FS
#define BCM281XX_PIN_SSP5_RXD
#define BCM281XX_PIN_SSP5_TXD
#define BCM281XX_PIN_SSP6_CLK
#define BCM281XX_PIN_SSP6_FS
#define BCM281XX_PIN_SSP6_RXD
#define BCM281XX_PIN_SSP6_TXD
#define BCM281XX_PIN_STAT_1
#define BCM281XX_PIN_STAT_2
#define BCM281XX_PIN_SYSCLKEN
#define BCM281XX_PIN_TRACECLK
#define BCM281XX_PIN_TRACEDT00
#define BCM281XX_PIN_TRACEDT01
#define BCM281XX_PIN_TRACEDT02
#define BCM281XX_PIN_TRACEDT03
#define BCM281XX_PIN_TRACEDT04
#define BCM281XX_PIN_TRACEDT05
#define BCM281XX_PIN_TRACEDT06
#define BCM281XX_PIN_TRACEDT07
#define BCM281XX_PIN_TRACEDT08
#define BCM281XX_PIN_TRACEDT09
#define BCM281XX_PIN_TRACEDT10
#define BCM281XX_PIN_TRACEDT11
#define BCM281XX_PIN_TRACEDT12
#define BCM281XX_PIN_TRACEDT13
#define BCM281XX_PIN_TRACEDT14
#define BCM281XX_PIN_TRACEDT15
#define BCM281XX_PIN_TXDATA3G0
#define BCM281XX_PIN_TXPWRIND
#define BCM281XX_PIN_UARTB1_UCTS
#define BCM281XX_PIN_UARTB1_URTS
#define BCM281XX_PIN_UARTB1_URXD
#define BCM281XX_PIN_UARTB1_UTXD
#define BCM281XX_PIN_UARTB2_URXD
#define BCM281XX_PIN_UARTB2_UTXD
#define BCM281XX_PIN_UARTB3_UCTS
#define BCM281XX_PIN_UARTB3_URTS
#define BCM281XX_PIN_UARTB3_URXD
#define BCM281XX_PIN_UARTB3_UTXD
#define BCM281XX_PIN_UARTB4_UCTS
#define BCM281XX_PIN_UARTB4_URTS
#define BCM281XX_PIN_UARTB4_URXD
#define BCM281XX_PIN_UARTB4_UTXD
#define BCM281XX_PIN_VC_CAM1_SCL
#define BCM281XX_PIN_VC_CAM1_SDA
#define BCM281XX_PIN_VC_CAM2_SCL
#define BCM281XX_PIN_VC_CAM2_SDA
#define BCM281XX_PIN_VC_CAM3_SCL
#define BCM281XX_PIN_VC_CAM3_SDA

#define BCM281XX_PIN_DESC(a, b, c)

/*
 * Pin description definition.  The order here must be the same as defined in
 * the PADCTRLREG block in the RDB, since the pin number is used as an index
 * into this array.
 */
static const struct pinctrl_pin_desc bcm281xx_pinctrl_pins[] =;

static const char * const bcm281xx_alt_groups[] =;

/* Every pin can implement all ALT1-ALT4 functions */
#define BCM281XX_PIN_FUNCTION(fcn_name)

static const struct bcm281xx_pin_function bcm281xx_functions[] =;

static struct bcm281xx_pinctrl_data bcm281xx_pinctrl =;

static inline enum bcm281xx_pin_type pin_type_get(struct pinctrl_dev *pctldev,
						  unsigned pin)
{}

#define BCM281XX_PIN_SHIFT(type, param)

#define BCM281XX_PIN_MASK(type, param)

/*
 * This helper function is used to build up the value and mask used to write to
 * a pin register, but does not actually write to the register.
 */
static inline void bcm281xx_pin_update(u32 *reg_val, u32 *reg_mask,
				       u32 param_val, u32 param_shift,
				       u32 param_mask)
{}

static const struct regmap_config bcm281xx_pinctrl_regmap_config =;

static int bcm281xx_pinctrl_get_groups_count(struct pinctrl_dev *pctldev)
{}

static const char *bcm281xx_pinctrl_get_group_name(struct pinctrl_dev *pctldev,
						   unsigned group)
{}

static int bcm281xx_pinctrl_get_group_pins(struct pinctrl_dev *pctldev,
					   unsigned group,
					   const unsigned **pins,
					   unsigned *num_pins)
{}

static void bcm281xx_pinctrl_pin_dbg_show(struct pinctrl_dev *pctldev,
					  struct seq_file *s,
					  unsigned offset)
{}

static const struct pinctrl_ops bcm281xx_pinctrl_ops =;

static int bcm281xx_pinctrl_get_fcns_count(struct pinctrl_dev *pctldev)
{}

static const char *bcm281xx_pinctrl_get_fcn_name(struct pinctrl_dev *pctldev,
						 unsigned function)
{}

static int bcm281xx_pinctrl_get_fcn_groups(struct pinctrl_dev *pctldev,
					   unsigned function,
					   const char * const **groups,
					   unsigned * const num_groups)
{}

static int bcm281xx_pinmux_set(struct pinctrl_dev *pctldev,
			       unsigned function,
			       unsigned group)
{}

static const struct pinmux_ops bcm281xx_pinctrl_pinmux_ops =;

static int bcm281xx_pinctrl_pin_config_get(struct pinctrl_dev *pctldev,
					   unsigned pin,
					   unsigned long *config)
{}


/* Goes through the configs and update register val/mask */
static int bcm281xx_std_pin_update(struct pinctrl_dev *pctldev,
				   unsigned pin,
				   unsigned long *configs,
				   unsigned num_configs,
				   u32 *val,
				   u32 *mask)
{}

/*
 * The pull-up strength for an I2C pin is represented by bits 4-6 in the
 * register with the following mapping:
 *   0b000: No pull-up
 *   0b001: 1200 Ohm
 *   0b010: 1800 Ohm
 *   0b011: 720 Ohm
 *   0b100: 2700 Ohm
 *   0b101: 831 Ohm
 *   0b110: 1080 Ohm
 *   0b111: 568 Ohm
 * This array maps pull-up strength in Ohms to register values (1+index).
 */
static const u16 bcm281xx_pullup_map[] =;

/* Goes through the configs and update register val/mask */
static int bcm281xx_i2c_pin_update(struct pinctrl_dev *pctldev,
				   unsigned pin,
				   unsigned long *configs,
				   unsigned num_configs,
				   u32 *val,
				   u32 *mask)
{}

/* Goes through the configs and update register val/mask */
static int bcm281xx_hdmi_pin_update(struct pinctrl_dev *pctldev,
				    unsigned pin,
				    unsigned long *configs,
				    unsigned num_configs,
				    u32 *val,
				    u32 *mask)
{}

static int bcm281xx_pinctrl_pin_config_set(struct pinctrl_dev *pctldev,
					   unsigned pin,
					   unsigned long *configs,
					   unsigned num_configs)
{}

static const struct pinconf_ops bcm281xx_pinctrl_pinconf_ops =;

static struct pinctrl_desc bcm281xx_pinctrl_desc =;

static int __init bcm281xx_pinctrl_probe(struct platform_device *pdev)
{}

static const struct of_device_id bcm281xx_pinctrl_of_match[] =;

static struct platform_driver bcm281xx_pinctrl_driver =;
builtin_platform_driver_probe();