Message ID | 20220803054728.1541104-5-colin.foster@in-advantage.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | add support for VSC7512 control over SPI | expand |
On Wed, Aug 3, 2022 at 7:47 AM Colin Foster <colin.foster@in-advantage.com> wrote: > > There are a few Ocelot chips that contain pinctrl logic, but can be > controlled externally. Specifically the VSC7511, 7512, 7513 and 7514. In > the externally controlled configurations these registers are not > memory-mapped. > > Add support for these non-memory-mapped configurations. FWIW, Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> > Signed-off-by: Colin Foster <colin.foster@in-advantage.com> > Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com> > Acked-by: Linus Walleij <linus.walleij@linaro.org> > --- > > (No changes since v14) > > v14 > * Add Reviewed and Acked tags > > --- > drivers/pinctrl/pinctrl-ocelot.c | 16 +++++----------- > 1 file changed, 5 insertions(+), 11 deletions(-) > > diff --git a/drivers/pinctrl/pinctrl-ocelot.c b/drivers/pinctrl/pinctrl-ocelot.c > index d18047d2306d..80a3bba520cb 100644 > --- a/drivers/pinctrl/pinctrl-ocelot.c > +++ b/drivers/pinctrl/pinctrl-ocelot.c > @@ -10,6 +10,7 @@ > #include <linux/gpio/driver.h> > #include <linux/interrupt.h> > #include <linux/io.h> > +#include <linux/mfd/ocelot.h> > #include <linux/of_device.h> > #include <linux/of_irq.h> > #include <linux/of_platform.h> > @@ -1918,7 +1919,6 @@ static int ocelot_pinctrl_probe(struct platform_device *pdev) > struct ocelot_pinctrl *info; > struct reset_control *reset; > struct regmap *pincfg; > - void __iomem *base; > int ret; > struct regmap_config regmap_config = { > .reg_bits = 32, > @@ -1938,20 +1938,14 @@ static int ocelot_pinctrl_probe(struct platform_device *pdev) > "Failed to get reset\n"); > reset_control_reset(reset); > > - base = devm_ioremap_resource(dev, > - platform_get_resource(pdev, IORESOURCE_MEM, 0)); > - if (IS_ERR(base)) > - return PTR_ERR(base); > - > info->stride = 1 + (info->desc->npins - 1) / 32; > > regmap_config.max_register = OCELOT_GPIO_SD_MAP * info->stride + 15 * 4; > > - info->map = devm_regmap_init_mmio(dev, base, ®map_config); > - if (IS_ERR(info->map)) { > - dev_err(dev, "Failed to create regmap\n"); > - return PTR_ERR(info->map); > - } > + info->map = ocelot_regmap_from_resource(pdev, 0, ®map_config); > + if (IS_ERR(info->map)) > + return dev_err_probe(dev, PTR_ERR(info->map), > + "Failed to create regmap\n"); > dev_set_drvdata(dev, info->map); > info->dev = dev; > > -- > 2.25.1 >
diff --git a/drivers/pinctrl/pinctrl-ocelot.c b/drivers/pinctrl/pinctrl-ocelot.c index d18047d2306d..80a3bba520cb 100644 --- a/drivers/pinctrl/pinctrl-ocelot.c +++ b/drivers/pinctrl/pinctrl-ocelot.c @@ -10,6 +10,7 @@ #include <linux/gpio/driver.h> #include <linux/interrupt.h> #include <linux/io.h> +#include <linux/mfd/ocelot.h> #include <linux/of_device.h> #include <linux/of_irq.h> #include <linux/of_platform.h> @@ -1918,7 +1919,6 @@ static int ocelot_pinctrl_probe(struct platform_device *pdev) struct ocelot_pinctrl *info; struct reset_control *reset; struct regmap *pincfg; - void __iomem *base; int ret; struct regmap_config regmap_config = { .reg_bits = 32, @@ -1938,20 +1938,14 @@ static int ocelot_pinctrl_probe(struct platform_device *pdev) "Failed to get reset\n"); reset_control_reset(reset); - base = devm_ioremap_resource(dev, - platform_get_resource(pdev, IORESOURCE_MEM, 0)); - if (IS_ERR(base)) - return PTR_ERR(base); - info->stride = 1 + (info->desc->npins - 1) / 32; regmap_config.max_register = OCELOT_GPIO_SD_MAP * info->stride + 15 * 4; - info->map = devm_regmap_init_mmio(dev, base, ®map_config); - if (IS_ERR(info->map)) { - dev_err(dev, "Failed to create regmap\n"); - return PTR_ERR(info->map); - } + info->map = ocelot_regmap_from_resource(pdev, 0, ®map_config); + if (IS_ERR(info->map)) + return dev_err_probe(dev, PTR_ERR(info->map), + "Failed to create regmap\n"); dev_set_drvdata(dev, info->map); info->dev = dev;