History log of /freebsd-10.1-release/sys/arm/at91/
Revision Date Author Comments
272461 03-Oct-2014 gjb

Copy stable/10@r272459 to releng/10.1 as part of
the 10.1-RELEASE process.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


266386 18-May-2014 ian

MFC 265852: Map device memory using PTE_DEVICE rather than PTE_NOCACHE.


266311 17-May-2014 ian

MFC 262952, 262958, 262966, 262979, 262980, 262986, 262987, 262995, 262997,
263030, 263033, 263034, 263056, 263057,

Remove all the redundant external declarations of exception vectors and
runtime setting of the pointers that's scattered around various places.

Remove all traces of support for ARM chips prior to the arm9 series.

Make the default exception handler vectors point to where I thought they
were already pointing: the default handlers (not a panic that says there
is no default handler).

Eliminate irq_dispatch.S. Move the data items it contained into
arm/intr.c and the functionality it provided into arm/exception.S.

Move the exception vector table (so-called "page0" data) into exception.S
and eliminate vectors.S.

Change the way the asm GET_CURTHREAD_PTR() macro is defined so that code
using it doesn't have to have an "AST_LOCALS" macro somewhere in the file.

Arrange for arm fork_trampoline() to return to userland via the standard
swi_exit code in exception.S instead of having its own inline expansion
of the DO_AST and PULLFRAME macros.

Now that the PUSHFRAME and PULLFRAME macros are used only in the swi
entry/exit code, they don't need to be macros. Except that didn't work
and the whole change was reverted.

Remove some unnecessary indirection and jump right to the handler functions.

Use panic rather than printf to "handle" an arm26 address exception
(should never happen on arm32).

Remove the unreferenced DATA() macro.

Remove #include <machine/asmacros.h> from files that don't need it.


266277 17-May-2014 ian

MFC 257774, 256760, 262916, 262905, 262918, 262919, 262920, 262921, 262924,
262925, 262929, 262932, 262935, 262940, 262941, 262942, 262948, 262949,
262950

Strip arm/conf/DEFAULTS down to just items that are mandatory for running
the architecture.

Move all the files named foo/common.c to foo/foo_common.c

Initial cut for DTS on the hl201 board.

Add commented out dts for sam9260ek as well as early printf support.

Make clock optional on uart nodes, then back it out ("I don't know what I
was thinking, but it is lame.")

Set the baud rate if it isn't 0

Make at91_soc_id() public.

Properly round at91 resource on unmapping.

Move AT91 AIC related stuff to own file.

Fix another bug in multicast filtering. i.MX uses 6 bits from MSB in
LE CRC32 for the hash value, not the lowest 6 bits in BE CRC32.

Follow r262916 with one more config file that references a renamed common.c

Remove bogus AT91 define that causes compile errors. Most of the defines
for SAM9X are going away soonish anyway (once FDT works), but until
then...

Remove all dregs of a per-thread undefined-exception-mode stack.

Rework the VFP code that handles demand-based save and restore of state.

Always call vfp_discard() on thread death.

When a thread begins life it doesn't own the VFP hardware state on any cpu.

Make undefined exception entry MP-safe.


266217 16-May-2014 ian

MFC r262591, r262592, r262593, r262597, r262598, r262599, r262600, r262601,
r262606

Initial import of Linux/Vendor DTS files for various embedded boards.

Initial import of DTS files from Linux

Correct initial import script

New AT91 devices or fdt probe added to existing devices. Some of these
are just stubs for testing the new dts.
- nand
- SDRAMC
- shdwc
- tcb
- usb host and gadget


266207 16-May-2014 ian

MFC r262534, r262548, r262549, r262552, r262568, r262581, r262583, r262584,
r262585, r262587, r262696, r262712

Replace many pasted identical definitions of cpu_initclocks() with a common
implementation in arm/machdep.c.

aicasm: Don't complain about missing prototypes to ease bootstrap issues.

Vybrid: Add driver for Inter-Integrated Circuit (I2C).

imx6: Initialize the Low Power Mode bits to keep the ARM cores running
during WFI.

All our current ARM multi-core systems have all cores in one package with
a shared L2 cache, reflect that in the common cpu_topo() routine.

mpcore timer: Supply a DELAY() implementation via weak linkage, so that
SoC-specific code can supply a better implementation.

imx6: Add some rudimentary voltage control.

Add an armv7 implementation of cpu_sleep().

Add __used attribute so that the DELAY implementation doesn't get
optimized away as unreferenced, causing linker errors when trying to
resolve the weak reference to the missing function.


266197 15-May-2014 ian

MFC r261786, r261789

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.

Convert two while(1); statements into proper panics.


266196 15-May-2014 ian

MFC r261681, r261682, r261683, r261684, r261685, r261686, r261687, r261688,
r261689, r261690, r261783, r261791, r261836, r261837, r261841,

Add FDT matching code to AT91 device drivers.

Better nomatch messages: include compat string. Also, flag devices as
disabled in the successful probe message, but leave what that means to
the actual driver (no semantic changes).

Fix Embest board name and id.

Honor the disabled status by only grabbing resources and returning
when running under FDT in the AT91 SPI driver.


266194 15-May-2014 ian

MFC r261643, r261646, r261648, r261649, r261651, r261656, r261657, r261663,
r261676, r261677, r261698, r261778

Consolidate code related to setting up physical memory configuration into
a new physmem.c file.

Replace compile-time constant KERNPHYSADDR with abp_physaddr

Calculate the kernel's load address from the PC in the elf / gzip
trampoline instead of relying on KERNPHYSADDR as a compile-time constant.

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.

Remove the now unused MMU_INIT macro.

Use vm_paddr_t, not vm_offset_t, when dealing with physical addresses.

No need to set physmem in each initarm() instance anymore, it's handled
in common code now.

Pass the pagetable used from locore.S to initarm to allow it to map data
in as required.

Fix the physmem exclude-region clipping logic for the edge-trim case.

Add some extra debugging output when DEBUG is defined.

Update legacy platforms to use new arm_physmem helper routines.


266160 15-May-2014 ian

MFC r261423, r261424, r261516, r261513, r261562, r261563, r261564, r261565,
r261596, r261606

Add the imx sdhci controller.

Move Open Firmware device root on PowerPC, ARM, and MIPS systems to
a sub-node of nexus (ofwbus) rather than direct attach under nexus. This
fixes FDT on x86 and will make coexistence with ACPI on ARM systems easier.
SPARC is unchanged.

Add the missing ')' at end of sentence. Reword it to use a more common idiom.

Pass the kernel physical address to initarm through the boot param struct.

Make functions only used in vfp.c static, and remove vfp_enable.

Fix __syscall on armeb EABI. As it returns a 64-bit value it needs to
place 32-bit data in r1, not r0. 64-bit data is already packed correctly.

Use abp_physaddr for the physical address over KERNPHYSADDR. This helps us
remove the need to load the kernel at a fixed address.

Remove references to PHYSADDR where it's used only in debugging output.

Dynamically generate the page table. This will allow us to detect the
physical address we are loaded at to change the mapping.


266110 15-May-2014 ian

MFC r261252, r261279, r261304, r261305, r261322, r261336, r261337, r261338,
r261353

Fix the name of the dts file for the HL201...

When mapping an address, the bsh needs the same offset we do for other things.

Add explicit depends on bus_if.h and device_if.h to avoid a
chicken and egg problem in some compilation environments.

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.

Comment cleanups. Move things around for diff reduction against FDT work.


266097 14-May-2014 ian

MFC r260886, r261165, r261171, r261172, r261214

Fix gcc with -Wstrict-prototypes by telling it bi_emac takes no
parameters.

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.

Make early printf output nicer by inserting a carriage return before
any linefeeds that are output.

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.

Remove extra parens to silence clang warning.


266095 14-May-2014 ian

MFC r261083, r261092, r261126, r261127, r261128, r261129, r261130, r261131

Add Atmel serial drivers.

uart clock-frequency is a FreeBSD-specific extention. Make it optional and
allow the client uart drivers to decide if a frequency is required.

Remove redundant declaration for uart devclass.
Commit some unrelated, but harmless, FDT ifdefs.

Add at91 NAND support, Fix comment.

Remove obsolete options and fix comments


266094 14-May-2014 ian

MFC r261038, r261039, r261040, r261041

Implement generic support for early printf.


266087 14-May-2014 ian

MFC r260695, r260696, r260884, r260885, r260886, r260887

Provide a simplified way to specify GPIO pins for the Atmel port.

Add at91 data so we can convert a PIO unit number into a base address.

Add at91 standard memory controller helper functions.

Generalize AT91 NAND support a bit.

Connect NAND for the SAM9260EK eval board, as well as the HotE HL-201.

Add nand device and NANDFS into the mix for those at91 boards that have
support for it at the moment.


266065 14-May-2014 ian

MFC r260092, r260093, r260121, r260180,

Allow AT91_MCI_ALLOW_OVERCLOCK to be an option in kernel config files.

Set the SoC name for the atmelbus name.

Add support for Samsung K9F2G08U0A (256MiB SLC) NAND

Comment updates.


265999 14-May-2014 ian

MFC r257334, r257336, r257337, r257338, r257341, r257342, r257343, r257370,
r257368, r257416

Hints-only devices should return BUS_PROBE_NOWILDCARD from their probe
methods.


262698 02-Mar-2014 imp

MRC: r260886

Merge only the uart_dev_at91usart.c part of this revision,
since it has nothing to do with the commit log and was included
by mistake there.

This connects the new grab/ungrab upcalls that were revised
in uart to fix mountroot>.


261455 04-Feb-2014 eadler

MFC r258779,r258780,r258787,r258822:

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.

Similar to the (1 << 31) case it is not defined to do (2 << 30).

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.


259759 23-Dec-2013 imp

MFC r259685:

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.

Approved by: re@ (gjb@)


259381 14-Dec-2013 ian

MFC r259212, r259220:

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.


259380 14-Dec-2013 ian

MFC r259038, r259039:

Bump the maximum VM space from 3 * memory size to a fixed
256MB. That's all we have room for since we map the hardware registers
starting at 0xd0000000. This allows my 64MB AT91SAM9G20 to boot again
after the unmmaped I/O changes were MFC'd at r251897. Other
subplatforms may need similar treatment.

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...


259379 14-Dec-2013 ian

MFC r258828:

Add a nand flash controller driver for Atmel at91 family. Tested only
on at91rm9200 so far.


259378 14-Dec-2013 ian

MFC r258820: Add definitions for the PIO pins found on recent AT91 SoCs.


259377 14-Dec-2013 ian

MFC r258392, r258412:

Call cpu_setup() immediately after the page tables are installed. This
enables data cache and other chip-specific features. It was previously
done via an early SYSINIT, but it was being done after pmap and vm setup,
and those setups need to use mutexes. On some modern ARM platforms,
the ldrex/strex instructions that implement mutexes require the data cache
to be enabled.

Call cpu_setup() from the initarm() routine on platforms that don't use
the common FDT-aware initarm() in arm/machdep.c.


259364 14-Dec-2013 ian

MFC r257648, r257649, r257660:

Begin reducing code duplication in arm pmap.c and pmap-v6.c by factoring
out common code related to mapping device memory into a new devmap.c file.

Remove the growing duplication of code that used pmap_devmap_find_pa() and
then did some math with the returned results to generate a virtual address,
and likewise in reverse to get a physical address. Now there are a pair
of functions, arm_devmap_vtop() and arm_devmap_ptov(), to do that. The
bus_space_map() implementations are rewritten in terms of these.

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).


