Commit Graph

377 Commits

Author SHA1 Message Date
andrew
ebd36ca42d Set machine correctly on ARM. This allows universe to use the correct world
when building each kernel.

Reviewed by:	imp
2012-08-18 05:48:19 +00:00
imp
7af781f113 Preliminary Embest ATEB9200 support. 2012-08-16 05:03:59 +00:00
gonzo
f60463b5c4 Unbreak build for the rest of AT91 platforms 2012-08-15 18:33:58 +00:00
gonzo
68f6dc6efd Unbreak ATMEL kernel build 2012-08-15 08:34:31 +00:00
gonzo
032427f3e9 Merging projects/armv6, part 1
Cummulative patch of changes that are not vendor-specific:
	- ARMv6 and ARMv7 architecture support
	- ARM SMP support
	- VFP/Neon support
	- ARM Generic Interrupt Controller driver
	- Simplification of startup code for all platforms
2012-08-15 03:03:03 +00:00
imp
5d28872c59 Correct the PLLA setting functions and centralize. 2012-08-11 05:45:19 +00:00
imp
dc70787a30 Update comments about setting PLLA and refernce the tables in the
datasheet that express the limits.
2012-08-11 05:12:46 +00:00
imp
24e221572d Don't use C++ comments. 2012-08-11 05:03:30 +00:00
imp
bf2909cb37 More comments about setting PLLA, or rather that we never do. 2012-08-10 04:48:06 +00:00
imp
2c7a0e23b3 Add charge pump current register. 2012-08-10 04:47:20 +00:00
imp
e198ea51a0 Allow chip selects other than 0. The SAM9260EK board
has its dataflash on CS1.
2012-07-31 19:14:22 +00:00
imp
94d6c8b29d These files will support the whole at91sam9x5 family when done,
so rename them now before they get copied further afield...
2012-07-30 21:30:43 +00:00
imp
299454071c List the members of the AT91SAM9G45 family. 2012-07-30 21:19:19 +00:00
imp
7f5d6e7486 Fix a couple of comments about the rm9200, and fix a couple of indentation
issues.  Add note that we need to implement at91sam9260 erratum workaround.
2012-07-30 06:00:31 +00:00
imp
a0e5c55d62 Add the usb device (gadget) side of things. Also add ehci bindings
while I'm here in anticipation of usb2 support for newer SoCs.

Requested by:	Hans Petter Selasky
2012-07-27 17:31:19 +00:00
imp
8aa20c163b Add new at91sam9g45 support and sn9g45 board to the ATMEL kernel.
Adapt SN9G45 board support to cope with multi-board.
2012-07-27 16:38:02 +00:00
imp
6efc75434f Turns out the ETHERNUT5 isn't anything like the SAM9260-EK. Make this
board init match better: UART1 instead of UART2, No RMMI, no SPI0, SPI1
comments.
2012-07-27 05:33:55 +00:00
imp
19fa71edda Add (back?) ohci atmel attachment. 2012-07-27 05:28:02 +00:00
andrew
8497a64002 Add support for the DesignA Electronics Snapper9g45 System on Module.
Reviewed by:	imp
2012-07-26 08:05:28 +00:00
andrew
ab76299bf9 Add support for the Atmel AT91SAM9G45 CPU.
Reviewed by:	imp
2012-07-26 08:01:25 +00:00
imp
8ebd4a20e0 Some models have 6 USARTS + DBGU. Set a consistent name. 2012-07-26 05:46:56 +00:00
gonzo
df07abd457 Move unmask IRQ function call up to nexus device level.
FDT-enabled targets were broken after r238043 that relies
on device up the hierarchy to properly setup interrupt.
nexus device for ARM platforms did job only partially:
setting handler but not unmasking interrupt. Unmasking
was performed by platform code.

