Commit Graph

4363 Commits

Author SHA1 Message Date
Michal Meloun
693f8b3673 Restore original (pre r315760) naming for Tegra SDHCI device.
Newbus handles multiple equally named device classes without problems,
so there is no reason to use slightly cryptic "<foo>_shdci" for them.
In contrast, the driver module name must be unique, so "<foo>_shdci"
is the right name for it.
2017-03-23 08:16:53 +00:00
Michal Meloun
12561ddddc Revert r315800, it was committed with invalid (unsaved) commit log. 2017-03-23 08:15:11 +00:00
Michal Meloun
67a50f6e6d Release all previously allocated resources. 2017-03-23 05:54:03 +00:00
Marius Strobl
906eb24c6d Correct the dependency of mmc(4) on sdhci_tegra(4) after r314887. 2017-03-23 00:41:33 +00:00
Konstantin Belousov
2274ab3d7b Update r315753 with the proper flag name.
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2017-03-22 22:28:13 +00:00
Konstantin Belousov
1438fe3cf2 Add a flag BI_BRAND_ONLY_STATIC to specify that the brand only
matches static binaries.

Interpretation of the 'static' there is that the binary must not
specify an interpreter.  In particular, shared objects are matched by
the brand if BI_CAN_EXEC_DYN is also set.

This improves precision of the brand matching, which should eliminate
surprises due to brand ordering.

Revert r315701.

Discussed with and tested by:	ed (previous version)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2017-03-22 22:23:01 +00:00
Andrew Turner
e336138c40 Add the early hypervisor code needed on 32-bit ARMv7. This will be used
when we bring in bhyve support.

Submitted by:	Mihai Carabas <mihai.carabas AT gmail.com>
Differential Revision:	https://reviews.freebsd.org/D10045
2017-03-22 14:30:02 +00:00
Ed Schouten
ae2373da91 Set the interpreter path to /nonexistent.
CloudABI executables are statically linked and don't have an
interpreter. Setting the interpreter path to NULL used to work
previously, but r314851 introduced code that checks the string
unconditionally. Running CloudABI executables now causes a null pointer
dereference.

Looking at the rest of imgact_elf.c, it seems various other codepaths
already leaned on the fact that the interpreter path is set. Let's just
go ahead and pick an obviously incorrect interpreter path to appease
imgact_elf.c.

MFC after:	1 week
2017-03-22 07:05:27 +00:00
Andrew Turner
b4fca5d4a7 Use tc_priv to find the softc in the i.MX timer driver.
Sponsored by:	ABT Systems Ltd
2017-03-20 19:25:42 +00:00
Ian Lepore
928e4f221d Replace the hard-coded way-too-small minimum event timer period with a value
calculated at runtime based on how long it takes to set up an event in
hardware.  This fixes the intermittant 1-minute hang at boot on imx5
systems, and also the occasional oversleeping while running.  It doesn't
affect imx6 systems, which use different hardware for eventtimers.

It turns out that it usually takes about 30 timer ticks to set up the timer
compare register, and the old hard-coded minimum period was 10 ticks.  On
the rare occasions when a timeout event that short was set up, we'd miss
the event and have to wait about 64 seconds for counter rollover before
the compare interrupt would fire.

Instead of just hardcoding a new bigger value, the code now measures the
time it takes to do the register read/write sequence to set up the compare
register, scales it up by 1.5x to be safe, and calculates the minimum event
period from the result.  In the real world, the minimum period works out to
about 750 nanoseconds on imx5 hardware.
2017-03-19 21:53:12 +00:00
Ian Lepore
5e52290fda Eliminate unnecessary read/modify/write sequences during eventtimer setup.
It turns out to be surprisingly expensive to access the gpt hardware (on the
order of 150ns per read/write).  To cut down on the overhead of setting up
each eventtimer event, eliminate read-modify-write sequences to manage the
compare interrupt enable, by keeping a shadow copy of the hardware register
and only writing to the hardware when the enable bits really change.
2017-03-19 21:28:37 +00:00
Ian Lepore
d32c1ca43c Add INTRNG option to EFIKA_MX config, it is an imx5-based platform. 2017-03-19 18:38:08 +00:00
Ian Lepore
d32f00077b Remove kernel config for DIGI-CCWMX53 devel board. It was just standard
IMX53 with static dtb added, and now that imx53 can use vendor-supplied dts
files and ubldr, there is no need for a static-dtb variant.
2017-03-19 18:35:20 +00:00
Ian Lepore
cde8ef4d96 Convert the imx5 interrupt controller driver to INTRNG. 2017-03-19 18:30:38 +00:00
Ian Lepore
e04a4275b2 Add dtb/imx5 module build to the imx53 kernel config. 2017-03-19 18:28:38 +00:00
Ian Lepore
76fedc062f Remove kernel config for IMX53-QSB (quickstart board). It was just
standard IMX53 with static dtb added, and now that imx53 can use vendor-
supplied dts files and ubldr, there is no need for a static-dtb variant.
2017-03-19 18:26:52 +00:00
Ian Lepore
3d9df27601 Remove unreferenced global function imx_gpt_get_timerfreq() and do some
cleanups enabled by that:

 - The only thing left in imx_gptvar.h was the softc, which IMO never
   should have been in there at all.  Move it into the driver, and
   delete the header file.

 - Remove several unneeded #includes from the driver.

 - Change imx_gpt_softc from global to static (it's used by DELAY()), and
   don't redundantly static-initialize it to NULL.
2017-03-19 04:03:39 +00:00
Ian Lepore
6c23d3cf76 Remove hardcoded bootverbose=1; imx53 systems boot using loader(8) and
users can set verbose if they want to.
2017-03-18 19:54:58 +00:00
Ian Lepore
26c048c814 Make the imx5 clocks driver work with vendor-supplied dts (which does not
supply the addresses for the DPLL register blocks) by hard-coding the
addresses in the driver source code.  Yes, this is just as bad an idea as
it sounds, but we have no choice.

In the early days of using fdt data, when we were making up our own data
for each board, we defined 4 sets of memory mapped registers in the data.
The vendor-supplied data only provides the address of the CCM register
block, but not the 3 DPLL blocks.  The linux driver has the DPLL physical
addresses (which differ by SOC type) hard-coded in the driver, and we
have no choice but to do the same thing if we want to run with the vendor-
supplied fdt data.

So now we use bus_space_map() to make the DPLL blocks accessible, choosing
the set of fixed addresses to map based on the soc id.
2017-03-18 17:50:49 +00:00
Andrew Turner
1eff4c0c37 Remove code for Marvell SoCs that lack a kernel config.
It seems to be old code from the armv6 project branch that never had a
kernel config.

Reviewed by:	mmel
Sponsored by:	ABT Systems Lrd
Differential Revision:	https://reviews.freebsd.org/D7166
2017-03-17 12:59:16 +00:00
Andrew Turner
83d9fd40d5 Make the default FDT implementation of platform_mp_setmaxid use the cpu
nodes from the DTB by default. This will allow us to enumerate the CPUs
without hard coding the CPU count into code.

Reviewed by:	br
Sponsored by:	ABT Systems Ltd
Differential Revision:	https://reviews.freebsd.org/D9827
2017-03-17 12:45:53 +00:00
Andrew Turner
0960989f8f Move the IMX6 kernels to use PLATFORM_SMP. This is the last SMP config to
be migrated to this and will allow the removal of this option.

Reviewed by:	ian
Sponsored by:	ABT Systems Ltd
Differential Revision:	https://reviews.freebsd.org/D9907
2017-03-17 12:34:56 +00:00
Marius Strobl
72dec0792a - Add support for eMMC "partitions". Besides the user data area, i. e.
the default partition, eMMC v4.41 and later devices can additionally
  provide up to:
  1 enhanced user data area partition
  2 boot partitions
  1 RPMB (Replay Protected Memory Block) partition
  4 general purpose partitions (optionally with a enhanced or extended
    attribute)

  Of these "partitions", only the enhanced user data area one actually
  slices the user data area partition and, thus, gets handled with the
  help of geom_flashmap(4). The other types of partitions have address
  space independent from the default partition and need to be switched
  to via CMD6 (SWITCH), i. e. constitute a set of additional "disks".

  The second kind of these "partitions" doesn't fit that well into the
  design of mmc(4) and mmcsd(4). I've decided to let mmcsd(4) hook all
  of these "partitions" up as disk(9)'s (except for the RPMB partition
  as it didn't seem to make much sense to be able to put a file-system
  there and may require authentication; therefore, RPMB partitions are
  solely accessible via the newly added IOCTL interface currently; see
  also below). This approach for one resulted in cleaner code. Second,
  it retains the notion of mmcsd(4) children corresponding to a single
  physical device each. With the addition of some layering violations,
  it also would have been possible for mmc(4) to add separate mmcsd(4)
  instances with one disk each for all of these "partitions", however.
  Still, both mmc(4) and mmcsd(4) share some common code now e. g. for
  issuing CMD6, which has been factored out into mmc_subr.c.

  Besides simply subdividing eMMC devices, some Intel NUCs having UEFI
  code in the boot partitions etc., another use case for the partition
  support is the activation of pseudo-SLC mode, which manufacturers of
  eMMC chips typically associate with the enhanced user data area and/
  or the enhanced attribute of general purpose partitions.

  CAVEAT EMPTOR: Partitioning eMMC devices is a one-time operation.

- Now that properly issuing CMD6 is crucial (so data isn't written to
  the wrong partition for example), make a step into the direction of
  correctly handling the timeout for these commands in the MMC layer.
  Also, do a SEND_STATUS when CMD6 is invoked with an R1B response as
  recommended by relevant specifications. However, quite some work is
  left to be done in this regard; all other R1B-type commands done by
  the MMC layer also should be followed by a SEND_STATUS (CMD13), the
  erase timeout calculations/handling as documented in specifications
  are entirely ignored so far, the MMC layer doesn't provide timeouts
  applicable up to the bridge drivers and at least sdhci(4) currently
  is hardcoding 1 s as timeout for all command types unconditionally.
  Let alone already available return codes often not being checked in
  the MMC layer ...

