RE: [PATCH 06/11] omap4: Fix omap_l2_cache_init not to run for other omaps
Tony, -Original Message- From: linux-arm-kernel-boun...@lists.infradead.org [mailto:linux-arm-kernel- boun...@lists.infradead.org] On Behalf Of Tony Lindgren Sent: Saturday, May 01, 2010 2:04 AM To: linux-arm-ker...@lists.infradead.org Cc: linux-omap@vger.kernel.org Subject: [PATCH 06/11] omap4: Fix omap_l2_cache_init not to run for other omaps In multi-omap configuration all the initcalls run. To avoid bad things from happening with 44xx specific initcalls on other omaps, we need to check that the booted system is omap4 before running. Signed-off-by: Tony Lindgren t...@atomide.com --- arch/arm/mach-omap2/board-4430sdp.c |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c index b88f28c..e603b00 100644 --- a/arch/arm/mach-omap2/board-4430sdp.c +++ b/arch/arm/mach-omap2/board-4430sdp.c @@ -55,6 +55,9 @@ static int __init omap_l2_cache_init(void) extern void omap_smc1(u32 fn, u32 arg); void __iomem *l2cache_base; + if (!cpu_is_omap44xx()) + return -ENODEV; + This check is already present just 3 lines below. /* To avoid code running on other OMAPs in * multi-omap builds */ ___ linux-arm-kernel mailing list linux-arm-ker...@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH ] omap4: Move SOC specific code from board file
This patch moves OMAP4 soc specific code from 4430sdp board file. The change is necessary so that newer board support can be added with minimal changes. This will be also problematic for multi-board, multi-omap builds. Signed-off-by: Santosh Shilimkar santosh.shilim...@ti.com --- (Because veger issue this one never made to the list ) Boot tested with regular and multi-omap defconfig on OMAP4430 and OMAP3430 SDPs. Needs Tony's sram fix to make multi-omap boot on OMAP4. The patch is generated against mainline v2.6.34-rc6 arch/arm/mach-omap2/Makefile|2 +- arch/arm/mach-omap2/board-4430sdp.c | 47 +-- arch/arm/mach-omap2/include/mach/omap4-common.h | 26 arch/arm/mach-omap2/omap-smp.c |2 +- arch/arm/mach-omap2/omap4-common.c | 74 +++ arch/arm/plat-omap/common.c |3 - arch/arm/plat-omap/include/plat/common.h|3 - 7 files changed, 103 insertions(+), 54 deletions(-) create mode 100644 arch/arm/mach-omap2/include/mach/omap4-common.h create mode 100644 arch/arm/mach-omap2/omap4-common.c diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile index 4b9fc57..ffe600a 100644 --- a/arch/arm/mach-omap2/Makefile +++ b/arch/arm/mach-omap2/Makefile @@ -22,7 +22,7 @@ obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o # SMP support ONLY available for OMAP4 obj-$(CONFIG_SMP) += omap-smp.o omap-headsmp.o obj-$(CONFIG_LOCAL_TIMERS) += timer-mpu.o -obj-$(CONFIG_ARCH_OMAP4) += omap44xx-smc.o +obj-$(CONFIG_ARCH_OMAP4) += omap44xx-smc.o omap4-common.o AFLAGS_omap44xx-smc.o :=-Wa,-march=armv7-a diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c index b88f28c..0f8cd85 100644 --- a/arch/arm/mach-omap2/board-4430sdp.c +++ b/arch/arm/mach-omap2/board-4430sdp.c @@ -20,6 +20,7 @@ #include linux/usb/otg.h #include mach/hardware.h +#include mach/omap4-common.h #include asm/mach-types.h #include asm/mach/arch.h #include asm/mach/map.h @@ -29,8 +30,6 @@ #include plat/control.h #include plat/timer-gp.h #include plat/usb.h -#include asm/hardware/gic.h -#include asm/hardware/cache-l2x0.h static struct platform_device sdp4430_lcd_device = { .name = sdp4430_lcd, @@ -49,50 +48,6 @@ static struct omap_board_config_kernel sdp4430_config[] __initdata = { { OMAP_TAG_LCD, sdp4430_lcd_config }, }; -#ifdef CONFIG_CACHE_L2X0 -static int __init omap_l2_cache_init(void) -{ - extern void omap_smc1(u32 fn, u32 arg); - void __iomem *l2cache_base; - - /* To avoid code running on other OMAPs in -* multi-omap builds -*/ - if (!cpu_is_omap44xx()) - return -ENODEV; - - /* Static mapping, never released */ - l2cache_base = ioremap(OMAP44XX_L2CACHE_BASE, SZ_4K); - BUG_ON(!l2cache_base); - - /* Enable PL310 L2 Cache controller */ - omap_smc1(0x102, 0x1); - - /* 32KB way size, 16-way associativity, - * parity disabled - */ - l2x0_init(l2cache_base, 0x0e05, 0xcfff); - - return 0; -} -early_initcall(omap_l2_cache_init); -#endif - -static void __init gic_init_irq(void) -{ - void __iomem *base; - - /* Static mapping, never released */ - base = ioremap(OMAP44XX_GIC_DIST_BASE, SZ_4K); - BUG_ON(!base); - gic_dist_init(0, base, 29); - - /* Static mapping, never released */ - gic_cpu_base_addr = ioremap(OMAP44XX_GIC_CPU_BASE, SZ_512); - BUG_ON(!gic_cpu_base_addr); - gic_cpu_init(0, gic_cpu_base_addr); -} - static void __init omap_4430sdp_init_irq(void) { omap_board_config = sdp4430_config; diff --git a/arch/arm/mach-omap2/include/mach/omap4-common.h b/arch/arm/mach-omap2/include/mach/omap4-common.h new file mode 100644 index 000..423af3a --- /dev/null +++ b/arch/arm/mach-omap2/include/mach/omap4-common.h @@ -0,0 +1,26 @@ +/* + * omap4-common.h: OMAP4 specific common header file + * + * Copyright (C) 2010 Texas Instruments, Inc. + * + * Author: + * Santosh Shilimkar santosh.shilim...@ti.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ +#ifndef OMAP_ARCH_OMAP4_COMMON_H +#define OMAP_ARCH_OMAP4_COMMON_H + +#ifdef CONFIG_CACHE_L2X0 +extern void __iomem *l2cache_base; +#endif + +extern void __iomem *gic_cpu_base_addr; +extern void __iomem *gic_dist_base_addr; + +extern void __init gic_init_irq(void); +extern void omap_smc1(u32 fn, u32 arg); + +#endif diff --git a/arch/arm/mach-omap2/omap-smp.c b/arch/arm/mach-omap2/omap-smp.c index 38153e5..1cf5231 100644 --- a/arch/arm/mach-omap2/omap-smp.c +++ b/arch/arm/mach-omap2/omap-smp.c @@ -24,7 +24,7 @@ #include asm/localtimer.h #include asm/smp_scu.h #include
RE: ARM suspend to disk?
-Original Message- From: linux-omap-ow...@vger.kernel.org [mailto:linux-omap-ow...@vger.kernel.org] On Behalf Of Kevin Hilman Sent: Saturday, May 01, 2010 3:36 AM To: Cliff Brake Cc: Peter Tseng; linux-omap@vger.kernel.org Subject: Re: ARM suspend to disk? Cliff Brake cliff.br...@gmail.com writes: On Thu, Apr 29, 2010 at 1:58 PM, Kevin Hilman khil...@deeprootsystems.com wrote: What do you expect to gain from suspend-to-disk + snapshot boot that you don't already get from suspend-to-RAM using off-mode? On OMAP, with off-mode enabled, a suspend to RAM puts the entire OMAP into full-chip off, and essentially reboots the ARM when waking up from suspend (or idle) already. What does the resume process look like in off mode? Does the resume pass through the bootloader? If so, are the bits that detects resume from off available in U-boot? No, it does not pass through the boot loader. In general terms, resume from off-mode is the same to normal resume (from retention) except that some additional state has to be restored before continuing where you left off since the ARM core (as well as most the OMAP itself) was turned off. On suspend to disk topic, Raghu under Romit's guidance did a prototype few months back as part of his internship using some of the earlier ARM work. The whole system snapshot was stored to the MMC card and one can take that MMC card on another board and continue from where it was suspended. We should have these patches somewhere. Regards, Santosh -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
mailbox_mach dependency problem
Hi, There seems to be a problem with 'mailbox' and 'mailbox_mach' modules. When another module, like bridgedriver, uses mailbox stuff, only the 'mailbox' module is loaded which doesn't register the platform device. The easiest solution would be to make mailbox_mach built-in when mailbox is configured, however, mailbox_mach needs mailbox to be loaded. I tried to add a poke() function in mailbox_mach so that the module is loaded when mailbox is loaded, but apparently linux doesn't like loop dependencies: WARNING: Loop detected: kernel/arch/arm/mach-omap2/mailbox_mach.ko needs mailbox.ko which needs mailbox_mach.ko again! Any ideas how to solve this issue? -- Felipe Contreras -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 3/3] DSPBRIDGE: remove hw_prcm module and related functions
On Tue, Apr 6, 2010 at 8:54 PM, Guzman Lugo, Fernando x0095...@ti.com wrote: From 4fb9fc015cea65dcd47172a8b180f380fe86be46 Mon Sep 17 00:00:00 2001 From: Fernando Guzman Lugo x0095...@ti.com Date: Tue, 30 Mar 2010 21:37:21 -0600 Subject: [PATCH] DSPBRIDGE: remove hw_prcm module and related functions This patches removes TI hw_prcm module and related functions and replace them with kernel functions. As kernel functions are exported, pointer function are used to build without problem in case of building dspbridge as a module. Signed-off-by: Fernando Guzman Lugo x0095...@ti.com This is screwing things for me on a beagleboard: mem_ext_phys_pool_init: external physical memory map failed [ cut here ] WARNING: at mm/page_alloc.c:1813 __alloc_pages_nodemask+0x144/0x514() Modules linked in: bridgedriver(+) mailbox_mach mailbox [c002c3a0] (unwind_backtrace+0x0/0xd4) from [c004ce38] (warn_slowpath_common+0x48/0x60) [c004ce38] (warn_slowpath_common+0x48/0x60) from [c007cef0] (__alloc_pages_nodemask+0x144/0x514) [c007cef0] (__alloc_pages_nodemask+0x144/0x514) from [c002cafc] (__dma_alloc+0xc0/0x27c) [c002cafc] (__dma_alloc+0xc0/0x27c) from [c002cd30] (dma_alloc_coherent+0x54/0x60) [c002cd30] (dma_alloc_coherent+0x54/0x60) from [bf00d7f8] (mem_alloc_phys_mem+0xb0/0xcc [bridgedriver]) [bf00d7f8] (mem_alloc_phys_mem+0xb0/0xcc [bridgedriver]) from [bf01d530] (drv_request_resources+0x1bc/0x260 [bridgedriver]) [bf01d530] (drv_request_resources+0x1bc/0x260 [bridgedriver]) from [bf023370] (dsp_init+0x64/0xe8 [bridgedriver]) [bf023370] (dsp_init+0x64/0xe8 [bridgedriver]) from [bf028da8] (omap34_xx_bridge_probe+0x208/0x2d0 [bridgedriver]) [bf028da8] (omap34_xx_bridge_probe+0x208/0x2d0 [bridgedriver]) from [c01b3550] (platform_drv_probe+0x18/0x1c) [c01b3550] (platform_drv_probe+0x18/0x1c) from [c01b2748] (driver_probe_device+0xa0/0x14c) [c01b2748] (driver_probe_device+0xa0/0x14c) from [c01b2854] (__driver_attach+0x60/0x84) [c01b2854] (__driver_attach+0x60/0x84) from [c01b201c] (bus_for_each_dev+0x44/0x74) [c01b201c] (bus_for_each_dev+0x44/0x74) from [c01b1988] (bus_add_driver+0x9c/0x218) [c01b1988] (bus_add_driver+0x9c/0x218) from [c01b2b24] (driver_register+0xa8/0x134) [c01b2b24] (driver_register+0xa8/0x134) from [c0026330] (do_one_initcall+0x58/0x1a8) [c0026330] (do_one_initcall+0x58/0x1a8) from [c00713c8] (sys_init_module+0xb0/0x1dc) [c00713c8] (sys_init_module+0xb0/0x1dc) from [c0026dc0] (ret_fast_syscall+0x0/0x2c) ---[ end trace ec6c9b46b6f26ea2 ]--- shm reservation Failed cfg_get_dev_object: Failed, status 0x DSP Bridge driver initialization failed -- Felipe Contreras -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: omap-pm: omap3_pm_defconfig no longer booting on Overo
On 04/30/2010 10:12 PM, Peter Tseng wrote: On 04/30/2010 02:54 PM, Kevin Hilman wrote: Peter Tsengtsenpe...@gmail.com writes: Since the rc5 tag, omap3_pm_defconfig from the pm branch no longer boots on the Gumstix Overo. I am certain that a build back in the rc3 days worked. Unfortunately, I don't know about rc4, or anything that happenend in the intervening time. Any clues on how to fix? If necessary, I'll provide what info I can to help diagnose the issue if told what to do. First step is to enable CONFIG_LL_DEBUG and CONFIG_EARLYPRINTK in the defconfig (I should have these enabled by default in omap3_pm_defconfig) Then, boot adding 'earlyprintk' to your boot cmdline and post the resulting bootlog here. Here it is. (Forgot to also send to mailing list the first time around) Peter Tseng DISCLAIMER: I dont have a overo, so no idea if this would work.. but here you go.. Attached is a diff which probably will help you with the specific changes needed for making pm boot on overo. hope it helps.. a.diff is the change you would probably need for the overo file to fix it up once for all the patch file is cleaning up the unnecessary BUG() in resource34xx.c which caused the lockup - elegant fix will potentially need more cleaning up.. but lets just leave it at the fact that srf is going to go away in a month or so.. Regards, Nishanth Menon diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c index 8848c7c..a93ae3d 100644 --- a/arch/arm/mach-omap2/board-overo.c +++ b/arch/arm/mach-omap2/board-overo.c @@ -49,6 +49,8 @@ #include mux.h #include sdram-micron-mt46h32m32lf-6.h #include hsmmc.h +#include pm.h +#include omap3-opp.h #define OVERO_GPIO_BT_XGATE 15 #define OVERO_GPIO_W2W_NRESET 16 @@ -71,6 +73,26 @@ #include linux/spi/spi.h #include linux/spi/ads7846.h +/* + * FIXME: These are not the optimal setup values to be used on overo + * Hacked from board-3430sdp.c + */ +static struct prm_setup_vc omap3_setuptime_table = { + .clksetup = 0xff, + .voltsetup_time1 = 0xfff, + .voltsetup_time2 = 0xfff, + .voltoffset = 0xff, + .voltsetup2 = 0xff, + .vdd0_on = 0x30, + .vdd0_onlp = 0x20, + .vdd0_ret = 0x1e, + .vdd0_off = 0x00, + .vdd1_on = 0x2c, + .vdd1_onlp = 0x20, + .vdd1_ret = 0x1e, + .vdd1_off = 0x00, +}; + static struct omap2_mcspi_device_config ads7846_mcspi_config = { .turbo_mode = 0, .single_channel = 1, /* 0: slave, 1: master */ @@ -384,6 +406,8 @@ static void __init overo_init_irq(void) { omap_board_config = overo_config; omap_board_config_size = ARRAY_SIZE(overo_config); + omap3_pm_init_opp_table(); + omap3_pm_init_vc(omap3_setuptime_table); omap2_init_common_hw(mt46h32m32lf6_sdrc_params, mt46h32m32lf6_sdrc_params); omap_init_irq(); From 54d5b1b47560fc4d790834c760dc5140d48e25ab Mon Sep 17 00:00:00 2001 From: Nishanth Menon n...@ti.com Date: Sat, 1 May 2010 10:25:25 -0500 Subject: [RFC] [PATCH] OMAP3: PM: quickly hack fix up init_opp init_opp is seen to crash, in resource34xx.c BUG() causes a kernel oops when OPP layer is not registered! Original Report: http://marc.info/?l=linux-omapm=127268352116119w=2 Cc: Peter Tseng tsenpe...@gmail.com Cc: Kevin Hilman khil...@deeprootsystems.com Reported-by: Peter Tseng tsenpe...@gmail.com Signed-off-by: Nishanth Menon n...@ti.com --- Completely untested!! just for a dry-run and srf is going to go off in a month, so this is more or less a curio.. arch/arm/mach-omap2/resource34xx.c | 26 -- 1 files changed, 24 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-omap2/resource34xx.c b/arch/arm/mach-omap2/resource34xx.c index c6cce8b..2297385 100644 --- a/arch/arm/mach-omap2/resource34xx.c +++ b/arch/arm/mach-omap2/resource34xx.c @@ -226,14 +226,36 @@ void init_opp(struct shared_resource *resp) dpll1_clk = clk_get(NULL, dpll1_ck); dpll2_clk = clk_get(NULL, dpll2_ck); ret = freq_to_opp(opp_id, OPP_MPU, dpll1_clk-rate); - BUG_ON(ret); /* TBD Cleanup handling */ + if (ret) { + pr_err(%s: initializing %s failed! !match for %ld\n, +__func__, resp-name, dpll1_clk-rate); + if (dpll1_clk) +clk_put(dpll1_clk); + if (dpll2_clk) +clk_put(dpll2_clk); + dpll1_clk = NULL; + dpll2_clk = NULL; + vdd1_resp = NULL; + return; + } curr_vdd1_opp = opp_id; } else if (strcmp(resp-name, vdd2_opp) == 0) { vdd2_resp = resp; dpll3_clk = clk_get(NULL, dpll3_m2_ck); l3_clk = clk_get(NULL, l3_ick); ret = freq_to_opp(opp_id, OPP_L3, l3_clk-rate); - BUG_ON(ret); /* TBD Cleanup handling */ + if (ret) { + pr_err(%s: initializing %s failed! !match for %ld\n, +__func__, resp-name, l3_clk-rate); + if (l3_clk) +clk_put(l3_clk); + if (dpll3_clk) +clk_put(dpll3_clk); + l3_clk = NULL; + dpll3_clk = NULL; + vdd1_resp = NULL; + return; + } curr_vdd2_opp = opp_id; } resp-curr_level = opp_id; -- 1.7.0.4
Re: [PATCH 3/3] DSPBRIDGE: remove hw_prcm module and related functions
On 05/01/2010 10:27 AM, Felipe Contreras wrote: On Tue, Apr 6, 2010 at 8:54 PM, Guzman Lugo, Fernandox0095...@ti.com wrote: From 4fb9fc015cea65dcd47172a8b180f380fe86be46 Mon Sep 17 00:00:00 2001 From: Fernando Guzman Lugox0095...@ti.com Date: Tue, 30 Mar 2010 21:37:21 -0600 Subject: [PATCH] DSPBRIDGE: remove hw_prcm module and related functions This patches removes TI hw_prcm module and related functions and replace them with kernel functions. As kernel functions are exported, pointer function are used to build without problem in case of building dspbridge as a module. Signed-off-by: Fernando Guzman Lugox0095...@ti.com This is screwing things for me on a beagleboard: mem_ext_phys_pool_init: external physical memory map failed this is interesting - we ran out of IOremap memory?? [ cut here ] WARNING: at mm/page_alloc.c:1813 __alloc_pages_nodemask+0x144/0x514() Modules linked in: bridgedriver(+) mailbox_mach mailbox [c002c3a0] (unwind_backtrace+0x0/0xd4) from [c004ce38] (warn_slowpath_common+0x48/0x60) [c004ce38] (warn_slowpath_common+0x48/0x60) from [c007cef0] (__alloc_pages_nodemask+0x144/0x514) [c007cef0] (__alloc_pages_nodemask+0x144/0x514) from [c002cafc] (__dma_alloc+0xc0/0x27c) [c002cafc] (__dma_alloc+0xc0/0x27c) from [c002cd30] (dma_alloc_coherent+0x54/0x60) [c002cd30] (dma_alloc_coherent+0x54/0x60) from [bf00d7f8] (mem_alloc_phys_mem+0xb0/0xcc [bridgedriver]) [bf00d7f8] (mem_alloc_phys_mem+0xb0/0xcc [bridgedriver]) from [bf01d530] (drv_request_resources+0x1bc/0x260 [bridgedriver]) [bf01d530] (drv_request_resources+0x1bc/0x260 [bridgedriver]) from [bf023370] (dsp_init+0x64/0xe8 [bridgedriver]) [bf023370] (dsp_init+0x64/0xe8 [bridgedriver]) from [bf028da8] (omap34_xx_bridge_probe+0x208/0x2d0 [bridgedriver]) [bf028da8] (omap34_xx_bridge_probe+0x208/0x2d0 [bridgedriver]) from [c01b3550] (platform_drv_probe+0x18/0x1c) [c01b3550] (platform_drv_probe+0x18/0x1c) from [c01b2748] (driver_probe_device+0xa0/0x14c) [c01b2748] (driver_probe_device+0xa0/0x14c) from [c01b2854] (__driver_attach+0x60/0x84) [c01b2854] (__driver_attach+0x60/0x84) from [c01b201c] (bus_for_each_dev+0x44/0x74) [c01b201c] (bus_for_each_dev+0x44/0x74) from [c01b1988] (bus_add_driver+0x9c/0x218) [c01b1988] (bus_add_driver+0x9c/0x218) from [c01b2b24] (driver_register+0xa8/0x134) [c01b2b24] (driver_register+0xa8/0x134) from [c0026330] (do_one_initcall+0x58/0x1a8) [c0026330] (do_one_initcall+0x58/0x1a8) from [c00713c8] (sys_init_module+0xb0/0x1dc) [c00713c8] (sys_init_module+0xb0/0x1dc) from [c0026dc0] (ret_fast_syscall+0x0/0x2c) ---[ end trace ec6c9b46b6f26ea2 ]--- shm reservation Failed cfg_get_dev_object: Failed, status 0x DSP Bridge driver initialization failed -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] OMAP3: PM: quickly hack fix up init_opp
init_opp is seen to crash, in resource34xx.c BUG() causes a kernel oops when OPP layer is not registered! Original Report: http://marc.info/?l=linux-omapm=127268352116119w=2 Cc: Peter Tseng tsenpe...@gmail.com Cc: Kevin Hilman khil...@deeprootsystems.com Reported-by: Peter Tseng tsenpe...@gmail.com Signed-off-by: Nishanth Menon n...@ti.com --- IMPORTANT: Completely untested!! just for a dry-run and srf is going to go away in a month, so this is more or less a curio.. arch/arm/mach-omap2/resource34xx.c | 26 -- 1 files changed, 24 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-omap2/resource34xx.c b/arch/arm/mach-omap2/resource34xx.c index c6cce8b..ae8bd09 100644 --- a/arch/arm/mach-omap2/resource34xx.c +++ b/arch/arm/mach-omap2/resource34xx.c @@ -226,14 +226,36 @@ void init_opp(struct shared_resource *resp) dpll1_clk = clk_get(NULL, dpll1_ck); dpll2_clk = clk_get(NULL, dpll2_ck); ret = freq_to_opp(opp_id, OPP_MPU, dpll1_clk-rate); - BUG_ON(ret); /* TBD Cleanup handling */ + if (ret) { + pr_err(%s: initializing %s failed! !match for %ld\n, + __func__, resp-name, dpll1_clk-rate); + if (dpll1_clk) + clk_put(dpll1_clk); + if (dpll2_clk) + clk_put(dpll2_clk); + dpll1_clk = NULL; + dpll2_clk = NULL; + vdd1_resp = NULL; + return; + } curr_vdd1_opp = opp_id; } else if (strcmp(resp-name, vdd2_opp) == 0) { vdd2_resp = resp; dpll3_clk = clk_get(NULL, dpll3_m2_ck); l3_clk = clk_get(NULL, l3_ick); ret = freq_to_opp(opp_id, OPP_L3, l3_clk-rate); - BUG_ON(ret); /* TBD Cleanup handling */ + if (ret) { + pr_err(%s: initializing %s failed! !match for %ld\n, + __func__, resp-name, l3_clk-rate); + if (l3_clk) + clk_put(l3_clk); + if (dpll3_clk) + clk_put(dpll3_clk); + l3_clk = NULL; + dpll3_clk = NULL; + vdd2_resp = NULL; + return; + } curr_vdd2_opp = opp_id; } resp-curr_level = opp_id; -- 1.7.0.4 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 3/3] DSPBRIDGE: remove hw_prcm module and related functions
On Sat, May 1, 2010 at 6:34 PM, Nishanth Menon menon.nisha...@gmail.com wrote: On 05/01/2010 10:27 AM, Felipe Contreras wrote: On Tue, Apr 6, 2010 at 8:54 PM, Guzman Lugo, Fernandox0095...@ti.com wrote: From 4fb9fc015cea65dcd47172a8b180f380fe86be46 Mon Sep 17 00:00:00 2001 From: Fernando Guzman Lugox0095...@ti.com Date: Tue, 30 Mar 2010 21:37:21 -0600 Subject: [PATCH] DSPBRIDGE: remove hw_prcm module and related functions This patches removes TI hw_prcm module and related functions and replace them with kernel functions. As kernel functions are exported, pointer function are used to build without problem in case of building dspbridge as a module. Signed-off-by: Fernando Guzman Lugox0095...@ti.com This is screwing things for me on a beagleboard: mem_ext_phys_pool_init: external physical memory map failed this is interesting - we ran out of IOremap memory?? Disregard that. I tested by recompiling only the bridgedriver but this patch has platform changes, so the whole kernel needs to be recompiled. Sorry about the noise. -- Felipe Contreras -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: mailbox_mach dependency problem
Hi, On Sat, May 01, 2010 at 05:47:57PM +0300, Felipe Contreras wrote: There seems to be a problem with 'mailbox' and 'mailbox_mach' modules. When another module, like bridgedriver, uses mailbox stuff, only the 'mailbox' module is loaded which doesn't register the platform device. The easiest solution would be to make mailbox_mach built-in when mailbox is configured, however, mailbox_mach needs mailbox to be loaded. I tried to add a poke() function in mailbox_mach so that the module is loaded when mailbox is loaded, but apparently linux doesn't like loop dependencies: WARNING: Loop detected: kernel/arch/arm/mach-omap2/mailbox_mach.ko needs mailbox.ko which needs mailbox_mach.ko again! Any ideas how to solve this issue? generally platform_device instantiation isn't compiled as a module. The patch below should probably help but I didn't test it. diff --git a/arch/arm/mach-omap1/Makefile b/arch/arm/mach-omap1/Makefile index b6a537c..39a9e9e 100644 --- a/arch/arm/mach-omap1/Makefile +++ b/arch/arm/mach-omap1/Makefile @@ -15,8 +15,7 @@ obj-$(CONFIG_OMAP_32K_TIMER) += timer32k.o obj-$(CONFIG_PM) += pm.o sleep.o # DSP -obj-$(CONFIG_OMAP_MBOX_FWK)+= mailbox_mach.o -mailbox_mach-objs := mailbox.o +obj-$(CONFIG_OMAP_MBOX_OMAP1) += mailbox.o i2c-omap-$(CONFIG_I2C_OMAP):= i2c.o obj-y += $(i2c-omap-m) $(i2c-omap-y) diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile index 4b9fc57..6813a60 100644 --- a/arch/arm/mach-omap2/Makefile +++ b/arch/arm/mach-omap2/Makefile @@ -86,8 +86,7 @@ obj-$(CONFIG_ARCH_OMAP3) += omap_hwmod_3xxx_data.o # EMU peripherals obj-$(CONFIG_OMAP3_EMU)+= emu.o -obj-$(CONFIG_OMAP_MBOX_FWK)+= mailbox_mach.o -mailbox_mach-objs := mailbox.o +obj-$(CONFIG_OMAP_MBOX_OMAP2) += mailbox.o iommu-y+= iommu2.o iommu-$(CONFIG_ARCH_OMAP3) += omap3-iommu.o diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig index 6da796e..1c826c4 100644 --- a/arch/arm/plat-omap/Kconfig +++ b/arch/arm/plat-omap/Kconfig @@ -102,10 +102,18 @@ config OMAP_MCBSP config OMAP_MBOX_FWK tristate Mailbox framework support depends on ARCH_OMAP + select OMAP_MBOX_OMAP2 if ARCH_OMAP2PLUS + select OMAP_MBOX_OMAP1 if ARCH_OMAP1 help Say Y here if you want to use OMAP Mailbox framework support for DSP, IVA1.0 and IVA2 in OMAP1/2/3. +config OMAP_MBOX_OMAP1 + bool + +config OMAP_MBOX_OMAP2 + bool + config OMAP_IOMMU tristate -- balbi -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] save and restore etm state across core OFF modes
On Tue, Jan 12, 2010 at 04:53:51 -0600, Nishanth Menon wrote: Tony Lindgren had written, on 01/12/2010 04:15 PM, the following: * Nishanth Menon n...@ti.com [100112 14:06]: Alexander Shishkin had written, on 01/12/2010 03:46 PM, the following: On Tue, Jan 12, 2010 at 01:04:04 -0800, Tony Lindgren wrote: * Nishanth Menon n...@ti.com [100112 09:31]: Alexander Shishkin had written, on 01/12/2010 11:30 AM, the following: On Tue, Jan 12, 2010 at 11:13:13 -0600, Nishanth Menon wrote: Alexander Shishkin had written, on 01/12/2010 11:04 AM, the following: diff --git a/arch/arm/mach-omap2/sleep34xx.S b/arch/arm/mach-omap2/sleep34xx.S index 69521be..0a5ec86 100644 --- a/arch/arm/mach-omap2/sleep34xx.S +++ b/arch/arm/mach-omap2/sleep34xx.S [...] /* Store current cpsr*/ mrs r2, cpsr stmia r8!, {r2} @@ -520,6 +616,7 @@ clean_caches: cmp r9, #1 /* Check whether L2 inval is required or not*/ bne skip_l2_inval clean_l2: +#if 0 my aversion to #if 0 kicks in here :(.. do we have an alternative like using the CONFIG_ENABLE_OFF_MODE_JTAG_ETM_DEBUG or something else? Fair enough. I could replace it with #if !defined(...) as the first thing that comes to mind. This way it will only take disabling the config option to catch any possible regressions in between. Does this sound reasonable? sounds ok to me.. unless folks have ideas coz of clean_l2 label.. more comments might be useful before a rev2 of the patch.. The best solution would be to be able to toggle this via sysfs or debugfs by swapping the sram code for idle loop when JTAG support is needed. Well, if you say, compile the ETM driver in, this will be needed most of the time. I can think of reasons for an against a sysfs entry (as part of discussion -warning lot of self contradictions below- but I think might save a bit of back and froth ;)): for sysfs entry: a) save and restore will have additional latency when you save a chunk such as EMU domain regs - this will not be needed in production phones, disabling it might pop up surprises There's no overhead if you're just replacing the function loaded to SRAM as needed. But for sure it's a debug tool only. I should probably have been more clear -I agree function relocation to SRAM is not a major factor here, my concern was the additional latency incurred during scratchpad save and restore logic as seen by the patch: -u32 omap3_arm_context[128]; +u32 omap3_arm_context[256]; the arm context has doubled albiet 128bytes only.. it still changes I've tried to address this and other concerns expressed in this thread and I'll post a new patchset in a few minutes. the latencies involved on the save and restore paths.. few interesting behavior seen with EHCI save and restore comes to mind here - but maybe irrelevant to the discussion.. Regards, -- Alex -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/6] coresight: add ETM management registers
From: Alexander Shishkin virtu...@slind.org Add notion of ETM OS lock, save and restore registers. Signed-off-by: Alexander Shishkin virtu...@slind.org --- arch/arm/include/asm/hardware/coresight.h |8 ++-- arch/arm/kernel/etm.c |2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/arch/arm/include/asm/hardware/coresight.h b/arch/arm/include/asm/hardware/coresight.h index 8838be1..d846051 100644 --- a/arch/arm/include/asm/hardware/coresight.h +++ b/arch/arm/include/asm/hardware/coresight.h @@ -36,8 +36,6 @@ /* CoreSight Component Registers */ #define CSCR_CLASS 0xff4 -#define CSCR_PRSR 0x314 - #define UNLOCK_MAGIC 0xc5acce55 /* ETM control register, ETM Architecture, 3.3.1 */ @@ -120,6 +118,12 @@ ETMCTRL_BRANCH_OUTPUT | \ ETMCTRL_DO_CONTEXTID) +/* ETM management registers, ETM Architecture, 3.5.24 */ +#define ETMMR_OSLAR0x300 +#define ETMMR_OSLSR0x304 +#define ETMMR_OSSRR0x308 +#define ETMMR_PDSR 0x314 + /* ETB registers, CoreSight Components TRM, 9.3 */ #define ETBR_DEPTH 0x04 #define ETBR_STATUS0x0c diff --git a/arch/arm/kernel/etm.c b/arch/arm/kernel/etm.c index 47a38af..d08062b 100644 --- a/arch/arm/kernel/etm.c +++ b/arch/arm/kernel/etm.c @@ -558,7 +558,7 @@ static int __init etm_probe(struct amba_device *dev, struct amba_id *id) t-etm_portsz = 1; etm_unlock(t); - ret = etm_readl(t, CSCR_PRSR); + ret = etm_readl(t, ETMMR_PDSR); t-ncmppairs = etm_readl(t, ETMR_CONFCODE) 0xf; etm_writel(t, 0x440, ETMR_CTRL); -- 1.7.1.1.g15764 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/6] coresight: cosmetic fixes
From: Alexander Shishkin virtu...@slind.org Use BIT() macro whenever it is sensible to do so. Signed-off-by: Alexander Shishkin virtu...@slind.org --- arch/arm/include/asm/hardware/coresight.h | 22 +++--- 1 files changed, 11 insertions(+), 11 deletions(-) diff --git a/arch/arm/include/asm/hardware/coresight.h b/arch/arm/include/asm/hardware/coresight.h index d846051..7ecd793 100644 --- a/arch/arm/include/asm/hardware/coresight.h +++ b/arch/arm/include/asm/hardware/coresight.h @@ -100,10 +100,10 @@ /* ETM status register, ETM Architecture, 3.3.2 */ #define ETMR_STATUS(0x10) -#define ETMST_OVERFLOW (1 0) -#define ETMST_PROGBIT (1 1) -#define ETMST_STARTSTOP(1 2) -#define ETMST_TRIGGER (1 3) +#define ETMST_OVERFLOW BIT(0) +#define ETMST_PROGBIT BIT(1) +#define ETMST_STARTSTOPBIT(2) +#define ETMST_TRIGGER BIT(3) #define etm_progbit(t) (etm_readl((t), ETMR_STATUS) ETMST_PROGBIT) #define etm_started(t) (etm_readl((t), ETMR_STATUS) ETMST_STARTSTOP) @@ -111,7 +111,7 @@ #define ETMR_TRACEENCTRL2 0x1c #define ETMR_TRACEENCTRL 0x24 -#define ETMTE_INCLEXCL (1 24) +#define ETMTE_INCLEXCL BIT(24) #define ETMR_TRACEENEVT0x20 #define ETMCTRL_OPTS (ETMCTRL_DO_CPRT | \ ETMCTRL_DATA_DO_ADDR | \ @@ -134,12 +134,12 @@ #define ETBR_CTRL 0x20 #define ETBR_FORMATTERCTRL 0x304 #define ETBFF_ENFTC1 -#define ETBFF_ENFCONT (1 1) -#define ETBFF_FONFLIN (1 4) -#define ETBFF_MANUAL_FLUSH (1 6) -#define ETBFF_TRIGIN (1 8) -#define ETBFF_TRIGEVT (1 9) -#define ETBFF_TRIGFL (1 10) +#define ETBFF_ENFCONT BIT(1) +#define ETBFF_FONFLIN BIT(4) +#define ETBFF_MANUAL_FLUSH BIT(6) +#define ETBFF_TRIGIN BIT(8) +#define ETBFF_TRIGEVT BIT(9) +#define ETBFF_TRIGFL BIT(10) #define etb_writel(t, v, x) \ (__raw_writel((v), (t)-etb_regs + (x))) -- 1.7.1.1.g15764 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 4/6] omap3: move EMU peripheral addresses to a platform header
From: Alexander Shishkin virtu...@slind.org These addresses are also needed for the OFF code to save/restore the contexts of the EMU peripherals correctly. Signed-off-by: Alexander Shishkin virtu...@slind.org --- arch/arm/mach-omap2/emu.c| 14 -- arch/arm/plat-omap/include/plat/io.h | 20 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/arch/arm/mach-omap2/emu.c b/arch/arm/mach-omap2/emu.c index 9c442e2..6b41745 100644 --- a/arch/arm/mach-omap2/emu.c +++ b/arch/arm/mach-omap2/emu.c @@ -24,19 +24,13 @@ MODULE_LICENSE(GPL); MODULE_AUTHOR(Alexander Shishkin); -/* Cortex CoreSight components within omap3xxx EMU */ -#define ETM_BASE (L4_EMU_34XX_PHYS + 0x1) -#define DBG_BASE (L4_EMU_34XX_PHYS + 0x11000) -#define ETB_BASE (L4_EMU_34XX_PHYS + 0x1b000) -#define DAPCTL (L4_EMU_34XX_PHYS + 0x1d000) - static struct amba_device omap3_etb_device = { .dev= { .init_name = etb, }, .res= { - .start = ETB_BASE, - .end= ETB_BASE + SZ_4K - 1, + .start = OMAP34XX_ETB_PHYS, + .end= OMAP34XX_ETB_PHYS + OMAP34XX_ETB_SIZE - 1, .flags = IORESOURCE_MEM, }, .periphid = 0x000bb907, @@ -47,8 +41,8 @@ static struct amba_device omap3_etm_device = { .init_name = etm, }, .res= { - .start = ETM_BASE, - .end= ETM_BASE + SZ_4K - 1, + .start = OMAP34XX_ETM_PHYS, + .end= OMAP34XX_ETM_PHYS + OMAP34XX_ETM_SIZE - 1, .flags = IORESOURCE_MEM, }, .periphid = 0x102bb921, diff --git a/arch/arm/plat-omap/include/plat/io.h b/arch/arm/plat-omap/include/plat/io.h index 128b549..81f736a 100644 --- a/arch/arm/plat-omap/include/plat/io.h +++ b/arch/arm/plat-omap/include/plat/io.h @@ -185,6 +185,26 @@ /* 3430 IVA - currently unmapped */ +#define OMAP34XX_DBG_OFFSET(0x00011000) +#define OMAP34XX_DBG_VIRT (L4_EMU_34XX_VIRT + OMAP34XX_DBG_OFFSET) +#define OMAP34XX_DBG_PHYS (L4_EMU_34XX_PHYS + OMAP34XX_DBG_OFFSET) +#define OMAP34XX_DBG_SIZE SZ_4K + +#define OMAP34XX_ETM_OFFSET(0x0001) +#define OMAP34XX_ETM_VIRT (L4_EMU_34XX_VIRT + OMAP34XX_ETM_OFFSET) +#define OMAP34XX_ETM_PHYS (L4_EMU_34XX_PHYS + OMAP34XX_ETM_OFFSET) +#define OMAP34XX_ETM_SIZE SZ_4K + +#define OMAP34XX_ETB_OFFSET(0x0001b000) +#define OMAP34XX_ETB_VIRT (L4_EMU_34XX_VIRT + OMAP34XX_ETB_OFFSET) +#define OMAP34XX_ETB_PHYS (L4_EMU_34XX_PHYS + OMAP34XX_ETB_OFFSET) +#define OMAP34XX_ETB_SIZE SZ_4K + +#define OMAP34XX_DAP_OFFSET(0x0001d000) +#define OMAP34XX_DAP_VIRT (L4_EMU_34XX_VIRT + OMAP34XX_DAP_OFFSET) +#define OMAP34XX_DAP_PHYS (L4_EMU_34XX_PHYS + OMAP34XX_DAP_OFFSET) +#define OMAP34XX_DAP_SIZE SZ_4K + /* * * Omap4 specific IO mapping -- 1.7.1.1.g15764 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/6] etm: do a dummy read from OSSRR during initialization
From: Alexander Shishkin virtu...@slind.org The first read from ETM OS save and restore register after the power down bit deassertion returns garbage. Signed-off-by: Alexander Shishkin virtu...@slind.org --- arch/arm/kernel/etm.c |4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/arch/arm/kernel/etm.c b/arch/arm/kernel/etm.c index d08062b..73b824a 100644 --- a/arch/arm/kernel/etm.c +++ b/arch/arm/kernel/etm.c @@ -558,7 +558,9 @@ static int __init etm_probe(struct amba_device *dev, struct amba_id *id) t-etm_portsz = 1; etm_unlock(t); - ret = etm_readl(t, ETMMR_PDSR); + (void)etm_readl(t, ETMMR_PDSR); + /* dummy first read */ + (void)etm_readl(tracer, ETMMR_OSSRR); t-ncmppairs = etm_readl(t, ETMR_CONFCODE) 0xf; etm_writel(t, 0x440, ETMR_CTRL); -- 1.7.1.1.g15764 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 6/6] omap3: make coresight register save across OFF modes a sysfs option
From: Alexander Shishkin virtu...@slind.org This adds a sysfs file at /sys/power/coresight_save which is used to control if the ETM and debug components' states should be saved and restored across OFF modes. Signed-off-by: Alexander Shishkin virtu...@slind.org --- arch/arm/mach-omap2/Makefile|1 + arch/arm/mach-omap2/debug34xx.c | 66 +++ arch/arm/mach-omap2/pm.h|6 +++ arch/arm/mach-omap2/pm34xx.c|3 ++ 4 files changed, 76 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-omap2/debug34xx.c diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile index 4b9fc57..3185114 100644 --- a/arch/arm/mach-omap2/Makefile +++ b/arch/arm/mach-omap2/Makefile @@ -47,6 +47,7 @@ ifeq ($(CONFIG_PM),y) obj-$(CONFIG_ARCH_OMAP2) += pm24xx.o obj-$(CONFIG_ARCH_OMAP2) += sleep24xx.o obj-$(CONFIG_ARCH_OMAP3) += pm34xx.o sleep34xx.o cpuidle34xx.o +obj-$(CONFIG_ENABLE_OFF_MODE_JTAG_ETM_DEBUG) += debug34xx.o obj-$(CONFIG_PM_DEBUG) += pm-debug.o AFLAGS_sleep24xx.o :=-Wa,-march=armv6 diff --git a/arch/arm/mach-omap2/debug34xx.c b/arch/arm/mach-omap2/debug34xx.c new file mode 100644 index 000..698e83a --- /dev/null +++ b/arch/arm/mach-omap2/debug34xx.c @@ -0,0 +1,66 @@ +/* + * Control saving and restoring of coresight components' state during + * OFF mode. + * + * Copyright (C) 2010 Nokia Corporation + * Alexander Shishkin + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include linux/kernel.h +#include linux/sysfs.h +#include linux/kobject.h + +#include pm.h + +/* + * Pointer to a place in sram where the ETM/debug state save + * flag is. It can be calculated after the omap_sram_idle is + * pushed to sram. + */ +static unsigned int *_etm_save; + +/* + * sysfs file /sys/power/coresight_save controls whether the + * state of coresight components should be saved and restored + * across OFF modes. + */ +static ssize_t coresight_save_show(struct kobject *kobj, + struct kobj_attribute *attr, + char *buf) +{ + return sprintf(buf, %u\n, *_etm_save); +} + +static ssize_t coresight_save_store(struct kobject *kobj, + struct kobj_attribute *attr, + const char *buf, size_t n) +{ + unsigned int value; + + if (sscanf(buf, %u, value) != 1) + return -EINVAL; + + *_etm_save = !!value; + + return n; +} + +static struct kobj_attribute coresight_save_attr = + __ATTR(coresight_save, 0644, coresight_save_show, coresight_save_store); + +int omap3_coresight_pm_init(void *sram_addr) +{ + int ret; + + /* the last word from the top of omap_sram_idle */ + _etm_save = (unsigned *)((u8 *)sram_addr + omap34xx_cpu_suspend_sz - 4); + + ret = sysfs_create_file(power_kobj, coresight_save_attr.attr); + + return ret; +} + diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h index bd6466a..06f5e0e 100644 --- a/arch/arm/mach-omap2/pm.h +++ b/arch/arm/mach-omap2/pm.h @@ -75,6 +75,12 @@ extern void omap34xx_cpu_suspend(u32 *addr, int save_state); extern void save_secure_ram_context(u32 *addr); extern void omap3_save_scratchpad_contents(void); +#ifdef CONFIG_ENABLE_OFF_MODE_JTAG_ETM_DEBUG +int omap3_coresight_pm_init(void *sram_addr); +#else +#define omap3_coresight_pm_init(x) do {} while (0) +#endif + extern unsigned int omap24xx_idle_loop_suspend_sz; extern unsigned int omap34xx_suspend_sz; extern unsigned int save_secure_ram_context_sz; diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c index eab..7a96bbe 100644 --- a/arch/arm/mach-omap2/pm34xx.c +++ b/arch/arm/mach-omap2/pm34xx.c @@ -1072,6 +1072,9 @@ static int __init omap3_pm_init(void) core_clkdm = clkdm_lookup(core_clkdm); omap_push_sram_idle(); + + omap3_coresight_pm_init(_omap_sram_idle); + #ifdef CONFIG_SUSPEND suspend_set_ops(omap_pm_ops); #endif /* CONFIG_SUSPEND */ -- 1.7.1.1.g15764 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 5/6] save and restore etm state across core OFF modes
From: Alexander Shishkin virtu...@slind.org This prevents ETM stalls whenever core enters OFF mode. Original patch author is Richard Woodruff r-woodru...@ti.com. This version of the patch makes use of the ETM OS save/restore mechanism, which takes about 55 words in omap3_arm_context[] instead of 128. Also, saving ETM context can be switched on/off at runtime. Signed-off-by: Alexander Shishkin virtu...@slind.org CC: Richard Woodruff r-woodru...@ti.com --- arch/arm/mach-omap2/Kconfig |9 ++ arch/arm/mach-omap2/control.c |2 +- arch/arm/mach-omap2/sleep34xx.S | 135 + arch/arm/plat-omap/include/plat/control.h |2 +- 4 files changed, 146 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig index 2455dcc..5460bfe 100644 --- a/arch/arm/mach-omap2/Kconfig +++ b/arch/arm/mach-omap2/Kconfig @@ -150,6 +150,15 @@ config MACH_OMAP_4430SDP bool OMAP 4430 SDP board depends on ARCH_OMAP4 +config ENABLE_OFF_MODE_JTAG_ETM_DEBUG + bool Enable hardware emulation context save and restore + depends on ARCH_OMAP3 + default y + help + This option enables JTAG ETM debugging across power states. + With out this option emulation features are reset across OFF + mode state changes. + config OMAP3_EMU bool OMAP3 debugging peripherals depends on ARCH_OMAP3 diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c index 43f8a33..70b1674 100644 --- a/arch/arm/mach-omap2/control.c +++ b/arch/arm/mach-omap2/control.c @@ -93,7 +93,7 @@ void *omap3_secure_ram_storage; * The address is stored in scratchpad, so that it can be used * during the restore path. */ -u32 omap3_arm_context[128]; +u32 omap3_arm_context[256]; struct omap3_control_regs { u32 sysconfig; diff --git a/arch/arm/mach-omap2/sleep34xx.S b/arch/arm/mach-omap2/sleep34xx.S index d522cd7..cd6a1d4 100644 --- a/arch/arm/mach-omap2/sleep34xx.S +++ b/arch/arm/mach-omap2/sleep34xx.S @@ -28,6 +28,7 @@ #include asm/assembler.h #include mach/io.h #include plat/control.h +#include asm/hardware/coresight.h #include cm.h #include prm.h @@ -226,6 +227,18 @@ loop: nop bl wait_sdrc_ok +#ifdef CONFIG_ENABLE_OFF_MODE_JTAG_ETM_DEBUG + /* +* Restore Coresight debug registers +*/ + ldr r6, debug_vbase /* base Vaddr of CortexA8-Debug */ + ldr r4, debug_xlar_key /* get lock key for OSLAR */ + bl unlock_debug/* remove global lock if set */ + ldr r6, etm_vbase /* base Vaddr of ETM */ + bl unlock_debug/* remove global lock if set */ + str r6, [r6, #ETMMR_OSLAR] /* clear OSLAR lock using non-key */ +#endif + ldmfd sp!, {r0-r12, pc} @ restore regs and return restore_es3: /*b restore_es3*/ @ Enable to debug restore code @@ -385,6 +398,44 @@ logic_l1_restore: /*normal memory remap register */ MCR p15, 0, r5, c10, c2, 1 +#ifdef CONFIG_ENABLE_OFF_MODE_JTAG_ETM_DEBUG + /* +* Restore Coresight debug registers +*/ + ldr r6, debug_pbase /* base paddr of CortexA8-Debug */ + ldr r4, debug_xlar_key /* get lock key for OSLAR */ + bl unlock_debug/* remove global lock if set */ + str r4, [r6, #ETMMR_OSLAR] /* reset-pointer (already locked) */ + ldr r4, [r6, #ETMMR_OSSRR] /* dummy read */ + ldr r4, [r3], #4/* load save size */ + cmp r4, #0 /* check for zero */ +debug_restore: + itttne /* t2/compat if-then block */ + ldrne r5, [r3], #4/* get saved value */ + strne r5, [r6,#ETMMR_OSSRR] /* restore saved value */ + subnes r4, r4, #1 /* decrement loop */ + bne debug_restore /* loop till done */ + str r5, [r6, #ETMMR_OSSRR] /* clear lock */ + /* +* Restore CoreSight ETM registers +*/ + ldr r6, etm_pbase /* base paddr of ETM */ + ldr r4, debug_xlar_key /* get lock key for OSLAR */ + bl unlock_debug/* remove global lock if set */ + str r4, [r6, #ETMMR_OSLAR] /* reset-pointer (already locked) */ + ldr r4, [r6, #ETMMR_OSSRR] /* dummy read */ + ldr r4, [r3], #4/* load save size */ + cmp r4, #0 /* check for zero */ + beq etm_skip +etm_restore: + ldrne r5, [r3], #4/* get saved value */ + strne r5, [r6, #ETMMR_OSSRR] /* restore saved value */ + subnes r4, r4, #1 /* decrement loop */ + bne etm_restore /* loop till done */ +etm_skip: + str r6, [r6, #ETMMR_OSLAR] /* remove OS lock
Re: [PATCH 06/11] omap4: Fix omap_l2_cache_init not to run for other omaps
* Shilimkar, Santosh santosh.shilim...@ti.com [100430 23:13]: Tony, -Original Message- From: linux-arm-kernel-boun...@lists.infradead.org [mailto:linux-arm-kernel- boun...@lists.infradead.org] On Behalf Of Tony Lindgren Sent: Saturday, May 01, 2010 2:04 AM To: linux-arm-ker...@lists.infradead.org Cc: linux-omap@vger.kernel.org Subject: [PATCH 06/11] omap4: Fix omap_l2_cache_init not to run for other omaps In multi-omap configuration all the initcalls run. To avoid bad things from happening with 44xx specific initcalls on other omaps, we need to check that the booted system is omap4 before running. Signed-off-by: Tony Lindgren t...@atomide.com --- arch/arm/mach-omap2/board-4430sdp.c |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c index b88f28c..e603b00 100644 --- a/arch/arm/mach-omap2/board-4430sdp.c +++ b/arch/arm/mach-omap2/board-4430sdp.c @@ -55,6 +55,9 @@ static int __init omap_l2_cache_init(void) extern void omap_smc1(u32 fn, u32 arg); void __iomem *l2cache_base; + if (!cpu_is_omap44xx()) + return -ENODEV; + This check is already present just 3 lines below. Oops. Thanks for pointing that out, dropping this patch. Tony -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[CBUS PATCH 1/2] cbus: fix compilation with current mainline
From: Felipe Balbi m...@felipebalbi.com commit 5a0e3ad6af8660be21ca98a971cd00f331318c05 broke compilation of the retu-pwrbutton driver when it dropped implicit inclusion of slab.h and gfp.h. Fix it by including slab.h on retu-pwrbutton.c, while at that, also include slab.h on retu-rtc.c to avoid later problems with implicit inclusion of that being dropped. Compile tested with n770_defconfig and n8x0_defconfig Signed-off-by: Felipe Balbi m...@felipebalbi.com --- drivers/cbus/retu-pwrbutton.c |1 + drivers/cbus/retu-rtc.c |1 + 2 files changed, 2 insertions(+), 0 deletions(-) diff --git a/drivers/cbus/retu-pwrbutton.c b/drivers/cbus/retu-pwrbutton.c index 2d8cf40..f0cd056 100644 --- a/drivers/cbus/retu-pwrbutton.c +++ b/drivers/cbus/retu-pwrbutton.c @@ -34,6 +34,7 @@ #include linux/jiffies.h #include linux/bitops.h #include linux/platform_device.h +#include linux/slab.h #include retu.h diff --git a/drivers/cbus/retu-rtc.c b/drivers/cbus/retu-rtc.c index b0a0f3d..b3974e2 100644 --- a/drivers/cbus/retu-rtc.c +++ b/drivers/cbus/retu-rtc.c @@ -36,6 +36,7 @@ #include linux/device.h #include linux/init.h #include linux/kernel.h +#include linux/slab.h #include linux/module.h #include linux/completion.h #include linux/platform_device.h -- 1.7.1.rc2.7.g3e7f1 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[CBUS PATCH 2/2] cbus: switch kmalloc() + memset() to kzalloc()
From: Felipe Balbi m...@felipebalbi.com no functional changes, just using kzalloc(). compile tested with n8x0_defconfig and n770_defconfig Signed-off-by: Felipe Balbi m...@felipebalbi.com --- drivers/cbus/retu-user.c |6 +++--- drivers/cbus/tahvo-usb.c |4 ++-- drivers/cbus/tahvo-user.c |6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/cbus/retu-user.c b/drivers/cbus/retu-user.c index 1a29492..953d92a 100644 --- a/drivers/cbus/retu-user.c +++ b/drivers/cbus/retu-user.c @@ -382,12 +382,12 @@ int retu_user_init(void) struct retu_irq *irq; int res, i; - irq = kmalloc(sizeof(*irq) * RETU_MAX_IRQ_BUF_LEN, GFP_KERNEL); + irq = kzalloc(sizeof(*irq) * RETU_MAX_IRQ_BUF_LEN, GFP_KERNEL); if (irq == NULL) { - printk(KERN_ERR PFX kmalloc failed\n); + printk(KERN_ERR PFX kzalloc failed\n); return -ENOMEM; } - memset(irq, 0, sizeof(*irq) * RETU_MAX_IRQ_BUF_LEN); + for (i = 0; i RETU_MAX_IRQ_BUF_LEN; i++) list_add(irq[i].node, retu_irqs_reserve); diff --git a/drivers/cbus/tahvo-usb.c b/drivers/cbus/tahvo-usb.c index ef9fc37..5a344b6 100644 --- a/drivers/cbus/tahvo-usb.c +++ b/drivers/cbus/tahvo-usb.c @@ -655,10 +655,10 @@ static int tahvo_usb_probe(struct device *dev) dev_dbg(dev, probe\n); /* Create driver data */ - tu = kmalloc(sizeof(*tu), GFP_KERNEL); + tu = kzalloc(sizeof(*tu), GFP_KERNEL); if (!tu) return -ENOMEM; - memset(tu, 0, sizeof(*tu)); + tu-pt_dev = container_of(dev, struct platform_device, dev); #ifdef CONFIG_USB_OTG /* Default mode */ diff --git a/drivers/cbus/tahvo-user.c b/drivers/cbus/tahvo-user.c index 01e7f20..bd30f06 100644 --- a/drivers/cbus/tahvo-user.c +++ b/drivers/cbus/tahvo-user.c @@ -364,12 +364,12 @@ int tahvo_user_init(void) struct tahvo_irq *irq; int res, i; - irq = kmalloc(sizeof(*irq) * TAHVO_MAX_IRQ_BUF_LEN, GFP_KERNEL); + irq = kzalloc(sizeof(*irq) * TAHVO_MAX_IRQ_BUF_LEN, GFP_KERNEL); if (irq == NULL) { - printk(KERN_ERR PFX kmalloc failed\n); + printk(KERN_ERR PFX kzalloc failed\n); return -ENOMEM; } - memset(irq, 0, sizeof(*irq) * TAHVO_MAX_IRQ_BUF_LEN); + for (i = 0; i TAHVO_MAX_IRQ_BUF_LEN; i++) list_add(irq[i].node, tahvo_irqs_reserve); -- 1.7.1.rc2.7.g3e7f1 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC/PATCH 0/6] DSPBRIDGE: fix mem+cache API issues
This patchset introduces an approach to eliminate the direct calls to follow_page and to the low level cache APIs. The patchset works by caching the page information while memory is mapped, and then using that information later when needed instead of calling follow_page. The low level cache API is then replaced by the standard DMA API. A few key points in the current approach that I'd be happy to hear your feedback about: 1. The new mapping + page information is currently cached in the proc object, but it might fit better inside dmm map objects (by enhancing the DMM layer to support the required data caching, storing and retrieving). 2. The information is stored in a linked list. That's pretty fine as long as the number of memory mappings per application is not extremely high. If that assumption is wrong, a different underlying data structure might be better (hash table, priority tree, etc..). 3. Moving to standard DMA API completely changes the user's point of view; users should no longer think in terms of which cache manipulation is required, but instead, they should just tell dspbridge before a DMA transfer begins, and after it ends. Between the begin and end calls, the buffer belongs to the DSP and should not be accessed by the user. The patchset renames the flush ioctl to begin_dma_to_dsp and the invalidate ioctl to begin_dma_from_dsp. Both functions eventually call dma_map_sg, with the former requesting a DMA_BIDIRECTIONAL direction, and the latter requesting a DMA_FROM_DEVICE direction. In addition, the patchset adds two new APIs which calls dma_unmap_sg: end_dma_to_dsp and end_dma_from_dsp. Ideally, there would be only a single begin_dma command and a single end_dma one, which would accept an additional parameter that will determine the direction of the transfer. Such an approach would be more versatile and cleaner, but it would also break all user space apps that use dspbridge today. Notes: 1. During my tests, a few testsuite scenarios failed due to the fact that the test cases called flush/invalidate on a memory buffer it didn't map beforehand. I consider that as a misuse of the API, and thus a testsuite error. 2. The global bridge device struct is used by adding an 'extern' to proc. This issue should be handled in a different patch series (the struct should not be global. instead, it should be accessible to the dspbridge code via one of the context objects. This way we will also be able to transform pr_* prints to dev_* prints). 3. The patchset is not yet rebased on the latest dspbridge commits. It's currently based on 13e2573f2162b76d45313e790fc67a0d7672930b. 4. The patchset was tested with the bridge testsuite and the dmm sample application running on ZOOM3 / 2.6.33. I'd like to thank Hari and Fernando for initial review of this patchset. Please review and let me know your comments. Thanks, Ohad. --- If you want, you can also reach me at ohadb at ti dot com . Ohad Ben-Cohen (6): DSPBRIDGE: add memory_map_info to PROC DSPBRIDGE: remember mapping and page info in proc_map DSPBRIDGE: remove mapping information in proc_unmap DSPBRIDGE: do not call follow_page DSPBRIDGE: do not use low level cache manipulation API DSPBRIDGE: add dspbridge API to mark end of DMA arch/arm/plat-omap/include/dspbridge/_dcd.h |6 +- arch/arm/plat-omap/include/dspbridge/proc.h |8 +- arch/arm/plat-omap/include/dspbridge/wcdioctl.h |6 +- arch/arm/plat-omap/include/dspbridge/wmd.h |3 +- drivers/dsp/bridge/pmgr/wcd.c | 39 ++- drivers/dsp/bridge/rmgr/proc.c | 440 --- drivers/dsp/bridge/wmd/io_sm.c | 10 +- drivers/dsp/bridge/wmd/tiomap3430.c | 11 +- 8 files changed, 448 insertions(+), 75 deletions(-) -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC/PATCH 1/6] DSPBRIDGE: add memory_map_info to PROC
Add the memory_map_info structure which will be used to maintain mapping and page information. Every memory mapping requested by the MM application will be remembered and kept in a linked list inside the proc object. Signed-off-by: Ohad Ben-Cohen o...@wizery.com --- If you want, you can also reach me at ohadb at ti dot com . drivers/dsp/bridge/rmgr/proc.c | 16 1 files changed, 16 insertions(+), 0 deletions(-) diff --git a/drivers/dsp/bridge/rmgr/proc.c b/drivers/dsp/bridge/rmgr/proc.c index 1f7dd09..95a194a 100644 --- a/drivers/dsp/bridge/rmgr/proc.c +++ b/drivers/dsp/bridge/rmgr/proc.c @@ -17,6 +17,8 @@ */ /* Host OS */ +#include linux/list.h +#include linux/spinlock.h #include dspbridge/host_os.h /* --- DSP/BIOS Bridge */ @@ -102,6 +104,20 @@ struct proc_object { struct bridge_drv_interface *intf_fxns; /* Function interface to WMD */ char *psz_last_coff; struct list_head proc_list; + + /* memory mapping information */ + struct list_head maps; + spinlock_t maps_lock; +}; + +/* used to cache memory mapping information */ +struct memory_map_info { + struct list_head node; + struct page **pages; + u32 mpu_addr; + u32 dsp_addr; + u32 size; + u32 num_usr_pgs; }; static u32 refs; -- 1.6.3.3 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC/PATCH 2/6] DSPBRIDGE: remember mapping and page info in proc_map
Every time the MM application calls proc_map to map a memory area, remember the details of that mapping, together with the related page structures. Signed-off-by: Ohad Ben-Cohen o...@wizery.com --- If you want, you can also reach me at ohadb at ti dot com . arch/arm/plat-omap/include/dspbridge/wmd.h |3 +- drivers/dsp/bridge/rmgr/proc.c | 55 ++-- drivers/dsp/bridge/wmd/io_sm.c | 10 +++-- drivers/dsp/bridge/wmd/tiomap3430.c| 11 +- 4 files changed, 68 insertions(+), 11 deletions(-) diff --git a/arch/arm/plat-omap/include/dspbridge/wmd.h b/arch/arm/plat-omap/include/dspbridge/wmd.h index f9883db..37ee0f3 100644 --- a/arch/arm/plat-omap/include/dspbridge/wmd.h +++ b/arch/arm/plat-omap/include/dspbridge/wmd.h @@ -182,7 +182,8 @@ typedef dsp_status(*fxn_brd_memwrite) (struct wmd_dev_context typedef dsp_status(*fxn_brd_memmap) (struct wmd_dev_context * hDevContext, u32 ul_mpu_addr, u32 ulVirtAddr, u32 ul_num_bytes, -u32 ulMapAttrs); +u32 ulMapAttrs, +struct page **mapped_pages); /* * bridge_brd_mem_un_map diff --git a/drivers/dsp/bridge/rmgr/proc.c b/drivers/dsp/bridge/rmgr/proc.c index 95a194a..b03232f 100644 --- a/drivers/dsp/bridge/rmgr/proc.c +++ b/drivers/dsp/bridge/rmgr/proc.c @@ -130,6 +130,45 @@ static s32 get_envp_count(char **envp); static char **prepend_envp(char **new_envp, char **envp, s32 envp_elems, s32 cnew_envp, char *szVar); +/* remember mapping information */ +static struct memory_map_info *add_mapping_info(struct proc_object *pr_obj, + u32 mpu_addr, u32 dsp_addr, u32 size) +{ + struct memory_map_info *map_info; + + u32 num_usr_pgs = size / PG_SIZE4K; + + pr_debug(%s: adding map info: mpu_addr 0x%x virt 0x%x size 0x%x\n, + __func__, mpu_addr, + dsp_addr, size); + + map_info = kzalloc(sizeof(struct memory_map_info), GFP_KERNEL); + if (!map_info) { + pr_err(%s: kzalloc failed\n, __func__); + return NULL; + } + INIT_LIST_HEAD(map_info-node); + + map_info-pages = kcalloc(num_usr_pgs, sizeof(struct page *), + GFP_KERNEL); + if (!map_info-pages) { + pr_err(%s: kzalloc failed\n, __func__); + kfree(map_info); + return NULL; + } + + map_info-mpu_addr = mpu_addr; + map_info-dsp_addr = dsp_addr; + map_info-size = size; + map_info-num_usr_pgs = num_usr_pgs; + + spin_lock(pr_obj-maps_lock); + list_add(map_info-node, pr_obj-maps); + spin_unlock(pr_obj-maps_lock); + + return map_info; +} + /* * proc_attach * Purpose: @@ -185,6 +224,8 @@ proc_attach(u32 processor_id, p_proc_object-process = current-tgid; INIT_LIST_HEAD(p_proc_object-proc_list); + INIT_LIST_HEAD(p_proc_object-maps); + spin_lock_init(p_proc_object-maps_lock); if (attr_in) p_proc_object-utimeout = attr_in-utimeout; @@ -1091,6 +1132,7 @@ dsp_status proc_map(void *hprocessor, void *pmpu_addr, u32 ul_size, dsp_status status = DSP_SOK; struct proc_object *p_proc_object = (struct proc_object *)hprocessor; struct dmm_map_object *map_obj; + struct memory_map_info *map_info; #ifdef CONFIG_BRIDGE_CACHE_LINE_CHECK if ((ul_map_attr BUFMODE_MASK) != RBUF) { @@ -1121,10 +1163,15 @@ dsp_status proc_map(void *hprocessor, void *pmpu_addr, u32 ul_size, /* Add mapping to the page tables. */ if (DSP_SUCCEEDED(status)) { - - status = (*p_proc_object-intf_fxns-pfn_brd_mem_map) - (p_proc_object-hwmd_context, pa_align, va_align, -size_align, ul_map_attr); + /* cache mapping information */ + map_info = add_mapping_info(p_proc_object, pa_align, va_align, + size_align); + if (!map_info) + status = DSP_EMEMORY; + else + status = (*p_proc_object-intf_fxns-pfn_brd_mem_map) + (p_proc_object-hwmd_context, pa_align, va_align, +size_align, ul_map_attr, map_info-pages); } if (DSP_SUCCEEDED(status)) { /* Mapped address = MSB of VA | LSB of PA */ diff --git a/drivers/dsp/bridge/wmd/io_sm.c b/drivers/dsp/bridge/wmd/io_sm.c index 1b5d977..d8cd9e3 100644 --- a/drivers/dsp/bridge/wmd/io_sm.c +++ b/drivers/dsp/bridge/wmd/io_sm.c @@ -505,7 +505,8 @@ dsp_status bridge_io_on_loaded(struct io_mgr *hio_mgr)
[RFC/PATCH 3/6] DSPBRIDGE: remove mapping information in proc_unmap
Clean up all mapping information resources whenever a buffer is unmapped. Signed-off-by: Ohad Ben-Cohen o...@wizery.com --- If you want, you can also reach me at ohadb at ti dot com . drivers/dsp/bridge/rmgr/proc.c | 43 1 files changed, 43 insertions(+), 0 deletions(-) diff --git a/drivers/dsp/bridge/rmgr/proc.c b/drivers/dsp/bridge/rmgr/proc.c index b03232f..ebb11b1 100644 --- a/drivers/dsp/bridge/rmgr/proc.c +++ b/drivers/dsp/bridge/rmgr/proc.c @@ -169,6 +169,46 @@ static struct memory_map_info *add_mapping_info(struct proc_object *pr_obj, return map_info; } +static int match_exact_map_info(struct memory_map_info *map_info, + u32 dsp_addr, u32 size) +{ + return map_info-dsp_addr == dsp_addr + map_info-size == size; +} + +static void remove_mapping_information(struct proc_object *pr_obj, + u32 dsp_addr, u32 size) +{ + struct memory_map_info *map_info; + struct list_head *iter; + + pr_debug(%s: looking for virt 0x%x size 0x%x\n, __func__, + dsp_addr, size); + + spin_lock(pr_obj-maps_lock); + list_for_each(iter, pr_obj-maps) { + map_info = list_entry(iter, struct memory_map_info, node); + pr_debug(%s: candidate: mpu_addr 0x%x virt 0x%x size 0x%x\n, + __func__, + map_info-mpu_addr, + map_info-dsp_addr, + map_info-size); + + if (match_exact_map_info(map_info, dsp_addr, size)) { + pr_debug(%s: match, deleting map info\n, __func__); + list_del(map_info-node); + kfree(map_info-pages); + kfree(map_info); + goto out; + } + pr_debug(%s: candidate didn't match\n, __func__); + } + + pr_err(%s: failed to find given map info\n, __func__); +out: + spin_unlock(pr_obj-maps_lock); +} + /* * proc_attach * Purpose: @@ -1508,6 +1548,9 @@ dsp_status proc_un_map(void *hprocessor, void *map_addr, status = (*p_proc_object-intf_fxns-pfn_brd_mem_un_map) (p_proc_object-hwmd_context, va_align, size_align); } + + remove_mapping_information(p_proc_object, va_align, size_align); + mutex_unlock(proc_lock); if (DSP_FAILED(status)) goto func_end; -- 1.6.3.3 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC/PATCH 4/6] DSPBRIDGE: do not call follow_page
Eliminate the call to follow_page. Instead, use the page information that was kept during the proc_map call. This also has the advantage that users can now only specify memory areas that were previously mapped. Signed-off-by: Ohad Ben-Cohen o...@wizery.com --- If you want, you can also reach me at ohadb at ti dot com . drivers/dsp/bridge/rmgr/proc.c | 143 ++-- 1 files changed, 93 insertions(+), 50 deletions(-) diff --git a/drivers/dsp/bridge/rmgr/proc.c b/drivers/dsp/bridge/rmgr/proc.c index ebb11b1..bbc7e0f 100644 --- a/drivers/dsp/bridge/rmgr/proc.c +++ b/drivers/dsp/bridge/rmgr/proc.c @@ -209,6 +209,71 @@ out: spin_unlock(pr_obj-maps_lock); } +static int match_containing_map_info(struct memory_map_info *map_info, + u32 mpu_addr, u32 size) +{ + u32 map_info_end = map_info-mpu_addr + map_info-size; + + return mpu_addr = map_info-mpu_addr + mpu_addr + size = map_info_end; +} + +static struct memory_map_info *find_containing_mapping( + struct proc_object *pr_obj, + u32 mpu_addr, u32 size) +{ + struct memory_map_info *map_info; + struct list_head *iter; + pr_debug(%s: looking for mpu_addr 0x%x size 0x%x\n, __func__, + mpu_addr, size); + + spin_lock(pr_obj-maps_lock); + list_for_each(iter, pr_obj-maps) { + map_info = list_entry(iter, struct memory_map_info, node); + pr_debug(%s: candidate: mpu_addr 0x%x virt 0x%x size 0x%x\n, + __func__, + map_info-mpu_addr, + map_info-dsp_addr, + map_info-size); + if (match_containing_map_info(map_info, mpu_addr, size)) { + pr_debug(%s: match!\n, __func__); + goto out; + } + + pr_debug(%s: no match!\n, __func__); + } + + map_info = NULL; +out: + spin_unlock(pr_obj-maps_lock); + return map_info; +} + +static int find_first_page_in_cache(struct memory_map_info *map_info, + unsigned long mpu_addr) +{ + u32 mapped_base_page = map_info-mpu_addr PAGE_SHIFT; + u32 requested_base_page = mpu_addr PAGE_SHIFT; + int pg_index = requested_base_page - mapped_base_page; + + if (pg_index 0 || pg_index = map_info-num_usr_pgs) { + pr_err(%s: failed (got %d)\n, __func__, pg_index); + return -1; + } + + pr_debug(%s: first page is %d\n, __func__, pg_index); + return pg_index; +} + +static inline struct page *get_mapping_page(struct memory_map_info *map_info, + int pg_i) +{ + if (pg_i 0 || pg_i = map_info-num_usr_pgs) + return NULL; + + return map_info-pages[pg_i]; +} + /* * proc_attach * Purpose: @@ -561,23 +626,30 @@ dsp_status proc_enum_nodes(void *hprocessor, void **node_tab, } /* Cache operation against kernel address instead of users */ -static int memory_sync_page(struct vm_area_struct *vma, unsigned long start, - ssize_t len, enum dsp_flushtype ftype) +static int memory_sync_page(struct memory_map_info *map_info, + unsigned long start, ssize_t len, enum dsp_flushtype ftype) { struct page *page; void *kaddr; unsigned long offset; ssize_t rest; + int pg_i; + + pg_i = find_first_page_in_cache(map_info, start); + if (pg_i 0) { + pr_err(%s: failed to find first page in cache\n, __func__); + return -EINVAL; + } while (len) { - page = follow_page(vma, start, FOLL_GET); + page = get_mapping_page(map_info, pg_i); if (!page) { pr_err(%s: no page for %08lx\n, __func__, start); return -EINVAL; } else if (IS_ERR(page)) { pr_err(%s: err page for %08lx(%lu)\n, __func__, start, - IS_ERR(page)); - return IS_ERR(page); + PTR_ERR(page)); + return PTR_ERR(page); } offset = start ~PAGE_MASK; @@ -586,59 +658,22 @@ static int memory_sync_page(struct vm_area_struct *vma, unsigned long start, mem_flush_cache(kaddr, rest, ftype); kunmap(page); - put_page(page); len -= rest; start += rest; + pg_i++; } return 0; } -/* Check if the given area blongs to process virtul memory address space */ -static int
[RFC/PATCH 5/6] DSPBRIDGE: do not use low level cache manipulation API
Instead of using low level cache manipulation API, use the standard DMA API. This changes the concept of the dspbridge cache API a little, hence the naming changes: * Flush marks the beginning of a DMA transfer from the MPU to the DSP. * Invalidate marks the beginning of a DMA transfer from the DSP to the MPU. Both of these actions eventually build a scatter gatter list using the page information that was kept during proc_map, and feed it to the standard dma_map_sg API. Note that now users cannot manipulate the cache state of any random address; if the buffer is not part of a previous memory mapping of that application, the request is denied. Signed-off-by: Ohad Ben-Cohen o...@wizery.com --- If you want, you can also reach me at ohadb at ti dot com . arch/arm/plat-omap/include/dspbridge/_dcd.h |4 +- arch/arm/plat-omap/include/dspbridge/proc.h |4 +- arch/arm/plat-omap/include/dspbridge/wcdioctl.h |4 +- drivers/dsp/bridge/pmgr/wcd.c | 12 +- drivers/dsp/bridge/rmgr/proc.c | 152 ++- 5 files changed, 134 insertions(+), 42 deletions(-) diff --git a/arch/arm/plat-omap/include/dspbridge/_dcd.h b/arch/arm/plat-omap/include/dspbridge/_dcd.h index 1350feb..0af4a31 100644 --- a/arch/arm/plat-omap/include/dspbridge/_dcd.h +++ b/arch/arm/plat-omap/include/dspbridge/_dcd.h @@ -110,9 +110,9 @@ extern u32 procwrap_reserve_memory(union Trapped_Args *args, void *pr_ctxt); extern u32 procwrap_un_reserve_memory(union Trapped_Args *args, void *pr_ctxt); extern u32 procwrap_map(union Trapped_Args *args, void *pr_ctxt); extern u32 procwrap_un_map(union Trapped_Args *args, void *pr_ctxt); -extern u32 procwrap_flush_memory(union Trapped_Args *args, void *pr_ctxt); +extern u32 procwrap_begin_dma_to_dsp(union Trapped_Args *args, void *pr_ctxt); extern u32 procwrap_stop(union Trapped_Args *args, void *pr_ctxt); -extern u32 procwrap_invalidate_memory(union Trapped_Args *args, void *pr_ctxt); +extern u32 procwrap_begin_dma_from_dsp(union Trapped_Args *args, void *pr_ctxt); /* NODE wrapper functions */ extern u32 nodewrap_allocate(union Trapped_Args *args, void *pr_ctxt); diff --git a/arch/arm/plat-omap/include/dspbridge/proc.h b/arch/arm/plat-omap/include/dspbridge/proc.h index 0707739..f8450a6 100644 --- a/arch/arm/plat-omap/include/dspbridge/proc.h +++ b/arch/arm/plat-omap/include/dspbridge/proc.h @@ -472,7 +472,7 @@ extern dsp_status proc_stop(void *hprocessor); * Details: * All the arguments are currently ignored. */ -extern dsp_status proc_flush_memory(void *hprocessor, +extern dsp_status proc_begin_dma_to_dsp(void *hprocessor, void *pmpu_addr, u32 ul_size, u32 ul_flags); /* @@ -493,7 +493,7 @@ extern dsp_status proc_flush_memory(void *hprocessor, * Details: * All the arguments are currently ignored. */ -extern dsp_status proc_invalidate_memory(void *hprocessor, +extern dsp_status proc_begin_dma_from_dsp(void *hprocessor, void *pmpu_addr, u32 ul_size); /* diff --git a/arch/arm/plat-omap/include/dspbridge/wcdioctl.h b/arch/arm/plat-omap/include/dspbridge/wcdioctl.h index b6a4dda..aba2078 100644 --- a/arch/arm/plat-omap/include/dspbridge/wcdioctl.h +++ b/arch/arm/plat-omap/include/dspbridge/wcdioctl.h @@ -452,9 +452,9 @@ union Trapped_Args { #define PROC_UNRSVMEM _IOW(DB, DB_IOC(DB_PROC, 11), unsigned long) #define PROC_MAPMEM_IOWR(DB, DB_IOC(DB_PROC, 12), unsigned long) #define PROC_UNMAPMEM _IOR(DB, DB_IOC(DB_PROC, 13), unsigned long) -#define PROC_FLUSHMEMORY _IOW(DB, DB_IOC(DB_PROC, 14), unsigned long) +#define PROC_BEGINDMATODSP _IOW(DB, DB_IOC(DB_PROC, 14), unsigned long) #define PROC_STOP _IOWR(DB, DB_IOC(DB_PROC, 15), unsigned long) -#define PROC_INVALIDATEMEMORY _IOW(DB, DB_IOC(DB_PROC, 16), unsigned long) +#define PROC_BEGINDMAFROMDSP _IOW(DB, DB_IOC(DB_PROC, 16), unsigned long) /* NODE Module */ #define NODE_ALLOCATE _IOWR(DB, DB_IOC(DB_NODE, 0), unsigned long) diff --git a/drivers/dsp/bridge/pmgr/wcd.c b/drivers/dsp/bridge/pmgr/wcd.c index 15a05a6..89243f1 100644 --- a/drivers/dsp/bridge/pmgr/wcd.c +++ b/drivers/dsp/bridge/pmgr/wcd.c @@ -111,9 +111,9 @@ static struct wcd_cmd proc_cmd[] = { {procwrap_un_reserve_memory}, /* PROC_UNRSVMEM */ {procwrap_map}, /* PROC_MAPMEM */ {procwrap_un_map}, /* PROC_UNMAPMEM */ - {procwrap_flush_memory},/* PROC_FLUSHMEMORY */ + {procwrap_begin_dma_to_dsp},/* PROC_BEGINDMATODSP */ {procwrap_stop},/* PROC_STOP */ - {procwrap_invalidate_memory}, /* PROC_INVALIDATEMEMORY */ + {procwrap_begin_dma_from_dsp}, /* PROC_BEGINDMAFROMDSP */ }; /* NODE wrapper functions */ @@ -680,7 +680,7 @@ u32 procwrap_enum_node_info(union Trapped_Args *args, void *pr_ctxt) /* * procwrap_flush_memory */ -u32
[RFC/PATCH 6/6] DSPBRIDGE: add dspbridge API to mark end of DMA
Standard DMA API is built upon the notion of buffer ownership. The buffer is either exclusively owned by the MPU (and therefore may be accessed by it) or exclusively owned by the DMA device (in our case, the dsp remote processor). This patch adds the missing dspbridge API with which the MM application can mark the end of a DMA transfer (and thus regain ownership of the buffer). Signed-off-by: Ohad Ben-Cohen o...@wizery.com --- If you want, you can also reach me at ohadb at ti dot com . arch/arm/plat-omap/include/dspbridge/_dcd.h |2 + arch/arm/plat-omap/include/dspbridge/proc.h |4 + arch/arm/plat-omap/include/dspbridge/wcdioctl.h |2 + drivers/dsp/bridge/pmgr/wcd.c | 27 +++ drivers/dsp/bridge/rmgr/proc.c | 87 +++ 5 files changed, 122 insertions(+), 0 deletions(-) diff --git a/arch/arm/plat-omap/include/dspbridge/_dcd.h b/arch/arm/plat-omap/include/dspbridge/_dcd.h index 0af4a31..adfcf67 100644 --- a/arch/arm/plat-omap/include/dspbridge/_dcd.h +++ b/arch/arm/plat-omap/include/dspbridge/_dcd.h @@ -113,6 +113,8 @@ extern u32 procwrap_un_map(union Trapped_Args *args, void *pr_ctxt); extern u32 procwrap_begin_dma_to_dsp(union Trapped_Args *args, void *pr_ctxt); extern u32 procwrap_stop(union Trapped_Args *args, void *pr_ctxt); extern u32 procwrap_begin_dma_from_dsp(union Trapped_Args *args, void *pr_ctxt); +extern u32 procwrap_end_dma_to_dsp(union Trapped_Args *args, void *pr_ctxt); +extern u32 procwrap_end_dma_from_dsp(union Trapped_Args *args, void *pr_ctxt); /* NODE wrapper functions */ extern u32 nodewrap_allocate(union Trapped_Args *args, void *pr_ctxt); diff --git a/arch/arm/plat-omap/include/dspbridge/proc.h b/arch/arm/plat-omap/include/dspbridge/proc.h index f8450a6..7a7b8e8 100644 --- a/arch/arm/plat-omap/include/dspbridge/proc.h +++ b/arch/arm/plat-omap/include/dspbridge/proc.h @@ -474,6 +474,8 @@ extern dsp_status proc_stop(void *hprocessor); */ extern dsp_status proc_begin_dma_to_dsp(void *hprocessor, void *pmpu_addr, u32 ul_size, u32 ul_flags); +extern dsp_status proc_end_dma_to_dsp(void *hprocessor, + void *pmpu_addr, u32 ul_size, u32 ul_flags); /* * proc_invalidate_memory @@ -495,6 +497,8 @@ extern dsp_status proc_begin_dma_to_dsp(void *hprocessor, */ extern dsp_status proc_begin_dma_from_dsp(void *hprocessor, void *pmpu_addr, u32 ul_size); +extern dsp_status proc_end_dma_from_dsp(void *hprocessor, +void *pmpu_addr, u32 ul_size); /* * proc_map diff --git a/arch/arm/plat-omap/include/dspbridge/wcdioctl.h b/arch/arm/plat-omap/include/dspbridge/wcdioctl.h index aba2078..a6debf2 100644 --- a/arch/arm/plat-omap/include/dspbridge/wcdioctl.h +++ b/arch/arm/plat-omap/include/dspbridge/wcdioctl.h @@ -455,6 +455,8 @@ union Trapped_Args { #define PROC_BEGINDMATODSP _IOW(DB, DB_IOC(DB_PROC, 14), unsigned long) #define PROC_STOP _IOWR(DB, DB_IOC(DB_PROC, 15), unsigned long) #define PROC_BEGINDMAFROMDSP _IOW(DB, DB_IOC(DB_PROC, 16), unsigned long) +#define PROC_ENDDMATODSP _IOW(DB, DB_IOC(DB_PROC, 17), unsigned long) +#define PROC_ENDDMAFROMDSP _IOW(DB, DB_IOC(DB_PROC, 18), unsigned long) /* NODE Module */ #define NODE_ALLOCATE _IOWR(DB, DB_IOC(DB_NODE, 0), unsigned long) diff --git a/drivers/dsp/bridge/pmgr/wcd.c b/drivers/dsp/bridge/pmgr/wcd.c index 89243f1..ae6e8ab 100644 --- a/drivers/dsp/bridge/pmgr/wcd.c +++ b/drivers/dsp/bridge/pmgr/wcd.c @@ -114,6 +114,8 @@ static struct wcd_cmd proc_cmd[] = { {procwrap_begin_dma_to_dsp},/* PROC_BEGINDMATODSP */ {procwrap_stop},/* PROC_STOP */ {procwrap_begin_dma_from_dsp}, /* PROC_BEGINDMAFROMDSP */ + {procwrap_end_dma_to_dsp}, /* PROC_ENDDMATODSP */ + {procwrap_end_dma_from_dsp},/* PROC_ENDDMAFROMDSP */ }; /* NODE wrapper functions */ @@ -709,6 +711,31 @@ u32 procwrap_begin_dma_from_dsp(union Trapped_Args *args, void *pr_ctxt) return status; } +u32 procwrap_end_dma_to_dsp(union Trapped_Args *args, void *pr_ctxt) +{ + dsp_status status; + + if (args-args_proc_flushmemory.ul_flags + PROC_WRITEBACK_INVALIDATE_MEM) + return DSP_EINVALIDARG; + + status = proc_end_dma_to_dsp(args-args_proc_flushmemory.hprocessor, + args-args_proc_flushmemory.pmpu_addr, + args-args_proc_flushmemory.ul_size, + args-args_proc_flushmemory.ul_flags); + return status; +} + +u32 procwrap_end_dma_from_dsp(union Trapped_Args *args, void *pr_ctxt) +{ + dsp_status status; + + status = + proc_end_dma_from_dsp(args-args_proc_invalidatememory.hprocessor, +
Re: mailbox_mach dependency problem
On Sat, May 1, 2010 at 8:33 PM, Felipe Balbi m...@felipebalbi.com wrote: On Sat, May 01, 2010 at 05:47:57PM +0300, Felipe Contreras wrote: The easiest solution would be to make mailbox_mach built-in when mailbox is configured, however, mailbox_mach needs mailbox to be loaded. generally platform_device instantiation isn't compiled as a module. The patch below should probably help but I didn't test it. Yeah, but as I said above... that doesn't work: arch/arm/mach-omap2/built-in.o: In function `omap2_mbox_probe': /data/public/dev/omap/linux-omap/arch/arm/mach-omap2/mailbox.c:389: undefined reference to `omap_mbox_register' arch/arm/mach-omap2/built-in.o: In function `omap2_mbox_remove': /data/public/dev/omap/linux-omap/arch/arm/mach-omap2/mailbox.c:439: undefined reference to `omap_mbox_unregister' -- Felipe Contreras -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html