Commit Graph

293 Commits

Author SHA1 Message Date
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
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
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
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
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
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
Luiz Otavio O Souza
9f16518401 Fix the pin value reading on AM335x. Because of the inverted logic it was
always returning '0' for all the reads, even for the outputs.  It is now
known to work with gpioiic(4) and gpioled(4).

Approved by:	adrian (mentor)
Tested on:	BBB
2013-12-06 18:09:10 +00:00
Ian Lepore
19bc299f1c Bugfixes... the host capabilties from FDT data are stored in host.caps, not
host.host_ocr, examine the correct field when setting up the hardware.  Also,
the offset for the capabilties register should be 0x140, not 0x240.

Submitted by:	Ilya Bakulin <ilya@bakulin.de>
Pointy hat to:	me
2013-11-19 22:14:35 +00:00
Rui Paulo
3477d65d6a Enable the ti_mbox and ti_pruss drivers. 2013-11-16 08:28:14 +00:00
Rui Paulo
8cfbb9cf03 Add a driver for the TI Programmable Realtime Unit Subsystem.
This is only a userland accessibility driver.  It mmaps the hardware region to
userland and posts interrupt notifications via kqueue.
2013-11-16 08:23:15 +00:00
Rui Paulo
5b8db1da54 Add a driver for the Texas Instruments Mailbox hardware. 2013-11-16 08:20:50 +00:00
Ian Lepore
5a8b65f67a Switch to the new common bus_space-v6.c, remove the local one. 2013-11-07 04:09:19 +00:00
Ian Lepore
515cbe8673 Call initarm_lastaddr() later in the init sequence, after establishing
static device mappings, rather than as the first of the initializations
that a platform can hook into.  This allows a platform to allocate KVA
from the top of the address space downwards for things like static device
mapping, and return the final "last usable address" result after that and
other early init work is done.

Because some platforms were doing work in initarm_lastaddr() that needs to
be done early, add a new initarm_early_init() routine and move the early
init code to that routine on those platforms.

Rename platform_devmap_init() to initarm_devmap_init() to match all the
other init routines called from initarm() that are designed to be
implemented by platform code.

Add a comment block that explains when these routines are called and the
type of work expected to be done in each of them.
2013-11-05 02:57:34 +00:00
Ian Lepore
3110e7eed8 Move remaining code and data related to static device mapping into the
new devmap.[ch] files.  Emphasize the MD nature of these things by using
the prefix arm_devmap_ on the function and type names (already a few of
these things found their way into MI code, hopefully it will be harder to
do by accident in the future).
2013-11-04 22:45:26 +00:00
Ian Lepore
760eb697b4 The ability to do 8-bit implies 4-bit capability too. Rearrange the cases
and add a fallthrough comment to make that happen.
2013-11-01 19:29:59 +00:00
Ian Lepore
4a98e46950 TI sdhci driver improvements, mostly related to fdt data...
Use the published compatible strings (our own invention, "ti,mmchs" is
still accepted as well, for now).

Don't blindly turn on 8-bit bus mode, because even though the conroller
supports it, the board has to be wired appropriately as well.  Use the
published property (bus-width=<n>) and honor all the valid values (1,4,8).

The eMMC device on a Beaglebone Black is wired for 8-bit, update the dts.

The mmchs controller can inherently do both 1.8v and 3.0v on the first
device and 1.8v only on other devices, unless an external transceiver is
used.  Set the voltage automatically for the first device and honor
the published fdt property (ti,dualvolt) for other devices.

Thanks go to Ilya Bakulin for figuring out the voltage compatibility stuff.
2013-11-01 19:22:06 +00:00
Ian Lepore
99895358c0 Sweep up a bit of arm-land fallout after r257244; include necessary
headers directly that are no longer available via accidental include.
2013-10-28 15:20:17 +00:00
Ian Lepore
99af02e3b6 Retire arm_remap_nocache() and the data and constants associated with it.
The only remaining user was the code that allocates bounce pages for armv4
busdma.  It's not clear why bounce pages would need uncached memory, but
if that ever changes, kmem_alloc_attr() would be the way to get it.
2013-10-27 03:13:26 +00:00
Ian Lepore
6489412064 Remove #include <machine/frame.h> from all the arm code that doesn't
really need it.  That would be almost everywhere it was included.  Add
it in a couple files that really do need it and were previously getting
it by accident via another header.
2013-10-27 01:34:10 +00:00
Ian Lepore
69d75558a7 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.

