projects/RPi/patches: add patch needed for NOOBS support

Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
Stephan Raue 2013-08-25 16:31:40 +02:00
parent 21d1ea08af
commit 6e575a90f6

View File

@ -0,0 +1,117 @@
From f5e64e3852175d7df92202c969e538140bc37abf Mon Sep 17 00:00:00 2001
From: popcornmix <popcornmix@gmail.com>
Date: Mon, 19 Aug 2013 15:21:22 +0100
Subject: [PATCH] Changes for new NOOBS multi partition booting from gsh
---
arch/arm/kernel/process.c | 2 +-
arch/arm/mach-bcm2708/bcm2708.c | 52 +++++++++++++++++++++++++++++++++--------
2 files changed, 43 insertions(+), 11 deletions(-)
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index 5bc2615..1b06c55 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -174,7 +174,7 @@ void arch_cpu_idle(void)
default_idle();
}
-static char reboot_mode = 'h';
+char reboot_mode = 'h';
int __init reboot_setup(char *str)
{
diff --git a/arch/arm/mach-bcm2708/bcm2708.c b/arch/arm/mach-bcm2708/bcm2708.c
index 68c577a..5662c1a 100644
--- a/arch/arm/mach-bcm2708/bcm2708.c
+++ b/arch/arm/mach-bcm2708/bcm2708.c
@@ -83,6 +83,7 @@
/* command line parameters */
static unsigned boardrev, serial;
static unsigned uart_clock;
+static unsigned reboot_part = 0;
static void __init bcm2708_init_led(void);
@@ -624,20 +625,42 @@ int __init bcm_register_device(struct platform_device *pdev)
return ret;
}
+int calc_rsts(int partition)
+{
+ return PM_PASSWORD |
+ ((partition & (1 << 0)) << 0) |
+ ((partition & (1 << 1)) << 1) |
+ ((partition & (1 << 2)) << 2) |
+ ((partition & (1 << 3)) << 3) |
+ ((partition & (1 << 4)) << 4) |
+ ((partition & (1 << 5)) << 5);
+}
+
static void bcm2708_restart(char mode, const char *cmd)
{
uint32_t pm_rstc, pm_wdog;
uint32_t timeout = 10;
+ uint32_t pm_rsts = 0;
- /* For quick reset notification add reboot=q to cmdline
- */
if(mode == 'q')
{
- uint32_t pm_rsts = readl(__io_address(PM_RSTS));
+ // NOOBS < 1.3 booting with reboot=q
+ pm_rsts = readl(__io_address(PM_RSTS));
pm_rsts = PM_PASSWORD | pm_rsts | PM_RSTS_HADWRQ_SET;
- writel(pm_rsts, __io_address(PM_RSTS));
+ }
+ else if(mode == 'p')
+ {
+ // NOOBS < 1.3 halting
+ pm_rsts = readl(__io_address(PM_RSTS));
+ pm_rsts = PM_PASSWORD | pm_rsts | PM_RSTS_HADWRH_SET;
+ }
+ else
+ {
+ pm_rsts = calc_rsts(reboot_part);
}
+ writel(pm_rsts, __io_address(PM_RSTS));
+
/* Setup watchdog for reset */
pm_rstc = readl(__io_address(PM_RSTC));
@@ -651,12 +674,20 @@ static void bcm2708_restart(char mode, const char *cmd)
/* We can't really power off, but if we do the normal reset scheme, and indicate to bootcode.bin not to reboot, then most of the chip will be powered off */
static void bcm2708_power_off(void)
{
- /* we set the watchdog hard reset bit here to distinguish this reset from the normal (full) reset. bootcode.bin will not reboot after a hard reset */
- uint32_t pm_rsts = readl(__io_address(PM_RSTS));
- pm_rsts = PM_PASSWORD | (pm_rsts & PM_RSTC_WRCFG_CLR) | PM_RSTS_HADWRH_SET;
- writel(pm_rsts, __io_address(PM_RSTS));
- /* continue with normal reset mechanism */
- bcm2708_restart(0, "");
+ extern char reboot_mode;
+
+ if(reboot_mode == 'q')
+ {
+ // NOOBS < v1.3
+ bcm2708_restart('p', "");
+ }
+ else
+ {
+ /* partition 63 is special code for HALT the bootloader knows not to boot*/
+ reboot_part = 63;
+ /* continue with normal reset mechanism */
+ bcm2708_restart(0, "");
+ }
}
void __init bcm2708_init(void)
@@ -883,3 +914,4 @@ static void __init board_reserve(void)
module_param(boardrev, uint, 0644);
module_param(serial, uint, 0644);
module_param(uart_clock, uint, 0644);
+module_param(reboot_part, uint, 0644);
--
1.8.1.6