Commit Graph

185 Commits

Author SHA1 Message Date
Oleksandr Tymoshenko
2c0b1f4f61 Multiple fixes in VCHI audio driver:
- Pre-buffer audio data to VideoCore so there are no audible glitches when
    driver is too late to provide samples
- Start actual playback when there is some prebuffered audio,
    it fixes audible noisy click in the beginning of playback
- Use #defines instead of hardcoded values where appropriate
- Fix copy-pasted comment

PR:		208678
2016-04-13 05:28:27 +00:00
Svatopluk Kraus
5b613c19b5 Implement intr_isrc_init_on_cpu() and use it to replace very same
code implemented in every interrupt controller driver running SMP.
This function returns true, if provided ISRC should be enabled on
given cpu.
2016-04-07 15:00:25 +00:00
Svatopluk Kraus
89de2fb6d4 Rework BCM283x gpio interrupt controller for INTRNG. It's used on RPI-B
and RPI2 where INTRNG is already enabled by default.

Differential Revision:	https://reviews.freebsd.org/D5810
2016-04-05 13:45:23 +00:00
Svatopluk Kraus
120b6fc9b2 Implement bcm2836 interrupt controller for INTRNG and enable it
on RPI2 by default.

Differential Revision:	https://reviews.freebsd.org/D5822
2016-04-05 13:41:51 +00:00
Svatopluk Kraus
472f2cca82 Rework bcm283x interrupt controller for INTRNG and enable it
on RPI-B by default.

Reviewed by:	gonzo
Differential Revision:	https://reviews.freebsd.org/D5809
2016-04-05 13:37:03 +00:00
Svatopluk Kraus
fa64321bba Define local-intc for BCM2836 platform (RPI2) and make BCM2835 intc
a child of it. This is done in conformity with Linux dts files and
as preparation for rework of BCM2836 interrupt controller for INTRNG.

Reviewed by:	gonzo
Differential Revision:	https://reviews.freebsd.org/D5807
2016-04-04 09:41:22 +00:00
Ian Lepore
dec4873723 Fix fallout from r292180 (Dec 2015)... ensure that every driver which has
a DRIVER_MODULE() referencing mmc_driver has a MODULE_DEPEND() on mmc.  This
is because the kernel linker only searches for symbols in dependent modules,
so loading sdhci_pci (and other bus-flavors of sdhci) would fail when mmc
was not compiled into the kernel (even if you hand-loaded mmc first).

(Thanks to jilles@ for providing the vital clue about the kernel linker.)
2016-03-21 00:52:24 +00:00
Ian Lepore
fd8e1198f8 Remove FREEBSD_BOOT_LOADER that already exists in std.armv6 config file.
PR:		207728
Submitted by:	Jia-Shiun Li <jiashiun@gmail.com>
2016-03-20 16:48:29 +00:00
Oleksandr Tymoshenko
d28956b489 Fix typo in device description
Spotted by: jmcneill
2016-02-28 19:39:00 +00:00
Andrew Turner
8d88b09320 Build ofw_cpu.c on all ARM configs using FDT. As we mve towards using the
Linux dts files these are more likely to have cpu nodes we can attach to.

Sponsored by:	ABT Systems Ltd
2016-02-28 09:35:37 +00:00
Andrew Turner
7133fe0f33 Almost all copies of platform_mp_init_secondary just called
intr_pic_init_secondary. Replace them with a direct call. On BCM2836
and ARMADA XP we need to add this function, but it can be empty.

Reviewed by:	ian, imp
Sponsored by:	ABT Systems Ltd
Differential Revision:	https://reviews.freebsd.org/D5460
2016-02-26 16:04:47 +00:00
Andrew Turner
3210b87554 Remove platform_mp_probe as it's almost identical on most ARM SoCs, and
slightly wrong on the others. We should just check if mp_ncpus is set to
more than one CPU as we may wish to run on a single core even when SMP is
available.

Reviewed by:	ian
Sponsored by:	ABT Systems Ltd
Differential Revision:	https://reviews.freebsd.org/D5458
2016-02-26 15:54:34 +00:00
Andrew Turner
243b36c321 Remove platform_ipi_send, it's an unneeded as all implementations are
identical.

Sponsored by:	 ABT Systems Ltd
2016-02-25 20:48:23 +00:00
Svatopluk Kraus
7758916f44 Move ARM_L2_PIPT option to std.armv6 for all armv6 platforms.
Only L2 PIPT cache is supported for __ARM_ARCH >= 6.

In fact, this is just a pure proclamation as this option is used
only in armv4 specific files now.
2016-02-22 11:47:28 +00:00
Svatopluk Kraus
ec950d0aef Do not use DMA channels used by GPU.
(1) The channel mask is get from "brcm,dma-channel-mask" property of
    dma node, and if not provided, from "broadcom,channels" property.
(2) Consequently, sdhci driver does not allocate any specific channel.
(3) Use CS_RESET bit for initial channel reset.

