X-Git-Url: https://git.librecmc.org/?p=oweals%2Fu-boot.git;a=blobdiff_plain;f=board%2Fraspberrypi%2Frpi%2Frpi.c;h=45caa4d49e8b9b7683c8e89ae45bad3607f8425d;hp=30495057d1759e295a54996bddf0a0f35f448283;hb=714497e327e7304a2b67d5f780f415c6e1c300d0;hpb=5512f5ccf1dc5cec068f8efa1d8ce81f51a988d3 diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c index 30495057d1..45caa4d49e 100644 --- a/board/raspberrypi/rpi/rpi.c +++ b/board/raspberrypi/rpi/rpi.c @@ -1,17 +1,16 @@ +// SPDX-License-Identifier: GPL-2.0 /* * (C) Copyright 2012-2016 Stephen Warren - * - * SPDX-License-Identifier: GPL-2.0 */ #include -#include #include #include -#include +#include #include #include #include +#include #include #include #include @@ -29,8 +28,11 @@ DECLARE_GLOBAL_DATA_PTR; -/* From lowlevel_init.S */ -extern unsigned long fw_dtb_pointer; +/* Assigned in lowlevel_init.S + * Push the variable into the .data section so that it + * does not get cleared later. + */ +unsigned long __section(".data") fw_dtb_pointer; /* TODO(sjg@chromium.org): Move these to the msg.c file */ struct msg_get_arm_mem { @@ -70,14 +72,7 @@ struct msg_get_clock_rate { #endif /* - * http://raspberryalphaomega.org.uk/2013/02/06/automatic-raspberry-pi-board-revision-detection-model-a-b1-and-b2/ - * http://www.raspberrypi.org/forums/viewtopic.php?f=63&t=32733 - * http://git.drogon.net/?p=wiringPi;a=blob;f=wiringPi/wiringPi.c;h=503151f61014418b9c42f4476a6086f75cd4e64b;hb=refs/heads/master#l922 - * - * In http://lists.denx.de/pipermail/u-boot/2016-January/243752.html - * ("[U-Boot] [PATCH] rpi: fix up Model B entries") Dom Cobley at the RPi - * Foundation stated that the following source was accurate: - * https://github.com/AndrewFromMelbourne/raspberry_pi_revision + * https://www.raspberrypi.org/documentation/hardware/raspberrypi/revision-codes/README.md */ struct rpi_model { const char *name; @@ -147,6 +142,21 @@ static const struct rpi_model rpi_models_new_scheme[] = { DTB_DIR "bcm2837-rpi-3-b-plus.dtb", true, }, + [0xE] = { + "3 Model A+", + DTB_DIR "bcm2837-rpi-3-a-plus.dtb", + false, + }, + [0x10] = { + "Compute Module 3+", + DTB_DIR "bcm2837-rpi-cm3.dtb", + false, + }, + [0x11] = { + "4 Model B", + DTB_DIR "bcm2711-rpi-4-b.dtb", + true, + }, }; static const struct rpi_model rpi_models_old_scheme[] = { @@ -242,30 +252,6 @@ static uint32_t rev_scheme; static uint32_t rev_type; static const struct rpi_model *model; -#ifdef CONFIG_ARM64 -static struct mm_region bcm2837_mem_map[] = { - { - .virt = 0x00000000UL, - .phys = 0x00000000UL, - .size = 0x3f000000UL, - .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | - PTE_BLOCK_INNER_SHARE - }, { - .virt = 0x3f000000UL, - .phys = 0x3f000000UL, - .size = 0x01000000UL, - .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | - PTE_BLOCK_NON_SHARE | - PTE_BLOCK_PXN | PTE_BLOCK_UXN - }, { - /* List terminator */ - 0, - } -}; - -struct mm_region *mem_map = bcm2837_mem_map; -#endif - int dram_init(void) { ALLOC_CACHE_ALIGN_BUFFER(struct msg_get_arm_mem, msg, 1); @@ -285,6 +271,19 @@ int dram_init(void) return 0; } +#ifdef CONFIG_OF_BOARD +int dram_init_banksize(void) +{ + int ret; + + ret = fdtdec_setup_memory_banksize(); + if (ret) + return ret; + + return fdtdec_setup_mem_size_base(); +} +#endif + static void set_fdtfile(void) { const char *fdtfile; @@ -385,7 +384,7 @@ static void set_serial_number(void) return; } - snprintf(serial_string, sizeof(serial_string), "%016" PRIx64, + snprintf(serial_string, sizeof(serial_string), "%016llx", msg->get_board_serial.body.resp.serial); env_set("serial#", serial_string); } @@ -490,7 +489,8 @@ int ft_board_setup(void *blob, bd_t *bd) #ifdef CONFIG_EFI_LOADER /* Reserve the spin table */ - efi_add_memory_map(0, 1, EFI_RESERVED_MEMORY_TYPE, 0); + efi_add_memory_map(0, CONFIG_RPI_EFI_NR_SPIN_PAGES << EFI_PAGE_SHIFT, + EFI_RESERVED_MEMORY_TYPE); #endif return 0;