Commit Graph

193 Commits

Author SHA1 Message Date
Andrew Turner
15147f076e Remove an unused include. 2016-02-14 16:38:32 +00:00
Andrew Turner
ee211e0268 Stop adding an extra null terminator to strings, OF_getprop already returns
a null terminated string.
2016-02-12 17:04:03 +00:00
Andrew Turner
647a3bac7e Stop defining fdt_pic_table when building for ARM_INTRNG. 2016-02-11 11:49:27 +00:00
Michal Meloun
a89156f53f ARM: Use new ARMv6 naming conventions for cache and TLB functions
in all but ARMv4 specific files.
Expand ARMv6 compatibility stubs in cpu-v4.h. Use physical address
in L2 cache functions if ARM_L2_PIPT is defined.
2016-02-05 14:57:41 +00:00
Svatopluk Kraus
e81df52303 Remove all remaining references to old and not more used struct
pmap_devmap, pmap_devmap_bootstrap() and pmap_devmap[]. It was
replaced in r257660.
2016-02-02 10:32:45 +00:00
Svatopluk Kraus
231ccab8e7 Remove not needed <machine/pte.h> includes. 2016-02-01 19:36:33 +00:00
Michal Meloun
ebda969939 ARM: Rename remaining instances of cpufunc_id() to cpu_ident(),
forgotten in r295096.
Remove tlb_flushI/tlb_flushI_SE functions forgotten in r295122.
2016-02-01 14:28:58 +00:00
Justin Hibbits
2dd1bdf183 Convert rman to use rman_res_t instead of u_long
Summary:
Migrate to using the semi-opaque type rman_res_t to specify rman resources.  For
now, this is still compatible with u_long.

This is step one in migrating rman to use uintmax_t for resources instead of
u_long.

Going forward, this could feasibly be used to specify architecture-specific
definitions of resource ranges, rather than baking a specific integer type into
the API.

This change has been broken out to facilitate MFC'ing drivers back to 10 without
breaking ABI.

Reviewed By: jhb
Sponsored by:	Alex Perez/Inertial Computing
Differential Revision: https://reviews.freebsd.org/D5075
2016-01-27 02:23:54 +00:00
Andrew Turner
026ffbb8ed Remove an extra '!' found by clang 3.8. 2016-01-21 16:42:52 +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
a695f1c97f Support watchdog depending on "mrvl,has-wdt" property
With this commit, watchdog is supported only in case of having
"mrvl,has-wdt" property or dedicated for watchdog compatibility field
("marvell,armada-380-wdt"). There is no need to modify dts files,
as "has-wdt" property already exists.

Obtained from:  Semihalf
Sponsored by:   Stormshield
Submitted by:   Bartosz Szczepanek <bsz@semihalf.com>
Differential revision:  https://reviews.freebsd.org/D4424
2016-01-20 14:28:05 +00:00
Zbigniew Bodek
786e3fea32 Add support for watchdog on Armada38x
A38X watchdog support was implemented in sys/arm/mv/timer.c driver.
It required following modifications:
- add "marvell,armada-380-wdt" compatibility, which supports only watchdog
- correct and enhance definitions related to timer control register
- unmask reset capability in RSTOUTn_MASK register
- use dedicated watchdog timer on A38X instead of second timer

Obtained from:  Semihalf
Sponsored by:   Stormshield
Submitted by:   Bartosz Szczepanek <bsz@semihalf.com>
Differential revision:  https://reviews.freebsd.org/D4423
2016-01-20 14:23:57 +00:00
Zbigniew Bodek
a4ee1a8e13 Add support for I2C on Armada38x
Extend driver's compatible strings' table
and enable I2C compilation in kernconf.

Reviewed by:    andrew, ian
Obtained from:  Semihalf
Sponsored by:   Stormshield
Submitted by:   Jan Dabros <jsd@semihalf.com>
Differential revision:  https://reviews.freebsd.org/D4422
2016-01-20 14:21:06 +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
e34c3bf23b Correct MV_DDR_CADR_BASE definiton in mvwin.h
SOC_MV_ARMADAXP ifdef was enhanced with SOC_MV_ARMADA38X,
correcting MV_DDR_CADR_BASE definition. It fixes PCIe hangs issue.

Reviewed by:    andrew
Obtained from:  Semihalf
Sponsored by:   Stormshield
Submitted by:   Bartosz Szczepanek <bsz@semihalf.com>
Differential revision:  https://reviews.freebsd.org/D4380
2016-01-20 14:16:13 +00:00
Zbigniew Bodek
5afccf3680 Improve definitions of CPU/PCIe windows for Armada38x
Enhance existing ARMADAXP defines and introduce new MV_WIN_PCIE_
definitions.

