Commit Graph

37 Commits

Author SHA1 Message Date
Kyle Evans
850dd7e9cd arm: add SOC_BRCM_BCM2837 option, include it in GENERIC
We use armv7/GENERIC for the RPI2 images. The original RPI2 is actually a
32-bit BCM2836, but v1.2 was upgraded to the 64-bit BCM2837. The project
continues to provide the RPI2 image as armv7, as it's the lowest common
denominator of the two. Historically, we've just kind of implicitly
acknowledged this by including some bcm2837 bits on a SOC_BCM2836 kernel
config -- this worked until r354875 added code that actually cared.

Acknowledge formally that BCM2837 is valid in arm32.

This name is inconsistent with the other BCM* SOC on !arm64 for two reasons:

1. It's a pre-existing option on arm64, and
2. the naming convention on arm/ should've arguably changed to include BRCM

#1 seems to be a convincing enough argument to maintain the existing name
for it.
2019-12-17 23:01:37 +00:00
Oleksandr Tymoshenko
adcd95974d [rpi] Fix compatiblity with upstream DTB for RPi 3B and 3B+
Upstream dtb switched to using brcm,bcm2837 for platform
compatibility string. Patch platfrom and cpufreq compatiblity
data accordingly.

Submitted by:	Sylvain Garrigues <sylgar@gmail.com>
Tested by:	db@
Differential Revision:	https://reviews.freebsd.org/D15998
2018-06-24 23:19:31 +00:00
Oleksandr Tymoshenko
108117cc22 [ofw] fix errneous checks for OF_finddevice(9) return value
OF_finddevices returns ((phandle_t)-1) in case of failure. Some code
in existing drivers checked return value to be equal to 0 or
less/equal to 0 which is also wrong because phandle_t is unsigned
type. Most of these checks were for negative cases that were never
triggered so trhere was no impact on functionality.

Reviewed by:	nwhitehorn
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D14645
2018-03-20 00:03:49 +00:00
Pedro F. Giffuni
af3dc4a7ca sys/arm: further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.
2017-11-27 15:04:10 +00:00
Ian Lepore
c5765d84ac Allow Raspberry Pi platform and drivers to be configured with upstream DTBs.
- Added more compatibility strings to drivers not yet converted
 - Added new RPI platform code compatibility string to match the ones used
   upstream
 - Adapted RPI and RPI2 DTS to match the new platform code compatibility
   string

The goal is to use the upstream DTBs as a replacement for our custom one.
This is now possible with these changes.

Additionally, as the RPI firmware automatically chooses the right DTB for
us, this would allow to have one common armv6 kernel for RPI0 and RPI1
(BCM2835-based), and one common armv7 kernel for RPI2 v1.1 (BCM2836-based),
and RPI2 v1.2 / RPI3 (BCM2837-based).

Submitted by:	Sylvain Garrigues <sylgar@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D12360
2017-10-02 00:49:33 +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
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
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
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
Emmanuel Vadot
d654c8053d RPI2: Add support for MULTIDELAY, this is needed for inclusion into GENERIC. 2016-09-30 10:21:04 +00:00
Emmanuel Vadot
10912ba837 RPI2: Add support for PLATFORM_SMP so we can later add it to GENERIC.
Reviewed by:	andrew
Differential Revision:	https://reviews.freebsd.org/D8063
2016-09-29 06:54:02 +00:00
Emmanuel Vadot
0c051204d7 RPI-B: Add support for MULTIDELAY
100 cycles per us seems accurate enough, at least it's better than the 200 value
that was used before.

Reviewed by:	andrew, imp
Differential Revision:	https://reviews.freebsd.org/D8062
2016-09-29 06:49:59 +00:00
Andrew Turner
eb2035b562 Also implement platform_cpu_reset on bcm2836 2016-09-23 15:28:15 +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
Andrew Turner
cca48a59de Add a MULTIDELAY option to allow the ARM kernel to have multiple DELAY
implementations. Early in the boot the kernel will use an approximate,
however after the timer has been probed it will switch to a more accurate
implementation.

Reviewed by:	manu
Sponsored by:	ABT Systems Ltd
Differential Revision:	https://reviews.freebsd.org/D5762
2016-04-30 17:27:33 +00:00
Ruslan Bukin
30b72b6871 Move arm's devmap to some generic place, so it can be used
by other architectures.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D6091
Sponsored by:	DARPA, AFRL
Sponsored by:	HEIF5
2016-04-26 11:53:37 +00:00
Andrew Turner
4e46a66e4a Add support for the Raspberry Pi 2. As the chip is based on the bcm2835 in
the Raspberry Pi B we support most of the devices are already supported,
however the base address has changed.

A few items are not working, or missing. The main ones are:
 * DMA doesn't work in the sdhci driver.
 * Enabling vchiq halts the boot, may be interrupt related.
 * There is no U-Boot port yet so the DTB is embedded in the kernel.

The last point will make it difficult to boot FreeBSD, however there is
support for the Raspberry Pi 2 in the U-Boot git repo. As I have not tested
this it is left as an open task to create a port to build.

