Commit graph

2206 commits

Author SHA1 Message Date
Aleksandr Rybalko 5f171f64a2 Fix build after FDT changes.
Sponsored by:	The FreeBSD Foundation
2014-01-16 14:48:23 +00:00
Warner Losh 7855b0bd68 Add data so we can convert a PIO unit number into a base address. 2014-01-15 19:53:36 +00:00
Warner Losh db9765adeb Provide a simplified way to specify GPIO pins for the Atmel port. 2014-01-15 19:49:12 +00:00
Ian Lepore afaa74ffe7 Add a prototype for the new arm_devmap_print_table(). This should have
been part of r260490.
2014-01-09 20:57:19 +00:00
Ian Lepore a0e04ab3ff Add a function to print the contents of the static device mapping table,
and invoke it for bootverbose logging, and also from a new DDB command,
"show devmap".  Also tweak the format string for the bootverbose output
of physical memory chunks to get the leading zeros in the hex values.
2014-01-09 18:51:57 +00:00
Ian Lepore 14f4ecfafa Add option USB_HOST_ALIGN to configs that contain 'device usb'. Setting
this to the cache line size is required to avoid data corruption on armv4
and armv5, and improves performance on armv6, in both cases by avoiding
partial cacheline flushes for USB IO.
2014-01-08 03:42:09 +00:00
Ian Lepore 7c2136adbb Add option USB_HOST_ALIGN to configs that contain 'device usb'. Setting
this to the cache line size is required to avoid data corruption on armv4
and armv5, and improves performance on armv6, in both cases by avoiding
partial cacheline flushes for USB IO.

All these configs already exist in 10-stable.  A few that don't (and
thus can't be MFC'd yet) will be committed separately.
2014-01-08 03:40:18 +00:00
Andreas Tobler 6bb9be1b41 Fix arm build.
Reviewed by:	ian, zbb
2014-01-06 17:16:27 +00:00
Ian Lepore 358018a688 Switch to using arm_devmap_add_entry() to set up static device mapping.
This eliminates the hard-coded max kva and roughly doubles the available
kva space.
2014-01-06 16:57:22 +00:00
Ian Lepore 4f9ffa42b0 Don't try to find a static mapping before calling pmap_mapdev(), that logic
is now part of pmap_mapdev() and doesn't need to be duplicated here.
Likewise for unmapping.
2014-01-06 16:33:16 +00:00
Ian Lepore 62a70ef64d Allow 'no static device mappings' to potentially work. It's not clear that
every arm system must have some static mappings to work correctly (although
currently they all do), so remove some panic() calls (which would never
been seen anyway, because they would happen before a console is available).
2014-01-06 16:07:27 +00:00
Ian Lepore fdadb971af Switch to using arm_devmap_add_entry() to set up static device mapping.
This eliminates the hard-coded max kva and roughly doubles the available
kva space.
2014-01-06 15:48:16 +00:00
Ian Lepore 02c7dba919 Remove dev/fdt/fdt_pci.c, which was code specific to Marvell ARM SoCs,
related to setting up static device mappings.  Since it was only used by
arm/mv/mv_pci.c, it's now just static functions within that file, plus
one public function that gets called only from arm/mv/mv_machdep.c.
2014-01-05 22:36:34 +00:00
Ian Lepore 8f4fa88900 Enable the cesa security/crypto device by providing the required property
in the dts source, and adding the right devices to the kernel config. Also
generally bring the kernel config into line with what we have for other
Marvell/Kirkwood systems (add lots of useful devices and options).

One particularly notable addition amongst the kernel config changes is
USB_HOST_ALIGN=32, which may help eliminate data corruption on USB drives.

PR:		kern/181975 arm/162159
2014-01-05 20:44:10 +00:00
Ian Lepore 170e15fb4c Add #include <machine/fdt.h> to a few files that used to get it via
pollution from other headers.
2014-01-05 20:09:51 +00:00
Nathan Whitehorn dcd08302e5 Retire machine/fdt.h as a header used by MI code, as its function is now
obsolete. This involves the following pieces:
- Remove it entirely on PowerPC, where it is not used by MD code either
- Remove all references to machine/fdt.h in non-architecture-specific code
  (aside from uart_cpu_fdt.c, shared by ARM and MIPS, and so is somewhat
  non-arch-specific).
- Fix code relying on header pollution from machine/fdt.h includes
- Legacy fdtbus.c (still used on x86 FDT systems) now passes resource
  requests to its parent (nexus). This allows x86 FDT devices to allocate
  both memory and IO requests and removes the last notionally MI use of
  fdtbus_bs_tag.
- On those architectures that retain a machine/fdt.h, unused bits like
  FDT_MAP_IRQ and FDT_INTR_MAX have been removed.
2014-01-05 18:46:58 +00:00
Ian Lepore 51dbd04609 Convert from using fdt_immr style to arm_devmap_add_entry() to make
static device mappings.

