mirror of
https://github.com/torvalds/linux.git
synced 2026-05-24 15:12:13 +02:00
pinctrl: renesas: Updates for v6.19
- Fix interrupt configuration and port mode after resume on RZ/G2L
family SoCs,
- Miscellaneous fixes and improvements.
-----BEGIN PGP SIGNATURE-----
iHUEABYKAB0WIQQ9qaHoIs/1I4cXmEiKwlD9ZEnxcAUCaQSPaAAKCRCKwlD9ZEnx
cDygAP0XM8cNnD8V0BEaOs599HaRe1GtrjLu6ozdGrcOh0dFEAD+OFCPySbvWwSd
aSQXyH1DkUm/lF6OB2ao+r41ItLvPgk=
=WQj/
-----END PGP SIGNATURE-----
Merge tag 'renesas-pinctrl-for-v6.19-tag1' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers into devel
pinctrl: renesas: Updates for v6.19
- Fix interrupt configuration and port mode after resume on RZ/G2L
family SoCs,
- Miscellaneous fixes and improvements.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
commit
4f91d2b094
|
|
@ -666,7 +666,6 @@ static const u16 pinmux_data[] = {
|
|||
PINMUX_IPSR_NOFN(UART_1_0_PORT158, UART2_TX, SEL_UART_1_0_01),
|
||||
};
|
||||
|
||||
|
||||
#define EMEV_MUX_PIN(name, pin, mark) \
|
||||
static const unsigned int name##_pins[] = { pin }; \
|
||||
static const unsigned int name##_mux[] = { mark##_MARK }
|
||||
|
|
|
|||
|
|
@ -85,7 +85,6 @@
|
|||
/* Port320 - Port329 */ \
|
||||
PORT_10(320, fn, pfx##32, sfx)
|
||||
|
||||
|
||||
enum {
|
||||
PINMUX_RESERVED = 0,
|
||||
|
||||
|
|
@ -227,7 +226,6 @@ enum {
|
|||
|
||||
PINMUX_MARK_BEGIN,
|
||||
|
||||
|
||||
#define F1(a) a##_MARK
|
||||
#define F2(a) a##_MARK
|
||||
#define F3(a) a##_MARK
|
||||
|
|
|
|||
|
|
@ -1994,7 +1994,6 @@ static const char * const scif5_groups[] = {
|
|||
"scif5_data_b",
|
||||
};
|
||||
|
||||
|
||||
static const char * const sdhi0_groups[] = {
|
||||
"sdhi0_cd",
|
||||
"sdhi0_ctrl",
|
||||
|
|
|
|||
|
|
@ -249,7 +249,6 @@
|
|||
#define GPSR7_1 FM(AVS2)
|
||||
#define GPSR7_0 FM(AVS1)
|
||||
|
||||
|
||||
/* IPSRx */ /* 0 */ /* 1 */ /* 2 */ /* 3 */ /* 4 */ /* 5 */ /* 6 */ /* 7 */ /* 8 */ /* 9 */ /* A */ /* B */ /* C - F */
|
||||
#define IP0_3_0 FM(AVB_MDC) F_(0, 0) FM(MSIOF2_SS2_C) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
|
||||
#define IP0_7_4 FM(AVB_MAGIC) F_(0, 0) FM(MSIOF2_SS1_C) FM(SCK4_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
|
||||
|
|
|
|||
|
|
@ -254,7 +254,6 @@
|
|||
#define GPSR7_1 FM(AVS2)
|
||||
#define GPSR7_0 FM(AVS1)
|
||||
|
||||
|
||||
/* IPSRx */ /* 0 */ /* 1 */ /* 2 */ /* 3 */ /* 4 */ /* 5 */ /* 6 */ /* 7 */ /* 8 */ /* 9 */ /* A */ /* B */ /* C - F */
|
||||
#define IP0_3_0 FM(AVB_MDC) F_(0, 0) FM(MSIOF2_SS2_C) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
|
||||
#define IP0_7_4 FM(AVB_MAGIC) F_(0, 0) FM(MSIOF2_SS1_C) FM(SCK4_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
|
||||
|
|
|
|||
|
|
@ -254,7 +254,6 @@
|
|||
#define GPSR7_1 FM(AVS2)
|
||||
#define GPSR7_0 FM(AVS1)
|
||||
|
||||
|
||||
/* IPSRx */ /* 0 */ /* 1 */ /* 2 */ /* 3 */ /* 4 */ /* 5 */ /* 6 */ /* 7 */ /* 8 */ /* 9 */ /* A */ /* B */ /* C - F */
|
||||
#define IP0_3_0 FM(AVB_MDC) F_(0, 0) FM(MSIOF2_SS2_C) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
|
||||
#define IP0_7_4 FM(AVB_MAGIC) F_(0, 0) FM(MSIOF2_SS1_C) FM(SCK4_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
|
||||
|
|
|
|||
|
|
@ -159,7 +159,6 @@
|
|||
#define GPSR5_1 FM(QSPI0_MOSI_IO0)
|
||||
#define GPSR5_0 FM(QSPI0_SPCLK)
|
||||
|
||||
|
||||
/* IPSRx */ /* 0 */ /* 1 */ /* 2 */ /* 3 */ /* 4 */ /* 5 */ /* 6 - F */
|
||||
#define IP0_3_0 FM(DU_DR2) FM(HSCK0) F_(0, 0) FM(A0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
|
||||
#define IP0_7_4 FM(DU_DR3) FM(HRTS0_N) F_(0, 0) FM(A1) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
|
||||
|
|
|
|||
|
|
@ -193,7 +193,6 @@
|
|||
#define GPSR5_1 FM(QSPI0_MOSI_IO0)
|
||||
#define GPSR5_0 FM(QSPI0_SPCLK)
|
||||
|
||||
|
||||
/* IPSRx */ /* 0 */ /* 1 */ /* 2 */ /* 3 */ /* 4 */ /* 5 */ /* 6 - F */
|
||||
#define IP0_3_0 FM(DU_DR2) FM(SCK4) FM(GETHER_RMII_CRS_DV) FM(A0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
|
||||
#define IP0_7_4 FM(DU_DR3) FM(RX4) FM(GETHER_RMII_RX_ER) FM(A1) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
|
||||
|
|
|
|||
|
|
@ -427,7 +427,6 @@ FM(IP12_31_28) IP12_31_28 \
|
|||
#define MOD_SEL1_27 FM(SEL_SCIF0_0) FM(SEL_SCIF0_1)
|
||||
#define MOD_SEL1_26 FM(SEL_SSIF4_0) FM(SEL_SSIF4_1)
|
||||
|
||||
|
||||
#define PINMUX_MOD_SELS \
|
||||
\
|
||||
MOD_SEL1_31 \
|
||||
|
|
@ -2869,7 +2868,6 @@ static const struct pinmux_ioctrl_reg pinmux_ioctrl_regs[] = {
|
|||
{ /* sentinel */ }
|
||||
};
|
||||
|
||||
|
||||
static int r8a77995_pin_to_pocctrl(unsigned int pin, u32 *pocctrl)
|
||||
{
|
||||
switch (pin) {
|
||||
|
|
|
|||
|
|
@ -652,7 +652,6 @@ static const unsigned int i2c5_mux[] = {
|
|||
SDA5_MARK, SCL5_MARK,
|
||||
};
|
||||
|
||||
|
||||
/* - INTC-EX ---------------------------------------------------------------- */
|
||||
static const unsigned int intc_ex_irq0_pins[] = {
|
||||
/* IRQ0 */
|
||||
|
|
|
|||
|
|
@ -259,7 +259,6 @@
|
|||
#define GPSR7_1 F_(AVB0_AVTP_CAPTURE, IP0SR7_7_4)
|
||||
#define GPSR7_0 F_(AVB0_AVTP_PPS, IP0SR7_3_0)
|
||||
|
||||
|
||||
/* SR0 */
|
||||
/* IP0SR0 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */
|
||||
#define IP0SR0_3_0 F_(0, 0) FM(ERROROUTC_N_B) FM(TCLK2_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
|
||||
|
|
|
|||
|
|
@ -182,7 +182,6 @@ enum {
|
|||
PTZ7_FN, PTZ6_FN, PTZ5_FN, PTZ4_FN,
|
||||
PTZ3_FN, PTZ2_FN, PTZ1_FN, PTZ0_FN,
|
||||
|
||||
|
||||
PSA15_PSA14_FN1, PSA15_PSA14_FN2,
|
||||
PSA13_PSA12_FN1, PSA13_PSA12_FN2,
|
||||
PSA11_PSA10_FN1, PSA11_PSA10_FN2,
|
||||
|
|
|
|||
|
|
@ -210,7 +210,6 @@ enum {
|
|||
PTZ7_FN, PTZ6_FN, PTZ5_FN, PTZ4_FN,
|
||||
PTZ3_FN, PTZ2_FN, PTZ1_FN, PTZ0_FN,
|
||||
|
||||
|
||||
PSA15_0, PSA15_1,
|
||||
PSA14_0, PSA14_1,
|
||||
PSA13_0, PSA13_1,
|
||||
|
|
|
|||
|
|
@ -664,7 +664,6 @@ static const u16 pinmux_data[] = {
|
|||
PINMUX_IPSR_MSEL(IP0_31_30, LCD_DATA15_A, SEL_LCDC_0),
|
||||
PINMUX_IPSR_MSEL(IP0_31_30, TIOC3D_C, SEL_MTU2_CH3_1),
|
||||
|
||||
|
||||
/* IPSR1 */
|
||||
PINMUX_IPSR_GPSR(IP1_1_0, A16),
|
||||
PINMUX_IPSR_GPSR(IP1_1_0, ST0_PWM),
|
||||
|
|
|
|||
|
|
@ -526,7 +526,6 @@ static inline int rza1_pinmux_get_swio(unsigned int port,
|
|||
const struct rza1_swio_pin *swio_pin;
|
||||
unsigned int i;
|
||||
|
||||
|
||||
for (i = 0; i < table->npins; ++i) {
|
||||
swio_pin = &table->pins[i];
|
||||
if (swio_pin->port == port && swio_pin->pin == pin &&
|
||||
|
|
@ -669,7 +668,7 @@ static inline int rza1_pin_get(struct rza1_port *port, unsigned int pin)
|
|||
* @mux_conf: pin multiplexing descriptor
|
||||
*/
|
||||
static int rza1_pin_mux_single(struct rza1_pinctrl *rza1_pctl,
|
||||
struct rza1_mux_conf *mux_conf)
|
||||
const struct rza1_mux_conf *mux_conf)
|
||||
{
|
||||
struct rza1_port *port = &rza1_pctl->ports[mux_conf->port];
|
||||
unsigned int pin = mux_conf->pin;
|
||||
|
|
@ -1119,7 +1118,7 @@ static int rza1_set_mux(struct pinctrl_dev *pctldev, unsigned int selector,
|
|||
unsigned int group)
|
||||
{
|
||||
struct rza1_pinctrl *rza1_pctl = pinctrl_dev_get_drvdata(pctldev);
|
||||
struct rza1_mux_conf *mux_confs;
|
||||
const struct rza1_mux_conf *mux_confs;
|
||||
const struct function_desc *func;
|
||||
struct group_desc *grp;
|
||||
int i;
|
||||
|
|
@ -1132,7 +1131,7 @@ static int rza1_set_mux(struct pinctrl_dev *pctldev, unsigned int selector,
|
|||
if (!func)
|
||||
return -EINVAL;
|
||||
|
||||
mux_confs = (struct rza1_mux_conf *)func->data;
|
||||
mux_confs = (const struct rza1_mux_conf *)func->data;
|
||||
for (i = 0; i < grp->grp.npins; ++i) {
|
||||
int ret;
|
||||
|
||||
|
|
|
|||
|
|
@ -359,7 +359,7 @@ struct rzg2l_pinctrl {
|
|||
spinlock_t bitmap_lock; /* protect tint_slot bitmap */
|
||||
unsigned int hwirq[RZG2L_TINT_MAX_INTERRUPT];
|
||||
|
||||
spinlock_t lock; /* lock read/write registers */
|
||||
raw_spinlock_t lock; /* lock read/write registers */
|
||||
struct mutex mutex; /* serialize adding groups and functions */
|
||||
|
||||
struct rzg2l_pinctrl_pin_settings *settings;
|
||||
|
|
@ -541,9 +541,16 @@ static void rzg2l_pinctrl_set_pfc_mode(struct rzg2l_pinctrl *pctrl,
|
|||
u8 pin, u8 off, u8 func)
|
||||
{
|
||||
unsigned long flags;
|
||||
u32 reg;
|
||||
u32 reg, pfc;
|
||||
|
||||
spin_lock_irqsave(&pctrl->lock, flags);
|
||||
/* Switching to GPIO is not required if reset value is same as func */
|
||||
raw_spin_lock_irqsave(&pctrl->lock, flags);
|
||||
reg = readb(pctrl->base + PMC(off));
|
||||
pfc = readl(pctrl->base + PFC(off));
|
||||
if ((reg & BIT(pin)) && (((pfc >> (pin * 4)) & PFC_MASK) == func)) {
|
||||
raw_spin_unlock_irqrestore(&pctrl->lock, flags);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Set pin to 'Non-use (Hi-Z input protection)' */
|
||||
reg = readw(pctrl->base + PM(off));
|
||||
|
|
@ -557,9 +564,8 @@ static void rzg2l_pinctrl_set_pfc_mode(struct rzg2l_pinctrl *pctrl,
|
|||
writeb(reg & ~BIT(pin), pctrl->base + PMC(off));
|
||||
|
||||
/* Select Pin function mode with PFC register */
|
||||
reg = readl(pctrl->base + PFC(off));
|
||||
reg &= ~(PFC_MASK << (pin * 4));
|
||||
writel(reg | (func << (pin * 4)), pctrl->base + PFC(off));
|
||||
pfc &= ~(PFC_MASK << (pin * 4));
|
||||
writel(pfc | (func << (pin * 4)), pctrl->base + PFC(off));
|
||||
|
||||
/* Switch to Peripheral pin function with PMC register */
|
||||
reg = readb(pctrl->base + PMC(off));
|
||||
|
|
@ -567,8 +573,8 @@ static void rzg2l_pinctrl_set_pfc_mode(struct rzg2l_pinctrl *pctrl,
|
|||
|
||||
pctrl->data->pwpr_pfc_lock_unlock(pctrl, true);
|
||||
|
||||
spin_unlock_irqrestore(&pctrl->lock, flags);
|
||||
};
|
||||
raw_spin_unlock_irqrestore(&pctrl->lock, flags);
|
||||
}
|
||||
|
||||
static int rzg2l_pinctrl_set_mux(struct pinctrl_dev *pctldev,
|
||||
unsigned int func_selector,
|
||||
|
|
@ -608,7 +614,7 @@ static int rzg2l_pinctrl_set_mux(struct pinctrl_dev *pctldev,
|
|||
}
|
||||
|
||||
return 0;
|
||||
};
|
||||
}
|
||||
|
||||
static int rzg2l_map_add_config(struct pinctrl_map *map,
|
||||
const char *group_or_pin,
|
||||
|
|
@ -882,10 +888,10 @@ static void rzg2l_rmw_pin_config(struct rzg2l_pinctrl *pctrl, u32 offset,
|
|||
addr += 4;
|
||||
}
|
||||
|
||||
spin_lock_irqsave(&pctrl->lock, flags);
|
||||
raw_spin_lock_irqsave(&pctrl->lock, flags);
|
||||
reg = readl(addr) & ~(mask << (bit * 8));
|
||||
writel(reg | (val << (bit * 8)), addr);
|
||||
spin_unlock_irqrestore(&pctrl->lock, flags);
|
||||
raw_spin_unlock_irqrestore(&pctrl->lock, flags);
|
||||
}
|
||||
|
||||
static int rzg2l_caps_to_pwr_reg(const struct rzg2l_register_offsets *regs, u32 caps)
|
||||
|
|
@ -1121,7 +1127,7 @@ static int rzg2l_write_oen(struct rzg2l_pinctrl *pctrl, unsigned int _pin, u8 oe
|
|||
if (bit < 0)
|
||||
return -EINVAL;
|
||||
|
||||
spin_lock_irqsave(&pctrl->lock, flags);
|
||||
raw_spin_lock_irqsave(&pctrl->lock, flags);
|
||||
val = readb(pctrl->base + oen_offset);
|
||||
if (oen)
|
||||
val &= ~BIT(bit);
|
||||
|
|
@ -1134,7 +1140,7 @@ static int rzg2l_write_oen(struct rzg2l_pinctrl *pctrl, unsigned int _pin, u8 oe
|
|||
writeb(val, pctrl->base + oen_offset);
|
||||
if (pctrl->data->hwcfg->oen_pwpr_lock)
|
||||
writeb(pwpr & ~PWPR_REGWE_B, pctrl->base + regs->pwpr);
|
||||
spin_unlock_irqrestore(&pctrl->lock, flags);
|
||||
raw_spin_unlock_irqrestore(&pctrl->lock, flags);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1413,7 +1419,7 @@ static int rzg2l_pinctrl_pinconf_get(struct pinctrl_dev *pctldev,
|
|||
*config = pinconf_to_config_packed(param, arg);
|
||||
|
||||
return 0;
|
||||
};
|
||||
}
|
||||
|
||||
static int rzg2l_pinctrl_pinconf_set(struct pinctrl_dev *pctldev,
|
||||
unsigned int _pin,
|
||||
|
|
@ -1613,7 +1619,7 @@ static int rzg2l_pinctrl_pinconf_group_set(struct pinctrl_dev *pctldev,
|
|||
}
|
||||
|
||||
return 0;
|
||||
};
|
||||
}
|
||||
|
||||
static int rzg2l_pinctrl_pinconf_group_get(struct pinctrl_dev *pctldev,
|
||||
unsigned int group,
|
||||
|
|
@ -1640,7 +1646,7 @@ static int rzg2l_pinctrl_pinconf_group_get(struct pinctrl_dev *pctldev,
|
|||
}
|
||||
|
||||
return 0;
|
||||
};
|
||||
}
|
||||
|
||||
static const struct pinctrl_ops rzg2l_pinctrl_pctlops = {
|
||||
.get_groups_count = pinctrl_generic_get_group_count,
|
||||
|
|
@ -1687,14 +1693,14 @@ static int rzg2l_gpio_request(struct gpio_chip *chip, unsigned int offset)
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
spin_lock_irqsave(&pctrl->lock, flags);
|
||||
raw_spin_lock_irqsave(&pctrl->lock, flags);
|
||||
|
||||
/* Select GPIO mode in PMC Register */
|
||||
reg8 = readb(pctrl->base + PMC(off));
|
||||
reg8 &= ~BIT(bit);
|
||||
pctrl->data->pmc_writeb(pctrl, reg8, PMC(off));
|
||||
|
||||
spin_unlock_irqrestore(&pctrl->lock, flags);
|
||||
raw_spin_unlock_irqrestore(&pctrl->lock, flags);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1709,7 +1715,7 @@ static void rzg2l_gpio_set_direction(struct rzg2l_pinctrl *pctrl, u32 offset,
|
|||
unsigned long flags;
|
||||
u16 reg16;
|
||||
|
||||
spin_lock_irqsave(&pctrl->lock, flags);
|
||||
raw_spin_lock_irqsave(&pctrl->lock, flags);
|
||||
|
||||
reg16 = readw(pctrl->base + PM(off));
|
||||
reg16 &= ~(PM_MASK << (bit * 2));
|
||||
|
|
@ -1717,7 +1723,7 @@ static void rzg2l_gpio_set_direction(struct rzg2l_pinctrl *pctrl, u32 offset,
|
|||
reg16 |= (output ? PM_OUTPUT : PM_INPUT) << (bit * 2);
|
||||
writew(reg16, pctrl->base + PM(off));
|
||||
|
||||
spin_unlock_irqrestore(&pctrl->lock, flags);
|
||||
raw_spin_unlock_irqrestore(&pctrl->lock, flags);
|
||||
}
|
||||
|
||||
static int rzg2l_gpio_get_direction(struct gpio_chip *chip, unsigned int offset)
|
||||
|
|
@ -1761,7 +1767,7 @@ static int rzg2l_gpio_set(struct gpio_chip *chip, unsigned int offset,
|
|||
unsigned long flags;
|
||||
u8 reg8;
|
||||
|
||||
spin_lock_irqsave(&pctrl->lock, flags);
|
||||
raw_spin_lock_irqsave(&pctrl->lock, flags);
|
||||
|
||||
reg8 = readb(pctrl->base + P(off));
|
||||
|
||||
|
|
@ -1770,7 +1776,7 @@ static int rzg2l_gpio_set(struct gpio_chip *chip, unsigned int offset,
|
|||
else
|
||||
writeb(reg8 & ~BIT(bit), pctrl->base + P(off));
|
||||
|
||||
spin_unlock_irqrestore(&pctrl->lock, flags);
|
||||
raw_spin_unlock_irqrestore(&pctrl->lock, flags);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -2429,14 +2435,13 @@ static int rzg2l_gpio_get_gpioint(unsigned int virq, struct rzg2l_pinctrl *pctrl
|
|||
return gpioint;
|
||||
}
|
||||
|
||||
static void rzg2l_gpio_irq_endisable(struct rzg2l_pinctrl *pctrl,
|
||||
unsigned int hwirq, bool enable)
|
||||
static void __rzg2l_gpio_irq_endisable(struct rzg2l_pinctrl *pctrl,
|
||||
unsigned int hwirq, bool enable)
|
||||
{
|
||||
const struct pinctrl_pin_desc *pin_desc = &pctrl->desc.pins[hwirq];
|
||||
u64 *pin_data = pin_desc->drv_data;
|
||||
u32 off = RZG2L_PIN_CFG_TO_PORT_OFFSET(*pin_data);
|
||||
u8 bit = RZG2L_PIN_ID_TO_PIN(hwirq);
|
||||
unsigned long flags;
|
||||
void __iomem *addr;
|
||||
|
||||
addr = pctrl->base + ISEL(off);
|
||||
|
|
@ -2445,12 +2450,20 @@ static void rzg2l_gpio_irq_endisable(struct rzg2l_pinctrl *pctrl,
|
|||
addr += 4;
|
||||
}
|
||||
|
||||
spin_lock_irqsave(&pctrl->lock, flags);
|
||||
if (enable)
|
||||
writel(readl(addr) | BIT(bit * 8), addr);
|
||||
else
|
||||
writel(readl(addr) & ~BIT(bit * 8), addr);
|
||||
spin_unlock_irqrestore(&pctrl->lock, flags);
|
||||
}
|
||||
|
||||
static void rzg2l_gpio_irq_endisable(struct rzg2l_pinctrl *pctrl,
|
||||
unsigned int hwirq, bool enable)
|
||||
{
|
||||
unsigned long flags;
|
||||
|
||||
raw_spin_lock_irqsave(&pctrl->lock, flags);
|
||||
__rzg2l_gpio_irq_endisable(pctrl, hwirq, enable);
|
||||
raw_spin_unlock_irqrestore(&pctrl->lock, flags);
|
||||
}
|
||||
|
||||
static void rzg2l_gpio_irq_disable(struct irq_data *d)
|
||||
|
|
@ -2462,23 +2475,23 @@ static void rzg2l_gpio_irq_disable(struct irq_data *d)
|
|||
gpiochip_disable_irq(gc, hwirq);
|
||||
}
|
||||
|
||||
static void rzg2l_gpio_irq_enable(struct irq_data *d)
|
||||
static void __rzg2l_gpio_irq_enable(struct irq_data *d, bool lock)
|
||||
{
|
||||
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
|
||||
struct rzg2l_pinctrl *pctrl = container_of(gc, struct rzg2l_pinctrl, gpio_chip);
|
||||
unsigned int hwirq = irqd_to_hwirq(d);
|
||||
|
||||
gpiochip_enable_irq(gc, hwirq);
|
||||
if (lock)
|
||||
rzg2l_gpio_irq_endisable(pctrl, hwirq, true);
|
||||
else
|
||||
__rzg2l_gpio_irq_endisable(pctrl, hwirq, true);
|
||||
irq_chip_enable_parent(d);
|
||||
}
|
||||
|
||||
static int rzg2l_gpio_irq_set_type(struct irq_data *d, unsigned int type)
|
||||
static void rzg2l_gpio_irq_enable(struct irq_data *d)
|
||||
{
|
||||
return irq_chip_set_type_parent(d, type);
|
||||
}
|
||||
|
||||
static void rzg2l_gpio_irqc_eoi(struct irq_data *d)
|
||||
{
|
||||
irq_chip_eoi_parent(d);
|
||||
__rzg2l_gpio_irq_enable(d, true);
|
||||
}
|
||||
|
||||
static void rzg2l_gpio_irq_print_chip(struct irq_data *data, struct seq_file *p)
|
||||
|
|
@ -2516,8 +2529,8 @@ static const struct irq_chip rzg2l_gpio_irqchip = {
|
|||
.irq_enable = rzg2l_gpio_irq_enable,
|
||||
.irq_mask = irq_chip_mask_parent,
|
||||
.irq_unmask = irq_chip_unmask_parent,
|
||||
.irq_set_type = rzg2l_gpio_irq_set_type,
|
||||
.irq_eoi = rzg2l_gpio_irqc_eoi,
|
||||
.irq_set_type = irq_chip_set_type_parent,
|
||||
.irq_eoi = irq_chip_eoi_parent,
|
||||
.irq_print_chip = rzg2l_gpio_irq_print_chip,
|
||||
.irq_set_affinity = irq_chip_set_affinity_parent,
|
||||
.irq_set_wake = rzg2l_gpio_irq_set_wake,
|
||||
|
|
@ -2616,11 +2629,11 @@ static void rzg2l_gpio_irq_restore(struct rzg2l_pinctrl *pctrl)
|
|||
* This has to be atomically executed to protect against a concurrent
|
||||
* interrupt.
|
||||
*/
|
||||
spin_lock_irqsave(&pctrl->lock, flags);
|
||||
ret = rzg2l_gpio_irq_set_type(data, irqd_get_trigger_type(data));
|
||||
raw_spin_lock_irqsave(&pctrl->lock, flags);
|
||||
ret = irq_chip_set_type_parent(data, irqd_get_trigger_type(data));
|
||||
if (!ret && !irqd_irq_disabled(data))
|
||||
rzg2l_gpio_irq_enable(data);
|
||||
spin_unlock_irqrestore(&pctrl->lock, flags);
|
||||
__rzg2l_gpio_irq_enable(data, false);
|
||||
raw_spin_unlock_irqrestore(&pctrl->lock, flags);
|
||||
|
||||
if (ret)
|
||||
dev_crit(pctrl->dev, "Failed to set IRQ type for virq=%u\n", virq);
|
||||
|
|
@ -2950,7 +2963,7 @@ static int rzg2l_pinctrl_probe(struct platform_device *pdev)
|
|||
"failed to enable GPIO clk\n");
|
||||
}
|
||||
|
||||
spin_lock_init(&pctrl->lock);
|
||||
raw_spin_lock_init(&pctrl->lock);
|
||||
spin_lock_init(&pctrl->bitmap_lock);
|
||||
mutex_init(&pctrl->mutex);
|
||||
atomic_set(&pctrl->wakeup_path, 0);
|
||||
|
|
@ -2993,7 +3006,11 @@ static void rzg2l_pinctrl_pm_setup_regs(struct rzg2l_pinctrl *pctrl, bool suspen
|
|||
* Now cache the registers or set them in the order suggested by
|
||||
* HW manual (section "Operation for GPIO Function").
|
||||
*/
|
||||
RZG2L_PCTRL_REG_ACCESS8(suspend, pctrl->base + PMC(off), cache->pmc[port]);
|
||||
if (suspend)
|
||||
RZG2L_PCTRL_REG_ACCESS8(suspend, pctrl->base + PMC(off), cache->pmc[port]);
|
||||
else
|
||||
pctrl->data->pmc_writeb(pctrl, cache->pmc[port], PMC(off));
|
||||
|
||||
if (has_iolh) {
|
||||
RZG2L_PCTRL_REG_ACCESS32(suspend, pctrl->base + IOLH(off),
|
||||
cache->iolh[0][port]);
|
||||
|
|
@ -3093,7 +3110,7 @@ static void rzg2l_pinctrl_pm_setup_pfc(struct rzg2l_pinctrl *pctrl)
|
|||
u32 nports = pctrl->data->n_port_pins / RZG2L_PINS_PER_PORT;
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&pctrl->lock, flags);
|
||||
raw_spin_lock_irqsave(&pctrl->lock, flags);
|
||||
pctrl->data->pwpr_pfc_lock_unlock(pctrl, false);
|
||||
|
||||
/* Restore port registers. */
|
||||
|
|
@ -3113,11 +3130,18 @@ static void rzg2l_pinctrl_pm_setup_pfc(struct rzg2l_pinctrl *pctrl)
|
|||
pm = readw(pctrl->base + PM(off));
|
||||
for_each_set_bit(pin, &pinmap, max_pin) {
|
||||
struct rzg2l_pinctrl_reg_cache *cache = pctrl->cache;
|
||||
u32 pfc_val, pfc_mask;
|
||||
|
||||
/* Nothing to do if PFC was not configured before. */
|
||||
if (!(cache->pmc[port] & BIT(pin)))
|
||||
continue;
|
||||
|
||||
pfc_val = readl(pctrl->base + PFC(off));
|
||||
pfc_mask = PFC_MASK << (pin * 4);
|
||||
/* Nothing to do if reset value of the pin is same as cached value */
|
||||
if ((cache->pfc[port] & pfc_mask) == (pfc_val & pfc_mask))
|
||||
continue;
|
||||
|
||||
/* Set pin to 'Non-use (Hi-Z input protection)' */
|
||||
pm &= ~(PM_MASK << (pin * 2));
|
||||
writew(pm, pctrl->base + PM(off));
|
||||
|
|
@ -3127,8 +3151,8 @@ static void rzg2l_pinctrl_pm_setup_pfc(struct rzg2l_pinctrl *pctrl)
|
|||
writeb(pmc, pctrl->base + PMC(off));
|
||||
|
||||
/* Select Pin function mode. */
|
||||
pfc &= ~(PFC_MASK << (pin * 4));
|
||||
pfc |= (cache->pfc[port] & (PFC_MASK << (pin * 4)));
|
||||
pfc &= ~pfc_mask;
|
||||
pfc |= (cache->pfc[port] & pfc_mask);
|
||||
writel(pfc, pctrl->base + PFC(off));
|
||||
|
||||
/* Switch to Peripheral pin function. */
|
||||
|
|
@ -3138,7 +3162,7 @@ static void rzg2l_pinctrl_pm_setup_pfc(struct rzg2l_pinctrl *pctrl)
|
|||
}
|
||||
|
||||
pctrl->data->pwpr_pfc_lock_unlock(pctrl, true);
|
||||
spin_unlock_irqrestore(&pctrl->lock, flags);
|
||||
raw_spin_unlock_irqrestore(&pctrl->lock, flags);
|
||||
}
|
||||
|
||||
static int rzg2l_pinctrl_suspend_noirq(struct device *dev)
|
||||
|
|
@ -3187,14 +3211,14 @@ static int rzg2l_pinctrl_resume_noirq(struct device *dev)
|
|||
|
||||
writeb(cache->qspi, pctrl->base + QSPI);
|
||||
if (pctrl->data->hwcfg->oen_pwpr_lock) {
|
||||
spin_lock_irqsave(&pctrl->lock, flags);
|
||||
raw_spin_lock_irqsave(&pctrl->lock, flags);
|
||||
pwpr = readb(pctrl->base + regs->pwpr);
|
||||
writeb(pwpr | PWPR_REGWE_B, pctrl->base + regs->pwpr);
|
||||
}
|
||||
writeb(cache->oen, pctrl->base + pctrl->data->hwcfg->regs.oen);
|
||||
if (pctrl->data->hwcfg->oen_pwpr_lock) {
|
||||
writeb(pwpr & ~PWPR_REGWE_B, pctrl->base + regs->pwpr);
|
||||
spin_unlock_irqrestore(&pctrl->lock, flags);
|
||||
raw_spin_unlock_irqrestore(&pctrl->lock, flags);
|
||||
}
|
||||
for (u8 i = 0; i < 2; i++) {
|
||||
if (regs->sd_ch)
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ static void rzt2h_pinctrl_set_pfc_mode(struct rzt2h_pinctrl *pctrl,
|
|||
/* Switch to Peripheral pin function with PMC register */
|
||||
reg16 = rzt2h_pinctrl_readb(pctrl, port, PMC(port));
|
||||
rzt2h_pinctrl_writeb(pctrl, port, reg16 | BIT(pin), PMC(port));
|
||||
};
|
||||
}
|
||||
|
||||
static int rzt2h_pinctrl_set_mux(struct pinctrl_dev *pctldev,
|
||||
unsigned int func_selector,
|
||||
|
|
@ -182,7 +182,7 @@ static int rzt2h_pinctrl_set_mux(struct pinctrl_dev *pctldev,
|
|||
}
|
||||
|
||||
return 0;
|
||||
};
|
||||
}
|
||||
|
||||
static int rzt2h_map_add_config(struct pinctrl_map *map,
|
||||
const char *group_or_pin,
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ static void rzv2m_pinctrl_set_pfc_mode(struct rzv2m_pinctrl *pctrl,
|
|||
/* Unmask input/output */
|
||||
rzv2m_writel_we(pctrl->base + EN_MSK(port), pin, 0);
|
||||
rzv2m_writel_we(pctrl->base + DI_MSK(port), pin, 0);
|
||||
};
|
||||
}
|
||||
|
||||
static int rzv2m_pinctrl_set_mux(struct pinctrl_dev *pctldev,
|
||||
unsigned int func_selector,
|
||||
|
|
@ -186,7 +186,7 @@ static int rzv2m_pinctrl_set_mux(struct pinctrl_dev *pctldev,
|
|||
}
|
||||
|
||||
return 0;
|
||||
};
|
||||
}
|
||||
|
||||
static int rzv2m_map_add_config(struct pinctrl_map *map,
|
||||
const char *group_or_pin,
|
||||
|
|
@ -551,7 +551,7 @@ static int rzv2m_pinctrl_pinconf_get(struct pinctrl_dev *pctldev,
|
|||
*config = pinconf_to_config_packed(param, arg);
|
||||
|
||||
return 0;
|
||||
};
|
||||
}
|
||||
|
||||
static int rzv2m_pinctrl_pinconf_set(struct pinctrl_dev *pctldev,
|
||||
unsigned int _pin,
|
||||
|
|
@ -689,7 +689,7 @@ static int rzv2m_pinctrl_pinconf_group_set(struct pinctrl_dev *pctldev,
|
|||
}
|
||||
|
||||
return 0;
|
||||
};
|
||||
}
|
||||
|
||||
static int rzv2m_pinctrl_pinconf_group_get(struct pinctrl_dev *pctldev,
|
||||
unsigned int group,
|
||||
|
|
@ -716,7 +716,7 @@ static int rzv2m_pinctrl_pinconf_group_get(struct pinctrl_dev *pctldev,
|
|||
}
|
||||
|
||||
return 0;
|
||||
};
|
||||
}
|
||||
|
||||
static const struct pinctrl_ops rzv2m_pinctrl_pctlops = {
|
||||
.get_groups_count = pinctrl_generic_get_group_count,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user