From 98aed08e16c5f18d0c31fc07127bc163ccd0d04c Mon Sep 17 00:00:00 2001 From: Jean Pihet Date: Thu, 4 Oct 2012 18:47:11 +0200 Subject: ARM: OMAP: SmartReflex: pass device dependent data via platform data Remove the device dependent code (ex. cpu_is_xxx()) and settings from the driver code and instead pass them via the platform data. This allows a clean separation of the driver code and the platform code, as required by the move of the platform header files to include/linux/platform_data. Note about the smartreflex functional clocks: the smartreflex fclks are derived from sys_clk and have the same name as the main_clk from the hwmod entry, in order for the SmartReflex driver to request the fclk (using clk_get(dev, "fck")). Signed-off-by: Jean Pihet Signed-off-by: Kevin Hilman --- drivers/power/avs/smartreflex.c | 54 +++++++++++++---------------------------- 1 file changed, 17 insertions(+), 37 deletions(-) (limited to 'drivers') diff --git a/drivers/power/avs/smartreflex.c b/drivers/power/avs/smartreflex.c index 24768a2..4c4519e 100644 --- a/drivers/power/avs/smartreflex.c +++ b/drivers/power/avs/smartreflex.c @@ -130,24 +130,21 @@ static irqreturn_t sr_interrupt(int irq, void *data) static void sr_set_clk_length(struct omap_sr *sr) { - struct clk *sys_ck; - u32 sys_clk_speed; + struct clk *fck; + u32 fclk_speed; - if (cpu_is_omap34xx()) - sys_ck = clk_get(NULL, "sys_ck"); - else - sys_ck = clk_get(NULL, "sys_clkin_ck"); + fck = clk_get(&sr->pdev->dev, "fck"); - if (IS_ERR(sys_ck)) { - dev_err(&sr->pdev->dev, "%s: unable to get sys clk\n", - __func__); + if (IS_ERR(fck)) { + dev_err(&sr->pdev->dev, "%s: unable to get fck for device %s\n", + __func__, dev_name(&sr->pdev->dev)); return; } - sys_clk_speed = clk_get_rate(sys_ck); - clk_put(sys_ck); + fclk_speed = clk_get_rate(fck); + clk_put(fck); - switch (sys_clk_speed) { + switch (fclk_speed) { case 12000000: sr->clk_length = SRCLKLENGTH_12MHZ_SYSCLK; break; @@ -164,34 +161,12 @@ static void sr_set_clk_length(struct omap_sr *sr) sr->clk_length = SRCLKLENGTH_38MHZ_SYSCLK; break; default: - dev_err(&sr->pdev->dev, "%s: Invalid sysclk value: %d\n", - __func__, sys_clk_speed); + dev_err(&sr->pdev->dev, "%s: Invalid fclk rate: %d\n", + __func__, fclk_speed); break; } } -static void sr_set_regfields(struct omap_sr *sr) -{ - /* - * For time being these values are defined in smartreflex.h - * and populated during init. May be they can be moved to board - * file or pmic specific data structure. In that case these structure - * fields will have to be populated using the pdata or pmic structure. - */ - if (cpu_is_omap34xx() || cpu_is_omap44xx()) { - sr->err_weight = OMAP3430_SR_ERRWEIGHT; - sr->err_maxlimit = OMAP3430_SR_ERRMAXLIMIT; - sr->accum_data = OMAP3430_SR_ACCUMDATA; - if (!(strcmp(sr->name, "smartreflex_mpu_iva"))) { - sr->senn_avgweight = OMAP3430_SR1_SENNAVGWEIGHT; - sr->senp_avgweight = OMAP3430_SR1_SENPAVGWEIGHT; - } else { - sr->senn_avgweight = OMAP3430_SR2_SENNAVGWEIGHT; - sr->senp_avgweight = OMAP3430_SR2_SENPAVGWEIGHT; - } - } -} - static void sr_start_vddautocomp(struct omap_sr *sr) { if (!sr_class || !(sr_class->enable) || !(sr_class->configure)) { @@ -924,8 +899,14 @@ static int __init omap_sr_probe(struct platform_device *pdev) sr_info->nvalue_count = pdata->nvalue_count; sr_info->senn_mod = pdata->senn_mod; sr_info->senp_mod = pdata->senp_mod; + sr_info->err_weight = pdata->err_weight; + sr_info->err_maxlimit = pdata->err_maxlimit; + sr_info->accum_data = pdata->accum_data; + sr_info->senn_avgweight = pdata->senn_avgweight; + sr_info->senp_avgweight = pdata->senp_avgweight; sr_info->autocomp_active = false; sr_info->ip_type = pdata->ip_type; + sr_info->base = ioremap(mem->start, resource_size(mem)); if (!sr_info->base) { dev_err(&pdev->dev, "%s: ioremap fail\n", __func__); @@ -937,7 +918,6 @@ static int __init omap_sr_probe(struct platform_device *pdev) sr_info->irq = irq->start; sr_set_clk_length(sr_info); - sr_set_regfields(sr_info); list_add(&sr_info->node, &sr_list); -- cgit v1.1 From 0a779abe875655625da46b2e45007ebf50d94d52 Mon Sep 17 00:00:00 2001 From: Tony Lindgren Date: Fri, 30 Nov 2012 08:41:35 -0800 Subject: watchdog: OMAP: fixup for ARM multiplatform support Recent changes to the omap_wdt.c removed the dependencies to the core omap code, but forgot to remove mach/hardware.h. We cannot include any plat headers with multiplatform support enabled. cc: Wim Van Sebroeck cc: linux-watchdog@vger.kernel.org Signed-off-by: Tony Lindgren --- drivers/watchdog/omap_wdt.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'drivers') diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c index 477a1d4..e5e7069 100644 --- a/drivers/watchdog/omap_wdt.c +++ b/drivers/watchdog/omap_wdt.c @@ -45,8 +45,6 @@ #include #include #include -#include - #include #include "omap_wdt.h" -- cgit v1.1 From 45c3eb7d3a07eb08d1b5b0f5983a996d41610b84 Mon Sep 17 00:00:00 2001 From: Tony Lindgren Date: Fri, 30 Nov 2012 08:41:50 -0800 Subject: ARM: OMAP: Move plat-omap/dma-omap.h to include/linux/omap-dma.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Based on earlier discussions[1] we attempted to find a suitable location for the omap DMA header in commit 2b6c4e73 (ARM: OMAP: DMA: Move plat/dma.h to plat-omap/dma-omap.h) until the conversion to dmaengine is complete. Unfortunately that was before I was able to try to test compile of the ARM multiplatform builds for omap2+, and the end result was not very good. So I'm creating yet another all over the place patch to cut the last dependency for building omap2+ for ARM multiplatform. After this, we have finally removed the driver dependencies to the arch/arm code, except for few drivers that are being worked on. The other option was to make the path to work, but we'd have to add some new header directory to for multiplatform builds. Or we would have to manually include arch/arm/plat-omap/include again from arch/arm/Makefile for omap2+. Neither of these alternatives sound appealing as they will likely lead addition of various other headers exposed to the drivers, which we want to avoid for the multiplatform kernels. Since we already have a minimal include/linux/omap-dma.h, let's just use that instead and add a note to it to not use the custom omap DMA functions any longer where possible. Note that converting omap DMA to dmaengine depends on dmaengine supporting automatically incrementing the FIFO address at the device end, and converting all the remaining legacy drivers. So it's going to be few more merge windows. [1] https://patchwork.kernel.org/patch/1519591/# cc: Russell King cc: Kevin Hilman cc: "BenoƮt Cousson" cc: Herbert Xu cc: "David S. Miller" cc: Vinod Koul cc: Dan Williams cc: Mauro Carvalho Chehab cc: Laurent Pinchart cc: Guennadi Liakhovetski cc: David Woodhouse cc: Kyungmin Park cc: Greg Kroah-Hartman cc: Tomi Valkeinen cc: Florian Tobias Schandinat cc: Hans Verkuil cc: Vaibhav Hiremath cc: Lokesh Vutla cc: Rusty Russell cc: Artem Bityutskiy cc: Afzal Mohammed cc: linux-crypto@vger.kernel.org cc: linux-media@vger.kernel.org cc: linux-mtd@lists.infradead.org cc: linux-usb@vger.kernel.org cc: linux-fbdev@vger.kernel.org Acked-by: Felipe Balbi Signed-off-by: Tony Lindgren --- drivers/crypto/omap-aes.c | 2 +- drivers/crypto/omap-sham.c | 2 +- drivers/dma/omap-dma.c | 2 -- drivers/media/platform/omap/omap_vout.c | 2 +- drivers/media/platform/omap/omap_vout_vrfb.c | 2 +- drivers/media/platform/omap3isp/ispstat.h | 2 +- drivers/media/platform/soc_camera/omap1_camera.c | 2 +- drivers/mtd/nand/omap2.c | 1 - drivers/mtd/onenand/omap2.c | 2 +- drivers/usb/gadget/omap_udc.c | 2 +- drivers/usb/musb/tusb6010_omap.c | 2 +- drivers/video/omap/lcdc.c | 2 +- drivers/video/omap/omapfb_main.c | 2 +- drivers/video/omap/sossi.c | 2 +- 14 files changed, 12 insertions(+), 15 deletions(-) (limited to 'drivers') diff --git a/drivers/crypto/omap-aes.c b/drivers/crypto/omap-aes.c index 649a146..e66e8ee 100644 --- a/drivers/crypto/omap-aes.c +++ b/drivers/crypto/omap-aes.c @@ -29,7 +29,7 @@ #include #include -#include +#include /* OMAP TRM gives bitfields as start:end, where start is the higher bit number. For example 7:0 */ diff --git a/drivers/crypto/omap-sham.c b/drivers/crypto/omap-sham.c index d76fe06..1d75e6f 100644 --- a/drivers/crypto/omap-sham.c +++ b/drivers/crypto/omap-sham.c @@ -37,7 +37,7 @@ #include #include -#include +#include #include #define SHA_REG_DIGEST(x) (0x00 + ((x) * 0x04)) diff --git a/drivers/dma/omap-dma.c b/drivers/dma/omap-dma.c index 7d35c23..5a31264 100644 --- a/drivers/dma/omap-dma.c +++ b/drivers/dma/omap-dma.c @@ -19,8 +19,6 @@ #include "virt-dma.h" -#include - struct omap_dmadev { struct dma_device ddev; spinlock_t lock; diff --git a/drivers/media/platform/omap/omap_vout.c b/drivers/media/platform/omap/omap_vout.c index 4b1becc..9935040 100644 --- a/drivers/media/platform/omap/omap_vout.c +++ b/drivers/media/platform/omap/omap_vout.c @@ -45,7 +45,7 @@ #include #include -#include +#include #include