- Add an IOCTL interface to mmcsd(4); this is sufficiently compatible
  with Linux so that the GNU mmc-utils can be ported to and used with
  FreeBSD (note that due to the remaining deficiencies outlined above
  SANITIZE operations issued by/with `mmc` currently most likely will
  fail). These latter will be added to ports as sysutils/mmc-utils in
  a bit. Among others, the `mmc` tool of the GNU mmc-utils allows for
  partitioning eMMC devices (tested working).

- For devices following the eMMC specification v4.41 or later, year 0
  is 2013 rather than 1997; so correct this for assembling the device
  ID string properly.

- Let mmcsd.ko depend on mmc.ko. Additionally, bump MMC_VERSION as at
  least for some of the above a matching pair is required.

- In the ACPI front-end of sdhci(4) describe the Intel eMMC and SDXC
  controllers as such in order to match the PCI one.
  Additionally, in the entry for the 80860F14 SDXC controller remove
  the eMMC-only SDHCI_QUIRK_INTEL_POWER_UP_RESET.

OKed by:	imp
Submitted by:	ian (mmc_switch_status() implementation)
2017-03-16 22:23:04 +00:00
Fabien Thomas
d42aefee43 Fix arm stack frame walking support:
- Adjust stack offset for Clang
- Correctly fill registers for fake stack frame (soft PMC)

MFC after:	1 week
Sponsored by:	Stormshield
Differential Revision:	https://reviews.freebsd.org/D7396
2017-03-14 16:06:57 +00:00
Michal Meloun
ffeeb2ab3f Split overbloated machep.c to multiple files and do basic cleanup
of these fragments.
2017-03-11 07:07:41 +00:00
Marius Strobl
55dae242e6 Add and use a MMC_DECLARE_BRIDGE macro for declaring mmc(4) bridges
as kernel drivers and their dependency onto mmc(4); this allows for
incrementing the mmc(4) module version but also for entire omission
of these bridge declarations for mmccam(4) in a single place, i. e.
in dev/mmc/bridge.h.
2017-03-07 22:42:44 +00:00
Marius Strobl
b440e965da o Another round fixes for mmc(4), mmcsd(4) and sdhci(4) regarding
comments, marking unused parameters as such, style(9), whitespace,
  etc.
o In the mmc(4) bridges and sdhci(4) (bus) front-ends:
  - Remove redundant assignments of the default bus_generic_print_child
    device method (I've whipped these out of the tree as part of r227843
    once, but they keep coming back ...),
  - use DEVMETHOD_END,
  - use NULL instead of 0 for pointers.
o Trim/adjust includes.
2017-03-06 23:47:59 +00:00
Michal Meloun
d457839bc8 Add support for card detect and write protect gpio pins to Tegra SDHCI. 2017-03-05 15:34:32 +00:00
Oleksandr Tymoshenko
f1f425aea0 [rpi] rpi3 should use the same cpufreq logic as rpi2, not rpi-b
RPi3 cpufreq is more like that on RPi2. Setting arm frequency
above min (say, "sysctl hw.cpufreq.arm_freq=600000001") turns on
turbo mode, and the firmware automatically raises voltage, sets
frequency to max 1200MHz, and throttle when overheat, etc.

Swap if/else parts and use SOC_BCM2835 def so RPi3 can share the
same cpufreq logic as RPi2, instead of falling to that for RPi.

Submitted by:	Jia-Shiun Li <jiashiun@gmail.com>
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D9640
2017-03-04 17:34:36 +00:00
Ruslan Bukin
6fd86cf752 Add FPGA manager driver for Intel Arria 10.
With this driver we able to program FPGA core from FreeBSD system
running on ARM core.

Sponsored by:	DARPA, AFRL
2017-03-03 14:19:37 +00:00
Warner Losh
43b96a4eb5 Revert prior commit to restore the files mangled by my "fixing" merge
conflicts for a git rebase I tried to do.
2017-03-01 02:10:40 +00:00
Warner Losh
fbbd9655e5 Renumber copyright clause 4
Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.

Submitted by:	Jan Schaumann <jschauma@stevens.edu>
Pull Request:	https://github.com/freebsd/freebsd/pull/96
2017-02-28 23:42:47 +00:00
Ruslan Bukin
6414b02d0c Add SOC_ALTERA_* kernel options per each SoC and use it to
conditionally compile the code.

Reviewed by:	andrew
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D9836
2017-02-28 16:20:33 +00:00
Emmanuel Vadot
fd8516cc05 allwinner: A31: Add ccung driver
This adds clocks support for the aw_ccung on the A31 SoC.
Newer DTS files require this.
All the clocks except two CSI are defined and exported on the clock domain.
2017-02-28 15:44:21 +00:00
Emmanuel Vadot
b78b8251c9 allwinner: nkmp: Add MUX capability
Some NKMP clocks have a mux options.
Add the capability to aw_clk_nkmp.
2017-02-28 15:11:33 +00:00
Ruslan Bukin
428157830b Add support for Intel Arria 10 SoC Development Kit.
Use standard DTS files for SOCKIT and SOCDK.

Sponsored by:	DARPA, AFRL
2017-02-28 14:02:16 +00:00
Emmanuel Vadot
511d4e58f3 allwinner: NKMP clock: add update bit
The PLL_DDR clock have an update bit which need to be set after changing
the value, add the possibility to define one for NKMP clocks.

This allow us to add the missing clocks.
We now have the full list of clocks created under the clock domain.
2017-02-28 11:38:11 +00:00
Emmanuel Vadot
7a5603c04a allwinner: NM clock: Add value for fixed factor.
The register func for aw_clk_nm didn't copy the value needed for the fixed
factor, resulting in all fixed factor not working on NM clocks.
2017-02-28 11:05:45 +00:00
Ruslan Bukin
c214a270f5 Allow setting access-width for UART registers.
This is required for FDT's standard "reg-io-width" property
(similar to "reg-shift" property) found in many DTS files.

This fixes operation on Altera Arria 10 SOC Development Kit,
where standard ns8250 uart allows 4-byte access only.

Reviewed by:	kan, marcel
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D9785
2017-02-27 20:08:42 +00:00
Emmanuel Vadot
25d9f6e859 allwinner: Correct some clocks name for H3 CCU. 2017-02-27 17:12:17 +00:00
Emmanuel Vadot
a5ae21c50d allwinner: Order clocks by offset rather than by type for H3 ccu.
Also add a few more supported gates and add comments for which clocks
are missing.
2017-02-27 11:10:36 +00:00
Emmanuel Vadot
d7e3f295fa allwinner: Add support for lock and fractional mode on NM clock
Some PLL have a fractional mode and a lock bit.
Add support for it on the NM clock and export the clocks in the clkdom.
2017-02-27 08:58:27 +00:00
Emmanuel Vadot
f5d1d20574 Add clkng driver for Allwinner SoC
Since Linux 4.9-4.10 DTS doesn't have clocks under /clocks but only a ccu node.
Currently only H3 is supported with almost the same state as HEAD.
(video pll aren't supported for now but we don't support video).
This driver and clocks will also be used for other SoC (A64, A31, H5, H2 etc ...)

Reviewed by:	jmcneill
Differential Revision:	https://reviews.freebsd.org/D9517
2017-02-26 16:00:20 +00:00
Warner Losh
28586889c2 Convert PCIe Hot Plug to using pci_request_feature
Convert PCIe hot plug support over to asking the firmware, if any, for
permission to use the HotPlug hardware. Implement pci_request_feature
for ACPI. All other host pci connections to allowing all valid feature
requests.

Sponsored by: Netflix
2017-02-25 06:11:59 +00:00
Pedro F. Giffuni
ee7030f303 at91: double assignment.
Found with:	coccinelle (da.cocci)
Suggested by:	cognet
2017-02-23 23:48:44 +00:00
Ian Lepore
c5727c468f Revert to this driver's historic behavior: assume an sd card is writable
if the fdt data doesn't provide a gpio pin for reading the write protect
switch and also doesn't contain a "wp-disable" property.

In r311735 the long-bitrotted code in this driver for using the non-
standard fdt "mmchs-wp-gpio-pin" property was replaced with new common
support code for handling write-protect and card-detect gpio pins.  The
old code never found a property with that name, and the logic was to
assume that no gpio pin meant that the card was not write protected.

The new common code behaves differently.  If there is no fdt data saying
what to do about sensing write protect, the value in the standard SDHCI
PRESENT_STATE register is used.  On this hardware, if there is no signal
for write protect muxed into the sd controller then that bit in the
register indicates write protect.

The real problem here is the fdt data, which should contain "wp-disable"
properties for eMMC and micro-sd slots where write protect is not even
an option in the hardware, but we are not in control of that data, it
comes from linux.  So we have to make the same flawed assumption in our
driver that the corresponding linux driver has: no info means no protect.

Reported by:	several users on the arm@ list
Pointy hat:	me, for not testing enough before committing r311735
2017-02-22 03:49:46 +00:00
Ian Lepore
9063812353 Remove a variable that has been unused since r311735 (it should have been
removed as part of those changes).
2017-02-22 01:07:04 +00:00
Konstantin Belousov
901b55218f MFamd64 r313933: microoptimize pmap_protect_pte1().
Noted by:	alc
Tested by:	mmel
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2017-02-19 20:40:07 +00:00
Ian Lepore
5002d69f9b Change the naming of imx{5,6} gpio pins to exactly match the names used in
the chip reference manuals: GPIOn_IOnn.
2017-02-18 18:24:03 +00:00
Olivier Houchard
c7529864f6 Remove debugging code that was probably unused since before the arm code
was initially committed.

Reported by:	Alexandre Martins <alexandre.martins@stormshield.eu>
2017-02-13 20:51:08 +00:00
Ian Lepore
8148f4f3d5 Enable usb low and full speed devices connected to the imx6 root hubs.
This enables the PHY circuitry for UTMI+ level 2 and 3, and sets the
flag to tell the ehci code that the root hub has a transaction translator
in it.  For imx6 we can use the standard ehci_get_port_speed_portsc()
function to find out what speed device is connected to the port.
2017-02-12 00:52:22 +00:00
Ian Lepore
9fc7a59f2a Stop including sys/types.h from arm's machine/atomic.h, fix the places
where atomic.h was being included without ensuring that types.h (via
param.h) was included first, as required by atomic(9).
2017-02-11 01:07:46 +00:00
Emmanuel Vadot
58256cf76e Rename timer.c to a10_timer.c
Requested by: andrew
2017-02-07 19:28:32 +00:00
Andrew Turner
5267f6243d Add support for PLATFORM and PLATFORM_SMP to the Altera SOCFPGA SoC. This
will help with moving it to GENERIC.

Reviewed by:	br
Sponsored by:	ABT Systems Ltd
Differential Revision:	https://reviews.freebsd.org/D9461
2017-02-07 12:04:04 +00:00
Konstantin Belousov
3b7a388b3e Update arm and arm64 counters MD bits.
On arm64 use atomics.  Then, both arm and arm64 do not need a critical
section around update.  Replace all cpus loop by CPU_FOREACH().
This brings arm and arm64 counter(9) implementation closer to current
amd64, but being more RISC-y, arm* version cannot avoid atomics.

Reported by:	Alexandre Martins <alexandre.martins@stormshield.eu>
Reviewed by:	andrew
Tested by:	Alexandre Martins, andrew
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2017-02-06 17:20:37 +00:00
Stanislav Galabov
59cd18b093 sys/arm/arm/identcpu-v4.c: fix identify_arm_cpu()
identify_arm_cpu() in sys/arm/arm/identcpu-v4.c incorrectly uses a
u_int8_t variable to store the result of cpu_get_control().
It should really use a u_int variable, the same way as done for cpu_ident()
in the same function, as both cpuid and control registers are 32-bit..
This issue causes users of identcpu-v4 to incorrectly report things such as
icache status (bit 12 in cpu control register) and basically anything
defined in bits above bit 7 :-)

Reviewed by:	manu
Sponsored by:	Smartcom - Bulgaria AD
Differential Revision:	https://reviews.freebsd.org/D9460
2017-02-06 14:58:24 +00:00
Konstantin Belousov
9fb10d635e Define the vm_ooffset_t and vm_pindex_t types as machine-independend.
The types are for the byte offset and page index in vm object.  They
are similar to off_t, which is defined as 64bit MI integer.  Using MI
definitions will allow to provide consistent MD values of vm
object-related maximum sizes.

Reviewed by:	alc
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2017-02-04 12:26:38 +00:00
Andrew Turner
c1a2c9314f Remove an old use of _ARM_ARCH_6, we are moving to using the standard
__ARM_ARCH >= 6 spelling.

Sponsored by:	ABT Systems Ltd
2017-02-03 11:47:57 +00:00
Andrew Turner
aa7dd0fb0e Only define atomic_fcmpset_long in the kernel. We may include
machine/atomic.h in userspace, however atomic_fcmpset_32 is unimplemented
there.

Sponsored by:	ABT Systems Ltd
2017-02-03 10:04:17 +00:00
Michal Meloun
93a065e749 Remake support for SMP kernel on UP cpu:
- Use new option SMP_ON_UP instead of (mis)using specific CPU type.
   By this, any SMP kernel can be compiled with SMP_ON_UP support.
 - Enable runtime detection of CPU multiprocessor extensions only
   if SMP_ON_UP option is used. In other cases (pure SMP or UP),
   statically compile only required variant.
 - Don't leak multiprocessor instructions to UP kernel.
 - Correctly handle data cache write back to point of unification.
   DCCMVAU is supported on all armv7 cpus.
 - For SMP_ON_UP kernels, detect proper TTB flags on runtime.

Differential Revision: https://reviews.freebsd.org/D9133
2017-02-02 06:14:44 +00:00
Oleksandr Tymoshenko
878097c10e [am335x] Fallback to standard video interface bindings when using Linux dts
Historically AM335x LCDC driver used non-standard "hdmi" property to
refer to HDMI framer. There is no such thing in upstream DTS, so to
handle both cases fallback to bindings described in
bindings/media/video-interfaces.txt in Linux documentation.

We still make some assumptions that are not universally true: we
assume that if remote endpoint is available it's going to be HDMI
framer. Which is true for AM335x-based devices currently supported
but may be not true for some custom hardware.

MFC after:	1 week
2017-02-01 22:03:59 +00:00
Olivier Houchard
4943dc2d2c Correct the IT instruction in atomic_fcmpset_64().
Reported by:	andrew
2017-01-29 13:31:56 +00:00
Olivier Houchard
8406f869f4 Remove useless labels. 2017-01-28 17:48:33 +00:00
Olivier Houchard
14dd14fc00 Use strexeq instead of needlessly branch.
Suggested by:	ian
2017-01-28 17:46:04 +00:00
Olivier Houchard
dc5f9fcdae Implement atomic_fcmpset_* for arm and arm64. 2017-01-28 16:24:06 +00:00
Ian Lepore
28b3a4a659 Configure the timer capture pin to input mode in the timer control
register, in addition to configuring it as input with the pinmux driver.

There was a control register bit commented as "no desc in datasheet".  A
later revision of the manual reveals the bit to be an input/output control
for the timer pin.  In addition to configuring capture or pulse mode, you
apparently have to separately configure the pin direction in the timer
control register.

Before this change, the timer block was apparently driving a signal onto a
pad configured by pinmux as input.  Capture mode still accidentally worked
for me during testing because I was using a very strong signal source that
just out-muscled the weaker drive from the misconfigured pin.
2017-01-27 04:08:24 +00:00
Andrew Turner
d177f4b8f1 Make fdt_pm_mask_table internal to the Marvell code, it's unued anywhere
else.

Sponsored by:	ABT Systems Ltd
2017-01-26 13:04:14 +00:00
Wojciech Macek
518a87d7e5 Add dummy functions for Marvell SoC's not equipped with AHCI
Commit r312747 ("Setup decoding windows for ARMADA38X") resulted
in build failing for Marvell platforms, which don't have AHCI controller.
This patch provides a fix by adding dummy functions for such cases.

On the occasion rename register dump routine to decode_win_ahci_dump,
in order to avoid confusion.

Submitted by:          Marcin Wojtas <mw@semihalf.com>
Obtained from:         Semihalf
Sponsored by:          Stormshield
2017-01-26 11:14:23 +00:00
Jason A. Harmening
fc100b8af2 Further cleanup of per-CPU armv6 pmap data:
- Replace pcpu_find(curcpu) with get_pcpu(), which is much
  more direct.

- Remove armv4 pcpu fields which I added in r286296 but never
  needed to use.

- armv6 pc_qmap_addr was leftover from the old armv6 pmap
  implementation.  Rename it and put it to use in the new one.

Noted by:	skra
Reviewed by:	skra
MFC after: 	1 week
Differential Revision:	https://reviews.freebsd.org/D9312
2017-01-26 05:23:33 +00:00
Wojciech Macek
5f55eefb91 Add support for AHCI on ARMADA38X
This file provides support for AHCI mode on Armada38x
and adds new optional AHCI device to arm/mv/files.mv.

Submitted by:          Konrad Adamczyk <ka@semihalf.com>
Obtained from:         Semihalf
Sponsored by:          Stormshield
Reviewed by:           zbb
Differential revision: https://reviews.freebsd.org/D9222
2017-01-25 10:34:37 +00:00
Wojciech Macek
ccd5b1b023 Setup decoding windows for ARMADA38X
It is necesarry to open memory windows on internal bus for
AHCI driver to work correctly.

Submitted by:          Konrad Adamczyk <ka@semihalf.com>
Obtained from:         Semihalf
Sponsored by:          Stormshield
Reviewed by:           zbb
Differential revision: https://reviews.freebsd.org/D9220
2017-01-25 10:31:16 +00:00
Wojciech Macek
228042ce94 Fix node detection for MBUS windows configuration
Configure decoding windows only for devices with
enabled nodes in FDT.

Submitted by:          Konrad Adamczyk <ka@semihalf.com>
Obtained from:         Semihalf
Sponsored by:          Stormshield
Reviewed by:           zbb
Differential revision: https://reviews.freebsd.org/D9219
2017-01-25 10:29:46 +00:00
Wojciech Macek
23e463579f Introduce armada_thermal driver for Armada family platforms
* Currently supports only Armada38X family but other Marvell SoC's
  can be added if needed.
* Provides temperature is C deg.
* To print the temperature one can use:
  sysctl dev.armada_thermal.0.temperature

Submitted by:          Zbigniew Bodek <zbb@semihalf.com>
Obtained from:         Semihalf
Sponsored by:          Stormshield
Differential revision: https://reviews.freebsd.org/D9217
2017-01-25 06:08:10 +00:00
Ian Lepore
83988d944b Handle imx6 erratum ERR004346... to reboot, clear the SRS bit twice within
the same cycle of the 32khz clock.

I've never actually noticed this error happening, but it's an easy fix.
2017-01-24 02:09:30 +00:00
Luiz Otavio O Souza
6386d003c9 Be a little more pedantic here, the TRM says the hardware is supposed to
only clean the OWNER bit on SOP descriptors.

MFC after:	3 days
Sponsored by:	Rubicon Communications, LLC (Netgate)
2017-01-22 17:24:00 +00:00
Luiz Otavio O Souza
3a3d1c770e Properly assemble an mbuf chain out of received fragments.
Remove the rx_batch hack, it makes no difference now that most of bugs have
been sorted out.

Sponsored by:	Rubicon Communications, LLC (Netgate)
2017-01-22 17:07:37 +00:00
Jason A. Harmening
e0b79e669b Like r310481 for i386, move the objects used to create temporary
mappings for armv6 pmap zero and copy operations to the MD PCPU region.
Change sysmap initialization to only allocate KVA pages for CPUs that
are actually present.

While here, collapse CMAP3 into CMAP2 (their use was mutually exclusive
anyway) and "recover" some space in PCPU padding that has always been
available due to 64-byte cacheline padding.

Reviewed by:	skra
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D9172
2017-01-22 00:46:04 +00:00
Luiz Otavio O Souza
6d800e3c9c Handle the rx queue stall while reading the packets from NIC (when the
descriptor state will not change anymore).  This seems to eliminate the
race where we can miss a stalled queue under high load.

While here remove the unnecessary curly brackets.

Reported by:	Konstantin Kormashev <konstantin@netgate.com>
MFC after:	3 days
Sponsored by:	Rubicon Communications, LLC (Netgate)
2017-01-21 23:07:15 +00:00
Luiz Otavio O Souza
f348557302 Commit the struture changes for the padding of small packets on if_cpsw.
Should have been committed together with r312604.