Thanks to alc@ for pointing this out.
2013-10-27 00:51:46 +00:00
Ian Lepore
aef60d8c4a Add support for uarts other than the serial console in TI OMAP SoCs.
The TI uart hardware is ns16550-compatible, except that before it can
be used the clocks and power have to be enabled and a non-standard
mode control register has to be set to put the device in uart mode
(as opposed to irDa or other serial protocols).  This adds the extra
code in an extension to the standard ns8250 probe routine, and the
rest of the driver is just the standard ns8250 code.
2013-08-21 14:33:02 +00:00
Ian Lepore
14548b7c32 Make the noop clock successfully do nothing, because doing nothing and
returning an error status (which the NULL method pointers caused) isn't
nearly as useful.
2013-08-21 04:49:58 +00:00
Ian Lepore
4169ecbb8f Define the uart clocks so that they can be en/disabled at runtime. 2013-08-21 04:20:17 +00:00
Ian Lepore
59769a581f Make the standard sdhci(4) driver work for the TI OMAP family SoCs.
The MMCHS hardware is pretty much a standard SDHCI v2.0 controller with a
couple quirks, which are now supported by sdhci(4) as of r254507.

This should work for all TI SoCs that use the MMCHS hardware, but it has
only been tested on AM335x right now, so this enables it on those platforms
but leaves the existing ti_mmchs driver in place for other OMAP variants
until they can be tested.

This initial incarnation lacks DMA support (coming soon).  Even without it
this improves performance pretty noticibly over the ti_mmchs driver,
primarily because it now does multiblock IO.
2013-08-20 12:33:35 +00:00
Olivier Houchard
7497e6267c Let the platform calculate the timer frequency at runtime, and use that for
the omap4, instead of relying on the (wrong) value provided in the dts.
2013-08-05 20:14:56 +00:00
Rui Paulo
db10a06d50 Initialisation routines for the mailbox, spinlock and PRU-ICSS clocks. 2013-07-31 05:52:03 +00:00
Rui Paulo
b2b175ba30 Improve a comment. 2013-07-09 02:50:05 +00:00
Oleksandr Tymoshenko
c0195195d5 Add IDs for TPS65217C and TPS65217D 2013-07-08 05:06:32 +00:00
Oleksandr Tymoshenko
f1fa19dfe7 - AM335x requires updated soft-reset logic too 2013-07-08 04:27:03 +00:00
Oleksandr Tymoshenko
5a2168b2ef - Add USBSS driver for AM335x SoC. Driver is a wrapper around Mentors Graphic
USB OTG core.
2013-07-07 04:22:08 +00:00
Rui Paulo
522b93a92a Don't clear the SYSCONFIG register on boot.
This follows section 18.4.2.2 SD Soft Reset Flow in the TI AM335x Technical
Reference Manual and seems to fix the "ti_mmchs0: Error: current cmd NULL,
already done?" messages.
2013-07-06 04:18:34 +00:00
Oleksandr Tymoshenko
179232d853 Add support for ePWM submodule of PWMSS
ePWM is controlled by sysctl nodes dev.am335x_pwm.N.period,
dev.am335x_pwm.N.dutyA and dev.am335x_pwm.N.dutyB that controls
PWM period and duty cycles for channels A and B respectively.