Reviewed by:	andrew@
2012-07-17 03:18:12 +00:00
imp
057a8ab456 These were never used, remove them. 2012-07-15 06:08:11 +00:00
imp
9acb87af3e Configure the peripheral pins for MCI devices. Eliminate the now-unused
at91_pio_rm9200.h.
2012-07-15 05:41:43 +00:00
imp
a709bd3b9d Add preliminary support for Atmel SAM9260-EK evaluation kit.
Initially identical to the Ethernut5, but will diverge shortly before
I refactor...
2012-07-14 06:13:23 +00:00
imp
3dcc564c1c uboot should be telling us it is an ETHERNUT5 for this board. Tag it
as such.
2012-07-14 06:00:37 +00:00
imp
a8c236d935 Create common routines for configuring the serial ports and use them
on all the at91rm9200 boards.
2012-07-14 05:46:52 +00:00
imp
28a7eca4eb For our at91rm9200 boards, register which subtype of SoC is on the
board.  We'll use this later to control the differences between these
two variants' pins.
2012-07-13 04:22:08 +00:00
imp
a8b00dea2c This file is no longer AT91RM9200 specific, but now is generic to all
Atmel AT91 SoC's we support.  Rename to reflect that.
2012-07-12 19:15:38 +00:00
imp
136515a603 Remember where we found the DBGU and use that for our console. 2012-07-12 19:11:37 +00:00
imp
65fd745ad0 Fix whitespace divot. 2012-07-12 13:54:24 +00:00
imp
2344bfa174 Complete the transition away from newbus to populate the children to
the linker set of CPU modules.  The newbus method, although clever,
had many flaws: it didn't really support multiple SoC, many of the
comments about order were just wrong, and it did a few things far too
late to be useful.  delay and cpu_reset now work much earlier in the
boot process.
2012-07-12 13:45:58 +00:00
imp
d3c013c5a4 Create the children devices for the SoC in atmelarm bus node, not in
the identify routine of the CPU.
2012-07-12 04:23:11 +00:00
imp
8cc7a49b96 Export the interrupt status vector via soc_data. Set the interrupt
priorities in the AIC in the atmelarm driver before attaching the
children.  Delete redunant copies of the code.
2012-07-12 02:58:45 +00:00
imp
515d0c1d29 Make the SoC stuff a little more modular, and start to move away from
having the CPU device that's a child of atmelarm that does stuff.

o Create a linker_set for the support fucntions for the SoCs.
o Rename soc_data to soc_info.
o Move the delay and reset function pointers to new soc_data struct
o Create elements for all known SoCs
o Add lookup of the SoC we found, and print a warning if it isn't one
  we know about.