MFC with:	r312604
2017-01-21 19:56:28 +00:00
Luiz Otavio O Souza
904e8e891b Simplify the handling of small packets padding in cpsw:
- Pad small packets to 60 bytes and not 64 (exclude the CRC bytes);
 - Pad the packet using m_append(9), if the packet has enough space for
   padding, which is usually true, it will not be necessary append a newly
   allocated mbuf to the chain.

Suggested by:	yongari
MFC after:	3 days
Sponsored by:	Rubicon Communications, LLC (Netgate)
2017-01-21 19:49:39 +00:00
Luiz Otavio O Souza
270da772f5 Handle the set capabilities ioctl, letting the hardware checksum be
disabled (Hi netmap!).

Only remove the CRC bytes from packets when the hardware tell us to do so.

Fixes the 'discard frame w/o leading ethernet header' issues.

Sponsored by:	Rubicon Communications, LLC (Netgate)
2017-01-19 14:58:55 +00:00
Luiz Otavio O Souza
b328ce000e The port number and the to_port_en flag are valid only on SOP descriptor.
Sponsored by:	Rubicon Communications, LLC (Netgate)
2017-01-19 14:05:49 +00:00
Ed Schouten
4423244072 Catch up with changes to structure member names.
Pointer/length pairs are now always named ${name} and ${name}_len.
2017-01-17 22:05:52 +00:00
Oleksandr Tymoshenko
024fe4e7ea [zynq] Fix panic on USB PHY initialization failure
The Zedboard has a hardware bug where initialization of the USB PHY
occasionally fails on boot-up. Fix regression in -CURRENT when
kernel panics on such occasion. 11-RELEASE branch works fine

PR:		215862
Submitted by:	Thomas Skibo <thoma555-bsd@yahoo.com>
2017-01-17 00:39:09 +00:00
Ian Lepore
3b9a898298 Remove arm's cpuconf.h, and references to it, after moving a few lines from
it into pmap-v4.h where they are used.  Other than those few lines of
support for different MMU types, nothing in cpuconf.h has been used in our
code for quite a while.

The file existed to set up a variety of symbols to describe the
architecture.  Over the past few years we have converted all of our source
to use the new architecture symbols standardized by ARM Inc, and predefined
by both clang and gcc.

PR:		216104
2017-01-16 16:44:13 +00:00
Ian Lepore
488b4e7e68 Remove a bit of armv6 support that didn't get deleted when this file was
split from trap.c into trap-v4.c and trap-v6.c.
2017-01-16 03:11:30 +00:00
Conrad Meyer
db4fcadf52 "Buses" is the preferred plural of "bus"
Replace archaic "busses" with modern form "buses."

Intentionally excluded:
* Old/random drivers I didn't recognize
  * Old hardware in general
* Use of "busses" in code as identifiers

No functional change.

http://grammarist.com/spelling/buses-busses/

PR:		216099
Reported by:	bltsrc at mail.ru
Sponsored by:	Dell EMC Isilon
2017-01-15 17:54:01 +00:00
Ian Lepore
e62eb51d5a Use the new sdhci_fdt_gpio helper functions to add full support for FDT
gpio pins for detecting card insert/remove and write protect.
2017-01-09 01:57:51 +00:00
Zbigniew Bodek
b3d8a7757b Include e6000sw driver in ARMADA38X configuration
e6000sw Marvell switch driver was added to files
and Armada38x kernel configuration file.

Submitted by:	Bartosz Szczepanek <bsz@semihalf.com>
Obtained from:	Semihalf
Sponsored by:	Stormshield
Differential revision: https://reviews.freebsd.org/D8178
2017-01-05 17:10:52 +00:00
Emmanuel Vadot
358e989f83 ARM GENERIC: Add support for Allwinner A33 SoC 2017-01-04 03:37:00 +00:00
Emmanuel Vadot
cf72965fbf Allwinner: Add A33 support
Add basic support for A33/R16 that is enough to boot a kernel.
This adds the platform code, padconf data and the new clocks strings.

MFC after:	2 weeks
2017-01-04 03:35:39 +00:00
Mark Johnston
33ce6ec1d9 Add some missing atomic_*_ptr #defines for arm.
MFC after:	1 week
2017-01-04 00:18:51 +00:00
Luiz Otavio O Souza
ab8fdacc82 Fixes the sensor initialization, always reset the digital outputs to start.
Obtained from:	pfSense
MFC after:	3 days
Sponsored by:	Rubicon Communications, LLC (Netgate)
2016-12-31 02:18:08 +00:00
Oleksandr Tymoshenko
78b5418242 [qemu] Fix VERSATILEPB kernel boot in QEMU broken by r300968
QEMU does not implement hardware debug registers so when
dbg_monitor_is_enabled is called kernel receives "invalid instruction"
exception. QEMU implements only DIDR register and on read returns all
zeroes to indicate that it doesn't support other registers. Real
hardware has Version bits set.

MFC after:	1 week
2016-12-29 21:55:23 +00:00
Jared McNeill
6443acaa6c Add support for audio on I2S based DesignWare HDMI controllers.
Relnotes:	yes
2016-12-29 14:08:24 +00:00
Oleksandr Tymoshenko
3a48aebfbe [rpi] Fix bcm2835_audio locking and samples starvation
Rework general approach to locking and working with audio worker thread:

- Use flags to signal requested worker action
- Fix submitted buffer calculations to avoid samples starvation
- Protect buffer pointers with locks to fix race condition between callback
  and audio worker thread
- Remove unnecessary vchi_service_use
- Do not use lock to serialize VCHI requests since only one thread issues them now
- Fix unloading signaling per hselasky@ suggestion
- Add output to detect inconsistent callback data caused by possible firmware bug
  https://github.com/raspberrypi/firmware/issues/696
- Add stats/debug sysctls to troubleshoot possible bugs

PR:		213687, 205979, 215194
MFC after:	1 week
2016-12-27 19:08:08 +00:00
Michal Meloun
a0a23564a3 Implement drivers for NVIDIA tegra124 display controller, HDMI source
and host1x module. Unfortunately, tegra124 SoC doesn't have 2D acceleration
engine and 3D requires not yet started nouveau driver.

These drivers forms a first non-x86 DRM2 enabled graphic stack.

Note, there are 2 outstanding issues:
 - The code uses gross hack in order to be comply with
   OBJT_MGTDEVICE pager. (See tegra_bo_init_pager() in tegra_bo.c)
 - Due to improper(probably) refcounting in drm_gem_mmap_single()
   (in drm_gem.c), the gem objects are never released.
I hope that I will be able to address both issues in finite time,
but I don't want to touch x86 world now.

MFC after: 1 month
2016-12-26 14:36:05 +00:00
Emmanuel Vadot
338af8a097 Allwinner clk: factor M for mod clock is 4 bits, not 5
MFC after:	1 week
2016-12-22 15:01:06 +00:00
Oleksandr Tymoshenko
8ad55e0482 [iMX6] Fix SDMA driver build
- Place const modifiers where required
- Make sure sdma device is attahched before consumers like SSI

Reviewed by:	br
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D8874
2016-12-21 01:38:44 +00:00
Oleksandr Tymoshenko
bbcd5f00d0 [iMX6] Fix build for SSI driver and add dependency for SDMA driver
- Pass correct pointer to OF_getencprop
- Check the size of "dmas" property
- Add dependency on sdma driver

Reviewed by:	br
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D8873
2016-12-21 01:32:19 +00:00
Jared McNeill
06785ff66a Split the DesignWare HDMI-specific code from imx6_hdmi.c into a separate
file and add a generic DT binding that takes advantage of the extres
framework for setting up clocks.

Reviewed by:		gonzo
Differential Revision:	https://reviews.freebsd.org/D8826
2016-12-20 01:34:29 +00:00
Emmanuel Vadot
7073d12c4d ofw_spi: Parse property for the SPI mode and CS polarity.
As cs is stored in a uint32_t, use the last bit to store the
active high flag as it's unlikely that we will have that much CS.

Reviewed by:	loos
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D8614
2016-12-18 14:54:20 +00:00
Jayachandran C.
b2ef3bae84 Initialize GIC[DR]_IGROUPRn registers for GICv3
In case where GICD_CTLR.DS is 1, the IGROUPR registers are RW in
non-secure state and has to be initialized to 1 for the
corresponding interrupts to be delivered as Group 1 interrupts.

Update gic_v3_dist_init() and gic_v3_redist_init() to initialize
GICD_IGROUPRn and GICR_IGROUPRn respectively to address this. The
registers can be set unconditionally since the writes are ignored
in non-secure state when GICD_CTLR.DS is 0.

This fixes the hang on boot seen when running qemu-system-aarch64
with machine virt,gic-version=3
2016-12-18 08:31:01 +00:00
Svatopluk Kraus
e5b16f1d0e Fix sscanf() format string to match an argument. This also fixes kernel
build after r310171.

MFC after:	1 weeks
2016-12-17 18:03:03 +00:00
Emmanuel Vadot
1e64280173 Honor the CLK_SET_DRYRUN for the *set_freq function for allwinner clocks.
Reviewed by:	jmcneill
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D8821
2016-12-16 21:58:48 +00:00
Andrew Turner
6c925b9c81 All armv6 platforms have the same implementation of platform_lastaddr.
Replace them with a default handler that returns devmap_lastaddr.

Reviewed by:	mmel
Sponsored by:	ABT Systems Ltd
Differential Revision:	https://reviews.freebsd.org/D8806
2016-12-16 10:31:13 +00:00
Emmanuel Vadot
74b66ae149 Fix building arm64 kernel after r310117
Pointy hat: me

MFC after:	3 days
2016-12-15 17:26:16 +00:00
Emmanuel Vadot
15b2342cf3 Add information about interrupts in the Allwinner padconf files and
correct some pin numbering.

While here switch to my freebsd mail address in the copyright.

MFC after:	3 days
2016-12-15 15:52:13 +00:00
Andrew Turner
cf1db37a45 Directly include openfirm.h rather than through fdt_common.h as none of the
latter file is needed.

Sponsored by:	ABT Systems Ltd
2016-12-15 13:31:44 +00:00
Emmanuel Vadot
2b0f0faeb6 Add new compatible string "allwinner,sun7i-a20-mmc".
New upstream DTS is using this now for A20 SoC.