Period and duty cycle are measured in clock ticks. Default
clock frequency for AM335x PWM subsystem is 100MHz
2013-07-04 20:13:22 +00:00
Oleksandr Tymoshenko
02ff64b84f - Request non-cached memory for framebuffer
- Properly probe/initialize syscons
2013-06-27 00:33:08 +00:00
Rui Paulo
8ab18d3034 Print the 'setting internal ...' message only with bootverbose. 2013-06-26 02:56:54 +00:00
Olivier Houchard
cd5ff81bd2 Increase the maximum KVM available on TI chips. Not sure why we suddenly need
that much, but that lets me boot with 1GB of RAM.
2013-06-09 22:51:11 +00:00
Oleksandr Tymoshenko
24ca3d19a9 AM335x LCD controller driver with syscons support
Limitations:
- Raster mode only
- 24 and 32 bpp only
2013-05-27 00:23:01 +00:00
Oleksandr Tymoshenko
7747ea65a0 Add PWM module driver for AM335x. Only eCAS subsystem is supported
Export function to configure eCAS submodule from another drivers.
It's used to control LCD panel backlight on AM335x EVM.
2013-05-27 00:13:27 +00:00
Oleksandr Tymoshenko
2487319716 Add SCM registers definitions for AM335x platform 2013-05-27 00:09:04 +00:00
Oleksandr Tymoshenko
2e9f638dbb Add clock definitions for LCD controller and PWM module 2013-05-27 00:06:24 +00:00
Tim Kientzle
11ee687c67 Back out r250768 until I can further investigate why it might
be causing problems with the BeagleBone Black boot.
2013-05-18 22:42:21 +00:00
Tim Kientzle
b5eb012033 Label the mmc child after the parent. 2013-05-18 12:53:20 +00:00
Gabor Kovesdan
b78540b1c7 - Correct mispellings of word resource
Submitted by:	Christoph Mallon <christoph.mallon@gmx.de>
2013-04-17 11:47:32 +00:00
Oleksandr Tymoshenko
08dab5832b Properly clean "spurious interrupt" state
Suggested by: Ian Lepore
2013-04-06 03:31:28 +00:00
Ian Lepore
33ff10ea55 Add a macro that gets the physical address of a memory mapped device
register from a bus space resource.

Note that this macro is just for ARM, and is intended to have a short
lifespan.  The DMA engines in some SoCs need the physical address of a
memory-mapped device register as one of the arguments for the transfer.
Several scattered ad-hoc solutions have been converted to use this macro,
which now also serves to mark the places where a more complete fix needs
to be applied (after that fix has been designed).
2013-03-17 03:04:43 +00:00
Alexander Motin
fdc5dd2d2f MFcalloutng:
Switch eventtimers(9) from using struct bintime to sbintime_t.
Even before this not a single driver really supported full dynamic range of
struct bintime even in theory, not speaking about practical inexpediency.
This change legitimates the status quo and cleans up the code.
2013-02-28 13:46:03 +00:00
Oleksandr Tymoshenko
8e02f209f9 Fix typo 2013-02-27 08:34:32 +00:00
Oleksandr Tymoshenko
5c7269aca4 - Initialize GPIO_OE register based on pinmux configuration
Although AM335x TRM states that GPIO_OE register is not used and just
reflects pads configuration in practice it does control pin behavior
and shoiuld be set in addition to pinmux setup
2013-02-27 08:32:34 +00:00
Oleksandr Tymoshenko
8f80e4e134 Fix off-by-one error in sanity checks 2013-02-25 09:33:48 +00:00
Oleksandr Tymoshenko
97b405f18f - Fix off-by-one error when returning max pin number
- Fix GPIOGET for output pins. Requesting state for
    output pin is valid operation, get the state from
    TI_GPIO_DATAOUTX register
2013-02-25 08:04:47 +00:00
Oleksandr Tymoshenko
e589740522 Fix copy-paste error in bus_space_unmap argument
While I'm at it - fix some style(9) issues

Submitted by:	Mikael Urankar
2013-02-15 21:24:21 +00:00
Tim Kientzle
ae6aefaf57 Another overhaul of the CPSW driver for BeagleBone
Major changes:
  * Finally tracked down the flow control setting that
    seems to have been causing TX stalls and watchdog timeouts
  * RX and TX paths now share a lot more code
  * TX interrupt is no longer used; we instead GC finished
    tx queue entries at the bottom of the start routine.
  * TX start now queues fragmented packets directly; it only
    invokes defrag() for occasional very fragmented packets.
  * "sysctl dev.cpsw" dumps controller statistics and queue counts
  * Host Error Interrupt will give extensive debugging information
    if the controller chokes on the queued data.
