Commit Graph

413 Commits

Author SHA1 Message Date
Warner Losh
fd420f84dd Honor the disabled status by only grabbing resources and returning
when running under FDT.
2014-02-13 16:50:08 +00:00
Warner Losh
88bc24ff35 Fix board ID too... 2014-02-13 15:47:41 +00:00
Warner Losh
2956b2b069 Fix board name. 2014-02-13 15:46:08 +00:00
Ian Lepore
42c8459bed Rework the EARLY_PRINTF mechanism. Instead of defining a special eprintf()
routine, now a platform can provide a pointer to an early_putc() routine
which is used instead of cn_putc().  Control can be handed off from early
printf support to standard console support by NULLing out the pointer
during standard console init.

This leverages all the existing error reporting that uses printf calls,
such as panic() which can now be usefully employed even in early
platform init code (useful at least to those who maintain that code and
build kernels with EARLY_PRINTF defined).

Reviewed by:	imp, eadler
2014-02-12 00:53:38 +00:00
Ian Lepore
7233ddb0cb Check in the "real" board_tsc4370 file in place of the stubbed out one.
Real means the one TSC / Symmetricom / Microsemi actually uses on their 4370
and other rm9200 boards.  This code demonstrates a variety of useful things
board init code can do, including adjusting the master clock frequency.
2014-02-11 21:13:37 +00:00
Ian Lepore
46aa33b2ac If someone tries to boot a generic ATMEL kernel that has no board_init()
routine compiled in, print a friendly error message about it rather than
mysteriously hanging while trying to init 4GB of nonexistant ram.
2014-02-09 21:21:10 +00:00
Warner Losh
1ef5f6a006 Add FDT attachment. 2014-02-09 21:02:46 +00:00
Warner Losh
c6053263cc FDT attachment... 2014-02-09 21:01:53 +00:00
Warner Losh
3526a97bba Add TWI attachment for FDT. We're only matching the SAMG20 device for
now, others to follow.
2014-02-09 21:01:10 +00:00
Warner Losh
bf5c70c929 Add FDT attachment. 2014-02-09 21:00:22 +00:00
Warner Losh
22a484c9d5 Add FDT attachment. Flag lost functionality with FDT_HACKS so we can
find it later.
2014-02-09 20:59:46 +00:00
Warner Losh
bc259c9157 Add FDT attachment. 2014-02-09 20:58:03 +00:00
Warner Losh
4da9131d2a Add FDT attachment, plus minor code shuffle. 2014-02-09 20:57:26 +00:00
Warner Losh
210c0e4c87 Add FDT attachment. 2014-02-09 20:56:39 +00:00
Warner Losh
bad391b21c Add FDT matching code. 2014-02-09 20:55:49 +00:00
Ian Lepore
73ab448c43 No need to set physmem in each initarm() instance anymore, it's handled
in common code now.
2014-02-09 14:46:50 +00:00
Ian Lepore
0c27b1d4fd It turns out a global variable is the only straightforward way to
communicate the kernel's physical load address from where it's known in
initarm() into cpu_mp_start() which is called from non-arm code and
takes no parameters.

This adds the global variable and ensures that all the various copies
of initarm() set it.  It uses the variable in cpu_mp_start(), eliminating
the last uses of KERNPHYSADDR outside of locore.S (where we can now
calculate it instead of relying on the constant).
2014-02-09 02:39:00 +00:00
Ian Lepore
ca3eec15c0 Replace compile-time constant KERNPHYSADDR with abp_physaddr (determined
at runtime) where it's trivial to do so.  Another breadcrumb on the trail
to a kernel that can be loaded at any 1MB boundary.
2014-02-09 01:21:30 +00:00
Ian Lepore
5698bf8c86 Consolidate code related to setting up physical memory configuration into
a new physmem.c file.  The new code provides helper routines that can be
used by legacy SoCs and newer FDT-based systems.  There are routines to
add one or more regions of physically contiguous ram, and exclude one or
more physically contiguous regions of ram.  Ram can be excluded from crash
dumps, from being given over to the vm system for allocation management,
or both.  After all the included and excluded regions have been added,
arm_physmem_init_kernel_globals() processes the regions into the global
dump_avail and phys_avail arrays and realmem and physmem variables that
communicate memory configuration to the rest of the kernel.

