Commit Graph

57 Commits (1a0c009ac53de4a7664a1239936f0bc258133156)

Author SHA1 Message Date
Haavard Skinnemoen d6c49a7a78 [AVR32] extint: Set initial irq type to low level
David Brownell pointed out a mismatch in the avr32 extint code:

> I noticed a small glitch that's not fixed by this patch:  the
> initial type is falling edge, but IRQ_TYPE_NONE is mapped to
> IRQ_TYPE_LEVEL_LOW.  Potentially surprising.

Fix it by setting the initial type (and handler) to low level,
matching the meaning of IRQ_TYPE_NONE.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
2008-01-25 08:31:44 +01:00
David Brownell e4f586f280 [AVR32] extint: change set_irq_type() handling
Update the AVR32 EIC code to use the new __set_irq_handler_unlocked()
call, getting rid of one more instance of this widespread problem.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
2008-01-25 08:31:44 +01:00
Haavard Skinnemoen e7ba176b47 [AVR32] NMI debugging
Change the NMI handler to use the die notifier chain to signal anyone
who cares. Add a simple "nmi debugger" which hooks into this chain and
that may dump registers, task state, etc. when it happens.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
2008-01-25 08:31:43 +01:00
Haavard Skinnemoen 438ff3f3cc [AVR32] Add support for AT32AP7001 and AT32AP7002
These are derivatives of the AT32AP7000 chip, which means that most of
the code stays the same. Rename a few files, functions, definitions
and config symbols to reflect that they apply to all AP700x chips, and
exclude some platform devices from chips where they aren't present.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
2008-01-25 08:31:41 +01:00
Haavard Skinnemoen 597702aeb4 [AVR32] Export intc_get_pending symbol
Oprofile needs to call intc_get_pending() in order to determine
whether a performance counter interrupt is pending.

Also, include the header which declares intc_get_pending() and fix the
definition to match the prototype.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
2007-11-15 13:47:20 +01:00
ben.nizette@iinet.net.au 80f76c54bd [AVR32] Fix duplicate clock index in at32ap machine code
There's a duplicate clock index between USART0 and USART1 which may be
causing system crashes when USART0 is used.  Change the USART0 index
to '3', indicating the clock that is actually used by USART0.

Signed-off-by: Ben Nizette <ben@niasdigital.com>
Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
2007-11-15 13:47:20 +01:00
Haavard Skinnemoen 3a65a69d49 [AVR32] Turn off debugging in SMC driver
Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
2007-11-15 13:47:19 +01:00
Hans-Christian Egtvedt 9797bed20e Extend I/O resource for wdt0 for at32ap7000 devices
This patch extends the I/O resource to 0xfff000cf which will enable the
watchdog driver to access the reset cause (RCAUSE) register. Making it
capable of reporting boot status.

Signed-off-by: Hans-Christian Egtvedt <hcegtvedt@atmel.com>
Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
2007-11-15 13:47:19 +01:00
Alejandro Martinez Ruiz 2298a1dd81 [AVR32] ARRAY_SIZE() cleanup
Signed-off-by: Alejandro Martinez Ruiz <alex@flawedcode.org>
Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
2007-10-23 11:20:26 +02:00
Haavard Skinnemoen eaf5f925a3 [AVR32] Implement at32_add_device_cf()
Implement at32_add_device_cf() which will add a platform_device for
the at32_cf driver (not merged yet). Separate out most of the
at32_add_device_ide() code and use it to implement
at32_add_device_cf() as well.

This changes the API in the following ways:
  * The board code must initialize data->cs to the chipselect ID to
    use before calling any of these functions.
  * The board code must use GPIO_PIN_NONE to indicate unused CF pins.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
2007-10-23 11:20:05 +02:00
Haavard Skinnemoen 2042c1c4e7 [AVR32] Implement more at32_add_device_foo() functions
Implement functions for adding platform devices for TWI, MCI, AC97C
and ABDAC. They may need to be modified to cope with platform data,
etc. when the corresponding drivers are ready to be merged, but such
changes are much less likely to conflict than adding support for a
whole new type of device.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
2007-10-23 11:19:32 +02:00
Haavard Skinnemoen 86298962c0 [AVR32] Fix a couple of sparse warnings
Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
2007-10-23 11:19:24 +02:00
Kristoffer Nyborg Gregertsen 48021bd93c [AVR32] Platform code for pata_at32
This patch adds platform code for PATA devices on the AP7000.

