sh: pfc: Unlock register support
Add PFC support for a 32-bit unlock register. Needed to drive the r8a7779 PFC that comes with a funky PMMR register. Signed-off-by: Magnus Damm <damm@opensource.se> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
This commit is contained in:
parent
f78a26f55b
commit
e499ada829
@ -210,7 +210,7 @@ static void write_config_reg(struct pinmux_info *gpioc,
|
|||||||
unsigned long field, unsigned long value)
|
unsigned long field, unsigned long value)
|
||||||
{
|
{
|
||||||
void __iomem *mapped_reg;
|
void __iomem *mapped_reg;
|
||||||
unsigned long mask, pos;
|
unsigned long mask, pos, data;
|
||||||
|
|
||||||
config_reg_helper(gpioc, crp, field, &mapped_reg, &mask, &pos);
|
config_reg_helper(gpioc, crp, field, &mapped_reg, &mask, &pos);
|
||||||
|
|
||||||
@ -221,17 +221,15 @@ static void write_config_reg(struct pinmux_info *gpioc,
|
|||||||
mask = ~(mask << pos);
|
mask = ~(mask << pos);
|
||||||
value = value << pos;
|
value = value << pos;
|
||||||
|
|
||||||
switch (crp->reg_width) {
|
data = gpio_read_raw_reg(mapped_reg, crp->reg_width);
|
||||||
case 8:
|
data &= mask;
|
||||||
iowrite8((ioread8(mapped_reg) & mask) | value, mapped_reg);
|
data |= value;
|
||||||
break;
|
|
||||||
case 16:
|
if (gpioc->unlock_reg)
|
||||||
iowrite16((ioread16(mapped_reg) & mask) | value, mapped_reg);
|
gpio_write_raw_reg(pfc_phys_to_virt(gpioc, gpioc->unlock_reg),
|
||||||
break;
|
32, ~data);
|
||||||
case 32:
|
|
||||||
iowrite32((ioread32(mapped_reg) & mask) | value, mapped_reg);
|
gpio_write_raw_reg(mapped_reg, crp->reg_width, data);
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int setup_data_reg(struct pinmux_info *gpioc, unsigned gpio)
|
static int setup_data_reg(struct pinmux_info *gpioc, unsigned gpio)
|
||||||
|
@ -116,6 +116,8 @@ struct pinmux_info {
|
|||||||
unsigned int num_resources;
|
unsigned int num_resources;
|
||||||
struct pfc_window *window;
|
struct pfc_window *window;
|
||||||
|
|
||||||
|
unsigned long unlock_reg;
|
||||||
|
|
||||||
struct gpio_chip chip;
|
struct gpio_chip chip;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user