2012-07-11 20:17:14 +00:00
imp
c72304b145 at91pit->at91_pit for consistnecy with other drivers. 2012-07-11 17:11:54 +00:00
imp
1d3ba5c3ca at91$DEV->at91_$DEV to match other Atmel drivers. Also, export
at91_rst_cpu_reset.
2012-07-11 17:11:07 +00:00
imp
cd114c7451 Remove some more unused code. 2012-07-10 23:11:52 +00:00
imp
e53b15fec4 Go ahead and disable the interrupts for the DBGU the boot loader may
have left enabled after we detect the CPU, and remove the multiplely
copied code from the SoC modules.
2012-07-10 19:48:42 +00:00
imp
296ee98cf6 Remove a useless bit of indirection. On all Atmel ARM products, irq 1
is the system IRQ, so use the define for it and get on with life.
2012-07-10 15:02:29 +00:00
imp
83b8fb1a63 Pure style mischief. at91_$DEV_ rather than at91$DEV_ to match
others.
2012-07-10 06:21:42 +00:00
imp
1d5b131f3f Minor rework to eliminate at91rm9200reg.h dependency and possibly set the
stage for a detach routine (unlikely to be useful, but while I was here..)
2012-07-10 06:18:53 +00:00
imp
06d108a4b9 Collapse all copies of at91_add_child into at91.c. They were
logically identical before today, and actually identical after today's
changes.
2012-07-10 04:17:49 +00:00
imp
af7577bff3 Missed one of the special AT91SAM9xxx_BASE defines. This should be
AT91_BASE.
2012-07-10 02:44:15 +00:00
imp
64e33d51d9 The system IRQ is always IRQ 1. Make it so. 2012-07-10 02:39:03 +00:00
imp
9d04a0db9c Eliminate the AT91XXXX_BASE for each SoC. AT91_BASE is the right way
to spell this since we only have one AT91_BASE for all Atmel arm9 SoCs.
2012-07-10 02:14:50 +00:00
imp
a5d922a754 Remove some unused variables/externs that have been copied too many times... 2012-07-10 01:49:50 +00:00
imp
5e867585e7 There's nothing AT91RM9200 specific about this file at all. 2012-07-10 01:13:00 +00:00
imp
3cb9677e87 Create a generic way to support multiple boards within an
arm platform.  Add all the atmel boards to the ATMEL kernel for
testing purposes.  Until boot loader arg parsing of baord type
is done, this won't actually be able to do the runtime selection.
2012-07-07 05:02:39 +00:00
imp
8ed7d610d0 Create a pseudo-lint kernel for all at91 SoCs. This kernel will not
currently boot, but will serve as a good linting.  make universe could
now be altered to skip building all the other at91 kernels...
2012-07-01 06:56:41 +00:00
imp
4ed0f24281 Opt-in rather than opt-out of the SoC. We don't really support
running with multiple SoCs compiled in very well anyway, so this just
wastes space.  As more and more SoCs arrive in the tree, it is better
to edit one master file that builds them all than many board files.
2012-07-01 06:34:17 +00:00
marius
f8115adb54 Exclude at91sam9x25 support, which just wastes space for Ethernut 5. 2012-06-30 14:48:52 +00:00
imp
d78e2429ba Tweak comment. 2012-06-29 06:06:19 +00:00
imp
214d9f3431 Add PIOD, make at91sam9x25 a standard SoC, tweak some comments. 2012-06-29 06:05:44 +00:00
imp
55778fcc7c Ooops, replaced the at91sam9g20 interrupt list with the at91sam9x25 ones. 2012-06-29 04:49:50 +00:00
imp
aef8c6386c Initital support for AT91SAM9X25 SoC and the SAM9X25-EK evaluation
board.  Much work remains.
2012-06-29 04:18:52 +00:00
imp
860e30dae9 Fix a stray debug that I committed accidentally years ago... 2012-06-22 06:44:22 +00:00
imp
deb86d102d Move these #defines to at91reg.h (where I should have put them in the
first place).
2012-06-22 05:54:34 +00:00
marius
8b8a1c1ea5 Revert the part of r236495 that introduced checking of SPI_SR_TXEMPTY
for TX transfer completion as for reasons unknown this occasionally
causes SPI_SR_RXBUFF and SPI_SR_ENDRX to not rise.
In any case, once the RX part of the transfer is done it's obvious
that the preceding TX part had finished and checking of SPI_SR_TXEMPTY
was introduced to rule out a possible cause for the data corruption
mentioned in r236495 but which didn't turn out to be the problem
anyway.

MFC after:	3 days
2012-06-18 20:14:42 +00:00
marius
691bfd067f Try to bring this file closer to style(9). 2012-06-18 19:47:25 +00:00
marius
ff81900109 Unbreak after r236658 by comparing the right things. 2012-06-18 19:22:10 +00:00
imp
9514ac24e9 Throw this debug behind bootverbose. The information isn't all that
exciting once the initial board bring up is over.
2012-06-16 04:34:46 +00:00
imp
88f68062a5 Make it possible to link together a sam and an rm kernel. The results
aren't very pretty yet, but this takes DELAY and cpu_reset and makes
them pointers.

# I worry that these are set too late in the boot, especially cpu_reset.
2012-06-15 08:37:50 +00:00
imp
1e270a72ac Collapse the files.at91 and files.at91sam9 back into files.at91.
Create a new option for at91rm9200 support.  Set this option in
std.at91.  Create a new option for the at91sam9 standard devices.  Set
this option in std.at91sam9.  Retire files.at91sam9.  Add options for
at91sam9x25 SoC and SAM9X25EK board, but don't connect it just yet as
the supporting files aren't quite ready.

