Blackfin fixes for 2.6.31
cover Blackfin fixes for 2.6.31
Just a whole bunch of small fixes / anomaly workarounds, nothing terribly interesting.
Barry Song (1):
Blackfin: bf537-stamp: fix irq decl for AD7142
Graf Yang (3):
Blackfin: update anomaly lists to match latest sheets/usage
Blackfin: update handling of anomaly 364 (wrong rev id in BF527-0.1)
Blackfin: add CPLB entries for Core B on-chip L1 SRAM regions
Jie Zhang (1):
Blackfin: fix miscompilation in lshrdi3
Julia Lawall (1):
arch/blackfin: Add kmalloc NULL tests
Michael Hennerich (3):
Blackfin: fix incomplete renaming of the bfin-twi-lcd driver
Blackfin: fix bugs in GPIO resume code
Blackfin: drop per-cpu loops_per_jiffy tracking
Mike Frysinger (5):
Blackfin: drop dead flash_probe call
Blackfin: restore exception banner when dumping crash info
Blackfin: handle BF561 Core B memory regions better when SMP=n
Blackfin: fix early_dma_memcpy() handling of busy channels
Blackfin: define HARDIRQ_BITS again for now
Robin Getz (6):
Blackfin: cleanup code a bit with comments and defines
Blackfin: work around anomaly 05000281
Blackfin: fix silent crash when no uClinux MTD filesystem exists
Blackfin: drop duplicate runtime checking of anomaly 05000448
Blackfin: fix handling of IPEND in interrupt context save
Blackfin: work around anomaly 05000189
Sonic Zhang (1):
Blackfin: fix wrong CTS inversion
arch/blackfin/include/asm/context.S | 7 ++- arch/blackfin/include/asm/cpu.h | 1 - arch/blackfin/include/asm/hardirq.h | 3 + arch/blackfin/include/asm/processor.h | 21 +++------ arch/blackfin/kernel/bfin_dma_5xx.c | 29 ++++++------- arch/blackfin/kernel/bfin_gpio.c | 6 +-- arch/blackfin/kernel/cplb-nompu/cplbinit.c | 23 ++++++++--- arch/blackfin/kernel/process.c | 14 +++--- arch/blackfin/kernel/setup.c | 44 ++++++++----------- arch/blackfin/kernel/traps.c | 9 +++- arch/blackfin/lib/lshrdi3.c | 16 +------- arch/blackfin/mach-bf518/boards/ezbrd.c | 2 +- arch/blackfin/mach-bf518/include/mach/anomaly.h | 2 + .../mach-bf518/include/mach/bfin_serial_5xx.h | 2 +- arch/blackfin/mach-bf527/boards/cm_bf527.c | 2 +- arch/blackfin/mach-bf527/boards/ezbrd.c | 2 +- arch/blackfin/mach-bf527/boards/ezkit.c | 2 +- arch/blackfin/mach-bf527/include/mach/anomaly.h | 4 +- .../mach-bf527/include/mach/bfin_serial_5xx.h | 2 +- arch/blackfin/mach-bf533/boards/stamp.c | 2 +- arch/blackfin/mach-bf533/include/mach/anomaly.h | 1 + .../mach-bf533/include/mach/bfin_serial_5xx.h | 2 +- arch/blackfin/mach-bf537/boards/stamp.c | 4 +- arch/blackfin/mach-bf537/include/mach/anomaly.h | 2 + .../mach-bf537/include/mach/bfin_serial_5xx.h | 2 +- arch/blackfin/mach-bf538/include/mach/anomaly.h | 2 + .../mach-bf538/include/mach/bfin_serial_5xx.h | 2 +- arch/blackfin/mach-bf548/boards/ezkit.c | 2 +- arch/blackfin/mach-bf548/include/mach/anomaly.h | 2 + arch/blackfin/mach-bf561/include/mach/anomaly.h | 1 + .../mach-bf561/include/mach/bfin_serial_5xx.h | 2 +- arch/blackfin/mach-bf561/include/mach/mem_map.h | 23 ++++++++++- arch/blackfin/mach-common/entry.S | 12 +++-- arch/blackfin/mach-common/smp.c | 10 ++++- 34 files changed, 145 insertions(+), 115 deletions(-)
PATCH 1/21 Blackfin: cleanup code a bit with comments and defines
From: Robin Getz <[email protected]>
Improve the assembly with a few explanatory comments and use symbolic defines rather than numeric values for bit positions.
--- arch/blackfin/mach-common/entry.S | 12 +++++++----- 1 files changed, 7 insertions(+), 5 deletions(-)
arch/blackfin/mach-common/entry.S +7 -5
@@ -218,7 +218,7 @@ ENTRY(_ex_single_step) /* Single stepping only a single instruction, so clear the trace * bit here. */ r7 = syscfg; - bitclr (r7, 0); + bitclr (r7, SYSCFG_SSSTEP_P); syscfg = R7; jump _ex_trap_c;
@@ -251,7 +251,7 @@ ENTRY(_ex_single_step) if !cc jump _bfin_return_from_exception; r7 = syscfg; - bitclr (r7, 0); + bitclr (r7, SYSCFG_SSSTEP_P); /* Turn off single step */ syscfg = R7; /* Fall through to _bfin_return_from_exception. */
@@ -342,9 +342,11 @@ ENTRY(_ex_trap_c) r6 = retx; [p5 + PDA_RETX] = r6; #endif + /* Save the state of single stepping */ r6 = SYSCFG; [p5 + PDA_SYSCFG] = r6; - BITCLR(r6, 0); + /* Clear it while we handle the exception in IRQ5 mode */ + BITCLR(r6, SYSCFG_SSSTEP_P); SYSCFG = r6; /* Disable all interrupts, but make sure level 5 is enabled so
@@ -367,7 +369,7 @@ ENDPROC(_ex_trap_c) * exception. This is a unrecoverable event, so crash. * Note: this cannot be ENTRY() as we jump here with "if cc jump" ... */ -_double_fault: +ENTRY(_double_fault) /* Turn caches & protection off, to ensure we don't get any more * double exceptions */
@@ -872,7 +874,7 @@ ENTRY(_ret_from_exception) raise 15; /* raise evt15 to do signal or reschedule */ 4: r0 = syscfg; - bitclr(r0, 0); + bitclr(r0, SYSCFG_SSSTEP_P); /* Turn off single step */ syscfg = r0; 5: rts;
Signature · 1 line
1.6.3.3
PATCH 2/21 Blackfin: drop dead flash_probe call
In reply to Mike FrysingerThere are no CONFIG_{BLK,CHR}_DEV_FLASH Kconfig options, and there is no flash_probe() function, so not really sure what this code is all about. Seems to be dead code that stretches way back to the start of the Blackfin port.
--- arch/blackfin/kernel/setup.c | 7 ------- 1 files changed, 0 insertions(+), 7 deletions(-)
arch/blackfin/kernel/setup.c +0 -7
@@ -868,13 +868,6 @@ void __init setup_arch(char **cmdline_p)else printk (KERN_CONT "and Disabled\n" ); -#if defined(CONFIG_CHR_DEV_FLASH ) || defined(CONFIG_BLK_DEV_FLASH ) -/* we need to initialize the Flashrom device here since we might -* do things with flash early on in the boot -*/ -flash_probe (); -#endif -printk (KERN_INFO "Boot Mode: %i\n" ,bfin_read_SYSCR () &0xF );/* Newer parts mirror SWRST bits in SYSCR */
Signature · 1 line
1.6.3.3
PATCH 3/21 Blackfin: update anomaly lists to match latest sheets/usage
In reply to Mike FrysingerFrom: Graf Yang <[email protected]>
--- arch/blackfin/mach-bf518/include/mach/anomaly.h | 2 ++ arch/blackfin/mach-bf527/include/mach/anomaly.h | 4 +++- arch/blackfin/mach-bf533/include/mach/anomaly.h | 1 + arch/blackfin/mach-bf537/include/mach/anomaly.h | 2 ++ arch/blackfin/mach-bf538/include/mach/anomaly.h | 2 ++ arch/blackfin/mach-bf548/include/mach/anomaly.h | 2 ++ arch/blackfin/mach-bf561/include/mach/anomaly.h | 1 + 7 files changed, 13 insertions(+), 1 deletions(-)
arch/blackfin/mach-bf518/include/mach/anomaly.h +2 -0
@@ -82,6 +82,7 @@#define ANOMALY_05000179 (0)#define ANOMALY_05000182 (0)#define ANOMALY_05000183 (0) +#define ANOMALY_05000189 (0)#define ANOMALY_05000198 (0)#define ANOMALY_05000202 (0)#define ANOMALY_05000215 (0)
@@ -117,6 +118,7 @@#define ANOMALY_05000357 (0)#define ANOMALY_05000362 (1)#define ANOMALY_05000363 (0) +#define ANOMALY_05000364 (0)#define ANOMALY_05000371 (0)#define ANOMALY_05000380 (0)#define ANOMALY_05000386 (0)
arch/blackfin/mach-bf527/include/mach/anomaly.h +3 -1
@@ -176,6 +176,8 @@#define ANOMALY_05000443 (1)/* The WURESET Bit in the SYSCR Register is not Functional */ #define ANOMALY_05000445 (1) +/* USB DMA Short Packet Data Corruption */ +#define ANOMALY_05000450 (1)/* BCODE_QUICKBOOT, BCODE_ALLBOOT, and BCODE_FULLBOOT Settings in SYSCR Register Not Functional */ #define ANOMALY_05000451 (1)/* Incorrect Default Hysteresis Setting for RESET, NMI, and BMODE Signals */
@@ -201,6 +203,7 @@#define ANOMALY_05000179 (0)#define ANOMALY_05000182 (0)#define ANOMALY_05000183 (0) +#define ANOMALY_05000189 (0)#define ANOMALY_05000198 (0)#define ANOMALY_05000202 (0)#define ANOMALY_05000215 (0)
@@ -238,6 +241,5 @@#define ANOMALY_05000412 (0)#define ANOMALY_05000447 (0)#define ANOMALY_05000448 (0) -#define ANOMALY_05000450 (0)#endif
arch/blackfin/mach-bf533/include/mach/anomaly.h +1 -0
@@ -335,6 +335,7 @@#define ANOMALY_05000323 (0)#define ANOMALY_05000353 (1)#define ANOMALY_05000362 (1) +#define ANOMALY_05000364 (0)#define ANOMALY_05000380 (0)#define ANOMALY_05000386 (1)#define ANOMALY_05000389 (0)
arch/blackfin/mach-bf537/include/mach/anomaly.h +2 -0
@@ -167,6 +167,7 @@#define ANOMALY_05000179 (0)#define ANOMALY_05000182 (0)#define ANOMALY_05000183 (0) +#define ANOMALY_05000189 (0)#define ANOMALY_05000198 (0)#define ANOMALY_05000202 (0)#define ANOMALY_05000215 (0)
@@ -186,6 +187,7 @@#define ANOMALY_05000353 (1)#define ANOMALY_05000362 (1)#define ANOMALY_05000363 (0) +#define ANOMALY_05000364 (0)#define ANOMALY_05000380 (0)#define ANOMALY_05000386 (1)#define ANOMALY_05000389 (0)
arch/blackfin/mach-bf538/include/mach/anomaly.h +2 -0
@@ -137,6 +137,7 @@#define ANOMALY_05000158 (0)#define ANOMALY_05000171 (0)#define ANOMALY_05000182 (0) +#define ANOMALY_05000189 (0)#define ANOMALY_05000198 (0)#define ANOMALY_05000202 (0)#define ANOMALY_05000215 (0)
@@ -160,6 +161,7 @@#define ANOMALY_05000353 (1)#define ANOMALY_05000362 (1)#define ANOMALY_05000363 (0) +#define ANOMALY_05000364 (0)#define ANOMALY_05000380 (0)#define ANOMALY_05000386 (1)#define ANOMALY_05000389 (0)
arch/blackfin/mach-bf548/include/mach/anomaly.h +2 -0
@@ -195,6 +195,7 @@#define ANOMALY_05000179 (0)#define ANOMALY_05000182 (0)#define ANOMALY_05000183 (0) +#define ANOMALY_05000189 (0)#define ANOMALY_05000198 (0)#define ANOMALY_05000202 (0)#define ANOMALY_05000215 (0)
@@ -226,6 +227,7 @@#define ANOMALY_05000323 (0)#define ANOMALY_05000362 (1)#define ANOMALY_05000363 (0) +#define ANOMALY_05000364 (0)#define ANOMALY_05000380 (0)#define ANOMALY_05000400 (0)#define ANOMALY_05000412 (0)
arch/blackfin/mach-bf561/include/mach/anomaly.h +1 -0
@@ -288,6 +288,7 @@#define ANOMALY_05000273 (0)#define ANOMALY_05000311 (0)#define ANOMALY_05000353 (1) +#define ANOMALY_05000364 (0)#define ANOMALY_05000380 (0)#define ANOMALY_05000386 (1)#define ANOMALY_05000389 (0)
Signature · 1 line
1.6.3.3
PATCH 4/21 Blackfin: work around anomaly 05000281
In reply to Mike FrysingerFrom: Robin Getz <[email protected]>
Add missing anomaly workaround for anomaly 05000281 - we can't return to instructions which cause hardware errors otherwise we trigger the error again which means we go into an infinite loop of handling, returning, and retriggering. This work around confuses gdb when the error occurs as the PC will seemed to have moved, so a better long term fix will need to be figured out, but for now this is better than an infinite crash loop.
--- arch/blackfin/kernel/traps.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
arch/blackfin/kernel/traps.c +2 -1
@@ -619,7 +619,8 @@ asmlinkage void trap_c(struct pt_regs *fp)force_sig_info (sig, &info, current); } -if (ANOMALY_05000461 && trapnr ==VEC_HWERR && !access_ok (VERIFY_READ , fp->pc,8 )) +if ((ANOMALY_05000461 && trapnr ==VEC_HWERR && !access_ok (VERIFY_READ , fp->pc,8 )) || + (ANOMALY_05000281 && trapnr ==VEC_HWERR )) fp->pc =SAFE_USER_INSTRUCTION ; traps_done:
Signature · 1 line
1.6.3.3
PATCH 5/21 Blackfin: restore exception banner when dumping crash info
In reply to Mike FrysingerPrevious unification code put the exception banner behind the "is oops" logic when it should have been printed all the time.
--- arch/blackfin/kernel/traps.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
arch/blackfin/kernel/traps.c +3 -2
@@ -570,11 +570,12 @@ asmlinkage void trap_c(struct pt_regs *fp)if (kernel_mode_regs (fp) || (current && !current->mm)) {console_verbose (); oops_in_progress =1 ; -if (strerror) -verbose_printk (strerror); }if (sig !=SIGTRAP ) { +if (strerror) +verbose_printk (strerror); +dump_bfin_process (fp);dump_bfin_mem (fp);show_regs (fp);
Signature · 1 line
1.6.3.3
PATCH 6/21 Blackfin: fix silent crash when no uClinux MTD filesystem exists
In reply to Mike FrysingerFrom: Robin Getz <[email protected]>
Since we need to relocate the attached filesystem with the uClinux MTD map (to handle some anomalies), we need to know its real filesize. If we boot a kernel without a filesystem actually attached, we end up blindly reading and copying garbage (since there is no magic value to detect validity). Often times this results in an early crash and no output. So add a few basic sanity checks before operating on things to catch the majority of cases.
--- arch/blackfin/kernel/setup.c | 26 ++++++++++++++++---------- 1 files changed, 16 insertions(+), 10 deletions(-)
arch/blackfin/kernel/setup.c +16 -10
@@ -568,17 +568,23 @@ static __init void memory_setup(void)# endif /* ANOMALY_05000263 */ # endif /* CONFIG_ROMFS_FS */ - memory_end -= mtd_size; - -if (mtd_size ==0 ) { -console_init (); -panic ("Don't boot kernel without rootfs attached." ); +/* Since the default MTD_UCLINUX has no magic number, we just blindly +* read 8 past the end of the kernel's image, and look at it. +* When no image is attached, mtd_size is set to a random number +* Do some basic sanity checks before operating on things +*/ +if (mtd_size ==0 || memory_end <= mtd_size) { +pr_emerg ("Could not find valid ram mtd attached.\n" ); + }else { + memory_end -= mtd_size; + +/* Relocate MTD image to the top of memory after the uncached memory area */ + uclinux_ram_map.phys = memory_mtd_start = memory_end; + uclinux_ram_map.size = mtd_size; +pr_info ("Found mtd parition at 0x%p, (len=0x%lx), moving to 0x%p\n" , + _end, mtd_size, (void *)memory_mtd_start); +dma_memcpy ((void *)uclinux_ram_map.phys, _end, uclinux_ram_map.size); } - -/* Relocate MTD image to the top of memory after the uncached memory area */ - uclinux_ram_map.phys = memory_mtd_start = memory_end; - uclinux_ram_map.size = mtd_size; -dma_memcpy ((void *)uclinux_ram_map.phys, _end, uclinux_ram_map.size);#endif /* CONFIG_MTD_UCLINUX */ #if (defined(CONFIG_BFIN_EXTMEM_ICACHEABLE ) &&ANOMALY_05000263 )
Signature · 1 line
1.6.3.3
PATCH 7/21 Blackfin: fix miscompilation in lshrdi3
In reply to Mike FrysingerFrom: Jie Zhang <[email protected]>
The code used in the Blackfin lshrdi3 utilizes gcc constructs. However, the structures declared don't line up with the code gcc generates, so under certain optimizations, we get bad code and things crap out in fun random ways. So rather than trying to maintain different gcc definitions ourselves, just use the ones available in gcclib.h.
URL: http://blackfin.uclinux.org/gf/tracker/5286
--- arch/blackfin/lib/lshrdi3.c | 16 +--------------- 1 files changed, 1 insertions(+), 15 deletions(-)
arch/blackfin/lib/lshrdi3.c +1 -15
@@ -27,21 +27,7 @@* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#define BITS_PER_UNIT 8 - -typedef int SItype __attribute__ ((mode (SI ))); -typedef unsigned int USItype __attribute__ ((mode (SI ))); -typedef int DItype __attribute__ ((mode (DI ))); -typedef int word_type __attribute__ ((mode (__word__))); - -struct DIstruct { -SItype high, low; -}; - -typedef union { -struct DIstruct s; -DItype ll; -}DIunion ; +#include "gcclib.h" #ifdef CONFIG_ARITHMETIC_OPS_L1 DItype __lshrdi3 (DItype u,word_type b)__attribute__((l1_text));
Signature · 1 line
1.6.3.3
PATCH 8/21 Blackfin: handle BF561 Core B memory regions better when SMP=n
In reply to Mike FrysingerRather than assume Core B is always run with caches turned on, let people load into any of the on-chip memory regions. It is their business how the SRAM/Cache regions are utilized, so don't prevent them from being able to load into them.
--- arch/blackfin/kernel/process.c | 14 +++++++------- arch/blackfin/mach-bf561/include/mach/mem_map.h | 23 ++++++++++++++++++++++- 2 files changed, 29 insertions(+), 8 deletions(-)
arch/blackfin/kernel/process.c +7 -7
@@ -361,7 +361,7 @@ static inlineint in_mem_const (unsigned long addr,unsigned long size,unsigned long const_addr,unsigned long const_size) { -return in_mem_const_off (addr,0 , size, const_addr, const_size); +return in_mem_const_off (addr, size,0 , const_addr, const_size); }#define IN_ASYNC (bnum, bctlnum) \ ({ \
@@ -390,13 +390,13 @@ int bfin_mem_access_type(unsigned long addr, unsigned long size)if (in_mem_const (addr, size,L1_DATA_B_START ,L1_DATA_B_LENGTH ))return cpu ==0 ?BFIN_MEM_ACCESS_CORE :BFIN_MEM_ACCESS_IDMA ;#ifdef COREB_L1_CODE_START -if (in_mem_const (addr, size,COREB_L1_CODE_START ,L1_CODE_LENGTH )) +if (in_mem_const (addr, size,COREB_L1_CODE_START ,COREB_L1_CODE_LENGTH ))return cpu ==1 ?BFIN_MEM_ACCESS_ITEST :BFIN_MEM_ACCESS_IDMA ;if (in_mem_const (addr, size,COREB_L1_SCRATCH_START ,L1_SCRATCH_LENGTH ))return cpu ==1 ?BFIN_MEM_ACCESS_CORE_ONLY : -EFAULT ; -if (in_mem_const (addr, size,COREB_L1_DATA_A_START ,L1_DATA_A_LENGTH )) +if (in_mem_const (addr, size,COREB_L1_DATA_A_START ,COREB_L1_DATA_A_LENGTH ))return cpu ==1 ?BFIN_MEM_ACCESS_CORE :BFIN_MEM_ACCESS_IDMA ; -if (in_mem_const (addr, size,COREB_L1_DATA_B_START ,L1_DATA_B_LENGTH )) +if (in_mem_const (addr, size,COREB_L1_DATA_B_START ,COREB_L1_DATA_B_LENGTH ))return cpu ==1 ?BFIN_MEM_ACCESS_CORE :BFIN_MEM_ACCESS_IDMA ;#endif if (in_mem_const (addr, size,L2_START ,L2_LENGTH ))
@@ -472,13 +472,13 @@ int _access_ok(unsigned long addr, unsigned long size)if (in_mem_const_off (addr, size, _ebss_b_l1 - _sdata_b_l1,L1_DATA_B_START ,L1_DATA_B_LENGTH ))return 1 ;#ifdef COREB_L1_CODE_START -if (in_mem_const (addr, size,COREB_L1_CODE_START ,L1_CODE_LENGTH )) +if (in_mem_const (addr, size,COREB_L1_CODE_START ,COREB_L1_CODE_LENGTH ))return 1 ;if (in_mem_const (addr, size,COREB_L1_SCRATCH_START ,L1_SCRATCH_LENGTH ))return 1 ; -if (in_mem_const (addr, size,COREB_L1_DATA_A_START ,L1_DATA_A_LENGTH )) +if (in_mem_const (addr, size,COREB_L1_DATA_A_START ,COREB_L1_DATA_A_LENGTH ))return 1 ; -if (in_mem_const (addr, size,COREB_L1_DATA_B_START ,L1_DATA_B_LENGTH )) +if (in_mem_const (addr, size,COREB_L1_DATA_B_START ,COREB_L1_DATA_B_LENGTH ))return 1 ;#endif if (in_mem_const_off (addr, size, _ebss_l2 - _stext_l2,L2_START ,L2_LENGTH ))
arch/blackfin/mach-bf561/include/mach/mem_map.h +22 -1
@@ -37,7 +37,6 @@/* Memory Map for ADSP-BF561 processors */ -#ifdef CONFIG_BF561 #define COREA_L1_CODE_START 0xFFA00000#define COREA_L1_DATA_A_START 0xFF800000#define COREA_L1_DATA_B_START 0xFF900000
@@ -74,6 +73,28 @@#define BFIN_DCACHESIZE (0*1024)#define BFIN_DSUPBANKS 0#endif /*CONFIG_BFIN_DCACHE*/ + +/* +* If we are in SMP mode, then the cache settings of Core B will match +* the settings of Core A. If we aren't, then we assume Core B is not +* using any cache. This allows the rest of the kernel to work with +* the core in either mode as we are only loading user code into it and +* it is the user's problem to make sure they aren't doing something +* stupid there. +* +* Note that we treat the L1 code region as a contiguous blob to make +* the rest of the kernel simpler. Easier to check one region than a +* bunch of small ones. Again, possible misbehavior here is the fault +* of the user -- don't try to use memory that doesn't exist. +*/ +#ifdef CONFIG_SMP +# define COREB_L1_CODE_LENGTH L1_CODE_LENGTH +# define COREB_L1_DATA_A_LENGTH L1_DATA_A_LENGTH +# define COREB_L1_DATA_B_LENGTH L1_DATA_B_LENGTH +#else +# define COREB_L1_CODE_LENGTH 0x14000 +# define COREB_L1_DATA_A_LENGTH 0x8000 +# define COREB_L1_DATA_B_LENGTH 0x8000#endif /* Level 2 Memory */
Signature · 1 line
1.6.3.3
PATCH 9/21 Blackfin: fix early_dma_memcpy() handling of busy channels
In reply to Mike FrysingerThe early logic to locate a free DMA channel and then set it up was broken in a few ways that only manifested itself when we needed to set up more than 2 on chip SRAM regions (most board defaults setup 1 or 2). First, we checked the wrong status register (the destination gets updated, not the source) and second, we did the ssync before rather than after resetting a DMA config register.
--- arch/blackfin/kernel/bfin_dma_5xx.c | 29 ++++++++++++++--------------- 1 files changed, 14 insertions(+), 15 deletions(-)
arch/blackfin/kernel/bfin_dma_5xx.c +14 -15
@@ -253,32 +253,31 @@ void __init early_dma_memcpy(void *pdst, const void *psrc, size_t size)BUG_ON (src %4 );BUG_ON (size %4 ); -/* Force a sync in case a previous config reset on this channel -* occurred. This is needed so subsequent writes to DMA registers -* are not spuriously lost/corrupted. -*/ -__builtin_bfin_ssync (); - src_ch =0 ;/* Find an avalible memDMA channel */ while (1 ) { -if (!src_ch || src_ch == (struct dma_register *)MDMA_S1_NEXT_DESC_PTR ) { - dst_ch = (struct dma_register *)MDMA_D0_NEXT_DESC_PTR ; - src_ch = (struct dma_register *)MDMA_S0_NEXT_DESC_PTR ; - }else { +if (src_ch == (struct dma_register *)MDMA_S0_NEXT_DESC_PTR ) { dst_ch = (struct dma_register *)MDMA_D1_NEXT_DESC_PTR ; src_ch = (struct dma_register *)MDMA_S1_NEXT_DESC_PTR ; + }else { + dst_ch = (struct dma_register *)MDMA_D0_NEXT_DESC_PTR ; + src_ch = (struct dma_register *)MDMA_S0_NEXT_DESC_PTR ; } -if (!bfin_read16 (&src_ch->cfg)) { +if (!bfin_read16 (&src_ch->cfg)) +break ; +else if (bfin_read16 (&dst_ch->irq_status) &DMA_DONE ) { +bfin_write16 (&src_ch->cfg,0 );break ; - }else { -if (bfin_read16 (&src_ch->irq_status) &DMA_DONE ) -bfin_write16 (&src_ch->cfg,0 ); } - } +/* Force a sync in case a previous config reset on this channel +* occurred. This is needed so subsequent writes to DMA registers +* are not spuriously lost/corrupted. +*/ +__builtin_bfin_ssync (); +/* Destination */ bfin_write32 (&dst_ch->start_addr, dst);bfin_write16 (&dst_ch->x_count, size >>2 );
Signature · 1 line
1.6.3.3
PATCH 10/21 Blackfin: update handling of anomaly 364 (wrong rev id in BF527-0.1)
In reply to Mike FrysingerFrom: Graf Yang <[email protected]>
This anomaly only applies to the BF527-0.1, not the BF526-0.1, and not any other revision of the BF527. So make sure we don't go returning 0xffff for other cases.
--- arch/blackfin/include/asm/processor.h | 21 +++++++-------------- 1 files changed, 7 insertions(+), 14 deletions(-)
arch/blackfin/include/asm/processor.h +7 -14
@@ -105,23 +105,16 @@ static inline uint32_t __pure bfin_revid(void)/* Always use CHIPID, to work around ANOMALY_05000234 */ uint32_t revid = (bfin_read_CHIPID () &CHIPID_VERSION ) >>28 ; -#ifdef CONFIG_BF52x -/* ANOMALY_05000357 +#ifdef _BOOTROM_GET_DXE_ADDRESS_TWI +/* +* ANOMALY_05000364 * Incorrect Revision Number in DSPID Register */ -if (revid ==0 ) -switch (bfin_read16 (_BOOTROM_GET_DXE_ADDRESS_TWI)) { -case 0x0010 : - revid =0 ; -break ; -case 0x2796 : - revid =1 ; -break ; -default : - revid =0xFFFF ; -break ; - } +if (ANOMALY_05000364 && +bfin_read16 (_BOOTROM_GET_DXE_ADDRESS_TWI) ==0x2796 ) + revid =1 ;#endif +return revid; }
Signature · 1 line
1.6.3.3
PATCH 11/21 Blackfin: fix wrong CTS inversion
In reply to Mike FrysingerFrom: Sonic Zhang <[email protected]>
The Blackfin serial headers were inverting the CTS value leading to wrong handling of the CTS line which broke CTS/RTS handling completely.
--- .../mach-bf518/include/mach/bfin_serial_5xx.h | 2 +- .../mach-bf527/include/mach/bfin_serial_5xx.h | 2 +- .../mach-bf533/include/mach/bfin_serial_5xx.h | 2 +- .../mach-bf537/include/mach/bfin_serial_5xx.h | 2 +- .../mach-bf538/include/mach/bfin_serial_5xx.h | 2 +- .../mach-bf561/include/mach/bfin_serial_5xx.h | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-)
arch/blackfin/mach-bf518/include/mach/bfin_serial_5xx.h +1 -1
@@ -53,7 +53,7 @@#define UART_SET_DLAB (uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) | DLAB); SSYNC(); } while (0)#define UART_CLEAR_DLAB (uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) & ~DLAB); SSYNC(); } while (0) -#define UART_GET_CTS (x) (!gpio_get_value(x->cts_pin)) +#define UART_GET_CTS (x) gpio_get_value(x->cts_pin)#define UART_DISABLE_RTS (x) gpio_set_value(x->rts_pin, 1)#define UART_ENABLE_RTS (x) gpio_set_value(x->rts_pin, 0)#define UART_ENABLE_INTS (x, v) UART_PUT_IER(x, v)
arch/blackfin/mach-bf527/include/mach/bfin_serial_5xx.h +1 -1
@@ -53,7 +53,7 @@#define UART_SET_DLAB (uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) | DLAB); SSYNC(); } while (0)#define UART_CLEAR_DLAB (uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) & ~DLAB); SSYNC(); } while (0) -#define UART_GET_CTS (x) (!gpio_get_value(x->cts_pin)) +#define UART_GET_CTS (x) gpio_get_value(x->cts_pin)#define UART_DISABLE_RTS (x) gpio_set_value(x->rts_pin, 1)#define UART_ENABLE_RTS (x) gpio_set_value(x->rts_pin, 0)#define UART_ENABLE_INTS (x, v) UART_PUT_IER(x, v)
arch/blackfin/mach-bf533/include/mach/bfin_serial_5xx.h +1 -1
@@ -53,7 +53,7 @@#define UART_SET_DLAB (uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) | DLAB); SSYNC(); } while (0)#define UART_CLEAR_DLAB (uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) & ~DLAB); SSYNC(); } while (0) -#define UART_GET_CTS (x) (!gpio_get_value(x->cts_pin)) +#define UART_GET_CTS (x) gpio_get_value(x->cts_pin)#define UART_DISABLE_RTS (x) gpio_set_value(x->rts_pin, 1)#define UART_ENABLE_RTS (x) gpio_set_value(x->rts_pin, 0)#define UART_ENABLE_INTS (x, v) UART_PUT_IER(x, v)
arch/blackfin/mach-bf537/include/mach/bfin_serial_5xx.h +1 -1
@@ -53,7 +53,7 @@#define UART_SET_DLAB (uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) | DLAB); SSYNC(); } while (0)#define UART_CLEAR_DLAB (uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) & ~DLAB); SSYNC(); } while (0) -#define UART_GET_CTS (x) (!gpio_get_value(x->cts_pin)) +#define UART_GET_CTS (x) gpio_get_value(x->cts_pin)#define UART_DISABLE_RTS (x) gpio_set_value(x->rts_pin, 1)#define UART_ENABLE_RTS (x) gpio_set_value(x->rts_pin, 0)#define UART_ENABLE_INTS (x, v) UART_PUT_IER(x, v)
arch/blackfin/mach-bf538/include/mach/bfin_serial_5xx.h +1 -1
@@ -53,7 +53,7 @@#define UART_SET_DLAB (uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) | DLAB); SSYNC(); } while (0)#define UART_CLEAR_DLAB (uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) & ~DLAB); SSYNC(); } while (0) -#define UART_GET_CTS (x) (!gpio_get_value(x->cts_pin)) +#define UART_GET_CTS (x) gpio_get_value(x->cts_pin)#define UART_DISABLE_RTS (x) gpio_set_value(x->rts_pin, 1)#define UART_ENABLE_RTS (x) gpio_set_value(x->rts_pin, 0)#define UART_ENABLE_INTS (x, v) UART_PUT_IER(x, v)
arch/blackfin/mach-bf561/include/mach/bfin_serial_5xx.h +1 -1
@@ -53,7 +53,7 @@#define UART_SET_DLAB (uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) | DLAB); SSYNC(); } while (0)#define UART_CLEAR_DLAB (uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) & ~DLAB); SSYNC(); } while (0) -#define UART_GET_CTS (x) (!gpio_get_value(x->cts_pin)) +#define UART_GET_CTS (x) gpio_get_value(x->cts_pin)#define UART_DISABLE_RTS (x) gpio_set_value(x->rts_pin, 1)#define UART_ENABLE_RTS (x) gpio_set_value(x->rts_pin, 0)#define UART_ENABLE_INTS (x, v) UART_PUT_IER(x, v)
Signature · 1 line
1.6.3.3
PATCH 12/21 Blackfin: fix incomplete renaming of the bfin-twi-lcd driver
In reply to Mike FrysingerFrom: Michael Hennerich <[email protected]>
The sed used to rename the bfin-twi-lcd only replaced the first instance rather than all which led to the resources not being enabled when the driver was built as a module.
--- arch/blackfin/mach-bf518/boards/ezbrd.c | 2 +- arch/blackfin/mach-bf527/boards/cm_bf527.c | 2 +- arch/blackfin/mach-bf527/boards/ezbrd.c | 2 +- arch/blackfin/mach-bf527/boards/ezkit.c | 2 +- arch/blackfin/mach-bf533/boards/stamp.c | 2 +- arch/blackfin/mach-bf537/boards/stamp.c | 2 +- arch/blackfin/mach-bf548/boards/ezkit.c | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-)
arch/blackfin/mach-bf518/boards/ezbrd.c +1 -1
@@ -534,7 +534,7 @@ static struct platform_device i2c_bfin_twi_device = {#endif static struct i2c_board_info __initdata bfin_i2c_board_info[] = { -#if defined(CONFIG_BFIN_TWI_LCD ) || defined(CONFIG_TWI_LCD_MODULE ) +#if defined(CONFIG_BFIN_TWI_LCD ) || defined(CONFIG_BFIN_TWI_LCD_MODULE ) { I2C_BOARD_INFO("pcf8574_lcd", 0x22), },
arch/blackfin/mach-bf527/boards/cm_bf527.c +1 -1
@@ -793,7 +793,7 @@ static struct platform_device i2c_bfin_twi_device = {#endif static struct i2c_board_info __initdata bfin_i2c_board_info[] = { -#if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE) +#if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE) { I2C_BOARD_INFO("pcf8574_lcd", 0x22), .type = "pcf8574_lcd",
arch/blackfin/mach-bf527/boards/ezbrd.c +1 -1
@@ -591,7 +591,7 @@ static struct platform_device i2c_bfin_twi_device = {#endif static struct i2c_board_info __initdata bfin_i2c_board_info[] = { -#if defined(CONFIG_BFIN_TWI_LCD ) || defined(CONFIG_TWI_LCD_MODULE ) +#if defined(CONFIG_BFIN_TWI_LCD ) || defined(CONFIG_BFIN_TWI_LCD_MODULE ) { I2C_BOARD_INFO("pcf8574_lcd", 0x22), },
arch/blackfin/mach-bf527/boards/ezkit.c +1 -1
@@ -858,7 +858,7 @@ static struct platform_device i2c_bfin_twi_device = {#endif static struct i2c_board_info __initdata bfin_i2c_board_info[] = { -#if defined(CONFIG_BFIN_TWI_LCD ) || defined(CONFIG_TWI_LCD_MODULE ) +#if defined(CONFIG_BFIN_TWI_LCD ) || defined(CONFIG_BFIN_TWI_LCD_MODULE ) { I2C_BOARD_INFO("pcf8574_lcd", 0x22), },
arch/blackfin/mach-bf533/boards/stamp.c +1 -1
@@ -453,7 +453,7 @@ static struct i2c_board_info __initdata bfin_i2c_board_info[] = { .irq = 39, },#endif -#if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE) +#if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE) { I2C_BOARD_INFO("pcf8574_lcd", 0x22), },
arch/blackfin/mach-bf537/boards/stamp.c +1 -1
@@ -1316,7 +1316,7 @@ static struct i2c_board_info __initdata bfin_i2c_board_info[] = { .irq = IRQ_PF5, },#endif -#if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE) +#if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE) { I2C_BOARD_INFO("pcf8574_lcd", 0x22), },
arch/blackfin/mach-bf548/boards/ezkit.c +1 -1
@@ -864,7 +864,7 @@ static struct i2c_board_info __initdata bfin_i2c_board_info0[] = { #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */ static struct i2c_board_info __initdata bfin_i2c_board_info1[] = { -#if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE) +#if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE) { I2C_BOARD_INFO("pcf8574_lcd", 0x22), },
Signature · 1 line
1.6.3.3
PATCH 13/21 Blackfin: drop duplicate runtime checking of anomaly 05000448
In reply to Mike FrysingerFrom: Robin Getz <[email protected]>
We already catch this anomaly at compile time, and the runtime version is such that it ends up checking on all parts rather than just the ones that might actually have it.
--- arch/blackfin/kernel/setup.c | 4 ---- 1 files changed, 0 insertions(+), 4 deletions(-)
arch/blackfin/kernel/setup.c +0 -4
@@ -937,10 +937,6 @@ void __init setup_arch(char **cmdline_p) CPU, bfin_revid()); } -/* We can't run on BF548-0.1 due to ANOMALY 05000448 */ -if (bfin_cpuid () ==0x27de &&bfin_revid () ==1 ) -panic ("You can't run on this processor due to 05000448" ); -printk (KERN_INFO "Blackfin Linux support by http://blackfin.uclinux.org/\n" ); printk(KERN_INFO "Processor Speed: %lu MHz core clock and %lu MHz System Clock\n",
Signature · 1 line
1.6.3.3
PATCH 14/21 Blackfin: fix handling of IPEND in interrupt context save
In reply to Mike FrysingerFrom: Robin Getz <[email protected]>
The interrupt context save logic incorrectly stored the address of the IPEND register rather than its value due to a missing dereference. While we're here, also enable this code for all kernel debugging scenarios and not just when KGDB is enabled.
--- arch/blackfin/include/asm/context.S | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-)
arch/blackfin/include/asm/context.S +4 -3
@@ -223,9 +223,10 @@ [--sp] = RETN; [--sp] = RETE; [--sp] = SEQSTAT; -#ifdef CONFIG_KGDB - r1.l = lo(IPEND); - r1.h = hi(IPEND); +#ifdef CONFIG_DEBUG_KERNEL + p1.l = lo(IPEND); + p1.h = hi(IPEND); + r1 = [p1]; [--sp] = r1; #else [--sp] = r0; /* Skip IPEND as well. */
Signature · 1 line
1.6.3.3
PATCH 15/21 Blackfin: bf537-stamp: fix irq decl for AD7142
In reply to Mike FrysingerFrom: Barry Song <[email protected]>
The AD7142 add-on card hooks the IRQ line up to PG5, not PF5.
--- arch/blackfin/mach-bf537/boards/stamp.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/blackfin/mach-bf537/boards/stamp.c +1 -1
@@ -1313,7 +1313,7 @@ static struct i2c_board_info __initdata bfin_i2c_board_info[] = {#if defined(CONFIG_JOYSTICK_AD7142 ) || defined(CONFIG_JOYSTICK_AD7142_MODULE ) { I2C_BOARD_INFO("ad7142_joystick", 0x2C), - .irq = IRQ_PF5, + .irq = IRQ_PG5, },#endif #if defined(CONFIG_BFIN_TWI_LCD ) || defined(CONFIG_BFIN_TWI_LCD_MODULE )
Signature · 1 line
1.6.3.3
PATCH 16/21 Blackfin: fix bugs in GPIO resume code
In reply to Mike FrysingerFrom: Michael Hennerich <[email protected]>
Change the bfin_gpio_pm_hibernate_restore() function to:
1) AND restored DATA with DIR (not OR) to get correct final state
2) Restore DATA before setting DIR to avoid glitches
--- arch/blackfin/kernel/bfin_gpio.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)
arch/blackfin/kernel/bfin_gpio.c +2 -4
@@ -686,14 +686,12 @@ void bfin_gpio_pm_hibernate_restore(void) *port_fer[bank] = gpio_bank_saved[bank].fer;#endif gpio_array[bank]->inen = gpio_bank_saved[bank].inen; + gpio_array[bank]->data_set = gpio_bank_saved[bank].data + & gpio_bank_saved[bank].dir; gpio_array[bank]->dir = gpio_bank_saved[bank].dir; gpio_array[bank]->polar = gpio_bank_saved[bank].polar; gpio_array[bank]->edge = gpio_bank_saved[bank].edge; gpio_array[bank]->both = gpio_bank_saved[bank].both; - - gpio_array[bank]->data_set = gpio_bank_saved[bank].data - | gpio_bank_saved[bank].dir; - gpio_array[bank]->maska = gpio_bank_saved[bank].maska; }AWA_DUMMY_READ (maska);
Signature · 1 line
1.6.3.3
PATCH 17/21 Blackfin: drop per-cpu loops_per_jiffy tracking
In reply to Mike FrysingerFrom: Michael Hennerich <[email protected]>
On Blackfin SMP, a per-cpu loops_per_jiffy is pointless since both cores always run at the same CCLK. In addition, the current implementation has flaws since the main consumer for loops_per_jiffy (asm/delay.h) uses the global kernel loops_per_jiffy and not the per_cpu one. So punt all of the per-cpu handling and go back to the global shared one.
--- arch/blackfin/include/asm/cpu.h | 1 - arch/blackfin/kernel/setup.c | 7 +++---- arch/blackfin/mach-common/smp.c | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-)
arch/blackfin/include/asm/cpu.h +0 -1
@@ -32,7 +32,6 @@ struct blackfin_cpudata {struct task_struct *idle;unsigned int imemctl;unsigned int dmemctl; -unsigned long loops_per_jiffy;unsigned long dcache_invld_count;unsigned long icache_invld_count; };
arch/blackfin/kernel/setup.c +3 -4
@@ -168,7 +168,6 @@ void __cpuinit bfin_setup_cpudata(unsigned int cpu)struct blackfin_cpudata *cpudata = &per_cpu (cpu_data, cpu); cpudata->idle = current; - cpudata->loops_per_jiffy = loops_per_jiffy; cpudata->imemctl =bfin_read_IMEM_CONTROL (); cpudata->dmemctl =bfin_read_DMEM_CONTROL (); }
@@ -1159,9 +1158,9 @@ static int show_cpuinfo(struct seq_file *m, void *v) sclk/1000000, sclk%1000000);seq_printf (m,"bogomips\t: %lu.%02lu\n" "Calibration\t: %lu loops\n" , - (cpudata->loops_per_jiffy *HZ ) /500000 , - ((cpudata->loops_per_jiffy *HZ ) /5000 ) %100 , - (cpudata->loops_per_jiffy *HZ )); + (loops_per_jiffy *HZ ) /500000 , + ((loops_per_jiffy *HZ ) /5000 ) %100 , + (loops_per_jiffy *HZ ));/* Check Cache configutation */ switch (cpudata->dmemctl & (1 <<DMC0_P |1 <<DMC1_P )) {
arch/blackfin/mach-common/smp.c +1 -1
@@ -450,7 +450,7 @@ void __init smp_cpus_done(unsigned int max_cpus)unsigned int cpu;for_each_online_cpu (cpu) - bogosum +=per_cpu (cpu_data, cpu).loops_per_jiffy; + bogosum += loops_per_jiffy; printk(KERN_INFO "SMP: Total of %d processors activated " "(%lu.%02lu BogoMIPS).\n",
Signature · 1 line
1.6.3.3
PATCH 18/21 Blackfin: work around anomaly 05000189
In reply to Mike FrysingerFrom: Robin Getz <[email protected]>
Similar to anomaly 05000281 but not as bad, we cannot return to the instruction causing a fault otherwise we'll trigger a second false exception. The system can still recover, but it isn't correct.
--- arch/blackfin/kernel/traps.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
arch/blackfin/kernel/traps.c +2 -1
@@ -621,7 +621,8 @@ asmlinkage void trap_c(struct pt_regs *fp) }if ((ANOMALY_05000461 && trapnr ==VEC_HWERR && !access_ok (VERIFY_READ , fp->pc,8 )) || - (ANOMALY_05000281 && trapnr ==VEC_HWERR )) + (ANOMALY_05000281 && trapnr ==VEC_HWERR ) || + (ANOMALY_05000189 && (trapnr ==VEC_CPLB_I_VL || trapnr ==VEC_CPLB_VL ))) fp->pc =SAFE_USER_INSTRUCTION ; traps_done:
Signature · 1 line
1.6.3.3
PATCH 19/21 Blackfin: add CPLB entries for Core B on-chip L1 SRAM regions
In reply to Mike FrysingerFrom: Graf Yang <[email protected]>
The Blackfin SMP port was missing CPLB entries for Core B on-chip L1 SRAM regions. Any code that attempted to use these would wrongly crash due to a CPLB miss.
--- arch/blackfin/kernel/cplb-nompu/cplbinit.c | 23 +++++++++++++++++------ 1 files changed, 17 insertions(+), 6 deletions(-)
arch/blackfin/kernel/cplb-nompu/cplbinit.c +17 -6
@@ -72,13 +72,24 @@ void __init generate_cplb_tables_cpu(unsigned int cpu) }/* Cover L1 memory. One 4M area for code and data each is enough. */ -if (L1_DATA_A_LENGTH ||L1_DATA_B_LENGTH ) { - d_tbl[i_d].addr =L1_DATA_A_START ; - d_tbl[i_d++].data =L1_DMEMORY |PAGE_SIZE_4MB ; +if (cpu ==0 ) { +if (L1_DATA_A_LENGTH ||L1_DATA_B_LENGTH ) { + d_tbl[i_d].addr =L1_DATA_A_START ; + d_tbl[i_d++].data =L1_DMEMORY |PAGE_SIZE_4MB ; + } + i_tbl[i_i].addr =L1_CODE_START ; + i_tbl[i_i++].data =L1_IMEMORY |PAGE_SIZE_4MB ; } - i_tbl[i_i].addr =L1_CODE_START ; - i_tbl[i_i++].data =L1_IMEMORY |PAGE_SIZE_4MB ; - +#ifdef CONFIG_SMP + else { +if (L1_DATA_A_LENGTH ||L1_DATA_B_LENGTH ) { + d_tbl[i_d].addr =COREB_L1_DATA_A_START ; + d_tbl[i_d++].data =L1_DMEMORY |PAGE_SIZE_4MB ; + } + i_tbl[i_i].addr =COREB_L1_CODE_START ; + i_tbl[i_i++].data =L1_IMEMORY |PAGE_SIZE_4MB ; + } +#endif first_switched_dcplb = i_d; first_switched_icplb = i_i;
Signature · 1 line
1.6.3.3
PATCH 20/21 arch/blackfin: Add kmalloc NULL tests
In reply to Mike FrysingerFrom: Julia Lawall <[email protected]>
Check that the result of kmalloc is not NULL before passing it to other functions.
In the first two cases, the new code returns -ENOMEM, which seems compatible with what is done for similar functions for other architectures.
In the last two cases, the new code fails silently, ie just returns, because the function has void return type.
The semantic match that finds this problem is as follows:
(http://www.emn.fr/x-info/coccinelle/)
// <smpl>
@@
expression *x;
identifier f;
constant char *C;
@@
x = \(kmalloc\|kcalloc\|kzalloc\)(...);
... when != x == NULL
when != x != NULL
when != (x || ...)(
kfree(x)
|f(...,C,...,x,...)
|*f(...,x,...)
|*x->f
)
// </smpl>
--- arch/blackfin/mach-common/smp.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
arch/blackfin/mach-common/smp.c +8 -0
@@ -211,6 +211,8 @@ int smp_call_function(void (*func)(void *info), void *info, int wait)return 0 ; msg =kmalloc (sizeof (*msg),GFP_ATOMIC ); +if (!msg) +return -ENOMEM ;INIT_LIST_HEAD (&msg->list); msg->call_struct.func = func; msg->call_struct.info = info;
@@ -252,6 +254,8 @@ int smp_call_function_single(int cpuid, void (*func) (void *info), void *info,cpu_set (cpu, callmap); msg =kmalloc (sizeof (*msg),GFP_ATOMIC ); +if (!msg) +return -ENOMEM ;INIT_LIST_HEAD (&msg->list); msg->call_struct.func = func; msg->call_struct.info = info;
@@ -287,6 +291,8 @@ void smp_send_reschedule(int cpu)return ; msg =kmalloc (sizeof (*msg),GFP_ATOMIC ); +if (!msg) +return ;memset (msg,0 ,sizeof (msg));INIT_LIST_HEAD (&msg->list); msg->type =BFIN_IPI_RESCHEDULE ;
@@ -314,6 +320,8 @@ void smp_send_stop(void)return ; msg =kmalloc (sizeof (*msg),GFP_ATOMIC ); +if (!msg) +return ;memset (msg,0 ,sizeof (msg));INIT_LIST_HEAD (&msg->list); msg->type =BFIN_IPI_CPU_STOP ;
Signature · 1 line
1.6.3.3
PATCH 21/21 Blackfin: define HARDIRQ_BITS again for now
In reply to Mike FrysingerThe default values of HARDIRQ_BITS and PREEMPT_BITS in common code leads to build failure:
In file included from include/linux/interrupt.h:12,
from include/linux/kernel_stat.h:8,
from arch/blackfin/kernel/asm-offsets.c:32:include/linux/hardirq.h:66:2: error: #error PREEMPT_ACTIVE is too low!
So until that gets resolved, just declare our own default value again.
--- arch/blackfin/include/asm/hardirq.h | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
arch/blackfin/include/asm/hardirq.h +3 -0
@@ -6,6 +6,9 @@extern void ack_bad_irq (unsigned int irq);#define ack_bad_irq ack_bad_irq +/* Define until common code gets sane defaults */ +#define HARDIRQ_BITS 9 +#include <asm-generic/hardirq.h> #endif
Signature · 1 line
1.6.3.3