Commit Graph

2931 Commits

Author SHA1 Message Date
Konstantin Belousov
206f09eb46 Do not qualify the mcontext_t *mcp argument for set_mcontext(9) as
const.  On x86, even after the machine context is supposedly read into
the struct ucontext, lazy FPU state save code might only mark the FPU
data as hardware-owned.  Later, set_fpcontext() needs to fetch the
state from hardware, modifying the *mcp.

The set_mcontext(9) is called from sigreturn(2) and setcontext(2)
implementations and old create_thread(2) interface, which throw the
*mcp out after the set_mcontext() call.

Reported by:	dim
Discussed with:	jhb
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2015-01-31 21:43:46 +00:00
Andrew Turner
8e35ef81cc Stop using load-multiple with lr and pc. This has been deprecated in ARMv7
and clang 3.6 warns about it. As this is used in libc and we build it with
-Werror this warning becomes an error stopping the build.
2015-01-31 19:55:12 +00:00
Luiz Otavio O Souza
7836352b50 Implement GPIO_GET_BUS() method for all GPIO drivers.
Add helper routines to deal with attach and detach of gpiobus and gpioc
devices that are common to all drivers.
2015-01-31 19:32:14 +00:00
Luiz Otavio O Souza
876c1bd8b0 Clean up and fix the device detach routine and the failure path on GPIO
drivers.

This paves the way for upcoming work.
2015-01-31 12:17:07 +00:00
Rui Paulo
c0a9702f95 ti_pruss: make sure the mmap'ed memory region is uncacheable.
MFC after:	1 week
2015-01-31 02:12:57 +00:00
Luiz Otavio O Souza
c213658943 The BCM2835 GPIO controller uses has interrupt lines and not only one.
Allocate all four, we will use them soon.

Simplificate the allocation of memory and interrupt resources with a single
bus_alloc_resources() call instead of doing them separately.

Destroy the mutex in case of errors.
2015-01-30 18:18:09 +00:00
Luiz Otavio O Souza
99a2011188 Allow the retrieving of the reserved pins state.
With this change, it is now possible to verify the pin function and level
of reserved pins (but not set them).

The use of reserved pins on Raspberry pi can lead to short circuits and
real damage to the SoC.

While here, remove duplicated code, make use of OF_getencprop_alloc()
instead of using fixed sized variables and reduce the dmesg spam by
printing reserved pin ranges (when possible) instead of printing each pin
in the range.
2015-01-30 14:35:04 +00:00
Luiz Otavio O Souza
c67d5d66bf Rename the avila, cambria and zynq GPIO driver names to match the expected
string.

With this change it is not necessary redeclare the driver relations with
gpiobus and gpioc.

This also prevents redundant declarations when gpiobusvar.h is included
(which is going to happen soon).
2015-01-29 18:08:50 +00:00
Oleksandr Tymoshenko
f100177dfb Set LCDC clock frequency to 2*148500 KHz
Minimum LCDC is 2 so clock freq shouild be 2*max_pixel_clock. Maximum pixel
clock for HDMI is 148500 (1920x1080). But AM335x can not run in this mode
due to bandwidth and clock limitations
2015-01-29 01:59:42 +00:00
Ruslan Bukin
6411d14d62 Add ARMv7 performance monitoring counters.
Differential Revision:	https://reviews.freebsd.org/D1687
Reviewed by:	rpaulo
Sponsored by:	DARPA, AFRL
2015-01-28 16:08:07 +00:00
Ruslan Bukin
8aaa1a77ec Add a generic way for hooking PMC interrupt. 2015-01-26 10:31:17 +00:00
Konstantin Belousov
ad87de1c87 Ensure that _tmppt KVA is used exclusively by providing exclusive sx
lock around the mapping and uiomove().  Before r277643, it was
partially protected by Giant (but potential sleeping in fault from
uiomove() would still allow other thread to reuse the mapping).

Noted by:	ian
Reviewed by:	alc, ian
Sponsored by:	The FreeBSD Foundation
MFC after:	3 weeks
2015-01-26 10:11:55 +00:00
Oleksandr Tymoshenko
e505aef3ed - Increase default i2c bus timeout to 5 seconds from 1 second. Sometimes
1 second is not enugh for TDA19988 HDMI framer (e.g. on Beaglebone Black)
- Add per-device i2c_timout sysctl (dev.iichb.X.i2c_timeout) to control
    I2C bus timeout manually