Differential Revision:    https://reviews.freebsd.org/D4303
2016-02-16 12:19:06 +00:00
Andrew Turner
647a3bac7e Stop defining fdt_pic_table when building for ARM_INTRNG. 2016-02-11 11:49:27 +00:00
Michal Meloun
a89156f53f ARM: Use new ARMv6 naming conventions for cache and TLB functions
in all but ARMv4 specific files.
Expand ARMv6 compatibility stubs in cpu-v4.h. Use physical address
in L2 cache functions if ARM_L2_PIPT is defined.
2016-02-05 14:57:41 +00:00
Oleksandr Tymoshenko
25a2de5e7e Add dev.fb.X.resync sysctl to resync ARM framebuffer with VideoCore
Some applications (e.g. Kodi) use tvservice APIs to manage HDMI
modes, power state, EDID etc. directly through VideoCore. After
these manipulations VideoCore may loose its state and needs to be
resynced with ARM. Under Linux this problem is worked around using
fbset utility that recreates framebuffer. Since there is no fbset
utility in FreeBSD we provide sysctl for userland apps to get system
back into normal mode.
2015-12-20 00:58:22 +00:00
Ian Lepore
3f62727443 Move the DRIVER_MODULE() statements that declare mmc(4) to be a child of
the various bridge drivers out of dev/mmc.c and into the bridge drivers.

Requested by:	   jhb (almost two years ago; better late than never)
2015-12-14 01:09:25 +00:00
Andrew Turner
ed18006cbf Create device options for the two common ARM timers.
Sponsored by:	ABT Systems Ltd
2015-11-21 16:23:56 +00:00
Andrew Turner
210d6af74d Move more bus_space_* files to be built by files.arm. This leaves the
definition in a file.* file under sys/arm/arm in the few cases we need it
for non-fdt platforms.

Sponsored by:	ABT Systems Ltd
2015-11-21 15:30:08 +00:00
Andrew Turner
805471578e Remove bus_space_asm_generic.S from the per-SoC files.* files, it's already
in files.arm.

Sponsored by:	ABT Systems Ltd
2015-11-20 19:48:32 +00:00
Andrew Turner
aeef645f92 Stop setting {KERN,}PHYSADDR on armv6, it's unneeded.
Sponsored by:	ABT Systems Ltd
2015-11-20 16:12:22 +00:00
Oleksandr Tymoshenko
cd3903c620 Refactor bcm2835_cpufreq to use bcm2835_mbox_property API 2015-11-11 00:45:41 +00:00
Oleksandr Tymoshenko
e597fdb889 - Set have_message in interrupt to handle "response before READ" case
- Serialize access to property channel when using bcm2835_mbox_property
2015-11-11 00:41:02 +00:00
Oleksandr Tymoshenko
ebb62474ab Fix some of WITNESS complaints and bootup lock by removing msg_avail
condvar/mutex. They're basically no-op because error is not propagated
up the call chain. We still report message failures in VC service callback
2015-11-08 04:15:52 +00:00
Oleksandr Tymoshenko
b805a8c3eb - Replace semaphore-base locking with sleep/wait synchronization:
sema_trywait/sema_timedwait can't be used while holding
    non-sleepable mutex

- Fix infinite loop if response from VideoCore never received
2015-11-08 03:34:19 +00:00
Svatopluk Kraus
3084b64cd9 Make interrupt dispatching MP safe. Use GPU interrupt bit in per-core
interrupt status register to process shared interrupts only if the bit
is active and only on core to which they are routed.

Reviewed by:	imp, loos
Approved by:	kib (mentor)
Differential Revision:	https://reviews.freebsd.org/D3723
2015-11-06 17:12:33 +00:00
Oleksandr Tymoshenko
f4f73431bc Add /dev/vcio, userland access point to VideoCore mailbox property channel
It's required by some applications in raspberrypi-userland package
2015-11-05 04:16:03 +00:00
Oleksandr Tymoshenko
8826550b5a Refactor mailbox property API to make it usable for /dev/vcio driver:
- Add bcm2835_mbox_property for generic property request, it accepts
    pointer to prepared property chan message and its size, forwards
    it to MBOX and copies result back
- Make all bcm2835_mbox_XXX functions that use property channel go
    through bcm2835_mbox_property path. Do not accept device_t as
    an argument, it's not required: all DMA operatiosn should go
    through mbox device, and all API consumers should report errors
    on their side.
2015-11-05 03:46:54 +00:00
Oleksandr Tymoshenko
85645c5669 Add mailbox tag/structure for touchscreen buffer address property 2015-11-01 23:50:07 +00:00
Oleksandr Tymoshenko
5ab55ce398 Fix framebuffer compatibility with new RPi firmware. Framebuffer driver
receives video memory address from VideoCore through property mailbox
channel. Older versions of firmware (and the one that is currently part
of sysutils/u-boot-rpi and sysutils/u-boot-rpi2) returned real physical
address, newer one returns VideoCore bus address, so we need to convert
it to actual physical address. this version works with both older and
newer interface.
2015-10-30 00:24:37 +00:00
Andrew Turner
17fb49c1e4 An IPI must be cleared before it is handled otherwise next IPI could be
missed. In other words, if a new request for an IPI is sent while the
previous request is being handled but the IPI is not cleared yet, the
clearing of the previous IPI request also clears the new one and the
handling is missed.

