2019-05-29 22:17:58 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2013-12-06 10:10:03 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2013, Sony Mobile Communications AB.
|
|
|
|
*/
|
|
|
|
#ifndef __PINCTRL_MSM_H__
|
|
|
|
#define __PINCTRL_MSM_H__
|
|
|
|
|
2014-03-07 14:44:42 +08:00
|
|
|
struct pinctrl_pin_desc;
|
2013-12-06 10:10:03 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* struct msm_function - a pinmux function
|
|
|
|
* @name: Name of the pinmux function.
|
|
|
|
* @groups: List of pingroups for this function.
|
|
|
|
* @ngroups: Number of entries in @groups.
|
|
|
|
*/
|
|
|
|
struct msm_function {
|
|
|
|
const char *name;
|
|
|
|
const char * const *groups;
|
|
|
|
unsigned ngroups;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* struct msm_pingroup - Qualcomm pingroup definition
|
|
|
|
* @name: Name of the pingroup.
|
|
|
|
* @pins: A list of pins assigned to this pingroup.
|
|
|
|
* @npins: Number of entries in @pins.
|
|
|
|
* @funcs: A list of pinmux functions that can be selected for
|
|
|
|
* this group. The index of the selected function is used
|
|
|
|
* for programming the function selector.
|
|
|
|
* Entries should be indices into the groups list of the
|
|
|
|
* struct msm_pinctrl_soc_data.
|
|
|
|
* @ctl_reg: Offset of the register holding control bits for this group.
|
|
|
|
* @io_reg: Offset of the register holding input/output bits for this group.
|
|
|
|
* @intr_cfg_reg: Offset of the register holding interrupt configuration bits.
|
|
|
|
* @intr_status_reg: Offset of the register holding the status bits for this group.
|
|
|
|
* @intr_target_reg: Offset of the register specifying routing of the interrupts
|
|
|
|
* from this group.
|
|
|
|
* @mux_bit: Offset in @ctl_reg for the pinmux function selection.
|
|
|
|
* @pull_bit: Offset in @ctl_reg for the bias configuration.
|
|
|
|
* @drv_bit: Offset in @ctl_reg for the drive strength configuration.
|
2020-07-03 16:06:45 +08:00
|
|
|
* @od_bit: Offset in @ctl_reg for controlling open drain.
|
2013-12-06 10:10:03 +08:00
|
|
|
* @oe_bit: Offset in @ctl_reg for controlling output enable.
|
|
|
|
* @in_bit: Offset in @io_reg for the input bit value.
|
|
|
|
* @out_bit: Offset in @io_reg for the output bit value.
|
|
|
|
* @intr_enable_bit: Offset in @intr_cfg_reg for enabling the interrupt for this group.
|
|
|
|
* @intr_status_bit: Offset in @intr_status_reg for reading and acking the interrupt
|
|
|
|
* status.
|
|
|
|
* @intr_target_bit: Offset in @intr_target_reg for configuring the interrupt routing.
|
2014-09-04 00:28:16 +08:00
|
|
|
* @intr_target_kpss_val: Value in @intr_target_bit for specifying that the interrupt from
|
|
|
|
* this gpio should get routed to the KPSS processor.
|
2013-12-06 10:10:03 +08:00
|
|
|
* @intr_raw_status_bit: Offset in @intr_cfg_reg for the raw status bit.
|
|
|
|
* @intr_polarity_bit: Offset in @intr_cfg_reg for specifying polarity of the interrupt.
|
|
|
|
* @intr_detection_bit: Offset in @intr_cfg_reg for specifying interrupt type.
|
|
|
|
* @intr_detection_width: Number of bits used for specifying interrupt type,
|
|
|
|
* Should be 2 for SoCs that can detect both edges in hardware,
|
|
|
|
* otherwise 1.
|
|
|
|
*/
|
|
|
|
struct msm_pingroup {
|
|
|
|
const char *name;
|
|
|
|
const unsigned *pins;
|
|
|
|
unsigned npins;
|
|
|
|
|
2014-04-01 05:49:55 +08:00
|
|
|
unsigned *funcs;
|
|
|
|
unsigned nfuncs;
|
2013-12-06 10:10:03 +08:00
|
|
|
|
2015-01-30 18:03:59 +08:00
|
|
|
u32 ctl_reg;
|
|
|
|
u32 io_reg;
|
|
|
|
u32 intr_cfg_reg;
|
|
|
|
u32 intr_status_reg;
|
|
|
|
u32 intr_target_reg;
|
2013-12-06 10:10:03 +08:00
|
|
|
|
2018-09-25 06:17:46 +08:00
|
|
|
unsigned int tile:2;
|
|
|
|
|
2013-12-06 10:10:03 +08:00
|
|
|
unsigned mux_bit:5;
|
|
|
|
|
|
|
|
unsigned pull_bit:5;
|
|
|
|
unsigned drv_bit:5;
|
|
|
|
|
2020-07-03 16:06:45 +08:00
|
|
|
unsigned od_bit:5;
|
2013-12-06 10:10:03 +08:00
|
|
|
unsigned oe_bit:5;
|
|
|
|
unsigned in_bit:5;
|
|
|
|
unsigned out_bit:5;
|
|
|
|
|
|
|
|
unsigned intr_enable_bit:5;
|
|
|
|
unsigned intr_status_bit:5;
|
2014-04-01 05:49:54 +08:00
|
|
|
unsigned intr_ack_high:1;
|
2013-12-06 10:10:03 +08:00
|
|
|
|
|
|
|
unsigned intr_target_bit:5;
|
2014-09-04 00:28:16 +08:00
|
|
|
unsigned intr_target_kpss_val:5;
|
2013-12-06 10:10:03 +08:00
|
|
|
unsigned intr_raw_status_bit:5;
|
|
|
|
unsigned intr_polarity_bit:5;
|
|
|
|
unsigned intr_detection_bit:5;
|
|
|
|
unsigned intr_detection_width:5;
|
|
|
|
};
|
|
|
|
|
2019-11-16 06:11:51 +08:00
|
|
|
/**
|
|
|
|
* struct msm_gpio_wakeirq_map - Map of GPIOs and their wakeup pins
|
|
|
|
* @gpio: The GPIOs that are wakeup capable
|
|
|
|
* @wakeirq: The interrupt at the always-on interrupt controller
|
|
|
|
*/
|
|
|
|
struct msm_gpio_wakeirq_map {
|
|
|
|
unsigned int gpio;
|
|
|
|
unsigned int wakeirq;
|
|
|
|
};
|
|
|
|
|
2013-12-06 10:10:03 +08:00
|
|
|
/**
|
|
|
|
* struct msm_pinctrl_soc_data - Qualcomm pin controller driver configuration
|
2017-07-14 22:14:11 +08:00
|
|
|
* @pins: An array describing all pins the pin controller affects.
|
|
|
|
* @npins: The number of entries in @pins.
|
|
|
|
* @functions: An array describing all mux functions the SoC supports.
|
|
|
|
* @nfunctions: The number of entries in @functions.
|
|
|
|
* @groups: An array describing all pin groups the pin SoC supports.
|
|
|
|
* @ngroups: The numbmer of entries in @groups.
|
|
|
|
* @ngpio: The number of pingroups the driver should expose as GPIOs.
|
|
|
|
* @pull_no_keeper: The SoC does not support keeper bias.
|
2019-11-16 06:11:51 +08:00
|
|
|
* @wakeirq_map: The map of wakeup capable GPIOs and the pin at PDC/MPM
|
|
|
|
* @nwakeirq_map: The number of entries in @wakeirq_map
|
2020-07-14 23:04:17 +08:00
|
|
|
* @wakeirq_dual_edge_errata: If true then GPIOs using the wakeirq_map need
|
|
|
|
* to be aware that their parent can't handle dual
|
|
|
|
* edge interrupts.
|
2013-12-06 10:10:03 +08:00
|
|
|
*/
|
|
|
|
struct msm_pinctrl_soc_data {
|
|
|
|
const struct pinctrl_pin_desc *pins;
|
|
|
|
unsigned npins;
|
|
|
|
const struct msm_function *functions;
|
|
|
|
unsigned nfunctions;
|
|
|
|
const struct msm_pingroup *groups;
|
|
|
|
unsigned ngroups;
|
|
|
|
unsigned ngpios;
|
2017-07-14 22:14:11 +08:00
|
|
|
bool pull_no_keeper;
|
2018-10-03 05:15:44 +08:00
|
|
|
const char *const *tiles;
|
2018-09-25 06:17:46 +08:00
|
|
|
unsigned int ntiles;
|
2019-06-10 16:42:08 +08:00
|
|
|
const int *reserved_gpios;
|
2019-11-16 06:11:51 +08:00
|
|
|
const struct msm_gpio_wakeirq_map *wakeirq_map;
|
|
|
|
unsigned int nwakeirq_map;
|
2020-07-14 23:04:17 +08:00
|
|
|
bool wakeirq_dual_edge_errata;
|
2013-12-06 10:10:03 +08:00
|
|
|
};
|
|
|
|
|
2018-11-17 02:58:53 +08:00
|
|
|
extern const struct dev_pm_ops msm_pinctrl_dev_pm_ops;
|
|
|
|
|
2013-12-06 10:10:03 +08:00
|
|
|
int msm_pinctrl_probe(struct platform_device *pdev,
|
|
|
|
const struct msm_pinctrl_soc_data *soc_data);
|
|
|
|
int msm_pinctrl_remove(struct platform_device *pdev);
|
|
|
|
|
|
|
|
#endif
|