Re: [PATCH v4 5/6] pinctrl: amd: Add amd_get_iomux_res function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jun 01, 2022 at 01:38:40PM +0300, Andy Shevchenko wrote:
> On Wed, Jun 01, 2022 at 03:32:13PM +0530, Basavaraj Natikar wrote:
> > Presently there is no way to change pinmux configuration run time.
> > Hence add a function to get IOMUX resource which can be used to
> > configure IOMUX GPIO pins run time.

...

> > +static void amd_get_iomux_res(struct amd_gpio *gpio_dev)
> > +{
> > +	struct pinctrl_desc *desc = &amd_pinctrl_desc;
> > +	struct device *dev = &gpio_dev->pdev->dev;
> > +	struct resource *res;
> > +	int index;
> > +
> > +	index = device_property_match_string(dev, "pinctrl-resource-names",  "iomux");

> > +	if (index > 0) {

Btw, why > and not >= ? 0 is valid index.

> > +		res = platform_get_resource(gpio_dev->pdev, IORESOURCE_MEM, index);
> > +		if (!res) {
> > +			dev_warn(dev, "Failed to get iomux %d io resource\n", index);
> > +			return;
> > +		}
> > +
> > +		gpio_dev->iomux_base = devm_ioremap(dev, res->start, resource_size(res));
> > +		if (!gpio_dev->iomux_base) {
> > +			desc->pmxops = NULL;
> > +			dev_warn(dev, "failed to devm_ioremap() iomux_base\n");
> > +		}
> 
> 	iomux_base = devm_platform_ioremap_resource(..., index);
> 	if (IS_ERR(...))
> 		dev_warn();
> 
> > +	} else {
> > +		desc->pmxops = NULL;
> > +		dev_warn(dev, "failed to get iomux index\n");
> > +	}
> > +}

-- 
With Best Regards,
Andy Shevchenko





[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux