diff options
-rw-r--r-- | drivers/pinctrl/sh-pfc/core.c | 25 | ||||
-rw-r--r-- | drivers/pinctrl/sh-pfc/core.h | 5 | ||||
-rw-r--r-- | drivers/pinctrl/sh-pfc/gpio.c | 13 |
3 files changed, 21 insertions, 22 deletions
diff --git a/drivers/pinctrl/sh-pfc/core.c b/drivers/pinctrl/sh-pfc/core.c index e2c442b64a2c..895a41e2f30a 100644 --- a/drivers/pinctrl/sh-pfc/core.c +++ b/drivers/pinctrl/sh-pfc/core.c | |||
@@ -144,8 +144,7 @@ static int sh_pfc_enum_in_range(u16 enum_id, const struct pinmux_range *r) | |||
144 | return 1; | 144 | return 1; |
145 | } | 145 | } |
146 | 146 | ||
147 | unsigned long sh_pfc_read_raw_reg(void __iomem *mapped_reg, | 147 | u32 sh_pfc_read_raw_reg(void __iomem *mapped_reg, unsigned long reg_width) |
148 | unsigned long reg_width) | ||
149 | { | 148 | { |
150 | switch (reg_width) { | 149 | switch (reg_width) { |
151 | case 8: | 150 | case 8: |
@@ -161,7 +160,7 @@ unsigned long sh_pfc_read_raw_reg(void __iomem *mapped_reg, | |||
161 | } | 160 | } |
162 | 161 | ||
163 | void sh_pfc_write_raw_reg(void __iomem *mapped_reg, unsigned long reg_width, | 162 | void sh_pfc_write_raw_reg(void __iomem *mapped_reg, unsigned long reg_width, |
164 | unsigned long data) | 163 | u32 data) |
165 | { | 164 | { |
166 | switch (reg_width) { | 165 | switch (reg_width) { |
167 | case 8: | 166 | case 8: |
@@ -181,8 +180,7 @@ void sh_pfc_write_raw_reg(void __iomem *mapped_reg, unsigned long reg_width, | |||
181 | static void sh_pfc_config_reg_helper(struct sh_pfc *pfc, | 180 | static void sh_pfc_config_reg_helper(struct sh_pfc *pfc, |
182 | const struct pinmux_cfg_reg *crp, | 181 | const struct pinmux_cfg_reg *crp, |
183 | unsigned long in_pos, | 182 | unsigned long in_pos, |
184 | void __iomem **mapped_regp, | 183 | void __iomem **mapped_regp, u32 *maskp, |
185 | unsigned long *maskp, | ||
186 | unsigned long *posp) | 184 | unsigned long *posp) |
187 | { | 185 | { |
188 | unsigned int k; | 186 | unsigned int k; |
@@ -202,14 +200,15 @@ static void sh_pfc_config_reg_helper(struct sh_pfc *pfc, | |||
202 | 200 | ||
203 | static void sh_pfc_write_config_reg(struct sh_pfc *pfc, | 201 | static void sh_pfc_write_config_reg(struct sh_pfc *pfc, |
204 | const struct pinmux_cfg_reg *crp, | 202 | const struct pinmux_cfg_reg *crp, |
205 | unsigned long field, unsigned long value) | 203 | unsigned long field, u32 value) |
206 | { | 204 | { |
207 | void __iomem *mapped_reg; | 205 | void __iomem *mapped_reg; |
208 | unsigned long mask, pos, data; | 206 | unsigned long pos; |
207 | u32 mask, data; | ||
209 | 208 | ||
210 | sh_pfc_config_reg_helper(pfc, crp, field, &mapped_reg, &mask, &pos); | 209 | sh_pfc_config_reg_helper(pfc, crp, field, &mapped_reg, &mask, &pos); |
211 | 210 | ||
212 | dev_dbg(pfc->dev, "write_reg addr = %lx, value = %ld, field = %ld, " | 211 | dev_dbg(pfc->dev, "write_reg addr = %lx, value = 0x%x, field = %ld, " |
213 | "r_width = %ld, f_width = %ld\n", | 212 | "r_width = %ld, f_width = %ld\n", |
214 | crp->reg, value, field, crp->reg_width, crp->field_width); | 213 | crp->reg, value, field, crp->reg_width, crp->field_width); |
215 | 214 | ||
@@ -230,11 +229,12 @@ static void sh_pfc_write_config_reg(struct sh_pfc *pfc, | |||
230 | 229 | ||
231 | static int sh_pfc_get_config_reg(struct sh_pfc *pfc, u16 enum_id, | 230 | static int sh_pfc_get_config_reg(struct sh_pfc *pfc, u16 enum_id, |
232 | const struct pinmux_cfg_reg **crp, int *fieldp, | 231 | const struct pinmux_cfg_reg **crp, int *fieldp, |
233 | int *valuep) | 232 | u32 *valuep) |
234 | { | 233 | { |
235 | const struct pinmux_cfg_reg *config_reg; | 234 | const struct pinmux_cfg_reg *config_reg; |
236 | unsigned long r_width, f_width, curr_width, ncomb; | 235 | unsigned long r_width, f_width, curr_width; |
237 | unsigned int k, m, n, pos, bit_pos; | 236 | unsigned int k, m, pos, bit_pos; |
237 | u32 ncomb, n; | ||
238 | 238 | ||
239 | k = 0; | 239 | k = 0; |
240 | while (1) { | 240 | while (1) { |
@@ -300,7 +300,8 @@ int sh_pfc_config_mux(struct sh_pfc *pfc, unsigned mark, int pinmux_type) | |||
300 | const struct pinmux_cfg_reg *cr = NULL; | 300 | const struct pinmux_cfg_reg *cr = NULL; |
301 | u16 enum_id; | 301 | u16 enum_id; |
302 | const struct pinmux_range *range; | 302 | const struct pinmux_range *range; |
303 | int in_range, pos, field, value; | 303 | int in_range, pos, field; |
304 | u32 value; | ||
304 | int ret; | 305 | int ret; |
305 | 306 | ||
306 | switch (pinmux_type) { | 307 | switch (pinmux_type) { |
diff --git a/drivers/pinctrl/sh-pfc/core.h b/drivers/pinctrl/sh-pfc/core.h index 6b59d63b9c01..8a10dd50ccdd 100644 --- a/drivers/pinctrl/sh-pfc/core.h +++ b/drivers/pinctrl/sh-pfc/core.h | |||
@@ -57,10 +57,9 @@ int sh_pfc_unregister_gpiochip(struct sh_pfc *pfc); | |||
57 | int sh_pfc_register_pinctrl(struct sh_pfc *pfc); | 57 | int sh_pfc_register_pinctrl(struct sh_pfc *pfc); |
58 | int sh_pfc_unregister_pinctrl(struct sh_pfc *pfc); | 58 | int sh_pfc_unregister_pinctrl(struct sh_pfc *pfc); |
59 | 59 | ||
60 | unsigned long sh_pfc_read_raw_reg(void __iomem *mapped_reg, | 60 | u32 sh_pfc_read_raw_reg(void __iomem *mapped_reg, unsigned long reg_width); |
61 | unsigned long reg_width); | ||
62 | void sh_pfc_write_raw_reg(void __iomem *mapped_reg, unsigned long reg_width, | 61 | void sh_pfc_write_raw_reg(void __iomem *mapped_reg, unsigned long reg_width, |
63 | unsigned long data); | 62 | u32 data); |
64 | 63 | ||
65 | int sh_pfc_get_pin_index(struct sh_pfc *pfc, unsigned int pin); | 64 | int sh_pfc_get_pin_index(struct sh_pfc *pfc, unsigned int pin); |
66 | int sh_pfc_config_mux(struct sh_pfc *pfc, unsigned mark, int pinmux_type); | 65 | int sh_pfc_config_mux(struct sh_pfc *pfc, unsigned mark, int pinmux_type); |
diff --git a/drivers/pinctrl/sh-pfc/gpio.c b/drivers/pinctrl/sh-pfc/gpio.c index 80f641ee4dea..f2bb7d7398cd 100644 --- a/drivers/pinctrl/sh-pfc/gpio.c +++ b/drivers/pinctrl/sh-pfc/gpio.c | |||
@@ -21,7 +21,7 @@ | |||
21 | 21 | ||
22 | struct sh_pfc_gpio_data_reg { | 22 | struct sh_pfc_gpio_data_reg { |
23 | const struct pinmux_data_reg *info; | 23 | const struct pinmux_data_reg *info; |
24 | unsigned long shadow; | 24 | u32 shadow; |
25 | }; | 25 | }; |
26 | 26 | ||
27 | struct sh_pfc_gpio_pin { | 27 | struct sh_pfc_gpio_pin { |
@@ -59,8 +59,8 @@ static void gpio_get_data_reg(struct sh_pfc_chip *chip, unsigned int offset, | |||
59 | *bit = gpio_pin->dbit; | 59 | *bit = gpio_pin->dbit; |
60 | } | 60 | } |
61 | 61 | ||
62 | static unsigned long gpio_read_data_reg(struct sh_pfc_chip *chip, | 62 | static u32 gpio_read_data_reg(struct sh_pfc_chip *chip, |
63 | const struct pinmux_data_reg *dreg) | 63 | const struct pinmux_data_reg *dreg) |
64 | { | 64 | { |
65 | void __iomem *mem = dreg->reg - chip->mem->phys + chip->mem->virt; | 65 | void __iomem *mem = dreg->reg - chip->mem->phys + chip->mem->virt; |
66 | 66 | ||
@@ -68,8 +68,7 @@ static unsigned long gpio_read_data_reg(struct sh_pfc_chip *chip, | |||
68 | } | 68 | } |
69 | 69 | ||
70 | static void gpio_write_data_reg(struct sh_pfc_chip *chip, | 70 | static void gpio_write_data_reg(struct sh_pfc_chip *chip, |
71 | const struct pinmux_data_reg *dreg, | 71 | const struct pinmux_data_reg *dreg, u32 value) |
72 | unsigned long value) | ||
73 | { | 72 | { |
74 | void __iomem *mem = dreg->reg - chip->mem->phys + chip->mem->virt; | 73 | void __iomem *mem = dreg->reg - chip->mem->phys + chip->mem->virt; |
75 | 74 | ||
@@ -162,9 +161,9 @@ static void gpio_pin_set_value(struct sh_pfc_chip *chip, unsigned offset, | |||
162 | pos = reg->info->reg_width - (bit + 1); | 161 | pos = reg->info->reg_width - (bit + 1); |
163 | 162 | ||
164 | if (value) | 163 | if (value) |
165 | set_bit(pos, ®->shadow); | 164 | reg->shadow |= BIT(pos); |
166 | else | 165 | else |
167 | clear_bit(pos, ®->shadow); | 166 | reg->shadow &= ~BIT(pos); |
168 | 167 | ||
169 | gpio_write_data_reg(chip, reg->info, reg->shadow); | 168 | gpio_write_data_reg(chip, reg->info, reg->shadow); |
170 | } | 169 | } |