259342 13-Dec-2013 ian

MFC r257258, r257265: Include headers (if_var.h and others) where needed.

The change that triggered the need for this on head was r257244. That
hasn't been MFC'd yet, but there's no harm in paving the way for it with
this MFC.


259329 13-Dec-2013 ian

MFC r257199, r257200, r257217:

Remove all #include <machine/pmap.h> from arm code. It's already
included by vm/pmap.h, which is a prerequisite for arm/machine/pmap.h
so there's no reason to ever include it directly.

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.

Remove the last dregs of trapframe_t. It turns out only arm was using
this type, so remove it to make arm code more consistant with other
platforms.


256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


254025 07-Aug-2013 jeff

Replace kernel virtual address space allocation with vmem. This provides
transparent layering and better fragmentation.

- Normalize functions that allocate memory to use kmem_*
- Those that allocate address space are named kva_*
- Those that operate on maps are named kmap_*
- Implement recursive allocation handling for kmem_arena in vmem.

Reviewed by: alc
Tested by: pho
Sponsored by: EMC / Isilon Storage Division


249232 07-Apr-2013 hselasky

Fix regression issue after r248910.

PR: arm/177685
Submitted by: Christoph Mallon <christoph.mallon@gmx.de>


248964 01-Apr-2013 ian

Enable hardware flow control and high speed bulk data transfer in at91 uarts.

Changes to make rtc/cts flow control work...

