ARM: rpi_b: many minor enhancements
Subsystems (3)
cover ARM: rpi_b: many minor enhancements
This is a slew of various small patches I've accumulated for the Raspberry Pi. They assume that the following have already been applied:
2230151 ARM: bcm2835: add Raspberry Pi model B board 3a43ab2 ARM: add basic support for the Broadcom BCM2835 SoC
Stephen Warren (12):
ARM: arm1176: enable instruction cache in arch_cpu_init()
ARM: rpi_b: enable CONFIG_ARCH_CPU_INIT for icache
ARM: rpi_b: define CONFIG_MACH_TYPE
ARM: rpi_b: include config_cmd_default.h
ARM: rpi_b: enable CONFIG_OF_LIBFDT
ARM: rpi_b: set bi_boot_params
ARM: rpi_b: add ATAG support for bootm/bootz
ARM: rpi_b: drop RAM size to 128M
ARM: rpi_b: move stack to top of RAM
ARM: rpi_b: re-order rpi_b.h to keep related defines adjacent
ARM: bcm2835: implement reset using watchdog
ARM: rpi_b: enabled bootz command
arch/arm/cpu/arm1176/bcm2835/reset.c | 18 +++++++++++---- arch/arm/cpu/arm1176/cpu.c | 7 ++++++ arch/arm/include/asm/arch-bcm2835/wdog.h | 37 ++++++++++++++++++++++++++++++ board/raspberrypi/rpi_b/rpi_b.c | 4 +++- include/configs/rpi_b.h | 34 +++++++++++++++++++++++---- 5 files changed, 89 insertions(+), 11 deletions(-) create mode 100644 arch/arm/include/asm/arch-bcm2835/wdog.h
Signature · 1 line
1.7.9.5
PATCH 1/12 ARM: arm1176: enable instruction cache in arch_cpu_init()
Note that this affects all users of the ARM1176 CPU that enable CONFIG_ARCH_CPU_INIT, not just the BCM2835 SoC, potentially such as tnetv107x.
--- arch/arm/cpu/arm1176/cpu.c | 7 +++++++ 1 file changed, 7 insertions(+)
arch/arm/cpu/arm1176/cpu.c +7 -0
@@ -65,3 +65,10 @@ static void cache_flush (void)/* mem barrier to sync things */ asm ("mcr p15, 0, %0, c7, c10, 4" : :"r" (0 )); } + +int arch_cpu_init (void ) +{ +icache_enable (); + +return 0 ; +}
Signature · 1 line
1.7.9.5
PATCH 2/12 ARM: rpi_b: enable CONFIG_ARCH_CPU_INIT for icache
In reply to Stephen WarrenThis causes arch_cpu_init() to be called, which enables the icache.
Extracted from work by Oleksandr Tymoshenko <[email protected]>.
--- include/configs/rpi_b.h | 1 + 1 file changed, 1 insertion(+)
include/configs/rpi_b.h +1 -0
@@ -22,6 +22,7 @@/* Architecture, CPU, etc.*/ #define CONFIG_ARM1176 #define CONFIG_BCM2835 +#define CONFIG_ARCH_CPU_INIT /* Timer */ #define CONFIG_SYS_HZ 1000000
Signature · 1 line
1.7.9.5
PATCH 3/12 ARM: rpi_b: define CONFIG_MACH_TYPE
In reply to Stephen WarrenUse MACH_TYPE_BCM2708 as the Linux machine type for the Raspberry Pi.
The Raspberry Pi actually uses a BCM2835. However, the 2835 this is apparently a SKU in a series for which the BCM2708 is the first or perhaps primary version, such that the 2708 name has historically been used for this purpose.
Extracted from work by Oleksandr Tymoshenko <[email protected]>.
--- include/configs/rpi_b.h | 5 +++++ 1 file changed, 5 insertions(+)
include/configs/rpi_b.h +5 -0
@@ -23,6 +23,11 @@#define CONFIG_ARM1176 #define CONFIG_BCM2835 #define CONFIG_ARCH_CPU_INIT +/* +* 2835 is a SKU in a series for which the 2708 is the first or primary SoC, +* so 2708 has historically been used rather than a dedicated 2835 ID. +*/ +#define CONFIG_MACH_TYPE MACH_TYPE_BCM2708/* Timer */ #define CONFIG_SYS_HZ 1000000
Signature · 1 line
1.7.9.5
PATCH 4/12 ARM: rpi_b: include config_cmd_default.h
In reply to Stephen WarrenThis enables a more typical default set of commands. Remove explicit enables for commands already in the default list.
--- include/configs/rpi_b.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
include/configs/rpi_b.h +6 -2
@@ -80,7 +80,11 @@#define CONFIG_AUTO_COMPLETE /* Commands */ -#define CONFIG_CMD_MEMORY -#define CONFIG_CMD_MISC +#include "config_cmd_default.h" +/* Some things don't make sense on this HW or yet */ +#undef CONFIG_CMD_FPGA +#undef CONFIG_CMD_NET +#undef CONFIG_CMD_NFS +#undef CONFIG_CMD_SAVEENV#endif
Signature · 1 line
1.7.9.5
PATCH 4/12 ARM: rpi_b: include config_cmd_default.h
Quoted 13 lines · Stephen Warren
This enables a more typical default set of commands. Remove explicit enables for commands already in the default list.
Signed-off-by Stephen Warren <[email protected]>--- include/configs/rpi_b.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)include/configs/rpi_b.h +0
-0
include/configs/rpi_b.h line 83
Quoted 6 lines
include/configs/rpi_b.h +1
-2@@ -80,7 +80,11 @@#define CONFIG_AUTO_COMPLETE /* Commands */ -#define CONFIG_CMD_MEMORY -#define CONFIG_CMD_MISC +#include "config_cmd_default.h"
OK, the README says "config_cmd_default.h" but every other user does <config_cmd_default.h>.
Signature · 1 line
Tom
PATCH 5/12 ARM: rpi_b: enable CONFIG_OF_LIBFDT
In reply to Stephen WarrenThis allows bootm/bootz to pass a device tree to the kernel.
--- include/configs/rpi_b.h | 3 +++ 1 file changed, 3 insertions(+)
include/configs/rpi_b.h +3 -0
@@ -87,4 +87,7 @@#undef CONFIG_CMD_NFS#undef CONFIG_CMD_SAVEENV +/* Device tree support for bootm/bootz */ +#define CONFIG_OF_LIBFDT +#endif
Signature · 1 line
1.7.9.5
PATCH 5/12 ARM: rpi_b: enable CONFIG_OF_LIBFDT
Quoted 3 lines · Stephen Warren
This allows bootm/bootz to pass a device tree to the kernel.
Signed-off-by Stephen Warren <[email protected]>
FWIW, I would combine this, 6 and 7 into a single commit and say "Enable booting the Linux Kernel" and in the body mention that today we use ATAGS and as the code moves into mainline device trees will be used and required, so enable both for now. This is roughly what I'm saying in my to-post series enhancing the am335x_evm support.
Signature · 1 line
Tom
PATCH 6/12 ARM: rpi_b: set bi_boot_params
In reply to Stephen WarrenThis defines where ATAGs will be written to when booting a Linux kernel.
Extracted from work by Oleksandr Tymoshenko <[email protected]>.
--- board/raspberrypi/rpi_b/rpi_b.c | 2 ++ 1 file changed, 2 insertions(+)
board/raspberrypi/rpi_b/rpi_b.c +2 -0
@@ -28,5 +28,7 @@ int dram_init(void)int board_init (void ) { + gd->bd->bi_boot_params =0x100 ; +return 0 ; }
Signature · 1 line
1.7.9.5
PATCH 7/12 ARM: rpi_b: add ATAG support for bootm/bootz
In reply to Stephen WarrenNewer kernels use device tree, so this isn't that useful. However, old kernels all use board files, so this might still see some use.
--- include/configs/rpi_b.h | 4 ++++ 1 file changed, 4 insertions(+)
include/configs/rpi_b.h +4 -0
@@ -89,5 +89,9 @@/* Device tree support for bootm/bootz */ #define CONFIG_OF_LIBFDT +/* ATAGs support for bootm/bootz */ +#define CONFIG_SETUP_MEMORY_TAGS +#define CONFIG_CMDLINE_TAG +#define CONFIG_INITRD_TAG #endif
Signature · 1 line
1.7.9.5
PATCH 8/12 ARM: rpi_b: drop RAM size to 128M
In reply to Stephen WarrenThe board really has 256M. However, the VC (VideoCore co-processor) shares the RAM, and uses a configurable portion at the top. We tell U-Boot that a smaller amount of RAM is present in order to avoid stomping on the area the VC uses.
Extracted from work by Oleksandr Tymoshenko <[email protected]>.
--- board/raspberrypi/rpi_b/rpi_b.c | 2 +- include/configs/rpi_b.h | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-)
board/raspberrypi/rpi_b/rpi_b.c +1 -1
@@ -21,7 +21,7 @@ DECLARE_GLOBAL_DATA_PTR;int dram_init (void ) { - gd->ram_size =SZ_256M ; + gd->ram_size =CONFIG_SYS_SDRAM_SIZE ;return 0 ; }
include/configs/rpi_b.h +7 -0
@@ -36,6 +36,13 @@#define CONFIG_NR_DRAM_BANKS 1#define CONFIG_SYS_TEXT_BASE 0x00008000#define CONFIG_SYS_SDRAM_BASE 0x00000000 +/* +* The board really has 256M. However, the VC (VideoCore co-processor) shares +* the RAM, and uses a configurable portion at the top. We tell U-Boot that a +* smaller amount of RAM is present in order to avoid stomping on the area +* the VC uses. +*/ +#define CONFIG_SYS_SDRAM_SIZE SZ_128M#define CONFIG_SYS_UBOOT_BASE CONFIG_SYS_TEXT_BASE#define CONFIG_SYS_INIT_RAM_SIZE SZ_4K#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_SDRAM_BASE + \
Signature · 1 line
1.7.9.5
A message that is not in the archive (sent off-list or not yet received): 930F248225E0FA44A2AE486086E959AEA56E33@SJEXCHMB06.corp.ad.broadcom.com
PATCH 8/12 ARM: rpi_b: drop RAM size to 128M
Quoted 3 lines · Naren (Narendra) Sankar
This should not be hard-coded.
The current board has 256MB but still allows the VC to use different RAM configuration splits. So the u-boot/Linux partition can get more than 128MB.
While that's true, I believe there's currently no runtime API available to retrieve the memory split information. When such an API is available, we can remove the hard-coded limit and use the API instead.
Such an API has been requested; see:
https://github.com/raspberrypi/firmware/issues/47
Quoted 1 line
And it is possible to support up to 1GB of DRAM on this platform.
The hard-coding is in a location specific to the Raspberry-Pi model B. So, it doesn't impose any restrictions on any other boards using the same SoC. While the BCM2835 SoC may allow more memory, the RPi B specifically only supports exactly 256MB.
PATCH 9/12 ARM: rpi_b: move stack to top of RAM
In reply to Stephen WarrenMove the top-of-stack from 32k to near the top of RAM. This leaves the bottom of RAM free for ATAGs, or U-Boot scripts to use as they see fit.
Extracted from work by Oleksandr Tymoshenko <[email protected]>.
--- include/configs/rpi_b.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
include/configs/rpi_b.h +1 -2
@@ -44,9 +44,8 @@*/ #define CONFIG_SYS_SDRAM_SIZE SZ_128M#define CONFIG_SYS_UBOOT_BASE CONFIG_SYS_TEXT_BASE -#define CONFIG_SYS_INIT_RAM_SIZE SZ_4K#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_SDRAM_BASE + \ - CONFIG_SYS_INIT_RAM_SIZE - \ + CONFIG_SYS_SDRAM_SIZE - \ GENERATED_GBL_DATA_SIZE)#define CONFIG_SYS_MALLOC_LEN SZ_4M#define CONFIG_SYS_MEMTEST_START 0x00100000
Signature · 1 line
1.7.9.5
PATCH 10/12 ARM: rpi_b: re-order rpi_b.h to keep related defines adjacent
In reply to Stephen Warren--- include/configs/rpi_b.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/configs/rpi_b.h +1 -1
@@ -35,6 +35,7 @@/* Memory layout */ #define CONFIG_NR_DRAM_BANKS 1#define CONFIG_SYS_TEXT_BASE 0x00008000 +#define CONFIG_SYS_UBOOT_BASE CONFIG_SYS_TEXT_BASE#define CONFIG_SYS_SDRAM_BASE 0x00000000/* * The board really has 256M. However, the VC (VideoCore co-processor) shares
@@ -43,7 +44,6 @@* the VC uses. */ #define CONFIG_SYS_SDRAM_SIZE SZ_128M -#define CONFIG_SYS_UBOOT_BASE CONFIG_SYS_TEXT_BASE#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_SDRAM_BASE + \ CONFIG_SYS_SDRAM_SIZE - \ GENERATED_GBL_DATA_SIZE)
Signature · 1 line
1.7.9.5
PATCH 11/12 ARM: bcm2835: implement reset using watchdog
In reply to Stephen Warren--- arch/arm/cpu/arm1176/bcm2835/reset.c | 18 +++++++++++---- arch/arm/include/asm/arch-bcm2835/wdog.h | 37 ++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 5 deletions(-) create mode 100644 arch/arm/include/asm/arch-bcm2835/wdog.h
arch/arm/cpu/arm1176/bcm2835/reset.c +13 -5
@@ -16,12 +16,20 @@#include <common.h> #include <asm/io.h> +#include <asm/arch/wdog.h> + +#define RESET_TIMEOUT 10void reset_cpu (ulong addr) { -/* -* We should probably use the WDT module here, but an unaligned -* access will do the trick for now. -*/ -readl (1 ); +struct bcm2835_wdog_regs *regs = + (struct bcm2835_wdog_regs *)BCM2835_WDOG_PHYSADDR ; +uint32_t rstc; + + rstc =readl (®s->rstc); + rstc &= ~BCM2835_WDOG_RSTC_WRCFG_MASK ; + rstc |=BCM2835_WDOG_RSTC_WRCFG_FULL_RESET ; + +writel (BCM2835_WDOG_PASSWORD |RESET_TIMEOUT , ®s->wdog); +writel (BCM2835_WDOG_PASSWORD | rstc, ®s->rstc); }
arch/arm/include/asm/arch-bcm2835/wdog.h new file +37 -0
@@ -0,0 +1,37 @@ +/* +* (C) Copyright 2012 Stephen Warren +* +* See file CREDITS for list of people who contributed to this +* project. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* version 2 as published by the Free Software Foundation. +* +* 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. +*/ + +#ifndef _BCM2835_TIMER_H +#define _BCM2835_TIMER_H + +#define BCM2835_WDOG_PHYSADDR 0x20100000 + +struct bcm2835_wdog_regs { +u32 unknown0[7 ]; +u32 rstc; +u32 unknown1; +u32 wdog; +}; + +#define BCM2835_WDOG_PASSWORD 0x5a000000 + +#define BCM2835_WDOG_RSTC_WRCFG_MASK 0x00000030 +#define BCM2835_WDOG_RSTC_WRCFG_FULL_RESET 0x00000020 + +#define BCM2835_WDOG_WDOG_TIMEOUT_MASK 0x0000ffff + +#endif +
Signature · 1 line
1.7.9.5
PATCH 12/12 ARM: rpi_b: enabled bootz command
In reply to Stephen Warren--- include/configs/rpi_b.h | 1 + 1 file changed, 1 insertion(+)
include/configs/rpi_b.h +1 -0
@@ -87,6 +87,7 @@/* Commands */ #include "config_cmd_default.h" +#define CONFIG_CMD_BOOTZ /* Some things don't make sense on this HW or yet */ #undef CONFIG_CMD_FPGA#undef CONFIG_CMD_NET
Signature · 1 line
1.7.9.5