MFC after:	3 days
2016-12-14 15:00:24 +00:00
Andrew Turner
ba9f40ca3b Use the platform_*_t typedefs to help check the platform function types are
correct.

Sponsored by:	ABT Systems Ltd
2016-12-13 13:46:09 +00:00
Andrew Turner
59249a516a Add the missing void to function signatures in much of the arm code.
Sponsored by:	ABT Systems Ltd
2016-12-13 13:43:22 +00:00
Andrew Turner
3f31908a97 Use platform_*_t to check the platform function signatures are correct in
the Rockchip platform code and correct the one place they differ.

Sponsored by:	ABT Systems Ltd
2016-12-13 13:07:17 +00:00
Ganbold Tsagaankhuu
a89938019a Switch Rockchip RK3188 SoC to use the platform code.
Reviewed by:	andrew, manu
Differential Revision:	https://reviews.freebsd.org/D8769
2016-12-13 11:43:46 +00:00
Oleksandr Tymoshenko
c85d45a5bb [iMX6] Add compatibility string for GPT timer on i.MX6 Dual
Up until r295436 GPT timer in i.MX6 Dual dts used the same compatiblity
string as i.MX6 Quad. After the sync up with Linux in r295436, GPT timer
stopped getting attached on the i.MX6 Dual

MFC after:	3 days
2016-12-13 05:09:49 +00:00
Oleksandr Tymoshenko
ec0a42e59c [iMX6] Fix platform compatibility string for i.MX6 Dual
i.MX6 Dual boot was broken since r308533 because ofw_bus_node_is_compatible
is more strict than fdt_is_compatible and does not accept partial matches
2016-12-13 03:26:12 +00:00
Emmanuel Vadot
adff859ba2 Use the spibus accessor when applicable.
MFC after:	3 days
2016-12-12 20:04:31 +00:00
Emmanuel Vadot
718860e469 CS ivar is uint32_t, not int.
MFC after:	3 days
2016-12-12 18:36:46 +00:00
Jayachandran C.
3ce73b2662 Fix gic_cpu_mask() calculation in ARM GIC
r309616 changed the definition of GICD_ITARGETSR(n) to take the irq
id as argument, but the usage of the macro in gic_cpu_mask() was not
updated to reflect this. This causes the cpu mask to be computed
incorrectly.

Update the GICD_ITARGETSR() call to fix this, this fixes a hang seen
while booting freebsd on qemu-system-aarch64 with SMP enabled.
2016-12-12 15:35:57 +00:00
Konrad Witaszczyk
480f31c214 Add support for encrypted kernel crash dumps.
Changes include modifications in kernel crash dump routines, dumpon(8) and
savecore(8). A new tool called decryptcore(8) was added.

A new DIOCSKERNELDUMP I/O control was added to send a kernel crash dump
configuration in the diocskerneldump_arg structure to the kernel.
The old DIOCSKERNELDUMP I/O control was renamed to DIOCSKERNELDUMP_FREEBSD11 for
backward ABI compatibility.

dumpon(8) generates an one-time random symmetric key and encrypts it using
an RSA public key in capability mode. Currently only AES-256-CBC is supported
but EKCD was designed to implement support for other algorithms in the future.
The public key is chosen using the -k flag. The dumpon rc(8) script can do this
automatically during startup using the dumppubkey rc.conf(5) variable.  Once the
keys are calculated dumpon sends them to the kernel via DIOCSKERNELDUMP I/O
control.

When the kernel receives the DIOCSKERNELDUMP I/O control it generates a random
IV and sets up the key schedule for the specified algorithm. Each time the
kernel tries to write a crash dump to the dump device, the IV is replaced by
a SHA-256 hash of the previous value. This is intended to make a possible
differential cryptanalysis harder since it is possible to write multiple crash
dumps without reboot by repeating the following commands:
# sysctl debug.kdb.enter=1
db> call doadump(0)
db> continue
# savecore

A kernel dump key consists of an algorithm identifier, an IV and an encrypted
symmetric key. The kernel dump key size is included in a kernel dump header.
The size is an unsigned 32-bit integer and it is aligned to a block size.
The header structure has 512 bytes to match the block size so it was required to
make a panic string 4 bytes shorter to add a new field to the header structure.
If the kernel dump key size in the header is nonzero it is assumed that the
kernel dump key is placed after the first header on the dump device and the core
dump is encrypted.

Separate functions were implemented to write the kernel dump header and the
kernel dump key as they need to be unencrypted. The dump_write function encrypts
data if the kernel was compiled with the EKCD option. Encrypted kernel textdumps
are not supported due to the way they are constructed which makes it impossible
to use the CBC mode for encryption. It should be also noted that textdumps don't
contain sensitive data by design as a user decides what information should be
dumped.

savecore(8) writes the kernel dump key to a key.# file if its size in the header
is nonzero. # is the number of the current core dump.

decryptcore(8) decrypts the core dump using a private RSA key and the kernel
dump key. This is performed by a child process in capability mode.
If the decryption was not successful the parent process removes a partially
decrypted core dump.

Description on how to encrypt crash dumps was added to the decryptcore(8),
dumpon(8), rc.conf(5) and savecore(8) manual pages.

EKCD was tested on amd64 using bhyve and i386, mipsel and sparc64 using QEMU.
The feature still has to be tested on arm and arm64 as it wasn't possible to run
FreeBSD due to the problems with QEMU emulation and lack of hardware.

Designed by:	def, pjd
Reviewed by:	cem, oshogbo, pjd
Partial review:	delphij, emaste, jhb, kib
Approved by:	pjd (mentor)
Differential Revision:	https://reviews.freebsd.org/D4712
2016-12-10 16:20:39 +00:00
Mark Johnston
7f68a896dc Add a COMPAT_FREEBSD11 kernel option.
Use it wherever COMPAT_FREEBSD10 is currently specified.

Reviewed by:	glebius, imp, jhb
Differential Revision:	https://reviews.freebsd.org/D8736
2016-12-09 18:54:12 +00:00
Andrew Turner
be04b41da2 Create two GIC ivars to find the bus type and GIC hardware version. These
will be used by the gicv2m and ITS ACPI drivers to only attach to the
correct parent.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation
2016-12-06 15:12:14 +00:00
Andrew Turner
c417fba9eb Move the common bit manipulation macros from the GICv3 header to the
common GIC header file.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation
2016-12-06 13:55:19 +00:00
Andrew Turner
4d7d72fb23 Adda new common GIC header to handle the common parts of the GICv2 and
GICv3 drivers. For now it just contains common distributor registers.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation
2016-12-06 12:57:28 +00:00
Luiz Otavio O Souza
ff30498384 Fix the armv6 build after r309553.
Sponsored by:	Rubicon Communications, LLC (Netgate)
2016-12-06 06:15:28 +00:00
Michal Meloun
65d5084f54 Fix build breakage caused by r309531.
Reported by: andrew
MFC after: 2 weeks
X-MFC with: r309531
2016-12-05 15:55:51 +00:00
Michal Meloun
6f1eb3052e Fixes for NVIDIA Tegra124 clocks:
- EMC clock have standard peripheral clock block. Use it.
 - Implement full frequency set method for PLLD2. This PLL
   is used as HDMI pixel clock so we must be able to set it
   to wide range of frequencies, within 5% tolerance allowed
   by HDMI specification. Due to this, full state space search
   (over m, n, p fields) is necessary.

MFC after: 3 weeks
2016-12-04 16:04:22 +00:00
Michal Meloun
bdbc1b764d Implement fake pmap_mapdev_attr() for ARMv6.
This function is referenced, but never called from DRM2 code. Also,
real behavior of pmap_mapdev_attr() in ARM world is unclear as we don't
have any additional attribute for a device memory type.

MFC after: 2 weeks
2016-12-04 15:27:39 +00:00
Luiz Otavio O Souza
7f67614061 MDIO_PHYACCESS_ACK is only valid for read access, remove it from
miibus_writereg.

Reduce the DELAY() between reads while waiting for MII access.

Spotted by:	yongari
Sponsored by:	Rubicon Communications, LLC (Netgate)
2016-12-01 03:34:04 +00:00
Luiz Otavio O Souza
71462f5652 The RX_FREEBUFFER registers are a write to increment field.
Writing the full queue size to it every time was makeing it overflow with a
lot of bogus values.

This fixes the interrupt storms on irq 40.

Sponsored by:	Rubicon Communications, LLC (Netgate)
2016-12-01 02:35:15 +00:00
Andrew Turner
c430fbd38c Move the FDT specific parts of the GIC diver softc to the FDT attachment.
This allows the driver to be built in a kernel with no FDT support, e.g.
on arm64 with just ACPI.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation
2016-11-30 09:47:29 +00:00
Andrew Turner
592022614f Only include FDT headders when building for FDT.
Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation
2016-11-30 09:45:18 +00:00
Emmanuel Vadot
def44246f2 PLL3 have a fractional mode where an explicit frequency (297Mhz or 270)
can be selected for it. If the desired frequency is one of those two, use
this mode instead of the integer one.
When calculating the PLL3 freq for the dotclock, check if it is a multiple
of the fracional frequencies.

MFC after:	2 weeks
2016-11-26 10:36:48 +00:00
Luiz Otavio O Souza
a2c46b941e Add the etherswitch(4) support for TI CPSW.
Adds VLAN and port management abilities for etherswitchcfg(8).

The code is conditionally enabled for now, because it is not necessary on
single ethernet use cases.

Obtained from:	pfSense
MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC (Netgate)
2016-11-24 20:14:43 +00:00
Emmanuel Vadot
49ba3f32c8 Enable the SCL and SDA i2c line for DDC.
This is an undocumented register that we need to set if we do not want to
rely on u-boot or other bootloader.
2016-11-24 01:24:26 +00:00
Oleksandr Tymoshenko
0f04f5deaa [rpi3] Fix SMP build for FreeBSD/arm64 2016-11-24 00:39:17 +00:00
Emmanuel Vadot
183a6b3de6 Test that the emac device is enabled in probe function
MFC after:	3 days
2016-11-23 18:07:44 +00:00
Emmanuel Vadot
5e2be2f660 Do not attempt to disable/release clock if it had not been enabled.
While here fix a style(9) issue.