- Pass softc instead of device_t to all sysctl handlers
2015-01-25 23:58:34 +00:00
Oleksandr Tymoshenko
72584f4cba Add vt(4) support to AM335x LCDC driver 2015-01-25 22:08:36 +00:00
Ruslan Bukin
f0583578a1 Add support for audio transmitting, include drivers for:
o Digital Audio Multiplexer (AUDMUX)
o Smart Direct Memory Access Controller (SDMA)
o Synchronous Serial Interface (SSI)

Disable by default as it depends on SDMA firmware.

Sponsored by:	Machdep, Inc.
2015-01-24 13:07:07 +00:00
Konstantin Belousov
8f4548ff25 Remove Giant from /dev/mem and /dev/kmem. It is definitely not needed
for i386, and from the code inspection, nothing in the
arm/mips/sparc64 implementations depends on it.

Discussed with:	imp, nwhitehorn
Sponsored by:	The FreeBSD Foundation
MFC after:	3 weeks
2015-01-24 12:51:15 +00:00
Oleksandr Tymoshenko
5967db8dca After interrupt read value from register to make sure it reached hardware. This
should fix "Spurious inteerupt" message

Suggested by ian@
2015-01-24 01:53:28 +00:00
Ian Lepore
9e8ab8f731 Add pinctrl driver support for the encoded input register config words
that the linux guys made up on the fly (but didn't document) last August.
This type of encoded config now appears in the imx6 fdt data.
2015-01-23 16:05:47 +00:00
Ian Lepore
5087ad0212 Enable all the mmc/sd controllers, because there's no telling which ones
any given board will be using.

Yes, changing source is an unusually primitive power control implementation.
2015-01-23 01:18:08 +00:00
Ian Lepore
8436f7fe62 Declare Maxmem on arm. This should have been part of r277532. 2015-01-22 17:46:05 +00:00
Ian Lepore
f62ae5518e Add the Maxmem global and set it to the highest physical page number plus 1. 2015-01-22 17:42:30 +00:00
Oleksandr Tymoshenko
5408fdf48d Add last_fault_code used in pmap-v6.c if kernel is compiled with "option DEBUG" 2015-01-22 03:33:51 +00:00
Oleksandr Tymoshenko
fbae9a50c4 Write ACK for all kinds of LCDC interrupts 2015-01-22 03:32:04 +00:00
Ian Lepore
b9a1285191 Move the __aligned() declaration to where it will actually do something. 2015-01-21 21:31:26 +00:00
Ian Lepore
ede35faed2 Micro-optimize the new arm inline bus_space implementation by grouping all
the data the inline functions access together at the start of the bus_space
struct.  The start-of part isn't so important, it's the grouping-together
that's the point: now all the most-accessed data should be in one cache line.

Suggested by:	  cognet
2015-01-21 20:12:35 +00:00
Oleksandr Tymoshenko
7d948458b1 Remove "#define DEBUG" that conflicts with "option DEBUG" in kernel config 2015-01-21 19:23:46 +00:00
Ian Lepore
099cce842d Remove a couple files that are no longer used (functionality take over by
arm/bus_space_base.c).
2015-01-21 05:31:54 +00:00
Ian Lepore
e81002d93a Use explicit initializer style, fill in missing functions as unimplemented. 2015-01-21 05:23:09 +00:00
Ian Lepore
ccae8a4b0e Use the base arm bus_space instead of an identical local copy. 2015-01-21 05:10:23 +00:00
Ian Lepore
41adadc9c0 Use the base arm bus_space instead of an identical local copy. 2015-01-21 05:05:07 +00:00
Ian Lepore
c0501ea3fd Use the base arm bus_space instead of an identical local copy. 2015-01-21 04:28:19 +00:00
Ian Lepore
7a4a35ab52 Use the base arm bus_space instead of an identical local copy. 2015-01-21 04:22:20 +00:00
Ian Lepore
f8812377e3 Remove a no-longer-used include. 2015-01-21 04:19:54 +00:00
Ian Lepore
afe43c7b5f The versatile platform had two copies of a bus_space that are essentially
duplicates of the standard arm base bus_space, so just use it.
2015-01-21 04:06:36 +00:00
Ian Lepore
eb8711ce16 Rename bus_space-v6.c to bus_space_base.c, because it's not v6-specific
and now some v5 Marvell systems are using it.  Only define fdt_bus_tag
if option FDT is defined.
2015-01-21 03:44:29 +00:00
Ian Lepore
05ca38474e Use explicit initializer style, fill in missing functions. 2015-01-21 03:28:07 +00:00
Ian Lepore
2737497b83 Move bs_unimplemented() to bus_space_generic.c so it can be shared. 2015-01-21 03:24:18 +00:00
Ian Lepore
a23e40a761 The mv/bus_space.c file is essentially identical to arm/bus_space-v6.c,
so just use it.
2015-01-21 03:22:37 +00:00
Ian Lepore
110e70ba1d 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.
2015-01-21 02:56:13 +00:00
Ian Lepore
36cc12c9da Use arm/bus_space-v6.c for all armv6 systems, the essentially identical
files for lpc and xilinx aren't needed.  Also, fix a couple paste-os.
2015-01-21 02:49:19 +00:00
Ian Lepore
942dfd1f3f Use the explicit member initializer style to init the bus_space struct.
Fill in some formerly NULL members where the implementation function
exists.  Add a dummy function that panics and use it as a placeholder
for thigns that are still unimplemented.  Remove a few unused includes.
2015-01-21 02:35:04 +00:00
Ian Lepore
4098ccafa4 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
2015-01-21 01:06:08 +00:00
Ian Lepore
16e2dc663f Add inline implementations of arm bus_space_read/write_N().
Reviewed by:	cognet
2015-01-20 22:56:59 +00:00
Andrew Turner
79b52c387e Remove the SMP code from locore-v4. These will never use the SMP code as
there is no multi-core hardware prior to ARMv6.

Sponsored by:	The FreeBSD Foundation
2015-01-20 11:32:48 +00:00
Andrew Turner
195237551a Add the User and PL1 read only and reqd write thread ID registers.
Sponsored by:	The FreeBSD Foundation
2015-01-20 11:11:32 +00:00
Ganbold Tsagaankhuu
e2763dca83 Enable Synopsys DesignWare Mobile Storage Host Controller
driver on Rockchip boards. It currently supports PIO mode
and dma mode needs external dma controller to be used.

Submitted by:   jmcneill
Approved by:    stas (mentor)
2015-01-20 09:07:28 +00:00
Oleksandr Tymoshenko
eaf6610dd7 Properly clear IRQ status in order to fix "Spurious IRQ" message from AINT.
This register is not documented in TRM but that's what linux driver does
2015-01-20 02:24:08 +00:00
Ian Lepore
86ee58d992 Save the command-and-flags value into the shadow register when it is written.
This doesn't actually change any behavior, because it just allows a 16-bit
read of the command register to return the correct value, and nothing
actually does a 16-bit read of that register.
2015-01-18 20:47:21 +00:00
Oleksandr Tymoshenko
81d8de5f75 Fix programming timing parameters to LCDC. Actual value used for HBP, HFP, HSW, VSW
is register's programmed value + 1.
2015-01-18 06:43:09 +00:00
Ian Lepore
bba987dc50 Add a new SDHCI quirk, SDHCI_QUIRK_DONT_SET_HISPD_BIT. Apparently some
sdhci controllers, such as the one on a Raspberry Pi, mishandle the signal
timing in high speed signaling mode, but run just fine in standard mode
with the bus running at frequencies between 25-50MHz (which shouldn't work).

This is the solution adopted by U-Boot and other OSes (linux and *BSD)
for the timeouts on Raspberry Pi boards with certain SD cards.  Some
research shows that this quirk is also used on a few other boards, so the
fix is a generic quirk instead of being in the RPi-specific driver code.

This change is based on information discovered by Michal Meloun.
2015-01-17 19:57:03 +00:00