Commit Graph

1091 Commits

Author SHA1 Message Date
Mike Frysinger 6843f405da Blackfin: define HARDIRQ_BITS again for now
The 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.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-07-16 13:56:07 -04:00
Julia Lawall 994e9a2e01 arch/blackfin: Add kmalloc NULL tests
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>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-07-16 01:52:54 -04:00
Graf Yang 5bc6e3cfe6 Blackfin: add CPLB entries for Core B on-chip L1 SRAM regions
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.

Signed-off-by: Graf Yang <graf.yang@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-07-16 01:52:51 -04:00
Robin Getz f574a76a3b Blackfin: work around anomaly 05000189
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.

Signed-off-by: Robin Getz <robin.getz@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-07-16 01:52:48 -04:00
Michael Hennerich c70c754ff9 Blackfin: drop per-cpu loops_per_jiffy tracking
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.

Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-07-16 01:52:44 -04:00
Michael Hennerich c03c2a8734 Blackfin: fix bugs in GPIO resume code
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

Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-07-16 01:52:42 -04:00
Barry Song 4c94c3e09a Blackfin: bf537-stamp: fix irq decl for AD7142
The AD7142 add-on card hooks the IRQ line up to PG5, not PF5.

Signed-off-by: Barry Song <barry.song@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-07-16 01:52:40 -04:00
Robin Getz ad863a9dc9 Blackfin: fix handling of IPEND in interrupt context save
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.

Signed-off-by: Robin Getz <robin.getz@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-07-16 01:52:38 -04:00
Robin Getz 3a920accbb Blackfin: drop duplicate runtime checking of anomaly 05000448
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.

Signed-off-by: Robin Getz <robin.getz@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-07-16 01:52:34 -04:00
Michael Hennerich ebd5833327 Blackfin: fix incomplete renaming of the bfin-twi-lcd driver
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.

Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-07-16 01:52:32 -04:00
Sonic Zhang f1c717fbf8 Blackfin: fix wrong CTS inversion
The Blackfin serial headers were inverting the CTS value leading to wrong
handling of the CTS line which broke CTS/RTS handling completely.

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-07-16 01:52:30 -04:00
Graf Yang 10a5ecd03f Blackfin: update handling of anomaly 364 (wrong rev id in BF527-0.1)
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.

Signed-off-by: Graf Yang <graf.yang@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-07-16 01:52:28 -04:00
Mike Frysinger 532f07ca04 Blackfin: fix early_dma_memcpy() handling of busy channels
The 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.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-07-16 01:52:26 -04:00
Mike Frysinger fb4b5d3a37 Blackfin: handle BF561 Core B memory regions better when SMP=n
Rather 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.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-07-16 01:52:24 -04:00
Jie Zhang 8399a74f61 Blackfin: fix miscompilation in lshrdi3
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
Signed-off-by: Jie Zhang <jie.zhang@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-07-16 01:52:23 -04:00
Robin Getz dc437b1b59 Blackfin: fix silent crash when no uClinux MTD filesystem exists
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.

Signed-off-by: Robin Getz <robin.getz@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-07-16 01:52:21 -04:00
Mike Frysinger 15627bd35c Blackfin: restore exception banner when dumping crash info
Previous unification code put the exception banner behind the "is oops"
logic when it should have been printed all the time.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-07-16 01:52:20 -04:00
Robin Getz 0e4edcf0b0 Blackfin: work around anomaly 05000281
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.

Signed-off-by: Robin Getz <robin.getz@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-07-16 01:52:19 -04:00
Graf Yang 976119bc5d Blackfin: update anomaly lists to match latest sheets/usage
Signed-off-by: Graf Yang <graf.yang@analog.com>
Signed-off-by: Cliff Cai <cliff.cai@analog.com>
Signed-off-by: Robin Getz <robin.getz@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-07-16 01:52:17 -04:00
Mike Frysinger b2dc0a0884 Blackfin: drop dead flash_probe call
There 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.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-07-16 01:39:45 -04:00
Robin Getz 1997660cea Blackfin: cleanup code a bit with comments and defines
Improve the assembly with a few explanatory comments and use symbolic
defines rather than numeric values for bit positions.

