Skip to contentSkip to conversation

drivers/video/am335x-fb: Add possibility to wait for stable power/picture

PATCH Superseded Hannes Petermaier 3 participants 27 messages Jan 30, 2015 – Feb 3, 2015 Framebuffer layer

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/21 drivers/video/am335x-fb: Add possibility to wait for stable power/picture

Often on boards exists a circuit which switches power on/off to LCD display. Due to the need of limiting the in-rush current the output voltage from this circuit rises "slowly", so it is necessary to wait a bit (VCC ramp up time) before starting output on LCD-pins.
This time is specified in <n> ms within the panel-settings, called "pup_delay"

Further some LCDs need a couple of frames to stabilize the image on it. We have now the possibility to wait some time after starting output on LCD. This time is also specified in <n> ms within panel-settings, called "pon_delay"

---
 drivers/video/am335x-fb.c |   13 ++++++++-----
 drivers/video/am335x-fb.h |    9 +++++++--
 2 files changed, 15 insertions(+), 7 deletions(-)
drivers/video/am335x-fb.c +8 -5
index ab98941..6f95649 100644
@@ -127,6 +127,12 @@ int am335xfb_init(struct am335x_lcdpanel *panel)
 	memset((void *)gd->fb_base, 0, 0x20);
 	*(unsigned int *)gd->fb_base = 0x4000;
 
+	/* turn ON display through powercontrol function if accessible */
+	if (0 != panel->panel_power_ctrl)
+		panel->panel_power_ctrl(1);
+
+	debug("am335x-fb: wait for stable power ...\n");
+	mdelay(panel->pup_delay);
 	lcdhw->clkc_enable = LCD_CORECLKEN | LCD_LIDDCLKEN | LCD_DMACLKEN;
 	lcdhw->raster_ctrl = 0;
 	lcdhw->ctrl = LCD_CLK_DIVISOR(panel->pxl_clk_div) | LCD_RASTER_MODE;
@@ -159,11 +165,8 @@ int am335xfb_init(struct am335x_lcdpanel *panel)
 
 	gd->fb_base += 0x20;	/* point fb behind palette */
 
-	/* turn ON display through powercontrol function if accessible */
-	if (0 != panel->panel_power_ctrl) {
-		mdelay(panel->pon_delay);
-		panel->panel_power_ctrl(1);
-	}
+	debug("am335x-fb: waiting picture to be stable.\n.");
+	mdelay(panel->pon_delay);
 
 	return 0;
 }
drivers/video/am335x-fb.h +7 -2
index 8a0b131..7f799d1 100644
@@ -55,9 +55,14 @@ struct am335x_lcdpanel {
 	unsigned int	vsw;		/* Vertical Sync Pulse Width */
 	unsigned int	pxl_clk_div;	/* Pixel clock divider*/
 	unsigned int	pol;		/* polarity of sync, clock signals */
+	unsigned int	pup_delay;	/*
+					 * time in ms after power on to
+					 * initialization of lcd-controller
+					 * (VCC ramp up time)
+					 */
 	unsigned int	pon_delay;	/*
-					 * time in ms for turning on lcd after
-					 * initializing lcd-controller
+					 * time in ms after initialization of
+					 * lcd-controller (pic stabilization)
 					 */
 	void (*panel_power_ctrl)(int);	/* fp for power on/off display */
 };
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 2/21 common/lcd: Add command for setting cursor within lcd-framework

We need this function if we want to make some outputs i.e position the writing cursor out of u-boot scripts.

---
 common/lcd.c |   21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
common/lcd.c +21 -0
index cc34b8a..f418da9 100644
@@ -279,12 +279,33 @@ static int do_lcd_clear(cmd_tbl_t *cmdtp, int flag, int argc,
 	return 0;
 }
 
+static int do_lcd_setcursor(cmd_tbl_t *cmdtp, int flag, int argc,
+			    char *const argv[])
+{
+	unsigned int col, row;
+
+	if (argc != 3)
+		return CMD_RET_USAGE;
+
+	col = simple_strtoul(argv[1], NULL, 10);
+	row = simple_strtoul(argv[2], NULL, 10);
+	lcd_position_cursor(col, row);
+
+	return 0;
+}
+
 U_BOOT_CMD(
 	cls,	1,	1,	do_lcd_clear,
 	"clear screen",
 	""
 );
 
+U_BOOT_CMD(
+	setcurs, 3,	1,	do_lcd_setcursor,
+	"sets cursor for 'puts'",
+	"    <col> <row> in character"
+);
+
 /*----------------------------------------------------------------------*/
 
 static int lcd_init(void *lcdbase)
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 2/21 common/lcd: Add command for setting cursor within lcd-framework

Hi Hannes,

Quoted 2 lines · Hannes Petermaier

We need this function if we want to make some outputs i.e position the writing cursor out of u-boot scripts.

This commit message is inaccurate. Positioning the writing cursor is not in itself output. Also, what is the use case for such a command?

Quoted 31 lines
---
  common/lcd.c |   21 +++++++++++++++++++++
  1 file changed, 21 insertions(+)
common/lcd.c +15 -0
index cc34b8a..f418da9 100644
@@ -279,12 +279,33 @@ static int do_lcd_clear(cmd_tbl_t *cmdtp, int flag, int argc,
  	return 0;
  }
 
