linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: jamie@jamieiles.com (Jamie Iles)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC/PATCH v2 07/13] dt: omap: create platform bus for omap devices
Date: Tue, 23 Aug 2011 10:07:05 +0100	[thread overview]
Message-ID: <20110823090705.GI2796@pulham.picochip.com> (raw)
In-Reply-To: <1314074021-25186-8-git-send-email-manjugk@ti.com>

Hi,

This creates a build failure for non-omap platforms as they don't know 
about struct omap_device_pm_latency, struct omap_hwmod etc.

An empty of_omap_device_create() as inline should do the trick.

Jamie

On Tue, Aug 23, 2011 at 10:03:35AM +0500, G, Manjunath Kondaiah wrote:
> 
> The omap devices will use HWMOD for fetching device information
> hence it needs to be handled seperately during platform bus
> creation during dt build.
> 
> Signed-off-by: G, Manjunath Kondaiah <manjugk@ti.com>
> ---
>  drivers/of/platform.c |   41 ++++++++++++++++++++++++++++++++++++++++-
>  1 files changed, 40 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/of/platform.c b/drivers/of/platform.c
> index e50ffcb..bd2c089 100644
> --- a/drivers/of/platform.c
> +++ b/drivers/of/platform.c
> @@ -24,6 +24,10 @@
>  #include <linux/of_platform.h>
>  #include <linux/platform_device.h>
>  
> +#ifdef CONFIG_ARCH_OMAP2PLUS
> +#include <plat/omap_device.h>
> +#endif
> +
>  const struct of_device_id of_default_bus_match_table[] = {
>  	{ .compatible = "simple-bus", },
>  #ifdef CONFIG_ARM_AMBA
> @@ -544,6 +548,36 @@ static const struct of_dev_auxdata *of_dev_lookup(const struct of_dev_auxdata *l
>  	return NULL;
>  }

#ifdef ARCH_OMAP

> +static struct omap_device_pm_latency omap_device_latency[] = {
> +	[0] = {
> +		.deactivate_func	= omap_device_idle_hwmods,
> +		.activate_func		= omap_device_enable_hwmods,
> +		.flags			= OMAP_DEVICE_LATENCY_AUTO_ADJUST,
> +	},
> +};
> +
> +int of_omap_device_create(struct device_node *np, const char *name, int id,
> +							void *platform_data,
> +							int pd_size)
> +{
> +	struct omap_hwmod *oh;
> +	struct platform_device *pdev;
> +
> +	oh = omap_hwmod_lookup(name);
> +	if (!oh) {
> +		pr_err("Could not look up %s\n", name);
> +		return -EEXIST;
> +	}
> +
> +	pdev = omap_device_build_dt(np, name, id, oh, platform_data,
> +				sizeof(platform_data), omap_device_latency,
> +				ARRAY_SIZE(omap_device_latency), 0);
> +	WARN(IS_ERR(pdev), "Could not build omap_device for %s\n", name);
> +
> +	pr_info("DT: omap_device build for %s is successful\n", name);
> +	return PTR_ERR(pdev);
> +}

#else /* ARCH_OMAP */
static inline int of_omap_device_create(struct device_node *np,
					const char *name, int id,
					void *platform_data, int pd_size)
{
	return -ENODEV;
}
#endif /* ARCH_OMAP */

> +
>  /**
>   * of_platform_bus_create() - Create a device for a node and its children.
>   * @bus: device node of the bus to instantiate
> @@ -565,7 +599,7 @@ static int of_platform_bus_create(struct device_node *bus,
>  	struct platform_device *dev;
>  	const char *bus_id = NULL;
>  	void *platform_data = NULL;
> -	int pd_size;
> +	int pd_size = 0;
>  	int id = -1;
>  	int rc = 0;
>  
> @@ -597,6 +631,11 @@ static int of_platform_bus_create(struct device_node *bus,
>  		return 0;
>  	}
>  
> +	if (of_device_is_compatible(bus, "ti,omap-device")) {
> +		of_omap_device_create(bus, bus_id, id, platform_data, pd_size);
> +		return 0;
> +	}
> +
>  	dev = of_platform_device_create_pdata(bus, bus_id, platform_data, parent);
>  
>  	/* override the id if auxdata gives an id */
> -- 
> 1.7.4.1
> 
> _______________________________________________
> devicetree-discuss mailing list
> devicetree-discuss at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/devicetree-discuss

  parent reply	other threads:[~2011-08-23  9:07 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1314074021-25186-1-git-send-email-manjugk@ti.com>
     [not found] ` <1314074021-25186-10-git-send-email-manjugk@ti.com>
2011-08-23  8:23   ` [RFC/PATCH v2 09/13] dt: omap4: add soc file for handling i2c controllers Rajendra Nayak
2011-08-23 15:11     ` G, Manjunath Kondaiah
     [not found]   ` <4E537FA7.3050609@ti.com>
2011-08-23 13:48     ` Fwd: " Cousson, Benoit
2011-08-23 15:18       ` G, Manjunath Kondaiah
2011-08-23 19:45         ` Cousson, Benoit
     [not found] ` <1314074021-25186-8-git-send-email-manjugk@ti.com>
2011-08-23  9:07   ` Jamie Iles [this message]
2011-08-23 15:19     ` [RFC/PATCH v2 07/13] dt: omap: create platform bus for omap devices G, Manjunath Kondaiah
     [not found] ` <4E537ECB.1060704@ti.com>
2011-08-23 12:38   ` [RFC/PATCH v2 00/13] dt: omap: dt binding with omap_device and support for i2c1 Cousson, Benoit
2011-08-23 15:41 ` G, Manjunath Kondaiah
2011-08-24  9:41   ` Cousson, Benoit
     [not found] ` <1314074021-25186-9-git-send-email-manjugk@ti.com>
2011-08-23 15:46   ` [RFC/PATCH v2 08/13] dt: omap: i2c: add dt support for i2c1 controller G, Manjunath Kondaiah
2011-09-01 17:34     ` Cousson, Benoit
2011-09-02  3:22       ` G, Manjunath Kondaiah
     [not found]   ` <4E537F53.4030405@ti.com>
2011-08-23 19:15     ` Fwd: " Cousson, Benoit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110823090705.GI2796@pulham.picochip.com \
    --to=jamie@jamieiles.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).