MFC after:	1 week
2016-11-23 01:44:28 +00:00
Andrew Turner
f1568d1e03 Split out the FDT parts of the pmu driver to make way for adding ACPI
support.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation
2016-11-22 09:39:31 +00:00
Andrew Turner
f94f8e62ab To allow for an ACPI attachment to the generic PCIe driver split off the
FDT attachment to a new file. A separate ACPI attachment will then be added
to allow arm64 servers with ACPI to use it over FDT.

This should also help with merging this with the ofwpci driver, with
further work needed to remove restrictions this driver places on resource
allocation.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D7319
2016-11-21 18:24:05 +00:00
Emmanuel Vadot
44b5cf6ff4 Add spigen to the ARMv6 GENERIC kernel 2016-11-20 18:21:42 +00:00
Olivier Houchard
cbfebd9a6e The only remaining offender that used ti_chip() without checking for
compatibility first was the gpio code, so change that, and re-assert
that the TI chip is a known chip
2016-11-19 15:43:22 +00:00
Olivier Houchard
80d2898d0f Don't panic if it's not a TI chip, this code can be called when it is not. 2016-11-19 15:35:40 +00:00
Olivier Houchard
645f6eaf9a Don't attempt to get the chip revision if it's not a supported TI chip 2016-11-19 15:35:10 +00:00
Jared McNeill
0a30b4b2a5 On H3, initialize alarm and shutdown trip points and do temperature
conversion as it is done in the BSP.
2016-11-19 14:56:22 +00:00
Olivier Houchard
487012f4f8 Move the pandaboard initialization from the probe to the attach method.
Use ofw_bus_node_is_compatible instead of fdt_is_compatible, as the
later is deprecated.

Suggested by:	andrew
2016-11-19 13:11:03 +00:00
Olivier Houchard
c49cf11473 Resolv the remaining conflicting symbols between omap4 and am335x, and
add omap4/pandaboard into the GENERIC kernel.
2016-11-19 01:51:56 +00:00
Olivier Houchard
8917c565bd Don't assume we're running on a pandaboard if the pandaboard-specific
code is compiled in, use FDT to detect it instead.
2016-11-19 00:55:46 +00:00
Olivier Houchard
31a2ddf253 Guess the TI chip based on the PLATFORM infos, instead of relying on the
kernel config file.
2016-11-18 23:48:20 +00:00
Olivier Houchard
44f0c15c6c Convert the omap4 code to use PLATFORM_SMP. 2016-11-18 22:58:47 +00:00
Andrew Turner
04b5b6a984 Use the correct OF_getencprop to get the height.
Reported by:	jmcneill
Sponsored by:	ABT Systems Ltd
2016-11-16 11:31:53 +00:00
Jared McNeill
ce4e4d612b On command error, reset only DMA and FIFO engines instead of the entire
controller. Fixes eMMC device detection on OrangePi Plus 2e (and likely
others).
2016-11-15 23:48:30 +00:00
Jared McNeill
02b2e3c5fb Allow the MMC frequency to be set up to 52MHz for MMC high speed timings. 2016-11-15 23:46:01 +00:00
Luiz Otavio O Souza
b7f9d71cf4 After r308533, the platform compatible string must be an exact match.
Use "ti,am33xx" instead of "ti,am335x", which gives an exact match in every
DTS we support.

This fixes the boot on TI SoCs after r308533.

Suggested by:	gonzo
Sponsored by:	Rubicon Communications, LLC (Netgate)
2016-11-15 21:18:55 +00:00
Luiz Otavio O Souza
d47e148e0b Change the TI aintc driver name to "ti_aintc" to avoid the conflict with
the aintc driver for Allwinner A10.

This fixes the boot of the GENERIC ARM kernel on TI/AM335x SoCs.

Sponsored by:	Rubicon Communications, LLC (Netgate)
2016-11-15 19:09:36 +00:00
Luiz Otavio O Souza
197029fec2 Fix ti_gpio_detach() to avoid crashing if something goes wrong.
Sponsored by:	Rubicon Communication, LLC (Netgate)
2016-11-15 18:57:25 +00:00
Emmanuel Vadot
51503e707b Upstream DTS provides PLL3 and PLL7 nodes (and their x2 form),
so remove them from our DTS and adapt the code to handle them correctly.
This fix HDMI video on A20.
2016-11-15 07:08:33 +00:00
Luiz Otavio O Souza
047dd1cd66 Add the cpsw, the NIC driver for ti/am335x, to GENERIC kernel.
While here:

 - remove 'device mii' - included by miibus;
 - remove 'device smcphy' - included by miibus;
 - sorted the network drivers list;
 - added a comment about miibus based on amd64/GENERIC.

Sponsored by:	Rubicon Communications, LLC (Netgate)
2016-11-14 20:57:30 +00:00
Luiz Otavio O Souza
7b12aa57c1 Build the Ti/AM335x DTBs as part of GENERIC kernel.
Sponsored by:	Rubicon Communications, LLC (Netgate)
2016-11-14 19:53:46 +00:00
Andrew Turner
9783ea5c9f Use the correct OF_getencprop over OF_getprop + fdt32_to_cpu to read
integer data from the device tree.

Sponsored by:	ABT Systems Ltd
2016-11-14 12:03:08 +00:00
Andrew Turner
222102cfca Move including fdt_pinctrl.h after openfirm.h to get th edefinition of
phandle_t and remove the need for including fdt_common.h.

Sponsored by:	ABT Systems Ltd
2016-11-14 11:52:22 +00:00
Andrew Turner
df7675353e Stop including fdt_common.h from the arm code when it's unneeded.
Sponsored by:	ABT Systems Ltd
2016-11-14 11:41:22 +00:00
Svatopluk Kraus
06a9e29e75 The return type of is_managed() was changed from boolean_t to bool type
in r308569. Now, propagate this change further for consistency sake.

MFC after:	2 weeks
2016-11-12 17:24:41 +00:00
Svatopluk Kraus
b75f7c6cfb Always call PHYS_TO_VM_PAGE() in is_managed(). Fast road for addresses
under first_page cannot be taken as this variable is connected only to
vm_page_array segment. There could be more segments in system like
the ones for various fictitious page ranges. These can be situated
under vm_page_array segment and so, they could be skipped before this
fix. However, as far as I know, there is no report associated with it.

While here, the return type of this function is changed from boolean_t
to bool type.

Reviewed by:	kib
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D8502
2016-11-12 17:03:21 +00:00
Andrew Turner
87acb7f815 Use the modern spelling of ofw_bus_node_is_compatible in sys/arm.
Sponsored by:	ABT Systems Ltd
2016-11-11 15:13:30 +00:00
Andrew Turner
30add35afa Fix ata_at91_alloc_resource to use rman_res_t.
Sponsored by:	ABT Systems Ltd
2016-11-11 14:30:09 +00:00
Andrew Turner
639e990770 Remove more unneeded users of the fdt_pic_decode_t table.
Sponsored by:	ABT Systems Ltd
2016-11-11 14:22:35 +00:00
Bryan Drewery
28323add09 Fix improper use of "its".
Sponsored by:	Dell EMC Isilon
2016-11-08 23:59:41 +00:00
Andrew Turner
feabce61dc Start to remove the old pre-INTRNG code from the arm platforms. These have
all moved to use INTRNG.

Reviewed by:	manu, mmel
Sponsored by:	ABT Systems Ltd
Differential Revision:	https://reviews.freebsd.org/D8469
2016-11-08 12:15:57 +00:00
Emmanuel Vadot
328dd395ba Do not fail to attach the clock if we cannot set the assigned parents as this
property isn't mandatory.

MFC after:	2 weeks
2016-11-08 10:06:43 +00:00
Oleksandr Tymoshenko
69cab2d1bf Fix locking in bcm2835_audio driver
- Move all VCHI activity to worker thread: channel methods are called with
    non-sleepable lock held and VCHI uses sleepable lock.

- In worker thread use sx(9) lock instead of mutex(9) for the same reason.

PR:		213801, 205979
2016-11-07 17:38:39 +00:00
Andrew Turner
95d34803f7 Fix the order of includes so machine/asm.h is first.
MFC after:	1 week
Sponsored by:	ABT Systems Ltd
2016-11-07 11:56:18 +00:00
Stanislav Galabov
c1bc87b161 Generate an error if machine/armreg.h is included without sys/cdefs.h
machine/armreg.h requires access to the __ARM_ARCH macro, which is not
always properly defined (especially by gcc 4.2.1). We should include
sys/cdefs.h in order to get the definitions in machine/acle-compat.h,
which would properly define the __ARM_ARCH macro in these cases.

So, in cases where machine/armreg.h is included without _SYS_CDEFS_H_
being defined - generate an #error.

Reviewed by:	andrew
Sponsored by:	Smartcom - Bulgaria AD
Differential Revision:	https://reviews.freebsd.org/D8460
2016-11-07 11:35:14 +00:00
Andrew Turner
fe06608404 Include machine/armreg.h after machine/asm.h to ensure __ARM_ARCH is
defined.

MFC after:	1 week
Sponsored by:	ABT Systems Ltd
2016-11-07 11:01:09 +00:00
Stanislav Galabov
921081191d Only include sys/boot.h if LINUX_BOOT_ABI is defined
Only include sys/boot.h if LINUX_BOOT_ABI is defined in
sys/arm/arm/machdep.c

Not doing this prevents kernels that do not define LINUX_BOOT_ABI from
being build with gcc (at least 4.2.1).

Reviewed by:	mmel
Sponsored by:	Smartcom - Bulgaria AD
Differential Revision:	https://reviews.freebsd.org/D8459
2016-11-07 10:54:56 +00:00
Andrew Turner
cb1b0068a1 Start to deorbit the kernel configs in GENERIC by marking them with
NO_UNIVERSE. This stops them from being built with the universe,
tinderbox, and related targets.

Sponsored by:	ABT Systems Ltd
2016-11-07 10:26:44 +00:00
Michal Meloun
ccf5e68e5b Add NVIDIA Tegra XHCI driver and coresponding firmware blob.
MFC after: 3 weeks
Approved by: core@ (NVIDIA license)
2016-11-07 05:37:10 +00:00
Michal Meloun
59b591b1b1 Rework NVIDIA Tegra124 XUSBPAD driver.
- Adapt it for new, incompatible, DT bindings introduced by r306197.
 - Add support for USB super speed pads/ports.