Convert all existing SoCs to use the new helper code.
2014-02-08 23:54:16 +00:00
Andrew Turner
9e4ed33024 Use abp_physaddr for the physical address over KERNPHYSADDR. This helps us
remove the need to load the kernel at a fixed address.
2014-02-06 20:35:33 +00:00
Warner Losh
a865b1a02e Fix AT91SAM9260 to work with PA rather than VA device addresses. 2014-02-01 17:53:35 +00:00
Warner Losh
cb3b48b05d Move these for diff reduction against FDT work. 2014-01-31 23:38:05 +00:00
Warner Losh
9aa2e6f381 Minor cleanup of comments. 2014-01-31 23:28:18 +00:00
Warner Losh
4587b6e9fd Switch to using PAs rather than VAs for the addresses we map for
devices. This is a nop, except for what's reported by atmelbus for the
resources.

It would be nice if we could dymanically allocated these things, but
the pmap_mapdev panics if we don't keep the static mappings, so we
still need to play the carefully allocate VA space between all
supported SoC game.

User's with their own devices may need to make adjustments.
2014-01-31 15:38:05 +00:00
Warner Losh
8b1bf92acc When mapping an address, the bsh needs the same offset we do for other
things.
2014-01-31 01:18:34 +00:00
Andrew Turner
979d76c948 Remove STARTUP_PAGETABLE_ADDR from the ARM configs and replace it with
memory at the end of the kernel.

This helps reduce the SoC and board specific configuration required.

Reviewed by:	bsdimp
Tested by:	jmg (armeb), br
2014-01-28 09:12:04 +00:00
Warner Losh
9107643c54 Before resetting the USART, delay a bit to allow the transmitter to
finish the current character to drain to avoid glitching. Also,
simplify the code a smidge.
2014-01-26 04:57:58 +00:00
Warner Losh
1fb293548d Make early printf output nicer by inserting a carriage return before
any linefeeds that are output.
2014-01-25 21:57:45 +00:00
Warner Losh
a500a7ce91 Bus space handles need to be the VA of the requested resource, not the
rounded page VA. Correct so the DBGU device can be mapped for FDT
console since it isn't on a page boundary.
2014-01-25 21:52:19 +00:00
Andrew Turner
9bd8ce289b Fix gcc with -Wstrict-prototypes by telling it bi_emac takes no parameters. 2014-01-25 19:36:27 +00:00
Warner Losh
0da1cf4094 Remove redundant declaration for uart devclass.
Commint some unrelated, but harmless, FDT ifdefs.
2014-01-24 16:50:15 +00:00
Warner Losh
52e996ac52 Implement support for early printf. You need to define SOCDEV_{PA,VA}
as described in the comments for the eputc function in your config file.
2014-01-22 21:49:20 +00:00
Warner Losh
2bff652222 Connect NAND for the SAM9260EK eval board, as well as the HotE HL-201.
# expect more refinement as do more boards.
2014-01-19 17:59:34 +00:00
Warner Losh
7b94bdc970 Add standard memory controller helper functions. 2014-01-19 17:45:13 +00:00
Warner Losh
7855b0bd68 Add data so we can convert a PIO unit number into a base address. 2014-01-15 19:53:36 +00:00
Warner Losh
db9765adeb Provide a simplified way to specify GPIO pins for the Atmel port. 2014-01-15 19:49:12 +00:00
Warner Losh
6f4f8f233c Set the SoC name for the atmelbus name. 2013-12-30 18:10:04 +00:00
Warner Losh
f83ed22cb6 Plumb the cn_grab and cn_ungrab routines down into the uart
clients. Mask RX interrupts while grabbed on the atmel serial
driver. This UART interrupts every character. When interrupts are
enabled at the mountroot> prompt, this means the ISR eats the
characters. Rather than try to create a cooperative buffering system
for the low level kernel console, instead just mask out the ISR. For
NS8250 and decsendents this isn't needed, since interrupts only happen
after 14 or more characters (depending on the fifo settings). Plumb
such that these are optional so there's no change in behavior for all
the other UART clients. ddb worked on this platform because all
interrupts were disabled while it was running, so this problem wasn't
noticed. The mountroot> issue has been around for a very very long
time.