This does not turn on the builtin hardware flow control on the SoC's usart
device, because that doesn't work on uart1 due to a chip erratum (they
forgot to wire up pin PA21 to RTS0 internally). Instead it uses the
hardware flow control logic where the tty layer calls the driver to assert
and de-assert the flow control lines as needed. This prevents overruns at
the tty layer (app doesn't read fast enough), but does nothing for overruns
at the driver layer (interrupts not serviced fast enough).

To work around the wiring problem with RTS0, the driver reassigns that pin
as a GPIO and controls it manually. It only does so if given permission via
hint.uart.1.use_rts0_workaround=1, to prevent accidentally driving the pin
if uart1 is used without flow control (because something not related to
serial IO could be wired to that pin).

In addition to the RTS0 workaround, driver changes were needed in the area
of reading the current set of DCE signals. A priming read is now done at
attach() time, and the interrupt routine now sets SER_INT_SIGCHG when any
of the DCE signals change. Without these changes, nothing could ever be
transmitted, because the tty layer thought CTS was de-asserted (when in fact
we had just never read the status register, and the hwsig variable was
init'd to CTS de-asserted).

Changes to support bulk high-speed (230kbps and higher) data reception...

Allow the receive fifo size to be tuned with hint.uart.<dev>.fifo_bytes.
For high speed receive, a fifo size of 1024 works well. The default is
still 128 bytes if no hint is provided. Using a value larger than 384
requires a change in dev/uart/uart_core.c to size the intermediate
buffer as MAX(384, 3*sc->sc_rxfifosize).

Recalculate the receive timeout whenever the baud rate changes. At low
baud rates (19.2kbps and below) the timeout is the number of bits in 2
characters. At higher speed it's calculated to be 500 microseconds
worth of bits. The idea is to compromise between being responsive in
interactive situations and not timing out prematurely during a brief
pause in bulk data flow. The old fixed timeout of 1.5 characters was
just 32 microseconds at 460kbps.

At interrupt time, check for receiver holding register overrun status
and set the corresponding status bit in the return value.

When handling a buffer overrun, get a single buffer emptied and handed
back to the hardware as quickly as possible, then deal with the second
buffer. This at least minimizes data loss compared to the old logic
that fully processed both buffers before restarting the hardware.

Rewrite the logic for handling buffers after a receive timeout. The
original author speculated in a comment that there may be a race with
high speed data. There was, although it was rare. The code now handles
all three possible scenarios on receive timeout: two empty buffers, one
empty and one partial buffer, or one full and one partial buffer.

Reviewed by: imp


248944 31-Mar-2013 ian

Fix a typo in the CF device driver name that prevented instantiation.


248911 29-Mar-2013 ian

Add userland access to at91 gpio functionality via ioctl calls. Also,
add the ability for userland to be notified of changes on gpio pins via
a select(2)/read(2) interface.

Change the interrupt handler from filtered to threaded.

Because of the uiomove() calls in the new interface, change locking from
standard mutex to sx.

Add / restore the at91_gpio_high_z() function.

Reviewed by: imp (long ago)


248910 29-Mar-2013 ian

Change the API for at91_pio_gpio_get() to return the entire masked set
of bits, not just a 0/1 indicating whether any of the masked bits are on.
This is compatible with the single in-tree caller of this function right now
(at91_vbus_poll() in dev/usb/controller/at91dci_atemelarm.c).


248909 29-Mar-2013 ian

Call soc_info.soc_data->soc_clock_init() before at91_pmc_init_clock(), so
that the latter correctly fills in the clock data structures based on
proper hardware-specific shift and mask values from the soc_data structure.


248904 29-Mar-2013 ian

Redo the workaround for at91rm9200 erratum #26 in a way that doesn't
cause a lockup on some rm92 hardware.


248902 29-Mar-2013 ian

Fix a typo: the RXD0 pin is PA18, not PA19.


248899 29-Mar-2013 ian

Remove a really noisy printf left over from debugging hardware errata.


248207 12-Mar-2013 glebius

Functions m_getm2() and m_get2() have different order of arguments,
and that can drive someone crazy. While m_get2() is young and not
documented yet, change its order of arguments to match m_getm2().

Sorry for churn, but better now than later.


248189 12-Mar-2013 glebius

Use m_get2() to get an mbuf of appropriate size.

Reviewed by: marius
Sponsored by: Nginx, Inc.


247313 26-Feb-2013 alc

Eliminate a redundant #include: machine/pmap.h is already included
through vm/pmap.h.


247297 26-Feb-2013 attilio

Merge from vmobj-rwlock branch:
Remove unused inclusion of vm/vm_pager.h and vm/vnode_pager.h.

Sponsored by: EMC / Isilon storage division
Tested by: pho
Reviewed by: alc


247046 20-Feb-2013 alc

Initialize vm_max_kernel_address on non-FDT platforms. (This should have
been included in r246926.)

The second parameter to pmap_bootstrap() is redundant. Eliminate it.

Reviewed by: andrew


243882 05-Dec-2012 glebius

Mechanically substitute flags from historic mbuf allocator with
malloc(9) flags within sys.

Exceptions:

- sys/contrib not touched
- sys/mbuf.h edited manually


243575 26-Nov-2012 marcel

Unbreak building a kernel with EHCI: there's no ehci_atmelarm.c.


242746 08-Nov-2012 imp

Reduce differences between these two initarms a bit more.


242700 07-Nov-2012 imp

Minor cosmetic changes to bring atmel's initarm and the default
initarm for FDT closer together. More to follow.


241333 07-Oct-2012 imp

Loop reading the RTC registers until the same values are obtained
twice, as advised in the atmel docs.

Submitted by: Ian Lapore


241308 07-Oct-2012 imp

Improve a few comments.


241307 07-Oct-2012 imp

Use the RTC unit to get the time. This works on all known AT91SAM9*
processors, either on reboot or after power down with battery backup.
However, the AT91RM9200 RTC always resets on reboot making it just
about useless at the moment (if we support a low-power mode or an
extended sleep mode, it might become useful).

Submitted by: Ian Lepore


240802 22-Sep-2012 andrew

Create a common set_stackptrs in sys/arm/machdep.c.

On single core devices set_stackptrs is only ever called with cpu = 0 in
initarm and will be identical to the existing function. On SMP this needs
to be implemented for sys/arm/mp_machdep.c, but the implementations are
identical for each SoC.


239805 29-Aug-2012 imp

Make this work on the AT91SAM9G20:
o Disable multi-block operations: they sometimes fail.
o Don't use the PROOF bits yet: they hang the system hard.
o Disable the the multi-block operations for !rm9200, but it
still doesn't help.
o Fix writing < 12 bytes errata to actually work.
o Enable, for the moment, reporting extra bytes soaked up.


239804 29-Aug-2012 imp

When copying data, use memcpy instead of bcopy. It matches the
arguments better.
Also, set the need to use the workaround flag before we actually need
to use it, rather than after.


239785 28-Aug-2012 imp

Make AT91_MCI_ALLOW_OVERCLOCK a real option. Rename old use 30MHz to
this new option. Only try to use > 25MHz when our best frequency is <
15MHz and overclocking is enabled. Fix minor style chaff.


239780 28-Aug-2012 imp

Clip the upper end to 31MHz for slow clock speeds. On faster
machines, we wind up with a 66MHz clock, which is too fast.


239764 28-Aug-2012 imp

Move to using a flag instead of checking the CPU type each
transaction for the MCI1 rev 2.x write workarounds.


239763 28-Aug-2012 imp

Style: Move these routines to be before the forward declared functions
as is the normal practice.


239762 28-Aug-2012 imp

Bring in the multi-block patches for mci. These required extensive
restructuring of the driver. I've tried to preserve the other silicon
workarounds that we've added over the years, but haven't had a chance
to extensively test on other hardware. On my AT91RM9200 with 30MHz/1
wire/64 block transfers, I've been able to go from ~.66MB/s to
2.25MB/s in the simple tests I performed, almost a 3.5x improvement.
This cuts the boot time almost in half when everything else goes
right (timed from rtc message to login: prompt).

PR: 155214
Submitted by: Ian Lapore


239721 27-Aug-2012 imp

Add hint and sysctl support for 4 wire mode.

PR: 155241
Submitted by: Ian Lapore


239720 27-Aug-2012 imp

Minor style(9) nit.


239719 27-Aug-2012 imp

Don't puprosely overclock the SD bus to 30MHz, make the user
explicltly enable that. The driver chose to use 60MHz / 2 (30MHz)
most of the time rather than 60MHz / 4 (15MHz) based on the Linux
driver of the time. This pushes the spec a little in order to not
suffer the penalty of running at 15MHz. However, when other bus
masters are active in the system, and the user tries 4-wire mode, the
internal bus arbitration would fail with data loss as a result.

# Comments from PR were reworked to reflect my historical perspective

PR: 155214 (partial)
Submitted by: Ian Lepore


239626 23-Aug-2012 imp

Fetch the chip select in the bridge driver, like all the other spi
bridges do.


239623 23-Aug-2012 imp

Use proper resource type when freeing.

Submitted by: Ian Lapore (indirectly in a larger patch)


239530 21-Aug-2012 hselasky

Make some at91_pcm_xxx() functions NULL safe.


239362 18-Aug-2012 andrew

Set machine correctly on ARM. This allows universe to use the correct world
when building each kernel.

Reviewed by: imp


239324 16-Aug-2012 imp

Preliminary Embest ATEB9200 support.


239308 15-Aug-2012 gonzo

Unbreak build for the rest of AT91 platforms


239291 15-Aug-2012 gonzo

Unbreak ATMEL kernel build


239268 15-Aug-2012 gonzo

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


239190 11-Aug-2012 imp

Correct the PLLA setting functions and centralize.


239189 11-Aug-2012 imp

Update comments about setting PLLA and refernce the tables in the
datasheet that express the limits.


239188 11-Aug-2012 imp

Don't use C++ comments.


239168 10-Aug-2012 imp

More comments about setting PLLA, or rather that we never do.


239167 10-Aug-2012 imp

Add charge pump current register.


238955 31-Jul-2012 imp

Allow chip selects other than 0. The SAM9260EK board
has its dataflash on CS1.


238922 30-Jul-2012 imp

These files will support the whole at91sam9x5 family when done,
so rename them now before they get copied further afield...


238921 30-Jul-2012 imp

List the members of the AT91SAM9G45 family.


238895 30-Jul-2012 imp

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.


238849 27-Jul-2012 imp

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


238846 27-Jul-2012 imp

Add new at91sam9g45 support and sn9g45 board to the ATMEL kernel.
Adapt SN9G45 board support to cope with multi-board.


238821 27-Jul-2012 imp

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.


238820 27-Jul-2012 imp

Add (back?) ohci atmel attachment.


238789 26-Jul-2012 andrew

Add support for the DesignA Electronics Snapper9g45 System on Module.

Reviewed by: imp


238788 26-Jul-2012 andrew

Add support for the Atmel AT91SAM9G45 CPU.

Reviewed by: imp


238787 26-Jul-2012 imp

Some models have 6 USARTS + DBGU. Set a consistent name.


238545 17-Jul-2012 gonzo

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@


238467 15-Jul-2012 imp

These were never used, remove them.


238465 15-Jul-2012 imp

Configure the peripheral pins for MCI devices. Eliminate the now-unused
at91_pio_rm9200.h.


238443 14-Jul-2012 imp

Add preliminary support for Atmel SAM9260-EK evaluation kit.
Initially identical to the Ethernut5, but will diverge shortly before
I refactor...


238442 14-Jul-2012 imp

uboot should be telling us it is an ETHERNUT5 for this board. Tag it
as such.


238439 14-Jul-2012 imp

Create common routines for configuring the serial ports and use them
on all the at91rm9200 boards.


238415 13-Jul-2012 imp

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.


238404 12-Jul-2012 imp

This file is no longer AT91RM9200 specific, but now is generic to all
Atmel AT91 SoC's we support. Rename to reflect that.


238403 12-Jul-2012 imp

Remember where we found the DBGU and use that for our console.


238398 12-Jul-2012 imp

Fix whitespace divot.


238397 12-Jul-2012 imp

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.


238390 12-Jul-2012 imp

Create the children devices for the SoC in atmelarm bus node, not in
the identify routine of the CPU.


238389 12-Jul-2012 imp

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.


238376 11-Jul-2012 imp

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.


238370 11-Jul-2012 imp

at91pit->at91_pit for consistnecy with other drivers.


238369 11-Jul-2012 imp

at91$DEV->at91_$DEV to match other Atmel drivers. Also, export
at91_rst_cpu_reset.


238358 10-Jul-2012 imp

Remove some more unused code.


238354 10-Jul-2012 imp

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.


238348 10-Jul-2012 imp

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.


238341 10-Jul-2012 imp

Pure style mischief. at91_$DEV_ rather than at91$DEV_ to match
others.


238340 10-Jul-2012 imp

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..)


238334 10-Jul-2012 imp

Collapse all copies of at91_add_child into at91.c. They were
logically identical before today, and actually identical after today's
changes.


238332 10-Jul-2012 imp

Missed one of the special AT91SAM9xxx_BASE defines. This should be
AT91_BASE.


238331 10-Jul-2012 imp

The system IRQ is always IRQ 1. Make it so.


238330 10-Jul-2012 imp

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.


238329 10-Jul-2012 imp

Remove some unused variables/externs that have been copied too many times...


238325 10-Jul-2012 imp

There's nothing AT91RM9200 specific about this file at all.


238189 07-Jul-2012 imp

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.


237883 01-Jul-2012 imp

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...


237881 01-Jul-2012 imp

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.


237841 30-Jun-2012 marius

Exclude at91sam9x25 support, which just wastes space for Ethernut 5.


237745 29-Jun-2012 imp

Tweak comment.


237744 29-Jun-2012 imp

Add PIOD, make at91sam9x25 a standard SoC, tweak some comments.


237743 29-Jun-2012 imp

Ooops, replaced the at91sam9g20 interrupt list with the at91sam9x25 ones.


237742 29-Jun-2012 imp

Initital support for AT91SAM9X25 SoC and the SAM9X25-EK evaluation
board. Much work remains.


237432 22-Jun-2012 imp

Fix a stray debug that I committed accidentally years ago...


237429 22-Jun-2012 imp

Move these #defines to at91reg.h (where I should have put them in the
first place).


237239 18-Jun-2012 marius

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


237238 18-Jun-2012 marius

Try to bring this file closer to style(9).


237237 18-Jun-2012 marius

Unbreak after r236658 by comparing the right things.


237151 16-Jun-2012 imp

Throw this debug behind bootverbose. The information isn't all that
exciting once the initial board bring up is over.


237130 15-Jun-2012 imp

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.


237122 15-Jun-2012 imp

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.


237115 15-Jun-2012 imp

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.


237045 14-Jun-2012 imp

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.


237040 14-Jun-2012 imp

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


236989 13-Jun-2012 imp

Strip trailing whitespace before other changes.


236846 10-Jun-2012 andrew

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.


236828 10-Jun-2012 andrew

Pull out the common code to initialise proc0 & thread0 from initarm to a
common function.

Reviewed by: imp


236681 06-Jun-2012 imp

Remove stray break; that resulted from a last-minute, untested change.


236658 06-Jun-2012 imp

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...


236617 05-Jun-2012 imp

Remove dead code.


236535 04-Jun-2012 imp

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.


236524 03-Jun-2012 imp

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.


