Commit Graph

75 Commits

Author SHA1 Message Date
Emmanuel Vadot
d597cfd520 Fix build when option MMCCAM is defined. 2018-03-08 22:49:36 +00:00
Konstantin Belousov
2c0f13aa59 vm_wait() rework.
Make vm_wait() take the vm_object argument which specifies the domain
set to wait for the min condition pass.  If there is no object
associated with the wait, use curthread' policy domainset.  The
mechanics of the wait in vm_wait() and vm_wait_domain() is supplied by
the new helper vm_wait_doms(), which directly takes the bitmask of the
domains to wait for passing min condition.

Eliminate pagedaemon_wait().  vm_domain_clear() handles the same
operations.

Eliminate VM_WAIT and VM_WAITPFAULT macros, the direct functions calls
are enough.

Eliminate several control state variables from vm_domain, unneeded
after the vm_wait() conversion.

Scetched and reviewed by:	jeff
Tested by:	pho
Sponsored by:	The FreeBSD Foundation, Mellanox Technologies
Differential revision:	https://reviews.freebsd.org/D14384
2018-02-20 10:13:13 +00:00
Michal Meloun
f8759facd2 Convert extres/phy to kobj model.
Similarly as other extres pseudo-drivers, implement phy by using kobj model.
This detaches it from provider device, so single device driver can export
multiple different phys. Additionally, this  allows phy to be subclassed to
more specialized drivers, like is USB OTG phy, or PCIe phy with hot-plug
capability.

Tested by:	manu (previous version, on Allwinner board)
MFC after:	1 month
2018-01-20 17:02:17 +00:00
Ian Lepore
2d09b07279 Make kernel option KERNVIRTADDR optional, remove it from std.<platform>
files that can use the default value.

It used to be required that the low-order bits of KERNVIRTADDR matched
the low-order bits of the physical load address for all arm platforms.
That hasn't been a requirement for armv6 platforms since FreeBSD 10.
There is no longer any relationship between load addr and KERNVIRTADDR
except that both must be aligned to a 2 MiB boundary.

This change makes the default KERNVIRTADDR value 0xc0000000, and removes the
options from all the platforms that can use the default value.  The default
is now defined in vmparam.h, and that file is now included in a few new
places that reference KERNVIRTADDR, since it may not come in via the
forced-include of opt_global.h on the compile command line.
2017-12-30 00:20:49 +00:00
Emmanuel Vadot
ee070097f2 Revert r327250 as it broke the build for some armv6 kernel and all armv4/5
Reported by:	ian
2017-12-28 07:31:14 +00:00
Emmanuel Vadot
d06955f9bd arm: Add kern/kern_clocksource.c to files.arm
Instead of adding it to every files.vendor, add it to the common arch file.
2017-12-27 21:39:57 +00:00
Emmanuel Vadot
59c4192cd3 tegra: Do not define early printf function
Since tegra is now in GENERIC, do not enable the early printf
function as it can conflict with others.
2017-10-19 20:52:17 +00:00
Warner Losh
094fc1ed0f Tag all armv7 kernels as such in their machine config line.
Transition all boards that support arm cortex CPUs to armv7. This
leaves two armv6 kernels in the tree. RPI-B, which uses the BCM2835
which has a ARM1176 core, and VERSATILEPB, which is a qemu board setup
around the time RPI-B went in. Copy std.armv6 to std.armv7, even
though that duplicates a lot of stuff. More work needs to be done to
sort out the duplication.

Differential Revision: https://reviews.freebsd.org/D12027
2017-10-05 23:01:50 +00:00
Ian Lepore
74eb18b6cc Define a single instance of ahci_devclass and reference it from all the
attachment code for various SOCs and busses.  Remove all the static and
should-have-been-static and named-differently instances of it.