Signed-off-by: Robin Getz <robin.getz@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-07-16 01:39:39 -04:00
Alexey Dobriyan 405f55712d headers: smp_lock.h redux
* Remove smp_lock.h from files which don't need it (including some headers!)
* Add smp_lock.h to files which do need it
* Make smp_lock.h include conditional in hardirq.h
  It's needed only for one kernel_locked() usage which is under CONFIG_PREEMPT

  This will make hardirq.h inclusion cheaper for every PREEMPT=n config
  (which includes allmodconfig/allyesconfig, BTW)

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-07-12 12:22:34 -07:00
Peter Zijlstra c99e6efe1b sched: INIT_PREEMPT_COUNT
Pull the initial preempt_count value into a single
definition site.

Maintainers for: alpha, ia64 and m68k, please have a look,
your arch code is funny.

The header magic is a bit odd, but similar to the KERNEL_DS
one, CPP waits with expanding these macros until the
INIT_THREAD_INFO macro itself is expanded, which is in
arch/*/kernel/init_task.c where we've already included
sched.h so we're good.

Cc: tony.luck@intel.com
Cc: rth@twiddle.net
Cc: geert@linux-m68k.org
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Acked-by: Matt Mackall <mpm@selenic.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-07-10 14:24:05 -07:00
Joe Perches ad361c9884 Remove multiple KERN_ prefixes from printk formats
Commit 5fd29d6ccb ("printk: clean up
handling of log-levels and newlines") changed printk semantics.  printk
lines with multiple KERN_<level> prefixes are no longer emitted as
before the patch.

<level> is now included in the output on each additional use.

Remove all uses of multiple KERN_<level>s in formats.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-07-08 10:30:03 -07:00
FUJITA Tomonori 42b86e06c7 Blackfin: fix dma-mapping build errors
The recent deprecation of dma_sync_{sg,single} ironically broke Blackfin
systems.  This is because we don't define dma_sync_sg_for_cpu at all, so
until the DMA asm-generic conversion/cleanup is done after the next
release, simply stub out the dma_sync_sg_for_{cpu,device} functions.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-06-22 22:31:00 -04:00
Mike Frysinger 5ecf3e03cd Blackfin: hook up new perf_counter_open syscall
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-06-22 21:47:40 -04:00
Yi Li 986d6c1e05 Blackfin: drop BF535-specific text for exception 0x2A (unaligned instruction)
We don't support the BF535 at all, and the exception 0x2A text specific to
it is pretty verbose and confusing (since the behavior is simply odd), so
punt it to keep the noise down.

Signed-off-by: Yi Li <yi.li@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-06-22 21:16:19 -04:00
Robin Getz bd854c077e Blackfin: fix early crash when booting on wrong cpu
Make sure we process the kernel command line before poking the hardware,
so that we can process early printk.  This helps ensure that if you boot
a kernel configured for a different processor, something will be left in
the log buffer.

Signed-off-by: Robin Getz <robin.getz@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-06-22 21:16:17 -04:00
Mike Frysinger 3aca47c020 Blackfin: fix GPTMR0_CLOCKSOURCE dependency on BFIN_GPTIMERS
The GPTMR0_CLOCKSOURCE Kconfig option requires the gptimers framework, so
make sure it is selected when this option is enabled.

Reported-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-06-22 21:16:15 -04:00
Mike Frysinger 3a7f5b1605 Blackfin: drop unused ISP1760 port1_disable from board resources
The port1 disable stuff was dropped from the USB ISP1760, so update the
Blackfin boards accordingly.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-06-22 21:16:13 -04:00
Graf Yang ee48efb5dc Blackfin: bf526-ezbrd: handle different SDRAM chips
The BF526-EZBRD changed SDRAM chips between board revisions, so create a
timing table that can accommodate both.

Signed-off-by: Graf Yang <graf.yang@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-06-22 21:16:12 -04:00
Graf Yang 8f580f7c82 Blackfin: fix typo in TRAS define in mem_init.h header
We defined SDRAM_tRAS to TRAS_4, but then wrongly defined SDRAM_tRAS_num
to 3.

Signed-off-by: Graf Yang <graf.yang@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-06-22 21:16:10 -04:00
Mike Frysinger fa48f84a8c Blackfin: unify memory map headers
Many aspects of the Blackfin memory map is exactly the same across all
variants.  Rather than copy and paste all of these duplicated values in
each header, unify all of these into the common Blackfin memory map header
file.  In the process, push down BF561 SMP specific stuff to the BF561
specific header to keep the noise down.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-06-22 21:16:07 -04:00
Robin Getz 985895bd8d Blackfin: stick the CPU name into boot image name
Rather than use "Linux" in the boot image name (as this is redundant --
the image type is already set to "linux"), use the CPU name.  This makes
it fairly obvious when a wrong image is accidentally booted.  Otherwise
there is no kernel output and you waste time scratching your head
wondering wtf just happened.

Signed-off-by: Robin Getz <rgetz@blackfin.uclinux.org>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-06-22 21:16:03 -04:00
Mike Frysinger 841a534367 Blackfin: update defconfigs
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-06-22 21:16:01 -04:00
Jie Zhang 41ba653f24 Blackfin: decouple unrelated cache settings to get exact behavior
The current cache options don't really represent the hardware features.
They end up setting different aspects of the hardware so that the end
result is to turn on/off the cache.  Unfortunately, when we hit cache
problems with the hardware, it's difficult to test different settings to
root cause the problem.  The current settings also don't cleanly allow for
different caching behaviors with different regions of memory.

So split the configure options such that they properly reflect the settings
that are applied to the hardware.

Signed-off-by: Jie Zhang <jie.zhang@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-06-22 21:15:59 -04:00
Philippe Gerum 7c039a90f0 Blackfin: update I-pipe patch level
Signed-off-by: Philippe Gerum <rpm@xenomai.org>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-06-22 21:15:58 -04:00
Philippe Gerum 5ba3b249c9 Blackfin: remove obsolete mcount support from I-pipe code
Signed-off-by: Philippe Gerum <rpm@xenomai.org>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-06-22 21:15:56 -04:00
Philippe Gerum a40494a62a Blackfin: allow CONFIG_TICKSOURCE_GPTMR0 with interrupt pipeline
Signed-off-by: Philippe Gerum <rpm@xenomai.org>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-06-22 21:15:54 -04:00
Philippe Gerum 06ecc190f3 Blackfin: convert interrupt pipeline to irqflags
Signed-off-by: Philippe Gerum <rpm@xenomai.org>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-06-22 21:15:53 -04:00
Mike Frysinger 3d15f302d0 Blackfin: allow people to select BF51x-0.1 silicon rev
Now that 0.1 of the BF51x is coming out, allow people to build for it.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-06-22 21:15:51 -04:00
Graf Yang dc2c46bb70 Blackfin: bf526-ezbrd: set SPI flash resources to SST device
The BF526-EZBRD has a SST SPI flash on it, not a ST Micro.

Signed-off-by: Graf Yang <graf.yang@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-06-22 21:15:49 -04:00
Sonic Zhang 0de4adfb8c Blackfin: fix accidental reset in some boot modes
We read the SWRST (Software Reset) register to get at the last reset
state, and then we may configure the DOUBLE_FAULT bit to control behavior
when a double fault occurs.  But if the lower bits of the register is
already set (like UART boot mode on a BF54x), we inadvertently make the
system reset by writing to the SYSTEM_RESET field at the same time.  So
make sure the lower 4 bits are always cleared.

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-06-22 21:15:48 -04:00
Mike Frysinger 81b79c213d Blackfin: abstract irq14 lowering in do_irq
Split out the optional IRQ14 lowering code to further simplify the
asm_do_IRQ() function and keep the ifdef nest under control.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-06-22 21:15:46 -04:00
Mike Frysinger 6f10fdabdc Blackfin: simplify irq stack overflow checking
Take a page from x86 and abstract the stack checking out of the
asm_do_IRQ() function so that the result is easier to digest.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-06-22 21:15:43 -04:00
Mike Frysinger 46f288a0f9 Blackfin: only build show_interrupts() when procfs is enabled
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-06-22 21:15:42 -04:00
Mike Frysinger 26579216f3 Blackfin: redo handling of bad irqs
With the common IRQ code initializing much more of the irq_desc state, we
can't blindly initialize it ourselves to the local bad_irq state.  If we
do, we end up wrongly clobbering many fields.  So punt most of the bad irq
code as the common layers will handle the default state, and simply call
handle_bad_irq() directly when the IRQ we are processing is invalid.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-06-22 21:15:40 -04:00
Mike Frysinger a200ad22bb Blackfin: update anomaly lists
Update anomaly headers to match latest released anomaly sheets.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-06-22 21:15:38 -04:00
Mike Frysinger 4d5e6fd42c Blackfin: bf533-ezkit: add resources for FISP devices
The BF533-EZKIT has two Flash In-System Programming devices hooked up to
the async memory bus, so add resources for the primary flashes and the
SRAMs on the devices.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-06-22 21:15:37 -04:00
Mike Frysinger 2780cd6434 Blackfin: bf518f-ezbrd: update DSA resources
The common DSA code changed structure layout, so update the BF518F-EZBRD
resources accordingly.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-06-22 21:15:36 -04:00