236498 03-Jun-2012 imp

Remove stray repeated line...


236495 03-Jun-2012 marius

- 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


236373 01-Jun-2012 imp

Revert debug and other immature code accidentally committed in r236372.


236372 01-Jun-2012 imp

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().


236215 29-May-2012 imp

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.


235718 21-May-2012 imp

Be a little less magical, not that these values are likely to change...


235715 21-May-2012 imp

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).


235698 20-May-2012 imp

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.


235348 12-May-2012 marius

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.


235271 11-May-2012 imp

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.


234931 02-May-2012 imp

Fix comment about what board this is really for left over from early
cut and paste.


234923 02-May-2012 imp

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


234901 01-May-2012 marius

- 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


234560 22-Apr-2012 marius

- 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.


234293 14-Apr-2012 marius

Generate an obviously missing STOP when having finished transmitting data.
This fixes communication with PCF8563.


234292 14-Apr-2012 marius

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.


234291 14-Apr-2012 marius

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.


234281 14-Apr-2012 marius

- Try to bring these files closer to style(9).
- Use DEVMETHOD_END.
- Use NULL instead of 0 for pointers.


230133 15-Jan-2012 uqs

Remove spurious 8bit chars, turning files into plain ASCII.


226832 27-Oct-2011 kevlo

Check the return value of BUS_SETUP_INTR()

Reviewed by: imp


225882 30-Sep-2011 kevlo

Remove pointless semicolons after label


225214 27-Aug-2011 rwatson

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)


223562 26-Jun-2011 kevlo

Remove duplicate header includes


221025 25-Apr-2011 cognet

Typo fix


218913 21-Feb-2011 cognet

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


218667 13-Feb-2011 cognet

Oops, wasn't supposed to commit this.


218666 13-Feb-2011 cognet

Call init_param1() much earlier, so that msgbufsize is non-zero when we want
to map and use the msgbuf.


218387 07-Feb-2011 ticso

unbreak mutlicast hash creation for the second time.
at91_emac hardware is *not* using ether_crc32_be algorithm!


217688 21-Jan-2011 pluknet

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


217062 06-Jan-2011 jhb

- 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


217036 06-Jan-2011 imp

Remove support for SKYEYE simulator


216227 06-Dec-2010 kevlo

Fix double ;;


213896 15-Oct-2010 marius

Remove a device_printf() accidentally left in r213894.

Submitted by: jhb


213894 15-Oct-2010 marius

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


213498 06-Oct-2010 cognet

Add support for the AT91SAM9260

Submitted by: Greg Ansley


213496 06-Oct-2010 cognet

if_ate.c:

* Support for sam9 "EMAC" controller.
* Support for rmii interface to phy.

at91.c & at91sam9.c:

* Eliminate separate at91sam9.c file.
* Add new devices to at91sam9_devs table.

at91_machdep.c & at at91sam9_machdep.c:

* Automatic chip type determination.
* Remove compile time chip dependencies.
* Eliminate separate at91sam9_machdep.c file.

at91_pmc.c:

* Corrected support for all of the sam926? and sam9g20 chips.
* Remove compile time chip dependencies.

My apologies to Greg for taking so long to take care of it.


213251 28-Sep-2010 ticso

fix outdated comment


213203 27-Sep-2010 ticso

The TWI controller automatically stops if we don't fill up with new data in
time.


213201 27-Sep-2010 ticso

fix off by one error for twi reads with len != 1.
STOP must be requested before the last byte is received.


210040 14-Jul-2010 cognet

Import preliminary support for Atmel AT91SAM9G20 cpu, and the Hot-e HL201.
This fine work was done by Yohanes Nugroho <yohanes a gmail dot com>
Many thanks to John Nicholls and Thinlinx for providing sample hardware.


207554 03-May-2010 sobomax

Add new tunable 'net.link.ifqmaxlen' to set default send interface
queue length. The default value for this parameter is 50, which is
quite low for many of today's uses and the only way to modify this
parameter right now is to edit if_var.h file. Also add read-only
sysctl with the same name, so that it's possible to retrieve the
current value.

MFC after: 1 month


204476 28-Feb-2010 ticso

simplify hash calculation


204463 28-Feb-2010 ticso

remove debug leftover


204462 28-Feb-2010 ticso

Fix multicast hashes.
Atmel uses a simple xor hash instead of the typical crc based one.


199557 19-Nov-2009 jhb

- Initialize callout before it is used in atestop() during attach.
- Reorder detach so that ether_ifdetach() is called first. This removes
the race that ATE_FLAG_DETACHING closed, so that flag can be removed.
- Trim a duplicate clearing of IFF_DRV_RUNNING.

Reviewed by: imp


199537 19-Nov-2009 jhb

These drivers only set if_timer but never set if_watchdog. Just remove
the assignments to if_timer.


198872 04-Nov-2009 alc

Eliminate an unnecessary vm include file.


196246 15-Aug-2009 stas

- Proprely intialize UART parameters at probe stage, so uart(4)
will initialize the FIFO memory correctly on attach. Before
that this values was intialized in only in at91_usart_bus_attach
which is called after the uart(4) memory allocation happens.

Approved by: re (kib)
MFC after: 1 week


195256 01-Jul-2009 raj

Map DPCPU pages into ARM kernel VA space.

DPCPU area was not properly mapped into kernel VA space, which caused page
fault on the first DPCPU access. This patch fixes the problem by mapping DPCPU
area into kernel VA space.

Submitted by: Michal Hajduk, Piotr Ziecik
Reviewed by: cognet, stas
Approved by: re (kib)
Obtained from: Semihalf


195049 26-Jun-2009 rwatson

Use if_maddr_rlock()/if_maddr_runlock() rather than IF_ADDR_LOCK()/
IF_ADDR_UNLOCK() across network device drivers when accessing the
per-interface multicast address list, if_multiaddrs. This will
allow us to change the locking strategy without affecting our driver
programming interface or binary interface.

For two wireless drivers, remove unnecessary locking, since they
don't actually access the multicast address list.

Approved by: re (kib)
MFC after: 6 weeks


194784 23-Jun-2009 jeff

Implement a facility for dynamic per-cpu variables.
- Modules and kernel code alike may use DPCPU_DEFINE(),
DPCPU_GET(), DPCPU_SET(), etc. akin to the statically defined
PCPU_*. Requires only one extra instruction more than PCPU_* and is
virtually the same as __thread for builtin and much faster for shared
objects. DPCPU variables can be initialized when defined.
- Modules are supported by relocating the module's per-cpu linker set
over space reserved in the kernel. Modules may fail to load if there
is insufficient space available.
- Track space available for modules with a one-off extent allocator.
Free may block for memory to allocate space for an extent.

Reviewed by: jhb, rwatson, kan, sam, grehan, marius, marcel, stas


194015 11-Jun-2009 avg

strict kobj signatures: number of fixes for arm architecture

no functional changes should result

Reviewed by: imp, current@
Approved by: jhb (mentor)


193934 10-Jun-2009 imp

Eliminate devclass_find_free_unit call here, since -1 gives the same
net behavior.


193847 09-Jun-2009 marcel

Pass the previously returned IRQ back to arm_get_next_irq() so that
the implementation can guarantee forward progress in the event of
a stuck interrupt or interrupt storm. This is especially critical
for fast interrupt handlers, as they can cause a hard hang in that
case. When first called, arm_get_next_irq() is passed -1.

Obtained from: Juniper Networks, Inc.


192901 27-May-2009 thompsa

Delete the old USB stack. The new stack has settled in and has all the
drivers/functionality and then some.


192135 15-May-2009 imp

Fix name for driver to assign to the SPI device.


192064 13-May-2009 stas

- Set MAC address in ateinit, so it can be changed later.


192063 13-May-2009 stas

- Style(9) and consistency nitpicking.

Reviewed by: imp


192059 13-May-2009 gonzo

- Make SPI bus bridge be non-arch dependent by using more generic
name

Reviewed by: imp


192028 12-May-2009 stas

- Resurrect the debug printf message I accidentally dropped
in the previous commit.
- Use device_printf instead of printf.
- Put all printfs in the interrupt handler under bootverbose.


192027 12-May-2009 stas

- Eliminate extra register reads by using a variable to store
registers contents.
- Use memory barriers to preserve the order of buffer space operations.
This might be needed if we'll ever use this driver on architectures
where ordering is not guaranteed.


192018 12-May-2009 stas

- Implement detach path.
- Release memory and DMA resources on stop.
- Unload the associated DMA maps after transmit is complete.


191961 10-May-2009 stas

- Fix build with INVARIANTS enabled.


191960 10-May-2009 stas

- Fix multicast operation that I broke in previous commit.
- Do not enable multicast hash lookup if no multicast addresses
were configured or if promisc mode is enabled.


191959 10-May-2009 stas

- Fix promisc/multicast/broadcast parameters setting by introducing the
new ate_rxfilter function to set requested parameters. Use this function
on parameters change rather than reinitializing the chip.


191410 23-Apr-2009 stas

- Whitespace nitpicking.


191408 22-Apr-2009 stas

- Add the driver for AT91RM9200 CompactFlash controller. The driver
operates in the common memory mode and use polling mode to control
the status of operations as I don't have any board with interrupt
line routed yet. I'll add the GPIO interrupt driven mode as soon
as I get one.


190740 05-Apr-2009 thompsa

MFp4 //depot/projects/usb@159992

at91_udp.c does not exist anymore, it is now replaced by at91dci in
src/sys/dev/usb/controller. Also remove the ohci_atmelarm.c because it is also
included in src/sys/conf/files