This should eliminate the recently-grown build warnings about multiple
definitions when building arm kernels.
2017-10-02 02:58:28 +00:00
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Oleksandr Tymoshenko
5031b2a018 Fix release MSI method for NVidia Tegra PCI controller 2016-10-09 04:36:40 +00:00
Oleksandr Tymoshenko
de2929fff0 Fix MSI allocation for NVidia Tegra
- Fix range check
- Due to checking found value in for(;;) condition irq after loop was
    always + 1 from actually found slot and wrong entry was marked as
    used which lead to returning slot 0 for all requests.
2016-10-09 04:29:42 +00:00
Michal Meloun
7cc70732a3 ARM: SEV/WFE instructions are implemented starting from ARMv6K,
use it directly.

MFC after: 1 week
2016-10-06 13:18:18 +00:00
Andrew Turner
1834282de6 Split CPU_CORTEXA into CPU_CORTEXA8, for the Cortex-A8, and CPU_CORTEXA_MP,
for later Cortex-A CPUs that support the Multiprocessor Extensions. This
will be needed to support both in a single GENERIC kernel while still
being able to only build for a single SoC.

Reviewed by:	mmel
Relnotes:	yes
Sponsored by:	ABT Systems Ltd
Differential Revision:	https://reviews.freebsd.org/D8138
2016-10-04 12:25:44 +00:00
Michal Meloun
c7533311be TEGRA: Fix PCIe link timeout.
MFC after: 2 weeks
2016-10-04 09:14:48 +00:00
Michal Meloun
a7b380d7d6 TEGRA: Fix bindings for cpufreq and coretemp drivers,
it was broken in r306477.
Correct a description for coretemp driver.
2016-10-01 06:50:16 +00:00
Michal Meloun
a27852480c TEGRA: Extend timeout for PLLs lock to 5 ms. Real lock time for PLLA
has been very near to old limit.
2016-10-01 03:35:03 +00:00
Michal Meloun
4bda238a9b TEGRA: Prepare Tegra subtree for inclusion into ARM generic kernel.
- use DEFINE_CLASS_0() for driver classes
 - unify driver names
 - cleanup driver definitions and bindings
2016-09-30 05:25:15 +00:00
Michal Meloun
1d59a5bb1b TEGRA: Rename (cut & pasted) genahci to tegra_ahci. Make device class definition static. 2016-09-29 13:54:09 +00:00
Michal Meloun
114abe7615 TEGRA: Return back kern_clocksource.c into tegra config file. It was removed in r306444 by mistake. 2016-09-29 12:54:27 +00:00
Michal Meloun
ef3639e852 TEGRA: Don't include files already included by system or arch configs. 2016-09-29 12:25:04 +00:00
Michal Meloun
92fa5c23d9 TEGRA: Add support for MULTIDELAY option. 2016-09-29 11:13:51 +00:00
Oleksandr Tymoshenko
ee484d5bd3 Update PCI driver to match new dts tree
In new dts tree phy is a property of port, not the controller node, also
the name was changed from "pcie" to "pcie-0"
2016-09-25 23:48:15 +00:00
Oleksandr Tymoshenko
23ea1f2b1d Update AHCI driver to match new dts tree
phy name parameter was changed from "sata-phy" to "sata-0" in new dts tree
introduced in r306197
2016-09-25 23:45:49 +00:00
Andrew Turner
0a4c0732a9 Restrict where we need to define fdt_fixup_table to just PowerPC and
Marvell.

Sponsored by:	ABT Systems Ltd
2016-09-23 14:11:23 +00:00
Andrew Turner
0dbb8873c8 Move cpu_reset to be a platform method to allow multiple implementations.
Reviewed by:	mmel
Sponsored by:	ABT Systems Ltd
Differential Revision:	https://reviews.freebsd.org/D8010
2016-09-23 13:08:15 +00:00
Andrew Turner
c35b5d8372 Remove bus_dma_get_range and bus_dma_get_range_nb on armv6. We only need
this on a few earlier arm SoCs.

Reviewed by:	manu (earlier version)
Sponsored by:	ABT Systems Ltd
2016-09-23 12:38:05 +00:00