Note: device at91rm9200 and device at91sam9 are presently mutually
exclusive.
2012-06-15 07:50:26 +00:00
imp
4d2f4108b0 Take half a step closer towards having a unified atmel kernel by
rearranging where we initialize the time counter and putting the
common stubs into a central place.
2012-06-15 06:38:55 +00:00
imp
b639382feb More Linux boot support. Create arm_dump_avail_init() to initialize
this array either from Linux boot data, when enabled, or in the
typical way that most ports do it.  arm_pyhs_avail_init is coming
soon since it must be a separate function.
2012-06-14 04:18:56 +00:00
imp
f69b442d94 Modify all the arm platform files to call parse_boot_param passing in
the boot parameters from initarm first thing.  parse_boot_param parses
the boot arguments and converts them to the /boot/loader metadata the
rest of the kernel uses.  parse_boot_param is a weak alias to
fake_preload_metadata, which all the platforms use now, but may become
more extensive in the future.

Since it is a weak symbol, specific boards may define their own
parse_boot_param to interface to custom boot loaders.

Reviewed by:	cognet@, Ian Lapore
2012-06-14 04:00:30 +00:00
imp
8839854e93 Strip trailing whitespace before other changes. 2012-06-13 04:52:19 +00:00
andrew
454415d4a3 Remove an unneeded increment from initarm. The variable is uninitialised,
is not used in this part of the function and correctly initialised later
when it is used.
2012-06-10 10:40:22 +00:00
andrew
723899fa5c Pull out the common code to initialise proc0 & thread0 from initarm to a
common function.

Reviewed by:	imp
2012-06-10 01:13:04 +00:00
imp
826e2b55c7 Remove stray break; that resulted from a last-minute, untested change. 2012-06-06 14:31:14 +00:00
imp
691dfc2d38 Enhance the Atmel SoC chip identification routines to account for more
SoC variants.  Fold the AT91SAM9XE chips into the AT91SAM9260
handling, where appropriate.  The following SoCs/SoC families are recognized:
	at91cap9, at91rm9200, at91sam9260, at91sam9261, at91sam9263,
	at91sam9g10, at91sam9g20, at91sam9g45, at91sam9n12, at91sam9rl,
	at91sam9x5
and the following variations are also recognized:
	at91rm9200_bga, at91rm9200_pqfp, at91sam9xe, at91sam9g45, at91sam9m10,
	at91sam9g46, at91sam9m11, at91sam9g15, at91sam9g25, at91sam9g35,
	at91sam9x25, at91sam9x35
This is only the identification routine: no additional Atmel devices
are supported at this time.

# With these changes, I'm able to boot to the point of identification
# on a few different Atmel SoCs that we don't yet support using the
# KB920X config file -- someday tht will be an ATMEL config file...
2012-06-06 06:19:52 +00:00
imp
fe9edacbcc Remove dead code. 2012-06-05 14:19:59 +00:00
imp
7670aa6951 Eliminate the now-unused AT91C_MASTER_CLOCK option and change the one
place in the source it was used to the more correct AT91C_MAIN_CLOCK.
Sort AT91C_MAIN_CLOCK into a better location in the options.arm file.
2012-06-04 04:24:59 +00:00
imp
c875946e79 Minor rearrangement of the locore <-> initarm interface. Pass in a
structure with the first 4 registers to allow a wider range of boot
loaders to work.  Future commits will make use of this to centralize
support for the different loaders.
2012-06-03 18:34:32 +00:00
imp
d8faea2753 Remove stray repeated line... 2012-06-03 05:36:25 +00:00
marius
9edaefbc6b - Prepend the device description with "AT91" to reflect its nature. [1]
- Move DMA tag and map creature to at91_spi_activate() where the other
  resource allocation also lives. [1]