2013-02-03 01:08:01 +00:00
Damjan Marion
bcf82d6e8c Fix case for some signal names.
Submitted by:   Emmanuel Vadot <elbarto@megadrive.org>
2013-01-28 09:23:38 +00:00
Damjan Marion
1a8655aa16 Filled in missing pads for AM335x / Beaglebone.
Submitted by:   Emmanuel Vadot <elbarto@megadrive.org>
2013-01-28 09:11:04 +00:00
Tim Kientzle
296aaa6046 Clarify the error messages for unrecognized pins and muxtypes. 2013-01-19 17:12:23 +00:00
Olivier Houchard
6db9b3528e Define IPI_IRQ_START and IPI_IRQ_END. 2013-01-09 01:54:17 +00:00
Oleksandr Tymoshenko
5c79e1dd7d - Identify more devices for OMAP4 SoC (up to OMAP4470)
- Whitespace fixes
2013-01-07 23:30:53 +00:00
Tim Kientzle
d7631c7111 Shuffle the TX underrun to work the same way as the RX underrun,
as suggested by YongHyeon PYUN.
2013-01-05 20:37:40 +00:00
Tim Kientzle
ebc4238eea While trying to track down the root cause for
TX stalls in this driver, I've also had some
time to evaluate the effectiveness of different
watchdog strategies.

This is the latest attempt, which consolidates
all of the watchdog logic in one place and
consistently detects TX stalls and resets within
a couple of seconds.
2013-01-05 17:59:44 +00:00
Tim Kientzle
5bf325556b Overhauled CPSW driver for TI CPSW Ethernet module
(as used in AM335x SoC for BeagleBone).

Among other things:
 * Watchdog reset doesn't hang the driver.
 * Disconnecting cable doesn't hang the driver.
 * ifconfig up/down doesn't hang the driver
 * Out-of-memory no longer panics the driver.

Known issues:
 * Doesn't have good support for fragmented packets
   (calls m_defrag() on TX, assumes RX packets are never fragmented)
 * Promisc and allmulti still unimplimented
 * addmulti and delmulti still unimplemented
 * TX queue still stalls (but watchdog now consistently recovers in ~5s)
 * No sysctl monitoring
 * Only supports port0
 * No switch configuration support
 * Not tested on anything but BeagleBone

Committed from: BeagleBone
2013-01-01 18:55:04 +00:00
Oleksandr Tymoshenko
7c5338d71e PL310 driver update:
- Add pl310.disable tunable to disable L2 cache altogether. In
    order to make sure that it's 100% disabled we use cache event
    counters for cache line eviction and read allocate events
    and panic if any of these counters increased. This is purely
    for debugging purpose
- Direct access DEBUG_CTRL and CTRL might be unavailable in
    unsecure mode, so use platform-specific functions for
    these registers
- Replace #if 1 with proper erratum numbers
- Add erratum 753970 workaround
- Remove wait function for atomic operations
- Protect cache operations with spin mutex in order to prevent race condition
- Disable instruction cache prefetch and make sure data cache
    prefetch is enabled in OMAP4-specific intialization
2012-12-31 21:19:44 +00:00
Gleb Smirnoff
eb1b1807af Mechanically substitute flags from historic mbuf allocator with
malloc(9) flags within sys.

Exceptions:

- sys/contrib not touched
- sys/mbuf.h edited manually
2012-12-05 08:04:20 +00:00
Tim Kientzle
3b5c0b51e9 Fix spelling. 2012-11-25 16:19:12 +00:00
Warner Losh
62c2fb63a9 Strip trailing newline. 2012-11-23 17:22:38 +00:00
Andrew Turner
7bf9ab5331 Merge the FDT versions of initarm.
The copies of initarm used on platforms with FDT support were almost
identical. The differences were pulled out into separate functions that
were called by initarm.

This change merges the, now identical, copies of initarm and a few of it's
support functions. This is a step towards a common kernel on ARMv6.
2012-11-03 22:39:07 +00:00
Olivier Houchard
6626207e67 Fix SMP build for omap4
Submitted by:	Giovanni Trematerra <gianni at freebsd DOT org>
2012-10-30 15:25:01 +00:00
Tim Kientzle
e9e4f18efc Missing paren.
Pointy hat:me
2012-10-27 22:13:42 +00:00
Tim Kientzle
83e73d6911 set the kernelname from the boot loader environment.
This fixes kern.bootfile sysctl.