Submitted by: Sylvestre Gallon


189126 27-Feb-2009 imp

Move to new usb stack that puts the front-end bus attachments with the
usb stack rather than with the rest of the processor support code.
Not sure that's a good idea, as we were moving away from it, but this
fixes the build in the mean time so we can have that discussion.


187606 23-Jan-2009 imp

Move to having a caps flag. Newer versions of the AT91 family don't
need the bouncing, so save a few copies in that case. Also convert
4-bit code selection to using it.


187603 22-Jan-2009 imp

Don't over-commit the DMA. Use the passed in size of the transfer
rather than a fixed 512... This fixes the mount root problem on at91.
Prior to the SD card reorg, all data transfers were 512 bytes, so we
didn't notice.


187602 22-Jan-2009 imp

Migrate towards using at91_master_clock. Initialize the clocks for
the serial port class when we set the devclass since it is now
no-longer a compile time constant. Eliminate the pci include, as it
isn't relevant or necessary.


187601 22-Jan-2009 imp

Use at91_master_clock instead of AT91C_MASTER_CLOCK.


187600 22-Jan-2009 imp

Remove now-redundant declaration.


187599 22-Jan-2009 imp

Store at91_master_clock in a global variable as opposed to a compile
time constant. This allows us to potentially change it at runtime or
autodetect it early in the boot (the latter being much more likely to
have a good outcome).


187548 21-Jan-2009 imp