+static int do_lcd_setcursor(cmd_tbl_t *cmdtp, int flag, int argc,
+			    char *const argv[])
+{
+	unsigned int col, row;
+
+	if (argc != 3)
+		return CMD_RET_USAGE;
+
+	col = simple_strtoul(argv[1], NULL, 10);
+	row = simple_strtoul(argv[2], NULL, 10);
+	lcd_position_cursor(col, row);
+
+	return 0;
+}
+
  U_BOOT_CMD(
  	cls,	1,	1,	do_lcd_clear,

common/lcd.c static int do_lcd_clear(cmd_tbl_t *cmdtp, int flag, int argc, · line 308

Quoted 10 lines
common/lcd.c +6 -0
  	"clear screen",
  	""
  );
 
+U_BOOT_CMD(
+	setcurs, 3,	1,	do_lcd_setcursor,
+	"sets cursor for 'puts'",
+	"    <col> <row> in character"
+);
+

I think it would be better if the U_BOOT_CMD macros were adjacent to the functions they use. Also, I think this command is better suited for the lcd_console.c file.

Quoted 4 lines
common/lcd.c +0 -0
  /*----------------------------------------------------------------------*/
 
  static int lcd_init(void *lcdbase)
Signature · 2 lines
Regards,
Nikita Kiryanov
#3 lore raw

PATCH 2/21 common/lcd: Add command for setting cursor within lcd-framework

"U-Boot" <[email protected]> schrieb am 01.02.2015 15:48:51:

Quoted 4 lines

From: Nikita Kiryanov <[email protected]>
To: Hannes Petermaier <[email protected]>, u-boot at lists.denx.de
Date: 01.02.2015 15:49
Subject: Re: [U-Boot] [PATCH 02/21] common/lcd: Add command for setting

cursor

Quoted 4 lines

within lcd-framework
Sent by: "U-Boot" <[email protected]>

Hi Hannes,

Hi Nikita,

Quoted 3 lines · Hannes Petermaier
Quoted 1 line

We need this function if we want to make some outputs i.e position the

writing

Quoted 3 lines
Quoted 1 line

cursor out of u-boot scripts.

This commit message is inaccurate. Positioning the writing cursor is not

in

Quoted 3 lines

itself output.
Also, what is the use case for such a command?

I want to set the "cursor" on the screen to a specific position and write there something
with "puts".

For example:

setcurs 1 9; sets the cursor to first column and 9th row
puts "Hello World!" writes the text to the cursor.

Quoted 11 lines

common/lcd.c static int do_lcd_clear(cmd_tbl_t *cmdtp, int

Quoted 11 lines
---
  common/lcd.c |   21 +++++++++++++++++++++
  1 file changed, 21 insertions(+)
common/lcd.c +0 -0
index cc34b8a..f418da9 100644
@@ -279,12 +279,33 @@ static int do_lcd_clear(cmd_tbl_t *cmdtp, int 

flag, int argc,

Quoted 24 lines
Quoted 24 lines
common/lcd.c +15 -0
     return 0;
  }
 
+static int do_lcd_setcursor(cmd_tbl_t *cmdtp, int flag, int argc,
+             char *const argv[])
+{
+   unsigned int col, row;
+
+   if (argc != 3)
+      return CMD_RET_USAGE;
+
+   col = simple_strtoul(argv[1], NULL, 10);
+   row = simple_strtoul(argv[2], NULL, 10);
+   lcd_position_cursor(col, row);
+
+   return 0;
+}
+
  U_BOOT_CMD(
     cls,   1,   1,   do_lcd_clear,
     "clear screen",
     ""
  );
 
Quoted 8 lines

common/lcd.c static int do_lcd_clear(cmd_tbl_t *cmdtp, int flag, int argc, · line 308

Quoted 6 lines
common/lcd.c +6 -0
+U_BOOT_CMD(
+   setcurs, 3,   1,   do_lcd_setcursor,
+   "sets cursor for 'puts'",
+   "    <col> <row> in character"
+);
+

I think it would be better if the U_BOOT_CMD macros were adjacent to the

functions they

Quoted 1 line

use. Also, I think this command is better suited for the lcd_console.c

file.

You're maybe right. Only thing for decission was, that existing commands are allready defined within
lcd.c. But i've no problem to move it. What do you say? let's move?

Quoted 2 lines
Quoted 2 lines

/*----------------------------------------------------------------------*/

Quoted 7 lines
Quoted 3 lines

static int lcd_init(void *lcdbase)

Signature · 2 lines
Regards,
Nikita Kiryanov

best regards,
Hannes

#4 lore raw

PATCH 2/21 common/lcd: Add command for setting cursor within lcd-framework

Hi Hannes,

Quoted 24 lines · Hannes Petermaier

"U-Boot" <[email protected]> schrieb am 01.02.2015 15:48:51:

Quoted 4 lines

From: Nikita Kiryanov <[email protected]>
To: Hannes Petermaier <[email protected]>, u-boot at lists.denx.de
Date: 01.02.2015 15:49
Subject: Re: [U-Boot] [PATCH 02/21] common/lcd: Add command for setting

cursor

Quoted 4 lines

within lcd-framework
Sent by: "U-Boot" <[email protected]>

Hi Hannes,

Hi Nikita,

Quoted 3 lines · Hannes Petermaier
Quoted 1 line

We need this function if we want to make some outputs i.e position the

writing

Quoted 3 lines
Quoted 1 line

cursor out of u-boot scripts.

This commit message is inaccurate. Positioning the writing cursor is not

in

Quoted 3 lines

itself output.
Also, what is the use case for such a command?

Quoted 8 lines

I want to set the "cursor" on the screen to a specific position and write there something
with "puts".

For example:

setcurs 1 9; sets the cursor to first column and 9th row
puts "Hello World!" writes the text to the cursor.

Alright... So setcurs does not output anything, just prepares us to do output. I think that's how the commit message should be phrased.

Quoted 37 lines
Quoted 7 lines
Quoted 7 lines
---
   common/lcd.c |   21 +++++++++++++++++++++
   1 file changed, 21 insertions(+)
Quoted 5 lines

common/lcd.c static int do_lcd_clear(cmd_tbl_t *cmdtp, int

Quoted 5 lines
common/lcd.c +0 -0
index cc34b8a..f418da9 100644
@@ -279,12 +279,33 @@ static int do_lcd_clear(cmd_tbl_t *cmdtp, int

flag, int argc,

Quoted 24 lines
Quoted 24 lines
common/lcd.c +15 -0
      return 0;
   }
 
+static int do_lcd_setcursor(cmd_tbl_t *cmdtp, int flag, int argc,
+             char *const argv[])
+{
+   unsigned int col, row;
+
+   if (argc != 3)
+      return CMD_RET_USAGE;
+
+   col = simple_strtoul(argv[1], NULL, 10);
+   row = simple_strtoul(argv[2], NULL, 10);
+   lcd_position_cursor(col, row);
+
+   return 0;
+}
+
   U_BOOT_CMD(
      cls,   1,   1,   do_lcd_clear,
      "clear screen",
      ""
   );
 
Quoted 3 lines
Quoted 3 lines

common/lcd.c static int do_lcd_clear(cmd_tbl_t *cmdtp, int flag, int argc, · line 305

Quoted 3 lines
common/lcd.c +3 -0
+U_BOOT_CMD(
+   setcurs, 3,   1,   do_lcd_setcursor,
+   "sets cursor for 'puts'",

Another thing: this function is not really limited to working with puts. It can do preparation for any other command that outputs to console. I recommend rewriting the description string to not mention it, maybe something along the lines of "set cursor on the screen".

Quoted 5 lines
Quoted 5 lines

common/lcd.c static int do_lcd_clear(cmd_tbl_t *cmdtp, int flag, int argc, · line 308

Quoted 3 lines
common/lcd.c +3 -0
+   "    <col> <row> in character"
+);
+

I think it would be better if the U_BOOT_CMD macros were adjacent to the

Quoted 7 lines

functions they

Quoted 1 line

use. Also, I think this command is better suited for the lcd_console.c

file.

You're maybe right. Only thing for decission was, that existing commands are allready defined within
lcd.c.

That's ok; we should place code where it's most relevant, and your command is related to lcd console functionality.

Quoted 1 line

But i've no problem to move it. What do you say? let's move?

Yes, please move it to lcd_console.c

Signature · 2 lines
Regards,
Nikita Kiryanov
#5 lore raw

PATCH 3/21 common/lcd: Add command for writing to lcd-display

In reply to Hannes Petermaier

We need this function if we want to make some outputs out of u-boot scripts.

---
 common/lcd.c |   17 +++++++++++++++++
 1 file changed, 17 insertions(+)
common/lcd.c +17 -0
index f418da9..755388f 100644
@@ -279,6 +279,17 @@ static int do_lcd_clear(cmd_tbl_t *cmdtp, int flag, int argc,
 	return 0;
 }
 
+static int do_lcd_puts(cmd_tbl_t *cmdtp, int flag, int argc,
+		       char *const argv[])
+{
+	if (argc != 2)
+		return CMD_RET_USAGE;
+
+	lcd_puts(argv[1]);
+
+	return 0;
+}
+
 static int do_lcd_setcursor(cmd_tbl_t *cmdtp, int flag, int argc,
 			    char *const argv[])
 {
@@ -306,6 +317,12 @@ U_BOOT_CMD(
 	"    <col> <row> in character"
 );
 
+U_BOOT_CMD(
+	puts,	2,	1,	do_lcd_puts,
+	"print string on lcd-framebuffer",
+	"    <string>"
+);
+
 /*----------------------------------------------------------------------*/
 
 static int lcd_init(void *lcdbase)
Signature · 1 line
1.7.9.5
#6 lore raw

PATCH 3/21 common/lcd: Add command for writing to lcd-display

Hi Hannes,

Quoted 2 lines · Hannes Petermaier

We need this function if we want to make some outputs out of u-boot scripts.

I think this commit message is missing information. What makes this necessary? Why can't your script use regular echo commands with the lcd console enabled?

Quoted 28 lines
---
  common/lcd.c |   17 +++++++++++++++++
  1 file changed, 17 insertions(+)
common/lcd.c +11 -0
index f418da9..755388f 100644
@@ -279,6 +279,17 @@ static int do_lcd_clear(cmd_tbl_t *cmdtp, int flag, int argc,
  	return 0;
  }
 
+static int do_lcd_puts(cmd_tbl_t *cmdtp, int flag, int argc,
+		       char *const argv[])
+{
+	if (argc != 2)
+		return CMD_RET_USAGE;
+
+	lcd_puts(argv[1]);
+
+	return 0;
+}
+
  static int do_lcd_setcursor(cmd_tbl_t *cmdtp, int flag, int argc,
  			    char *const argv[])
  {

common/lcd.c U_BOOT_CMD( · line 321

Quoted 5 lines
common/lcd.c +2 -0
@@ -306,6 +317,12 @@ U_BOOT_CMD(
  	"    <col> <row> in character"
  );
 
+U_BOOT_CMD(
+	puts,	2,	1,	do_lcd_puts,

"puts" is too generic for an lcd specific function. I would expect to see something with an "lcd" prefix. Also, this code seems better suited for lcd_console.c

Quoted 8 lines
common/lcd.c +4 -0
+	"print string on lcd-framebuffer",
+	"    <string>"
+);
+
  /*----------------------------------------------------------------------*/
 
  static int lcd_init(void *lcdbase)
Signature · 2 lines
Regards,
Nikita Kiryanov
#7 lore raw

PATCH 3/21 common/lcd: Add command for writing to lcd-display

Quoted 4 lines

From: Nikita Kiryanov <[email protected]>
To: Hannes Petermaier <[email protected]>, u-boot at lists.denx.de
Date: 01.02.2015 15:53
Subject: Re: [U-Boot] [PATCH 03/21] common/lcd: Add command for writing

to lcd-display

Quoted 3 lines

Sent by: "U-Boot" <[email protected]>

Hi Hannes,

Hi Nikita,

Quoted 3 lines · Hannes Petermaier
Quoted 1 line

We need this function if we want to make some outputs out of u-boot

scripts.

Quoted 3 lines
Quoted 1 line

I think this commit message is missing information. What makes this

necessary?

Quoted 1 line

Why can't your script use regular echo commands with the lcd console

enabled?

Since i don't want that stdout is redirected to LCD (customer isn't interested in watching
all output of u-boot) i need something to write out of scripts to the screen.

For example we write of script in which mode we are booting, maybe also some default ip settings
in recovery mode.

Quoted 11 lines

common/lcd.c static int do_lcd_clear(cmd_tbl_t *cmdtp, int

Quoted 11 lines
---
  common/lcd.c |   17 +++++++++++++++++
  1 file changed, 17 insertions(+)
common/lcd.c +0 -0
index f418da9..755388f 100644
@@ -279,6 +279,17 @@ static int do_lcd_clear(cmd_tbl_t *cmdtp, int 

flag, int argc,

Quoted 21 lines
Quoted 21 lines
common/lcd.c +11 -0
     return 0;
  }
 
+static int do_lcd_puts(cmd_tbl_t *cmdtp, int flag, int argc,
+             char *const argv[])
+{
+   if (argc != 2)
+      return CMD_RET_USAGE;
+
+   lcd_puts(argv[1]);
+
+   return 0;
+}
+
  static int do_lcd_setcursor(cmd_tbl_t *cmdtp, int flag, int argc,
               char *const argv[])
  {
@@ -306,6 +317,12 @@ U_BOOT_CMD(
     "    <col> <row> in character"
  );
 
Quoted 4 lines

common/lcd.c U_BOOT_CMD( · line 321

Quoted 2 lines
common/lcd.c +2 -0
+U_BOOT_CMD(
+   puts,   2,   1,   do_lcd_puts,

"puts" is too generic for an lcd specific function. I would expect to

see something

Quoted 1 line

with an "lcd" prefix. Also, this code seems better suited for

lcd_console.c

Okay, thats right - should we rename it to "lcdputs" ?

Only thing for decission was, that existing commands are allready defined within
lcd.c. But i've no problem to move it. What do you say? let's move?

Quoted 6 lines

common/lcd.c U_BOOT_CMD( · line 327

Quoted 6 lines
common/lcd.c +4 -0
+   "print string on lcd-framebuffer",
+   "    <string>"
+);
+
 

/*----------------------------------------------------------------------*/

Quoted 7 lines
Quoted 3 lines
common/lcd.c +0 -0
  static int lcd_init(void *lcdbase)
 
Signature · 2 lines
Regards,
Nikita Kiryanov

best regards,
Hannes

#8 lore raw

PATCH 3/21 common/lcd: Add command for writing to lcd-display

Hi Hannes,

Quoted 21 lines · Hannes Petermaier
Quoted 4 lines

From: Nikita Kiryanov <[email protected]>
To: Hannes Petermaier <[email protected]>, u-boot at lists.denx.de
Date: 01.02.2015 15:53
Subject: Re: [U-Boot] [PATCH 03/21] common/lcd: Add command for writing

to lcd-display

Quoted 3 lines

Sent by: "U-Boot" <[email protected]>

Hi Hannes,

Hi Nikita,

Quoted 3 lines · Hannes Petermaier
Quoted 1 line

We need this function if we want to make some outputs out of u-boot

scripts.

Quoted 3 lines
Quoted 1 line

I think this commit message is missing information. What makes this

necessary?

Quoted 1 line

Why can't your script use regular echo commands with the lcd console

enabled?

Quoted 8 lines

Since i don't want that stdout is redirected to LCD (customer isn't interested in watching
all output of u-boot) i need something to write out of scripts to the screen.

For example we write of script in which mode we are booting, maybe also some default ip settings
in recovery mode.

Alright, then please explain in the commit message that this function is meant to give user the option to output to lcd without enabling lcd console.

Quoted 38 lines
Quoted 7 lines
Quoted 7 lines
---
   common/lcd.c |   17 +++++++++++++++++
   1 file changed, 17 insertions(+)
Quoted 5 lines

common/lcd.c static int do_lcd_clear(cmd_tbl_t *cmdtp, int

Quoted 5 lines
common/lcd.c +0 -0
index f418da9..755388f 100644
@@ -279,6 +279,17 @@ static int do_lcd_clear(cmd_tbl_t *cmdtp, int

flag, int argc,

Quoted 21 lines
Quoted 21 lines
common/lcd.c +11 -0
      return 0;
   }
 
+static int do_lcd_puts(cmd_tbl_t *cmdtp, int flag, int argc,
+             char *const argv[])
+{
+   if (argc != 2)
+      return CMD_RET_USAGE;
+
+   lcd_puts(argv[1]);
+
+   return 0;
+}
+
   static int do_lcd_setcursor(cmd_tbl_t *cmdtp, int flag, int argc,
                char *const argv[])
   {
@@ -306,6 +317,12 @@ U_BOOT_CMD(
      "    <col> <row> in character"
   );
 
Quoted 4 lines

common/lcd.c U_BOOT_CMD( · line 321

Quoted 2 lines
common/lcd.c +2 -0
+U_BOOT_CMD(
+   puts,   2,   1,   do_lcd_puts,

"puts" is too generic for an lcd specific function. I would expect to

Quoted 5 lines

see something

Quoted 1 line

with an "lcd" prefix. Also, this code seems better suited for

lcd_console.c

Okay, thats right - should we rename it to "lcdputs" ?

That sounds better, yes.

Quoted 4 lines

Only thing for decission was, that existing commands are allready defined within
lcd.c.

That's ok; we should place code where it's most relevant, and your command is related to lcd console functionality.

Quoted 1 line

But i've no problem to move it. What do you say? let's move?

Yes, please move it to lcd_console.c

Signature · 2 lines
Regards,
Nikita Kiryanov
#9 lore raw

PATCH 4/21 board/BuR/common: Take usage of am335x LCD-Display

In reply to Hannes Petermaier

From now we use the am335x lcd driver and setup a display with displaying a summary screen to the lcd.
Values are taken from environment and or devicetree blob.

---
 board/BuR/common/bur_common.h |    4 +
 board/BuR/common/common.c     |  417 ++++++++++++++++++++++++++++++++++++++++-
 board/BuR/tseries/board.c     |   52 +++--
 include/configs/tseries.h     |    8 +
 include/power/tps65217.h      |    1 +
 5 files changed, 463 insertions(+), 19 deletions(-)
board/BuR/common/bur_common.h +4 -0
index 15225b0..39afbba 100644
@@ -12,6 +12,10 @@
 #ifndef _BUR_COMMON_H_
 #define _BUR_COMMON_H_
 
+#include <../../../drivers/video/am335x-fb.h>
+
+int load_lcdtiming(struct am335x_lcdpanel *panel);
+void br_summaryscreen(void);
 void blink(u32 blinks, u32 intervall, u32 pin);
 void pmicsetup(u32 mpupll);
 void enable_uart0_pin_mux(void);
board/BuR/common/common.c +416 -1

445 lines not on this page · raw message

board/BuR/tseries/board.c +34 -18

78 lines not on this page · raw message

include/configs/tseries.h +8 -0
index 9a62070..9ad294f 100644
@@ -14,6 +14,12 @@
 
 #include <configs/bur_am335x_common.h>
 /* ------------------------------------------------------------------------- */
+#define CONFIG_AM335X_LCD
+#define CONFIG_LCD
+#define CONFIG_LCD_NOSTDOUT
+#define CONFIG_SYS_WHITE_ON_BLACK
+#define LCD_BPP				LCD_COLOR32
+
 /* Clock Defines */
 #define V_OSCK				26000000  /* Clock output from T2 */
 #define V_SCLK				(V_OSCK)
@@ -22,6 +28,8 @@
 
 /* Support both device trees and ATAGs. */
 #define CONFIG_OF_LIBFDT
+#define CONFIG_USE_FDT			/* use fdt within board code */
+#define CONFIG_OF_BOARD_SETUP
 #define CONFIG_CMDLINE_TAG
 #define CONFIG_SETUP_MEMORY_TAGS
 #define CONFIG_INITRD_TAG
include/power/tps65217.h +1 -0
index 297c4cb..93cbe36 100644
@@ -73,6 +73,7 @@ enum {
 #define TPS65217_LDO_VOLTAGE_OUT_1_8		0x06
 #define TPS65217_LDO_VOLTAGE_OUT_3_3		0x1F
 
+#define TPS65217_PWR_OFF			0x80
 #define TPS65217_PWR_SRC_USB_BITMASK		0x4
 #define TPS65217_PWR_SRC_AC_BITMASK		0x8
 
Signature · 1 line
1.7.9.5
#10 lore raw

PATCH 5/21 board/BuR/common: try to setup cpsw mac-address from the devicetree

In reply to Hannes Petermaier

since we have a dtb blob programmed on the board we try to setup the cpsw interface with the programmed mac.
If this method fails, we fall back to the device-fuses.

---
 board/BuR/common/common.c |   25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)
board/BuR/common/common.c +15 -10
index 7d0e05c..18e1520 100644
@@ -591,9 +591,9 @@ static struct cpsw_platform_data cpsw_data = {
 int board_eth_init(bd_t *bis)
 {
 	int rv = 0;
-	uint8_t mac_addr[6];
+	char mac_addr[6];
+	const char *mac = 0;
 	uint32_t mac_hi, mac_lo;
-
 	/* try reading mac address from efuse */
 	mac_lo = readl(&cdev->macid0l);
 	mac_hi = readl(&cdev->macid0h);
@@ -607,14 +607,19 @@ int board_eth_init(bd_t *bis)
 #if (defined(CONFIG_DRIVER_TI_CPSW) && !defined(CONFIG_SPL_BUILD)) || \
 	(defined(CONFIG_SPL_ETH_SUPPORT) && defined(CONFIG_SPL_BUILD))
 	if (!getenv("ethaddr")) {
-		printf("<ethaddr> not set. Validating first E-fuse MAC ... ");
-
-		if (is_valid_ether_addr(mac_addr)) {
-			printf("using: %02X:%02X:%02X:%02X:%02X:%02X.\n",
-			       mac_addr[0], mac_addr[1], mac_addr[2],
-			       mac_addr[3], mac_addr[4], mac_addr[5]
-				);
-			eth_setenv_enetaddr("ethaddr", mac_addr);
+		#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_USE_FDT)
+		printf("<ethaddr> not set. trying DTB ... ");
+		mac = dtbmacaddr(0);
+		#endif
+		if (!mac) {
+			printf("<ethaddr> not set. validating E-fuse MAC ... ");
+			if (is_valid_ether_addr((const u8 *)mac_addr))
+				mac = (const char *)mac_addr;
+		}
+
+		if (mac) {
+			printf("using: %pM on ", mac);
+			eth_setenv_enetaddr("ethaddr", (const u8 *)mac);
 		}
 	}
 	writel(MII_MODE_ENABLE, &cdev->miisel);
Signature · 1 line
1.7.9.5
#11 lore raw

PATCH 6/21 board/BuR/tseries: Enable HW-Watchdog

In reply to Hannes Petermaier
---
 board/BuR/tseries/board.c |    4 ++++
 include/configs/tseries.h |    3 +++
 2 files changed, 7 insertions(+)
board/BuR/tseries/board.c +4 -0
index 66747eb..a1c6887 100644
@@ -28,6 +28,7 @@
 #include <power/tps65217.h>
 #include "../common/bur_common.h"
 #include <lcd.h>
+#include <watchdog.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -144,6 +145,9 @@ void sdram_init(void)
 /* Basic board specific setup.  Pinmux has been handled already. */
 int board_init(void)
 {
+#if defined(CONFIG_HW_WATCHDOG)
+	hw_watchdog_init();
+#endif
 	gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
 #ifdef CONFIG_NAND
 	gpmc_init();
include/configs/tseries.h +3 -0
index 9ad294f..368f588 100644
@@ -20,6 +20,9 @@
 #define CONFIG_SYS_WHITE_ON_BLACK
 #define LCD_BPP				LCD_COLOR32
 
+#define CONFIG_HW_WATCHDOG
+#define CONFIG_OMAP_WATCHDOG
+#define CONFIG_SPL_WATCHDOG_SUPPORT
 /* Clock Defines */
 #define V_OSCK				26000000  /* Clock output from T2 */
 #define V_SCLK				(V_OSCK)
Signature · 1 line
1.7.9.5
#12 lore raw

PATCH 7/21 board/BuR/tseries: Enable U-Boot BOOTCOUNT feature

In reply to Hannes Petermaier
---
 include/configs/tseries.h |    4 ++++
 1 file changed, 4 insertions(+)
include/configs/tseries.h +4 -0
index 368f588..7fd0a00 100644
@@ -23,6 +23,10 @@
 #define CONFIG_HW_WATCHDOG
 #define CONFIG_OMAP_WATCHDOG
 #define CONFIG_SPL_WATCHDOG_SUPPORT
+/* Bootcount using the RTC block */
+#define CONFIG_SYS_BOOTCOUNT_ADDR	0x44E3E000
+#define CONFIG_BOOTCOUNT_LIMIT
+#define CONFIG_BOOTCOUNT_AM33XX
 /* Clock Defines */
 #define V_OSCK				26000000  /* Clock output from T2 */
 #define V_SCLK				(V_OSCK)
Signature · 1 line
1.7.9.5
#13 lore raw

PATCH 8/21 board/BuR/tseries: Enable EXT4 support

In reply to Hannes Petermaier
---
 include/configs/tseries.h |    4 ++++
 1 file changed, 4 insertions(+)
include/configs/tseries.h +4 -0
index 7fd0a00..986db3f 100644
@@ -275,6 +275,10 @@
 #define CONFIG_DOS_PARTITION
 #define CONFIG_CMD_FAT
 #define CONFIG_FAT_WRITE
+#define CONFIG_FS_EXT4
+#define CONFIG_EXT4_WRITE
+#define CONFIG_CMD_EXT4
+#define CONFIG_CMD_EXT4_WRITE
 #define CONFIG_CMD_FS_GENERIC
 #endif /* CONFIG_MMC, ... */
 
Signature · 1 line
1.7.9.5
#14 lore raw

PATCH 9/21 board/BuR/tseries: Change pinmux for GPIO2_28 from GPIO to PWM-Timeroutput

In reply to Hannes Petermaier

From now we use this pin for the Brightness regulation from LED-Backlight.

---
 board/BuR/tseries/mux.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
board/BuR/tseries/mux.c +3 -3
index 0ba25ee..36ee04c 100644
@@ -131,9 +131,9 @@ static struct module_pin_mux gpIOs[] = {
 	{OFFSET(spi0_cs1),  (MODE(7) | PULLUDEN | PULLUP_EN | RXACTIVE)},
 	/* TIMER5   (MMC0_DAT3) - TIMER5 (Buzzer) */
 	{OFFSET(mmc0_dat3), (MODE(3) | PULLUDEN | RXACTIVE)},
-	/* TIMER6   (MMC0_DAT2) - PWM_BACK_3V3, later used as MODE3 for PWM */
-	{OFFSET(mmc0_dat2), (MODE(7) | PULLUDEN | RXACTIVE)},
-	/* GPIO2_27 (MMC0_DAT1)	 - MII_nNAND */
+	/* TIMER6   (MMC0_DAT2) - PWM_BACK_3V3 */
+	{OFFSET(mmc0_dat2), (MODE(3) | PULLUDEN | RXACTIVE)},
+	/* GPIO2_28 (MMC0_DAT1)	 - MII_nNAND */
 	{OFFSET(mmc0_dat1), (MODE(7) | PULLUDEN | RXACTIVE)},
 	/* GPIO2_29 (MMC0_DAT0)	 - NAND_1n0 */
 	{OFFSET(mmc0_dat0), (MODE(7) | PULLUDEN | RXACTIVE)},
Signature · 1 line
1.7.9.5
#15 lore raw

PATCH 10/21 board/BuR/tseries: Chg pinmux - use free NAND Pins in non NAND-config as GPIO

In reply to Hannes Petermaier

On boards were we have no NAND-flash soldered, we want to use those free pins as regular gpio.

---
 board/BuR/tseries/mux.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
board/BuR/tseries/mux.c +8 -1
index 36ee04c..330429a 100644
@@ -168,7 +168,14 @@ static struct module_pin_mux gpIOs[] = {
 	{OFFSET(mcasp0_axr0),  (MODE(7) | PULLUDDIS) },
 	/* GPIO3_17 (MCASP0_AHCLKR) - ETH2_LEDY */
 	{OFFSET(mcasp0_ahclkr), (MODE(7) | PULLUDDIS) },
-
+#ifndef CONFIG_NAND
+	/* GPIO2_3 - NAND_OE */
+	{OFFSET(gpmc_oen_ren), (MODE(7) | PULLDOWN_EN | RXACTIVE)},
+	/* GPIO2_4 - NAND_WEN */
+	{OFFSET(gpmc_wen), (MODE(7) | PULLDOWN_EN | RXACTIVE)},
+	/* GPIO2_5 - NAND_BE_CLE */
+	{OFFSET(gpmc_be0n_cle), (MODE(7) | PULLDOWN_EN | RXACTIVE)},
+#endif
 	{-1},
 };
 
Signature · 1 line
1.7.9.5
#16 lore raw

PATCH 11/21 board/BuR/tseries: Chg Pinmux - enable UART1 pins

In reply to Hannes Petermaier
---
 board/BuR/tseries/mux.c |    8 ++++++++
 1 file changed, 8 insertions(+)
board/BuR/tseries/mux.c +8 -0
index 330429a..2c87a63 100644
@@ -25,6 +25,13 @@ static struct module_pin_mux uart0_pin_mux[] = {
 	{OFFSET(uart0_txd), (MODE(0) | PULLUDEN)},
 	{-1},
 };
+static struct module_pin_mux uart1_pin_mux[] = {
+	/* UART0_RXD */
+	{OFFSET(uart1_rxd), (MODE(0) | PULLUDEN | PULLUP_EN | RXACTIVE)},
+	/* UART0_TXD */
+	{OFFSET(uart1_txd), (MODE(0) | PULLUDEN)},
+	{-1},
+};
 #ifdef CONFIG_MMC
 static struct module_pin_mux mmc1_pin_mux[] = {
 	{OFFSET(gpmc_ad7), (MODE(1) | RXACTIVE | PULLUP_EN)},	/* MMC1_DAT7 */
@@ -236,5 +243,6 @@ void enable_board_pin_mux(void)
 #endif
 	configure_module_pin_mux(spi0_pin_mux);
 	configure_module_pin_mux(lcd_pin_mux);
+	configure_module_pin_mux(uart1_pin_mux);
 	configure_module_pin_mux(gpIOs);
 }
Signature · 1 line
1.7.9.5
#17 lore raw

PATCH 12/21 board/BuR/common: Introduce Network Console and common environment for it

In reply to Hannes Petermaier

It is often necessary to "break in" into boards bootloader commandline if something fails or even for development purposes some parameters have to be changed.

So we enable u-boot's CONFIG_NETCONSOLE feature.
We also modify Networksettings to apply with this new use-case.

---
 include/configs/bur_am335x_common.h |   23 +++++++++++++++++++++--
 include/configs/tseries.h           |   33 ++++-----------------------------
 2 files changed, 25 insertions(+), 31 deletions(-)
include/configs/bur_am335x_common.h +21 -2
index e9d5d01..d7ea1c9 100644
@@ -12,6 +12,23 @@
 #ifndef __BUR_AM335X_COMMON_H__
 #define __BUR_AM335X_COMMON_H__
 /* ------------------------------------------------------------------------- */
+#define BUR_COMMON_ENV \
+"defaultip=192.168.60.253\0" \
+"defaultsip=192.168.60.254\0" \
+"netconsole=echo switching to network console ...; " \
+"if dhcp; then " \
+"setenv ncip ${serverip}; else " \
+"setenv ncip 192.168.60.254; " \
+"setenv serverip 192.168.60.254; " \
+"setenv gatewayip 192.168.60.254; " \
+"setenv ipaddr 192.168.60.1; " \
+"fi;" \
+"setenv netdisplay0 '" \
+"setcurs 1 9; puts myip; setcurs 10 9; puts ${ipaddr};" \
+"setcurs 1 10;puts serverip; setcurs 10 10; puts ${serverip}\;'" \
+"run netdisplay0; " \
+"setenv stdout nc;setenv stdin nc;setenv stderr nc\0"
+
 #define CONFIG_SYS_GENERIC_BOARD
 
 #define CONFIG_AM33XX
@@ -47,7 +64,7 @@
 #define CONFIG_BOOTP_SEND_HOSTNAME
 #define CONFIG_BOOTP_GATEWAY
 #define CONFIG_BOOTP_SUBNETMASK
-#define CONFIG_NET_RETRY_COUNT		4
+#define CONFIG_NET_RETRY_COUNT		2
 #define CONFIG_CMD_PING
 #define CONFIG_DRIVER_TI_CPSW		/* Driver for IP block */
 #define CONFIG_MII			/* Required in net/eth.c */
@@ -57,7 +74,9 @@
 #define CONFIG_SPL_NET_SUPPORT
 #define CONFIG_SPL_ENV_SUPPORT		/* used for a fetching MAC-Address */
 #define CONFIG_SPL_NET_VCI_STRING	"AM335x U-Boot SPL"
-
+/* Network console */
+#define CONFIG_NETCONSOLE			1
+#define CONFIG_BOOTP_MAY_FAIL		/* if we don't have DHCP environment */
 /*
  * SPL related defines.  The Public RAM memory map the ROM defines the
  * area between 0x402F0400 and 0x4030B800 as a download area and
include/configs/tseries.h +4 -29
index 986db3f..8e073e0 100644
@@ -125,35 +125,10 @@
 
 #ifndef CONFIG_SPL_BUILD
 #define CONFIG_EXTRA_ENV_SETTINGS \
-	"autoload=0\0" \
-	"loadaddr=0x80200000\0" \
-	"bootfile=zImage\0" \
-	"console=ttyO0,115200n8\0" \
-	"optargs=\0" \
-	"rootpath=/tftpboot/tseries/rootfs-small\0" \
-	"nfsopts=nolock\0" \
-	"netargs=setenv bootargs console=${console} " \
-		"${optargs} " \
-		"root=/dev/nfs " \
-		"nfsroot=${serverip}:${rootpath},${nfsopts} rw " \
-		"ip=dhcp\0" \
-	"netboot=echo Booting from network ...; " \
-		"setenv autoload no; " \
-		"dhcp; " \
-		"tftp ${loadaddr} ${bootfile}; " \
-		"run netargs; " \
-		"bootm ${loadaddr}\0" \
-	"usbupdate=echo Updating UBOOT from USB-Stick ...; " \
-		"usb start; " \
-		"fatload usb 0 0x80000000 updateubootusb.img; " \
-		"source;\0" \
-	"netupdate=echo Updating UBOOT from Network (TFTP) ...; " \
-		"setenv autoload 0; " \
-		"dhcp;" \
-		"tftp 0x80000000 updateUBOOT.img;" \
-		"source;\0" \
-	NANDARGS \
-	MMCARGS
+BUR_COMMON_ENV \
+"autoload=0\0" \
+NANDARGS \
+MMCARGS
 #endif /* !CONFIG_SPL_BUILD*/
 
 #define CONFIG_BOOTCOMMAND \
Signature · 1 line
1.7.9.5
#18 lore raw

PATCH 13/21 board/BuR/common: Enable CONFIG_CMD_TIME

In reply to Hannes Petermaier

time measurement of u-boot commands is needed very often during development. We add this feature until development is completed. Maybe forever :)

---
 include/configs/bur_am335x_common.h |    1 +
 1 file changed, 1 insertion(+)
include/configs/bur_am335x_common.h +1 -0
index d7ea1c9..cd15c6c 100644
@@ -29,6 +29,7 @@
 "run netdisplay0; " \
 "setenv stdout nc;setenv stdin nc;setenv stderr nc\0"
 
+#define CONFIG_CMD_TIME
 #define CONFIG_SYS_GENERIC_BOARD
 
 #define CONFIG_AM33XX
Signature · 1 line
1.7.9.5
#19 lore raw

PATCH 14/21 board/BuR/common: Add support for displaying BMP on LCD

In reply to Hannes Petermaier

Customer wants to display some logo very quickly after power on, so we support from now loading a compressed bmp.gz to the screen.

---
 include/configs/bur_am335x_common.h |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
include/configs/bur_am335x_common.h +8 -1
index cd15c6c..29c1567 100644
@@ -30,6 +30,13 @@
 "setenv stdout nc;setenv stdin nc;setenv stderr nc\0"
 
 #define CONFIG_CMD_TIME
+#define CONFIG_VIDEO_BMP_GZIP
+#define CONFIG_SYS_VIDEO_LOGO_MAX_SIZE	(1366*767*4)
+#define CONFIG_CMD_UNZIP
+#define CONFIG_CMD_BMP
+#define CONFIG_BMP_24BMP
+#define CONFIG_BMP_32BPP
+
 #define CONFIG_SYS_GENERIC_BOARD
 
 #define CONFIG_AM33XX
@@ -130,7 +137,7 @@
  * we are on so we do not need to rely on the command prompt.  We set a
  * console baudrate of 115200 and use the default baud rate table.
  */
-#define CONFIG_SYS_MALLOC_LEN		(1024 << 10)
+#define CONFIG_SYS_MALLOC_LEN		(5120 << 10)
 #define CONFIG_SYS_HUSH_PARSER
 #define CONFIG_SYS_PROMPT		"U-Boot (BuR V2.0)# "
 #define CONFIG_SYS_CONSOLE_INFO_QUIET
Signature · 1 line
1.7.9.5
#20 lore raw

PATCH 15/21 board/BuR/tseries: Rework default-environment settings.

In reply to Hannes Petermaier

Due to several changes of the boot-process we've redesigned the default- environment settings completly.

---
 include/configs/tseries.h |   71 +++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 66 insertions(+), 5 deletions(-)
include/configs/tseries.h +66 -5
index 8e073e0..a6c7d5f 100644
@@ -94,8 +94,8 @@
 #define CONFIG_SYS_NAND_U_BOOT_OFFS	0x80000
 #endif /* CONFIG_NAND */
 
-/* Always 128 KiB env size */
-#define CONFIG_ENV_SIZE			(128 << 10)
+/* Always 64 KiB env size */
+#define CONFIG_ENV_SIZE			(64 << 10)
 
 #ifdef CONFIG_NAND
 #define NANDARGS \
@@ -118,7 +118,32 @@
 
 #ifdef CONFIG_MMC
 #define MMCARGS \
-	"silent=1\0"
+"dtbdev=mmc\0" \
+"dtbpart=0:1\0" \
+"logo0=ext4load mmc 0:3 ${loadaddr} /PPTLogo.bmp.gz && " \
+	"bmp display ${loadaddr} 0 0\0" \
+"logo1=ext4load mmc 0:1 ${loadaddr} /PPTLogo.bmp.gz && " \
+	"bmp display ${loadaddr} 0 0\0" \
+"mmcroot0=setenv bootargs ${optargs} console=${console}\0" \
+"mmcroot1=setenv bootargs ${optargs} console=${console} root=/dev/mmcblk0p2 " \
+	"rootfstype=ext4\0" \
+"mmcboot0=echo booting Updatesystem from mmc (ext4-fs) ...; " \
+	"ext4load mmc 0:1 ${loadaddr} /${kernel}; " \
+	"ext4load mmc 0:1 ${ramaddr} /${ramdisk}; " \
+	"run mmcroot0; bootz ${loadaddr} ${ramaddr} ${dtbaddr};\0" \
+"mmcboot1=echo booting PPT-OS from mmc (ext4-fs) ...; " \
+	"ext4load mmc 0:2 ${loadaddr} /boot/${kernel}; " \
+	"run mmcroot1; bootz ${loadaddr} - ${dtbaddr};\0" \
+"defboot=run logo0 || run logo1; " \
+	"ext4load mmc 0:2 ${loadaddr} /boot/PPTImage.md5 && run mmcboot1; " \
+	"ext4load mmc 0:1 ${dtbaddr} /$dtb && run mmcboot0; " \
+	"run ramboot; run usbupdate;\0" \
+"bootlimit=1\0" \
+"altbootcmd=run logo0 || run logo1; " \
+	"run mmcboot0;\0" \
+"upduboot=dhcp; " \
+	"tftp ${loadaddr} MLO && mmc write ${loadaddr} 100 100; " \
+	"tftp ${loadaddr} u-boot.img && mmc write ${loadaddr} 300 400;\0"
 #else
 #define MMCARGS ""
 #endif /* CONFIG_MMC */
@@ -126,14 +151,50 @@
 #ifndef CONFIG_SPL_BUILD
 #define CONFIG_EXTRA_ENV_SETTINGS \
 BUR_COMMON_ENV \
+"verify=no\0" \
 "autoload=0\0" \
+"dtb=bur-ppt-ts30.dtb\0" \
+"dtbaddr=0x80100000\0" \
+"loadaddr=0x80200000\0" \
+"ramaddr=0x80A00000\0" \
+"kernel=zImage\0" \
+"ramdisk=rootfs.cpio.uboot\0" \
+"console=ttyO0,115200n8\0" \
+"optargs=consoleblank=0 quiet lpj=1191936 panic=2\0" \
+"nfsroot=/tftpboot/tseries/rootfs-small\0" \
+"nfsopts=nolock\0" \
+"ramargs=setenv bootargs ${optargs} console=${console} root=/dev/ram0\0" \
+"netargs=setenv bootargs console=${console} " \
+	"${optargs} " \
+	"root=/dev/nfs " \
+	"nfsroot=${serverip}:${nfsroot},${nfsopts} rw " \
+	"ip=dhcp\0" \
+"netboot=echo Booting from network ...; " \
+	"dhcp; " \
+	"tftp ${loadaddr} ${kernel}; " \
+	"tftp ${dtbaddr} ${dtb}; " \
+	"run netargs; " \
+	"bootz ${loadaddr} - ${dtbaddr}\0" \
+"ramboot=echo Booting from network into RAM ...; "\
+	"if dhcp; then; " \
+	"tftp ${loadaddr} ${kernel}; " \
+	"tftp ${ramaddr} ${ramdisk}; " \
+	"if ext4load ${dtbdev} ${dtbpart} ${dtbaddr} /${dtb}; " \
+	"then; else tftp ${dtbaddr} ${dtb}; fi;" \
+	"run mmcroot0; " \
+	"bootz ${loadaddr} ${ramaddr} ${dtbaddr}; fi;\0" \
+"usbupdate=echo Updating UBOOT from USB-Stick ...; " \
+	"usb start && fatload usb 0 0x80000000 updateubootusb.img && source\0" \
+"netupdate=echo Updating UBOOT from Network (TFTP) ...; " \
+	"setenv autoload 0; " \
+	"dhcp && tftp 0x80000000 updateUBOOT.img && source;\0" \
 NANDARGS \
 MMCARGS
 #endif /* !CONFIG_SPL_BUILD*/
 
 #define CONFIG_BOOTCOMMAND \
-	"run mmcboot1;"
-#define CONFIG_BOOTDELAY		1 /* TODO: f?r release auf 0 setzen */
+	"run defboot;"
+#define CONFIG_BOOTDELAY		0
 
 #ifdef CONFIG_NAND
 /*
Signature · 1 line
1.7.9.5
#21 lore raw

PATCH 16/21 board/BuR/tseries: cosmetic changes

In reply to Hannes Petermaier

remove unnary '#define ETHLED_ORANGE (96+16) /* GPIO3_16 */'

---
 board/BuR/tseries/board.c |    2 --
 1 file changed, 2 deletions(-)
board/BuR/tseries/board.c +0 -2
index a1c6887..9402aa4 100644
@@ -34,10 +34,8 @@ DECLARE_GLOBAL_DATA_PTR;
 
 /* --------------------------------------------------------------------------*/
 /* -- defines for GPIO -- */
-#define	ETHLED_ORANGE	(96+16)	/* GPIO3_16 */
 #define	REPSWITCH	(0+20)	/* GPIO0_20 */
 
-
 #if defined(CONFIG_SPL_BUILD)
 /* TODO: check ram-timing ! */
 static const struct ddr_data ddr3_data = {
Signature · 1 line
1.7.9.5
#22 lore raw

PATCH 17/21 board/BuR/kwb: switch to board HW-Rev3

In reply to Hannes Petermaier

The board has been redesigned, therefore we need from now other I/O Pins to mux and handle.

Older boards aren't supported from now anymore.

---
 board/BuR/kwb/board.c |   92 ++++++++++++++++++++++++++++++-------------------
 board/BuR/kwb/mux.c   |   51 +++++++++++++--------------
 include/configs/kwb.h |    9 +++--
 3 files changed, 89 insertions(+), 63 deletions(-)
board/BuR/kwb/board.c +56 -36
index 804765a..30900bc 100644
@@ -26,14 +26,13 @@
 #include <i2c.h>
 #include <power/tps65217.h>
 #include "../common/bur_common.h"
+#include <lcd.h>
 
 /* -------------------------------------------------------------------------*/
 /* -- defines for used GPIO Hardware -- */
-#define KEY						(0+4)
-#define LCD_PWR						(0+5)
-#define PUSH_KEY					(0+31)
-#define USB2SD_NRST					(32+29)
-#define USB2SD_PWR					(96+13)
+#define ESC_KEY					(0+19)
+#define LCD_PWR					(0+5)
+#define PUSH_KEY				(0+31)
 /* -------------------------------------------------------------------------*/
 /* -- PSOC Resetcontroller Register defines -- */
 
@@ -46,6 +45,7 @@
 
 /* -- defines for RSTCTRL_CTRLREG  -- */
 #define	RSTCTRL_FORCE_PWR_NEN			0x0404
+#define	RSTCTRL_CAN_STB				0x4040
 
 #if defined(CONFIG_SPL_BUILD)
 /* TODO: check ram-timing ! */
@@ -107,10 +107,13 @@ void am33xx_spl_board_init(void)
 		&cmper->epwmss0clkctrl,
 		&cmper->epwmss1clkctrl,
 		&cmper->epwmss2clkctrl,
+		&cmper->lcdclkctrl,
+		&cmper->lcdcclkstctrl,
 		0
 	};
 	do_enable_clocks(clk_domains, clk_modules_kwbspecific, 1);
-
+	/* setup LCD-Pixel Clock */
+	writel(0x2, CM_DPLL + 0x34);
 	/* power-OFF LCD-Display */
 	gpio_direction_output(LCD_PWR, 0);
 
@@ -121,7 +124,7 @@ void am33xx_spl_board_init(void)
 	/* power-ON  3V3 via Resetcontroller */
 	oldspeed = i2c_get_bus_speed();
 	if (i2c_set_bus_speed(CONFIG_SYS_OMAP24_I2C_SPEED_PSOC) >= 0) {
-		buf = RSTCTRL_FORCE_PWR_NEN;
+		buf = RSTCTRL_FORCE_PWR_NEN | RSTCTRL_CAN_STB;
 		i2c_write(RSTCTRL_ADDR, RSTCTRL_CTRLREG, 1,
 			  (uint8_t *)&buf, sizeof(buf));
 		i2c_set_bus_speed(oldspeed);
@@ -129,15 +132,6 @@ void am33xx_spl_board_init(void)
 		puts("ERROR: i2c_set_bus_speed failed! (turn on PWR_nEN)\n");
 	}
 
-#if defined(CONFIG_AM335X_USB0)
-	/* power on USB2SD Controller */
-	gpio_direction_output(USB2SD_PWR, 1);
-	mdelay(1);
-	/* give a reset Pulse to USB2SD Controller */
-	gpio_direction_output(USB2SD_NRST, 0);
-	mdelay(1);
-	gpio_set_value(USB2SD_NRST, 1);
-#endif
 	pmicsetup(0);
 }
 
@@ -166,7 +160,6 @@ int board_init(void)
 #ifdef CONFIG_BOARD_LATE_INIT
 int board_late_init(void)
 {
-	const unsigned int ton  = 250;
 	const unsigned int toff = 1000;
 	unsigned int cnt  = 3;
 	unsigned short buf = 0xAAAA;
@@ -175,50 +168,77 @@ int board_late_init(void)
 	tps65217_reg_write(TPS65217_PROT_LEVEL_NONE,
 			   TPS65217_WLEDCTRL2, 0x32, 0xFF); /* 50% dimlevel */
 
-	if (gpio_get_value(KEY)) {
+	if (gpio_get_value(ESC_KEY)) {
 		do {
-			/* turn on light */
-			tps65217_reg_write(TPS65217_PROT_LEVEL_NONE,
-					   TPS65217_WLEDCTRL1, 0x09, 0xFF);
-			mdelay(ton);
-			/* turn off light */
-			tps65217_reg_write(TPS65217_PROT_LEVEL_NONE,
-					   TPS65217_WLEDCTRL1, 0x01, 0xFF);
+			lcd_position_cursor(1, 8);
+			switch (cnt) {
+			case 3:
+				lcd_puts(
+				"release ESC-KEY to enter SERVICE-mode.");
+				break;
+			case 2:
+				lcd_puts(
+				"release ESC-KEY to enter DIAGNOSE-mode.");
+				break;
+			case 1:
+				lcd_puts(
+				"release ESC-KEY to enter BOOT-mode.    ");
+				break;
+			}
 			mdelay(toff);
 			cnt--;
-			if (!gpio_get_value(KEY) &&
+			if (!gpio_get_value(ESC_KEY) &&
+			    gpio_get_value(PUSH_KEY) && 2 == cnt) {
+				lcd_position_cursor(1, 8);
+				lcd_puts(
+				"switching to network-console ...       ");
+				setenv("bootcmd", "run netconsole");
+				cnt = 4;
+				break;
+			} else if (!gpio_get_value(ESC_KEY) &&
 			    gpio_get_value(PUSH_KEY) && 1 == cnt) {
-				puts("updating from USB ...\n");
+				lcd_position_cursor(1, 8);
+				lcd_puts(
+				"updating U-BOOT from USB ...           ");
 				setenv("bootcmd", "run usbupdate");
+				cnt = 4;
 				break;
-			} else if (!gpio_get_value(KEY)) {
+			} else if ((!gpio_get_value(ESC_KEY) &&
+				    gpio_get_value(PUSH_KEY) && cnt == 0) ||
+				    (gpio_get_value(ESC_KEY) &&
+				    gpio_get_value(PUSH_KEY) && cnt == 0)) {
+				lcd_position_cursor(1, 8);
+				lcd_puts(
+				"starting script from network ...      ");
+				setenv("bootcmd", "run netscript");
+				cnt = 4;
+				break;
+			} else if (!gpio_get_value(ESC_KEY)) {
 				break;
 			}
 		} while (cnt);
 	}
 
+	lcd_position_cursor(1, 8);
 	switch (cnt) {
 	case 0:
-		puts("3 blinks ... entering BOOT mode.\n");
+		lcd_puts("entering BOOT-mode.                    ");
+		setenv("bootcmd", "run defaultAR");
 		buf = 0x0000;
 		break;
 	case 1:
-		puts("2 blinks ... entering DIAGNOSE mode.\n");
+		lcd_puts("entering DIAGNOSE-mode.                ");
 		buf = 0x0F0F;
 		break;
 	case 2:
-		puts("1 blinks ... entering SERVICE mode.\n");
+		lcd_puts("entering SERVICE mode.                 ");
 		buf = 0xB4B4;
 		break;
 	case 3:
-		puts("0 blinks ... entering RUN mode.\n");
+		lcd_puts("loading OS...                          ");
 		buf = 0x0404;
 		break;
 	}
-	mdelay(ton);
-	/* turn on light */
-	tps65217_reg_write(TPS65217_PROT_LEVEL_NONE,
-			   TPS65217_WLEDCTRL1, 0x09, 0xFF);
 	/* write bootinfo into scratchregister of resetcontroller */
 	oldspeed = i2c_get_bus_speed();
 	if (i2c_set_bus_speed(CONFIG_SYS_OMAP24_I2C_SPEED_PSOC) >= 0) {
board/BuR/kwb/mux.c +26 -25

93 lines not on this page · raw message

include/configs/kwb.h +7 -2
index 29b263f..2c59fbd 100644
@@ -14,6 +14,11 @@
 
 #include <configs/bur_am335x_common.h>
 /* ------------------------------------------------------------------------- */
+#define CONFIG_AM335X_LCD
+#define CONFIG_LCD
+#define CONFIG_LCD_NOSTDOUT
+#define CONFIG_SYS_WHITE_ON_BLACK
+#define LCD_BPP				LCD_COLOR32
 /* Clock Defines */
 #define V_OSCK				26000000  /* Clock output from T2 */
 #define V_SCLK				(V_OSCK)
@@ -87,8 +92,6 @@
 #undef	CONFIG_BOOTM_NETBSD
 #undef	CONFIG_BOOTM_PLAN9
 #undef	CONFIG_BOOTM_RTEMS
-#undef	CONFIG_GZIP
-#undef	CONFIG_ZLIB
 
 /* USB configuration */
 #define CONFIG_USB_MUSB_DSPS
@@ -100,6 +103,8 @@
 #define CONFIG_MUSB_HOST
 #define CONFIG_AM335X_USB0
 #define CONFIG_AM335X_USB0_MODE	MUSB_HOST
+#define CONFIG_AM335X_USB1
+#define CONFIG_AM335X_USB1_MODE	MUSB_HOST
 
 #ifdef CONFIG_MUSB_HOST
 #define CONFIG_CMD_USB
Signature · 1 line
1.7.9.5
#23 lore raw

PATCH 18/21 board/BuR/kwb: Support booting Linux

In reply to Hannes Petermaier

For series testing purpose we need to boot some linux, therefore we enable the needed features

- bootz
- devicetree

---
 include/configs/kwb.h |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
include/configs/kwb.h +8 -1
index 2c59fbd..7989f4b 100644
@@ -88,10 +88,17 @@
 #define CONFIG_BOOTDELAY		1 /* TODO: f?r release auf 0 setzen */
 
 /* undefine command which we not need here */
-#undef	CONFIG_BOOTM_LINUX
 #undef	CONFIG_BOOTM_NETBSD
 #undef	CONFIG_BOOTM_PLAN9
 #undef	CONFIG_BOOTM_RTEMS
+#undef CONFIG_CMD_CRC32
+
+/* Support both device trees and ATAGs. */
+#define CONFIG_OF_LIBFDT
+#define CONFIG_CMDLINE_TAG
+#define CONFIG_SETUP_MEMORY_TAGS
+#define CONFIG_INITRD_TAG
+#define CONFIG_CMD_BOOTZ
 
 /* USB configuration */
 #define CONFIG_USB_MUSB_DSPS
Signature · 1 line
1.7.9.5
#24 lore raw

PATCH 19/21 board/BuR/kwb: Redesign default-environment

In reply to Hannes Petermaier

Due to several changes in the boot-process we do a complete redesign of the default environment.

---
 include/configs/kwb.h |   81 +++++++++++++++++++++++++++----------------------
 1 file changed, 45 insertions(+), 36 deletions(-)
include/configs/kwb.h +45 -36
index 7989f4b..dd30df2 100644
@@ -43,49 +43,58 @@
 #define CONFIG_SYS_U_BOOT_MAX_SIZE_SECTORS		0x200 /* 256 KB */
 #define CONFIG_SPL_MMC_SUPPORT
 
-#undef CONFIG_SPL_OS_BOOT
-#ifdef CONFIG_SPL_OS_BOOT
-#define CONFIG_SYS_SPL_ARGS_ADDR		0x80F80000
-
-/* RAW SD card / eMMC */
-#define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR	0x900	/* address 0x120000 */
-#define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR	0x80	/* address 0x10000 */
-#define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS	0x80	/* 64KiB */
-
-#endif /* CONFIG_SPL_OS_BOOT */
-
-/* Always 128 KiB env size */
-#define CONFIG_ENV_SIZE			(128 << 10)
+/* Always 64 KiB env size */
+#define CONFIG_ENV_SIZE			(64 << 10)
 
 #ifndef CONFIG_SPL_BUILD
 #define CONFIG_EXTRA_ENV_SETTINGS \
-	"autoload=0\0" \
-	"loadaddr=0x80100000\0" \
-	"bootfile=arimg\0" \
-	"usbboot=echo Booting from USB-Stick ...; " \
-		"usb start; " \
-		"fatload usb 0 ${loadaddr} ${bootfile}; " \
-		"usb stop; " \
-		"go ${loadaddr};\0" \
-	"netboot=echo Booting from network ...; " \
-		"setenv autoload 0; " \
-		"dhcp; " \
-		"tftp ${loadaddr} arimg; " \
-		"go ${loadaddr}\0" \
-	"usbupdate=echo Updating UBOOT from USB-Stick ...; " \
-		"usb start; " \
-		"fatload usb 0 0x80000000 updateubootusb.img; " \
-		"source;\0" \
-	"netupdate=echo Updating UBOOT from Network (TFTP) ...; " \
-		"setenv autoload 0; " \
-		"dhcp;" \
-		"tftp 0x80000000 updateUBOOT.img;" \
-		"source;\0"
+BUR_COMMON_ENV \
+"vx_romfsbase=0x800E0000\0" \
+"vx_romfssize=0x20000\0" \
+"vx_memtop=0x8FBEF000\0" \
+"loadromfs=mmc read ${vx_romfsbase} 700 100\0" \
+"autoload=0\0" \
+"loadaddr=0x80100000\0" \
+"logoaddr=0x82000000\0" \
+"defaultARlen=0x8000\0" \
+"loaddefaultAR=mmc read ${loadaddr} 800 ${defaultARlen}\0" \
+"defaultAR=run loadromfs; run loaddefaultAR; go ${loadaddr}\0" \
+"logo0=fatload mmc 0:1 ${logoaddr} SYSTEM/ADDON/Bootlogo/Bootlogo.bmp.gz && " \
+	"bmp display ${logoaddr} 0 0\0" \
+"logo1=fatload mmc 0:1 ${logoaddr} SYSTEM/BASE/Bootlogo/Bootlogo.bmp.gz && " \
+	"bmp display ${logoaddr} 0 0\0" \
+"mmcboot=echo booting AR from eMMC-flash ...; "\
+	"run logo0 || run logo1; " \
+	"run loadromfs; " \
+	"fatload mmc 0:1 ${loadaddr} arimg && go ${loadaddr}; " \
+	"run defaultAR;\0" \
+"netboot=echo booting AR from network ...; " \
+	"run loadromfs; " \
+	"tftp ${loadaddr} arimg && go ${loadaddr}; " \
+	"puts 'networkboot failed!';\0" \
+"usbupdate=echo updating u-boot from usb ...; " \
+	"usb start; " \
+	"fatload usb 0 0x80000000 updateubootusb.img && source; " \
+	"puts 'usbupdate failed!'\0" \
+"netscript=echo running script from network (tftp) ...; " \
+	"tftp 0x80000000 netscript.img && source; " \
+	"puts 'netscript load failed!'\0" \
+"netupdate=tftp ${loadddr} MLO && mmc write ${loadaddr} 100 100; " \
+	"tftp ${loadaddr} u-boot.img && mmc write ${loadaddr} 300 300\0" \
+"netupdatedefaultAR=echo updating defaultAR from network (tftp) ...; " \
+	"if tftp 0x80100000 arimg.bin; " \
+	"then mmc write 0x80100000 800 ${defaultARlen}; " \
+	"else setcurs 1 8; puts 'defAR update failed (tftp)!'; fi;\0" \
+"netupdateROMFS=echo updating romfs from network (tftp) ...; " \
+	"if tftp 0x80100000 romfs.bin; " \
+	"then mmc write 0x80100000 700 100; " \
+	"else setcurs 1 8; puts 'romfs update failed (tftp)!'; fi;\0"
+
 #endif /* !CONFIG_SPL_BUILD*/
 
 #define CONFIG_BOOTCOMMAND \
 	"run usbupdate;"
-#define CONFIG_BOOTDELAY		1 /* TODO: f?r release auf 0 setzen */
+#define CONFIG_BOOTDELAY		0
 
 /* undefine command which we not need here */
 #undef	CONFIG_BOOTM_NETBSD
Signature · 1 line
1.7.9.5
#25 lore raw

PATCH 20/21 board/BuR/kwb: Form a bootline for vxWorks

In reply to Hannes Petermaier

vxWorks needs several parameters which are set by the bootloader und his environment. So we form a vxWorks bootline and pass the result to vxWorks on a predefined address.

---
 board/BuR/kwb/board.c |   30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
board/BuR/kwb/board.c +30 -0
index 30900bc..455f472 100644
@@ -47,6 +47,12 @@
 #define	RSTCTRL_FORCE_PWR_NEN			0x0404
 #define	RSTCTRL_CAN_STB				0x4040
 
+#define VXWORKS_BOOTLINE			0x80001100
+#define DEFAULT_BOOTLINE	"cpsw(0,0):pme/vxWorks"
+#define VXWORKS_USER		"u=vxWorksFTP pw=vxWorks tn=vxtarget"
+
+DECLARE_GLOBAL_DATA_PTR;
+
 #if defined(CONFIG_SPL_BUILD)
 /* TODO: check ram-timing ! */
 static const struct ddr_data ddr3_data = {
@@ -248,6 +254,30 @@ int board_late_init(void)
 	} else {
 		puts("ERROR: i2c_set_bus_speed failed! (scratchregister)\n");
 	}
+	/* setup vxworks bootline */
+	char *vxworksbootline = (char *)VXWORKS_BOOTLINE;
+
+	/* setup default IP, in case if there is nothing in environment */
+	if (!getenv("ipaddr")) {
+		setenv("ipaddr", "192.168.60.1");
+		setenv("netmask", "255.255.255.0");
+		setenv("serverip", "192.168.60.254");
+		setenv("gatewayip", "192.168.60.254");
+		puts("net: had no IP! made default setup.\n");
+	}
+
+	sprintf(vxworksbootline,
+		"%s h=%s e=%s:%s g=%s %s o=0x%08x;0x%08x;0x%08x;0x%08x",
+		DEFAULT_BOOTLINE,
+		getenv("serverip"),
+		getenv("ipaddr"), getenv("netmask"),
+		getenv("gatewayip"),
+		VXWORKS_USER,
+		(unsigned int) gd->fb_base-0x20,
+		(u32)getenv_ulong("vx_memtop", 16, gd->fb_base-0x20),
+		(u32)getenv_ulong("vx_romfsbase", 16, 0),
+		(u32)getenv_ulong("vx_romfssize", 16, 0));
+
 	/*
 	 * reset VBAR registers to its reset location, VxWorks 6.9.3.2 does
 	 * expect that vectors are there, original u-boot moves them to _start
Signature · 1 line
1.7.9.5
#26 lore raw

PATCH 21/21 board/BuR/kwb: Support modify bootcmd through reset-controller

In reply to Hannes Petermaier

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.

---
 board/BuR/kwb/board.c |   30 ++++++++++++++++++++++++++++--
 1 file changed, 28 insertions(+), 2 deletions(-)
board/BuR/kwb/board.c +28 -2
index 455f472..892311e 100644
@@ -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);
Signature · 1 line
1.7.9.5