diff options
author | ian <ian@FreeBSD.org> | 2014-05-14 19:18:58 +0000 |
---|---|---|
committer | ian <ian@FreeBSD.org> | 2014-05-14 19:18:58 +0000 |
commit | 057c7452877929463827f58db062e6c8a7e70e1e (patch) | |
tree | 4d7e5652ad495e1d8b2080c968e1eaf2b8f0ffba /sys/arm/tegra | |
parent | 21fbbde45943109155a62d78963119afc7f3f290 (diff) | |
download | FreeBSD-src-057c7452877929463827f58db062e6c8a7e70e1e.zip FreeBSD-src-057c7452877929463827f58db062e6c8a7e70e1e.tar.gz |
MFC r257738, r259202, r258410, r260288, r260292, r260294, r260320, r260323,
r260326, r260327, r260331, r260333, r260340, r260371, r260372, r260373,
r260374, r260375
Add common bus_space tag definition shared for most supported ARMv6/v7 SoCs.
Correct license statements to reflect the fact that these files were all
derived from sys/arm/mv/bus_space.c.
In pmap_unmapdev(), remember the size, and use that as an argument to
kva_free(), or we'd end up always passing it a size of 0
In pmap_mapdev(), first check whether a static mapping exists,
Convert TI static device mapping to use the new arm_devmap_add_entry(),
Use the common armv6 fdt_bus_tag defintion for tegra instead of a local copy.
Eliminate use of fdt_immr_addr(), it's not needed for tegra
Convert lpc from using fdt_immr style to arm_devmap_add_entry() to make
static device mappings.
Retire machine/fdt.h as a header used by MI code, as its function is now
obsolete. This involves the following pieces:
- Remove it entirely on PowerPC, where it is not used by MD code either
- Remove all references to machine/fdt.h in non-architecture-specific code
(aside from uart_cpu_fdt.c, shared by ARM and MIPS, and so is somewhat
non-arch-specific).
- Fix code relying on header pollution from machine/fdt.h includes
- Legacy fdtbus.c (still used on x86 FDT systems) now passes resource
requests to its parent (nexus). This allows x86 FDT devices to allocate
both memory and IO requests and removes the last notionally MI use of
fdtbus_bs_tag.
- On those architectures that retain a machine/fdt.h, unused bits like
FDT_MAP_IRQ and FDT_INTR_MAX have been removed.
Add #include <machine/fdt.h> to a few files that used to get it via pollution
Enable the mv cesa security/crypto device by providing the required property
in the dts source, and adding the right devices to the kernel config.
Remove dev/fdt/fdt_pci.c, which was code specific to Marvell ARM SoCs,
related to setting up static device mappings. Since it was only used by
arm/mv/mv_pci.c, it's now just static functions within that file, plus
one public function that gets called only from arm/mv/mv_machdep.c.
Switch RPi to using arm_devmap_add_entry() to set up static device mapping.
Allow 'no static device mappings' to potentially work.
Don't try to find a static mapping before calling pmap_mapdev(), that logic
is now part of pmap_mapdev() and doesn't need to be duplicated here.
Switch a10 to using arm_devmap_add_entry() to set up static device mapping.
Diffstat (limited to 'sys/arm/tegra')
-rw-r--r-- | sys/arm/tegra/bus_space.c | 153 | ||||
-rw-r--r-- | sys/arm/tegra/files.tegra2 | 2 | ||||
-rw-r--r-- | sys/arm/tegra/tegra2_machdep.c | 34 |
3 files changed, 9 insertions, 180 deletions
diff --git a/sys/arm/tegra/bus_space.c b/sys/arm/tegra/bus_space.c deleted file mode 100644 index 8d21f55..0000000 --- a/sys/arm/tegra/bus_space.c +++ /dev/null @@ -1,153 +0,0 @@ -/*- - * Copyright (c) 2012 Damjan Marion <damjan.marion@gmail.com> - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/bus.h> -#include <sys/kernel.h> -#include <sys/malloc.h> - -#include <machine/bus.h> - -/* Prototypes for all the bus_space structure functions */ -bs_protos(generic); -bs_protos(generic_armv4); - -/* - * The bus space tag. This is constant for all instances, so - * we never have to explicitly "create" it. - */ -static struct bus_space _base_tag = { - /* cookie */ - (void *) 0, - - /* mapping/unmapping */ - generic_bs_map, - generic_bs_unmap, - generic_bs_subregion, - - /* allocation/deallocation */ - generic_bs_alloc, - generic_bs_free, - - /* barrier */ - generic_bs_barrier, - - /* read (single) */ - generic_bs_r_1, - generic_armv4_bs_r_2, - generic_bs_r_4, - NULL, - - /* read multiple */ - generic_bs_rm_1, - generic_armv4_bs_rm_2, - generic_bs_rm_4, - NULL, - - /* read region */ - generic_bs_rr_1, - generic_armv4_bs_rr_2, - generic_bs_rr_4, - NULL, - - /* write (single) */ - generic_bs_w_1, - generic_armv4_bs_w_2, - generic_bs_w_4, - NULL, - - /* write multiple */ - generic_bs_wm_1, - generic_armv4_bs_wm_2, - generic_bs_wm_4, - NULL, - - /* write region */ - NULL, - NULL, - NULL, - NULL, - - /* set multiple */ - NULL, - NULL, - NULL, - NULL, - - /* set region */ - NULL, - NULL, - NULL, - NULL, - - /* copy */ - NULL, - NULL, - NULL, - NULL, - - /* read stream (single) */ - NULL, - NULL, - NULL, - NULL, - - /* read multiple stream */ - NULL, - generic_armv4_bs_rm_2, /* bus_space_read_multi_stream_2 */ - NULL, - NULL, - - /* read region stream */ - NULL, - NULL, - NULL, - NULL, - - /* write stream (single) */ - NULL, - NULL, - NULL, - NULL, - - /* write multiple stream */ - NULL, - generic_armv4_bs_wm_2, /* bus_space_write_multi_stream_2 */ - NULL, - NULL, - - /* write region stream */ - NULL, - NULL, - NULL, - NULL -}; - -bus_space_tag_t fdtbus_bs_tag = &_base_tag; diff --git a/sys/arm/tegra/files.tegra2 b/sys/arm/tegra/files.tegra2 index 9540979..7f6e893 100644 --- a/sys/arm/tegra/files.tegra2 +++ b/sys/arm/tegra/files.tegra2 @@ -2,6 +2,7 @@ arm/arm/bus_space_asm_generic.S standard arm/arm/bus_space_generic.c standard +arm/arm/bus_space-v6.c standard arm/arm/cpufunc_asm_armv5.S standard arm/arm/cpufunc_asm_arm11.S standard arm/arm/cpufunc_asm_armv7.S standard @@ -10,7 +11,6 @@ arm/arm/irq_dispatch.S standard arm/arm/gic.c standard arm/arm/mpcore_timer.c standard -arm/tegra/bus_space.c standard arm/tegra/common.c standard arm/tegra/tegra2_machdep.c standard diff --git a/sys/arm/tegra/tegra2_machdep.c b/sys/arm/tegra/tegra2_machdep.c index 8904250..bd639ae 100644 --- a/sys/arm/tegra/tegra2_machdep.c +++ b/sys/arm/tegra/tegra2_machdep.c @@ -50,17 +50,12 @@ __FBSDID("$FreeBSD$"); #include <dev/fdt/fdt_common.h> -/* FIXME move to tegrareg.h */ -#define TEGRA2_BASE 0xE0000000 /* KVM base for peripherials */ -#define TEGRA2_UARTA_VA_BASE 0xE0006000 -#define TEGRA2_UARTA_PA_BASE 0x70006000 - #define TEGRA2_CLK_RST_PA_BASE 0x60006000 #define TEGRA2_CLK_RST_OSC_FREQ_DET_REG 0x58 #define TEGRA2_CLK_RST_OSC_FREQ_DET_STAT_REG 0x5C -#define OSC_FREQ_DET_TRIG (1<<31) -#define OSC_FREQ_DET_BUSY (1<<31) +#define OSC_FREQ_DET_TRIG (1U<<31) +#define OSC_FREQ_DET_BUSY (1U<<31) #if 0 static int @@ -107,15 +102,12 @@ vm_offset_t initarm_lastaddr(void) { - return (fdt_immr_va); + return (arm_devmap_lastaddr()); } void initarm_early_init(void) { - - if (fdt_immr_addr(TEGRA2_BASE) != 0) /* FIXME ???? */ - while (1); } void @@ -128,26 +120,16 @@ initarm_late_init(void) { } -#define FDT_DEVMAP_MAX (1 + 2 + 1 + 1) /* FIXME */ -static struct arm_devmap_entry fdt_devmap[FDT_DEVMAP_MAX] = { - { 0, 0, 0, 0, 0, } -}; - /* - * Construct pmap_devmap[] with DT-derived config data. + * Add a static mapping for the register range that includes the debug uart. + * It's not clear this is needed, but the original code established this mapping + * before conversion to the newer arm_devmap_add_entry() routine. */ int initarm_devmap_init(void) { - int i = 0; - fdt_devmap[i].pd_va = 0xe0000000; - fdt_devmap[i].pd_pa = 0x70000000; - fdt_devmap[i].pd_size = 0x100000; - fdt_devmap[i].pd_prot = VM_PROT_READ | VM_PROT_WRITE; - fdt_devmap[i].pd_cache = PTE_NOCACHE; - i++; - - arm_devmap_register_table(&fdt_devmap[0]); + + arm_devmap_add_entry(0x70000000, 0x00100000); return (0); } |