Commit e4dd7fd5 authored by Andy Shevchenko's avatar Andy Shevchenko

pinctrl/rockchip: Use temporary variable for struct device

Use temporary variable for struct device to make code neater.
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: default avatarHeiko Stuebner <heiko@sntech.de>
parent 5a83227b
...@@ -285,6 +285,7 @@ static int rockchip_dt_node_to_map(struct pinctrl_dev *pctldev, ...@@ -285,6 +285,7 @@ static int rockchip_dt_node_to_map(struct pinctrl_dev *pctldev,
{ {
struct rockchip_pinctrl *info = pinctrl_dev_get_drvdata(pctldev); struct rockchip_pinctrl *info = pinctrl_dev_get_drvdata(pctldev);
const struct rockchip_pin_group *grp; const struct rockchip_pin_group *grp;
struct device *dev = info->dev;
struct pinctrl_map *new_map; struct pinctrl_map *new_map;
struct device_node *parent; struct device_node *parent;
int map_num = 1; int map_num = 1;
...@@ -296,8 +297,7 @@ static int rockchip_dt_node_to_map(struct pinctrl_dev *pctldev, ...@@ -296,8 +297,7 @@ static int rockchip_dt_node_to_map(struct pinctrl_dev *pctldev,
*/ */
grp = pinctrl_name_to_group(info, np->name); grp = pinctrl_name_to_group(info, np->name);
if (!grp) { if (!grp) {
dev_err(info->dev, "unable to find group for node %pOFn\n", dev_err(dev, "unable to find group for node %pOFn\n", np);
np);
return -EINVAL; return -EINVAL;
} }
...@@ -331,7 +331,7 @@ static int rockchip_dt_node_to_map(struct pinctrl_dev *pctldev, ...@@ -331,7 +331,7 @@ static int rockchip_dt_node_to_map(struct pinctrl_dev *pctldev,
new_map[i].data.configs.num_configs = grp->data[i].nconfigs; new_map[i].data.configs.num_configs = grp->data[i].nconfigs;
} }
dev_dbg(pctldev->dev, "maps: function %s group %s num %d\n", dev_dbg(dev, "maps: function %s group %s num %d\n",
(*map)->data.mux.function, (*map)->data.mux.group, map_num); (*map)->data.mux.function, (*map)->data.mux.group, map_num);
return 0; return 0;
...@@ -872,20 +872,20 @@ static int rockchip_verify_mux(struct rockchip_pin_bank *bank, ...@@ -872,20 +872,20 @@ static int rockchip_verify_mux(struct rockchip_pin_bank *bank,
int pin, int mux) int pin, int mux)
{ {
struct rockchip_pinctrl *info = bank->drvdata; struct rockchip_pinctrl *info = bank->drvdata;
struct device *dev = info->dev;
int iomux_num = (pin / 8); int iomux_num = (pin / 8);
if (iomux_num > 3) if (iomux_num > 3)
return -EINVAL; return -EINVAL;
if (bank->iomux[iomux_num].type & IOMUX_UNROUTED) { if (bank->iomux[iomux_num].type & IOMUX_UNROUTED) {
dev_err(info->dev, "pin %d is unrouted\n", pin); dev_err(dev, "pin %d is unrouted\n", pin);
return -EINVAL; return -EINVAL;
} }
if (bank->iomux[iomux_num].type & IOMUX_GPIO_ONLY) { if (bank->iomux[iomux_num].type & IOMUX_GPIO_ONLY) {
if (mux != RK_FUNC_GPIO) { if (mux != RK_FUNC_GPIO) {
dev_err(info->dev, dev_err(dev, "pin %d only supports a gpio mux\n", pin);
"pin %d only supports a gpio mux\n", pin);
return -ENOTSUPP; return -ENOTSUPP;
} }
} }
...@@ -909,6 +909,7 @@ static int rockchip_verify_mux(struct rockchip_pin_bank *bank, ...@@ -909,6 +909,7 @@ static int rockchip_verify_mux(struct rockchip_pin_bank *bank,
static int rockchip_set_mux(struct rockchip_pin_bank *bank, int pin, int mux) static int rockchip_set_mux(struct rockchip_pin_bank *bank, int pin, int mux)
{ {
struct rockchip_pinctrl *info = bank->drvdata; struct rockchip_pinctrl *info = bank->drvdata;
struct device *dev = info->dev;
int iomux_num = (pin / 8); int iomux_num = (pin / 8);
struct regmap *regmap; struct regmap *regmap;
int reg, ret, mask, mux_type; int reg, ret, mask, mux_type;
...@@ -922,8 +923,7 @@ static int rockchip_set_mux(struct rockchip_pin_bank *bank, int pin, int mux) ...@@ -922,8 +923,7 @@ static int rockchip_set_mux(struct rockchip_pin_bank *bank, int pin, int mux)
if (bank->iomux[iomux_num].type & IOMUX_GPIO_ONLY) if (bank->iomux[iomux_num].type & IOMUX_GPIO_ONLY)
return 0; return 0;
dev_dbg(info->dev, "setting mux of GPIO%d-%d to %d\n", dev_dbg(dev, "setting mux of GPIO%d-%d to %d\n", bank->bank_num, pin, mux);
bank->bank_num, pin, mux);
regmap = (bank->iomux[iomux_num].type & IOMUX_SOURCE_PMU) regmap = (bank->iomux[iomux_num].type & IOMUX_SOURCE_PMU)
? info->regmap_pmu : info->regmap_base; ? info->regmap_pmu : info->regmap_base;
...@@ -1575,6 +1575,7 @@ static int rockchip_get_drive_perpin(struct rockchip_pin_bank *bank, ...@@ -1575,6 +1575,7 @@ static int rockchip_get_drive_perpin(struct rockchip_pin_bank *bank,
{ {
struct rockchip_pinctrl *info = bank->drvdata; struct rockchip_pinctrl *info = bank->drvdata;
struct rockchip_pin_ctrl *ctrl = info->ctrl; struct rockchip_pin_ctrl *ctrl = info->ctrl;
struct device *dev = info->dev;
struct regmap *regmap; struct regmap *regmap;
int reg, ret; int reg, ret;
u32 data, temp, rmask_bits; u32 data, temp, rmask_bits;
...@@ -1620,7 +1621,7 @@ static int rockchip_get_drive_perpin(struct rockchip_pin_bank *bank, ...@@ -1620,7 +1621,7 @@ static int rockchip_get_drive_perpin(struct rockchip_pin_bank *bank,
bit -= 16; bit -= 16;
break; break;
default: default:
dev_err(info->dev, "unsupported bit: %d for pinctrl drive type: %d\n", dev_err(dev, "unsupported bit: %d for pinctrl drive type: %d\n",
bit, drv_type); bit, drv_type);
return -EINVAL; return -EINVAL;
} }
...@@ -1632,8 +1633,7 @@ static int rockchip_get_drive_perpin(struct rockchip_pin_bank *bank, ...@@ -1632,8 +1633,7 @@ static int rockchip_get_drive_perpin(struct rockchip_pin_bank *bank,
rmask_bits = RK3288_DRV_BITS_PER_PIN; rmask_bits = RK3288_DRV_BITS_PER_PIN;
break; break;
default: default:
dev_err(info->dev, "unsupported pinctrl drive type: %d\n", dev_err(dev, "unsupported pinctrl drive type: %d\n", drv_type);
drv_type);
return -EINVAL; return -EINVAL;
} }
...@@ -1652,13 +1652,14 @@ static int rockchip_set_drive_perpin(struct rockchip_pin_bank *bank, ...@@ -1652,13 +1652,14 @@ static int rockchip_set_drive_perpin(struct rockchip_pin_bank *bank,
{ {
struct rockchip_pinctrl *info = bank->drvdata; struct rockchip_pinctrl *info = bank->drvdata;
struct rockchip_pin_ctrl *ctrl = info->ctrl; struct rockchip_pin_ctrl *ctrl = info->ctrl;
struct device *dev = info->dev;
struct regmap *regmap; struct regmap *regmap;
int reg, ret, i; int reg, ret, i;
u32 data, rmask, rmask_bits, temp; u32 data, rmask, rmask_bits, temp;
u8 bit; u8 bit;
int drv_type = bank->drv[pin_num / 8].drv_type; int drv_type = bank->drv[pin_num / 8].drv_type;
dev_dbg(info->dev, "setting drive of GPIO%d-%d to %d\n", dev_dbg(dev, "setting drive of GPIO%d-%d to %d\n",
bank->bank_num, pin_num, strength); bank->bank_num, pin_num, strength);
ctrl->drv_calc_reg(bank, pin_num, &regmap, &reg, &bit); ctrl->drv_calc_reg(bank, pin_num, &regmap, &reg, &bit);
...@@ -1680,8 +1681,7 @@ static int rockchip_set_drive_perpin(struct rockchip_pin_bank *bank, ...@@ -1680,8 +1681,7 @@ static int rockchip_set_drive_perpin(struct rockchip_pin_bank *bank,
} }
if (ret < 0) { if (ret < 0) {
dev_err(info->dev, "unsupported driver strength %d\n", dev_err(dev, "unsupported driver strength %d\n", strength);
strength);
return ret; return ret;
} }
...@@ -1720,7 +1720,7 @@ static int rockchip_set_drive_perpin(struct rockchip_pin_bank *bank, ...@@ -1720,7 +1720,7 @@ static int rockchip_set_drive_perpin(struct rockchip_pin_bank *bank,
bit -= 16; bit -= 16;
break; break;
default: default:
dev_err(info->dev, "unsupported bit: %d for pinctrl drive type: %d\n", dev_err(dev, "unsupported bit: %d for pinctrl drive type: %d\n",
bit, drv_type); bit, drv_type);
return -EINVAL; return -EINVAL;
} }
...@@ -1731,8 +1731,7 @@ static int rockchip_set_drive_perpin(struct rockchip_pin_bank *bank, ...@@ -1731,8 +1731,7 @@ static int rockchip_set_drive_perpin(struct rockchip_pin_bank *bank,
rmask_bits = RK3288_DRV_BITS_PER_PIN; rmask_bits = RK3288_DRV_BITS_PER_PIN;
break; break;
default: default:
dev_err(info->dev, "unsupported pinctrl drive type: %d\n", dev_err(dev, "unsupported pinctrl drive type: %d\n", drv_type);
drv_type);
return -EINVAL; return -EINVAL;
} }
...@@ -1766,6 +1765,7 @@ static int rockchip_get_pull(struct rockchip_pin_bank *bank, int pin_num) ...@@ -1766,6 +1765,7 @@ static int rockchip_get_pull(struct rockchip_pin_bank *bank, int pin_num)
{ {
struct rockchip_pinctrl *info = bank->drvdata; struct rockchip_pinctrl *info = bank->drvdata;
struct rockchip_pin_ctrl *ctrl = info->ctrl; struct rockchip_pin_ctrl *ctrl = info->ctrl;
struct device *dev = info->dev;
struct regmap *regmap; struct regmap *regmap;
int reg, ret, pull_type; int reg, ret, pull_type;
u8 bit; u8 bit;
...@@ -1800,7 +1800,7 @@ static int rockchip_get_pull(struct rockchip_pin_bank *bank, int pin_num) ...@@ -1800,7 +1800,7 @@ static int rockchip_get_pull(struct rockchip_pin_bank *bank, int pin_num)
return rockchip_pull_list[pull_type][data]; return rockchip_pull_list[pull_type][data];
default: default:
dev_err(info->dev, "unsupported pinctrl type\n"); dev_err(dev, "unsupported pinctrl type\n");
return -EINVAL; return -EINVAL;
}; };
} }
...@@ -1810,13 +1810,13 @@ static int rockchip_set_pull(struct rockchip_pin_bank *bank, ...@@ -1810,13 +1810,13 @@ static int rockchip_set_pull(struct rockchip_pin_bank *bank,
{ {
struct rockchip_pinctrl *info = bank->drvdata; struct rockchip_pinctrl *info = bank->drvdata;
struct rockchip_pin_ctrl *ctrl = info->ctrl; struct rockchip_pin_ctrl *ctrl = info->ctrl;
struct device *dev = info->dev;
struct regmap *regmap; struct regmap *regmap;
int reg, ret, i, pull_type; int reg, ret, i, pull_type;
u8 bit; u8 bit;
u32 data, rmask; u32 data, rmask;
dev_dbg(info->dev, "setting pull of GPIO%d-%d to %d\n", dev_dbg(dev, "setting pull of GPIO%d-%d to %d\n", bank->bank_num, pin_num, pull);
bank->bank_num, pin_num, pull);
/* rk3066b does support any pulls */ /* rk3066b does support any pulls */
if (ctrl->type == RK3066B) if (ctrl->type == RK3066B)
...@@ -1859,8 +1859,7 @@ static int rockchip_set_pull(struct rockchip_pin_bank *bank, ...@@ -1859,8 +1859,7 @@ static int rockchip_set_pull(struct rockchip_pin_bank *bank,
} }
if (ret < 0) { if (ret < 0) {
dev_err(info->dev, "unsupported pull setting %d\n", dev_err(dev, "unsupported pull setting %d\n", pull);
pull);
return ret; return ret;
} }
...@@ -1872,7 +1871,7 @@ static int rockchip_set_pull(struct rockchip_pin_bank *bank, ...@@ -1872,7 +1871,7 @@ static int rockchip_set_pull(struct rockchip_pin_bank *bank,
ret = regmap_update_bits(regmap, reg, rmask, data); ret = regmap_update_bits(regmap, reg, rmask, data);
break; break;
default: default:
dev_err(info->dev, "unsupported pinctrl type\n"); dev_err(dev, "unsupported pinctrl type\n");
return -EINVAL; return -EINVAL;
} }
...@@ -1963,12 +1962,13 @@ static int rockchip_set_schmitt(struct rockchip_pin_bank *bank, ...@@ -1963,12 +1962,13 @@ static int rockchip_set_schmitt(struct rockchip_pin_bank *bank,
{ {
struct rockchip_pinctrl *info = bank->drvdata; struct rockchip_pinctrl *info = bank->drvdata;
struct rockchip_pin_ctrl *ctrl = info->ctrl; struct rockchip_pin_ctrl *ctrl = info->ctrl;
struct device *dev = info->dev;
struct regmap *regmap; struct regmap *regmap;
int reg, ret; int reg, ret;
u8 bit; u8 bit;
u32 data, rmask; u32 data, rmask;
dev_dbg(info->dev, "setting input schmitt of GPIO%d-%d to %d\n", dev_dbg(dev, "setting input schmitt of GPIO%d-%d to %d\n",
bank->bank_num, pin_num, enable); bank->bank_num, pin_num, enable);
ret = ctrl->schmitt_calc_reg(bank, pin_num, &regmap, &reg, &bit); ret = ctrl->schmitt_calc_reg(bank, pin_num, &regmap, &reg, &bit);
...@@ -2028,10 +2028,11 @@ static int rockchip_pmx_set(struct pinctrl_dev *pctldev, unsigned selector, ...@@ -2028,10 +2028,11 @@ static int rockchip_pmx_set(struct pinctrl_dev *pctldev, unsigned selector,
struct rockchip_pinctrl *info = pinctrl_dev_get_drvdata(pctldev); struct rockchip_pinctrl *info = pinctrl_dev_get_drvdata(pctldev);
const unsigned int *pins = info->groups[group].pins; const unsigned int *pins = info->groups[group].pins;
const struct rockchip_pin_config *data = info->groups[group].data; const struct rockchip_pin_config *data = info->groups[group].data;
struct device *dev = info->dev;
struct rockchip_pin_bank *bank; struct rockchip_pin_bank *bank;
int cnt, ret = 0; int cnt, ret = 0;
dev_dbg(info->dev, "enable function %s group %s\n", dev_dbg(dev, "enable function %s group %s\n",
info->functions[selector].name, info->groups[group].name); info->functions[selector].name, info->groups[group].name);
/* /*
...@@ -2310,6 +2311,7 @@ static int rockchip_pinctrl_parse_groups(struct device_node *np, ...@@ -2310,6 +2311,7 @@ static int rockchip_pinctrl_parse_groups(struct device_node *np,
struct rockchip_pinctrl *info, struct rockchip_pinctrl *info,
u32 index) u32 index)
{ {
struct device *dev = info->dev;
struct rockchip_pin_bank *bank; struct rockchip_pin_bank *bank;
int size; int size;
const __be32 *list; const __be32 *list;
...@@ -2317,7 +2319,7 @@ static int rockchip_pinctrl_parse_groups(struct device_node *np, ...@@ -2317,7 +2319,7 @@ static int rockchip_pinctrl_parse_groups(struct device_node *np,
int i, j; int i, j;
int ret; int ret;
dev_dbg(info->dev, "group(%d): %pOFn\n", index, np); dev_dbg(dev, "group(%d): %pOFn\n", index, np);
/* Initialise group */ /* Initialise group */
grp->name = np->name; grp->name = np->name;
...@@ -2330,18 +2332,14 @@ static int rockchip_pinctrl_parse_groups(struct device_node *np, ...@@ -2330,18 +2332,14 @@ static int rockchip_pinctrl_parse_groups(struct device_node *np,
/* we do not check return since it's safe node passed down */ /* we do not check return since it's safe node passed down */
size /= sizeof(*list); size /= sizeof(*list);
if (!size || size % 4) { if (!size || size % 4) {
dev_err(info->dev, "wrong pins number or pins and configs should be by 4\n"); dev_err(dev, "wrong pins number or pins and configs should be by 4\n");
return -EINVAL; return -EINVAL;
} }
grp->npins = size / 4; grp->npins = size / 4;
grp->pins = devm_kcalloc(info->dev, grp->npins, sizeof(unsigned int), grp->pins = devm_kcalloc(dev, grp->npins, sizeof(*grp->pins), GFP_KERNEL);
GFP_KERNEL); grp->data = devm_kcalloc(dev, grp->npins, sizeof(*grp->data), GFP_KERNEL);
grp->data = devm_kcalloc(info->dev,
grp->npins,
sizeof(struct rockchip_pin_config),
GFP_KERNEL);
if (!grp->pins || !grp->data) if (!grp->pins || !grp->data)
return -ENOMEM; return -ENOMEM;
...@@ -2375,6 +2373,7 @@ static int rockchip_pinctrl_parse_functions(struct device_node *np, ...@@ -2375,6 +2373,7 @@ static int rockchip_pinctrl_parse_functions(struct device_node *np,
struct rockchip_pinctrl *info, struct rockchip_pinctrl *info,
u32 index) u32 index)
{ {
struct device *dev = info->dev;
struct device_node *child; struct device_node *child;
struct rockchip_pmx_func *func; struct rockchip_pmx_func *func;
struct rockchip_pin_group *grp; struct rockchip_pin_group *grp;
...@@ -2382,7 +2381,7 @@ static int rockchip_pinctrl_parse_functions(struct device_node *np, ...@@ -2382,7 +2381,7 @@ static int rockchip_pinctrl_parse_functions(struct device_node *np,
static u32 grp_index; static u32 grp_index;
u32 i = 0; u32 i = 0;
dev_dbg(info->dev, "parse function(%d): %pOFn\n", index, np); dev_dbg(dev, "parse function(%d): %pOFn\n", index, np);
func = &info->functions[index]; func = &info->functions[index];
...@@ -2392,8 +2391,7 @@ static int rockchip_pinctrl_parse_functions(struct device_node *np, ...@@ -2392,8 +2391,7 @@ static int rockchip_pinctrl_parse_functions(struct device_node *np,
if (func->ngroups <= 0) if (func->ngroups <= 0)
return 0; return 0;
func->groups = devm_kcalloc(info->dev, func->groups = devm_kcalloc(dev, func->ngroups, sizeof(*func->groups), GFP_KERNEL);
func->ngroups, sizeof(char *), GFP_KERNEL);
if (!func->groups) if (!func->groups)
return -ENOMEM; return -ENOMEM;
...@@ -2421,20 +2419,14 @@ static int rockchip_pinctrl_parse_dt(struct platform_device *pdev, ...@@ -2421,20 +2419,14 @@ static int rockchip_pinctrl_parse_dt(struct platform_device *pdev,
rockchip_pinctrl_child_count(info, np); rockchip_pinctrl_child_count(info, np);
dev_dbg(&pdev->dev, "nfunctions = %d\n", info->nfunctions); dev_dbg(dev, "nfunctions = %d\n", info->nfunctions);
dev_dbg(&pdev->dev, "ngroups = %d\n", info->ngroups); dev_dbg(dev, "ngroups = %d\n", info->ngroups);
info->functions = devm_kcalloc(dev, info->functions = devm_kcalloc(dev, info->nfunctions, sizeof(*info->functions), GFP_KERNEL);
info->nfunctions,
sizeof(struct rockchip_pmx_func),
GFP_KERNEL);
if (!info->functions) if (!info->functions)
return -ENOMEM; return -ENOMEM;
info->groups = devm_kcalloc(dev, info->groups = devm_kcalloc(dev, info->ngroups, sizeof(*info->groups), GFP_KERNEL);
info->ngroups,
sizeof(struct rockchip_pin_group),
GFP_KERNEL);
if (!info->groups) if (!info->groups)
return -ENOMEM; return -ENOMEM;
...@@ -2446,7 +2438,7 @@ static int rockchip_pinctrl_parse_dt(struct platform_device *pdev, ...@@ -2446,7 +2438,7 @@ static int rockchip_pinctrl_parse_dt(struct platform_device *pdev,
ret = rockchip_pinctrl_parse_functions(child, info, i++); ret = rockchip_pinctrl_parse_functions(child, info, i++);
if (ret) { if (ret) {
dev_err(&pdev->dev, "failed to parse function\n"); dev_err(dev, "failed to parse function\n");
of_node_put(child); of_node_put(child);
return ret; return ret;
} }
...@@ -2461,6 +2453,7 @@ static int rockchip_pinctrl_register(struct platform_device *pdev, ...@@ -2461,6 +2453,7 @@ static int rockchip_pinctrl_register(struct platform_device *pdev,
struct pinctrl_desc *ctrldesc = &info->pctl; struct pinctrl_desc *ctrldesc = &info->pctl;
struct pinctrl_pin_desc *pindesc, *pdesc; struct pinctrl_pin_desc *pindesc, *pdesc;
struct rockchip_pin_bank *pin_bank; struct rockchip_pin_bank *pin_bank;
struct device *dev = &pdev->dev;
int pin, bank, ret; int pin, bank, ret;
int k; int k;
...@@ -2470,9 +2463,7 @@ static int rockchip_pinctrl_register(struct platform_device *pdev, ...@@ -2470,9 +2463,7 @@ static int rockchip_pinctrl_register(struct platform_device *pdev,
ctrldesc->pmxops = &rockchip_pmx_ops; ctrldesc->pmxops = &rockchip_pmx_ops;
ctrldesc->confops = &rockchip_pinconf_ops; ctrldesc->confops = &rockchip_pinconf_ops;
pindesc = devm_kcalloc(&pdev->dev, pindesc = devm_kcalloc(dev, info->ctrl->nr_pins, sizeof(*pindesc), GFP_KERNEL);
info->ctrl->nr_pins, sizeof(*pindesc),
GFP_KERNEL);
if (!pindesc) if (!pindesc)
return -ENOMEM; return -ENOMEM;
...@@ -2497,9 +2488,9 @@ static int rockchip_pinctrl_register(struct platform_device *pdev, ...@@ -2497,9 +2488,9 @@ static int rockchip_pinctrl_register(struct platform_device *pdev,
if (ret) if (ret)
return ret; return ret;
info->pctl_dev = devm_pinctrl_register(&pdev->dev, ctrldesc, info); info->pctl_dev = devm_pinctrl_register(dev, ctrldesc, info);
if (IS_ERR(info->pctl_dev)) { if (IS_ERR(info->pctl_dev)) {
dev_err(&pdev->dev, "could not register pinctrl driver\n"); dev_err(dev, "could not register pinctrl driver\n");
return PTR_ERR(info->pctl_dev); return PTR_ERR(info->pctl_dev);
} }
...@@ -2513,8 +2504,9 @@ static struct rockchip_pin_ctrl *rockchip_pinctrl_get_soc_data( ...@@ -2513,8 +2504,9 @@ static struct rockchip_pin_ctrl *rockchip_pinctrl_get_soc_data(
struct rockchip_pinctrl *d, struct rockchip_pinctrl *d,
struct platform_device *pdev) struct platform_device *pdev)
{ {
struct device *dev = &pdev->dev;
struct device_node *node = dev->of_node;
const struct of_device_id *match; const struct of_device_id *match;
struct device_node *node = pdev->dev.of_node;
struct rockchip_pin_ctrl *ctrl; struct rockchip_pin_ctrl *ctrl;
struct rockchip_pin_bank *bank; struct rockchip_pin_bank *bank;
int grf_offs, pmu_offs, drv_grf_offs, drv_pmu_offs, i, j; int grf_offs, pmu_offs, drv_grf_offs, drv_pmu_offs, i, j;
...@@ -2566,7 +2558,7 @@ static struct rockchip_pin_ctrl *rockchip_pinctrl_get_soc_data( ...@@ -2566,7 +2558,7 @@ static struct rockchip_pin_ctrl *rockchip_pinctrl_get_soc_data(
drv_pmu_offs : drv_grf_offs; drv_pmu_offs : drv_grf_offs;
} }
dev_dbg(d->dev, "bank %d, iomux %d has iom_offset 0x%x drv_offset 0x%x\n", dev_dbg(dev, "bank %d, iomux %d has iom_offset 0x%x drv_offset 0x%x\n",
i, j, iom->offset, drv->offset); i, j, iom->offset, drv->offset);
/* /*
...@@ -2675,8 +2667,8 @@ static int rockchip_pinctrl_probe(struct platform_device *pdev) ...@@ -2675,8 +2667,8 @@ static int rockchip_pinctrl_probe(struct platform_device *pdev)
{ {
struct rockchip_pinctrl *info; struct rockchip_pinctrl *info;
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct device_node *np = dev->of_node, *node;
struct rockchip_pin_ctrl *ctrl; struct rockchip_pin_ctrl *ctrl;
struct device_node *np = pdev->dev.of_node, *node;
struct resource *res; struct resource *res;
void __iomem *base; void __iomem *base;
int ret; int ret;
...@@ -2712,8 +2704,8 @@ static int rockchip_pinctrl_probe(struct platform_device *pdev) ...@@ -2712,8 +2704,8 @@ static int rockchip_pinctrl_probe(struct platform_device *pdev)
rockchip_regmap_config.max_register = resource_size(res) - 4; rockchip_regmap_config.max_register = resource_size(res) - 4;
rockchip_regmap_config.name = "rockchip,pinctrl"; rockchip_regmap_config.name = "rockchip,pinctrl";
info->regmap_base = devm_regmap_init_mmio(&pdev->dev, base, info->regmap_base =
&rockchip_regmap_config); devm_regmap_init_mmio(dev, base, &rockchip_regmap_config);
/* to check for the old dt-bindings */ /* to check for the old dt-bindings */
info->reg_size = resource_size(res); info->reg_size = resource_size(res);
...@@ -2725,12 +2717,10 @@ static int rockchip_pinctrl_probe(struct platform_device *pdev) ...@@ -2725,12 +2717,10 @@ static int rockchip_pinctrl_probe(struct platform_device *pdev)
if (IS_ERR(base)) if (IS_ERR(base))
return PTR_ERR(base); return PTR_ERR(base);
rockchip_regmap_config.max_register = rockchip_regmap_config.max_register = resource_size(res) - 4;
resource_size(res) - 4;
rockchip_regmap_config.name = "rockchip,pinctrl-pull"; rockchip_regmap_config.name = "rockchip,pinctrl-pull";
info->regmap_pull = devm_regmap_init_mmio(&pdev->dev, info->regmap_pull =
base, devm_regmap_init_mmio(dev, base, &rockchip_regmap_config);
&rockchip_regmap_config);
} }
} }
...@@ -2750,7 +2740,7 @@ static int rockchip_pinctrl_probe(struct platform_device *pdev) ...@@ -2750,7 +2740,7 @@ static int rockchip_pinctrl_probe(struct platform_device *pdev)
ret = of_platform_populate(np, rockchip_bank_match, NULL, NULL); ret = of_platform_populate(np, rockchip_bank_match, NULL, NULL);
if (ret) { if (ret) {
dev_err(&pdev->dev, "failed to register gpio device\n"); dev_err(dev, "failed to register gpio device\n");
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment