History log of /freebsd-11-stable/sys/arm/at91/at91.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 331722 29-Mar-2018 eadler

Revert r330897:

This was intended to be a non-functional change. It wasn't. The commit
message was thus wrong. In addition it broke arm, and merged crypto
related code.

Revert with prejudice.

This revert skips files touched in r316370 since that commit was since
MFCed. This revert also skips files that require $FreeBSD$ property
changes.

Thank you to those who helped me get out of this mess including but not
limited to gonzo, kevans, rgrimes.

Requested by: gjb (re)


# 330897 14-Mar-2018 eadler

Partial merge of the SPDX changes

These changes are incomplete but are making it difficult
to determine what other changes can/should be merged.

No objections from: pfg


# 302408 07-Jul-2016 gjb

Copy head@r302406 to stable/11 as part of the 11.0-RELEASE cycle.
Prune svn:mergeinfo from the new branch, as nothing has been merged
here.

Additional commits post-branch will follow.

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


/freebsd-11-stable/MAINTAINERS
/freebsd-11-stable/cddl
/freebsd-11-stable/cddl/contrib/opensolaris
/freebsd-11-stable/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print
/freebsd-11-stable/cddl/contrib/opensolaris/cmd/zfs
/freebsd-11-stable/cddl/contrib/opensolaris/lib/libzfs
/freebsd-11-stable/contrib/amd
/freebsd-11-stable/contrib/apr
/freebsd-11-stable/contrib/apr-util
/freebsd-11-stable/contrib/atf
/freebsd-11-stable/contrib/binutils
/freebsd-11-stable/contrib/bmake
/freebsd-11-stable/contrib/byacc
/freebsd-11-stable/contrib/bzip2
/freebsd-11-stable/contrib/com_err
/freebsd-11-stable/contrib/compiler-rt
/freebsd-11-stable/contrib/dialog
/freebsd-11-stable/contrib/dma
/freebsd-11-stable/contrib/dtc
/freebsd-11-stable/contrib/ee
/freebsd-11-stable/contrib/elftoolchain
/freebsd-11-stable/contrib/elftoolchain/ar
/freebsd-11-stable/contrib/elftoolchain/brandelf
/freebsd-11-stable/contrib/elftoolchain/elfdump
/freebsd-11-stable/contrib/expat
/freebsd-11-stable/contrib/file
/freebsd-11-stable/contrib/gcc
/freebsd-11-stable/contrib/gcclibs/libgomp
/freebsd-11-stable/contrib/gdb
/freebsd-11-stable/contrib/gdtoa
/freebsd-11-stable/contrib/groff
/freebsd-11-stable/contrib/ipfilter
/freebsd-11-stable/contrib/ldns
/freebsd-11-stable/contrib/ldns-host
/freebsd-11-stable/contrib/less
/freebsd-11-stable/contrib/libarchive
/freebsd-11-stable/contrib/libarchive/cpio
/freebsd-11-stable/contrib/libarchive/libarchive
/freebsd-11-stable/contrib/libarchive/libarchive_fe
/freebsd-11-stable/contrib/libarchive/tar
/freebsd-11-stable/contrib/libc++
/freebsd-11-stable/contrib/libc-vis
/freebsd-11-stable/contrib/libcxxrt
/freebsd-11-stable/contrib/libexecinfo
/freebsd-11-stable/contrib/libpcap
/freebsd-11-stable/contrib/libstdc++
/freebsd-11-stable/contrib/libucl
/freebsd-11-stable/contrib/libxo
/freebsd-11-stable/contrib/llvm
/freebsd-11-stable/contrib/llvm/projects/libunwind
/freebsd-11-stable/contrib/llvm/tools/clang
/freebsd-11-stable/contrib/llvm/tools/lldb
/freebsd-11-stable/contrib/llvm/tools/llvm-dwarfdump
/freebsd-11-stable/contrib/llvm/tools/llvm-lto
/freebsd-11-stable/contrib/mdocml
/freebsd-11-stable/contrib/mtree
/freebsd-11-stable/contrib/ncurses
/freebsd-11-stable/contrib/netcat
/freebsd-11-stable/contrib/ntp
/freebsd-11-stable/contrib/nvi
/freebsd-11-stable/contrib/one-true-awk
/freebsd-11-stable/contrib/openbsm
/freebsd-11-stable/contrib/openpam
/freebsd-11-stable/contrib/openresolv
/freebsd-11-stable/contrib/pf
/freebsd-11-stable/contrib/sendmail
/freebsd-11-stable/contrib/serf
/freebsd-11-stable/contrib/sqlite3
/freebsd-11-stable/contrib/subversion
/freebsd-11-stable/contrib/tcpdump
/freebsd-11-stable/contrib/tcsh
/freebsd-11-stable/contrib/tnftp
/freebsd-11-stable/contrib/top
/freebsd-11-stable/contrib/top/install-sh
/freebsd-11-stable/contrib/tzcode/stdtime
/freebsd-11-stable/contrib/tzcode/zic
/freebsd-11-stable/contrib/tzdata
/freebsd-11-stable/contrib/unbound
/freebsd-11-stable/contrib/vis
/freebsd-11-stable/contrib/wpa
/freebsd-11-stable/contrib/xz
/freebsd-11-stable/crypto/heimdal
/freebsd-11-stable/crypto/openssh
/freebsd-11-stable/crypto/openssl
/freebsd-11-stable/gnu/lib
/freebsd-11-stable/gnu/usr.bin/binutils
/freebsd-11-stable/gnu/usr.bin/cc/cc_tools
/freebsd-11-stable/gnu/usr.bin/gdb
/freebsd-11-stable/lib/libc/locale/ascii.c
/freebsd-11-stable/sys/cddl/contrib/opensolaris
/freebsd-11-stable/sys/contrib/dev/acpica
/freebsd-11-stable/sys/contrib/ipfilter
/freebsd-11-stable/sys/contrib/libfdt
/freebsd-11-stable/sys/contrib/octeon-sdk
/freebsd-11-stable/sys/contrib/x86emu
/freebsd-11-stable/sys/contrib/xz-embedded
/freebsd-11-stable/usr.sbin/bhyve/atkbdc.h
/freebsd-11-stable/usr.sbin/bhyve/bhyvegc.c
/freebsd-11-stable/usr.sbin/bhyve/bhyvegc.h
/freebsd-11-stable/usr.sbin/bhyve/console.c
/freebsd-11-stable/usr.sbin/bhyve/console.h
/freebsd-11-stable/usr.sbin/bhyve/pci_fbuf.c
/freebsd-11-stable/usr.sbin/bhyve/pci_xhci.c
/freebsd-11-stable/usr.sbin/bhyve/pci_xhci.h
/freebsd-11-stable/usr.sbin/bhyve/ps2kbd.c
/freebsd-11-stable/usr.sbin/bhyve/ps2kbd.h
/freebsd-11-stable/usr.sbin/bhyve/ps2mouse.c
/freebsd-11-stable/usr.sbin/bhyve/ps2mouse.h
/freebsd-11-stable/usr.sbin/bhyve/rfb.c
/freebsd-11-stable/usr.sbin/bhyve/rfb.h
/freebsd-11-stable/usr.sbin/bhyve/sockstream.c
/freebsd-11-stable/usr.sbin/bhyve/sockstream.h
/freebsd-11-stable/usr.sbin/bhyve/usb_emul.c
/freebsd-11-stable/usr.sbin/bhyve/usb_emul.h
/freebsd-11-stable/usr.sbin/bhyve/usb_mouse.c
/freebsd-11-stable/usr.sbin/bhyve/vga.c
/freebsd-11-stable/usr.sbin/bhyve/vga.h
# 298627 26-Apr-2016 br

Move arm's devmap to some generic place, so it can be used
by other architectures.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D6091
Sponsored by: DARPA, AFRL
Sponsored by: HEIF5


# 297199 22-Mar-2016 jhibbits

Fix the resource_list_print_type() calls to use uintmax_t.

Missed a bunch from r297000.


# 295832 19-Feb-2016 jhibbits

Introduce a RMAN_IS_DEFAULT_RANGE() macro, and use it.

This simplifies checking for default resource range for bus_alloc_resource(),
and improves readability.

This is part of, and related to, the migration of rman_res_t from u_long to
uintmax_t.

Discussed with: jhb
Suggested by: marcel


# 294883 27-Jan-2016 jhibbits

Convert rman to use rman_res_t instead of u_long

Summary:
Migrate to using the semi-opaque type rman_res_t to specify rman resources. For
now, this is still compatible with u_long.

This is step one in migrating rman to use uintmax_t for resources instead of
u_long.

Going forward, this could feasibly be used to specify architecture-specific
definitions of resource ranges, rather than baking a specific integer type into
the API.

This change has been broken out to facilitate MFC'ing drivers back to 10 without
breaking ABI.

Reviewed By: jhb
Sponsored by: Alex Perez/Inertial Computing
Differential Revision: https://reviews.freebsd.org/D5075