MFC after: 3 weeks
2016-11-07 05:34:44 +00:00
Emmanuel Vadot
6988dd5e61 Add support for AXP221 Power Management Unit.
AXP221 is used on board with A31/A31S and is mostly compatible with AXP209.
Regulators, GPIO and Sensors are supported.

MFC after:	2 weeks
2016-11-04 20:02:52 +00:00
Emmanuel Vadot
73e62e8c5c Fix r308306 by spelling variable correctly. 2016-11-04 19:23:52 +00:00
Emmanuel Vadot
1ca819f642 Set rst_apb to NULL to avoid panic when release. 2016-11-04 19:21:11 +00:00
Emmanuel Vadot
e3454ae8b3 For AHB clock we need to set the assigned parents for cpufreq(4) to work.
MFC after:	2 weeks
2016-11-04 17:13:47 +00:00
Michal Meloun
7961a970c7 TEGRA: Fix numerous issues in clock code.
Define and export clocks related to XUSB driver.
2016-11-04 11:40:11 +00:00
Michal Meloun
47a232c660 TEGRA: Add basic driver for memory controller.
For now, it only reports memory and SMMU access errors.
2016-11-04 11:39:19 +00:00
Emmanuel Vadot
bccf798278 Add Allwinner UP SoC support to GENERIC on armv6
Relnotes:	yes
2016-11-04 04:47:08 +00:00
Jared McNeill
16025c357f Add support for Allwinner H3 audio codec.
The audio controller in the H3 is more or less the same as A10/A20 except
some registers are shuffled around. The mixer interface, however, is
completely different between SoCs. Separate a10_mixer_class and
h3_mixer_class implementations are now made available. This will also make
adding support for other SoCs easier in the future.

Reviewed by:		andrew, ganbold
Relnotes:		yes
Differential Revision:	https://reviews.freebsd.org/D8425
2016-11-03 23:22:04 +00:00
Jared McNeill
e1ca1a284c Add support for the integrated DMA controller found in the Allwinner A31,
A64, A83T, and H3 SoCs.

Relnotes:	yes
2016-11-02 23:58:10 +00:00
Jared McNeill
ddfb3d5aa7 Register the device's xref handle at attach time. 2016-11-02 23:53:47 +00:00
Jared McNeill
5f7cfb6035 Add support for H3 PLL2 (PLL_Audio). 2016-11-02 23:49:57 +00:00
Jared McNeill
8c07f7653a The DTS may report fewer than 4 parents for a module clock. Avoid setting
the module clock parent to an out-of-range index in these cases.
2016-11-02 23:46:23 +00:00
Andrew Turner
5c73dd07a6 Add BeagleBone Black support to GENERIC on armv6.
Reviewed by:	mmel, imp
Relnotes:	yes
Sponsored by:	ABT Systems Ltd
Differential Revision:	https://reviews.freebsd.org/D8335
2016-11-02 13:11:19 +00:00
Andrew Turner
e9524a3c2f Allow an SMP kernel to boot on Cortex-A8:
* Rename ARM_HAVE_MP_EXTENSIONS to ARM_USE_MP_EXTENSIONS and extend it to
   handle more cases, including when SMP is not enabled.
 * Check ARM_USE_MP_EXTENSIONS when building for ARMv7+, even if no SMP.
 * Use ARM_USE_MP_EXTENSIONS in pmap-v6.c to detect when to set PRRR_NS1.

With this we should be able to boot on all ARMv7+ Cortex-A cores with
32-bit support.

Reviewed by:	mmel, imp (earlier version)
Relnotes:	yes
Sponsored by:	ABT Systems Ltd
Differential Revision:	https://reviews.freebsd.org/D8335
2016-11-02 13:10:08 +00:00
Justin Hibbits
3d9df07abf Move imx_sdhci driver over to a dev/sdhci in preparation for QorIQ support.
Freescale uses eSDHC in both i.MX (ARM) and QorIQ (PowerPC), with slight
differences.  This is part one in unifying the drivers.

Reviewed by:	imp
2016-11-02 00:51:09 +00:00
Jared McNeill
bd95d8610a Fix H3 temperature reporting. The formula in for V1.0 of the H3 datasheet
seems to be incorrect, so use the same method of conversion as the H3 BSP
instead.
2016-10-30 14:39:33 +00:00
Ganbold Tsagaankhuu
a6e9118bf4 Add support for Allwinner Consumer IR interface.
RX is supported now and the driver is using evdev framework.
It was tested on Cubieboard2 (A20 SoC) using lirc
with dfrobot's IR remote controller.
2016-10-27 04:26:33 +00:00
Andrew Turner
f1ae17fb50 Use the new fdt_intr.h constants in the Allwinner NMI driver.
Sponsored by:	DARPA, AFRL
2016-10-26 16:03:26 +00:00
Andrew Turner
0c5434ae58 Pull the common FDT interrupt values into a new header rather than be magic
numbers.

Sponsored by:	DARPA, AFRL
2016-10-26 15:18:08 +00:00
Andrew Turner
87e1355ba5 Define the Allwinner PLL FDT constants in the file that uses them rather
than including a file from under sys/gnu.

Sponsored by:	DARPA, AFRL
2016-10-26 14:09:30 +00:00
Emmanuel Vadot
1535414c25 The only consumer of pll1 is the CPU clock, we don't need to set it glitch free.
Reported by:	jmcneill
MFC after:	1 week
2016-10-26 08:47:35 +00:00
Andrew Turner
8fcbb32311 Add MULTIDELAY support to the am335x dmtimer. This will be useful for
testing Cortex-A8 support in GENERIC.

Sponsored by:	ABT Systems Ltd
2016-10-25 18:01:19 +00:00
Andrew Turner
12f7add9f7 Remove the need for the delay to be zero when MULTIDELAY is undefined,
it may be useful to only enable this in some configs.

Sponsored by:	ABT Systems Ltd
2016-10-25 17:57:31 +00:00
Andrew Turner
bf715082c3 Remove armadaxp_idcache_wbinv_all, it's a static function in the ELF
trampoline and not used outside this.

Sponsored by:	ABT Systems Ltd
2016-10-25 16:33:05 +00:00
Andrew Turner
ff300d2316 Remove arm11x6_setttb and armv7_setttb as they are unused. While here
remove unneeded code from the ARMv7 cpu assembly code.

Sponsored by:	ABT Systems Ltd
2016-10-25 16:25:06 +00:00
Emmanuel Vadot
6a9f23793d allwinner A10 Pll1 allow changing freq
PLL1 is used by the cpu core, allowing changing freq is needed for cpufreq.
The factors table contains all the frequencies in the operating point table
present in the DTS.

MFC after:	1 week
2016-10-25 15:21:08 +00:00
Andrew Turner
ce9fa35b35 Update the armv6 tlb handling functions to detect if it is running on
hardware that supports the mp extensions. If so it should use the broadcast
tlb invalidate instructions as other CPUs or devices may need to know about
the invalidation.

To simplify the code have the compiler optimise out the else case when not
builing for Cortex-A8.

Sponsored by:	ABT Systems Ltd
Differential Revision:	https://reviews.freebsd.org/D8092
2016-10-25 13:45:59 +00:00
Jared McNeill
51fefb0418 Enable driver for SY8106A Buck Regulator. 2016-10-24 22:35:45 +00:00
Jared McNeill
2e4f934752 Defer cpufreq updates from intr handler to the taskqueue_thread queue. 2016-10-24 22:35:12 +00:00
Emmanuel Vadot
cd2b868b5d allwinner: Add support for P2WI in RSB driver
Push-Pull Two Wire interface is a almost compatible iic like bus used
in sun6i SoC. It's only use is to communicate with the power management IC.

Reviewed by:	jmcneill
MFC after:	1 week
Relnotes:	yes
2016-10-24 20:33:42 +00:00
Emmanuel Vadot
2c3b1e3c42 Revert 307822
P2WI is almost compatible with RSB which we already support.
I'll add support for P2WI in aw_rsb instead.

Discussed with:	 jmcneill
2016-10-24 14:24:12 +00:00
Jared McNeill
5a7f20b4d0 Add device cpufreq. 2016-10-23 19:02:19 +00:00
Jared McNeill
3c2b90f1d1 Throttle CPU frequency when hot temperature threshold has been reached to
prevent overheating.

When sensor 0's alarm interrupt is fired, set a throttle flag. Further
requests to set CPU frequency will be rejected until sensor 0's temperature
returns to a level below the hot temperature threshold.

Relnotes:	yes
2016-10-23 17:48:34 +00:00
Emmanuel Vadot
0b194aca21 allwinner: Add support for P2WI bus
P2WI (Push-Pull Two Wire Interface) is an I2C-like bus used in sun6i SoC
for talking to power management unit IC.
2016-10-23 12:48:09 +00:00
Wojciech Macek
7902c8dca8 Driver for PCI Ethernet NIC on Alpine V1 and V2.
Obtained from:         Semihalf
Submitted by:          Michal Stanek <mst@semihalf.com>
Sponsored by:          Annapurna Labs
Reviewed by:           wma
Differential Revision: https://reviews.freebsd.org/D7814
2016-10-20 11:31:11 +00:00
Wojciech Macek
246d07a7a3 Support for Alpine Serializer/Deserializer.
The exported functions will be used by
Alpine Ethernet driver.

Obtained from:         Semihalf
Submitted by:          Michal Stanek <mst@semihalf.com>
Sponsored by:          Annapurna Labs
Reviewed by:           wma
Differential Revision: https://reviews.freebsd.org/D7763
2016-10-20 11:26:51 +00:00
Wojciech Macek
be48125bbf Support for MSI-X on Annapurna Alpine
This patch adds support for MSI-X interrupts
on Annapurna Alpine platform. MSI-X on Alpine
work similarly to GICv2m, i.e. some range of
SPI interrupts is reserved in GIC and individual
SPIs can be triggered by MSI-X messages.
This SPI range is defined in FDT.

Obtained from:         Semihalf
Submitted by:          Michal Stanek <mst@semihalf.com>
Sponsored by:          Annapurna Labs
Reviewed by:           nwhitehorn, wma
Differential Revision: https://reviews.freebsd.org/D7579
2016-10-20 11:23:59 +00:00
Michal Meloun
99746e4658 TEGRA: Raise minimum voltage for CPU, original 0.9 V was too optimistic.
While I'm in, remove duplicated line from CPU frequency table.