o The f_max is really at91_master_clock / 2, not 30MHz, so compute it as such.
o Only set 4-bit caps on those boards that have 4-bit caps (this means that
because we don't set wire4 yet, this forces us to always use 1-bit bus).
o Don't test wire4 when setting up the bus width, since bad things will
happen if we do.

# This likely won't fix the busted at91 sd card support, but these are
# needful changes for correctness.


187476 20-Jan-2009 mav

Implement MMCBR_IVAR_CAPS. It should better be implemented, or results
can be unpredictable.

PR: arm/128987


185539 02-Dec-2008 peter

Delete a bunch of empty mergeinfo records caused by local copies.


185513 01-Dec-2008 stas

- Fix spelling error in comments.

PR: arm/128891
Submitted by: Pavel Pankov <pankov_p@mail.ru>
Approved by: kib (mentor)


185492 30-Nov-2008 stas

- Get rid of extra include file, erroneously added by the
previous commit. This include file was required by the
first version of the patch.

Approved by: kib (mentor, implicit)


185491 30-Nov-2008 stas

- Obtain main clock frequency dynamically based on CKGR_MCFR register
contents.
- It is possible to override the dynamic configuration by using
AT91C_MAIN_CLOCK option in kernel config.

PR: arm/128961 (based on)
Submitted by: Bjorn Konig <bkoenig@alpha-tierchen.de>
Reviewed by: imp
Approved by: kib (mentor, implicit)


185477 30-Nov-2008 imp

opt_at91.h isn't needed here at all anymore, since the board init
routines have been split out. Remove it. This leaves only one
instance of it in the tree that will be going away soon.


185307 25-Nov-2008 imp

Convert BWCT and HL200 over to new board mechanism as well. The
TSC4370 config file wasn't committed to this tree, so I don't know if
my changes will work on it or not.


185305 25-Nov-2008 imp

Start to make it easier to add AT91RM9200 based boards:
o Copy kb920x_machdep.c to at91_machdep.c
o Move board_init to new board_kb920x.c
o rename ramsize to at91_ramsize and make it accessible to board_* files.
o Delete files.kb920x. We can do this selection with the new boards.
o Add a stub for the tsc4370 board init, which will be added in
a future commit.
o Add new 'devices' at91_board_kb920x and at91_board_tsc4370. More are
needed and will be added in future commits.

Reviewed by: stass, cognet


185300 25-Nov-2008 imp

Whitespace nit.


185288 25-Nov-2008 imp

Save boot args.


185287 25-Nov-2008 imp

more silly whitespace changes.


185270 25-Nov-2008 imp

Fix various whitespace botches, mostly having them at the end of a line.


185267 25-Nov-2008 imp

Replace disclaimer with the one from COPYRIGHT. Joint authors aggreed
to the change.


185266 25-Nov-2008 imp

Replace three magic constants with L1_S_SIZE, since that's what is
really meant in those places.


185265 25-Nov-2008 imp

Tweak the disclaimer section of the license to match COPYRIGHT, for
better or worse. Ok'd by folks that have additional copyrights to the
files in cases where there's joint authorship.


185049 18-Nov-2008 stas

- Fix two minor errors in at91 code.

PR: arm/128959
Submitted by: Bjorn Konig <bkoenig@alpha-tierchen.de>
Approved by: kib (mentor)


184452 29-Oct-2008 mav

Allow card reader bridge driver to report maximum supported transfer size.
sdhci supports up to 65535 blocks transfers, at91_mci - one block.

Enable multiblock operations disabled before to follow at91_mci driver
limitations.

Reviewed by: imp@


184310 26-Oct-2008 stas

- Add stream bus_space operations.

Reviewed by: cognet
Approved by: kib (mentor, implicit)
MFC after: 1 week


184309 26-Oct-2008 stas

- Add a missing NULL-pointer check.

Reviewed by: cognet
Approved by: kib (mentor, implicit)
MFC after: 3 days


183670 07-Oct-2008 imp

Use bus_get_dma_tag() instead of NULL here. Not really needed for atmel
at the moment, but it is more correct.


183479 30-Sep-2008 imp

Properly implement read only. Also, the caps implementation is wrong
here, so I'm backing it out.


183451 28-Sep-2008 imp

Implement MMCBR_IVAR_CAPS for AT91 MCI device.

Submitted by: mav@ (well, not this one, but the base impl was)


182807 05-Sep-2008 imp

Turn some lame pseudo-code into a less lame comment.


182806 05-Sep-2008 imp

Kill bogus #if 0'd stuff for interrupts. They don't happen, and this
driver will need more serious help to work with an interrupt driven
path. There's many subtleties in driving the DMA engine with
interrupts in many configurations. Best to not "guess" what the right
way would be and mislead people.


182805 05-Sep-2008 imp

Kill vestiges of the special case code we once had in place for usb
memory allocation. It was change to include the range in the normal
memory area, so these ifdef'd out special cases are no longer useful
to keep around.


182803 05-Sep-2008 imp

Kill bogus #if 1. There's no need for it since usb works these days.


182555 31-Aug-2008 imp

Use a locally assigned address rather than stealing Atmel's which
might cause a conflict...


182524 31-Aug-2008 stas

- Fix comment.
- Set U/L bit of generated ethernet address to 1 to not
clash with Atmel assigned addresses.

Suggested by: yar
Approved by: kib (mentor)


182477 30-Aug-2008 stas

- Try to look for MAC address in all SA registers, not only in the
first one. U-boot, for example, uses the second register to store
MAC.[1]
- Use random MAC address if none configured instead of failing.

Submitted by: Bjorn Konig <bkoenig@alpha-tierchen.de> [1]
Reviewed by: imp
Approved by: kib (mentor)
MFC after: 1 week


182476 30-Aug-2008 stas

- Style fix.

Approved by: kib (mentor)
MFC after: 1 week


181884 19-Aug-2008 imp

Provide hooks into the GPIO lines and the ability to set/clear
interrupts from them. This should be more generalized, but is
sufficient for now.

Submitted by: Hans Petter Selasky


181883 19-Aug-2008 imp

Use the proper clock domain for the usb host controller.

Submitted by: Hans Petter Selasky


181882 19-Aug-2008 imp

Add IRQ line for usb device. I'm not 100% sure this is the right
place to add this connection, since the interrupt is for a GPIO pin,
but since we have no alternative at the moment...

Submitted by: Hans Petter Selasky


181303 04-Aug-2008 jhb

Add locking to the various iicbus(4) bridge drivers:
- Just grab Giant in the ixp425_iic(4) driver since this driver uses
a shared address/data register window pair to access the actual
I2C registers. None of the other ixp425 drivers lock access to these
shared address/data registers yet and that would need to be done before
this could use any meaningful locking.
- Add locking to the interrupt handler and 'iicbus_reset' methods of the
at91_twi(4) driver.
- Add locking to the pcf(4) driver. Other pcf(4) fixes include:
- Don't needlessly zero the softc.
- Use bus_foo rather than bus_space_foo and remove bus space tag and
handle from softc.
- The lpbb(4) driver just grabs Giant for now. This will be refined later
when ppbus(4) is locked.
- As was done with smbus earlier, move the DRIVER_MODULE() lines to match
the bus driver (either iicbus or iicbb) to the bridge driver into the
bridge drivers.

Tested by: sam (arm/ixp425)


181158 02-Aug-2008 ed

Make the at91 uart(4) driver compile again.

As of r178766 this driver didn't compile anymore, because it missed a
switch()-statement. I'm getting tired of seeing this driver being broken
for two months already. When I run `make universe', everything passes,
except the BWCT kernel configuration file.


180693 22-Jul-2008 stas

- Whitespace fixes.

Approved by: gonzo
MFC after: 1 week


180486 12-Jul-2008 ticso

fix multicast hash register definition


179693 09-Jun-2008 wkoszek

Since we create a DMA tag "mtag" for TX map with bus_dmamap_create(),
we must synchronize such a map against "mtag" with bus_dmamap_sync(),
not the tag designated for RX map.

Fix it.

Approved by: cognet


179375 28-May-2008 imp

Release the resources for the registers for the TWI device with
SYS_RES_MEMORY to match how we allocate them...

Noticed by: Ian Lepore


178766 04-May-2008 peter

Expand kdb_alt_break a little, most commonly used with the option
ALT_BREAK_TO_DEBUGGER. In addition to "Enter ~ ctrl-B" (to enter the
debugger), there is now "Enter ~ ctrl-P" (force panic) and
"Enter ~ ctrl-R" (request clean reboot, ala ctrl-alt-del on syscons).

We've used variations of this at work. The force panic sequence is
best used with KDB_UNATTENDED for when you just want it to dump and
get on with it.

The reboot request is a safer way of getting into single user than
a power cycle. eg: you've hosed the ability to log in (pam, rtld, etc).
It gives init the reboot signal, which causes an orderly reboot.

I've taken my best guess at what the !x86 and non-sio code changes
should be.

This also makes sio release its spinlock before calling KDB/DDB.


178366 20-Apr-2008 cognet

On the AT91, we need to write on the EOI register after we handle an
interrupt. So, add a new function pointer, arm_post_filter, which defaults
to NULL, and which will be used as the post_filter arg for
intr_event_create(). Set it properly for the AT91, so that it boots again.

Reported by: hps


177883 03-Apr-2008 imp

Take the first baby step towards unifying and cleaning up arminit():
- Pull all the code to deal with the trampoline stuff into one
centeralized place and use it from everywhere.
- Some minor style tidiness

Reviewed by: tinguely


177873 03-Apr-2008 imp

Remove unnecessary #define.


175120 07-Jan-2008 cognet

Add a missing \n.


174898 25-Dec-2007 rwatson

Add a new 'why' argument to kdb_enter(), and a set of constants to use
for that argument. This will allow DDB to detect the broad category of
reason why the debugger has been entered, which it can use for the
purposes of deciding which DDB script to run.

Assign approximate why values to all current consumers of the
kdb_enter() interface.


174880 23-Dec-2007 stas

- Fix a typo in comments.

MFC after: 1 week
Approved by: cognet


174781 19-Dec-2007 imp

Actually program the interrupt controller for priorities. As we
support more AT91 platforms, we'll need to move this into some
platform init routine.


174700 17-Dec-2007 kevlo

Use M_NOWAIT instead of M_WAITOK to cause malloc() to return NULL

Reviewed by: imp


174661 16-Dec-2007 stas

- Don't return 0xffff if PHY id isn't equal 0. This allows PHYs with
non-zero addresses to be used.

Approved by: cognet
MFC after: 2 weeks


173361 05-Nov-2007 kib

Fix for the panic("vm_thread_new: kstack allocation failed") and
silent NULL pointer dereference in the i386 and sparc64 pmap_pinit()
when the kmem_alloc_nofault() failed to allocate address space. Both
functions now return error instead of panicing or dereferencing NULL.

As consequence, vmspace_exec() and vmspace_unshare() returns the errno
int. struct vmspace arg was added to vm_forkproc() to avoid dealing
with failed allocation when most of the fork1() job is already done.

The kernel stack for the thread is now set up in the thread_alloc(),
that itself may return NULL. Also, allocation of the first process
thread is performed in the fork1() to properly deal with stack
allocation failure. proc_linkup() is separated into proc_linkup()
called from fork1(), and proc_linkup0(), that is used to set up the
kernel process (was known as swapper).

In collaboration with: Peter Holm
Reviewed by: jhb


173155 29-Oct-2007 imp

kill commented out line of code.


172993 25-Oct-2007 cognet

Add an option to be able to override the value of the AT91 master clock
frequency. It'd be better to be able to calculate it at runtime, but we need
the information very early, to setup the uart.


172992 25-Oct-2007 cognet

Move some KB920x-specific options into the KB920x file.


172989 25-Oct-2007 cognet

Oooops, get the end of the memory right.


172945 24-Oct-2007 cognet

KERNBASE should really be KERNVIRTADDR there too.

MFC after: 1 week


172944 24-Oct-2007 cognet

In ate_get_mac(), try to get the mac address in the right order, at least
in the same order as it's set in ate_set_mac.
I remember a discussion about this on -arm, but apparently nothing was done.
Warner, is this wrong ?

X-MFC After: proper review


172943 24-Oct-2007 cognet

Handle the case where PHYSADDR != KERNPHYSADDR (ie we do not load the kernel
at the beginning of the RAM).

MFC After: 1 week


172942 24-Oct-2007 cognet

Correct a comment, this was not true anymore.


172739 18-Oct-2007 imp

correct guard variable names.


172196 16-Sep-2007 imp

Kill bogus printf debugs.

Approved by: re@ (blanket)


172195 16-Sep-2007 imp

Kill overly verbose messages about setting bus width.

Approved by: re@ (blanket)


171673 31-Jul-2007 imp

Make USB work on the KB9202{,A,B} boards. This has been in p4 for about
7 months. You must have JP6 in the 1-2 position to supply power to the
USB devices, but I've used uftdi, uplcom and umass successfully. If you
have it in 2-3, then nothing will show up. Also, if you have the FQPA
packaging for the AT91RM9200 (like the KN9202 boards have), you will get
the following message

uhub0: device problem (IOERROR), disabling port 2

due to a hardware erratum. It is safe to ignore as it is about pins that
aren't brought out on the FQPA package and aren't proeprly terminated either.
Alas, there's no register to read to tell the FQPA from the BGA versions.

Submitted by: Daan Vreeken
Approved by: re (kensmith)


170574 11-Jun-2007 imp

Fix a spacing nit.


170286 04-Jun-2007 marcel

Revert to the previous version where the return value of uart_getenv()
is being ignored. It's optional and the lack of environment variable
is not an error condition.


169900 23-May-2007 cognet

Remove duplicate includes.

Submitted by: Cyril Nguyen Huu <cyril ci0 org>


168281 02-Apr-2007 marcel

Don't expose the uart_ops structure directly, but instead have
it obtained through the uart_class structure. This allows us
to declare the uart_class structure as weak and as such allows
us to reference it even when it's not compiled-in.
It also allows is to get the uart_ops structure by name, which
makes it possible to implement the dt tag handling in uart_getenv().
The side-effect of all this is that we're using the uart_class
structure more consistently which means that we now also have
access to the size of the bus space block needed by the hardware
when we map the bus space, eliminating any hardcoding.


167950 27-Mar-2007 n_hibma

Revisit the watchdogs: Resetting the error to EINVAL after failing to set the
watchdog might hide the succesful arming of an earlier one. Accept that on
failing to arm any watchdog (because of non-supported timeouts) EOPNOTSUPP is
returned instead of the more appropriate EINVAL.

MFC after: 3 days


167935 27-Mar-2007 kevlo

Don't map mini-data cache page since ARM920T doesn't have it.


167852 23-Mar-2007 imp

MFp4: A bunch of patches from myself and Tisco to improve the
robustness of IIC transactions when parts aren't present. This also
removes a bunch of debug. This also moves this driver to 7-1
addressing rather than 6-0 addressing, which is more inline with all
the other iic drivers in the tree. I've tested this for about a
million years on the systems at work.


167261 06-Mar-2007 piso

o substitute INTR_FAST with FILTER in a panic message.
o wrap a BUS_SETUP_INTR() line at 80.


167135 01-Mar-2007 piso

Update bus_setup_intr().

Pointed by: Krassimir Slavchev


167082 27-Feb-2007 jhb

Use tsleep() rather than msleep() with a NULL mtx.


167069 27-Feb-2007 piso

Correct return code (int) for at91_rtc_intr() prototype.

Approved by: cognet


166974 25-Feb-2007 piso

Fix attach of at91_pio() after bus_setup_intr() modification.

Reported and tested by: Krassimir Slavchev


166901 23-Feb-2007 piso

o break newbus api: add a new argument of type driver_filter_t to
bus_setup_intr()

o add an int return code to all fast handlers

o retire INTR_FAST/IH_FAST

For more info: http://docs.freebsd.org/cgi/getmsg.cgi?fetch=465712+0+current/freebsd-current

Reviewed by: many
Approved by: re@


166625 10-Feb-2007 mlaier

Fix small altq related copy and paste error.


166573 08-Feb-2007 imp

Add sanity check to make sure that the MAC address isn't all 0's. Bad
boot loaders can do this, and this leads to all kinds of ill effects
downstream. Also, minor formatting nits.


166532 06-Feb-2007 imp

at91_twi depends on the iicbus module to satisfy its symbols when
loaded, so make that explicit. Works for the monolithic kernel case,
won't work for the kldload case.


166454 03-Feb-2007 kevlo

ether_ifattach() sets if_mtu to ETHERMTU, don't bother set it again.

Approved by: imp, cognet


166100 18-Jan-2007 marius

- Add a uart_rxready() and corresponding device-specific implementations
that can be used to check whether receive data is ready, i.e. whether
the subsequent call of uart_poll() should return a char, and unlike
uart_poll() doesn't actually receive data.
- Remove the device-specific implementations of uart_poll() and implement
uart_poll() in terms of uart_getc() and the newly added uart_rxready()
in order to minimize code duplication.
- In sunkbd(4) take advantage of uart_rxready() and use it to implement
the polled mode part of sunkbd_check() so we don't need to buffer a
potentially read char in the softc.
- Fix some mis-indentation in sunkbd_read_char().

Discussed with: marcel


165787 05-Jan-2007 ticso

MFp4: Use the next possible value for hz instead of defaulting to 128
Update tick value after modifying hz.


165783 05-Jan-2007 ticso

MFp4: Make at91_rtc optional to allow other RTC choices


165781 05-Jan-2007 ticso

MFp4: Read access require PDC to be setup first otherwise we might get
overrun errors.
Write access however need cmd first, so keep the existing order
for them.


165780 05-Jan-2007 ticso

MFp4: BWCT boards are using an 16MHz xtal


165779 05-Jan-2007 ticso

MFp4: Add VLAN_MTU support


165778 05-Jan-2007 ticso

MFp4: fix a race in transmit buffer handling


165713 01-Jan-2007 imp

MFp4: Fix bit name for SPI SR register


165712 01-Jan-2007 imp

MFp4: Remove watchdog timeout that appears to be unused.


165711 01-Jan-2007 imp

Merge from FreeBSD-tsf-6 by way of p4:
correct values for PIO registers

submitted by: patrick schweiger


165260 15-Dec-2006 n_hibma

Align the interfaces for the various watchdogs and make the interface
behave as expected.

Also:
- Return an error if WD_PASSIVE is passed in to the ioctl as only
WD_ACTIVE is implemented at the moment. See sys/watchdog.h for an
explanation of the difference between WD_ACTIVE and WD_PASSIVE.
- Remove the I_HAVE_TOTALLY_LOST_MY_SENSE_OF_HUMOR define. If you've
lost your sense of humor, than don't add a define.

Specific changes:

i80321_wdog.c
Don't roll your own passive watchdog tickle as this would defeat the
purpose of an active (userland) watchdog tickle.

ichwd.c / ipmi.c:
WD_ACTIVE means active patting of the watchdog by a userland process,
not whether the watchdog is active. See sys/watchdog.h.

kern_clock.c:
(software watchdog) Remove a check for WD_ACTIVE as this does not make
sense here. This reverts r1.181.


164969 07-Dec-2006 cognet

Unbreak build for Skyeye: do not attempt to do any DMA, as Skyeye doesn't
emulate it.

Reported by: ru


164936 06-Dec-2006 julian

Threading cleanup.. part 2 of several.

Make part of John Birrell's KSE patch permanent..
Specifically, remove:
Any reference of the ksegrp structure. This feature was
never fully utilised and made things overly complicated.
All code in the scheduler that tried to make threaded programs
fair to unthreaded programs. Libpthread processes will already
do this to some extent and libthr processes already disable it.

Also:
Since this makes such a big change to the scheduler(s), take the opportunity
to rename some structures and elements that had to be moved anyhow.
This makes the code a lot more readable.

The ULE scheduler compiles again but I have no idea if it works.

The 4bsd scheduler still reqires a little cleaning and some functions that now do
ALMOST nothing will go away, but I thought I'd do that as a separate commit.

Tested by David Xu, and Dan Eischen using libthr and libpthread.


164745 29-Nov-2006 imp

MFp4:
formatting nit


164744 29-Nov-2006 imp

Make this work a lot better:
Remove a lot of older cruft not needed.
Improve ISR support, but it is still unused since polling is faster
Properly initalize the speed register to get 90kb/s, not 400b/s.
Try to catch NACK
Allow 0 length read transfers to generate start/top pairs.


164741 29-Nov-2006 imp

MFp4:
correct data counts so that we clock enough data for the spi
transaction. This allows complete spi transactions to happen.


164503 22-Nov-2006 imp

MFp4: Make it work :-)
o Don't delay when checking the done bits. There's no gain other
than a small performance hit.
o calculate the clock divisors better (things are still way slow,
so maybe there's more here?)
o don't always fail reset. Always succeed instead.
o fix inverted logic around at91_twi_wait() return value
o remove debug code
o remove unneeded, unworking junk


164432 20-Nov-2006 imp

MFp4: Tweak descriptions in preparation for porting to other members of
the AT91 arm9 family.


164425 19-Nov-2006 sam

change bus space unmap protoype

Reviewed by: cognet, imp
MFC After: 1 month


164198 11-Nov-2006 alc

Eliminate unused global variables.


163937 03-Nov-2006 imp

MFp4:
o Fix the packet statistics
o Make sure we set the FD bit when in full duplex
o Improve TX side efficency by eliminating a data copy for
unfragmented mbufs (the hardware can't do s/g).
o Minor busdma pedantry
o better comments in some places, more XXX in others
o Minor style nits.

This solves a problem I was seeing where I'd get no ethernet when not
booting with a NFS root. Well, unless I unplugged the cable and
plugged it back in first so I'd get the same up down up messages I get
for NFS root...

Thanks to sam and scottl for suggestions on making this driver more
efficient through better use of approrpiate APIs.


163709 26-Oct-2006 jb

Make KSE a kernel option, turned on by default in all GENERIC
kernel configs except sun4v (which doesn't process signals properly
with KSE).

Reviewed by: davidxu@


163681 25-Oct-2006 imp

MFp4: Move the parameters that are basically dictated by the AT91
organization to that file.


163680 25-Oct-2006 imp

MFp4: Status register bits


163526 20-Oct-2006 imp

MFp4: Working SPI driver.


163525 20-Oct-2006 imp

Commit WIP SSC driver, more work is needed here, but it configures
things OK.


163524 20-Oct-2006 imp

More register definitions.


163523 20-Oct-2006 imp

Progress commit for getting TWI working


163522 20-Oct-2006 imp

Add sysctl to export current state of rmii vs mii configuraiton.
Fix a typo in resource allocation.


163521 20-Oct-2006 imp

Add configuration of the SSC lines for second SSC.


163517 20-Oct-2006 imp

MMC/SD bridge driver (host adapter) for AT91RM9200's MCI interface.
This interface also appears in the AT91SAM9260 and '61 as well as the
AVR32 based micros from Atmel. We don't yet support write protect or
hot-swap in this bridge driver.


162130 07-Sep-2006 imp

MFp4: first cut at getting I2C transfers working (generically). I'm
unsure if this driver correctly implements all the start/stop junk
right (but it did or didn't before I made this commit).


162129 07-Sep-2006 imp

MFp4: berndt pointed me at an errata that shows that the stat register
offsets were originally documented incorrectly. This fixes that. It
shouldn't affect anything other than error stat reporting.


161704 28-Aug-2006 cognet

Relocate the vector page for AT91, to work around bugs with the LOW_VECTOR
code.


161617 25-Aug-2006 cognet

Do not create dma maps with bus_dmamap_create, as we call
bus_dmamem_alloc later which will overwrite the value, leading to a small
memory leak.


161138 09-Aug-2006 imp

Hook into the watchdog device, if present. Also, turn off the
watchdog timer stuff when we boot because the boot blocks are turning
it on...


161105 08-Aug-2006 cognet

Rewrite ARM_USE_SMALL_ALLOC so that instead of the current behavior, it maps
whole the physical memory, cached, using 1MB section mappings. This reduces
the address space available for user processes a bit, but given the amount of
memory a typical arm machine has, it is not (yet) a big issue.
It then provides a uma_small_alloc() that works as it does for architectures
which have a direct mapping.


161063 08-Aug-2006 kevlo

Remove a bogus i = 0.
Approved by: cognet


160683 25-Jul-2006 cognet

Use virtual_avail instead of freemempos as the starting point of the available
physical memory, as the vm uses the memory between freemempos and
virtual_avail.

MFC After: 3 days


160533 20-Jul-2006 cognet

Fix ALT_BREAK_TO_DEBUGGER on the AT91 :
The core uart code expects the receive method to actually puts the
characters read into its buffers. For AT91, it's done in the ipend routine,
so also check if we have the alternate break sequence here.

MFC after: 3 days


160455 17-Jul-2006 cognet

If we can't defrag a packet, re-queue it instead of dropping it.


160453 17-Jul-2006 cognet

#if => #ifdef


160374 15-Jul-2006 cognet

Add a comment explaining why the OHCI mapping has been commented out.


160369 14-Jul-2006 imp

MFp4: this now depends on new spi bus stuff


160368 14-Jul-2006 imp

MFp4: tweaks


160366 14-Jul-2006 imp

MFp4: elevate quality of slow clock a little


160365 14-Jul-2006 imp

MFp4: paren police


160363 14-Jul-2006 imp

MFp4:
Introduce framework to configure the multiplexed pins on boot.

Since the USART supprots RS-485 multidrop mode, it allows the
TX pins to float. However, for RS-232 operations, we don't
want these pins to float. Instead, they should be pulled up
to avoid mismatches. Linux does something similar when it
configures the TX lines. This implies that we also allow the
RX lines to float rather than be in the state they are left in
by the boot loader. Since they are input pins, I think that
this is the right thing to do.

Plus minor for our board.


160362 14-Jul-2006 imp

MFp4:
Fix typo in RTC_CALR_MK.


160361 14-Jul-2006 imp

The TSC board uses a 16MHz base clock for the AT91RM9200, while the Kwikbyte
board uses a 10MHz base clock. Cope with this difference.


160359 14-Jul-2006 imp

Implement the set_time function. Rather pointless with this RTC, as it
resets when the core resets, but there may be some use for it...


160358 14-Jul-2006 imp

MF p4:

Adapt to forthcoming spi framework. The ioctls for SPI commands and such
belong in the higher level driver.


160357 14-Jul-2006 imp

Be sure to flush the cache after a partial read on timeout. Expand
comments about timeouts. Fix a style nit. Sometimes small messages
were getting corrupted.


160348 14-Jul-2006 imp

Move some of the common parameters into the std. files for this platform.
Also migrate from MD disk to NFS boot.


160282 12-Jul-2006 cognet

Comment out the mapping of the OHCI controller registers va == pa. This
address is in the userland address space. The proper thing is either to choose
a virtual address in the kernel address space beyond the KVA, or to use
pmap_mapdev().


160072 02-Jul-2006 imp

Add support for configuring pins to be one of {GPIO, PERIPHERAL A or
PERIPHERAL B}, as well as direction of GPIO pin. Add defines for all
the pins.


160071 02-Jul-2006 imp

MFp4:

Make serial ports more robust and reliable. Make non-console ports
work. This might have broken skyeye stuff.

o Introduce ping-pong receive buffers.
o Use DMA to copy characters directly into memory.
o Support baud rates other than 115200
o Use 1 stop bit when 1 stop bit is requested (otherwise 2 were used,
which caused dropped characters when received in bursts).
o Use 1.5 stop bits for 5-bit bytes, and 2 stop bits otherwise when 2
stop bits were requested.
o Actually update line parameters.
o Fix comments
o Move init into attach
o Tweaks to TX interrupt registers to get them reliable and non-storming.
o harvest data in ipend since the latency between it and the callback
was too long. This likely is how it should be, I don't know why I deferred
things to the callback before.
o disable all interrupts in console init. We don't want interrupts until
we turn on an ISR.
o cosmetic tweaks
o Automatically detect of the TIMEOUT interrupt is supported. If so, use
it so we get better CPU utilization. Otherwise do a character at a time
RX. Good news here is that it seems we have enough CPU and low enough
fast interrupt latency to do this reliably.
o Don't read USART_CR. It is a write-only register.
o start to implement bus_ioctl. Do BAUD now...


159902 23-Jun-2006 cognet

Backout previous commit, Warner committed at91_pio.c...


159899 23-Jun-2006 cognet

Comment out at91_pio.c, it's not in CVS.


159814 20-Jun-2006 imp

Compute physmem so we can print it correctly on boot.
Slightly optimize while I'm here.


159795 20-Jun-2006 imp

Probe the memory size of the board better. Look at the bus width,
number of banks, rows and columns the SDRAMC is programmed to access
to determine the RAM size for the board, rather than hard-wiring it to
be 32MB. My company's board with 64MB now probes correctly, as does
the KB9202 with only 32MB. This means that to detect the right memory
size, our boot loader must correctly initialize these values. This is
a fairly safe assumption because the boot loader has to initialize
SDRAM already, and it isn't really possible to change this register
after we've accessed SDRAM.


159708 17-Jun-2006 imp

Carefully note the RMII bit in the config register at attach time.
The boot loader is supposed to leave this bit set to the right value
for the board. If this bit was set at attach time, use it to init the
config register correctly.

Note: this means the boot loader has to properly initialize it.


159707 17-Jun-2006 imp

improve reporting of clocks


159556 12-Jun-2006 cognet

MFp4: Increase the L1 pagetable needed for the kernel from 8 to 22, to be
able to boot fat kernels.


159365 07-Jun-2006 imp

Remove sa1_cache_clean_addr. It isn't needed.

Submitted by: kevlo


158746 19-May-2006 cognet

We have an implementation of generic_bs_rr_1, so use it, as some drivers use
it.

Submitted by: kevlo


158531 13-May-2006 cognet

Resurrect Skyeye support :
Add a new option, SKYEYE_WORKAROUNDS, which as the name suggests adds
workarounds for things skyeye doesn't simulate. Specifically :
- Use USART0 instead of DBGU as the console, make it not use DMA, and manually provoke an interrupt when we're done in the transmit function.
- Skyeye maintains an internal counter for clock, but apparently there's
no way to access it, so hack the timecounter code to return a value which
is increased at every clock interrupts. This is gross, but I didn't find a
better way to implement timecounters without hacking Skyeye to get the
counter value.
- Force the write-back of PTEs once we're done writing them, even if they
are supposed to be write-through. I don't know why I have to do that.


158432 11-May-2006 cognet

Get this to compile :
- The prototype of uart_bus_probe() hasn't been changed in cvs yet, so use the
old one.
- Add at91_pdcreg.h, needed by uart_dev_at91usart.c.


157891 20-Apr-2006 imp

When returning a resource that we've allocated with rman_reserve_resource,
go ahead and set the rid for that resource.


157570 06-Apr-2006 cognet

MFp4: Catchup with recent UART changes.


157564 06-Apr-2006 imp

Add debug writes in error cases that, in theory, should never happen


157563 06-Apr-2006 imp

Connect twi to the FreeBSD iicbus infrastructure.


157562 06-Apr-2006 imp

Pull in numerous fixes from myself and cognet. With these fixes the
KB9202 eval board is finally stable with a nfs root.


157561 06-Apr-2006 imp

Remove unused bit definitions.
Minor style cleanup while I'm here.


157560 06-Apr-2006 imp

Optimize the TX side of the part by using the PDC to move bytes out to
the wire. This increases the speed considerably. Start to put
infrastructure in place to do RX side, but that requires more study
before it can be done.


157091 24-Mar-2006 imp

Skeleton support for the SSC device, which implements I2S interfaces,
amoung others.


157089 24-Mar-2006 imp

Skeleton PIO support.


157088 24-Mar-2006 imp

Add the sekelton of support for the Power Management Controller.


157087 24-Mar-2006 imp

Add rtc to files.at91


157086 24-Mar-2006 imp

Add RTC support. This may be of dubious value since the RTC is reset
to 1998 every reboot.


157029 22-Mar-2006 cognet

MFp4: Don't force single-user now we can go multi-user.
Call cninit() only after the pagetable has been set, as locore.S won't
map the system device for us anymore.


157024 22-Mar-2006 cognet

MFp4: teach the KB920x bits how to know where the ELF trampoline puts the
strtab and the symtab.


157023 22-Mar-2006 cognet

MFp4: Handle break interrupts (it seems to only work for USART, not DBGU).


156833 18-Mar-2006 imp

MFp4:

Add bus attachment for the ohci device on this chip. The bus and hub
are detected correctly, but the children devices aren't detected
correctly for reasons unknown.


156832 18-Mar-2006 imp

Add ohci controller mapping.


156831 18-Mar-2006 imp

MFp4:

o update TODO list
o Better use of busdma
o mark RX dtors as COHERENT. This helps performance a lot by not requiring
so many EXPENSIVE cache flushes. The cost of accessing it non-cached
is much smaller.
o Copy data from Rx buffers to make IP header 4 byte aligned.
o CRC length included in reported length, so cope
o Don't free TX buffer twice
o Manage TX buffers better.
o Enable just the interrupts we want.
o Manage OACTIVE better

# Some of these done by cognet
# These changes let us get to # via NFS root.


156830 18-Mar-2006 imp

MFP4:
Gratuitously sort alphabetically.


156829 18-Mar-2006 imp

MFP4:

GC and fix definitions.

# some of this may have been done by cognet


156828 18-Mar-2006 imp

MFp4:

o Add memory barrier to bus space
o Allow for up to 3 IRQs per device
o Move to table driven population of children devices.
o Add support for usb ohci memory mapped controller resource allocation.
o Clean up a bunch of extra writes to disable interrupts that are now
done elsewhere.
o Force all system interrupt handlers be fast. We get deadlock if they
aren't.


156827 18-Mar-2006 imp

MFp4:

o Disable all interrupts that the ST can generate until we have an ISR
to service them.
o Correct clock calculation to make DELAY the right length...

Submitted by: cognet (#2)


156094 27-Feb-2006 cognet

Get this to compile with the recent UART changes.


155793 17-Feb-2006 imp

These files apply to all the atmel parts that freebsd is going to run on,
so name them more generically. If we do support the MMU-less ARM7 parts,
then we'll need to, at that time, expand the files we have.


155791 17-Feb-2006 imp

This file was obsolete when committed. Catchup and delete it.


155527 11-Feb-2006 imp

Use the correct address for the ohci device.


155445 07-Feb-2006 cognet

Set the MAC address after we just read it at attach time, as it seems needed.


155443 07-Feb-2006 cognet

Set m_pkthdr.len and m_pkthdr.rcvif.


155405 06-Feb-2006 cognet

- Call mii_phy_probe() after we allocated an ifp. mii has this evil
hack where it assumes the first field of the driver softc is the struct
ifnet, and it copies its value in mii_phy_probe().
- In the interrupt handler, set the mbuf m_len field on packet receive.


155324 04-Feb-2006 imp

Import support for the Atmel AT91RM9200 CPU/Microcontroller. This SoC
is a ARM920T based CPU with a bunch of built-in peripherals. The
inital import supports the SPI bus, the TWI bus (although iicbus
integration is not complete), the uarts, the system timer and the
onboard ethernet. Support for the Kwikbyte KB9202
(http://www.kwikbyte.com) board is also included, although there's no
reason why the 9200 and the 9201 wouldn't also work. Primitive
support for running under the skyeye emulator is also provided
(although skyeye's support for the AT91RM9200 is a little weak).

The code has been structured so that other members of Atmel's arm family can
be supported in the future. The AT91SAM9260 is not presently supported
due to lack of hardware. The arm7tdmi families are also not supported
becasue they lack an MMU.

Many thanks to cognet@ for his help and assistance in bringing up this
board. He did much of the vm work and wrote parts of the uart and
system timer code as well as the bus space implementation.

The system boots to single user w/o problem, although the serial
console is a little slow and the ethernet driver is still in flux.

This work was sponsored by Timing Solutions, Corporation. I am
grateful to their support of the FreeBSD project in this manner.