diff options
author | John Keeping <john@metanate.com> | 2017-03-23 06:59:29 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2017-03-28 05:17:11 -0400 |
commit | 70b7aa7a87b4593f50f634dc721e18bd1f9e5448 (patch) | |
tree | cb68384b807c07a66d11f24c1685ec5dbb6e0432 | |
parent | f07bedc37f3cfb7b182e1337fe7c8acce71e3a25 (diff) |
pinctrl: rockchip: convert to raw spinlock
This lock is used from rockchip_irq_set_type() which is part of the
irq_chip implementation and thus must use raw_spinlock_t as documented
in Documentation/gpio/driver.txt.
Signed-off-by: John Keeping <john@metanate.com>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r-- | drivers/pinctrl/pinctrl-rockchip.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c index 6568c867bdcd..5d5a9c4c522d 100644 --- a/drivers/pinctrl/pinctrl-rockchip.c +++ b/drivers/pinctrl/pinctrl-rockchip.c | |||
@@ -163,7 +163,7 @@ struct rockchip_pin_bank { | |||
163 | struct irq_domain *domain; | 163 | struct irq_domain *domain; |
164 | struct gpio_chip gpio_chip; | 164 | struct gpio_chip gpio_chip; |
165 | struct pinctrl_gpio_range grange; | 165 | struct pinctrl_gpio_range grange; |
166 | spinlock_t slock; | 166 | raw_spinlock_t slock; |
167 | u32 toggle_edge_mode; | 167 | u32 toggle_edge_mode; |
168 | }; | 168 | }; |
169 | 169 | ||
@@ -1498,7 +1498,7 @@ static int _rockchip_pmx_gpio_set_direction(struct gpio_chip *chip, | |||
1498 | return ret; | 1498 | return ret; |
1499 | 1499 | ||
1500 | clk_enable(bank->clk); | 1500 | clk_enable(bank->clk); |
1501 | spin_lock_irqsave(&bank->slock, flags); | 1501 | raw_spin_lock_irqsave(&bank->slock, flags); |
1502 | 1502 | ||
1503 | data = readl_relaxed(bank->reg_base + GPIO_SWPORT_DDR); | 1503 | data = readl_relaxed(bank->reg_base + GPIO_SWPORT_DDR); |
1504 | /* set bit to 1 for output, 0 for input */ | 1504 | /* set bit to 1 for output, 0 for input */ |
@@ -1508,7 +1508,7 @@ static int _rockchip_pmx_gpio_set_direction(struct gpio_chip *chip, | |||
1508 | data &= ~BIT(pin); | 1508 | data &= ~BIT(pin); |
1509 | writel_relaxed(data, bank->reg_base + GPIO_SWPORT_DDR); | 1509 | writel_relaxed(data, bank->reg_base + GPIO_SWPORT_DDR); |
1510 | 1510 | ||
1511 | spin_unlock_irqrestore(&bank->slock, flags); | 1511 | raw_spin_unlock_irqrestore(&bank->slock, flags); |
1512 | clk_disable(bank->clk); | 1512 | clk_disable(bank->clk); |
1513 | 1513 | ||
1514 | return 0; | 1514 | return 0; |
@@ -1958,7 +1958,7 @@ static void rockchip_gpio_set(struct gpio_chip *gc, unsigned offset, int value) | |||
1958 | u32 data; | 1958 | u32 data; |
1959 | 1959 | ||
1960 | clk_enable(bank->clk); | 1960 | clk_enable(bank->clk); |
1961 | spin_lock_irqsave(&bank->slock, flags); | 1961 | raw_spin_lock_irqsave(&bank->slock, flags); |
1962 | 1962 | ||
1963 | data = readl(reg); | 1963 | data = readl(reg); |
1964 | data &= ~BIT(offset); | 1964 | data &= ~BIT(offset); |
@@ -1966,7 +1966,7 @@ static void rockchip_gpio_set(struct gpio_chip *gc, unsigned offset, int value) | |||
1966 | data |= BIT(offset); | 1966 | data |= BIT(offset); |
1967 | writel(data, reg); | 1967 | writel(data, reg); |
1968 | 1968 | ||
1969 | spin_unlock_irqrestore(&bank->slock, flags); | 1969 | raw_spin_unlock_irqrestore(&bank->slock, flags); |
1970 | clk_disable(bank->clk); | 1970 | clk_disable(bank->clk); |
1971 | } | 1971 | } |
1972 | 1972 | ||
@@ -2078,7 +2078,7 @@ static void rockchip_irq_demux(struct irq_desc *desc) | |||
2078 | 2078 | ||
2079 | data = readl_relaxed(bank->reg_base + GPIO_EXT_PORT); | 2079 | data = readl_relaxed(bank->reg_base + GPIO_EXT_PORT); |
2080 | do { | 2080 | do { |
2081 | spin_lock_irqsave(&bank->slock, flags); | 2081 | raw_spin_lock_irqsave(&bank->slock, flags); |
2082 | 2082 | ||
2083 | polarity = readl_relaxed(bank->reg_base + | 2083 | polarity = readl_relaxed(bank->reg_base + |
2084 | GPIO_INT_POLARITY); | 2084 | GPIO_INT_POLARITY); |
@@ -2089,7 +2089,7 @@ static void rockchip_irq_demux(struct irq_desc *desc) | |||
2089 | writel(polarity, | 2089 | writel(polarity, |
2090 | bank->reg_base + GPIO_INT_POLARITY); | 2090 | bank->reg_base + GPIO_INT_POLARITY); |
2091 | 2091 | ||
2092 | spin_unlock_irqrestore(&bank->slock, flags); | 2092 | raw_spin_unlock_irqrestore(&bank->slock, flags); |
2093 | 2093 | ||
2094 | data_old = data; | 2094 | data_old = data; |
2095 | data = readl_relaxed(bank->reg_base + | 2095 | data = readl_relaxed(bank->reg_base + |
@@ -2120,20 +2120,20 @@ static int rockchip_irq_set_type(struct irq_data *d, unsigned int type) | |||
2120 | return ret; | 2120 | return ret; |
2121 | 2121 | ||
2122 | clk_enable(bank->clk); | 2122 | clk_enable(bank->clk); |
2123 | spin_lock_irqsave(&bank->slock, flags); | 2123 | raw_spin_lock_irqsave(&bank->slock, flags); |
2124 | 2124 | ||
2125 | data = readl_relaxed(bank->reg_base + GPIO_SWPORT_DDR); | 2125 | data = readl_relaxed(bank->reg_base + GPIO_SWPORT_DDR); |
2126 | data &= ~mask; | 2126 | data &= ~mask; |
2127 | writel_relaxed(data, bank->reg_base + GPIO_SWPORT_DDR); | 2127 | writel_relaxed(data, bank->reg_base + GPIO_SWPORT_DDR); |
2128 | 2128 | ||
2129 | spin_unlock_irqrestore(&bank->slock, flags); | 2129 | raw_spin_unlock_irqrestore(&bank->slock, flags); |
2130 | 2130 | ||
2131 | if (type & IRQ_TYPE_EDGE_BOTH) | 2131 | if (type & IRQ_TYPE_EDGE_BOTH) |
2132 | irq_set_handler_locked(d, handle_edge_irq); | 2132 | irq_set_handler_locked(d, handle_edge_irq); |
2133 | else | 2133 | else |
2134 | irq_set_handler_locked(d, handle_level_irq); | 2134 | irq_set_handler_locked(d, handle_level_irq); |
2135 | 2135 | ||
2136 | spin_lock_irqsave(&bank->slock, flags); | 2136 | raw_spin_lock_irqsave(&bank->slock, flags); |
2137 | irq_gc_lock(gc); | 2137 | irq_gc_lock(gc); |
2138 | 2138 | ||
2139 | level = readl_relaxed(gc->reg_base + GPIO_INTTYPE_LEVEL); | 2139 | level = readl_relaxed(gc->reg_base + GPIO_INTTYPE_LEVEL); |
@@ -2176,7 +2176,7 @@ static int rockchip_irq_set_type(struct irq_data *d, unsigned int type) | |||
2176 | break; | 2176 | break; |
2177 | default: | 2177 | default: |
2178 | irq_gc_unlock(gc); | 2178 | irq_gc_unlock(gc); |
2179 | spin_unlock_irqrestore(&bank->slock, flags); | 2179 | raw_spin_unlock_irqrestore(&bank->slock, flags); |
2180 | clk_disable(bank->clk); | 2180 | clk_disable(bank->clk); |
2181 | return -EINVAL; | 2181 | return -EINVAL; |
2182 | } | 2182 | } |
@@ -2185,7 +2185,7 @@ static int rockchip_irq_set_type(struct irq_data *d, unsigned int type) | |||
2185 | writel_relaxed(polarity, gc->reg_base + GPIO_INT_POLARITY); | 2185 | writel_relaxed(polarity, gc->reg_base + GPIO_INT_POLARITY); |
2186 | 2186 | ||
2187 | irq_gc_unlock(gc); | 2187 | irq_gc_unlock(gc); |
2188 | spin_unlock_irqrestore(&bank->slock, flags); | 2188 | raw_spin_unlock_irqrestore(&bank->slock, flags); |
2189 | clk_disable(bank->clk); | 2189 | clk_disable(bank->clk); |
2190 | 2190 | ||
2191 | return 0; | 2191 | return 0; |
@@ -2468,7 +2468,7 @@ static struct rockchip_pin_ctrl *rockchip_pinctrl_get_soc_data( | |||
2468 | for (i = 0; i < ctrl->nr_banks; ++i, ++bank) { | 2468 | for (i = 0; i < ctrl->nr_banks; ++i, ++bank) { |
2469 | int bank_pins = 0; | 2469 | int bank_pins = 0; |
2470 | 2470 | ||
2471 | spin_lock_init(&bank->slock); | 2471 | raw_spin_lock_init(&bank->slock); |
2472 | bank->drvdata = d; | 2472 | bank->drvdata = d; |
2473 | bank->pin_base = ctrl->nr_pins; | 2473 | bank->pin_base = ctrl->nr_pins; |
2474 | ctrl->nr_pins += bank->nr_pins; | 2474 | ctrl->nr_pins += bank->nr_pins; |