Reviewed by:    andrew
Obtained from:  Semihalf
Sponsored by:   Stormshield
Submitted by:   Bartosz Szczepanek <bsz@semihalf.com>
Differential revision:  https://reviews.freebsd.org/D4378
2016-01-20 14:10:00 +00:00
Zbigniew Bodek
1e92574faa Fix invalid root link detection in mv_pci driver
mv_pci driver omitted slot 0, which can be valid device on Armada38x.
New mechanism detects if device is root link, basing on vendor's
and device's IDs.
It is restricted to Armada38x; on other machines, behaviour remains
the same.

Reviewed by:    andrew
Obtained from:  Semihalf
Sponsored by:   Stormshield
Submitted by:   Bartosz Szczepanek <bsz@semihalf.com>
Differential revision:  https://reviews.freebsd.org/D4377
2016-01-20 14:05:21 +00:00
Zbigniew Bodek
515af5ce4e Enhance remap capabilities for Armada38x
Add conditions corresponding to Armada38x-based SoCs,
enhancing their remap capabilities.
This is required for PCIe to work properly.

Reviewed by:    andrew
Obtained from:  Semihalf
Sponsored by:   Stormshield
Submitted by:   Bartosz Szczepanek <bsz@semihalf.com>
Differential revision:  https://reviews.freebsd.org/D4376
2016-01-20 14:02:36 +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
81c8a263d6 Use GIC-specific decoding function in mv_common.c
Add gic_decode_fdt function to fdt_pic_table, allowing to recognize GIC
interrupts on Armada38x. SOC_MV_ARMADA38X ifdef is required because A38X
is the only Marvell's platform in FreeBSD using GIC; lack of ifdef would
lead to linking errors on other platforms.

Reviewed by:    andrew, ian, imp
Obtained from:  Semihalf
Sponsored by:   Stormshield
Submitted by:   Michal Stanek <mst@semihalf.com>
Differential revision:  https://reviews.freebsd.org/D4214
2016-01-20 13:42:54 +00:00
Zbigniew Bodek
b2ea73e3bb Do not require strict compatibility on simplebus
Strict compatibility requirement is a root of problems when simplebus'
node has two compatibility strings (i.e. on Armada38x). Removing this
requirement should not interfere with other platforms.

fdt_is_compatible_strict() and fdt_find_compatible() calls were changed
in fdt_common.c and mv_common.c.

Reviewed by:    ian, imp
Obtained from:	Semihalf
Sponsored by:	Stormshield
Submitted by:	Bartosz Szczepanek <bsz@semihalf.com>
Differential revision:  https://reviews.freebsd.org/D4602
2016-01-20 13:35:06 +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
Zbigniew Bodek
fa85e32f0c Mark gpio as "optional" in files.mv and edit Marvell's kernconfs
Including arm/mv/gpio.c now depends on 'gpio' device. 'device gpio' was
added to all kernconf files of Marvell boards, except ARMADAXP (dummy
mv_gpio_res definition was removed) and ARMADA38X (not supported yet).

This commit allows to use generic files.mv on A38X.

Reviewed by:    andrew
Obtained from:	Semihalf
Sponsored by:	Stormshield
Submitted by:	Bartosz Szczepanek <bsz@semihalf.com>
Differential revision:	https://reviews.freebsd.org/D4372
2016-01-20 11:57:11 +00:00
Andrew Turner
7c570e8bb1 Remove the arm KERNPHYSADDR option as it is no longer used. The make
option is still in existance as it is used to build the trampoline code.
2015-12-22 09:08:21 +00:00
Ian Lepore
bfb14e93a2 Change KERNVIRTADDR to 0xc0000000 since the low-order bits no longer need to
match the physical load address.  Remove the *PHYSADDR symbols which are no
longer necessary.

Also remove a bunch of comments, most of which which have been wrong for
quite some time now, and the rest of which are mooted by these changes.  All
that's left in this file is assigning a single symbol to its cannonical
value, not much to comment on anymore.
2015-12-20 23:38:14 +00:00
Andrew Turner
210d6af74d Move more bus_space_* files to be built by files.arm. This leaves the
definition in a file.* file under sys/arm/arm in the few cases we need it
for non-fdt platforms.

Sponsored by:	ABT Systems Ltd
2015-11-21 15:30:08 +00:00
Andrew Turner
aeef645f92 Stop setting {KERN,}PHYSADDR on armv6, it's unneeded.
Sponsored by:	ABT Systems Ltd
2015-11-20 16:12:22 +00:00
Tijl Coosemans
27f38a8d69 Since r289279 bufinit() uses mp_ncpus, but some architectures set this
variable during mp_start() which is too late.  Move this to mp_setmaxid()
where other architectures set it and move x86 assertions to MI code.

Reviewed by:	kib (x86 part)
2015-11-08 14:26:50 +00:00
Ian Lepore
9a74ac77b8 Fix a strange macro re-definition compile error. If the VM_MAXUSER_ADDRESS
value is defined as a config option the definition is emitted into
opt_global.h which is force-included into everything.  In addition, the
symbol is emitted by the genassym mechanism, but that by its nature reduces
the value to a 0xnnnnnnnn number.  When compiling a .S file you end up
with two different definitions of the macro (they evaluate to the same
number, but the text is different, upsetting the compiler).

Nothing has changed about this code for a while but the compile error is
new, so this must be fallout from the clang 3.7 update or something.
2015-10-18 01:03:43 +00:00
Andrew Turner
17fb49c1e4 An IPI must be cleared before it is handled otherwise next IPI could be
missed. In other words, if a new request for an IPI is sent while the
previous request is being handled but the IPI is not cleared yet, the
clearing of the previous IPI request also clears the new one and the
handling is missed.

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

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

Submitted by:	Svatopluk Kraus <onwahe@gmail.com>
Reviewed by:	loos, kib
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D3722
2015-10-01 12:09:05 +00:00
Andrew Turner
087af50ab8 Include vm/pmap.h for pmap_kextract. 2015-04-04 23:03:11 +00:00
Andrew Turner
7defa9a75c Move the definition of fdt_localbus_devmap to a Marvell specific file as
it's only used there.
2015-04-04 22:05:43 +00:00
Andrew Turner
ff3b52bb19 Stop using machine/fdt.h in the arm kernel code when we don't need it. 2015-04-04 21:34:26 +00:00
Andrew Turner
0ebebb1260 Build the cpufunc_asm_* files based on the cpu type, not which config file
we happen to be building.
2015-03-29 22:43:39 +00:00
Andrew Turner
745202c280 We don't use cpufunc_asm_armv5.S in any of these configs, remove it. 2015-03-29 18:41:43 +00:00
Ian Lepore
16b2a62ec4 Use pmap_mapdev()/unmapdev() to temporarily map on-chip sram while copying
the startup trampoline code.  The old code allocated a kva page, mapped it
using using pmap_kenter_nocache(), then freed the kva without destroying
the mapping.  This is the only use of pmap_kenter_nocache() in the system,
so redoing this one use of allows it to be garbage collected in the
near future.
2015-03-26 19:33:07 +00:00
Alexander Motin
cdc5836726 Remove from legacy ata(4) driver support for hardware, supported by newer
and more functional drivers ahci(4), siis(4) and mvs(4).

This removes about 3400 lines of code, unused since FreeBSD 9.0 release.
2015-03-24 18:09:07 +00:00
Ian Lepore
eb8711ce16 Rename bus_space-v6.c to bus_space_base.c, because it's not v6-specific
and now some v5 Marvell systems are using it.  Only define fdt_bus_tag
if option FDT is defined.
2015-01-21 03:44:29 +00:00
Ian Lepore
a23e40a761 The mv/bus_space.c file is essentially identical to arm/bus_space-v6.c,
so just use it.
2015-01-21 03:22:37 +00:00
Ian Lepore
110e70ba1d For some reason, all the arm bus_space functions that work with uint16
values have armv4 in the name.  There's nothing armv4-special about them,
so just use the same sort of names as all the other functions.
2015-01-21 02:56:13 +00:00
Ian Lepore
67009184e3 Remove -Wa,-march=armv7a from arm kernel configs, it makes clang 3.5 sad
and apparently isn't needed now that we're using the integrated assembler.
2015-01-01 23:21:46 +00:00
Andrew Turner
ed600fa777 Rename pic_ipi_get to pic_ipi_read for intrng. 2014-12-24 15:25:18 +00:00
Ian Lepore
88b80af731 Add -march=armv7a to the kernel compile for all ARM systems which are v7a.
Submitted by:	Michal Meloun <meloun@miracle.cz>
2014-12-21 23:48:32 +00:00
Ruslan Bukin
dd279f7aaa Fix typo. 2014-12-15 12:15:18 +00:00
Ruslan Bukin
1f7f3314d1 Follow r275792 eliminating fdt_data_verify(). 2014-12-15 11:57:39 +00:00
Zbigniew Bodek
8948956770 Fix buffer overflow in Marvell PCI/PCIe driver
Buffer overflow occured when more than one MSI was allocated.

Submitted by:    Wojciech Macek <wma@semihalf.com>
Obtained from:   Semihalf
2014-12-07 21:02:45 +00:00
Warner Losh
40e6bdaf1e opt_global.h is included automatically in the build. No need to
explicitly include it in these places.

Sponsored by: Netflix
2014-11-18 17:06:56 +00:00