- Flesh out at91_spi_deactivate(). [1]
- Work around the "Software Reset must be Written Twice" erratum.
- For now, run the bus at the slowest speed possible in order to work
  around data corruption on transit even seen with 9 MHz on ETHERNUT5
  (15 MHz maximum) and AT45DB321D (20 MHz maximum). This also serves as
  a poor man's work-around for the "NPCSx rises if no data data is to be
  transmitted" erratum of RM9200. Being able to use the appropriate bus
  speed would require:
  1) Adding a proper work-around for the RM9200 bug consisting of taking
     the chip select control away from the SPI peripheral and managing it
     directly as a GPIO line.
  2) Taking the maximum frequencies supported by the actual board and the
     slave devices into account and basing the whole thing on the master
     clock instead of hardcoding a divisor as previously done.
  3) Fixing the above mentioned data corruption.
- KASSERT that TX/RX command and data sizes match on transfers.
- Introduce a mutex ensuring that only one child device is running a SPI
  transfer at a time. [1]
- Add preliminary, #ifdef'ed out support for setting the chip select. [1]
- Use the RX instead of the TX commando size when setting up the RX side
  of a transfer.
- For controllers having SPI_SR_TXEMPTY, i.e. !RM9200, also wait for the
  completion of the TX part of transfers before stopping the whole thing
  again.
- Use DEVMETHOD_END. [1]
- Use NULL instead of 0 for pointers. [1, partially]

Additional testing by:  Ian Lepore

Submitted by:   Ian Lepore [1]
MFC after:      1 week
2012-06-03 00:54:10 +00:00
imp
ff434e7926 Revert debug and other immature code accidentally committed in r236372. 2012-06-01 03:00:36 +00:00
imp
efd4b91d2a Initialize the clocks before we call cninit() so that the serial
console so initialized will work upon return from cninit.  While this
is the very next line, other platforms setup all this stuff before
calling cninit.  Also, initialize the SDRAM base register in the inner
block in at91_ramsize().
2012-06-01 02:55:42 +00:00
imp
0a32ad9a42 Compute the master clock frequency, so we no longer need to have it
compiled into the kernel.  This allows us to boot the same kernel on
machines with different master clock frequencies, so long as we can
determine the main clock frequency accurately.  Cleanup the pmc clock
init function so it can be called in early boot so we can use the
serial port just after we call cninit.

# We have two calls to at91_pmc_clock_init for reasons unknown, that will
# be fixed later -- it is harmless for now.
2012-05-29 03:23:18 +00:00
imp
36592c67a8 Be a little less magical, not that these values are likely to change... 2012-05-21 07:47:57 +00:00
imp
d9369891ab Another minor re-arrangement of the code: calcualte the master clock
frequency in the at91_pmc_clock_init rather than passing it in.  Allow
for frequencies >= 21MHz by rounding to the nearest 500Hz (Idea from
Ian Lapore whose company uses a similar arrangement in their product).
at91_pmc_clock_init() is now nearly independent of the rest of the pmc
driver (which means we may be able to call it much earlier in boot
soon to eliminate the master clock config file requirement for printf
to work during early boot and also eliminate some interdependencies
with the device ordering which requires pmc to be the first device
added).
2012-05-21 04:24:58 +00:00
imp
c72ac48503 Minor cleanup before some more major changes:
o main_clock_hz isn't used, eliminate it
o move main clock calculation code and table so we have only one ifdef.
2012-05-20 20:50:40 +00:00
marius
7fcdbd9dc2 Add glue/support for the SAM9XE512-based Ethernut 5 boards. Currently,
all integrated and on-board peripherals except the DataFlash (at91_spi(4)
and at45d(4) still need to be unb0rken) and NAND Flash (missing NAND
framework) are working.
AFAICT, this makes FreeBSD the first operating system besides Nut/OS
supporting Ethernut 5 out of tree.
2012-05-12 18:11:26 +00:00
imp
2aac3bff63 Hack to unbreak boot2 for at91rm9200 boot loader. When the at91sam
code came in, it moved things around which wound up breaking the
build.  We have to do this bit of a hack to avoid duplication of a lot
of #defines.
2012-05-11 14:40:25 +00:00
imp
d3b0b7e392 Fix comment about what board this is really for left over from early
cut and paste.
2012-05-02 18:41:58 +00:00
imp
cecdf5f9b6 The PIT is really 16 bytes long (0x10) not 10 bytes long. Doesn't
matter much, since these defines are unused...