X-MFC:		When the above issues are fixed
Sponsored by:	ABT Systems Ltd
2015-03-25 10:59:42 +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
Andrew Turner
27521ff8e4 Add the start of the ARM platform code. This is based on the PowerPC
platform code, it is expected these will be merged in the future when the
ARM code is more complete.

Until more boards can be tested only use this with the Raspberry Pi and
rrename the functions on the other SoCs.

Reviewed by:	ian@
2014-05-17 11:27:36 +00:00
Ian Lepore
fdadb971af Switch to using arm_devmap_add_entry() to set up static device mapping.
This eliminates the hard-coded max kva and roughly doubles the available
kva space.
2014-01-06 15:48:16 +00:00
Ian Lepore
515cbe8673 Call initarm_lastaddr() later in the init sequence, after establishing
static device mappings, rather than as the first of the initializations
that a platform can hook into.  This allows a platform to allocate KVA
from the top of the address space downwards for things like static device
mapping, and return the final "last usable address" result after that and
other early init work is done.

Because some platforms were doing work in initarm_lastaddr() that needs to
be done early, add a new initarm_early_init() routine and move the early
init code to that routine on those platforms.

Rename platform_devmap_init() to initarm_devmap_init() to match all the
other init routines called from initarm() that are designed to be
implemented by platform code.

Add a comment block that explains when these routines are called and the
type of work expected to be done in each of them.
2013-11-05 02:57:34 +00:00
Ian Lepore
3110e7eed8 Move remaining code and data related to static device mapping into the
new devmap.[ch] files.  Emphasize the MD nature of these things by using
the prefix arm_devmap_ on the function and type names (already a few of
these things found their way into MI code, hopefully it will be harder to
do by accident in the future).
2013-11-04 22:45:26 +00:00
Ian Lepore
99af02e3b6 Retire arm_remap_nocache() and the data and constants associated with it.
The only remaining user was the code that allocates bounce pages for armv4
busdma.  It's not clear why bounce pages would need uncached memory, but
if that ever changes, kmem_alloc_attr() would be the way to get it.
2013-10-27 03:13:26 +00:00
Ian Lepore
6489412064 Remove #include <machine/frame.h> from all the arm code that doesn't
really need it.  That would be almost everywhere it was included.  Add
it in a couple files that really do need it and were previously getting
it by accident via another header.
2013-10-27 01:34:10 +00:00
Ian Lepore
69d75558a7 Remove all #include <machine/pmap.h> from arm code. It's already
included by vm/pmap.h, which is a prerequisite for arm/machine/pmap.h
so there's no reason to ever include it directly.

Thanks to alc@ for pointing this out.
2013-10-27 00:51:46 +00:00
Oleksandr Tymoshenko
0b5eb45655 Remove accidentally copypasted comment
Spotted by: gavin
2013-01-13 21:32:40 +00:00
Oleksandr Tymoshenko
fd79f4a5a4 Export board serial and board revision obtained from FDT blob 2013-01-05 23:08:58 +00:00
Andrew Turner
7bf9ab5331 Merge the FDT versions of initarm.
The copies of initarm used on platforms with FDT support were almost
identical. The differences were pulled out into separate functions that
were called by initarm.

This change merges the, now identical, copies of initarm and a few of it's
support functions. This is a step towards a common kernel on ARMv6.
2012-11-03 22:39:07 +00:00
Andrew Turner
ef8abaaebf Merge r242125 into the other ARMv6 copies of initarm. 2012-10-31 08:25:45 +00:00
Andrew Turner
c2257f93ba Clean up the bcm2835 initarm. It is now identical to the other ARMv6 copies
Tested by:	Alexander Yerenkow
2012-09-23 19:48:29 +00:00
Andrew Turner
610ba83a97 Fix a typo in a Broadcom initarm debug printf 2012-09-23 08:49:41 +00:00
Andrew Turner
1f008b99cc Pull out the SoC specific parts of initarm into separate functions 2012-09-23 03:46:03 +00:00
Andrew Turner
70203625fb Update different versions of physmap_init to be identical in preparation
for merging them.
2012-09-23 02:01:59 +00:00
Andrew Turner
d98d8a1e83 Reduce the diff between the FDT implementations of initarm.
This only touches whitespace and comments.
2012-09-22 22:41:38 +00:00
Andrew Turner
1161298251 Create a common set_stackptrs in sys/arm/machdep.c.
On single core devices set_stackptrs is only ever called with cpu = 0 in
initarm and will be identical to the existing function. On SMP this needs
to be implemented for sys/arm/mp_machdep.c, but the implementations are
identical for each SoC.
2012-09-22 06:41:56 +00:00
Oleksandr Tymoshenko
1b1a53cf46 Add barebone Raspberry Pi port. Supported parts:
- Interrupts controller
  - Watchdog
  - System timer
  - Framebuffer (hardcoded resolution/bpp)
2012-08-30 20:59:37 +00:00