RE: [PATCH 09/13 v5] OMAP: GPIO: Introduce support for OMAP2PLUS chip GPIO init

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

 




> -----Original Message-----
> From: Kevin Hilman [mailto:khilman@xxxxxxxxxxxxxxxxxxx]
> Sent: Tuesday, August 10, 2010 5:29 AM
> To: Varadarajan, Charulatha
> Cc: linux-omap@xxxxxxxxxxxxxxx; paul@xxxxxxxxx; Cousson, Benoit; Nayak,
> Rajendra; Basak, Partha
> Subject: Re: [PATCH 09/13 v5] OMAP: GPIO: Introduce support for OMAP2PLUS
> chip GPIO init
> 
> Charulatha V <charu@xxxxxx> writes:
> 
> > This patch adds support for handling GPIO as a HWMOD FW adapted
> > platform device for OMAP2PLUS chips.
> >
> > gpio_init needs to be done before machine_init functions access
> > gpio APIs.Hence gpio_init is made as a postcore_initcall.
> >
> > Signed-off-by: Charulatha V <charu@xxxxxx>
> > Signed-off-by: Basak, Partha <p-basak2@xxxxxx>
> > ---
> 
> [...]
> 
> > +static int omap2_init_gpio(struct omap_hwmod *oh, void *user)
> > +{
> > +	struct omap_device *od;
> > +	struct omap_gpio_platform_data *pdata;
> > +	char *name = "omap-gpio";
> > +	static int id;
> > +	struct omap_gpio_dev_attr *gpio_dev_data;
> > +
> > +	if (!oh) {
> > +		pr_err("Could not look up omap gpio %d\n", id + 1);
> > +		return -EINVAL;
> > +	}
> > +
> > +	pdata = kzalloc(sizeof(struct omap_gpio_platform_data),
> > +					GFP_KERNEL);
> > +	if (!pdata) {
> > +		pr_err("Memory allocation failed gpio%d\n", id + 1);
> > +		return -ENOMEM;
> > +	}
> > +
> > +	gpio_dev_data = (struct omap_gpio_dev_attr *)oh->dev_attr;
> > +
> > +	pdata->gpio_attr = gpio_dev_data;
> > +	pdata->virtual_irq_start = IH_GPIO_BASE + 32 * id;
> > +	switch (oh->class->rev) {
> > +	case 0:
> > +	case 1:
> > +		pdata->bank_type = METHOD_GPIO_24XX;
> > +		break;
> > +	case 2:
> > +		pdata->bank_type = METHOD_GPIO_44XX;
> > +		break;
> > +	default:
> > +		WARN(1, "Invalid gpio bank_type\n");
> > +		break;
> > +	}
> > +	gpio_bank_count++;
> > +
> > +	od = omap_device_build(name, id, oh, pdata,
> > +				sizeof(*pdata),	omap_gpio_latency,
> > +				ARRAY_SIZE(omap_gpio_latency),
> > +				false);
> > +	WARN(IS_ERR(od), "Cant build omap_device for %s:%s.\n",
> > +				name, oh->name);
> > +
> 
> pdata should be free'd here as omap_device_build makes a copy for
> itself.
> 

Okay.

> Kevin
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux