Commit Graph

39 Commits

Author SHA1 Message Date
John Baldwin
a3b866cb29 arm mv: Remove unused devclass arguments to DRIVER_MODULE. 2022-05-09 14:26:45 -07:00
Warner Losh
b20f0f7247 mv_rtc_attach: eliminate write only unit variable
Sponsored by:		Netflix
2022-04-04 22:29:13 -06:00
Mateusz Guzik
654548838b arm: clean up empty lines in .c and .h files 2020-09-01 21:17:24 +00:00
Michal Meloun
d5d4dd38b4 Add specific stub for ARMADA 8k SoC to Marvell RTC driver.
The AXI bridge is different between ARMADA 38x and 8K, and both platforms
needs specific setup to mitigate HW issues with accessing RTC registers.

MFC after:	2 weeks
2020-06-19 15:32:55 +00:00
Andrew Turner
e4c66ddabd Remove IPI_IRQ_START and IPI_IRQ_END from the arm kernel config files.
These are unneeded with INTRNG.
2018-07-28 06:46:10 +00:00
Marcin Wojtas
ccc1e6eb49 Use PLATFORM for initializing Marvell ArmadaXP and Armada38X
Spliting armv5 and armv7 machdep is necessary for adding Armada38X and
ArmadaXP to GENERIC config.
PLATFORM framework checks SOC type in FDT and will select proper
initialization function implementation during runtime.
Pointers to SoC specific implementation are stored in array of
platform_method_t and provided to framework by FDT_PLATFORM_DEF macro.
PLATFORM framework supports also reset function. To simplify implementation
cpu_reset is moved from mv_common to armv5 and armv7 machdep.

Armada38X and ArmadaXP share now common list of files, so resolve all
dependencies as well.

Submitted by: Rafal Kozik <rk@semihalf.com>
	      Marcin Wojtas <mw@semihalf.com>
Reviewed by: mw
Obtained from: Semihalf
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D14744
2018-04-04 08:40:49 +00:00
Marcin Wojtas
526de79be2 Make get_tclk and get_cpu_freq generic for Marvell armv7 SoCs
In GENERIC kernel choosing proper get_tclk and get_cpu_freq implementation must
be done in runtime. Kernel for both SoC need to have implementation of each
other functions, so common file list mv/files.arm7 is added.
Marvell armv5 SoC have their own non-generic implementation of those function.

Submitted by: Rafal Kozik <rk@semihalf.com>
Obtained from: Semihalf
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D14739
2018-04-03 22:10:50 +00:00
Marcin Wojtas
0a57279ba4 Split get_sar_value function for Marvell ArmadaXP and Armada38X
get_sar_value is implemented only for ArmadaXP and Armada38X. Splitting it for
two different functions and change registers names result in more generic code.

Submitted by: Rafal Kozik <rk@semihalf.com>
Reviewed by: andrew
Obtained from: Semihalf
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D14736
2018-04-03 21:38:11 +00:00
Ruslan Bukin
5823f6fb29 o Move sdhci_fdt to the generic files list.
o Include Qualcomm EHCI and UART drivers to the build.

Sponsored by:	DARPA, AFRL
2018-01-25 17:16:29 +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
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
Marcin Wojtas
ee1c891dbc Add Armada 80x0/70x0 compatible to 38x RTC driver
Marvell Armada 80x0/70x0 SoC family uses same RTC IP as Armada 38x.
This patch adds Armada 8k compatible to Marvell RTC driver.

Submitted by: Rafal Kozik <rk@semihalf.com>
Obtained from: Semihalf
Sponsored by: Semihalf
Differential Revision: https://reviews.freebsd.org/D12186
2017-09-05 05:45:57 +00:00
Marcin Wojtas
cb0c98fce0 Change name of Marvell Armada38x RTC driver
Two modules with the same name cannot be loaded, so Marvell specific drivers
cannot have the same name as generic drivers.
Files with the same name, even in different folder overlaps their .o files.
Change armada38x/rtc.c to armada38x/armada38x_rtc.c fix it.
Preparation for adding this driver to GENERIC config for ARMv7
Marvell platforms.

Submitted by: Rafal Kozik <rk@semihalf.com>
Obtained from: Semihalf
Sponsored by: Semihalf
Differential Revision: https://reviews.freebsd.org/D12185
2017-09-05 05:42:37 +00:00
Marcin Wojtas
75b2aa51b4 Enable pl310 coherent operation in platform init for Armada 38x
Updating PL310 sotfware context sc_io_coherent field in
platform_pl310_init() routine for Armada 38x helps to avoid
using 'arm,io-coherent' property, which is by default not present
in the device tree node in Linux.

This way another step for DT unification between two operating
systems is done. The improvemnt will also work after enabling
PLATFORM for Marvell ARMv7 SoCs.

Reviewed by: andrew, cognet (mentor)
Approved by: cognet (mentor)
Obtained from: Semihalf
Differential Revision: https://reviews.freebsd.org/D11883
2017-08-09 01:25:47 +00:00
Zbigniew Bodek
11a6a330c8 Enhance Armada 38x SoC identification string
Add hw_clockrate and CPU frequency, basing on sample-at-reset
configuration.