This SoC relied heavily on the fact that all devices were static-mapped
at a fixed address, and it (rather bogusly) used bus_space read and write
calls passing hard-coded virtual addresses instead of proper bus handles,
relying on the fact that the virtual addresses of the mappings were known
at compile time, and relying on the implementation details of arm
bus_space never changing.  All such usage was replaced with calls to
bus_space_map() to obtain a proper bus handle for the read/write calls.

This required adjusting some of the #define values that map out hardware
registers, and some of them were renamed in the process to make it clear
which were defining absolute physical addresses and which were defining
offsets.  (The ones that just define offsets don't appear to be referenced
and probably serve no value other than perhaps documentation.)
2014-01-05 18:40:06 +00:00
Ian Lepore caca500f02 Eliminate use of fdt_immr_addr(), it's not needed for this SoC. Convert
to the newer arm_devmap_add_entry() routine for creating device mappings.
2014-01-05 16:45:34 +00:00
Ian Lepore 6bd6fe5bbb Use the common armv6 fdt_bus_tag defintion instead of an essentially
identical local copy of it.
2014-01-05 15:33:33 +00:00
Ian Lepore 273f1d76d9 Doh! Use C comments, not C++. 2014-01-04 22:14:59 +00:00
Ian Lepore 219f39ba09 Convert static device mapping to use the new arm_devmap_add_entry(),
and add static mappings that cover most of the on-chip peripherals with
1MB section mappings.  This adds about 220MB or so available kva space
by not using a hard-coded 0xF0000000 as the mapping address.
2014-01-04 22:09:53 +00:00
Ian Lepore c18fc3ff67 In pmap_mapdev(), first check whether a static mapping exists, and if so
use it rather than allocating kva space and making another mapping.  In
pmap_unmapdev(), don't unmap/free if the mapping is static.
2014-01-04 21:38:41 +00:00
Ian Lepore f61b6fe561 Use bus_space_map() rather than pmap_mapdev() in nexus_activate_resource(),
when running on FDT systems.  Unmap memory in nexus_deactivate_resource().

Also, call rman_activate_resource() before mapping device memory, and only
do the mapping if it returns success.

Reviewed by:	nwhitehorn
2014-01-04 21:18:22 +00:00
Nathan Whitehorn 818f49fc98 Implement OFW_BUS_MAP_INTR() in terms of the FDT PIC table, which will
become an ARM-specific quirk.
2014-01-04 20:59:03 +00:00
Ian Lepore faacdbd9cf Fix a typo that caused a loop to run beyond the end of the array it was
searching.  If you didn't configure a timer capture pin you'd get a data
abort as it wandered into the weeds, now you get a nice warning message
about your config, as originally intended.
2014-01-03 21:38:33 +00:00
Zbigniew Bodek e1b5472915 Fix race condition in DELAY for SP804 timer.
Fix race condition in DELAY function: sc->tc was not initialized yet when
time_counter pointer was set, what resulted in NULL pointer dereference.

Export sysfreq to dts.

Submitted by:	Wojciech Macek <wma@semihalf.com>
Obtained from:	Semihalf
2014-01-01 20:35:38 +00:00
Zbigniew Bodek 4acd62c51e Add polarity and level support to ARM GIC
Add suport for setting triggering level and polarity in GIC.
New function pointer was added to nexus which corresponds
to the function which sets level/sense in the hardware (GIC).

Submitted by:	Wojciech Macek <wma@semihalf.com>
Obtained from:	Semihalf
2014-01-01 20:03:48 +00:00
Warner Losh 6f4f8f233c Set the SoC name for the atmelbus name. 2013-12-30 18:10:04 +00:00
Adrian Chadd f553cf3bb9 Revert r252694 - which attempted to fix bit emulation for armv6/armv7.
This seems to cause issues with jemalloc + {dhclient, sshd}.

Thus, revert this for now until the root cause can be found and
fixed.

This should quieten some runtime problems with the Raspberry Pi.

PR: kern/185046
MFC after: 3 days
2013-12-27 05:01:13 +00:00
Ian Lepore fb962e6dcf Add PPS support to the am335x timer driver. This uses the timer hardware's
capture mode together with the timecounter's PPS polling feature to get
very accurate PPS capture without any interrupt processing (or latency).

Hardware timers 4 through 7 have associated capture-trigger input pins.
When the PPS support is compiled in the code automatically chooses the
first timer it finds that has the capture-trigger pin set to input mode
(this is configured via the fdt data).
2013-12-22 23:03:29 +00:00
Ian Lepore 97247a2acf A variety of cleanups...
- Use named constants for register bits, instead of mystery numebrs
   scattered around in the code.
 - Use inline functions for bus space read/write, instead of macros
   that rely on global variables.
 - Move the timecounter struct into the softc instead of treating it
   as a global variable.  Backlink from it to the softc.
 - This leaves a pointer to the softc as the only static/global variable
   and it's now used only by DELAY().