MFC after: 2 weeks
2016-10-19 14:28:51 +00:00
Warner Losh
44637964ef Use MODULES_EXTRA rather than MODULES_OVERRIDE for dtb.
Submitted by: Oleksandr Tymoshenko
2016-10-19 05:53:43 +00:00
Michal Meloun
fd02931841 REGULATOR: Move functions for handling with regulator ranges to
common file. They can be useful for other PMICs.

MFC after: 2 weeks
2016-10-18 12:27:46 +00:00
Michal Meloun
4d517b66a0 TEGRA: Attach cpufreq and coretemp drivers only on tegra124 SoC.
It's needed by GENERIC kernel.

MFC after: 2 weeks
2016-10-18 12:26:22 +00:00
Michal Meloun
69c48a2805 TEGRA: Really implement early printf. The original version
was cut&pasted from another SoC.

Pointy-hat to: mmel

MFC after: 2 weeks
2016-10-18 12:21:45 +00:00
Warner Losh
c6b36952ec Also include the DTBs in /boot/dtb for omap4 systems. 2016-10-18 04:01:58 +00:00
Hans Petter Selasky
d3bf5efc1f Fix device delete child function.
When detaching device trees parent devices must be detached prior to
detaching its children. This is because parent devices can have
pointers to the child devices in their softcs which are not
invalidated by device_delete_child(). This can cause use after free
issues and panic().

Device drivers implementing trees, must ensure its detach function
detaches or deletes all its children before returning.

While at it remove now redundant device_detach() calls before
device_delete_child() and device_delete_children(), mostly in
the USB controller drivers.

Tested by:		Jan Henrik Sylvester <me@janh.de>
Reviewed by:		jhb
Differential Revision:	https://reviews.freebsd.org/D8070
MFC after:		2 weeks
2016-10-17 10:20:38 +00:00
Jared McNeill
63f6b1a75a aw_ccu on H3 needs access to PRCM space. The r_pio controller works now. 2016-10-16 12:55:31 +00:00
Jared McNeill
72f1cf0446 Add driver for GPIO controlled regulator.
Reviewed by:		gonzo, manu, mmel
Differential Revision:	https://reviews.freebsd.org/D8257
2016-10-15 20:04:14 +00:00
Emmanuel Vadot
b3d4851e86 axp209: Add support for regulators
Except for LDO4, all regulators are supported.

MFC after:	1 week
2016-10-15 17:49:41 +00:00
Jared McNeill
3c6a684c11 Match "allwinner,sun8i-h3-apb0-gates-clk" compatible string. 2016-10-15 13:27:01 +00:00
Jared McNeill
2ee32f3c7f Provide a complete A23 PLL1 factor table, from 60MHz to 1872MHz. 2016-10-15 12:23:54 +00:00
Oleksandr Tymoshenko
745c4aa5e8 Make BRCM2837 port conform FreeBSD/ARM64 guidelines
- Rename SOC_BCM2837 to SOC_BRCM_BCM2837, put it to opt_soc.h
- do not use files.XXX files, just move required sources to
    conf/files.arm64 and make them depend on soc_brcm_bcm2837

Suggested by: andrew
2016-10-14 22:23:03 +00:00
John Baldwin
31dc1e9681 Drop support for using mmap() with /dev/kmem.
Using the device pager with /dev/kmem is not stable since KVA mappings
are transient, but the device pager caches the PA associated with a
given offset forever.  Interestingly, mips' implementation of
memmap() already refused requests for /dev/kmem.

Note that kvm_read/kvm_write do not use mmap, but use read and write on
/dev/kmem, so this should not affect libkvm users.

Reviewed by:	kib
MFC after:	2 months
2016-10-14 20:01:07 +00:00
Oleksandr Tymoshenko
563193fd0c Add initial Raspberry Pi 3 support
RPI3 kernel config builds kernel compatible with latest upstream device
tree and firmware: https://github.com/raspberrypi/firmware/tree/master/boot
As of today it's 597c662a613df1144a6bc43e5f4505d83bd748ca

Default console is PL01x, so pi3-disable-bt dt overlay should be configured
in config.txt and stock U-Boot should be patched to use proper serial port.

Yet unsupported: SMP, VCHIQ, RNG driver. RNG requires some work due to
upstream device tree incompatibility.

Multiple people contributed to this work over time: db@, loos@, manu@
2016-10-14 03:37:35 +00:00
Oleksandr Tymoshenko
eea6ab027a Make bcm2835_machdep.c optional
bcm2835_machdep.c contains only bits enabled by "options PLATFORM", this
option available only on ARM, not ARM64
2016-10-14 03:00:53 +00:00
Oleksandr Tymoshenko
16bacb8a2d Do not set FB_FLAG_MEMATTR if VM_MEMATTR_WRITE_COMBINING is not available
Pintyhat to: gonzo
Spotted by: jmallett
2016-10-14 01:23:21 +00:00
Oleksandr Tymoshenko
be4b107168 Fix BCM238x framebuffer driver build for ARM64
VM_MEMATTR_WRITE_COMBINING can be undefined for some platforms, use it only
if it's defined
2016-10-14 00:42:08 +00:00
Oleksandr Tymoshenko
8ff1636c1a Fix BCM283x(Raspberry Pi) SDHCI driver for ARM64 build
- Revert BUS_SPACE_PHYSADDR back to rman_get_start. BUS_SPACE_PHYSADDR was
    introduced in 2013 as temporary wrapper until proper solution appears.
    It's ARM only and since we need this file for ARM64 build and no proper
    API has been introduced - just revert the change and make sure it's
    going to appear when people grep for BUS_SPACE_PHYSADDR in sources.

- Fix printf format for size_t variables
2016-10-13 23:29:24 +00:00
Warner Losh
b2a7ac4802 Fix building on i386 and arm. But 'public domain' headers on the files
with no creative content. Include "lost" changes from git:
o Use /dev/efi instead of /dev/efidev
o Remove redundant NULL checks.

Submitted by: kib@, dim@, zbb@, emaste@
2016-10-13 06:56:23 +00:00
Oleksandr Tymoshenko
c38fb7809f INTRNG: Propagate IRQ activation error to API consumer
Keep resource state consistent with INTRNG state - if intr_activate_irq
fails - deactivate resource and propagate error to calling function

Reviewed by:	mmel
2016-10-12 17:10:59 +00:00
Oleksandr Tymoshenko
0e3cfd98fc Fix typo in comment
Spotted by: loos
2016-10-12 05:35:57 +00:00
Oleksandr Tymoshenko
43be86e31b Make BCM283x USB driver compatible with upstream DT
- Make resource allocation logic depend on compatibility string
    to check what format of DTS node should be used - FreeBSD's or upstream
2016-10-12 03:07:49 +00:00
Oleksandr Tymoshenko
aa2959bae5 Make BCM2835 GPIO driver compatible with upstream DT
- Add compatibility string
- Make reserverd and read-only properties optional
2016-10-12 03:06:05 +00:00
Oleksandr Tymoshenko
38e62ae597 Add compatibility string from upstream DT 2016-10-12 03:03:55 +00:00
Oleksandr Tymoshenko
5a715e8aa2 Make framebuffer driver compatible with upstream DT
- Add compatibility string
- Add simplebus as possible parent bus
2016-10-12 03:03:05 +00:00
Oleksandr Tymoshenko
9d6eb8bb3d Add compatible strings used in upstream dts files 2016-10-12 03:00:42 +00:00
Oleksandr Tymoshenko
511bc527ff Make sure intc is attached before interrupt consumers
If pass order is not specified devices are attached in the order they are
defined in dts. Some interrupt consumers may be defined before intc. Also
make sure intc interrupt-parent local_intc is attached before intc itself.
2016-10-12 02:58:27 +00:00
Jonathan T. Looney
bd79708dbf In the TCP stack, the hhook(9) framework provides hooks for kernel modules
to add actions that run when a TCP frame is sent or received on a TCP
session in the ESTABLISHED state. In the base tree, this functionality is
only used for the h_ertt module, which is used by the cc_cdg, cc_chd, cc_hd,
and cc_vegas congestion control modules.

Presently, we incur overhead to check for hooks each time a TCP frame is
sent or received on an ESTABLISHED TCP session.

This change adds a new compile-time option (TCP_HHOOK) to determine whether
to include the hhook(9) framework for TCP. To retain backwards
compatibility, I added the TCP_HHOOK option to every configuration file that
already defined "options INET". (Therefore, this patch introduces no
functional change. In order to see a functional difference, you need to
compile a custom kernel without the TCP_HHOOK option.) This change will
allow users to easily exclude this functionality from their kernel, should
they wish to do so.

Note that any users who use a custom kernel configuration and use one of the
congestion control modules listed above will need to add the TCP_HHOOK
option to their kernel configuration.

Reviewed by:	rrs, lstewart, hiren (previous version), sjg (makefiles only)
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D8185
2016-10-12 02:16:42 +00:00
Oleksandr Tymoshenko
58a3e50de6 Make Rapsberry Pi watchdog driver compatible with upstream DTS
- Fix compatibility strings
- Compensate the difference in base address for our custom DTS and
    upstream one (for backward compatibility)
2016-10-11 21:40:15 +00:00
Oleksandr Tymoshenko
98884a9ea9 Make intc driver compatible with upstream DTS
- Fix compatibility strings
- Properly decode upstream's two-cell interrupt specs. Our home-made dts
    does not have two-cell interrupts so no need to preserve backward
    compatibility
2016-10-11 21:37:34 +00:00
Michal Meloun
c7264b2dfa ARM: Remove unused includes.
MFC after: 1 week
2016-10-09 10:25:47 +00:00
Michal Meloun
ba0bb20635 ARM: Split identify_arm_cpu() into ARMv4 and ARMv6 variant.
On ARMv6, be more verbose about supported CPU features and/or
optional instructions.
2016-10-09 10:24:10 +00:00
Oleksandr Tymoshenko
6dcc1178c4 Fix release MSI method for ARM GIC 2016-10-09 04:37:21 +00:00
Oleksandr Tymoshenko
5031b2a018 Fix release MSI method for NVidia Tegra PCI controller 2016-10-09 04:36:40 +00:00