Submitted by:	Arnaud Ysmal <arnaud.ysmal@stormshield.eu>
		Marcin Wojtas <mw@semihalf.com>
Obtained from: Stormshield, Semihalf
Sponsored by: Stormshield
Reviewed by: andrew
Differential revision: https://reviews.freebsd.org/D10899
2017-06-16 17:18:29 +00:00
Zbigniew Bodek
dc3b75aeef Enable MBUS bridge configuration in mv_rtc driver
This patch fixes sporadic problems with updating time
with mv_rtc driver by configuring access to it via MBUS.
For this purpose already existing second set of resources
in rtc@3800 node of Armada 38x DT is used.

Submitted by: Dominik Ermel <der@semihalf.com>
Obtained from: Semihalf
Sponsored by: Stormshield
Differential revision: https://reviews.freebsd.org/D10901
2017-06-08 16:48:09 +00:00
Zbigniew Bodek
054beaac09 Add reset capability to mv_rtc driver
This commit enables optional reset of the RTC, in case
its registers' contents did not sustain the reboot or power-off/on
sequence. Without it, further usage of RTC is impossible
(e.g. writing values to RTC_TIME register will not succeed).

The reset is performed only if Clock Correction register
does not comprise RTC_NOMINAL_TIMING, what helps to distinguish,
whether the software configured RTC before or it comprises
the default value.

Submitted by: Bartosz Szczepanek <bsz@semihalf.com>
Obtained from: Semihalf
Sponsored by: Stormshield
Differential revision: https://reviews.freebsd.org/D10900
2017-06-08 16:46:38 +00:00
Zbigniew Bodek
92ce47d94e Introduce separate watchdog driver for Armada to fix phony DELAY
DELAY is a problematic routine called all over the kernel.
Armada38x using CA-9 CPUs are using mpcore timer to count events
and measure time but DELAY in the mpcore timer code is a weak
function reference and therefore will be replaced by the platform
implementation if the one is introduced. Since Armada38x uses
on-chip watchdog to which the driver is merged with the on-chip timer
driver there will be a platform DELAY implementation.
The latter however will not use any HW timers as it will not attempt
to configure any. Phony busy loop will be used instead.

To fix that we introduce a separate watchdog driver for Armada platforms,
(currently only A38X) and stop using Marvell timer driver. That
switches DELAY to the desired implementation.

Submitted by: Zbigniew Bodek <zbb@semihalf.com>
Obtained from: Semihalf
Sponsored by: Stormshield
Differential revision: https://reviews.freebsd.org/D10710
2017-05-25 14:22:00 +00:00
Zbigniew Bodek
bb98396b47 Enable SCU Speculative linefills to L2 on Armada 38x
Submitted by: Marcin Wojtas <mw@semihalf.com>
Obtained from: Semihalf
Sponsored by: Stormshield
Differential revision: https://reviews.freebsd.org/D10709
2017-05-25 14:19:20 +00:00
Wojciech Macek
22a752b482 Fix boot up on ARMADA38X uniprocessor variant
Marvell Armada 380 is a uni-processor variant of the 38x SoC
family. A function platform_mp_setmaxid() was setting a hardcoded
value, which caused boot fail on A380. Fix this by relying on
the CPU count obtained from device tree nodes.

Submitted by:  Marcin Wojtas <mw@semihalf.com
Obtained from: Semihalf
Sponsored by:  Netgate
Reviewed by:   loos
Differential revision: https://reviews.freebsd.org/D10783
2017-05-19 08:26:41 +00:00
Luiz Otavio O Souza
018101a836 Add the Marvell SDHCI controller to the list of supported devices in
sdhci_fdt.

Enable the SDHCI controller, bus and devices on ARMADA38X kernel.

Tested on:	ClearFog Pro
Reviewed by:	Marcin Wojtas <mw at semihalf.com>
Sponsored by:	Rubicon Communications, LLC (Netgate)
Differential Revision:	https://reviews.freebsd.org/D10606
2017-05-16 05:10:15 +00:00
Zbigniew Bodek
2fcf414549 Optimize Armada38x low-level MBUS settings
Add early init handler, which comprises various internal
bus optimisations for Armada 38x SoC's. Magic values used
due to undocumented registers.

Submitted by:	Marcin Wojtas <mw@semihalf.com>,
		Arnaud Ysmal <arnaud.ysmal@stormshield.eu>
Obtained from: Semihalf, Stormshield
Sponsored by: Stormshield
Differential revision: https://reviews.freebsd.org/D10219
2017-04-18 10:39:14 +00:00
Zbigniew Bodek
06918748e5 Add PL310 platform initialization for Armada 38x
Introduce machine-dependent part of the arm/pl310 driver for
Armada 38x SoCs. Add prefetch and power savings configuration.