There are only three MP interrupt controllers in ARM now. Two of them are
fixed by this change, the third one is correct, probably only just by
accident. The fix is minimalistic as new interrupt framework is awaited.

It was debugged on RPi2 where missing IPI handling together with SCHED_ULE
led to situation in which tdq_ipipending was not cleared and so IPI_PREEMPT
was stopped to be sent. Various odditys were found related to slow system
response time like various events timed out, and slow console response.

Submitted by:	Svatopluk Kraus <onwahe@gmail.com>
Reviewed by:	loos, kib
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D3722
2015-10-01 12:09:05 +00:00
Ian Lepore
46d49ed78e Use simple fixed name strings for these timecounters and eventimers which
are tied to fixed pieces of hardware; dynamic string formatting isn't needed.
2015-08-14 16:48:07 +00:00
Ian Lepore
148ddb8a6f Add a missing wakeup when releasing ownership of the SPI hardware.
Also, validate the chipselect parameter before grabbing ownership of the
hardware, and report timeout errors after releasing it.

PR:		200584
2015-06-02 16:07:28 +00:00
Luiz Otavio O Souza
3c57e1df81 Remove unused mutex and softc variables. 2015-05-26 01:30:09 +00:00
Luiz Otavio O Souza
98d1292d0a Fix the SMP initialization on RPi 2 (BCM2836).
Invalidate the CPU cache before start the others CPUs.

Submitted by:	Michal Meloun <meloun@miracle.cz>
2015-05-13 01:48:47 +00:00
Luiz Otavio O Souza
962940ce6c Add the SMP support for Raspberry Pi 2 (BCM2836).
Tested with the build of some ports and a buildworld.

Submitted by:	Daisuke Aoyama <aoyama@peach.ne.jp>
2015-05-07 22:11:44 +00:00
Luiz Otavio O Souza
382ac7c838 Enable DMA for sdhci on RPi 2 (BCM2836). 2015-05-05 00:27:55 +00:00
Luiz Otavio O Souza
2ae580711a Fix DMA on RPi 2.
BCM2836 has a different base address for peripherals.

Obtained from:	netbsd
2015-05-05 00:19:04 +00:00
Luiz Otavio O Souza
11cede4873 Fix the voltage and clock levels for cpufreq on RPi 2.
Submitted by:	Daisuke Aoyama <aoyama@peach.ne.jp>
2015-05-04 00:01:35 +00:00
Luiz Otavio O Souza
61dfa98164 Fix the vt(4) framebuffer driver on RPi 2.
Use the BCM2835_MBOX_CHAN_PROP mbox channel to setup the framebuffer,
remove DMA code (its now done in bcm2835_mbox.c).

Also adjust the color palette when bcm2708_fb.fbswap is set.  The
firmware used on RPi 2 uses this mode.

Tested on:	RPi-B and RPi 2 with 16, 24 and 32bpp
Note:		The 32bpp mode on RPi-B has the red and blue swapped, this
		is a know problem (not a driver problem).
2015-05-02 22:48:56 +00:00
Luiz Otavio O Souza
aafead11b2 Fix the sc(4) framebuffer driver on RPi 2.
Use the BCM2835_MBOX_CHAN_PROP mbox channel to setup the framebuffer,
remove unused code and unnecessary includes.

Adjust the color palette when bcm2708_fb.fbswap is set on /chosen/bootargs
node of DTB.  The firmware used on RPi 2 uses this mode.

Tested on:	RPi-B and RPi 2 with 16, 24 and 32bpp
2015-05-02 22:40:41 +00:00
Luiz Otavio O Souza
ae29e2d8a4 Add the routines to query and setup the framebuffer state using the
BCM2835_MBOX_CHAN_PROP channel.  The old channel (BCM2835_MBOX_CHAN_FB)
seems deprecated on recent firmware versions and is causing a freeze on
RPi 2.

The actual changes in the framebuffer drivers will follow in subsequent
commits.
2015-05-02 22:24:33 +00:00
Luiz Otavio O Souza
723af368a1 Pass the supplied buffer length instead of a fixed size. 2015-04-27 01:36:16 +00:00
Luiz Otavio O Souza
d24e6f4add Set ARM_L2_PIPT for A10 and RPI2, they are probably missing by accident.
Noted by:	Michal Meloun <meloun@miracle.cz>
2015-04-25 22:42:03 +00:00
Luiz Otavio O Souza
b7fbc36963 Fetch the SDHCI frequency from videocore (our prefered source) and only if
it fails, fetch the clock-frequency from DTB.

If both methods fail, use the hardcoded default.
2015-04-22 18:35:02 +00:00
Andrew Turner
087af50ab8 Include vm/pmap.h for pmap_kextract. 2015-04-04 23:03:11 +00:00
Andrew Turner
ff3b52bb19 Stop using machine/fdt.h in the arm kernel code when we don't need it. 2015-04-04 21:34:26 +00:00
Andrew Turner
0ebebb1260 Build the cpufunc_asm_* files based on the cpu type, not which config file
we happen to be building.
2015-03-29 22:43:39 +00:00