Home | History | Annotate | Download | only in broadcom
History log of /src/sys/arch/arm/broadcom/bcm283x_platform.c
RevisionDateAuthorComments
 1.51  06-Sep-2025  thorpej Re-factor the console-related code into fdt_console.[ch]
 1.50  06-Sep-2025  thorpej Refactor the "platform" defitions into fdt_platform.h
 1.49  07-Apr-2023  skrll Rename ARM_PLATFORM to FDT_PLATFORM and make it available outside arm.
 1.48  24-Apr-2021  thorpej Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.47  04-Feb-2021  thorpej branches: 1.47.2;
Call acpi_device_register() / fdtbus_device_register() as approrpriate.
 1.46  27-Jan-2021  thorpej Rename of_match_compat_data() to of_compatible_match(). Similarly,
rename of_search_compatible() to of_compatible_lookup().

Standardize on of_compatible_match() for driver matching, and adapt
all call sites.
 1.45  01-Dec-2020  rin Data written to and read from bcm283x UART registers should be in little-endian.
 1.44  01-Dec-2020  rin Data written to and read from bcmmbox(4) should be in little-endian.
 1.43  23-Nov-2020  rin Support EARLYCONS and VERBOSE_INIT_ARM for Raspberry Pi Zero W, for
which mini UART should be used instead of PL011 UART.
 1.42  23-Nov-2020  rin Factor out bcm283x_aux_platform_early_putchar() from
bcm{2837,2711}_platform_early_putchar(), for which output goes to
AUX UART (aka mini UART).

No functional changes.
 1.41  28-Sep-2020  jmcneill branches: 1.41.2;
Get rid of a4x bus_space tag from fdtbus_attach_args. The only consumer
of this was various com(4) glue so modify all of that to use the new
com_init_regs_stride instead.
 1.40  10-Jul-2020  skrll Add support for KASAN on ARMv[67]

Thanks to maxv for many pointers and reviews.
 1.39  26-Jun-2020  skrll Avoid large stack usage with kmem_alloc - we're in device_register so
there is no problem doing this.
 1.38  21-Jun-2020  skrll Update to new proplib api
 1.37  22-Feb-2020  jmcneill Add support for Broadcom GENET v5 ethernet controller as found on the
Raspberry Pi 4 (BCM2711).
 1.36  22-Feb-2020  jmcneill Translate bus addresses for SCB on BCM2711
 1.35  20-Feb-2020  jmcneill Remove custom bus dma tag handling.
 1.34  01-Jan-2020  skrll branches: 1.34.2;
Provide a single generic bcm283x_platform_uart_freq which checks for
"brcm,bcm2835-aux-uart" and returns the appropriate core clock based
results; otherwise it returns the uart clock from firmware.

Should fix early console output on the rpi0w.

Based on a diff from mlelstv
 1.33  01-Jan-2020  skrll The DMA range doesn't cover all of memory on the bcm2711 (rpi4) - it
covers (most of) the first 1GB.
 1.32  31-Dec-2019  skrll Add another cache invalidation before reading memory for firmware query
results.
 1.31  30-Dec-2019  skrll Fix up ARM_LOCAL for 2711 so that it works now.
 1.30  30-Dec-2019  skrll Invalidate the cache just before trying to read the results from the
firmware as RPI4 A72s can fill the cache with speculation
 1.29  30-Dec-2019  skrll Add emmc2 clock goop from mlelstv@
 1.28  24-Dec-2019  skrll We follow linux mainline and they're using 2711 and not 2838 for RPI4
 1.27  22-Dec-2019  skrll Add brcm,bcm2711 as an alias for brcm,bcm2838
 1.26  28-Sep-2019  skrll Fix build on SOC_BCM2835 kernels
 1.25  27-Sep-2019  skrll BCM2838 (RPI4) support.

Based on a diff from mlelstv
 1.24  25-Sep-2019  skrll s/2835/283X/ in BCM2835_PERIPHERALS_BASE_BUS and BCM2835_PERIPHERALS_SIZE
to show they cover all of 283[5678]

NFCI
 1.23  03-Jan-2019  jmcneill branches: 1.23.4;
Add a link set for cpu enable methods.
 1.22  30-Oct-2018  skrll Retire fdt_putchar and ap_early_put_char in favour of uartputc.
 1.21  20-Oct-2018  ryo - fix AP spinup on bcm283x
- "brcm,bcm2836-smp" is a enable-method for only 32bit bcm2836.
 1.20  18-Oct-2018  skrll Provide generic start code that assumes the MMU is off and caches are
disabled as per the linux booting protocol for ARMv6 and ARMv7 boards.
u-boot image type should be changed to 'linux' for correct behaviour.

The new start code builds a minimal "bootstrap" L1PT with cached access
disabled and uses the same table for all processors. AP startup is
performed in less steps and more code is written in C.

The bootstrap tables and stack are placed into an (orphaned) section
"_init_memory" which is given to uvm when it is no longer used.

Various kernels have been converted to use this code and tested. Some
boards were provided by TNF. Thanks!

The GENERIC kernel now boots on boards using the TEGRA, SUNXI and EXYNOS
kernels. The GENERIC kernel will also work on RPI2 using u-boot.

Thanks to martin@ and aymeric@ for testing on parallella and nanosoc
respectively
 1.19  06-Oct-2018  skrll Use __BIT. NFC.
 1.18  10-Sep-2018  ryo cleanup aarch64 mpstart and fdt bootstrap
