Commit Graph

268 Commits

Author SHA1 Message Date
Marius Strobl
da20f734c0 Try to bring this file closer to style(9). 2012-06-18 19:47:25 +00:00
Marius Strobl
352a43b07f Unbreak after r236658 by comparing the right things. 2012-06-18 19:22:10 +00:00
Warner Losh
6212b9963b 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
Warner Losh
b44f8e5e1e 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
Warner Losh
e6e7584dcd 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
Warner Losh
1591de53b1 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
Warner Losh
3590dad094 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
Warner Losh
d39655d7a4 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
Warner Losh
6a7be52dbe Strip trailing whitespace before other changes. 2012-06-13 04:52:19 +00:00
Andrew Turner
16072bc718 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 Turner
4ea15b8776 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
Warner Losh
c6aea9681a Remove stray break; that resulted from a last-minute, untested change. 2012-06-06 14:31:14 +00:00
Warner Losh
73a4b7a9d8 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
Warner Losh
a687c5ecc9 Remove dead code. 2012-06-05 14:19:59 +00:00
Warner Losh
537cdfaff1 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
Warner Losh
4623180919 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
Warner Losh
5fd9ec69d6 Remove stray repeated line... 2012-06-03 05:36:25 +00:00
Marius Strobl
31a2c906d7 - 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
Warner Losh
b33fdab5e0 Revert debug and other immature code accidentally committed in r236372. 2012-06-01 03:00:36 +00:00
Warner Losh
b8b0747b3c 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
Warner Losh
c414207ab0 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
Warner Losh
32f648079f Be a little less magical, not that these values are likely to change... 2012-05-21 07:47:57 +00:00
Warner Losh
e5db213663 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
Warner Losh
c41941dfeb 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 Strobl
0a7ac239c9 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
Warner Losh
9434786e88 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
Warner Losh
f5fbd56ca7 Fix comment about what board this is really for left over from early
cut and paste.
2012-05-02 18:41:58 +00:00
Warner Losh
b847531ac8 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 Strobl
8a7eceb74a - 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 Strobl
f7f6865e6d - 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 Strobl
83a8745245 Generate an obviously missing STOP when having finished transmitting data.
This fixes communication with PCF8563.
2012-04-14 17:27:34 +00:00
Marius Strobl
de98dfa146 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 Strobl
0f0819525b 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 Strobl
bef0709e64 - 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
Ulrich Spörlein
004a39cd57 Remove spurious 8bit chars, turning files into plain ASCII. 2012-01-15 13:23:33 +00:00
Kevin Lo
a32376dd76 Check the return value of BUS_SETUP_INTR()
Reviewed by:	imp
2011-10-27 10:21:40 +00:00
Kevin Lo
d11bbab85d Remove pointless semicolons after label 2011-09-30 04:55:23 +00:00
Robert Watson
e5a0927394 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
Kevin Lo
281f0ca8e7 Remove duplicate header includes 2011-06-26 10:07:48 +00:00
Olivier Houchard
cef9635e50 Typo fix 2011-04-25 18:15:45 +00:00
Olivier Houchard
3e9a516ed4 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
Olivier Houchard
04f86cb130 Oops, wasn't supposed to commit this. 2011-02-13 20:04:29 +00:00
Olivier Houchard
e9e1639ac0 Call init_param1() much earlier, so that msgbufsize is non-zero when we want
to map and use the msgbuf.
2011-02-13 20:02:46 +00:00
Bernd Walter
57abf9f47b unbreak mutlicast hash creation for the second time.
at91_emac hardware is *not* using ether_crc32_be algorithm!
2011-02-07 01:13:57 +00:00
Sergey Kandaurov
4053b05b91 Make MSGBUF_SIZE kernel option a loader tunable kern.msgbufsize.
Submitted by:	perryh pluto.rain.com (previous version)
Reviewed by:	jhb
Approved by:	kib (mentor)
Tested by:	universe
2011-01-21 10:26:26 +00:00
John Baldwin
e9dc47ee81 - Use macbstart_locked() directly instead of deferring it to a task.
- Expand locking scope in interrupt handler.
- Flesh out the detach routine.

Reviewed by:	cognet
2011-01-06 19:32:00 +00:00
Warner Losh
fb1f3084ea Remove support for SKYEYE simulator 2011-01-05 23:45:07 +00:00
Kevin Lo
7df9d5acad Fix double ;; 2010-12-06 10:24:06 +00:00
Marius Strobl
b56f1ea9d4 Remove a device_printf() accidentally left in r213894.
Submitted by:	jhb
2010-10-15 15:16:36 +00:00
Marius Strobl
d6c65d276e Converted the remainder of the NIC drivers to use the mii_attach()
introduced in r213878 instead of mii_phy_probe(). Unlike r213893 these
are only straight forward conversions though.

Reviewed by:	yongari
2010-10-15 15:00:30 +00:00