# 294133 16-Jan-2016 imp

We don't need at91_bs_tag. arm_base_bs_tag works now that we have
better dynamic device mapping that didn't exit when we started this
port. Remove it, since everything works w/o it.


# 277471 21-Jan-2015 ian

Use explicit initializer style, fill in missing functions.


# 277467 21-Jan-2015 ian

For some reason, all the arm bus_space functions that work with uint16
values have armv4 in the name. There's nothing armv4-special about them,
so just use the same sort of names as all the other functions.


# 277460 20-Jan-2015 ian

Revise the arm bus_space implementation to avoid dereferencing the tag on
every operation to retrieve the bs_cookie value almost nothing actually uses.

The bus_space struct contains a private data pointer (poorly named bs_cookie,
now renamed to bs_privdata) which is used only by a few old armv4 xscale
implementations. The bus_space functions were all defined to take this
value as the first parameter instead of the bus_space_tag_t, requiring all
the inline macro and function expansions to dereference the tag to pass it
to another function, which never uses it. Now all the functions take the tag
as the first parameter and retrieve the privdata if they need it.

Also fix a couple bus_space_unmap() implementations that were calling
kva_free() instead of pmap_unmapdev().

Discussed with: cognet


# 271398 10-Sep-2014 andrew

Unify interrupts bit definition and usage. While here remove PSR_C_bit.

Submitted by: Svatopluk Kraus <onwahe at gmail.com>,
Michal Meloun <meloun at miracle.cz>
Differential Revision: https://reviews.freebsd.org/D754


# 269960 14-Aug-2014 imp

Add AIC to at91sam9260 support, now that it is needed for multipass to
work. This gets my AT91SAM9260-based boards almost booting with
current in multi pass. The MCI driver is broken, but it is equally
broken before multi-pass.


# 262925 08-Mar-2014 imp

Move AIC related stuff to own file.


# 262924 08-Mar-2014 imp

Properly round on unmapping.


# 261322 31-Jan-2014 imp

Switch to using PAs rather than VAs for the addresses we map for
devices. This is a nop, except for what's reported by atmelbus for the
resources.

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

User's with their own devices may need to make adjustments.


# 261304 30-Jan-2014 imp

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


# 261171 25-Jan-2014 imp

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.


# 260093 30-Dec-2013 imp

Set the SoC name for the atmelbus name.


# 257660 04-Nov-2013 ian

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


# 257370 29-Oct-2013 nwhitehorn

Fix typo. Sorry!


# 257343 29-Oct-2013 nwhitehorn

A last BUS_PROBE_NOWILDCARD. Move setting the postfilter function into the
attach function probe shouldn't actually set anything up but just bid
on the device.


# 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


# 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@


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


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


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


# 236989 13-Jun-2012 imp

Strip trailing whitespace before other changes.


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


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


# 226832 27-Oct-2011 kevlo

Check the return value of BUS_SETUP_INTR()

Reviewed by: imp


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


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


# 192135 15-May-2009 imp

Fix name for driver to assign to the SPI device.


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


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


# 185265 24-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.


# 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


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


# 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


# 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


# 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


# 167261 06-Mar-2007 piso

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


# 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@


# 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


# 161704 28-Aug-2006 cognet

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


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


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


# 157564 06-Apr-2006 imp

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


# 156828 17-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.


# 155527 11-Feb-2006 imp

Use the correct address for the ohci device.


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