Submitted by: <arnaud.ysmal@stormshield.eu>
Obtained from: Stormshield
Sponsored by: Stormshield
Differential revision: https://reviews.freebsd.org/D10220
2017-04-18 10:32:21 +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
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
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
Wojciech Macek
ca8e20784a Make MPIC compatible with ARM_INTRNG
After ARM_INTRNG introduction, MPIC code needed several modifications:
- IRQ resource and its handler added
-  several DEVMETHODs of INTRNG interface implemented
-  defines enhanced to ensure code compiles as well for AXP as for A38X
- added dummy MSI_IRQ, ERR_IRQ defines for Armada38x
- MPIC driver was added to files.armada38x, ARM_INTRNG option enabled in
  kernconf file and regs of MPIC corrected in dts file.

Instead of modifying Armada38X DTS, offsets to CPU registers defined in
driver were changed. That required restoring 'reg' property of mpic node
in ArmadaXP to state compliant with Linux DTS.

Additionally, required ARM_INTRNG definitions were added to mv_common.c.

Submitted by:          Bartosz Szczepanek <bsz@semihalf.com>
Obtained from:         Semihalf
Sponsored by:          Stormshield
Reviewed by:           adrian, andrew, ian, skra
Approved by:           cognet (mentor)
Differential Revision: https://reviews.freebsd.org/D5030
2016-03-14 07:05:41 +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
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
Zbigniew Bodek
ec22b42afb Introduce initial driver for PMSU on Armada38x
This is a stub for PMSU driver. Note that it cannot be used to set the
secondary core boot address during attach because drivers are attached
later than SI_SUB_CPU sysinit where cores are started.
Setting the boot address should be done manually in platform_mp_start_ap().

SMP is working fine with this commit and was enabled in Armada38x kernel
configuration file.

Obtained from:	Semihalf
Sponsored by:	Stormshield
Submitted by:	Michal Stanek <mst@semihalf.com>
Differential revision:  https://reviews.freebsd.org/D4427
2016-01-20 14:49:16 +00:00
Zbigniew Bodek
00ad2ec864 Add initial support for SMP on Armada38x
- Add file sys/arm/mv/armada38x/armada38x_mp.c
- Set mp_maxid and mp_ncpus based on FDT unless SCU register indicates
  only one core
- Boot CPU1 in platform_mp_start_ap()
- IPI range defined

Obtained from:  Semihalf
Sponsored by:   Stormshield
Submitted by:   Michal Stanek <mst@semihalf.com>
Differential revision:  https://reviews.freebsd.org/D4426
2016-01-20 14:45:54 +00:00
Zbigniew Bodek
46c9254b05 Open window to bootROM memory on Armada38x to allow CPU1 to boot
CPU1 is halted in bootROM code while it is waiting to be released.
Memory window to bootROM must be opened before booting the core.

Obtained from:  Semihalf
Sponsored by:   Stormshield
Submitted by:   Michal Stanek <mst@semihalf.com>
Differential revision:  https://reviews.freebsd.org/D4425
2016-01-20 14:30:17 +00:00
Zbigniew Bodek
e7a6ec97db Add a new RTC driver for Armada38x
New driver registers RTC as system clock. New RTC resolution is 1 sec.
Settime and gettime functions were implemented.

Reviewed by:    andrew, ian
Obtained from:  Semihalf
Sponsored by:   Stormshield
Submitted by:   Jan Dabros <jsd@semihalf.com>
Differential revision:  https://reviews.freebsd.org/D4421
2016-01-20 14:18:49 +00:00
Zbigniew Bodek
223e0cfd9a Enable SCU unit for Armada38x
Valid SCU operation is necessary for SMP interoperability.
Initialization function armada38x_enable_scu() was added.

Reviewed by:    andrew, ian
Obtained from:  Semihalf
Sponsored by:   Stormshield
Submitted by:   Bartosz Szczepanek <bsz@semihalf.com>
Differential revision:  https://reviews.freebsd.org/D4220
2016-01-20 13:55:51 +00:00
Zbigniew Bodek
5b683b6fc5 Set IO Sync Barrier flags for all Mbus devices on Armada38x
IO Sync Barrier setting is required for I/O coherency.

Reviewed by:   andrew, ian, imp
Obtained from: Semihalf
Sponsored by:  Stormshield
Submitted by:  Michal Stanek <mst@semihalf.com>
Differential revision:  https://reviews.freebsd.org/D4219
2016-01-20 13:53:33 +00:00
Zbigniew Bodek
f8742b0da3 Introduce initial support for Marvell Armada38x
This commit introduces initial support for Marvell Armada38x platform.
Changes:
- Add common DTS files for Armada38x SoCs and DTS file for A388-GP
- Add ARMADA38X kernel configuration
- Add option SOC_MV_ARMADA38X and set MV_PCI_PORTS
- Add list of files to compile
- Implement get_tclk(), get_sar_value(), cpu_reset() functions
- Add CPU ID and SoC numbers
- Correct ifdefs in arm/mv/timer.c

Reviewed by:    ian, imp
Obtained from:  Semihalf
Sponsored by:   Stormshield
Submitted by:   Michal Stanek <mst@semihalf.com>
Differential revision:  https://reviews.freebsd.org/D4210
2016-01-20 13:14:36 +00:00