Obtained from:	AT91SAM9G20 datasheet
2012-05-02 09:19:42 +00:00
marius
06cf74a20c - Add missing locking in at91_usart_getc().
- Align the RX buffers on the cache line size, otherwise the requirement
  of partial cache line flushes on every are pretty much guaranteed. [1]
- Make the code setting the RX timeout match its comment (apparently,
  start and stop bits were missed in the previous calculation). [1]
- Cover the busdma operations in at91_usart_bus_{ipend,transmit}() with
  the hardware mutex, too, so these don't race against each other.
- In at91_usart_bus_ipend(), reduce duplication in the code dealing with
  TX interrupts.
- In at91_usart_bus_ipend(), turn the code dealing with RX interrupts
  into an else-if cascade in order reduce its complexity and to improve
  its run-time behavior.
- In at91_usart_bus_ipend(), add missing BUS_DMASYNC_PREREAD calls on
  the RX buffer map before handing things over to the hardware again. [1]
- In at91_usart_bus_getsig(), used a variable of sufficient width for
  storing the contents of USART_CSR.
- Use KOBJMETHOD_END.
- Remove an unused header.

Submitted by:	Ian Lepore [1]
Reviewed by:	Ian Lepore
MFC after:	1 week
2012-05-01 20:42:03 +00:00
marius
39ad66504e - Add support for MCI1 revision 2xx controllers and a work-around for their
"Data Write Operation and number of bytes" erratum.
- Use DEVMETHOD_END.
- Use NULL instead of 0 for pointers.
2012-04-22 00:43:32 +00:00
marius
330283063f Generate an obviously missing STOP when having finished transmitting data.
This fixes communication with PCF8563.
2012-04-14 17:27:34 +00:00
marius
460b10f523 Add support for the Atmel SAM9XE familiy of microcontrollers, which
consist of a ARM926EJ-S processor core with up to 512 Kbytes of on-chip
flash. Tested with SAM9XE512.

This file was missed in r234291.
2012-04-14 17:17:55 +00:00
marius
c2d55bde65 Add support for the Atmel SAM9XE familiy of microcontrollers, which
consist of a ARM926EJ-S processor core with up to 512 Kbytes of on-chip
flash. Tested with SAM9XE512.
2012-04-14 17:09:38 +00:00
marius
66d2871df6 - Try to bring these files closer to style(9).
- Use DEVMETHOD_END.
- Use NULL instead of 0 for pointers.
2012-04-14 11:29:32 +00:00
uqs
bb016fc00a Remove spurious 8bit chars, turning files into plain ASCII. 2012-01-15 13:23:33 +00:00
kevlo
c96884d89b Check the return value of BUS_SETUP_INTR()
Reviewed by:	imp
2011-10-27 10:21:40 +00:00
kevlo
a99e6ac189 Remove pointless semicolons after label 2011-09-30 04:55:23 +00:00
rwatson
55dd870b96 Follow up to r225203 refining break-to-debugger run-time configuration
improvements:

(1) Implement new model in previously missed at91 UART driver
(2) Move BREAK_TO_DEBUGGER and ALT_BREAK_TO_DEBUGGER from opt_comconsole.h
    to opt_kdb.h (spotted by np)
(3) Garbage collect now-unused opt_comconsole.h

MFC after:	3 weeks
Approved by:	re (bz)
2011-08-27 14:24:27 +00:00
kevlo
827f99272d Remove duplicate header includes 2011-06-26 10:07:48 +00:00
cognet
86e3f53481 Typo fix 2011-04-25 18:15:45 +00:00
cognet
5dc900439d Get myself a brain, move the call to init_param1() before the first use in
at91_machdep.c, and do it for the files I forgot the first time

Reported by:	andrew
Submitted by:	pluknet
2011-02-21 13:11:05 +00:00