* arm_cpu_hatch_arg is a bad idea. avoid serializing CPU startup, and eliminate arm_cpu_hatch_arg.
in mpstart, resolve own cpu index using array of cpu_mpidr[] (aarch64)
* add support fdt enable-method "spin-table"
* add support fdt enable-method "brcm,bcm2836-smp" (for 32bit RaspberryPi)
* use arm_fdt_cpu_bootstrap() instead of psci_fdt_bootstrap()
* rename "arm/fdt/psci_fdt.h" to "arm/fdt/psci_fdtvar.h" because of conflict of include file for needs-flag
* add devmap for cpu spin-table of raspberrypi3/aarch64
* no need to force hatch APs for raspberrypi3/arm32 ifndef MULTIPROCESSOR.
* fix to work pmap_extract(kerneltext/data/bss) even if before calling pmap_bootstrap

idea to use cpu_mpidr[] by jmcneill@. reviewd by skrll@. thanks.
 1.17  03-Sep-2018  riastradh Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.16  28-Aug-2018  skrll Fix arm non-MULTIPROCESSOR build for RPI2
 1.15  26-Aug-2018  ryo add support multiple cpu clusters.
* pass cpu index as an argument to secondary processors when hatching.
* keep cpu cache confituration per cpu clusters.

Hello big.LITTLE!
 1.14  25-Aug-2018  rin Set mac-address property to mue(4).
 1.13  21-Aug-2018  rin Correctly report memory size, not clock rate when VERBOSE_INIT_ARM.
 1.12  10-Aug-2018  rin * Convert bus address to physical address in xxx_bs_mmap(), as done in
xxx_bs_map().

* Reuse bs_map and bs_mmap in arm_generic_bs_tag in order to
- set pmap flags properly for aarch64
- dedup codes

OK ryo
 1.11  05-Aug-2018  skrll Add prefixes to struct arm_platform{,_info} members.

No functional change.
 1.10  03-Aug-2018  skrll Provide and use kern_vtopdiff in KERN_{VTOPHYS,PHYSTOV}. A step towards
generic arm.
 1.9  03-Aug-2018  skrll Provide and use a evbarm/fdt/machdep.h
 1.8  16-Jul-2018  christos Add missing pointer <-> integer casts
Use PRI?64 to print uint64_t instead 'll?'
 1.7  09-Jul-2018  ryo hatch secondary processors (aarch64)
 1.6  27-Jun-2018  ryo branches: 1.6.2;
on evbarm/RPI,RPI2, VERBOSE_INIT_ARM had broken.

XPUTC() of evbarm/rpi/rpi*_start.S uses bcm283[567]_platform_early_putchar() and it requires stack.
fixed to allocate stack when starting from rpi*_start.S and a9_mpsubr.S if needed.

to work XPUTC(), need to define VERBOSE_INIT_ARM and EARLYCONS option.
 1.5  08-Jun-2018  jmcneill Provide bs_mmap implementations for bcm283x based boards.

PR: port-arm/53283
Submitted by: Nick Hudson
 1.4  01-Apr-2018  ryo Add initial support for ARMv8 (AARCH64) (by nisimura@ and ryo@)

- sys/arch/evbarm64 is gone and integrated into sys/arch/evbarm. (by skrll@)
- add support fdt. evbarm/conf/GENERIC64 fdt (bcm2837,sunxi,tegra) based generic 64bit kernel config. (by skrll@, jmcneill@)
 1.3  17-Mar-2018  ryo move from sys/arch/arm/arm32/armv7_generic_dma.c to sys/arch/arm/arm/arm_generic_dma.c,
and change variable name from armv7_generic_dma_tag to arm_generic_dma_tag

no functional change. (preliminary changes for merging aarch64)
 1.2  20-Dec-2017  skrll branches: 1.2.2;
G/C
 1.1  10-Dec-2017  skrll FDTise RapberryPI support. Thanks for jmcneill for a lot of help with this.

The kernel image that the RPI firmware boots is now netbsd.img in the
kernel build directory.

XXX fdtbus_get_reg needs reworking
 1.2.2.9  18-Jan-2019  pgoyette Synch with HEAD
 1.2.2.8  26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.2.2.7  20-Oct-2018  pgoyette Sync with head
 1.2.2.6  30-Sep-2018  pgoyette Ssync with HEAD
 1.2.2.5  06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.2.2.4  28-Jul-2018  pgoyette Sync with HEAD
 1.2.2.3  25-Jun-2018  pgoyette Sync with HEAD
 1.2.2.2  07-Apr-2018  pgoyette Sync with HEAD. 77 conflicts resolved - all of them $NetBSD$
 1.2.2.1  22-Mar-2018  pgoyette Synch with HEAD, resolve conflicts
 1.6.2.2  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.6.2.1  10-Jun-2019  christos Sync with HEAD
 1.23.4.1  02-Jan-2020  martin Pull up following revision(s) (requested by skrll in ticket #599):

sys/arch/arm/broadcom/bcm283x_platform.c: revision 1.34 (patch)

Provide a single generic bcm283x_platform_uart_freq which checks for
"brcm,bcm2835-aux-uart" and returns the appropriate core clock based
results; otherwise it returns the uart clock from firmware.

Should fix early console output on the rpi0w.

Based on a diff from mlelstv
 1.34.2.1  29-Feb-2020  ad Sync with head.
 1.41.2.2  03-Apr-2021  thorpej Sync with HEAD.
 1.41.2.1  14-Dec-2020  thorpej Sync w/ HEAD.
 1.47.2.1  03-Apr-2021  thorpej - FDT device enumeration now sets the device handle using CFARG_DEVHANDLE.
- fdtbus_device_register() is now obsolete, so G/C it.
- of_device_register() is now obsolete, so G/C it.

RSS XML Feed