diff options
Diffstat (limited to 'arch/arm/mach-bcm283x/core.c')
-rw-r--r-- | arch/arm/mach-bcm283x/core.c | 57 |
1 files changed, 23 insertions, 34 deletions
diff --git a/arch/arm/mach-bcm283x/core.c b/arch/arm/mach-bcm283x/core.c index f2528cf1f1..1091ad0b56 100644 --- a/arch/arm/mach-bcm283x/core.c +++ b/arch/arm/mach-bcm283x/core.c @@ -1,40 +1,29 @@ -/* - * Author: Carlo Caione <carlo@carlocaione.org> - * - * Based on mach-nomadik - * Copyright (C) 2009 Jean-Christophe PLAGNIOL-VILLARD <plagnio@jcrosoft.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - */ +// SPDX-License-Identifier: GPL-2.0-only -#include <common.h> -#include <init.h> +#include <linux/types.h> +#include <mach/bcm283x/core.h> +#include <asm/system_info.h> -#include <linux/clk.h> -#include <linux/clkdev.h> -#include <linux/err.h> - -#include <io.h> -#include <asm/armlinux.h> -#include <linux/sizes.h> +void __iomem *bcm2835_get_mmio_base_by_cpuid(void) +{ + static u32 cpuid; -#include <mach/platform.h> -#include <mach/core.h> -#include <linux/amba/bus.h> + if (!cpuid) { + cpuid = read_cpuid_id(); + pr_debug("ARM CPUID: %08x\n", cpuid); + } -void bcm2835_add_device_sdram(u32 size) -{ - if (!size) - size = get_ram_size((ulong *) BCM2835_SDRAM_BASE, SZ_128M); + /* We know ARM1167, Cortex A-7, A-53 and A-72 CPUID mask is identical */ + switch(cpuid & CPU_IS_ARM1176_MASK) { + case CPU_IS_ARM1176: /* bcm2835 */ + return IOMEM(0x20000000); + case CPU_IS_CORTEX_A7: /* bcm2836 */ + case CPU_IS_CORTEX_A53: /* bcm2837 */ + return IOMEM(0x3f000000); + case CPU_IS_CORTEX_A72: /* bcm2711 */ + return IOMEM(0xfe000000); + } - arm_add_mem_device("ram0", BCM2835_SDRAM_BASE, size); + pr_err("Couldn't determine rpi by CPUID %08x\n", cpuid); + return NULL; } |