MFC after:	3 days
2013-12-21 16:23:31 +00:00
Warner Losh
9336463d86 Loose -> Lose so this sentence makes sense.
MFC after:	3 days
2013-12-11 15:32:28 +00:00
Warner Losh
19dab280cc Fix one race and one fence post error. When the TX buffer was
completely full, we'd not complete any of the mbufs due to the fence
post error (this creates a large leak). When this is fixed, we still
leak, but at a much smaller rate due to a race between ateintr and
atestart_locked as well as an asymmetry where atestart_locked is
called from elsewhere.  Ensure that we free in-flight packets that
have completed there as well. Also remove needless check for NULL on
mb, checked earlier in the loop and simplify a redundant if.

MFC after:	3 days
2013-12-11 05:32:29 +00:00
Warner Losh
0b40a04719 Although not strictly required to boot a 64MB board, bump
vm_max_virtual_address to be KERNVIRTADDR + 256MB. This allows some
future shock protection since the KVA requirements have gone up since
the unmapped changes have gone in, as well as preventing us from
overlapping with the hardware devices, which we map at 0xd0000000,
which we'd hit with anything more than 85MB...

MFC after:	3 days
2013-12-06 18:41:16 +00:00
Ian Lepore
f32d80bf1f Add a nand flash controller driver for Atmel at91 family. Tested only
on at91rm9200 so far.

The files.at91 has listed a nand driver for ages, but it never existed.
2013-12-02 03:52:40 +00:00
Ian Lepore
ca38150ce3 Add definitions for the additional PIO pins found on recent AT91 SoCs. 2013-12-02 02:33:03 +00:00
Eitan Adler
7a22215c53 Fix undefined behavior: (1 << 31) is not defined as 1 is an int and this
shifts into the sign bit.  Instead use (1U << 31) which gets the
expected result.

This fix is not ideal as it assumes a 32 bit int, but does fix the issue
for most cases.

A similar change was made in OpenBSD.

Discussed with:	-arch, rdivacky
Reviewed by:	cperciva
2013-11-30 22:17:27 +00:00
Ian Lepore
c6ff193255 Call cpu_setup() from the initarm() routine on platforms that don't use
the common FDT-aware initarm() in arm/machdep.c.

Pointed out by:	     cognet
Pointy hat to:	     ian
2013-11-21 01:08:10 +00:00
Ian Lepore
3110e7eed8 Move remaining code and data related to static device mapping into the
new devmap.[ch] files.  Emphasize the MD nature of these things by using
the prefix arm_devmap_ on the function and type names (already a few of
these things found their way into MI code, hopefully it will be harder to
do by accident in the future).
2013-11-04 22:45:26 +00:00
Nathan Whitehorn
87cb964b92 Fix typo. Sorry! 2013-10-29 23:55:17 +00:00
Nathan Whitehorn
cd43f427f6 A last BUS_PROBE_NOWILDCARD. Move setting the postfilter function into the
attach function probe shouldn't actually set anything up but just bid
on the device.
2013-10-29 14:44:36 +00:00
Ian Lepore
99895358c0 Sweep up a bit of arm-land fallout after r257244; include necessary
headers directly that are no longer available via accidental include.
2013-10-28 15:20:17 +00:00
Ian Lepore
6489412064 Remove #include <machine/frame.h> from all the arm code that doesn't
really need it.  That would be almost everywhere it was included.  Add
it in a couple files that really do need it and were previously getting
it by accident via another header.
2013-10-27 01:34:10 +00:00