Submitted by:	Giovanni Trematerra
2012-10-26 05:48:53 +00:00
Tim Kientzle
5daf64fb7d Do proper padding of runt packets using code copied from bge(4).
Reviewed by:	gnn
2012-10-25 04:37:47 +00:00
Tim Kientzle
ea4597d0ab Refer to headers locally. This makes it a lot easier
to build this driver out-of-tree.
2012-10-25 04:33:47 +00:00
Eitan Adler
db702c59cf remove duplicate semicolons where possible.
Approved by:	cperciva
MFC after:	1 week
2012-10-22 03:00:37 +00:00
Tim Kientzle
747d299f0a Don't repeat the POSTREAD dma sync. 2012-10-22 02:28:48 +00:00
Tim Kientzle
da44817ee6 Replace deprecated M_DONTWAIT with M_NOWAIT. 2012-10-19 05:50:56 +00:00
Tim Kientzle
83e5430018 Fix an mbuf leak in cpsw driver, clean up mbuf management:
* Record TX mbufs when we get them so we can release them.
 * Set TX/RX mbuf slots to NULL when we are no longer responsible for them
 * Move dma sync on RX into RX intr routine
2012-10-15 04:10:49 +00:00
Tim Kientzle
2e88f5cd34 Cut-and-paste dropped semicolon. 2012-10-14 23:07:54 +00:00
Tim Kientzle
4cc21ce89a Name cpsw_stop to cpsw_stop_locked consistently with other functions
in this file that assume locks are already held.
2012-10-14 23:00:24 +00:00
Tim Kientzle
a97afde093 Return correct packet size. 2012-10-14 22:58:12 +00:00
Andrew Turner
5bd9e48117 Remove unused variables from the OMAP ehci code. 2012-10-01 05:15:13 +00:00
Andrew Turner
1f008b99cc Pull out the SoC specific parts of initarm into separate functions 2012-09-23 03:46:03 +00:00
Andrew Turner
70203625fb Update different versions of physmap_init to be identical in preparation
for merging them.
2012-09-23 02:01:59 +00:00
Andrew Turner
d98d8a1e83 Reduce the diff between the FDT implementations of initarm.
This only touches whitespace and comments.
2012-09-22 22:41:38 +00:00
Andrew Turner
1161298251 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.
2012-09-22 06:41:56 +00:00
John-Mark Gurney
2b539bdcb3 remove some unnecessary debugging statements, dead code and incorrect
comment...

Reviewed by:	gnn, imp
2012-09-16 19:42:27 +00:00
Eitan Adler
96240c89f0 Correct double "the the"
Approved by:	cperciva
MFC after:	3 days
2012-09-14 21:28:56 +00:00
Tim Kientzle
0be65db279 Correctly fetch the MAC address.
Break down the bytes directly into the softc;
the intermediate buffer isn't needed here.
Break down the bytes in the correct order.
2012-08-27 04:43:30 +00:00
Oleksandr Tymoshenko
5b88bb19d6 Style cleanup 2012-08-25 21:13:00 +00:00
Tim Kientzle
cddf6d2a33 After r239366, fix the ti_edma3.c driver to use the
exact name as used in the FDT.
2012-08-22 05:14:59 +00:00
Andrew Turner
19a0f7f9cb Set machine correctly on ARM. This allows universe to use the correct world
when building each kernel.

Reviewed by:	imp
2012-08-18 05:48:19 +00:00
Oleksandr Tymoshenko
d3b496875a Specify architecture for assembler 2012-08-15 07:00:34 +00:00
Oleksandr Tymoshenko
e53470fee3 Merging of projects/armv6, part 10
- Support for Texas Instruments SoCs:
	- AM335x
	- OMAP4

- Kernel configs, DTS for Beaglebone and Pandaboard

Submitted by:	Ben Gray, Damjan Marion
2012-08-15 06:31:32 +00:00