From: Tony Lindgren <tony@atomide.com>
Date: Tue, 4 Oct 2011 16:47:06 +0000 (-0700)
Subject: Merge branches 'cleanup-part3', 'voltage', 'dmtimer' and 'l3' into dt-base
X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=c541c15fb5ab48c47bc9b90121538fd30d152f23;p=linux.git

Merge branches 'cleanup-part3', 'voltage', 'dmtimer' and 'l3' into dt-base
---

c541c15fb5ab48c47bc9b90121538fd30d152f23
diff --cc arch/arm/mach-omap2/board-2430sdp.c
index f79b7d2a8ed42,45dafe2e8552a,618216c8f7427,618216c8f7427,2028464cf5b90..d934169d65537
--- a/arch/arm/mach-omap2/board-2430sdp.c
+++ b/arch/arm/mach-omap2/board-2430sdp.c
@@@@@@ -259,8 -247,8 -253,8 -253,8 -258,8 +248,8 @@@@@@ MACHINE_START(OMAP_2430SDP, "OMAP2430 s
     	/* Maintainer: Syed Khasim - Texas Instruments Inc */
     	.boot_params	= 0x80000100,
     	.reserve	= omap_reserve,
- ---	.map_io		= omap_2430sdp_map_io,
-   -	.init_early	= omap_2430sdp_init_early,
+ +++	.map_io		= omap243x_map_io,
+   +	.init_early	= omap2430_init_early,
     	.init_irq	= omap2_init_irq,
     	.init_machine	= omap_2430sdp_init,
     	.timer		= &omap2_timer,
diff --cc arch/arm/mach-omap2/board-4430sdp.c
index 9e423ac74997f,44a3e2c7b58bd,ab19d305f61e2,ab19d305f61e2,c7cef44c75d4e..a97c29a73edd5
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@@@@@ -840,8 -829,8 -835,8 -835,8 -840,8 +829,8 @@@@@@ MACHINE_START(OMAP_4430SDP, "OMAP4430 4
     	/* Maintainer: Santosh Shilimkar - Texas Instruments Inc */
     	.boot_params	= 0x80000100,
     	.reserve	= omap_reserve,
- ---	.map_io		= omap_4430sdp_map_io,
-   -	.init_early	= omap_4430sdp_init_early,
+ +++	.map_io		= omap4_map_io,
+   +	.init_early	= omap4430_init_early,
     	.init_irq	= gic_init_irq,
     	.init_machine	= omap_4430sdp_init,
     	.timer		= &omap4_timer,
diff --cc arch/arm/mach-omap2/pm.c
index 472bf22d5e848,25b8c7f43852c,d34fc5206b4a1,472bf22d5e848,472bf22d5e848..0844e2ecfb4ab
--- a/arch/arm/mach-omap2/pm.c
+++ b/arch/arm/mach-omap2/pm.c
@@@@@@ -181,9 -181,9 -181,9 -181,9 -181,9 +181,9 @@@@@@ static int __init omap2_set_init_voltag
     		goto exit;
     	}
     
-- --	voltdm = omap_voltage_domain_lookup(vdd_name);
++ ++	voltdm = voltdm_lookup(vdd_name);
     	if (IS_ERR(voltdm)) {
- ---		printk(KERN_ERR "%s: Unable to get vdd pointer for vdd_%s\n",
+ +++		pr_err("%s: unable to get vdd pointer for vdd_%s\n",
     			__func__, vdd_name);
     		goto exit;
     	}
diff --cc arch/arm/mach-omap2/timer.c
index cf1de7d2630d6,cf1de7d2630d6,cf1de7d2630d6,1140e98c97736,cf1de7d2630d6..e49fc7be2229b
--- a/arch/arm/mach-omap2/timer.c
+++ b/arch/arm/mach-omap2/timer.c
@@@@@@ -341,3 -341,3 -341,3 -347,167 -341,3 +347,167 @@@@@@ static void __init omap4_timer_init(voi
     }
     OMAP_SYS_TIMER(4)
     #endif
+++ +
+++ +/**
+++ + * omap2_dm_timer_set_src - change the timer input clock source
+++ + * @pdev:	timer platform device pointer
+++ + * @source:	array index of parent clock source
+++ + */
+++ +static int omap2_dm_timer_set_src(struct platform_device *pdev, int source)
+++ +{
+++ +	int ret;
+++ +	struct dmtimer_platform_data *pdata = pdev->dev.platform_data;
+++ +	struct clk *fclk, *parent;
+++ +	char *parent_name = NULL;
+++ +
+++ +	fclk = clk_get(&pdev->dev, "fck");
+++ +	if (IS_ERR_OR_NULL(fclk)) {
+++ +		dev_err(&pdev->dev, "%s: %d: clk_get() FAILED\n",
+++ +				__func__, __LINE__);
+++ +		return -EINVAL;
+++ +	}
+++ +
+++ +	switch (source) {
+++ +	case OMAP_TIMER_SRC_SYS_CLK:
+++ +		parent_name = "sys_ck";
+++ +		break;
+++ +
+++ +	case OMAP_TIMER_SRC_32_KHZ:
+++ +		parent_name = "32k_ck";
+++ +		break;
+++ +
+++ +	case OMAP_TIMER_SRC_EXT_CLK:
+++ +		if (pdata->timer_ip_version == OMAP_TIMER_IP_VERSION_1) {
+++ +			parent_name = "alt_ck";
+++ +			break;
+++ +		}
+++ +		dev_err(&pdev->dev, "%s: %d: invalid clk src.\n",
+++ +			__func__, __LINE__);
+++ +		clk_put(fclk);
+++ +		return -EINVAL;
+++ +	}
+++ +
+++ +	parent = clk_get(&pdev->dev, parent_name);
+++ +	if (IS_ERR_OR_NULL(parent)) {
+++ +		dev_err(&pdev->dev, "%s: %d: clk_get() %s FAILED\n",
+++ +			__func__, __LINE__, parent_name);
+++ +		clk_put(fclk);
+++ +		return -EINVAL;
+++ +	}
+++ +
+++ +	ret = clk_set_parent(fclk, parent);
+++ +	if (IS_ERR_VALUE(ret)) {
+++ +		dev_err(&pdev->dev, "%s: clk_set_parent() to %s FAILED\n",
+++ +			__func__, parent_name);
+++ +		ret = -EINVAL;
+++ +	}
+++ +
+++ +	clk_put(parent);
+++ +	clk_put(fclk);
+++ +
+++ +	return ret;
+++ +}
+++ +
+++ +struct omap_device_pm_latency omap2_dmtimer_latency[] = {
+++ +	{
+++ +		.deactivate_func = omap_device_idle_hwmods,
+++ +		.activate_func   = omap_device_enable_hwmods,
+++ +		.flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
+++ +	},
+++ +};
+++ +
+++ +/**
+++ + * omap_timer_init - build and register timer device with an
+++ + * associated timer hwmod
+++ + * @oh:	timer hwmod pointer to be used to build timer device
+++ + * @user:	parameter that can be passed from calling hwmod API
+++ + *
+++ + * Called by omap_hwmod_for_each_by_class to register each of the timer
+++ + * devices present in the system. The number of timer devices is known
+++ + * by parsing through the hwmod database for a given class name. At the
+++ + * end of function call memory is allocated for timer device and it is
+++ + * registered to the framework ready to be proved by the driver.
+++ + */
+++ +static int __init omap_timer_init(struct omap_hwmod *oh, void *unused)
+++ +{
+++ +	int id;
+++ +	int ret = 0;
+++ +	char *name = "omap_timer";
+++ +	struct dmtimer_platform_data *pdata;
   - 	struct omap_device *od;
+++++	struct platform_device *pdev;
+++ +	struct omap_timer_capability_dev_attr *timer_dev_attr;
+++ +	struct powerdomain *pwrdm;
+++ +
+++ +	pr_debug("%s: %s\n", __func__, oh->name);
+++ +
+++ +	/* on secure device, do not register secure timer */
+++ +	timer_dev_attr = oh->dev_attr;
+++ +	if (omap_type() != OMAP2_DEVICE_TYPE_GP && timer_dev_attr)
+++ +		if (timer_dev_attr->timer_capability == OMAP_TIMER_SECURE)
+++ +			return ret;
+++ +
+++ +	pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
+++ +	if (!pdata) {
+++ +		pr_err("%s: No memory for [%s]\n", __func__, oh->name);
+++ +		return -ENOMEM;
+++ +	}
+++ +
+++ +	/*
+++ +	 * Extract the IDs from name field in hwmod database
+++ +	 * and use the same for constructing ids' for the
+++ +	 * timer devices. In a way, we are avoiding usage of
+++ +	 * static variable witin the function to do the same.
+++ +	 * CAUTION: We have to be careful and make sure the
+++ +	 * name in hwmod database does not change in which case
+++ +	 * we might either make corresponding change here or
+++ +	 * switch back static variable mechanism.
+++ +	 */
+++ +	sscanf(oh->name, "timer%2d", &id);
+++ +
+++ +	pdata->set_timer_src = omap2_dm_timer_set_src;
+++ +	pdata->timer_ip_version = oh->class->rev;
+++ +
+++ +	/* Mark clocksource and clockevent timers as reserved */
+++ +	if ((sys_timer_reserved >> (id - 1)) & 0x1)
+++ +		pdata->reserved = 1;
+++ +
+++ +	pwrdm = omap_hwmod_get_pwrdm(oh);
+++ +	pdata->loses_context = pwrdm_can_ever_lose_context(pwrdm);
+++ +#ifdef CONFIG_PM
+++ +	pdata->get_context_loss_count = omap_pm_get_dev_context_loss_count;
+++ +#endif
   - 	od = omap_device_build(name, id, oh, pdata, sizeof(*pdata),
+++++	pdev = omap_device_build(name, id, oh, pdata, sizeof(*pdata),
+++ +			omap2_dmtimer_latency,
+++ +			ARRAY_SIZE(omap2_dmtimer_latency),
+++ +			0);
+++ +
   - 	if (IS_ERR(od)) {
+++++	if (IS_ERR(pdev)) {
+++ +		pr_err("%s: Can't build omap_device for %s: %s.\n",
+++ +			__func__, name, oh->name);
+++ +		ret = -EINVAL;
+++ +	}
+++ +
+++ +	kfree(pdata);
+++ +
+++ +	return ret;
+++ +}
+++ +
+++ +/**
+++ + * omap2_dm_timer_init - top level regular device initialization
+++ + *
+++ + * Uses dedicated hwmod api to parse through hwmod database for
+++ + * given class name and then build and register the timer device.
+++ + */
+++ +static int __init omap2_dm_timer_init(void)
+++ +{
+++ +	int ret;
+++ +
+++ +	ret = omap_hwmod_for_each_by_class("timer", omap_timer_init, NULL);
+++ +	if (unlikely(ret)) {
+++ +		pr_err("%s: device registration failed.\n", __func__);
+++ +		return -EINVAL;
+++ +	}
+++ +
+++ +	return 0;
+++ +}
+++ +arch_initcall(omap2_dm_timer_init);
diff --cc arch/arm/mach-omap2/usb-musb.c
index 19e4dac62a8c1,a65145b02a558,a65145b02a558,a65145b02a558,a65145b02a558..d86af3cda8c78
--- a/arch/arm/mach-omap2/usb-musb.c
+++ b/arch/arm/mach-omap2/usb-musb.c
@@@@@@ -115,7 -115,7 -115,7 -115,7 -115,7 +115,6 @@@@@@ static struct omap_musb_board_data musb
     void __init usb_musb_init(struct omap_musb_board_data *musb_board_data)
     {
     	struct omap_hwmod		*oh;
-----	struct omap_device		*od;
     	struct platform_device		*pdev;
     	struct device			*dev;
     	int				bus_id = -1;
@@@@@@ -145,22 -148,22 -148,22 -148,22 -148,22 +144,20 @@@@@@
     		name = "musb-omap2430";
     	}
     
-----	oh = omap_hwmod_lookup(oh_name);
-----	if (!oh) {
-----		pr_err("Could not look up %s\n", oh_name);
-----		return;
-----	}
+++++        oh = omap_hwmod_lookup(oh_name);
+++++        if (WARN(!oh, "%s: could not find omap_hwmod for %s\n",
+++++                 __func__, oh_name))
+++++                return;
     
-----	od = omap_device_build(name, bus_id, oh, &musb_plat,
+++++	pdev = omap_device_build(name, bus_id, oh, &musb_plat,
     			       sizeof(musb_plat), omap_musb_latency,
     			       ARRAY_SIZE(omap_musb_latency), false);
-----	if (IS_ERR(od)) {
+++++	if (IS_ERR(pdev)) {
     		pr_err("Could not build omap_device for %s %s\n",
     						name, oh_name);
     		return;
     	}
     
-----	pdev = &od->pdev;
     	dev = &pdev->dev;
     	get_device(dev);
     	dev->dma_mask = &musb_dmamask;