[hskinnemoen@atmel.com: board code left out for now since stk1000
	doesn't support IDE out of the box]
Signed-off-by: Kristoffer Nyborg Gregertsen <kngregertsen@norway.atmel.com>
Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
2007-10-23 11:19:05 +02:00
Kristoffer Nyborg Gregertsen af8184718a [AVR32] SMC configuration in clock cycles
This patch makes the SMC configuration take timings in clock cycles
instead of nanoseconds. A function to calculate timings in clock
cycles is added.

This patch removes the rounding troubles of the previous SMC
configuration method.

[hskinnemoen@atmel.com: fix atstk1002/atngw100 flash config]
Signed-off-by: Kristoffer Nyborg Gregertsen <gregerts@stud.ntnu.no>
Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
2007-10-11 13:32:49 +02:00
Haavard Skinnemoen 6fcf061511 [AVR32] Wire up USBA device
Implement at32_add_device_usba() and use it to wire up the USBA device
on ATSTK1000 and ATNGW100.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
2007-10-11 11:40:27 +02:00
Matteo Vit 7808fa4853 [AVR32] add multidrive support for pio driver
This patch add multidrive support for pio driver

Signed-off-by: Matteo Vit - Dave S.r.l. <matteo.vit@dave.eu>
Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
2007-10-11 11:38:41 +02:00
David Brownell d938b89392 [AVR32] /sys/kernel/debug/at32ap_clk
When debugfs is available, /sys/kernel/debug/at32ap_clk will provide a
dump of the power manager registers and of the current clock tree.  This
can help sorting out various surprises, and when making runtime PM work.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
2007-10-11 11:38:41 +02:00
Haavard Skinnemoen 2417a130bd [AVR32] Move AT32_PM_BASE definition into pm.h
We don't want to redefine this in every file that needs to access
the PM.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
2007-10-11 11:38:41 +02:00
Hans-Christian Egtvedt 9cf6cf58d0 [AVR32] Add Atmel SSC driver platform device to AT32AP architecture
This patch adds register definitions, clocks and IRQs to the platform devices.

Signed-off-by: Hans-Christian Egtvedt <hcegtvedt@atmel.com>
Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
2007-07-18 20:45:52 +02:00
Hans-Christian Egtvedt 9e58e1855c [AVR32] CPU frequency scaling for AT32AP
This patch enables CPU frequency scaling for AT32AP devices. This will
enable the CPU to scale between the speed of the high speed bus and
the master clock and thus save some power.

The patch also adds a parent to cpu_clk and a cpu_clk_set_rate to
enable changing the CPU clock divider in a sane way.

The driver does not check if the given rate is 0, thus resulting in a
div by 0.  I think this check should be go into the clk_set_rate
framework, and not here.

Tested on AT32AP7000/ATSTK1000.

Hardware documentation can be found in the AT32AP7000 datasheet.

Signed-off-by: Hans-Christian Egtvedt <hcegtvedt@atmel.com>
Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
2007-07-18 20:45:51 +02:00
Haavard Skinnemoen 7a5b805907 [AVR32] Split SM device into PM, RTC, WDT and EIC
Split the SM platform device into separate platform devices for PM,
RTC, WDT and EIC. This is more correct according to the documentation
and allows us to simplify the code a little.

Also turn the EIC driver into a real platform driver.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
Acked-by: Hans-Christian Egtvedt <hcegtvedt@atmel.com>
2007-07-18 20:45:51 +02:00
David Brownell 6b84bbfc71 [AVR32] Initialize dma_mask and dma_coherent_mask
The current at32ap7000 platform devices aren't declared as supporting DMA,
so that layered drivers can't tell whether they need to manage DMA.

This patch makes all those platform devices report that they support DMA.
Most do, but in a few cases this is inappropriate.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
2007-06-23 14:53:16 +02:00
Haavard Skinnemoen d0a2b7af27 [AVR32] Implement platform hooks for atmel_lcdfb driver
This modifies and extends the existing lcdc platform code to support
the new atmel_lcdfb driver. The ATSTK1000 board code is set up to use
the on-board Samsung LTV350QV LCD panel.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
2007-05-15 14:13:27 +02:00
Thomas Gleixner e89b064a4f AVR32: Spinlock initializer cleanup
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
2007-05-09 08:48:39 +02:00
Haavard Skinnemoen e3e7d8d4ea [AVR32] Make I/O access macros work with external devices
Fix the I/O access macros so that they work with externally connected
devices accessed in little-endian mode over any bus width:

* Use a set of macros to define I/O port- and memory operations
  borrowed from MIPS.
* Allow subarchitecture to specify address- and data-mangling
* Implement at32ap-specific port mangling (with build-time
  configurable bus width. Only one bus width at a time supported
  for now.)
* Rewrite iowriteN and friends to use write[bwl] and friends
  (not the __raw counterparts.)

This has been tested using pata_pcmcia to access a CompactFlash card
connected to the EBI (16-bit bus width.)

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
2007-04-27 13:44:14 +02:00
Haavard Skinnemoen 188ff65d49 [AVR32] Don't enable clocks with no users
Bring the code that sets the initial PM clock masks in line with the
comment preceding it by only enabling clocks that have users != 0.
Fix SM clock definition and avr32_hpt_init() so that the SM and TC0
clocks keep ticking.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
2007-04-27 13:44:13 +02:00
Hans-Christian Egtvedt 7760989e5e [AVR32] Change system timer from count-compare to Timer/Counter 0
Due to limitation of the count-compare system timer (not able to
count when CPU is in sleep), the system timer had to be changed to
use a peripheral timer/counter.

The old COUNT-COMPARE code is still present in time.c as weak
functions. The new timer is added to the architecture directory.

This patch sets up TC0 as system timer The new timer has been tested
on AT32AP7000/ATSTK1000 at 100 Hz, 250 Hz, 300 Hz and 1000 Hz.

For more details about the timer/counter see the datasheet for
AT32AP700x available at

http://www.atmel.com/dyn/products/product_card.asp?part_id=3903

Signed-off-by: Hans-Christian Egtvedt <hcegtvedt@atmel.com>
Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
2007-04-27 13:44:12 +02:00
Haavard Skinnemoen 228e845fd2 [AVR32] Add mach-specific Kconfig
Include at32ap-specific Kconfig file from top-level Kconfig file. The
at32ap Kconfig is currently empty, but it will grow some machine-
specific options soon.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
2007-04-27 13:43:27 +02:00
Hans-Christian Egtvedt 068d9f6eb9 [AVR32] Add nwait and tdf parameters to SMC configuration
Complete the SMC configuration code by adding nwait and tdf
parameter. After this change, we support the same parameters as the
hardware.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
2007-04-27 13:43:27 +02:00
Haavard Skinnemoen 9c8f8e7524 [AVR32] Add basic HMATRIX support
This adds register and clock definitions for the High-speed bus Matrix
(HMATRIX) as well as a function that can be used to configure special
EBI functionality like CompactFlash and NAND flash support.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
2007-04-27 12:58:50 +02:00
David Brownell 28735a7253 [PATCH] gpio_direction_output() needs an initial value
It's been pointed out that output GPIOs should have an initial value, to
avoid signal glitching ...  among other things, it can be some time before
a driver is ready.  This patch corrects that oversight, fixing

 - documentation
 - platforms supporting the GPIO interface
 - users of that call (just one for now, others are pending)

There's only one user of this call for now since most platforms are still
using non-generic GPIO setup code, which in most cases already couples the
initial value with its "set output mode" request.

Note that most platforms are clear about the hardware letting the output
value be set before the pin direction is changed, but the s3c241x docs are
vague on that topic ...  so those chips might not avoid the glitches.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Acked-by: Andrew Victor <andrew@sanpeople.com>
Acked-by: Milan Svoboda <msvoboda@ra.rockwell.com>
Acked-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
Cc: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-03-16 19:25:04 -07:00
Haavard Skinnemoen 9a596a6236 [AVR32] at32_spi_setup_slaves should be __init
Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
2007-03-07 10:50:26 +01:00
Linus Torvalds 59b8175c77 Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm
* 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm: (117 commits)
  [ARM] 4058/2: iop32x: set ->broken_parity_status on n2100 onboard r8169 ports
  [ARM] 4140/1: AACI stability add ac97 timeout and retries
  [ARM] 4139/1: AACI record support
  [ARM] 4138/1: AACI: multiple channel support for IRQ handling
  [ARM] 4211/1: Provide a defconfig for ns9xxx
  [ARM] 4210/1: base for new machine type "NetSilicon NS9360"
  [ARM] 4222/1: S3C2443: Remove reference to missing S3C2443_PM
  [ARM] 4221/1: S3C2443: DMA support
  [ARM] 4220/1: S3C24XX: DMA system initialised from sysdev
  [ARM] 4219/1: S3C2443: DMA source definitions
  [ARM] 4218/1: S3C2412: fix CONFIG_CPU_S3C2412_ONLY wrt to S3C2443
  [ARM] 4217/1: S3C24XX: remove the dma channel show at startup
  [ARM] 4090/2: avoid clash between PXA and SA1111 defines
  [ARM] 4216/1: add .gitignore entries for ARM specific files
  [ARM] 4214/2: S3C2410: Add Armzone QT2410
  [ARM] 4215/1: s3c2410 usb device:  per-platform vbus_draw
  [ARM] 4213/1: S3C2410 - Update definition of ADCTSC_XY_PST
  [ARM] 4098/1: ARM: rtc_lock only used with rtc_cmos
  [ARM] 4137/1: Add kexec support
  [ARM] 4201/1: SMP barriers pair needed for the secondary boot process
  ...

Fix up conflict due to typedef removal in sound/arm/aaci.h
2007-02-19 13:18:39 -08:00
Haavard Skinnemoen 41d8ca452f [AVR32] Use per-controller spi_board_info structures
Set up one spi_board_info array per controller and pass this to
at32_add_device_spi so that it can set up any GPIO pins for chip
selects based on this information.

Extracted from a patch by David Brownell and adapted slightly.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
2007-02-16 14:01:40 +01:00
Haavard Skinnemoen 23cebe2287 [AVR32] Warn, don't BUG if clk_disable is called too many times
Print a helpful warning along with a stack dump if clk_disable is
called on a already-disabled clock. Remove the BUG_ON().

Extracted from a patch by David Brownell.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
2007-02-16 13:19:47 +01:00
Haavard Skinnemoen 7a5fe23879 [AVR32] Make sure all genclocks have a parent
Initialize the parent field of each generic clock by looking at the
PM registers. This means that the genclock operations can always
assume that the parent field is non-null, so they don't have to
check. Also remove a few unnecessary BUG_ON()s.

Extracted from a patch by David Brownell.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
2007-02-16 13:14:33 +01:00
Haavard Skinnemoen 3d60ee1b04 [AVR32] SPI platform code update
Move stuff in spi.c into ATSTK1002 board code and update SPI
platform device definitions according to the new GPIO API.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
2007-02-09 15:01:59 +01:00
Haavard Skinnemoen 7f9f467863 [AVR32] Add PIOE device and reserve SDRAM pins
The PIOE device was left out before because it muxes SDRAM pins (and
is therefore a bit dangerous to mess with) and because no existing
drivers had any use for it.

It is needed for CompactFlash, however, and now that we have a way
to protect the SDRAM pins, it can be safely added.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
2007-02-09 15:01:58 +01:00
Haavard Skinnemoen e7f70b8cc6 [AVR32] Introduce at32_reserve_pin()
at32_reserve_pin() can be used for reserving portmux pins without
altering their configuration. Useful for e.g. SDRAM pins where we
really don't want to change the bootloader-provided configuration.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
2007-02-09 15:01:58 +01:00
Haavard Skinnemoen dde251033f [AVR32] Don't reset PIO state at bootup
Leave the PIO lines as the bootloader left them. This allows us to
use PIOE without disturbing the SDRAM muxing.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
2007-02-09 15:01:58 +01:00
Haavard Skinnemoen 6a4e5227a3 [AVR32] GPIO API implementation
Arch-neutral GPIO calls for AVR32. GPIO IRQ support written by
David Brownell.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
2007-02-09 15:01:58 +01:00
David Brownell 58febc0b13 [AVR32] ext int fixes
Bugfixes for external irq handler set_irq_type():

 - If set_irq_type() can't set the type, don't change anything!

 - It's not OK to change the flow handler as part of set_irq_type(),
   among other issues that violates spinlock rules.  Instead, we can
   call the relevant handler when we demux the external interrupts.

 - The external irq demux has no need to grab the spinlock.  And in
   fact grabbing it that way was wrong, since that code might be
   pre-empted by an irq at a different priority level, and that code
   might then have tried to grab that spinlock...

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
2007-02-09 15:01:57 +01:00
David Brownell a3d912c8fa [AVR32] fix serial port setup on ATSTK1000
Fixes to USART setup on the stk-1000 ... don't configure USART 2, since
its TXD/RXD are used for INT-A and INT-B buttons; and configure USART 0
(for IRDA, and with corrected IRQ) iff SW2 has a non-default setting.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
2007-02-09 15:01:57 +01:00
Andrew Victor 9d0412680e [ARM] 4124/1: Rename mach-at91rm9200 and arch-at91rm9200 directories
Now that Linux includes support for the Atmel AT91SAM9260 and
AT91SAM9261 processors in addition to the original Atmel AT91RM9200
(with support for more AT91 processors pending), the "mach-at91rm9200"
and "arch-at91rm9200" directories should be renamed to indicate their
more generic nature.

The following git commands should be run BEFORE applying this patch:
  git-mv arch/arm/mach-at91rm9200 arch/arm/mach-at91
  git-mv include/asm-arm/arch-at91rm9200 include/asm-arm/arch-at91

Signed-off-by: Andrew Victor <andrew@sanpeople.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2007-02-08 14:50:56 +00:00
Haavard Skinnemoen 695621183e [AVR32] Implement intc_get_pending()
intc_get_pending() returns a bitmask with pending interrupts in a
interrupt controller group (irq). This is used by the upcoming
oprofile implementation for avr32 and may also be useful for chained
interrupt controller drivers.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
2006-12-08 13:08:10 +01:00
Haavard Skinnemoen 01cb087e74 [AVR32] Set flow handler for external interrupts
Make sure that the flow handler for external interrupts is updated
whenever they type is changed. Also make sure that the defaults
correspond with how the interrupt controller is configured.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
2006-12-08 13:06:23 +01:00
Haavard Skinnemoen da58e92f1f [AVR32] Remove unused file
Remove arch/avr32/mach-at32ap/sm.c, which is not referenced by
any Makefile.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
2006-12-08 13:06:22 +01:00
Haavard Skinnemoen cfcb3a89d0 [AVR32] Add macb1 platform_device
Add platform_device definition and pio init code for the second
ethernet controller in AT32AP7000.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
2006-12-08 13:06:18 +01:00
Haavard Skinnemoen c3e2a79c0b [AVR32] Portmux API update
Rename portmux_set_func to at32_select_periph, add at32_select_gpio
and add flags parameter to specify the initial state of the pins.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
2006-12-08 13:06:17 +01:00
Haavard Skinnemoen 452976b298 [PATCH] AVR32: Use __raw MMIO access for internal peripherals
The read[bwl] and write[bwl] functions are meant for accessing PCI
devices. How this is achieved on AVR32 is unknown, as there are no
systems with a PCI bridge available yet.

On-chip peripheral access, however, should not depend on how we end
up implementing PCI access, so using __raw_read[bwl]/__raw_write[bwl]
is the right thing to do for on-chip peripherals. This patch converts
the drivers for the static memory controller, interrupt controller,
PIO controller and system manager to use __raw MMIO access.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-25 20:26:33 -07:00