All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hannes Petermaier <oe5hpm@oevsv.at>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 21/21] board/BuR/kwb: Support modify bootcmd through reset-controller
Date: Fri, 30 Jan 2015 14:25:24 +0100	[thread overview]
Message-ID: <1422624324-15431-21-git-send-email-oe5hpm@oevsv.at> (raw)
In-Reply-To: <1422624324-15431-1-git-send-email-oe5hpm@oevsv.at>

For some cases it is necessary to modify temporaly the bootcommand.
This can be done by writing into the Scratchregister a specific value:

* 0xCC - modify bootcmd "run netboot"
* 0xCD - modify bootcmd "run netscript"
* 0xCE - modify bootcmd "run mmcboot"

the environment in flash is NOT overwritten.

Signed-off-by: Hannes Petermaier <oe5hpm@oevsv.at>
---
 board/BuR/kwb/board.c |   30 ++++++++++++++++++++++++++++--
 1 file changed, 28 insertions(+), 2 deletions(-)

diff --git a/board/BuR/kwb/board.c b/board/BuR/kwb/board.c
index 455f472..892311e 100644
--- a/board/BuR/kwb/board.c
+++ b/board/BuR/kwb/board.c
@@ -169,10 +169,18 @@ int board_late_init(void)
 	const unsigned int toff = 1000;
 	unsigned int cnt  = 3;
 	unsigned short buf = 0xAAAA;
+	unsigned char scratchreg = 0;
 	unsigned int oldspeed;
 
-	tps65217_reg_write(TPS65217_PROT_LEVEL_NONE,
-			   TPS65217_WLEDCTRL2, 0x32, 0xFF); /* 50% dimlevel */
+	/* try to read out some boot-instruction from resetcontroller */
+	oldspeed = i2c_get_bus_speed();
+	if (i2c_set_bus_speed(CONFIG_SYS_OMAP24_I2C_SPEED_PSOC) >= 0) {
+		i2c_read(RSTCTRL_ADDR, RSTCTRL_SCRATCHREG, 1,
+			 &scratchreg, sizeof(scratchreg));
+		i2c_set_bus_speed(oldspeed);
+	} else {
+		puts("ERROR: i2c_set_bus_speed failed! (scratchregister)\n");
+	}
 
 	if (gpio_get_value(ESC_KEY)) {
 		do {
@@ -223,6 +231,24 @@ int board_late_init(void)
 				break;
 			}
 		} while (cnt);
+	} else if (scratchreg == 0xCC) {
+		lcd_position_cursor(1, 8);
+		lcd_puts(
+		"starting vxworks from network ...      ");
+		setenv("bootcmd", "run netboot");
+		cnt = 4;
+	} else if (scratchreg == 0xCD) {
+		lcd_position_cursor(1, 8);
+		lcd_puts(
+		"starting script from network ...      ");
+		setenv("bootcmd", "run netscript");
+		cnt = 4;
+	} else if (scratchreg == 0xCE) {
+		lcd_position_cursor(1, 8);
+		lcd_puts(
+		"starting AR from eMMC ...             ");
+		setenv("bootcmd", "run mmcboot");
+		cnt = 4;
 	}
 
 	lcd_position_cursor(1, 8);
-- 
1.7.9.5

      parent reply	other threads:[~2015-01-30 13:25 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-30 13:25 [U-Boot] [PATCH 01/21] drivers/video/am335x-fb: Add possibility to wait for stable power/picture Hannes Petermaier
2015-01-30 13:25 ` [U-Boot] [PATCH 02/21] common/lcd: Add command for setting cursor within lcd-framework Hannes Petermaier
2015-02-01 14:48   ` Nikita Kiryanov
2015-02-02  7:32     ` Hannes Petermaier
2015-02-03 11:52       ` Nikita Kiryanov
2015-01-30 13:25 ` [U-Boot] [PATCH 03/21] common/lcd: Add command for writing to lcd-display Hannes Petermaier
2015-02-01 14:53   ` Nikita Kiryanov
2015-02-02  7:37     ` Hannes Petermaier
2015-02-03 11:53       ` Nikita Kiryanov
2015-01-30 13:25 ` [U-Boot] [PATCH 04/21] board/BuR/common: Take usage of am335x LCD-Display Hannes Petermaier
2015-01-30 13:25 ` [U-Boot] [PATCH 05/21] board/BuR/common: try to setup cpsw mac-address from the devicetree Hannes Petermaier
2015-01-30 13:25 ` [U-Boot] [PATCH 06/21] board/BuR/tseries: Enable HW-Watchdog Hannes Petermaier
2015-01-30 13:25 ` [U-Boot] [PATCH 07/21] board/BuR/tseries: Enable U-Boot BOOTCOUNT feature Hannes Petermaier
2015-01-30 13:25 ` [U-Boot] [PATCH 08/21] board/BuR/tseries: Enable EXT4 support Hannes Petermaier
2015-01-30 13:25 ` [U-Boot] [PATCH 09/21] board/BuR/tseries: Change pinmux for GPIO2_28 from GPIO to PWM-Timeroutput Hannes Petermaier
2015-01-30 13:25 ` [U-Boot] [PATCH 10/21] board/BuR/tseries: Chg pinmux - use free NAND Pins in non NAND-config as GPIO Hannes Petermaier
2015-01-30 13:25 ` [U-Boot] [PATCH 11/21] board/BuR/tseries: Chg Pinmux - enable UART1 pins Hannes Petermaier
2015-01-30 13:25 ` [U-Boot] [PATCH 12/21] board/BuR/common: Introduce Network Console and common environment for it Hannes Petermaier
2015-01-30 13:25 ` [U-Boot] [PATCH 13/21] board/BuR/common: Enable CONFIG_CMD_TIME Hannes Petermaier
2015-01-30 13:25 ` [U-Boot] [PATCH 14/21] board/BuR/common: Add support for displaying BMP on LCD Hannes Petermaier
2015-01-30 13:25 ` [U-Boot] [PATCH 15/21] board/BuR/tseries: Rework default-environment settings Hannes Petermaier
2015-01-30 13:25 ` [U-Boot] [PATCH 16/21] board/BuR/tseries: cosmetic changes Hannes Petermaier
2015-01-30 13:25 ` [U-Boot] [PATCH 17/21] board/BuR/kwb: switch to board HW-Rev3 Hannes Petermaier
2015-01-30 13:25 ` [U-Boot] [PATCH 18/21] board/BuR/kwb: Support booting Linux Hannes Petermaier
2015-01-30 13:25 ` [U-Boot] [PATCH 19/21] board/BuR/kwb: Redesign default-environment Hannes Petermaier
2015-01-30 13:25 ` [U-Boot] [PATCH 20/21] board/BuR/kwb: Form a bootline for vxWorks Hannes Petermaier
2015-01-30 13:25 ` Hannes Petermaier [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1422624324-15431-21-git-send-email-oe5hpm@oevsv.at \
    --to=oe5hpm@oevsv.at \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.