pinctrl: single: get register area size by device API

Use dev_read_addr_size to get size of the controller's register area.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
Reviewed-by: Pratyush Yadav <p.yadav@ti.com>
This commit is contained in:
Dario Binacchi 2021-04-11 09:39:43 +02:00 committed by Lokesh Vutla
parent fcf6a2b30a
commit 9fd8a430f3

View File

@ -182,17 +182,19 @@ static int single_set_state(struct udevice *dev,
static int single_of_to_plat(struct udevice *dev) static int single_of_to_plat(struct udevice *dev)
{ {
fdt_addr_t addr; fdt_addr_t addr;
u32 of_reg[2]; fdt_size_t size;
int res;
struct single_pdata *pdata = dev_get_plat(dev); struct single_pdata *pdata = dev_get_plat(dev);
pdata->width = pdata->width =
dev_read_u32_default(dev, "pinctrl-single,register-width", 0); dev_read_u32_default(dev, "pinctrl-single,register-width", 0);
res = dev_read_u32_array(dev, "reg", of_reg, 2); addr = dev_read_addr_size(dev, "reg", &size);
if (res) if (addr == FDT_ADDR_T_NONE) {
return res; dev_err(dev, "failed to get base register size\n");
pdata->offset = of_reg[1] - pdata->width / 8; return -EINVAL;
}
pdata->offset = size - pdata->width / BITS_PER_BYTE;
addr = dev_read_addr(dev); addr = dev_read_addr(dev);
if (addr == FDT_ADDR_T_NONE) { if (addr == FDT_ADDR_T_NONE) {