2013-12-22 21:44:32 +00:00
Ian Lepore b125ed0241 Map out all the timer-related registers, and define named constants for
the bits within the registers.
2013-12-22 21:35:18 +00:00
Ian Lepore 299e547f97 Shorten the DMTIMER_ prefix used for register names to DMT_. This is in
preparation for adding more complete register defintions, some of which
have fairly long names.
2013-12-22 20:40:56 +00:00
Aleksandr Rybalko e58e20aeda Add Freescale i.MX515 vt(9) driver.
Sponsored by:	The FreeBSD Foundation
2013-12-22 16:09:29 +00:00
Warner Losh f83ed22cb6 Plumb the cn_grab and cn_ungrab routines down into the uart
clients. Mask RX interrupts while grabbed on the atmel serial
driver. This UART interrupts every character. When interrupts are
enabled at the mountroot> prompt, this means the ISR eats the
characters. Rather than try to create a cooperative buffering system
for the low level kernel console, instead just mask out the ISR. For
NS8250 and decsendents this isn't needed, since interrupts only happen
after 14 or more characters (depending on the fifo settings). Plumb
such that these are optional so there's no change in behavior for all
the other UART clients. ddb worked on this platform because all
interrupts were disabled while it was running, so this problem wasn't
noticed. The mountroot> issue has been around for a very very long
time.

MFC after:	3 days
2013-12-21 16:23:31 +00:00
Ganbold Tsagaankhuu 543c9e95f2 Add identification and necessary type checks for Krait CPU cores. Krait CPU is used in
Qualcomm Snapdragon S4 and Snapdragon 400/600/800 SoCs and has architectural
similarities to ARM Cortex-A15. As for development boards IFC6400 series embedded
boards from Inforce Computing uses Snapdragon S4 Pro/APQ8064.

Approved by: stas (mentor)
2013-12-20 00:56:23 +00:00
Aleksandr Rybalko 86b04d42ec Fix copyright and some style(9) things.
Sponsored by:	The FreeBSD Foundation
2013-12-17 15:34:38 +00:00
Aleksandr Rybalko 0f705e869b Add vt support for RPi. (No early stage yet.)
Sponsored by:	The FreeBSD Foundation
2013-12-17 15:23:47 +00:00
Nathan Whitehorn 95e3bfe889 Simplify the ofw_bus_lookup_imap() API slightly: make it allocate maskbuf
internally instead of requiring the caller to allocate it.
2013-12-17 15:11:24 +00:00
Nathan Whitehorn c826a64307 Use the common Open Firmware PCI interrupt routing code instead of the
duplicate version in dev/fdt.

Tested by:	zbb
2013-12-16 22:04:47 +00:00
Luiz Otavio O Souza 9fa569a713 After r256961 ofw_iicbuc.c will be built for any kernel which includes
options 'iicbus' and 'fdt'.  Remove the (now) unnecessary entries.

Verified on BBB (am335x), EFIKA_MX (imx51 - by ray@), DIGI-CCWMX53
(imx53 - kernel build).

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

MFC after:	3 days
2013-12-11 05:32:29 +00:00
John Baldwin 0b20d9bf78 Correct license statements to reflect the fact that these files were all
derived from sys/arm/mv/bus_space.c.

Approved by:	core
2013-12-10 22:13:36 +00:00
Luiz Otavio O Souza 7f6897133f Bring the RPi I2C driver in line with ti_i2c. Make it treat any slave
address as a 7-bit address.

Approved by:	adrian (mentor)
2013-12-09 12:01:17 +00:00
Luiz Otavio O Souza 05a92e03c3 Activate the device before attempt to access any of its registers. Without
this change we may end up with a panic (Fatal kernel mode data abort:
'External Non-Linefetch Abort (S)') as described in
http://e2e.ti.com/support/arm/sitara_arm/f/791/t/276862.aspx.

It is now possible to bring up I2C1 and I2C2 on BBB.

Approved by:	adrian (mentor)
2013-12-09 11:51:17 +00:00
Luiz Otavio O Souza 8537123a62 Fix a few typos on the scm (control module) pin mux definitions.
Approved by:	adrian (mentor)
2013-12-09 11:33:45 +00:00
Ganbold Tsagaankhuu bfb24e2a06 Add gpio parse routines according to sys/boot/fdt/dts/bindings-gpio.txt.
Reviewed by: stas@
2013-12-09 07:14:59 +00:00
Luiz Otavio O Souza 87bd9889d1 Similar to r255816, fix the math for the DELAY() calculation. It was off
by a really small amount because of the higher timer resolution.

Approved by:	adrian (mentor)
Verified on:	BBB
2013-12-08 13:46:27 +00:00
Warner Losh 0b40a04719 Although not strictly required to boot a 64MB board, bump
vm_max_virtual_address to be KERNVIRTADDR + 256MB. This allows some
future shock protection since the KVA requirements have gone up since
the unmapped changes have gone in, as well as preventing us from
overlapping with the hardware devices, which we map at 0xd0000000,
which we'd hit with anything more than 85MB...

MFC after:	3 days
2013-12-06 18:41:16 +00:00