[U-Boot] [PATCH 00/14] Nokia RX-51 support

This patch series add support for new board Nokia RX-51 (aka N900). Last two patches adding on screen bootmenu support.
This series supersedes the last sent version.
Pali Rohár (14): arm,omap3: Define save_boot_params in lowlevel_init.S for SPL only arm: Optionally use existing atags in bootm.c Add power bus message definitions in twl4030.h Fix function readline in main.c cfb_console: Fix function console_scrollup cfb_console: Add function console_clear and console_clear_line cfb_console: Add functions for moving with cursor cfb_console: Add support for some ANSI terminal escape codes New command clear: Clear the ANSI terminal New config variable CONFIG_MENUCMD New config variable CONFIG_PREMONITOR New board support: Nokia RX-51 aka N900 New command bootmenu: ANSI terminal Boot Menu support RX-51: Add support for bootmenu
README | 2 + arch/arm/cpu/armv7/omap3/lowlevel_init.S | 4 +- arch/arm/lib/bootm.c | 39 +++- board/nokia/rx51/Makefile | 46 ++++ board/nokia/rx51/lowlevel_init.S | 79 ++++++ board/nokia/rx51/rx51.c | 381 ++++++++++++++++++++++++++++++ board/nokia/rx51/rx51.h | 378 +++++++++++++++++++++++++++++ boards.cfg | 1 + common/Makefile | 2 + common/cmd_bootmenu.c | 366 ++++++++++++++++++++++++++++ common/cmd_clear.c | 42 ++++ common/env_common.c | 3 + common/main.c | 89 ++++++- drivers/video/cfb_console.c | 346 +++++++++++++++++++++++++-- include/common.h | 20 ++ include/config_cmd_all.h | 2 + include/configs/nokia_rx51.h | 375 +++++++++++++++++++++++++++++ include/twl4030.h | 98 ++++++++ 18 files changed, 2233 insertions(+), 40 deletions(-) create mode 100644 board/nokia/rx51/Makefile create mode 100644 board/nokia/rx51/lowlevel_init.S create mode 100644 board/nokia/rx51/rx51.c create mode 100644 board/nokia/rx51/rx51.h create mode 100644 common/cmd_bootmenu.c create mode 100644 common/cmd_clear.c create mode 100644 include/configs/nokia_rx51.h

* Hide function save_boot_params if CONFIG_SPL_BUILD is not defined (function do nothing)
* Same behaviour as in file arch/arm/cpu/armv7/omap4/lowlevel_init.S * This allow to implement board specified function save_boot_params in board code
Signed-off-by: Pali Rohár pali.rohar@gmail.com --- Changes since original version: - Fixed commit message
arch/arm/cpu/armv7/omap3/lowlevel_init.S | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/cpu/armv7/omap3/lowlevel_init.S b/arch/arm/cpu/armv7/omap3/lowlevel_init.S index 2f6930b..c42c5dd 100644 --- a/arch/arm/cpu/armv7/omap3/lowlevel_init.S +++ b/arch/arm/cpu/armv7/omap3/lowlevel_init.S @@ -35,15 +35,15 @@ _TEXT_BASE: .word CONFIG_SYS_TEXT_BASE /* sdram load addr from config.mk */
+#ifdef CONFIG_SPL_BUILD .global save_boot_params save_boot_params: -#ifdef CONFIG_SPL_BUILD ldr r4, =omap3_boot_device ldr r5, [r0, #0x4] and r5, r5, #0xff str r5, [r4] -#endif bx lr +#endif
.global omap3_gp_romcode_call omap3_gp_romcode_call:

- Hide function save_boot_params if CONFIG_SPL_BUILD is not defined
(function do nothing)
What do you mean by this statement here ?
- Same behaviour as in file arch/arm/cpu/armv7/omap4/lowlevel_init.S
Eh?
- This allow to implement board specified function save_boot_params in
board code
I see ... do you want to write overridable function? Make it a weak alias?
M
Signed-off-by: Pali Rohár pali.rohar@gmail.com
Changes since original version:
- Fixed commit message
arch/arm/cpu/armv7/omap3/lowlevel_init.S | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/cpu/armv7/omap3/lowlevel_init.S b/arch/arm/cpu/armv7/omap3/lowlevel_init.S index 2f6930b..c42c5dd 100644 --- a/arch/arm/cpu/armv7/omap3/lowlevel_init.S +++ b/arch/arm/cpu/armv7/omap3/lowlevel_init.S @@ -35,15 +35,15 @@ _TEXT_BASE: .word CONFIG_SYS_TEXT_BASE /* sdram load addr from config.mk */
+#ifdef CONFIG_SPL_BUILD .global save_boot_params save_boot_params: -#ifdef CONFIG_SPL_BUILD ldr r4, =omap3_boot_device ldr r5, [r0, #0x4] and r5, r5, #0xff str r5, [r4] -#endif bx lr
Wasn't this jump intentionally left out from the macro ifdef block?
+#endif
.global omap3_gp_romcode_call omap3_gp_romcode_call:

On Wed, Jan 25, 2012 at 11:00 AM, Marek Vasut marek.vasut@gmail.com wrote:
- Hide function save_boot_params if CONFIG_SPL_BUILD is not defined
(function do nothing)
What do you mean by this statement here ?
- Same behaviour as in file arch/arm/cpu/armv7/omap4/lowlevel_init.S
Eh?
- This allow to implement board specified function save_boot_params in
board code
I see ... do you want to write overridable function? Make it a weak alias?
There is a weak one today, but we globally replace it for 'omap3' today. The N900 needs its own version however.

On Tue, Jan 24, 2012 at 7:27 AM, Pali Rohár pali.rohar@gmail.com wrote:
- Hide function save_boot_params if CONFIG_SPL_BUILD is not defined (function do nothing)
This is fine.
- Same behaviour as in file arch/arm/cpu/armv7/omap4/lowlevel_init.S
This isn't quite right. OMAP4/5 and AM33XX can re-use the same code here to determine boot device/mode but it's not the same as 'OMAP3.'
- This allow to implement board specified function save_boot_params in board code
This is fine.
Signed-off-by: Pali Rohár pali.rohar@gmail.com
So I will apply this, but modify the commit message slightly.

On Tuesday 24 January 2012 15:27:58 Pali Rohár wrote:
- Hide function save_boot_params if CONFIG_SPL_BUILD is not defined
(function do nothing)
- Same behaviour as in file arch/arm/cpu/armv7/omap4/lowlevel_init.S
- This allow to implement board specified function save_boot_params in board
code
Signed-off-by: Pali Rohár pali.rohar@gmail.com
Changes since original version:
- Fixed commit message
arch/arm/cpu/armv7/omap3/lowlevel_init.S | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/cpu/armv7/omap3/lowlevel_init.S b/arch/arm/cpu/armv7/omap3/lowlevel_init.S index 2f6930b..c42c5dd 100644 --- a/arch/arm/cpu/armv7/omap3/lowlevel_init.S +++ b/arch/arm/cpu/armv7/omap3/lowlevel_init.S @@ -35,15 +35,15 @@ _TEXT_BASE: .word CONFIG_SYS_TEXT_BASE /* sdram load addr from config.mk */
+#ifdef CONFIG_SPL_BUILD .global save_boot_params save_boot_params: -#ifdef CONFIG_SPL_BUILD ldr r4, =omap3_boot_device ldr r5, [r0, #0x4] and r5, r5, #0xff str r5, [r4] -#endif bx lr +#endif
.global omap3_gp_romcode_call omap3_gp_romcode_call:
Now I see that somebody commited this patch to u-boot: http://git.denx.de/?p=u- boot.git;a=commit;h=204705111ca10f52f62e1a02ba567d8fc33a6d1e
So I will not include it in new version.
Please, can you inform me when somebody commit my patches to git master?

On Tue, Feb 28, 2012 at 9:25 AM, Pali Rohár pali.rohar@gmail.com wrote:
On Tuesday 24 January 2012 15:27:58 Pali Rohár wrote:
- Hide function save_boot_params if CONFIG_SPL_BUILD is not defined
(function do nothing)
- Same behaviour as in file arch/arm/cpu/armv7/omap4/lowlevel_init.S
- This allow to implement board specified function save_boot_params in board
code
Signed-off-by: Pali Rohár pali.rohar@gmail.com
Changes since original version: - Fixed commit message
arch/arm/cpu/armv7/omap3/lowlevel_init.S | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/cpu/armv7/omap3/lowlevel_init.S b/arch/arm/cpu/armv7/omap3/lowlevel_init.S index 2f6930b..c42c5dd 100644 --- a/arch/arm/cpu/armv7/omap3/lowlevel_init.S +++ b/arch/arm/cpu/armv7/omap3/lowlevel_init.S @@ -35,15 +35,15 @@ _TEXT_BASE: .word CONFIG_SYS_TEXT_BASE /* sdram load addr from config.mk */
+#ifdef CONFIG_SPL_BUILD .global save_boot_params save_boot_params: -#ifdef CONFIG_SPL_BUILD ldr r4, =omap3_boot_device ldr r5, [r0, #0x4] and r5, r5, #0xff str r5, [r4] -#endif bx lr +#endif
.global omap3_gp_romcode_call omap3_gp_romcode_call:
Now I see that somebody commited this patch to u-boot: http://git.denx.de/?p=u- boot.git;a=commit;h=204705111ca10f52f62e1a02ba567d8fc33a6d1e
So I will not include it in new version.
Please, can you inform me when somebody commit my patches to git master?
I did: http://patchwork.ozlabs.org/patch/137559/ :)

On Tue, Feb 28, 2012 at 9:25 AM, Pali Rohár pali.rohar@gmail.com wrote:
On Tuesday 24 January 2012 15:27:58 Pali Rohár wrote:
- Hide function save_boot_params if CONFIG_SPL_BUILD is not defined
(function do nothing)
- Same behaviour as in file arch/arm/cpu/armv7/omap4/lowlevel_init.S
- This allow to implement board specified function save_boot_params in
board code
Signed-off-by: Pali Rohár pali.rohar@gmail.com
Changes since original version:
- Fixed commit message
arch/arm/cpu/armv7/omap3/lowlevel_init.S | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/cpu/armv7/omap3/lowlevel_init.S b/arch/arm/cpu/armv7/omap3/lowlevel_init.S index 2f6930b..c42c5dd 100644 --- a/arch/arm/cpu/armv7/omap3/lowlevel_init.S +++ b/arch/arm/cpu/armv7/omap3/lowlevel_init.S @@ -35,15 +35,15 @@ _TEXT_BASE: .word CONFIG_SYS_TEXT_BASE /* sdram load addr from config.mk */
+#ifdef CONFIG_SPL_BUILD .global save_boot_params save_boot_params: -#ifdef CONFIG_SPL_BUILD ldr r4, =omap3_boot_device ldr r5, [r0, #0x4] and r5, r5, #0xff str r5, [r4] -#endif bx lr +#endif
.global omap3_gp_romcode_call
omap3_gp_romcode_call:
Now I see that somebody commited this patch to u-boot: http://git.denx.de/?p=u- boot.git;a=commit;h=204705111ca10f52f62e1a02ba567d8fc33a6d1e
So I will not include it in new version.
Please, can you inform me when somebody commit my patches to git master?
Do we really want this hack-around? Maybe generating such bootargs by uboot in the first place (or the ability to actually source bootargs and adjust env accordingly) won't be too bad of a solution?
M

On Wed, Feb 29, 2012 at 10:37:06PM +0100, Marek Vasut wrote:
On Tue, Feb 28, 2012 at 9:25 AM, Pali Roh?r pali.rohar@gmail.com wrote:
On Tuesday 24 January 2012 15:27:58 Pali Roh?r wrote:
- Hide function save_boot_params if CONFIG_SPL_BUILD is not defined
(function do nothing)
- Same behaviour as in file arch/arm/cpu/armv7/omap4/lowlevel_init.S
- This allow to implement board specified function save_boot_params in
board code
Signed-off-by: Pali Roh?r pali.rohar@gmail.com
Changes since original version:
- Fixed commit message
arch/arm/cpu/armv7/omap3/lowlevel_init.S | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/cpu/armv7/omap3/lowlevel_init.S b/arch/arm/cpu/armv7/omap3/lowlevel_init.S index 2f6930b..c42c5dd 100644 --- a/arch/arm/cpu/armv7/omap3/lowlevel_init.S +++ b/arch/arm/cpu/armv7/omap3/lowlevel_init.S @@ -35,15 +35,15 @@ _TEXT_BASE: .word CONFIG_SYS_TEXT_BASE /* sdram load addr from config.mk */
+#ifdef CONFIG_SPL_BUILD .global save_boot_params save_boot_params: -#ifdef CONFIG_SPL_BUILD ldr r4, =omap3_boot_device ldr r5, [r0, #0x4] and r5, r5, #0xff str r5, [r4] -#endif bx lr +#endif
.global omap3_gp_romcode_call
omap3_gp_romcode_call:
Now I see that somebody commited this patch to u-boot: http://git.denx.de/?p=u- boot.git;a=commit;h=204705111ca10f52f62e1a02ba567d8fc33a6d1e
So I will not include it in new version.
Please, can you inform me when somebody commit my patches to git master?
Do we really want this hack-around? Maybe generating such bootargs by uboot in the first place (or the ability to actually source bootargs and adjust env accordingly) won't be too bad of a solution?
IMHO, yes. There is value in being able to use u-boot as a useful shim when we don't control 100% of the sequence.

Dear Tom Rini,
On Wed, Feb 29, 2012 at 10:37:06PM +0100, Marek Vasut wrote:
On Tue, Feb 28, 2012 at 9:25 AM, Pali Roh?r pali.rohar@gmail.com wrote:
On Tuesday 24 January 2012 15:27:58 Pali Roh?r wrote:
- Hide function save_boot_params if CONFIG_SPL_BUILD is not defined
(function do nothing)
- Same behaviour as in file arch/arm/cpu/armv7/omap4/lowlevel_init.S
- This allow to implement board specified function save_boot_params
in board code
Signed-off-by: Pali Roh?r pali.rohar@gmail.com
Changes since original version:
- Fixed commit message
arch/arm/cpu/armv7/omap3/lowlevel_init.S | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/cpu/armv7/omap3/lowlevel_init.S b/arch/arm/cpu/armv7/omap3/lowlevel_init.S index 2f6930b..c42c5dd 100644 --- a/arch/arm/cpu/armv7/omap3/lowlevel_init.S +++ b/arch/arm/cpu/armv7/omap3/lowlevel_init.S @@ -35,15 +35,15 @@
_TEXT_BASE: .word CONFIG_SYS_TEXT_BASE /* sdram load addr from config.mk
*/
+#ifdef CONFIG_SPL_BUILD
.global save_boot_params
save_boot_params: -#ifdef CONFIG_SPL_BUILD
ldr r4, =omap3_boot_device ldr r5, [r0, #0x4] and r5, r5, #0xff str r5, [r4]
-#endif
bx lr
+#endif
.global omap3_gp_romcode_call
omap3_gp_romcode_call:
Now I see that somebody commited this patch to u-boot: http://git.denx.de/?p=u- boot.git;a=commit;h=204705111ca10f52f62e1a02ba567d8fc33a6d1e
So I will not include it in new version.
Please, can you inform me when somebody commit my patches to git master?
Do we really want this hack-around? Maybe generating such bootargs by uboot in the first place (or the ability to actually source bootargs and adjust env accordingly) won't be too bad of a solution?
IMHO, yes. There is value in being able to use u-boot as a useful shim when we don't control 100% of the sequence.
Well ... I won't argue, it's your start.S that's gonne be bloated ;-)
Best regards, Marek Vasut

This patch adapts the bootm command so that it can use an existing atags command set up by a previous bootloader. If the environment variable "atagaddr" is unset, bootm behaves as normal. If "atagaddr" is set, bootm will use atags address from environment variable and also append new boot args (if specified in u-boot). For example, if a previous boot loader already set up the atags struct at 0x80000100:
setenv atagaddr 0x80000100; bootm 0x80008000
Signed-off-by: Pali Rohár pali.rohar@gmail.com --- Changes since original version: - Added info to README file - Added local define CONFIG_SETUP_ANY_TAG - Fixed compile warning - Fixed commit message - Check if atagaddr is not NULL
README | 2 ++ arch/arm/lib/bootm.c | 39 ++++++++++++++++++++++++++++++++------- 2 files changed, 34 insertions(+), 7 deletions(-)
diff --git a/README b/README index 9d713e8..8c3b98a 100644 --- a/README +++ b/README @@ -3584,6 +3584,8 @@ Some configuration options can be set using Environment Variables.
List of environment variables (most likely not complete):
+ atagaddr - bootm will use ATAGs struct from specified address (arm only) + baudrate - see CONFIG_BAUDRATE
bootdelay - see CONFIG_BOOTDELAY diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c index afa0093..8366dd5 100644 --- a/arch/arm/lib/bootm.c +++ b/arch/arm/lib/bootm.c @@ -93,6 +93,14 @@ static void announce_and_cleanup(void) cleanup_before_linux(); }
+#if defined(CONFIG_SETUP_MEMORY_TAGS) || \ +defined(CONFIG_CMDLINE_TAG) || \ +defined(CONFIG_INITRD_TAG) || \ +defined(CONFIG_SERIAL_TAG) || \ +defined(CONFIG_REVISION_TAG) +#define CONFIG_SETUP_ANY_TAG +#endif + int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images) { bd_t *bd = gd->bd; @@ -125,12 +133,22 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images) debug ("## Transferring control to Linux (at address %08lx) ...\n", (ulong) kernel_entry);
-#if defined (CONFIG_SETUP_MEMORY_TAGS) || \ - defined (CONFIG_CMDLINE_TAG) || \ - defined (CONFIG_INITRD_TAG) || \ - defined (CONFIG_SERIAL_TAG) || \ - defined (CONFIG_REVISION_TAG) - setup_start_tag (bd); + s = getenv("atagaddr"); + if (s) + bd->bi_boot_params = simple_strtoul(s, NULL, 16); + + if (bd->bi_boot_params) { + printf("Using existing atags at %#lx\n", bd->bi_boot_params); + + params = (struct tag *) bd->bi_boot_params; + while (params->hdr.size > 0) + params = tag_next(params); + } else { +#ifdef CONFIG_SETUP_ANY_TAG + setup_start_tag(bd); +#endif + } + #ifdef CONFIG_SERIAL_TAG setup_serial_tag (¶ms); #endif @@ -147,8 +165,15 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images) if (images->rd_start && images->rd_end) setup_initrd_tag (bd, images->rd_start, images->rd_end); #endif - setup_end_tag(bd); + + if (s) { + if (params->hdr.size > 0) + setup_end_tag(bd); + } else { +#ifdef CONFIG_SETUP_ANY_TAG + setup_end_tag(bd); #endif + }
announce_and_cleanup();

This patch adapts the bootm command so that it can use an existing atags command set up by a previous bootloader.
Why do you need it?
If the environment variable "atagaddr" is unset, bootm behaves as normal. If "atagaddr" is set, bootm will use atags address from environment variable and also append new boot args (if specified in u-boot). For example, if a previous boot loader already set up the atags struct at 0x80000100:
setenv atagaddr 0x80000100; bootm 0x80008000
Can't you set those atags correctly in uboot?
M
Signed-off-by: Pali Rohár pali.rohar@gmail.com
Changes since original version:
- Added info to README file
- Added local define CONFIG_SETUP_ANY_TAG
- Fixed compile warning
- Fixed commit message
- Check if atagaddr is not NULL
README | 2 ++ arch/arm/lib/bootm.c | 39 ++++++++++++++++++++++++++++++++------- 2 files changed, 34 insertions(+), 7 deletions(-)
diff --git a/README b/README index 9d713e8..8c3b98a 100644 --- a/README +++ b/README @@ -3584,6 +3584,8 @@ Some configuration options can be set using Environment Variables.
List of environment variables (most likely not complete):
atagaddr - bootm will use ATAGs struct from specified address (arm only)
baudrate - see CONFIG_BAUDRATE
bootdelay - see CONFIG_BOOTDELAY
diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c index afa0093..8366dd5 100644 --- a/arch/arm/lib/bootm.c +++ b/arch/arm/lib/bootm.c @@ -93,6 +93,14 @@ static void announce_and_cleanup(void) cleanup_before_linux(); }
+#if defined(CONFIG_SETUP_MEMORY_TAGS) || \ +defined(CONFIG_CMDLINE_TAG) || \ +defined(CONFIG_INITRD_TAG) || \ +defined(CONFIG_SERIAL_TAG) || \ +defined(CONFIG_REVISION_TAG) +#define CONFIG_SETUP_ANY_TAG +#endif
int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images) { bd_t *bd = gd->bd; @@ -125,12 +133,22 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images) debug ("## Transferring control to Linux (at address %08lx) ...\n", (ulong) kernel_entry);
-#if defined (CONFIG_SETUP_MEMORY_TAGS) || \
- defined (CONFIG_CMDLINE_TAG) || \
- defined (CONFIG_INITRD_TAG) || \
- defined (CONFIG_SERIAL_TAG) || \
- defined (CONFIG_REVISION_TAG)
- setup_start_tag (bd);
- s = getenv("atagaddr");
- if (s)
bd->bi_boot_params = simple_strtoul(s, NULL, 16);
- if (bd->bi_boot_params) {
printf("Using existing atags at %#lx\n", bd->bi_boot_params);
params = (struct tag *) bd->bi_boot_params;
while (params->hdr.size > 0)
params = tag_next(params);
- } else {
+#ifdef CONFIG_SETUP_ANY_TAG
setup_start_tag(bd);
+#endif
- }
#ifdef CONFIG_SERIAL_TAG setup_serial_tag (¶ms); #endif @@ -147,8 +165,15 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images) if (images->rd_start && images->rd_end) setup_initrd_tag (bd, images->rd_start, images->rd_end); #endif
- setup_end_tag(bd);
- if (s) {
if (params->hdr.size > 0)
setup_end_tag(bd);
- } else {
+#ifdef CONFIG_SETUP_ANY_TAG
setup_end_tag(bd);
#endif
}
announce_and_cleanup();

On Wednesday 25 January 2012 19:02:45 Marek Vasut wrote:
This patch adapts the bootm command so that it can use an existing atags command set up by a previous bootloader.
Why do you need it?
Default Nokia kernel has patches which using non-standard atags for reporting bootmode, bootreason, hw-rev, NOLO version, boot count, ...
Closed-source Maemo application need to know these properties (read via /proc/bootreason, ...) and will restart device if there is error.
So U-Boot must can reuse old atags from NOLO and tell it new kernel.
If the environment variable "atagaddr" is unset, bootm behaves as normal. If "atagaddr" is set, bootm will use atags address from environment variable and also append new boot args (if specified in u-boot). For example, if a previous boot loader already set up the atags struct at 0x80000100:
setenv atagaddr 0x80000100; bootm 0x80008000
Can't you set those atags correctly in uboot?
No, because atags are not static (e.g bootreason).

On Wednesday 25 January 2012 19:02:45 Marek Vasut wrote:
This patch adapts the bootm command so that it can use an existing atags command set up by a previous bootloader.
Why do you need it?
Default Nokia kernel has patches which using non-standard atags for reporting bootmode, bootreason, hw-rev, NOLO version, boot count, ...
So what? Make u-boot pass arbitrary atags and specify them in your board file.
Closed-source Maemo application need to know these properties (read via /proc/bootreason, ...) and will restart device if there is error.
Fine?
So U-Boot must can reuse old atags from NOLO and tell it new kernel.
must can reuse? Anyway, that's nonsense, why won't u-boot be able to craft those atags?
If the environment variable "atagaddr" is unset, bootm behaves as normal. If "atagaddr" is set, bootm will use atags address from environment variable and also append new boot args (if specified in u-boot). For example, if a previous boot loader already set up the atags struct at 0x80000100:
setenv atagaddr 0x80000100; bootm 0x80008000
Can't you set those atags correctly in uboot?
No, because atags are not static (e.g bootreason).
So? You craft them properly in u-boot?
M

On Wednesday 25 January 2012 21:55:53 Marek Vasut wrote:
must can reuse? Anyway, that's nonsense, why won't u-boot be able to craft those atags?
Maemo 5 (default OS in Nokia N900) cannot work if kernel does not have proper atags from NOLO. So if U-Boot does not reuse it, then Maemo will not boot...

On Wednesday 25 January 2012 21:55:53 Marek Vasut wrote:
must can reuse? Anyway, that's nonsense, why won't u-boot be able to craft those atags?
Maemo 5 (default OS in Nokia N900) cannot work if kernel does not have proper atags from NOLO. So if U-Boot does not reuse it, then Maemo will not boot...
U-Boot CAN GENERATE THEM

On Wednesday 25 January 2012 22:28:38 Marek Vasut wrote:
On Wednesday 25 January 2012 21:55:53 Marek Vasut wrote:
must can reuse? Anyway, that's nonsense, why won't u-boot be able to craft those atags?
Maemo 5 (default OS in Nokia N900) cannot work if kernel does not have proper atags from NOLO. So if U-Boot does not reuse it, then Maemo will not boot...
U-Boot CAN GENERATE THEM
Yes, you can parse atags from NOLO and then generate new from existing... But why? Better and easier is copy exising and use it.

On Wednesday 25 January 2012 22:28:38 Marek Vasut wrote:
On Wednesday 25 January 2012 21:55:53 Marek Vasut wrote:
must can reuse? Anyway, that's nonsense, why won't u-boot be able to craft those atags?
Maemo 5 (default OS in Nokia N900) cannot work if kernel does not have proper atags from NOLO. So if U-Boot does not reuse it, then Maemo will not boot...
U-Boot CAN GENERATE THEM
Yes, you can parse atags from NOLO and then generate new from existing... But why? Better and easier is copy exising and use it.
Because eventually, someone will replace nolo with u-boot and what then?
M

On Wednesday 25 January 2012 22:55:25 Marek Vasut wrote:
On Wednesday 25 January 2012 22:28:38 Marek Vasut wrote:
On Wednesday 25 January 2012 21:55:53 Marek Vasut wrote:
must can reuse? Anyway, that's nonsense, why won't u-boot be able to craft those atags?
Maemo 5 (default OS in Nokia N900) cannot work if kernel does not have proper atags from NOLO. So if U-Boot does not reuse it, then Maemo will not boot...
U-Boot CAN GENERATE THEM
Yes, you can parse atags from NOLO and then generate new from existing... But why? Better and easier is copy exising and use it.
Because eventually, someone will replace nolo with u-boot and what then?
Then we will know what is NOLO doing and how NOLO generating atags...
Temporary solution will be to dump atags for specified N900 HW revision and hard-code it into u-boot... But in one atag is stored boot reason (power key, watchdog reset, normal reset, alarm clock, charger connected, ...) - so we will do not have feature to know why was Maemo started.
Or if someone replace NOLO, he will use other system/kernel which do not depend on non standard atags... (Debian, Kubuntu, Mer or Android working without NOLO atags on N900).

* Code copied from linux kernel 3.0.0 from file include/linux/i2c/twl.h
Signed-off-by: Pali Rohár pali.rohar@gmail.com --- Changes since original version: - Fixed commit message
include/twl4030.h | 98 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 98 insertions(+), 0 deletions(-)
diff --git a/include/twl4030.h b/include/twl4030.h index 9cd32ab..0c17f59 100644 --- a/include/twl4030.h +++ b/include/twl4030.h @@ -151,6 +151,103 @@ #define TWL4030_PM_MASTER_SW_EVENTS_DEVSLP (1 << 1) #define TWL4030_PM_MASTER_SW_EVENTS_DEVOFF (1 << 0)
+/* Power bus message definitions */ + +/* The TWL4030/5030 splits its power-management resources (the various + * regulators, clock and reset lines) into 3 processor groups - P1, P2 and + * P3. These groups can then be configured to transition between sleep, wait-on + * and active states by sending messages to the power bus. See Section 5.4.2 + * Power Resources of TWL4030 TRM + */ + +/* Processor groups */ +#define DEV_GRP_NULL 0x0 +#define DEV_GRP_P1 0x1 /* P1: all OMAP devices */ +#define DEV_GRP_P2 0x2 /* P2: all Modem devices */ +#define DEV_GRP_P3 0x4 /* P3: all peripheral devices */ + +/* Resource groups */ +#define RES_GRP_RES 0x0 /* Reserved */ +#define RES_GRP_PP 0x1 /* Power providers */ +#define RES_GRP_RC 0x2 /* Reset and control */ +#define RES_GRP_PP_RC 0x3 +#define RES_GRP_PR 0x4 /* Power references */ +#define RES_GRP_PP_PR 0x5 +#define RES_GRP_RC_PR 0x6 +#define RES_GRP_ALL 0x7 /* All resource groups */ + +#define RES_TYPE2_R0 0x0 + +#define RES_TYPE_ALL 0x7 + +/* Resource states */ +#define RES_STATE_WRST 0xF +#define RES_STATE_ACTIVE 0xE +#define RES_STATE_SLEEP 0x8 +#define RES_STATE_OFF 0x0 + +/* Power resources */ + +/* Power providers */ +#define RES_VAUX1 1 +#define RES_VAUX2 2 +#define RES_VAUX3 3 +#define RES_VAUX4 4 +#define RES_VMMC1 5 +#define RES_VMMC2 6 +#define RES_VPLL1 7 +#define RES_VPLL2 8 +#define RES_VSIM 9 +#define RES_VDAC 10 +#define RES_VINTANA1 11 +#define RES_VINTANA2 12 +#define RES_VINTDIG 13 +#define RES_VIO 14 +#define RES_VDD1 15 +#define RES_VDD2 16 +#define RES_VUSB_1V5 17 +#define RES_VUSB_1V8 18 +#define RES_VUSB_3V1 19 +#define RES_VUSBCP 20 +#define RES_REGEN 21 +/* Reset and control */ +#define RES_NRES_PWRON 22 +#define RES_CLKEN 23 +#define RES_SYSEN 24 +#define RES_HFCLKOUT 25 +#define RES_32KCLKOUT 26 +#define RES_RESET 27 +/* Power Reference */ +#define RES_Main_Ref 28 + +#define TOTAL_RESOURCES 28 +/* + * Power Bus Message Format ... these can be sent individually by Linux, + * but are usually part of downloaded scripts that are run when various + * power events are triggered. + * + * Broadcast Message (16 Bits): + * DEV_GRP[15:13] MT[12] RES_GRP[11:9] RES_TYPE2[8:7] RES_TYPE[6:4] + * RES_STATE[3:0] + * + * Singular Message (16 Bits): + * DEV_GRP[15:13] MT[12] RES_ID[11:4] RES_STATE[3:0] + */ + +#define MSG_BROADCAST(devgrp, grp, type, type2, state) \ + ((devgrp) << 13 | 1 << 12 | (grp) << 9 | (type2) << 7 \ + | (type) << 4 | (state)) + +#define MSG_SINGULAR(devgrp, id, state) \ + ((devgrp) << 13 | 0 << 12 | (id) << 4 | (state)) + +#define MSG_BROADCAST_ALL(devgrp, state) \ + ((devgrp) << 5 | (state)) + +#define MSG_BROADCAST_REF MSG_BROADCAST_ALL +#define MSG_BROADCAST_PROV MSG_BROADCAST_ALL +#define MSG_BROADCAST__CLK_RST MSG_BROADCAST_ALL + /* Power Managment Receiver */ #define TWL4030_PM_RECEIVER_SC_CONFIG 0x5B #define TWL4030_PM_RECEIVER_SC_DETECT1 0x5C @@ -311,6 +408,7 @@ #define TWL4030_PM_RECEIVER_VDAC_VSEL_18 0x03 #define TWL4030_PM_RECEIVER_VMMC1_VSEL_30 0x02 #define TWL4030_PM_RECEIVER_VMMC1_VSEL_32 0x03 +#define TWL4030_PM_RECEIVER_VSIM_VSEL_18 0x03
/* Device Selection in PM Receiver Module */ #define TWL4030_PM_RECEIVER_DEV_GRP_P1 0x20

- Code copied from linux kernel 3.0.0 from file include/linux/i2c/twl.h
Do you need them?
Also, as in other patches, I noticed you don't CC Tom Rini. Also, Ccing Igor Grinberg. Please keep the Cc in next inkarnation of the series!
Guys, can you also help review the rest of the series ?
Signed-off-by: Pali Rohár pali.rohar@gmail.com
Changes since original version:
- Fixed commit message
include/twl4030.h | 98 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 98 insertions(+), 0 deletions(-)
diff --git a/include/twl4030.h b/include/twl4030.h index 9cd32ab..0c17f59 100644 --- a/include/twl4030.h +++ b/include/twl4030.h @@ -151,6 +151,103 @@ #define TWL4030_PM_MASTER_SW_EVENTS_DEVSLP (1 << 1) #define TWL4030_PM_MASTER_SW_EVENTS_DEVOFF (1 << 0)
+/* Power bus message definitions */
+/* The TWL4030/5030 splits its power-management resources (the various
- regulators, clock and reset lines) into 3 processor groups - P1, P2 and
- P3. These groups can then be configured to transition between sleep,
wait-on + * and active states by sending messages to the power bus. See Section 5.4.2 + * Power Resources of TWL4030 TRM
- */
+/* Processor groups */ +#define DEV_GRP_NULL 0x0 +#define DEV_GRP_P1 0x1 /* P1: all OMAP devices */ +#define DEV_GRP_P2 0x2 /* P2: all Modem devices */ +#define DEV_GRP_P3 0x4 /* P3: all peripheral devices */
+/* Resource groups */ +#define RES_GRP_RES 0x0 /* Reserved */ +#define RES_GRP_PP 0x1 /* Power providers */ +#define RES_GRP_RC 0x2 /* Reset and control */ +#define RES_GRP_PP_RC 0x3 +#define RES_GRP_PR 0x4 /* Power references */ +#define RES_GRP_PP_PR 0x5 +#define RES_GRP_RC_PR 0x6 +#define RES_GRP_ALL 0x7 /* All resource groups */
+#define RES_TYPE2_R0 0x0
+#define RES_TYPE_ALL 0x7
+/* Resource states */ +#define RES_STATE_WRST 0xF +#define RES_STATE_ACTIVE 0xE +#define RES_STATE_SLEEP 0x8 +#define RES_STATE_OFF 0x0
+/* Power resources */
+/* Power providers */ +#define RES_VAUX1 1 +#define RES_VAUX2 2 +#define RES_VAUX3 3 +#define RES_VAUX4 4 +#define RES_VMMC1 5 +#define RES_VMMC2 6 +#define RES_VPLL1 7 +#define RES_VPLL2 8 +#define RES_VSIM 9 +#define RES_VDAC 10 +#define RES_VINTANA1 11 +#define RES_VINTANA2 12 +#define RES_VINTDIG 13 +#define RES_VIO 14 +#define RES_VDD1 15 +#define RES_VDD2 16 +#define RES_VUSB_1V5 17 +#define RES_VUSB_1V8 18 +#define RES_VUSB_3V1 19 +#define RES_VUSBCP 20 +#define RES_REGEN 21 +/* Reset and control */ +#define RES_NRES_PWRON 22 +#define RES_CLKEN 23 +#define RES_SYSEN 24 +#define RES_HFCLKOUT 25 +#define RES_32KCLKOUT 26 +#define RES_RESET 27 +/* Power Reference */ +#define RES_Main_Ref 28
+#define TOTAL_RESOURCES 28 +/*
- Power Bus Message Format ... these can be sent individually by Linux,
- but are usually part of downloaded scripts that are run when various
- power events are triggered.
- Broadcast Message (16 Bits):
- DEV_GRP[15:13] MT[12] RES_GRP[11:9] RES_TYPE2[8:7] RES_TYPE[6:4]
- RES_STATE[3:0]
- Singular Message (16 Bits):
- DEV_GRP[15:13] MT[12] RES_ID[11:4] RES_STATE[3:0]
- */
+#define MSG_BROADCAST(devgrp, grp, type, type2, state) \
- ((devgrp) << 13 | 1 << 12 | (grp) << 9 | (type2) << 7 \
- | (type) << 4 | (state))
+#define MSG_SINGULAR(devgrp, id, state) \
- ((devgrp) << 13 | 0 << 12 | (id) << 4 | (state))
+#define MSG_BROADCAST_ALL(devgrp, state) \
- ((devgrp) << 5 | (state))
+#define MSG_BROADCAST_REF MSG_BROADCAST_ALL +#define MSG_BROADCAST_PROV MSG_BROADCAST_ALL +#define MSG_BROADCAST__CLK_RST MSG_BROADCAST_ALL
/* Power Managment Receiver */ #define TWL4030_PM_RECEIVER_SC_CONFIG 0x5B #define TWL4030_PM_RECEIVER_SC_DETECT1 0x5C @@ -311,6 +408,7 @@ #define TWL4030_PM_RECEIVER_VDAC_VSEL_18 0x03 #define TWL4030_PM_RECEIVER_VMMC1_VSEL_30 0x02 #define TWL4030_PM_RECEIVER_VMMC1_VSEL_32 0x03 +#define TWL4030_PM_RECEIVER_VSIM_VSEL_18 0x03
/* Device Selection in PM Receiver Module */ #define TWL4030_PM_RECEIVER_DEV_GRP_P1 0x20

On Wednesday 25 January 2012 19:04:37 Marek Vasut wrote:
- Code copied from linux kernel 3.0.0 from file include/linux/i2c/twl.h
Do you need them?
Yes, needed for twl regulator for enabling eMMC.

On 01/25/12 20:04, Marek Vasut wrote:
- Code copied from linux kernel 3.0.0 from file include/linux/i2c/twl.h
Do you need them?
Also, as in other patches, I noticed you don't CC Tom Rini. Also, Ccing Igor Grinberg. Please keep the Cc in next inkarnation of the series!
Guys, can you also help review the rest of the series ?
I'm currently really busy, but I'll try to give it a quick glance.

* Ignore ANSI escape codes for moving cursor, which are generated by keyboard
Signed-off-by: Pali Rohár pali.rohar@gmail.com --- Changes since original version: - Fixed commit message
common/main.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 51 insertions(+), 0 deletions(-)
diff --git a/common/main.c b/common/main.c index e96c95a..e7b5516 100644 --- a/common/main.c +++ b/common/main.c @@ -958,6 +958,7 @@ int readline_into_buffer (const char *const prompt, char * buffer) int n = 0; /* buffer index */ int plen = 0; /* prompt length */ int col; /* output column cnt */ + int esc = 0; /* ansi escape char */ char c;
/* print prompt */ @@ -1024,7 +1025,57 @@ int readline_into_buffer (const char *const prompt, char * buffer) p=delete_char(p_buf, p, &col, &n, plen); continue;
+ case '\e': /* ANSI escape char */ + esc = 1; + continue; + default: + + /* + * Check for ANSI escape chars + */ + if (esc == 0 && c == '\e') { + esc = 1; + continue; + } else if (esc == 1) { + if (c == '[') { + esc = 2; + continue; + } + if (n < CONFIG_SYS_CBSIZE-2) { + ++n; + *p++ = '\e'; + putc('\e'); + } + esc = 0; + } else if (esc == 2 || esc == 3) { + if (esc == 2 && c == '1') { + esc = 3; + continue; + } + /* Ignore ANSI escape sequences */ + /* generated by keyboard */ + /* \e [ 1 A-D and \e [ A-D */ + if (c >= 'A' && c <= 'D') { + esc = 0; + continue; + } + if (esc == 2 && n < CONFIG_SYS_CBSIZE-3) { + n += 2; + *p++ = '\e'; + *p++ = '['; + puts("\e["); + } else if (esc == 3 && + n < CONFIG_SYS_CBSIZE-4) { + n += 3; + *p++ = '\e'; + *p++ = '['; + *p++ = '1'; + puts("\e[1"); + } + esc = 0; + } + /* * Must be a normal character then */

- Ignore ANSI escape codes for moving cursor, which are generated by
keyboard
I think WD should comment on this one.
Signed-off-by: Pali Rohár pali.rohar@gmail.com
Changes since original version:
- Fixed commit message
common/main.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 51 insertions(+), 0 deletions(-)
diff --git a/common/main.c b/common/main.c index e96c95a..e7b5516 100644 --- a/common/main.c +++ b/common/main.c @@ -958,6 +958,7 @@ int readline_into_buffer (const char *const prompt, char * buffer) int n = 0; /* buffer index
*/
int plen = 0; /* prompt length */ int col; /* output column cnt */
int esc = 0; /* ansi escape char */ char c;
/* print prompt */
@@ -1024,7 +1025,57 @@ int readline_into_buffer (const char *const prompt, char * buffer) p=delete_char(p_buf, p, &col, &n, plen); continue;
case '\e': /* ANSI escape char */
esc = 1;
continue;
- default:
/*
* Check for ANSI escape chars
*/
if (esc == 0 && c == '\e') {
esc = 1;
continue;
} else if (esc == 1) {
if (c == '[') {
esc = 2;
continue;
}
if (n < CONFIG_SYS_CBSIZE-2) {
++n;
*p++ = '\e';
putc('\e');
}
esc = 0;
} else if (esc == 2 || esc == 3) {
if (esc == 2 && c == '1') {
esc = 3;
continue;
}
/* Ignore ANSI escape sequences */
/* generated by keyboard */
/* \e [ 1 A-D and \e [ A-D */
if (c >= 'A' && c <= 'D') {
esc = 0;
continue;
}
if (esc == 2 && n < CONFIG_SYS_CBSIZE-3) {
n += 2;
*p++ = '\e';
*p++ = '[';
puts("\e[");
} else if (esc == 3 &&
n < CONFIG_SYS_CBSIZE-4) {
n += 3;
*p++ = '\e';
*p++ = '[';
*p++ = '1';
puts("\e[1");
}
esc = 0;
}
/* * Must be a normal character then */

On Wednesday 25 January 2012 13:05:31 Marek Vasut wrote:
- Ignore ANSI escape codes for moving cursor, which are generated by
keyboard
I think WD should comment on this one.
no need ... see the previous thread on the previous version of this patch. Pali should be able to drop this. -mike

* Use correct buffer size, do not damage screen output
Signed-off-by: Pali Rohár pali.rohar@gmail.com --- Changes since original version: - Fixed commit message
drivers/video/cfb_console.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c index 904caf7..9092399 100644 --- a/drivers/video/cfb_console.c +++ b/drivers/video/cfb_console.c @@ -701,7 +701,7 @@ static void console_scrollup(void) ); #else memcpyl(CONSOLE_ROW_FIRST, CONSOLE_ROW_SECOND, - CONSOLE_SCROLL_SIZE >> 2); + CONSOLE_SCROLL_SIZE); #endif
/* clear the last one */

- Use correct buffer size, do not damage screen output
What are the symptoms, how does this fix the issue?
Ccing Anatolij, I think he's the right one for this patch. Again, keep the correct CC!!!
Signed-off-by: Pali Rohár pali.rohar@gmail.com
Changes since original version:
- Fixed commit message
drivers/video/cfb_console.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c index 904caf7..9092399 100644 --- a/drivers/video/cfb_console.c +++ b/drivers/video/cfb_console.c @@ -701,7 +701,7 @@ static void console_scrollup(void) ); #else memcpyl(CONSOLE_ROW_FIRST, CONSOLE_ROW_SECOND,
CONSOLE_SCROLL_SIZE >> 2);
CONSOLE_SCROLL_SIZE);
#endif
/* clear the last one */

On Wednesday 25 January 2012 19:06:51 Marek Vasut wrote:
- Use correct buffer size, do not damage screen output
What are the symptoms, how does this fix the issue?
Ccing Anatolij, I think he's the right one for this patch. Again, keep the correct CC!!!
Output on n900 screen is damged after function console_scrollup is called.

Hi,
On Tue, 24 Jan 2012 15:28:02 +0100 Pali Rohár pali.rohar@gmail.com wrote:
- Use correct buffer size, do not damage screen output
Signed-off-by: Pali Rohár pali.rohar@gmail.com
Changes since original version:
- Fixed commit message
drivers/video/cfb_console.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c index 904caf7..9092399 100644 --- a/drivers/video/cfb_console.c +++ b/drivers/video/cfb_console.c @@ -701,7 +701,7 @@ static void console_scrollup(void) ); #else memcpyl(CONSOLE_ROW_FIRST, CONSOLE_ROW_SECOND,
CONSOLE_SCROLL_SIZE >> 2);
CONSOLE_SCROLL_SIZE);
NAK. This change is wrong. CONSOLE_SCROLL_SIZE is the size of the visible frame buffer - size of one row in bytes. We are using memcpyl() here, so the division by 4 (size >> 2) is correct. With your change we end up copying 4 times more data then needed.
Thanks, Anatolij

Dear Anatolij Gustschin,
Hi,
On Tue, 24 Jan 2012 15:28:02 +0100
Pali Rohár pali.rohar@gmail.com wrote:
- Use correct buffer size, do not damage screen output
Signed-off-by: Pali Rohár pali.rohar@gmail.com
Changes since original version:
- Fixed commit message
drivers/video/cfb_console.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c index 904caf7..9092399 100644 --- a/drivers/video/cfb_console.c +++ b/drivers/video/cfb_console.c @@ -701,7 +701,7 @@ static void console_scrollup(void)
);
#else
memcpyl(CONSOLE_ROW_FIRST, CONSOLE_ROW_SECOND,
CONSOLE_SCROLL_SIZE >> 2);
CONSOLE_SCROLL_SIZE);
NAK. This change is wrong. CONSOLE_SCROLL_SIZE is the size of the visible frame buffer - size of one row in bytes. We are using memcpyl() here, so the division by 4 (size >> 2) is correct. With your change we end up copying 4 times more data then needed.
What kind of a problem are we fixing here? And what are the symptoms of it?
Thanks, Anatolij
Best regards, Marek Vasut

Hi Marek,
On Wed, 21 Mar 2012 11:20:38 +0100 Marek Vasut marex@denx.de wrote:
Dear Anatolij Gustschin,
Hi,
On Tue, 24 Jan 2012 15:28:02 +0100
Pali Rohár pali.rohar@gmail.com wrote:
- Use correct buffer size, do not damage screen output
Signed-off-by: Pali Rohár pali.rohar@gmail.com
Changes since original version:
- Fixed commit message
drivers/video/cfb_console.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c index 904caf7..9092399 100644 --- a/drivers/video/cfb_console.c +++ b/drivers/video/cfb_console.c @@ -701,7 +701,7 @@ static void console_scrollup(void)
);
#else
memcpyl(CONSOLE_ROW_FIRST, CONSOLE_ROW_SECOND,
CONSOLE_SCROLL_SIZE >> 2);
CONSOLE_SCROLL_SIZE);
NAK. This change is wrong. CONSOLE_SCROLL_SIZE is the size of the visible frame buffer - size of one row in bytes. We are using memcpyl() here, so the division by 4 (size >> 2) is correct. With your change we end up copying 4 times more data then needed.
What kind of a problem are we fixing here? And what are the symptoms of it?
Actually I'm not aware of any problem in current console_scrollup(). At least on two test setups with different framebuffer drivers and in one setup with HW accelerated scrolling I didn't see any problems with current code.
The description in the commit log of this patch: "Use correct buffer size, do not damage screen output" doesn't say much about the problem. If the GraphicDevice structure returned by video_hw_init() is setup correctly, the scrolling should be working fine. From the other patch [1] I can see that the structure is setup as follows:
/* fill in Graphic Device */ gdev.frameAdrs = 0x8f9c0000; gdev.winSizeX = 800; gdev.winSizeY = 480; gdev.gdfBytesPP = 2; gdev.gdfIndex = GDF_16BIT_565RGB; memset((void *)gdev.frameAdrs, 0, 0xbb800); return (void *) &gdev;
Most likely using 0x8f9c0000 as framebuffer address is the first _big_ problem. The framebuffer address range is not allocated properly and could be used by malloc area. The board has 256 MB of RAM starting at 0x80000000, if U-Boot relocated itself to the upper RAM, the problems should be expected.
AFAIK the N900 port doesn't use a framebuffer driver but probably uses pre-initialized display controller configuration. This should be fixed first.
Thanks, Anatolij

On Wed, 21 Mar 2012 12:32:16 +0100 Anatolij Gustschin agust@denx.de wrote: ...
doesn't say much about the problem. If the GraphicDevice structure returned by video_hw_init() is setup correctly, the scrolling should be working fine. From the other patch [1] I can see that the structure
I forgot to include a link [1] to the mentioned patch, sorry. Here it is:
[1] http://patchwork.ozlabs.org/patch/137567/
Thanks, Anatolij

On Wednesday 21 March 2012 12:32:16 Anatolij Gustschin wrote:
Hi Marek,
On Wed, 21 Mar 2012 11:20:38 +0100
Marek Vasut marex@denx.de wrote:
Dear Anatolij Gustschin,
Hi,
On Tue, 24 Jan 2012 15:28:02 +0100
Pali Rohár pali.rohar@gmail.com wrote:
- Use correct buffer size, do not damage screen output
Signed-off-by: Pali Rohár pali.rohar@gmail.com
Changes since original version:
- Fixed commit message
drivers/video/cfb_console.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c index 904caf7..9092399 100644 --- a/drivers/video/cfb_console.c +++ b/drivers/video/cfb_console.c @@ -701,7 +701,7 @@ static void console_scrollup(void)
);
#else
memcpyl(CONSOLE_ROW_FIRST, CONSOLE_ROW_SECOND,
CONSOLE_SCROLL_SIZE >> 2);
CONSOLE_SCROLL_SIZE);
NAK. This change is wrong. CONSOLE_SCROLL_SIZE is the size of the visible frame buffer - size of one row in bytes. We are using memcpyl() here, so the division by 4 (size >> 2) is correct. With your change we end up copying 4 times more data then needed.
What kind of a problem are we fixing here? And what are the symptoms of it?
Actually I'm not aware of any problem in current console_scrollup(). At least on two test setups with different framebuffer drivers and in one setup with HW accelerated scrolling I didn't see any problems with current code.
The description in the commit log of this patch: "Use correct buffer size, do not damage screen output" doesn't say much about the problem. If the GraphicDevice structure returned by video_hw_init() is setup correctly, the scrolling should be working fine. From the other patch [1] I can see that the structure is setup as follows:
/* fill in Graphic Device */ gdev.frameAdrs = 0x8f9c0000; gdev.winSizeX = 800; gdev.winSizeY = 480; gdev.gdfBytesPP = 2; gdev.gdfIndex = GDF_16BIT_565RGB; memset((void *)gdev.frameAdrs, 0, 0xbb800); return (void *) &gdev;
Most likely using 0x8f9c0000 as framebuffer address is the first _big_ problem. The framebuffer address range is not allocated properly and could be used by malloc area. The board has 256 MB of RAM starting at 0x80000000, if U-Boot relocated itself to the upper RAM, the problems should be expected.
AFAIK the N900 port doesn't use a framebuffer driver but probably uses pre-initialized display controller configuration. This should be fixed first.
Thanks, Anatolij
Hi, can you show me how to fix this? How to correctly use framebuffer?

On Wed, 21 Mar 2012 19:50:34 +0100 Pali Rohár pali.rohar@gmail.com wrote: ...
Hi, can you show me how to fix this? How to correctly use framebuffer?
Hi,
Not really. This would be a new project to rewrite U-Boot driver for OMAP3 DSS. There is a driver under drivers/video/omap3_dss.c, but it doesn't do what we need here. You can try to set gdev.frameAdrs to point to another address range in RAM which is not used by U-Boot. Then get OMAP3430 TRM and read DSS documentation how to configure the display controller so that is displays frame buffer data from this address range. Currently I do not have time nor resources to rewrite the existing omap3_dss driver.
Thanks, Anatolij

On Wednesday 21 March 2012 23:58:10 Anatolij Gustschin wrote:
On Wed, 21 Mar 2012 19:50:34 +0100 Pali Rohár pali.rohar@gmail.com wrote: ...
Hi, can you show me how to fix this? How to correctly use framebuffer?
Hi,
Not really. This would be a new project to rewrite U-Boot driver for OMAP3 DSS. There is a driver under drivers/video/omap3_dss.c, but it doesn't do what we need here. You can try to set gdev.frameAdrs to point to another address range in RAM which is not used by U-Boot. Then get OMAP3430 TRM and read DSS documentation how to configure the display controller so that is displays frame buffer data from this address range. Currently I do not have time nor resources to rewrite the existing omap3_dss driver.
Thanks, Anatolij
Do you think that mapped address of framebuffer is only problem? Why then framebuffer output on n900 screen working without problem if I do NOT read framebuffer memory? Problem with garbaged display output seems happends only for read operations (console_scrollup, negation of pixels for cursor,...) but not for write-only operations (clear console, clear line, set black/white cursror, render fonsts...). I think if there is problem with address space, then garbaged screen should be also for framebuffer write operations...

Hi,
On Thu, 22 Mar 2012 01:58:02 -0700 (PDT) Pali Rohár pali.rohar@gmail.com wrote: ...
Do you think that mapped address of framebuffer is only problem?
I wrote that it could be a problem. I do not know much about your system and U-Boot port and do not know exactly what you meant by "damaged screen output" and when exactly it happens, so I can only speculate.
Why then framebuffer output on n900 screen working without problem if I do NOT read framebuffer memory? Problem with garbaged display output seems happends only for read operations (console_scrollup, negation of pixels for cursor,...) but not for write-only operations (clear console, clear line, set black/white cursror, render fonsts...). I think if there is problem with address space, then garbaged screen should be also for framebuffer write operations...
This is another issue then. Can you test read/write access to the frame buffer area by available memory commands "cp", "md", "mm", "cmp"? Can you also verify that reading from frame buffer area by using these memory commands is not working?
Thanks, Anatolij

Hi,
On Tue, 24 Jan 2012 15:28:02 +0100 Pali Rohár pali.rohar@gmail.com wrote:
- Use correct buffer size, do not damage screen output
It seems that I can reproduce similar problem on the beagleboard now. Will try to debug and find a solution for it.
Thanks, Anatolij

On Thursday 26 April 2012 23:45:52 Anatolij Gustschin wrote:
Hi,
On Tue, 24 Jan 2012 15:28:02 +0100
Pali Rohár pali.rohar@gmail.com wrote:
- Use correct buffer size, do not damage screen output
It seems that I can reproduce similar problem on the beagleboard now. Will try to debug and find a solution for it.
Thanks, Anatolij
Ok, thanks! I played a lot of with u-boot on nokia n900, but I did not find reason...

On Thu, 26 Apr 2012 23:50:57 +0200 Pali Rohár pali.rohar@gmail.com wrote:
On Thursday 26 April 2012 23:45:52 Anatolij Gustschin wrote:
Hi,
On Tue, 24 Jan 2012 15:28:02 +0100
Pali Rohár pali.rohar@gmail.com wrote:
- Use correct buffer size, do not damage screen output
It seems that I can reproduce similar problem on the beagleboard now. Will try to debug and find a solution for it.
Ok, thanks! I played a lot of with u-boot on nokia n900, but I did not find reason...
Probably the issue is caused by cached frame buffer data. This [1] patch is supposed to fix it. Could you please test it on N900? Additional cache flushing also needs to be added to your extensions for cfb_console to fix the menu output.
Thanks, Anatolij

On Saturday 28 April 2012 17:11:51 Anatolij Gustschin wrote:
On Thu, 26 Apr 2012 23:50:57 +0200
Pali Rohár pali.rohar@gmail.com wrote:
On Thursday 26 April 2012 23:45:52 Anatolij Gustschin wrote:
Hi,
On Tue, 24 Jan 2012 15:28:02 +0100
Pali Rohár pali.rohar@gmail.com wrote:
- Use correct buffer size, do not damage screen output
It seems that I can reproduce similar problem on the beagleboard now. Will try to debug and find a solution for it.
Ok, thanks! I played a lot of with u-boot on nokia n900, but I did not find reason...
Probably the issue is caused by cached frame buffer data. This [1] patch is supposed to fix it. Could you please test it on N900? Additional cache flushing also needs to be added to your extensions for cfb_console to fix the menu output.
Thanks, Anatolij
Hi, your patch fixing this problem. Thanks!

* console_clear - clear full console framebuffer output * console_clear_line - clear part of specified line (or full)
Signed-off-by: Pali Rohár pali.rohar@gmail.com --- Changes since original version: - Fixed commit message
drivers/video/cfb_console.c | 64 +++++++++++++++++++++++++++++++++++-------- 1 files changed, 52 insertions(+), 12 deletions(-)
diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c index 9092399..b74d6d0 100644 --- a/drivers/video/cfb_console.c +++ b/drivers/video/cfb_console.c @@ -683,6 +683,57 @@ static void memcpyl(int *d, int *s, int c) } #endif
+static void console_clear(void) +{ +#ifdef VIDEO_HW_RECTFILL + video_hw_rectfill(VIDEO_PIXEL_SIZE, /* bytes per pixel */ + 0, /* dest pos x */ + video_logo_height, /* dest pos y */ + VIDEO_VISIBLE_COLS, /* frame width */ + VIDEO_VISIBLE_ROWS, /* frame height */ + bgx /* fill color */ + ); +#else + memsetl(CONSOLE_ROW_FIRST, CONSOLE_SIZE, bgx); +#endif +} + +static void console_clear_line(int line, int begin, int end) +{ +#ifdef VIDEO_HW_RECTFILL + video_hw_rectfill(VIDEO_PIXEL_SIZE, /* bytes per pixel */ + /* FIXME: correct? */ + VIDEO_FONT_WIDTH * begin, /* dest pos x */ + /* FIXME: correct? */ + video_logo_height + + CONSOLE_ROW_SIZE * line, /* dest pos y */ + /* FIXME: correct? */ + VIDEO_FONT_WIDTH * (end - begin), /* frame width */ + VIDEO_FONT_HEIGHT, /* frame height */ + bgx /* fill color */ + ); +#else + int i; + if (begin == 0 && end == CONSOLE_COLS) + memsetl(CONSOLE_ROW_FIRST + + CONSOLE_ROW_SIZE * line, /* offset of row */ + CONSOLE_ROW_SIZE >> 2, /* length of row */ + bgx /* fill color */ + ); + else + for (i = 0; i < VIDEO_FONT_HEIGHT; ++i) + memsetl(CONSOLE_ROW_FIRST + + CONSOLE_ROW_SIZE * line + /* offset of row */ + VIDEO_FONT_WIDTH * + VIDEO_PIXEL_SIZE * begin + /* offset of col */ + i * VIDEO_LINE_LEN, /* col offset of i line */ + (VIDEO_FONT_WIDTH * VIDEO_PIXEL_SIZE * + (end - begin + 1)) >> 2, /* length to end */ + bgx /* fill color */ + ); +#endif +} + static void console_scrollup(void) { /* copy up rows ignoring the first one */ @@ -705,18 +756,7 @@ static void console_scrollup(void) #endif
/* clear the last one */ -#ifdef VIDEO_HW_RECTFILL - video_hw_rectfill(VIDEO_PIXEL_SIZE, /* bytes per pixel */ - 0, /* dest pos x */ - VIDEO_VISIBLE_ROWS - - VIDEO_FONT_HEIGHT, /* dest pos y */ - VIDEO_VISIBLE_COLS, /* frame width */ - VIDEO_FONT_HEIGHT, /* frame height */ - CONSOLE_BG_COL /* fill color */ - ); -#else - memsetl(CONSOLE_ROW_LAST, CONSOLE_ROW_SIZE >> 2, CONSOLE_BG_COL); -#endif + console_clear_line(CONSOLE_ROWS-1, 0, CONSOLE_COLS); }
static void console_back(void)

- console_clear - clear full console framebuffer output
- console_clear_line - clear part of specified line (or full)
Signed-off-by: Pali Rohár pali.rohar@gmail.com
Changes since original version:
- Fixed commit message
drivers/video/cfb_console.c | 64 +++++++++++++++++++++++++++++++++++-------- 1 files changed, 52 insertions(+), 12 deletions(-)
diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c index 9092399..b74d6d0 100644 --- a/drivers/video/cfb_console.c +++ b/drivers/video/cfb_console.c @@ -683,6 +683,57 @@ static void memcpyl(int *d, int *s, int c) } #endif
+static void console_clear(void)
Do you use this function AT ALL?
+{ +#ifdef VIDEO_HW_RECTFILL
- video_hw_rectfill(VIDEO_PIXEL_SIZE, /* bytes per pixel */
0, /* dest pos x */
video_logo_height, /* dest pos y */
VIDEO_VISIBLE_COLS, /* frame width */
VIDEO_VISIBLE_ROWS, /* frame height */
bgx /* fill color */
- );
+#else
- memsetl(CONSOLE_ROW_FIRST, CONSOLE_SIZE, bgx);
+#endif +}
+static void console_clear_line(int line, int begin, int end) +{ +#ifdef VIDEO_HW_RECTFILL
- video_hw_rectfill(VIDEO_PIXEL_SIZE, /* bytes per pixel */
/* FIXME: correct? */
VIDEO_FONT_WIDTH * begin, /* dest pos x */
/* FIXME: correct? */
video_logo_height +
CONSOLE_ROW_SIZE * line, /* dest pos y */
/* FIXME: correct? */
VIDEO_FONT_WIDTH * (end - begin), /* frame width */
VIDEO_FONT_HEIGHT, /* frame height */
bgx /* fill color */
);
+#else
- int i;
- if (begin == 0 && end == CONSOLE_COLS)
memsetl(CONSOLE_ROW_FIRST +
CONSOLE_ROW_SIZE * line, /* offset of row */
CONSOLE_ROW_SIZE >> 2, /* length of row */
bgx /* fill color */
);
- else
for (i = 0; i < VIDEO_FONT_HEIGHT; ++i)
memsetl(CONSOLE_ROW_FIRST +
CONSOLE_ROW_SIZE * line + /* offset of row */
VIDEO_FONT_WIDTH *
VIDEO_PIXEL_SIZE * begin + /* offset of col */
i * VIDEO_LINE_LEN, /* col offset of i line */
(VIDEO_FONT_WIDTH * VIDEO_PIXEL_SIZE *
(end - begin + 1)) >> 2, /* length to end */
bgx /* fill color */
);
+#endif +}
static void console_scrollup(void) { /* copy up rows ignoring the first one */ @@ -705,18 +756,7 @@ static void console_scrollup(void) #endif
/* clear the last one */ -#ifdef VIDEO_HW_RECTFILL
- video_hw_rectfill(VIDEO_PIXEL_SIZE, /* bytes per pixel */
0, /* dest pos x */
VIDEO_VISIBLE_ROWS
- VIDEO_FONT_HEIGHT, /* dest pos y */
VIDEO_VISIBLE_COLS, /* frame width */
VIDEO_FONT_HEIGHT, /* frame height */
CONSOLE_BG_COL /* fill color */
);
-#else
- memsetl(CONSOLE_ROW_LAST, CONSOLE_ROW_SIZE >> 2, CONSOLE_BG_COL);
-#endif
- console_clear_line(CONSOLE_ROWS-1, 0, CONSOLE_COLS);
}
static void console_back(void)

On Wednesday 25 January 2012 19:08:31 Marek Vasut wrote:
+static void console_clear(void)
Do you use this function AT ALL?
Yes, in patch which add ANSI terminal support to cfb_console.

On Wednesday 25 January 2012 19:08:31 Marek Vasut wrote:
+static void console_clear(void)
Do you use this function AT ALL?
Yes, in patch which add ANSI terminal support to cfb_console.
Why do you even need the support for ANSI terminal in the first place?

* console_cursor_fix - fix cursor position (check for out of screen) * console_cursor_up, console_cursor_down, console_cursor_left, console_cursor_right, console_cursor_set_position for change cursor position * console_newline - added param to specify count of creating new lines * console_previewsline - opposite of console_newline
Signed-off-by: Pali Rohár pali.rohar@gmail.com --- Changes since original version: - Fixed commit message
drivers/video/cfb_console.c | 64 +++++++++++++++++++++++++++++++++++++++---- 1 files changed, 58 insertions(+), 6 deletions(-)
diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c index b74d6d0..3823eae 100644 --- a/drivers/video/cfb_console.c +++ b/drivers/video/cfb_console.c @@ -773,9 +773,54 @@ static void console_back(void) CURSOR_SET; }
-static void console_newline(void) +static void console_cursor_fix(void) { - console_row++; + if (console_row < 0) + console_row = 0; + if (console_row >= CONSOLE_ROWS) + console_row = CONSOLE_ROWS-1; + if (console_col < 0) + console_col = 0; + if (console_col >= CONSOLE_COLS) + console_col = CONSOLE_COLS-1; +} + +static void console_cursor_up(int n) +{ + console_row -= n; + console_cursor_fix(); +} + +static void console_cursor_down(int n) +{ + console_row += n; + console_cursor_fix(); +} + +static void console_cursor_left(int n) +{ + console_col -= n; + console_cursor_fix(); +} + +static void console_cursor_right(int n) +{ + console_col += n; + console_cursor_fix(); +} + +static void console_cursor_set_position(int row, int col) +{ + if (console_row != -1) + console_row = row; + if (console_col != -1) + console_col = col; + console_cursor_fix(); +} + +static void console_newline(int n) +{ + console_row += n; console_col = 0;
/* Check if we need to scroll the terminal */ @@ -784,10 +829,17 @@ static void console_newline(void) console_scrollup();
/* Decrement row number */ - console_row--; + console_row = CONSOLE_ROWS-1; } }
+static void console_previewsline(int n) +{ + /* FIXME: also scroll terminal ? */ + console_row -= n; + console_cursor_fix(); +} + static void console_cr(void) { console_col = 0; @@ -806,7 +858,7 @@ void video_putc(const char c)
case '\n': /* next line */ if (console_col || (!console_col && nl)) - console_newline(); + console_newline(1); nl = 1; break;
@@ -815,7 +867,7 @@ void video_putc(const char c) console_col &= ~0x0007;
if (console_col >= CONSOLE_COLS) - console_newline(); + console_newline(1); break;
case 8: /* backspace */ @@ -829,7 +881,7 @@ void video_putc(const char c)
/* check for newline */ if (console_col >= CONSOLE_COLS) { - console_newline(); + console_newline(1); nl = 0; } }

* This patch add support for move cursor and reverse colors via ANSI espace codes in cfb_console driver * ANSI escape codes can be enabled/disabled via CONFIG_CFB_CONSOLE_ANSI
Signed-off-by: Pali Rohár pali.rohar@gmail.com --- Changes since original version: - Fixed commit message
drivers/video/cfb_console.c | 216 ++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 215 insertions(+), 1 deletions(-)
diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c index 3823eae..dc8d99b 100644 --- a/drivers/video/cfb_console.c +++ b/drivers/video/cfb_console.c @@ -377,6 +377,10 @@ static int console_row; /* cursor row */
static u32 eorx, fgx, bgx; /* color pats */
+static char ansi_buf[10] = { 0, }; +static int ansi_buf_size; +static int ansi_colors_need_revert; + static const int video_font_draw_table8[] = { 0x00000000, 0x000000ff, 0x0000ff00, 0x0000ffff, 0x00ff0000, 0x00ff00ff, 0x00ffff00, 0x00ffffff, @@ -602,6 +606,14 @@ static void video_putchar(int xx, int yy, unsigned char c) video_drawchars(xx, yy + video_logo_height, &c, 1); }
+static void console_swap_colors(void) +{ + eorx = fgx; + fgx = bgx; + bgx = eorx; + eorx = fgx ^ bgx; +} + #if defined(CONFIG_CONSOLE_CURSOR) || defined(CONFIG_VIDEO_SW_CURSOR) static void video_set_cursor(void) { @@ -845,7 +857,7 @@ static void console_cr(void) console_col = 0; }
-void video_putc(const char c) +static void parse_putc(const char c) { static int nl = 1;
@@ -888,6 +900,208 @@ void video_putc(const char c) CURSOR_SET; }
+void video_putc(const char c) +{ +#ifdef CONFIG_CFB_CONSOLE_ANSI + int i; + + if (c == 27) { + for (i = 0; i < ansi_buf_size; ++i) + parse_putc(ansi_buf[i]); + ansi_buf[0] = 27; + ansi_buf_size = 1; + return; + } + + if (ansi_buf_size > 0) { + /* + 0 - ESC + 1 - [ + 2 - num1 + 3 - .. + 4 - ; + 5 - num2 + 6 - .. + 7 - cchar + */ + int next = 0; + + int flush = 0; + int fail = 0; + + int num1 = 0; + int num2 = 0; + int cchar = 0; + + ansi_buf[ansi_buf_size++] = c; + + if (ansi_buf_size >= sizeof(ansi_buf)) + fail = 1; + + for (i = 0; i < ansi_buf_size; ++i) { + if (fail) + break; + + switch (next) { + case 0: + if (ansi_buf[i] == 27) + next = 1; + else + fail = 1; + break; + + case 1: + if (ansi_buf[i] == '[') + next = 2; + else + fail = 1; + break; + + case 2: + if (ansi_buf[i] >= '0' && ansi_buf[i] <= '9') { + num1 = ansi_buf[i]-'0'; + next = 3; + } else { + --i; + num1 = 1; + next = 4; + } + break; + + case 3: + if (ansi_buf[i] >= '0' && ansi_buf[i] <= '9') { + num1 *= 10; + num1 += ansi_buf[i]-'0'; + } else { + --i; + next = 4; + } + break; + + case 4: + if (ansi_buf[i] != ';') { + --i; + next = 7; + } else + next = 5; + break; + + case 5: + if (ansi_buf[i] >= '0' && ansi_buf[i] <= '9') { + num2 = ansi_buf[i]-'0'; + next = 6; + } else + fail = 1; + break; + + case 6: + if (ansi_buf[i] >= '0' && ansi_buf[i] <= '9') { + num2 *= 10; + num2 += ansi_buf[i]-'0'; + } else { + --i; + next = 7; + } + break; + + case 7: + if ((ansi_buf[i] >= 'A' && ansi_buf[i] <= 'H') + || ansi_buf[i] == 'J' + || ansi_buf[i] == 'K' + || ansi_buf[i] == 'm') { + cchar = ansi_buf[i]; + flush = 1; + } else + fail = 1; + break; + } + } + + if (fail) { + for (i = 0; i < ansi_buf_size; ++i) + parse_putc(ansi_buf[i]); + ansi_buf_size = 0; + return; + } + + if (flush) { + CURSOR_OFF; + ansi_buf_size = 0; + switch (cchar) { + case 'A': + /* move cursor num1 rows up */ + console_cursor_up(num1); + break; + case 'B': + /* move cursor num1 rows down */ + console_cursor_down(num1); + break; + case 'C': + /* move cursor num1 columns forward */ + console_cursor_right(num1); + break; + case 'D': + /* move cursor num1 columns back */ + console_cursor_left(num1); + break; + case 'E': + /* move cursor num1 rows up at begin of row */ + console_previewsline(num1); + break; + case 'F': + /* move cursor num1 rows down at begin of row */ + console_newline(num1); + break; + case 'G': + /* move cursor to column num1 */ + console_cursor_set_position(-1, num1-1); + break; + case 'H': + /* move cursor to row num1, column num2 */ + console_cursor_set_position(num1-1, num2-1); + break; + case 'J': + /* clear console and move cursor to 0, 0 */ + console_clear(); + console_cursor_set_position(0, 0); + break; + case 'K': + /* clear line */ + if (num1 == 0) + console_clear_line(console_row, + console_col, + CONSOLE_COLS-1); + else if (num1 == 1) + console_clear_line(console_row, + 0, console_col); + else + console_clear_line(console_row, + 0, CONSOLE_COLS-1); + break; + case 'm': + if (num1 == 0) { /* reset swapped colors */ + if (ansi_colors_need_revert) { + console_swap_colors(); + ansi_colors_need_revert = 0; + } + } else if (num1 == 7) { /* once swap colors */ + if (!ansi_colors_need_revert) { + console_swap_colors(); + ansi_colors_need_revert = 1; + } + } + break; + } + CURSOR_SET; + } + } else { + parse_putc(c); + } +#else + parse_putc(c); +#endif +} + void video_puts(const char *s) { int count = strlen(s);

* Command can be enabled by CONFIG_CMD_CLEAR * Added some ANSI escape codes definitions in common.h
Signed-off-by: Pali Rohár pali.rohar@gmail.com Cc: Marcel Mol marcel@mesa.nl --- Changes since original version: - Renamed command clr to clear - Use puts instead printf - Move cursor to pos1,1 - Merged parts of patch "Add some ANSI escape codes definitions in common.h"
common/Makefile | 1 + common/cmd_clear.c | 42 ++++++++++++++++++++++++++++++++++++++++++ include/common.h | 7 +++++++ include/config_cmd_all.h | 1 + 4 files changed, 51 insertions(+), 0 deletions(-) create mode 100644 common/cmd_clear.c
diff --git a/common/Makefile b/common/Makefile index 2d9ae8c..e1efd45 100644 --- a/common/Makefile +++ b/common/Makefile @@ -69,6 +69,7 @@ COBJS-$(CONFIG_CMD_BEDBUG) += bedbug.o cmd_bedbug.o COBJS-$(CONFIG_CMD_BMP) += cmd_bmp.o COBJS-$(CONFIG_CMD_BOOTLDR) += cmd_bootldr.o COBJS-$(CONFIG_CMD_CACHE) += cmd_cache.o +COBJS-$(CONFIG_CMD_CLEAR) += cmd_clear.o COBJS-$(CONFIG_CMD_CONSOLE) += cmd_console.o COBJS-$(CONFIG_CMD_CPLBINFO) += cmd_cplbinfo.o COBJS-$(CONFIG_DATAFLASH_MMC_SELECT) += cmd_dataflash_mmc_mux.o diff --git a/common/cmd_clear.c b/common/cmd_clear.c new file mode 100644 index 0000000..597611e --- /dev/null +++ b/common/cmd_clear.c @@ -0,0 +1,42 @@ +/* + * Copyright 2011 + * Marcel Mol, MESA Consulting, marcel@mesa.nl + * + * Copyright 2011 + * Pali Rohár, pali.rohar@gmail.com + * + * 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 as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <common.h> +#include <command.h> + +static int do_clear(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) +{ + puts(ANSI_CLEAR_CONSOLE); + printf(ANSI_CURSOR_POSITION, 1, 1); + return 0; +} + +U_BOOT_CMD( + clear, CONFIG_SYS_MAXARGS, 1, do_clear, + "clear", + "\n" + " - clear screen and move cursor to top of screen" +); diff --git a/include/common.h b/include/common.h index 3df1def..9c0449e 100644 --- a/include/common.h +++ b/include/common.h @@ -751,6 +751,13 @@ void clear_ctrlc (void); /* clear the Control-C condition */ int disable_ctrlc (int); /* 1 to disable, 0 to enable Control-C detect */
/* + * ANSI terminal + */ + +#define ANSI_CURSOR_POSITION "\e[%d;%dH" +#define ANSI_CLEAR_CONSOLE "\e[2J" + +/* * STDIO based functions (can always be used) */ /* serial stuff */ diff --git a/include/config_cmd_all.h b/include/config_cmd_all.h index 9716f9c..3f25eba 100644 --- a/include/config_cmd_all.h +++ b/include/config_cmd_all.h @@ -23,6 +23,7 @@ #define CONFIG_CMD_BSP /* Board Specific functions */ #define CONFIG_CMD_CACHE /* icache, dcache */ #define CONFIG_CMD_CDP /* Cisco Discovery Protocol */ +#define CONFIG_CMD_CLEAR /* ANSI clear screen command */ #define CONFIG_CMD_CONSOLE /* coninfo */ #define CONFIG_CMD_DATE /* support for RTC, date/time...*/ #define CONFIG_CMD_DHCP /* DHCP Support */

- Command can be enabled by CONFIG_CMD_CLEAR
- Added some ANSI escape codes definitions in common.h
Signed-off-by: Pali Rohár pali.rohar@gmail.com Cc: Marcel Mol marcel@mesa.nl
Do you seriously need a new command for such a simple operation?
M
Changes since original version:
- Renamed command clr to clear
- Use puts instead printf
- Move cursor to pos1,1
- Merged parts of patch "Add some ANSI escape codes definitions in
common.h"
common/Makefile | 1 + common/cmd_clear.c | 42 ++++++++++++++++++++++++++++++++++++++++++ include/common.h | 7 +++++++ include/config_cmd_all.h | 1 + 4 files changed, 51 insertions(+), 0 deletions(-) create mode 100644 common/cmd_clear.c
diff --git a/common/Makefile b/common/Makefile index 2d9ae8c..e1efd45 100644 --- a/common/Makefile +++ b/common/Makefile @@ -69,6 +69,7 @@ COBJS-$(CONFIG_CMD_BEDBUG) += bedbug.o cmd_bedbug.o COBJS-$(CONFIG_CMD_BMP) += cmd_bmp.o COBJS-$(CONFIG_CMD_BOOTLDR) += cmd_bootldr.o COBJS-$(CONFIG_CMD_CACHE) += cmd_cache.o +COBJS-$(CONFIG_CMD_CLEAR) += cmd_clear.o COBJS-$(CONFIG_CMD_CONSOLE) += cmd_console.o COBJS-$(CONFIG_CMD_CPLBINFO) += cmd_cplbinfo.o COBJS-$(CONFIG_DATAFLASH_MMC_SELECT) += cmd_dataflash_mmc_mux.o diff --git a/common/cmd_clear.c b/common/cmd_clear.c new file mode 100644 index 0000000..597611e --- /dev/null +++ b/common/cmd_clear.c @@ -0,0 +1,42 @@ +/*
- Copyright 2011
- Marcel Mol, MESA Consulting, marcel@mesa.nl
- Copyright 2011
- Pali Rohár, pali.rohar@gmail.com
- 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 as
- published by the Free Software Foundation; either version 2 of
- the License, or (at your option) any later version.
- 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.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- MA 02111-1307 USA
- */
+#include <common.h> +#include <command.h>
+static int do_clear(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) +{
- puts(ANSI_CLEAR_CONSOLE);
- printf(ANSI_CURSOR_POSITION, 1, 1);
- return 0;
+}
+U_BOOT_CMD(
- clear, CONFIG_SYS_MAXARGS, 1, do_clear,
- "clear",
- "\n"
- " - clear screen and move cursor to top of screen"
+); diff --git a/include/common.h b/include/common.h index 3df1def..9c0449e 100644 --- a/include/common.h +++ b/include/common.h @@ -751,6 +751,13 @@ void clear_ctrlc (void); /* clear the Control-C condition */ int disable_ctrlc (int); /* 1 to disable, 0 to enable Control-C detect */
/*
- ANSI terminal
- */
+#define ANSI_CURSOR_POSITION "\e[%d;%dH" +#define ANSI_CLEAR_CONSOLE "\e[2J"
+/*
- STDIO based functions (can always be used)
*/ /* serial stuff */ diff --git a/include/config_cmd_all.h b/include/config_cmd_all.h index 9716f9c..3f25eba 100644 --- a/include/config_cmd_all.h +++ b/include/config_cmd_all.h @@ -23,6 +23,7 @@ #define CONFIG_CMD_BSP /* Board Specific functions */ #define CONFIG_CMD_CACHE /* icache, dcache */ #define CONFIG_CMD_CDP /* Cisco Discovery Protocol */ +#define CONFIG_CMD_CLEAR /* ANSI clear screen command */ #define CONFIG_CMD_CONSOLE /* coninfo */ #define CONFIG_CMD_DATE /* support for RTC, date/time...*/ #define CONFIG_CMD_DHCP /* DHCP Support */

On Wednesday 25 January 2012 19:10:03 Marek Vasut wrote:
Do you seriously need a new command for such a simple operation?
Yes, command clear is really usefull for debugging framebuffer output on n900.

On Wednesday 25 January 2012 19:10:03 Marek Vasut wrote:
Do you seriously need a new command for such a simple operation?
Yes, command clear is really usefull for debugging framebuffer output on n900.
Ok, let's see what the other people think, I'm opposed tho

On Wednesday 25 January 2012 15:53:51 Marek Vasut wrote:
On Wednesday 25 January 2012 19:10:03 Marek Vasut wrote:
Do you seriously need a new command for such a simple operation?
Yes, command clear is really usefull for debugging framebuffer output on n900.
Ok, let's see what the other people think, I'm opposed tho
it's a CONFIG option, so it's fine by me
Acked-by: Mike Frysinger vapier@gentoo.org -mike

* If not defined CONFIG_MENUCMD do nothing
* If CONFIG_MENUKEY is 0 and was pressed any key run env "menu_cmd" * If pressed key was CONFIG_MENUKEY run env "menu_cmd" * If CONFIG_MENUKEY is not defined run env "menu_cmd" always
* CONFIG_MENUKEY working if defined CONFIG_MENUCMD and CONFIG_BOOTDELAY >= 0
Signed-off-by: Pali Rohár pali.rohar@gmail.com --- Changes since original version: - Fixed commit message
common/main.c | 34 +++++++++++++++++++++++----------- 1 files changed, 23 insertions(+), 11 deletions(-)
diff --git a/common/main.c b/common/main.c index e7b5516..503d6c4 100644 --- a/common/main.c +++ b/common/main.c @@ -82,6 +82,20 @@ int do_mdm_init = 0; extern void mdm_init(void); /* defined in board.c */ #endif
+#if defined(CONFIG_MENUKEY) && !defined(CONFIG_MENUCMD) && \ +(!defined(CONFIG_BOOTDELAY) || CONFIG_BOOTDELAY < 0) +#error CONFIG_MENUKEY defined, but not CONFIG_MENUCMD or CONFIG_BOOTDELAY >= 0 +#error define CONFIG_MENUCMD and CONFIG_BOOTDELAY too +#endif + +#ifdef CONFIG_MENUCMD +# ifdef CONFIG_MENUKEY +static int menucmd; +# else +static int menucmd = 1; +# endif +#endif + /*************************************************************************** * Watch for 'delay' seconds for autoboot stop or autoboot delay string. * returns: 0 - no key string, allow autoboot 1 - got key string, abort @@ -201,10 +215,6 @@ int abortboot(int bootdelay)
# else /* !defined(CONFIG_AUTOBOOT_KEYED) */
-#ifdef CONFIG_MENUKEY -static int menukey = 0; -#endif - #ifndef CONFIG_MENU static inline #endif @@ -241,8 +251,10 @@ int abortboot(int bootdelay) if (tstc()) { /* we got a key press */ abort = 1; /* don't auto boot */ bootdelay = 0; /* no more delay */ -# ifdef CONFIG_MENUKEY - menukey = getc(); +# if defined(CONFIG_MENUCMD) && defined(CONFIG_MENUKEY) + if (CONFIG_MENUKEY == 0 || + CONFIG_MENUKEY == getc()) + menucmd = 1; # else (void) getc(); /* consume input */ # endif @@ -292,6 +304,7 @@ int run_command2(const char *cmd, int flag)
void main_loop (void) { + char *s; #ifndef CONFIG_SYS_HUSH_PARSER static char lastcommand[CONFIG_SYS_CBSIZE] = { 0, }; int len; @@ -300,7 +313,6 @@ void main_loop (void) #endif
#if defined(CONFIG_BOOTDELAY) && (CONFIG_BOOTDELAY >= 0) - char *s; int bootdelay; #endif #ifdef CONFIG_PREBOOT @@ -405,15 +417,15 @@ void main_loop (void) disable_ctrlc(prev); /* restore Control C checking */ # endif } +#endif /* CONFIG_BOOTDELAY */
-# ifdef CONFIG_MENUKEY - if (menukey == CONFIG_MENUKEY) { +#ifdef CONFIG_MENUCMD + if (menucmd == 1) { s = getenv("menucmd"); if (s) run_command2(s, 0); } -#endif /* CONFIG_MENUKEY */ -#endif /* CONFIG_BOOTDELAY */ +#endif
/* * Main Loop for Monitor Command Processing

If not defined CONFIG_MENUCMD do nothing
If CONFIG_MENUKEY is 0 and was pressed any key run env "menu_cmd"
If pressed key was CONFIG_MENUKEY run env "menu_cmd"
If CONFIG_MENUKEY is not defined run env "menu_cmd" always
CONFIG_MENUKEY working if defined CONFIG_MENUCMD and CONFIG_BOOTDELAY >=
0
Signed-off-by: Pali Rohár pali.rohar@gmail.com
So this is just to interrupt autoboot? Why not just report the "menukey" as any other keypress and do it that way?
M
Changes since original version:
- Fixed commit message
common/main.c | 34 +++++++++++++++++++++++----------- 1 files changed, 23 insertions(+), 11 deletions(-)
diff --git a/common/main.c b/common/main.c index e7b5516..503d6c4 100644 --- a/common/main.c +++ b/common/main.c @@ -82,6 +82,20 @@ int do_mdm_init = 0; extern void mdm_init(void); /* defined in board.c */ #endif
+#if defined(CONFIG_MENUKEY) && !defined(CONFIG_MENUCMD) && \ +(!defined(CONFIG_BOOTDELAY) || CONFIG_BOOTDELAY < 0) +#error CONFIG_MENUKEY defined, but not CONFIG_MENUCMD or CONFIG_BOOTDELAY
= 0 +#error define CONFIG_MENUCMD and CONFIG_BOOTDELAY too
+#endif
+#ifdef CONFIG_MENUCMD +# ifdef CONFIG_MENUKEY +static int menucmd; +# else +static int menucmd = 1; +# endif +#endif
/************************************************************************* ** * Watch for 'delay' seconds for autoboot stop or autoboot delay string.
- returns: 0 - no key string, allow autoboot 1 - got key string, abort @@
-201,10 +215,6 @@ int abortboot(int bootdelay)
# else /* !defined(CONFIG_AUTOBOOT_KEYED) */
-#ifdef CONFIG_MENUKEY -static int menukey = 0; -#endif
#ifndef CONFIG_MENU static inline #endif @@ -241,8 +251,10 @@ int abortboot(int bootdelay) if (tstc()) { /* we got a key press */ abort = 1; /* don't auto boot */ bootdelay = 0; /* no more delay */ -# ifdef CONFIG_MENUKEY
menukey = getc();
+# if defined(CONFIG_MENUCMD) && defined(CONFIG_MENUKEY)
if (CONFIG_MENUKEY == 0 ||
CONFIG_MENUKEY == getc())
menucmd = 1;
# else (void) getc(); /* consume input */ # endif @@ -292,6 +304,7 @@ int run_command2(const char *cmd, int flag)
void main_loop (void) {
- char *s;
#ifndef CONFIG_SYS_HUSH_PARSER static char lastcommand[CONFIG_SYS_CBSIZE] = { 0, }; int len; @@ -300,7 +313,6 @@ void main_loop (void) #endif
#if defined(CONFIG_BOOTDELAY) && (CONFIG_BOOTDELAY >= 0)
- char *s; int bootdelay;
#endif #ifdef CONFIG_PREBOOT @@ -405,15 +417,15 @@ void main_loop (void) disable_ctrlc(prev); /* restore Control C checking */ # endif } +#endif /* CONFIG_BOOTDELAY */
-# ifdef CONFIG_MENUKEY
- if (menukey == CONFIG_MENUKEY) {
+#ifdef CONFIG_MENUCMD
- if (menucmd == 1) { s = getenv("menucmd"); if (s) run_command2(s, 0); }
-#endif /* CONFIG_MENUKEY */ -#endif /* CONFIG_BOOTDELAY */ +#endif
/* * Main Loop for Monitor Command Processing

On Wednesday 25 January 2012 19:12:29 Marek Vasut wrote:
So this is just to interrupt autoboot? Why not just report the "menukey" as any other keypress and do it that way?
Usefull for interrupt autoboot and run some menu (script/booting) only with specific key (for example with key M on device keyboard).

On Wednesday 25 January 2012 19:12:29 Marek Vasut wrote:
So this is just to interrupt autoboot? Why not just report the "menukey" as any other keypress and do it that way?
Usefull for interrupt autoboot and run some menu (script/booting) only with specific key (for example with key M on device keyboard).
what's the difference between this and CONFIG_MENUKEY?

On Wednesday 25 January 2012 21:53:02 Marek Vasut wrote:
On Wednesday 25 January 2012 19:12:29 Marek Vasut wrote:
So this is just to interrupt autoboot? Why not just report the "menukey" as any other keypress and do it that way?
Usefull for interrupt autoboot and run some menu (script/booting) only with specific key (for example with key M on device keyboard).
what's the difference between this and CONFIG_MENUKEY?
See commit message
CONFIG_MENUCMD define if U-Boot will run env variable "menucmd" CONFIG_MENUKEY define if some key must be pressed (and which) to run "menucmd"

same as before, this needs integration with existing menu code, so NAK this for now -mike

* if defined run env "premonitor" before Main Loop for Monitor Processing
Signed-off-by: Pali Rohár pali.rohar@gmail.com --- Changes since original version: - removed #ifdef CONFIG_PREMONITOR in main.c
common/env_common.c | 3 +++ common/main.c | 4 ++++ 2 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/common/env_common.c b/common/env_common.c index 71811c4..1c2360d 100644 --- a/common/env_common.c +++ b/common/env_common.c @@ -92,6 +92,9 @@ const uchar default_environment[] = { #ifdef CONFIG_PREBOOT "preboot=" CONFIG_PREBOOT "\0" #endif +#ifdef CONFIG_PREMONITOR + "premonitor=" CONFIG_PREMONITOR "\0" +#endif #ifdef CONFIG_ROOTPATH "rootpath=" CONFIG_ROOTPATH "\0" #endif diff --git a/common/main.c b/common/main.c index 503d6c4..e0c262c 100644 --- a/common/main.c +++ b/common/main.c @@ -427,6 +427,10 @@ void main_loop (void) } #endif
+ s = getenv("premonitor"); + if (s) + run_command2(s, 0); + /* * Main Loop for Monitor Command Processing */

- if defined run env "premonitor" before Main Loop for Monitor Processing
What is this good for?
Signed-off-by: Pali Rohár pali.rohar@gmail.com
Changes since original version:
- removed #ifdef CONFIG_PREMONITOR in main.c
common/env_common.c | 3 +++ common/main.c | 4 ++++ 2 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/common/env_common.c b/common/env_common.c index 71811c4..1c2360d 100644 --- a/common/env_common.c +++ b/common/env_common.c @@ -92,6 +92,9 @@ const uchar default_environment[] = { #ifdef CONFIG_PREBOOT "preboot=" CONFIG_PREBOOT "\0" #endif +#ifdef CONFIG_PREMONITOR
- "premonitor=" CONFIG_PREMONITOR "\0"
+#endif #ifdef CONFIG_ROOTPATH "rootpath=" CONFIG_ROOTPATH "\0" #endif diff --git a/common/main.c b/common/main.c index 503d6c4..e0c262c 100644 --- a/common/main.c +++ b/common/main.c @@ -427,6 +427,10 @@ void main_loop (void) } #endif
- s = getenv("premonitor");
- if (s)
run_command2(s, 0);
- /*
*/
- Main Loop for Monitor Command Processing

On Wednesday 25 January 2012 19:12:51 Marek Vasut wrote:
- if defined run env "premonitor" before Main Loop for Monitor Processing
What is this good for?
before running monitor loop I'd like write some info to console (specific board info, board commands, board macros). but if these info will be written in preboot it can be deleted by menu section.

On Wednesday 25 January 2012 19:12:51 Marek Vasut wrote:
- if defined run env "premonitor" before Main Loop for Monitor
Processing
What is this good for?
before running monitor loop I'd like write some info to console (specific board info, board commands, board macros). but if these info will be written in preboot it can be deleted by menu section.
The "menu" here, you refer to the thing you implemented? So fix that instead of introducing broken code and a pile of workarounds.

On Wednesday 25 January 2012 21:51:38 Marek Vasut wrote:
On Wednesday 25 January 2012 19:12:51 Marek Vasut wrote:
- if defined run env "premonitor" before Main Loop for Monitor
Processing
What is this good for?
before running monitor loop I'd like write some info to console (specific board info, board commands, board macros). but if these info will be written in preboot it can be deleted by menu section.
The "menu" here, you refer to the thing you implemented? So fix that instead of introducing broken code and a pile of workarounds.
With "menu" I mean env menucmd. U-Boot run command stored in env menucmd after preboot and before monitor loop. For example in menucmd can be my bootmenu, but there are no problems - no broken code! My bootmenu clear screan and show menu, so anything printed before menu entries will be deleted. This is not bug - Also in Grub or LILO is debug/output log cleaned when showing menu entries.

On Wednesday 25 January 2012 21:51:38 Marek Vasut wrote:
On Wednesday 25 January 2012 19:12:51 Marek Vasut wrote:
- if defined run env "premonitor" before Main Loop for Monitor
Processing
What is this good for?
before running monitor loop I'd like write some info to console (specific board info, board commands, board macros). but if these info will be written in preboot it can be deleted by menu section.
The "menu" here, you refer to the thing you implemented? So fix that instead of introducing broken code and a pile of workarounds.
With "menu" I mean env menucmd. U-Boot run command stored in env menucmd after preboot and before monitor loop. For example in menucmd can be my bootmenu, but there are no problems - no broken code! My bootmenu clear screan and show menu, so anything printed before menu entries will be deleted. This is not bug - Also in Grub or LILO is debug/output log cleaned when showing menu entries.
Ok anyway, but you implemented custom menu system anyway ... so let's clear this first, is common/menu.c useless for your application?
M

On Wednesday 25 January 2012 22:28:17 Marek Vasut wrote:
On Wednesday 25 January 2012 21:51:38 Marek Vasut wrote:
On Wednesday 25 January 2012 19:12:51 Marek Vasut wrote:
- if defined run env "premonitor" before Main Loop for Monitor
Processing
What is this good for?
before running monitor loop I'd like write some info to console (specific board info, board commands, board macros). but if these info will be written in preboot it can be deleted by menu section.
The "menu" here, you refer to the thing you implemented? So fix that instead of introducing broken code and a pile of workarounds.
With "menu" I mean env menucmd. U-Boot run command stored in env menucmd after preboot and before monitor loop. For example in menucmd can be my bootmenu, but there are no problems - no broken code! My bootmenu clear screan and show menu, so anything printed before menu entries will be deleted. This is not bug - Also in Grub or LILO is debug/output log cleaned when showing menu entries.
Ok anyway, but you implemented custom menu system anyway ... so let's clear this first, is common/menu.c useless for your application?
I do not know. I created my bootmenu before menu.c was integrated into u-boot. I did not looked at menu.c yet - I do not know what is in menu.c implemented.

On Wednesday 25 January 2012 22:28:17 Marek Vasut wrote:
On Wednesday 25 January 2012 21:51:38 Marek Vasut wrote:
On Wednesday 25 January 2012 19:12:51 Marek Vasut wrote:
> * if defined run env "premonitor" before Main Loop for Monitor > Processing
What is this good for?
before running monitor loop I'd like write some info to console (specific board info, board commands, board macros). but if these info will be written in preboot it can be deleted by menu section.
The "menu" here, you refer to the thing you implemented? So fix that instead of introducing broken code and a pile of workarounds.
With "menu" I mean env menucmd. U-Boot run command stored in env menucmd after preboot and before monitor loop. For example in menucmd can be my bootmenu, but there are no problems - no broken code! My bootmenu clear screan and show menu, so anything printed before menu entries will be deleted. This is not bug - Also in Grub or LILO is debug/output log cleaned when showing menu entries.
Ok anyway, but you implemented custom menu system anyway ... so let's clear this first, is common/menu.c useless for your application?
I do not know. I created my bootmenu before menu.c was integrated into u-boot. I did not looked at menu.c yet - I do not know what is in menu.c implemented.
Please go through it, we don't need two separate implementations of the same thing. If you can't use it as it, just augment it and submit a patch for it.

Acked-by: Mike Frysinger vapier@gentoo.org -mike

This board definition results in a u-boot.bin which can be chainloaded from NOLO in qemu or on a real N900. It does very little hardware config because NOLO has already configured the board. Only needed is enabling internal eMMC memory via twl4030 regulator which is not enabled by NOLO.
NOLO is expecting a kernel image and will treat any image it finds in onenand as such. This u-boot is intended to be flashed to the N900 like a kernel. In order to transparently boot the original kernel, it will be appended to u-boot.bin at 0x40000. NOLO will load the entire image into memory and execute u-boot, which saves the ATAGs set by NOLO. Then the bootscripts will attempt to load uImage or boot.scr from a fat or ext2 filesystem in external SD card or internal eMMC memory. If this fails or keyboard is closed the appended kernel image will be booted using the stored ATAGs (see boot order).
There is support for hardware watchdog. It is started by NOLO so u-boot must kick watchdog to prevent reboot device (but not very often, max every 2 seconds). There is also support for framebuffer display output with ANSI espace codes and the N900 HW keyboard input. USB tty works but is disabled because it prevents the current Maemo kernel from booting.
Based on previous work by: Alistair Buxton a.j.buxton@gmail.com
Default boot order:
* 0. if keyboard is closed boot automatically NOLO kernel image * 1. try boot from external SD card * 2. try boot from internal eMMC memory * 3. try boot from attached NOLO kernel image
Boot from SD or eMMC in this order:
* find boot.scr on first fat partition * find uImage on first fat parition * same order for 2. - 4. fat partition
* find boot.scr on first ext2 partition * find uImage on first ext2 parition * same order for 2. - 4. ext2 partition
Available additional commands/variables:
* run sercon - Use serial port for control * run usbcon - Use usbtty for control * run vgacon - Use framebuffer and HW keyboard for control (default)
* run sdboot - Boot from external SD card (see boot order) * run emmcboot - Boot from internal eMMC memory (see boot order) * run noloboot - Boot NOLO kernel image (attached to U-Boot binary)
* run scriptload - Load boot script ${mmcscriptfile} * run scriptboot - Run loaded boot script * run kernload - Load kernel image ${mmckernfile} * run initrdload - Load initrd image ${mmcinitrdfile} * run kernboot - Boot loaded kernel image * run kerninitrdboot - Boot loaded kernel image with loaded initrd image
* run trymmcscriptboot - Try to load and boot script ${mmcscriptfile} * run trymmckernboot - Try to load and boot kernel image ${mmckernfile} * run trymmckerninitrdboot - Try to load and boot kernel image ${mmckernfile} with initrd image ${mmcinitrdfile}
Variables for loading files from mmc:
* mmc ${mmcnum} (0 - external, 1 - internal) * partition number ${mmcpart} (1 - 4) * parition type ${mmctype} (fat, ext2)
Signed-off-by: Pali Rohár pali.rohar@gmail.com --- Changes since original version: - Removed Makefile targets: clean and distclean - Rewrited bootcommand and env variables in nokia_rx51.h - Removed useless CONFIG defines in nokia_rx51.h - Disable L2 cache with CONFIG_SYS_L2CACHE_OFF - fixed battery draining - Added onenand support (default disabled due to big u-boot size) - Moved inlined asm code to new file lowlevel_init.S - Fixed commit message
board/nokia/rx51/Makefile | 46 +++++ board/nokia/rx51/lowlevel_init.S | 79 ++++++++ board/nokia/rx51/rx51.c | 381 ++++++++++++++++++++++++++++++++++++++ board/nokia/rx51/rx51.h | 378 +++++++++++++++++++++++++++++++++++++ boards.cfg | 1 + include/configs/nokia_rx51.h | 362 ++++++++++++++++++++++++++++++++++++ 6 files changed, 1247 insertions(+), 0 deletions(-) create mode 100644 board/nokia/rx51/Makefile create mode 100644 board/nokia/rx51/lowlevel_init.S create mode 100644 board/nokia/rx51/rx51.c create mode 100644 board/nokia/rx51/rx51.h create mode 100644 include/configs/nokia_rx51.h
diff --git a/board/nokia/rx51/Makefile b/board/nokia/rx51/Makefile new file mode 100644 index 0000000..86fb48c --- /dev/null +++ b/board/nokia/rx51/Makefile @@ -0,0 +1,46 @@ +# +# (C) Copyright 2000, 2001, 2002 +# Wolfgang Denk, DENX Software Engineering, wd@denx.de. +# +# 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 as +# published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# + +include $(TOPDIR)/config.mk + +LIB = $(obj)lib$(BOARD).o + +COBJS-y := $(BOARD).o +SOBJS-y := lowlevel_init.o + +COBJS := $(sort $(COBJS-y)) +SOBJS := $(sort $(SOBJS-y)) +SRCS := $(COBJS:.o=.c) $(SOBJS:.o=.S) +OBJS := $(addprefix $(obj),$(COBJS)) $(addprefix $(obj),$(SOBJS)) + +$(LIB): $(obj).depend $(OBJS) + $(call cmd_link_o_target, $(OBJS)) + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +######################################################################### diff --git a/board/nokia/rx51/lowlevel_init.S b/board/nokia/rx51/lowlevel_init.S new file mode 100644 index 0000000..5a57213 --- /dev/null +++ b/board/nokia/rx51/lowlevel_init.S @@ -0,0 +1,79 @@ +/* + * (C) Copyright 2011-2012 + * Pali Rohár pali.rohar@gmail.com + * + * 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 as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#define KERNEL_OFFSET 0x40000 +#define KERNEL_MAXSIZE 0x200000 /* 2MB */ + +startaddr: /* address where should be u-boot after relocation */ + .word CONFIG_SYS_TEXT_BASE + +relocaddr: /* address of this relocaddr section after relocation */ + .word . /* address of section (calculated at compile time) */ + +.global rx51_atagaddr +rx51_atagaddr: +atagaddr: /* stored atag address (r2) */ + .word 0x0 + +.global rx51_kernaddr +rx51_kernaddr: +kernaddr: /* stored attached kernel address */ + .word CONFIG_SYS_TEXT_BASE + KERNEL_OFFSET + +/* + * Routine: save_boot_params (called after reset from start.S) + * Description: Save atag address and attached kernel address. + * Move u-boot to address CONFIG_SYS_TEXT_BASE + */ + +.global save_boot_params +save_boot_params: /* function save_boot_params, called after reset */ + /* r2 - address of atag (set by NOLO) */ + str r2, atagaddr /* store atag address to memory */ + adr r0, relocaddr /* r0 - address of section relocaddr */ + ldr r1, relocaddr /* r1 - address of relocaddr after relocation */ + sub r0, r0, r1 /* r1 - calculated offset for relocation */ + ldr r1, startaddr /* r1 - address of u-boot after relocation */ + add r0, r0, r1 /* r0 - address where is u-boot now */ + /* (address after relocation + offset) */ + + cmp r0, r1 + bne reloc /* relocate if u-boot is not at correct address */ + bx lr /* else return (to reset, relocation is not needed) */ + +reloc: + add r2, r0, #KERNEL_OFFSET /* r2 - address of attached kernel */ + /* (u-boot address + kernel offset) */ + str r2, kernaddr /* store kernel address to memory */ + add r2, r0, #KERNEL_MAXSIZE /* r2 - address - end of kernel image */ + /* (u-boot address + kernel max size */ + +loop: + ldmia r0!, {r3 - r10} /* copy from source address (r0) */ + stmia r1!, {r3 - r10} /* copy to destination address (r1) */ + cmp r0, r2 + bne loop /* until end of kernel image (r2) */ + + ldr r2, atagaddr /* revert back address of atag to r2 */ + ldr pc, startaddr /* jump to start section */ +/* (where should be u-boot after relocation) and restart u-boot */ diff --git a/board/nokia/rx51/rx51.c b/board/nokia/rx51/rx51.c new file mode 100644 index 0000000..f6d4cb5 --- /dev/null +++ b/board/nokia/rx51/rx51.c @@ -0,0 +1,381 @@ +/* + * (C) Copyright 2011-2012 + * Pali Rohár pali.rohar@gmail.com + * + * (C) Copyright 2010 + * Alistair Buxton a.j.buxton@gmail.com + * + * Derived from Beagle Board and 3430 SDP code: + * (C) Copyright 2004-2008 + * Texas Instruments, <www.ti.com> + * + * Author : + * Sunil Kumar sunilsaini05@gmail.com + * Shashi Ranjan shashiranjanmca05@gmail.com + * + * Richard Woodruff r-woodruff2@ti.com + * Syed Mohammed Khasim khasim@ti.com + * + * 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 as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <common.h> +#include <twl4030.h> +#include <i2c.h> +#include <video_fb.h> +#include <asm/io.h> +#include <asm/bitops.h> +#include <asm/gpio.h> +#include <asm/mach-types.h> +#include <asm/arch/mux.h> +#include <asm/arch/sys_proto.h> +#include <asm/arch/mmc_host_def.h> + +#include "rx51.h" + +DECLARE_GLOBAL_DATA_PTR; + +GraphicDevice gdev; + +const omap3_sysinfo sysinfo = { + DDR_STACKED, + "Nokia RX-51", + "" +}; + +/* + * Routine: board_init + * Description: Early hardware init. + */ +int board_init(void) +{ + gpmc_init(); /* in SRAM or SDRAM, finish GPMC */ + /* board id for Linux */ + gd->bd->bi_arch_number = MACH_TYPE_NOKIA_RX51; + /* boot param addr */ + gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100); + + return 0; +} + +/* + * Routine: video_hw_init + * Description: Set up the GraphicDevice depending on sys_boot. + */ +void *video_hw_init(void) +{ + /* fill in Graphic Device */ + gdev.frameAdrs = 0x8f9c0000; + gdev.winSizeX = 800; + gdev.winSizeY = 480; + gdev.gdfBytesPP = 2; + gdev.gdfIndex = GDF_16BIT_565RGB; + memset((void *)gdev.frameAdrs, 0, 0xbb800); + return (void *) &gdev; +} + +/* + * Routine: twl4030_regulator_set_mode + * Description: Set twl4030 regulator mode over i2c powerbus. + */ +static void twl4030_regulator_set_mode(u8 id, u8 mode) +{ + u16 msg = MSG_SINGULAR(DEV_GRP_P1, id, mode); + twl4030_i2c_write_u8(TWL4030_CHIP_PM_MASTER, msg >> 8, + TWL4030_PM_MASTER_PB_WORD_MSB); + twl4030_i2c_write_u8(TWL4030_CHIP_PM_MASTER, msg & 0xff, + TWL4030_PM_MASTER_PB_WORD_LSB); +} + +/* + * Routine: misc_init_r + * Description: Configure board specific parts. + */ +int misc_init_r(void) +{ + unsigned int slide_sw; + char buf[12]; + + sprintf(buf, "%#x", rx51_kernaddr); + setenv("init_kernaddr", buf); + sprintf(buf, "%#x", rx51_atagaddr); + setenv("init_atagaddr", buf); + + /* initialize twl4030 power managment */ + twl4030_power_init(); + + /* set VSIM to 1.8V */ + twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VSIM_DEDICATED, + TWL4030_PM_RECEIVER_VSIM_VSEL_18, + TWL4030_PM_RECEIVER_VSIM_DEV_GRP, + TWL4030_PM_RECEIVER_DEV_GRP_P1); + + /* enable I2C access to powerbus (needed for twl4030 regulator) */ + twl4030_i2c_write_u8(TWL4030_CHIP_PM_MASTER, 0x02, + TWL4030_PM_MASTER_PB_CFG); + + /* set VAUX3, VSIM and VMMC1 state to active - enable eMMC memory */ + twl4030_regulator_set_mode(RES_VAUX3, RES_STATE_ACTIVE); + twl4030_regulator_set_mode(RES_VSIM, RES_STATE_ACTIVE); + twl4030_regulator_set_mode(RES_VMMC1, RES_STATE_ACTIVE); + + /* set environment variable slide_sw if keyboard slide is open/close */ + gpio_direction_input(71); + slide_sw = gpio_get_value(71); + gpio_free(71); + setenv("slide_sw", slide_sw ? "close" : "open"); + + dieid_num_r(); + + return 0; +} + +/* + * Routine: set_muxconf_regs + * Description: Setting up the configuration Mux registers specific to the + * hardware. Many pins need to be moved from protect to primary + * mode. + */ +void set_muxconf_regs(void) +{ + MUX_RX51(); +} + +static unsigned long int twl_wd_time; /* last time of watchdog reset */ +static unsigned long int twl_i2c_lock; + +/* + * Routine: hw_watchdog_reset + * Description: Reset timeout of twl4030 watchdog. + */ +void hw_watchdog_reset(void) +{ + u8 timeout = 0; + + /* do not reset watchdog too often - max every 4s */ + if (get_timer(twl_wd_time) < 4 * CONFIG_SYS_HZ) + return; + + /* localy lock twl4030 i2c bus */ + if (test_and_set_bit(0, &twl_i2c_lock)) + return; + + /* read actual watchdog timeout */ + twl4030_i2c_read_u8(TWL4030_CHIP_PM_RECEIVER, &timeout, + TWL4030_PM_RECEIVER_WATCHDOG_CFG); + + /* timeout 0 means watchdog is disabled */ + /* reset watchdog timeout to 31s (maximum) */ + if (timeout != 0) + twl4030_i2c_write_u8(TWL4030_CHIP_PM_RECEIVER, 31, + TWL4030_PM_RECEIVER_WATCHDOG_CFG); + + /* store last watchdog reset time */ + twl_wd_time = get_timer(0); + + /* localy unlock twl4030 i2c bus */ + test_and_clear_bit(0, &twl_i2c_lock); +} + +/* + * TWL4030 keypad handler for cfb_console + */ + +static const char keymap[] = { + /* normal */ + 'q', 'o', 'p', ',', '\b', 0, 'a', 's', + 'w', 'd', 'f', 'g', 'h', 'j', 'k', 'l', + 'e', '.', 0, '\r', 0, 'z', 'x', 'c', + 'r', 'v', 'b', 'n', 'm', ' ', ' ', 0, + 't', 0, 0, 0, 0, 0, 0, 0, + 'y', 0, 0, 0, 0, 0, 0, 0, + 'u', 0, 0, 0, 0, 0, 0, 0, + 'i', 5, 6, 0, 0, 0, 0, 0, + /* fn */ + '1', '9', '0', '=', '\b', 0, '*', '+', + '2', '#', '-', '_', '(', ')', '&', '!', + '3', '?', '^', '\r', 0, 156, '$', 238, + '4', '/', '\', '"', ''', '@', 0, '<', + '5', '|', '>', 0, 0, 0, 0, 0, + '6', 0, 0, 0, 0, 0, 0, 0, + '7', 0, 0, 0, 0, 0, 0, 0, + '8', 16, 17, 0, 0, 0, 0, 0, +}; + +static u8 keys[8]; +static u8 old_keys[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +#define KEYBUF_SIZE 32 +static u8 keybuf[KEYBUF_SIZE]; +static u8 keybuf_head; +static u8 keybuf_tail; + +/* + * Routine: rx51_kp_init + * Description: Initialize HW keyboard. + */ +int rx51_kp_init(void) +{ + int ret = 0; + u8 ctrl; + ret = twl4030_i2c_read_u8(TWL4030_CHIP_KEYPAD, &ctrl, + TWL4030_KEYPAD_KEYP_CTRL_REG); + + if (!ret) { + /* turn on keyboard and use hardware scanning */ + ctrl |= TWL4030_KEYPAD_CTRL_KBD_ON; + ctrl |= TWL4030_KEYPAD_CTRL_SOFT_NRST; + ctrl |= TWL4030_KEYPAD_CTRL_SOFTMODEN; + ret |= twl4030_i2c_write_u8(TWL4030_CHIP_KEYPAD, ctrl, + TWL4030_KEYPAD_KEYP_CTRL_REG); + /* enable key event status */ + ret |= twl4030_i2c_write_u8(TWL4030_CHIP_KEYPAD, 0xfe, + TWL4030_KEYPAD_KEYP_IMR1); + /* enable interrupt generation on rising and falling */ + /* this is a workaround for qemu twl4030 emulation */ + ret |= twl4030_i2c_write_u8(TWL4030_CHIP_KEYPAD, 0x57, + TWL4030_KEYPAD_KEYP_EDR); + /* enable ISR clear on read */ + ret |= twl4030_i2c_write_u8(TWL4030_CHIP_KEYPAD, 0x05, + TWL4030_KEYPAD_KEYP_SIH_CTRL); + } + return ret; +} + +static void rx51_kp_fill(u8 k, u8 mods) +{ + if (!(mods & 2) && (k == 18 || k == 31 || k == 33 || k == 34)) { + /* cursor keys, without fn */ + keybuf[keybuf_tail++] = '\e'; + keybuf_tail %= KEYBUF_SIZE; + keybuf[keybuf_tail++] = '['; + keybuf_tail %= KEYBUF_SIZE; + keybuf[keybuf_tail++] = '1'; + if (k == 18) /* up */ + keybuf[keybuf_tail++] = 'A'; + else if (k == 31) /* left */ + keybuf[keybuf_tail++] = 'D'; + else if (k == 33) /* down */ + keybuf[keybuf_tail++] = 'B'; + else if (k == 34) /* right */ + keybuf[keybuf_tail++] = 'C'; + keybuf_tail %= KEYBUF_SIZE; + return; + } + + if (mods & 2) { /* fn */ + k = keymap[k+64]; + } else { + k = keymap[k]; + if (mods & 1) { /* ctrl */ + if (k >= 'a' && k <= 'z') + k -= 'a' - 1; + } + if (mods & 4) { /* shift */ + if (k >= 'a' && k <= 'z') + k += 'A' - 'a'; + else if (k == '.') + k = ':'; + else if (k == ',') + k = ';'; + } + } + keybuf[keybuf_tail++] = k; + keybuf_tail %= KEYBUF_SIZE; +} + +/* + * Routine: rx51_kp_tstc + * Description: Test if key was pressed (from buffer). + */ +int rx51_kp_tstc(void) +{ + u8 c, r, dk, i; + u8 intr; + u8 mods; + + /* localy lock twl4030 i2c bus */ + if (test_and_set_bit(0, &twl_i2c_lock)) + return 0; + + /* twl4030 remembers up to 2 events */ + for (i = 0; i < 2; i++) { + + /* check interrupt register for events */ + twl4030_i2c_read_u8(TWL4030_CHIP_KEYPAD, &intr, + TWL4030_KEYPAD_KEYP_ISR1+(2*i)); + + if (intr&1) { /* got an event */ + + /* read the key state */ + i2c_read(TWL4030_CHIP_KEYPAD, + TWL4030_KEYPAD_FULL_CODE_7_0, 1, keys, 8); + + /* cut out modifier keys from the keystate */ + mods = keys[4] >> 4; + keys[4] &= 0x0f; + + for (c = 0; c < 8; c++) { + + /* get newly pressed keys only */ + dk = ((keys[c] ^ old_keys[c])&keys[c]); + old_keys[c] = keys[c]; + + /* fill the keybuf */ + for (r = 0; r < 8; r++) { + if (dk&1) + rx51_kp_fill((c*8)+r, mods); + dk = dk >> 1; + } + + } + + } + + } + + /* localy unlock twl4030 i2c bus */ + test_and_clear_bit(0, &twl_i2c_lock); + + return (KEYBUF_SIZE + keybuf_tail - keybuf_head)%KEYBUF_SIZE; +} + +/* + * Routine: rx51_kp_getc + * Description: Get last pressed key (from buffer). + */ +int rx51_kp_getc(void) +{ + keybuf_head %= KEYBUF_SIZE; + while (!rx51_kp_tstc()) { + udelay(1); + hw_watchdog_reset(); + } + return keybuf[keybuf_head++]; +} + +/* + * Routine: board_mmc_init + * Description: Initialize mmc devices. + */ +int board_mmc_init(bd_t *bis) +{ + omap_mmc_init(0); + omap_mmc_init(1); + return 0; +} diff --git a/board/nokia/rx51/rx51.h b/board/nokia/rx51/rx51.h new file mode 100644 index 0000000..362928f --- /dev/null +++ b/board/nokia/rx51/rx51.h @@ -0,0 +1,378 @@ +/* + * (C) Copyright 2011-2012 + * Pali Rohár pali.rohar@gmail.com + * + * (C) Copyright 2008 + * Dirk Behme dirk.behme@gmail.com + * + * 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 as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ +#ifndef _RX51_H_ +#define _RX51_H_ + +extern u32 rx51_atagaddr; /* atag address */ +extern u32 rx51_kernaddr; /* attached kernel address */ + +/* + * IEN - Input Enable + * IDIS - Input Disable + * PTD - Pull type Down + * PTU - Pull type Up + * DIS - Pull type selection is inactive + * EN - Pull type selection is active + * M0 - Mode 0 + * The commented string gives the final mux configuration for that pin + */ +#define MUX_RX51() \ + /*SDRC*/\ + MUX_VAL(CP(SDRC_D0), (IEN | PTD | DIS | M0)) /*SDRC_D0*/\ + MUX_VAL(CP(SDRC_D1), (IEN | PTD | DIS | M0)) /*SDRC_D1*/\ + MUX_VAL(CP(SDRC_D2), (IEN | PTD | DIS | M0)) /*SDRC_D2*/\ + MUX_VAL(CP(SDRC_D3), (IEN | PTD | DIS | M0)) /*SDRC_D3*/\ + MUX_VAL(CP(SDRC_D4), (IEN | PTD | DIS | M0)) /*SDRC_D4*/\ + MUX_VAL(CP(SDRC_D5), (IEN | PTD | DIS | M0)) /*SDRC_D5*/\ + MUX_VAL(CP(SDRC_D6), (IEN | PTD | DIS | M0)) /*SDRC_D6*/\ + MUX_VAL(CP(SDRC_D7), (IEN | PTD | DIS | M0)) /*SDRC_D7*/\ + MUX_VAL(CP(SDRC_D8), (IEN | PTD | DIS | M0)) /*SDRC_D8*/\ + MUX_VAL(CP(SDRC_D9), (IEN | PTD | DIS | M0)) /*SDRC_D9*/\ + MUX_VAL(CP(SDRC_D10), (IEN | PTD | DIS | M0)) /*SDRC_D10*/\ + MUX_VAL(CP(SDRC_D11), (IEN | PTD | DIS | M0)) /*SDRC_D11*/\ + MUX_VAL(CP(SDRC_D12), (IEN | PTD | DIS | M0)) /*SDRC_D12*/\ + MUX_VAL(CP(SDRC_D13), (IEN | PTD | DIS | M0)) /*SDRC_D13*/\ + MUX_VAL(CP(SDRC_D14), (IEN | PTD | DIS | M0)) /*SDRC_D14*/\ + MUX_VAL(CP(SDRC_D15), (IEN | PTD | DIS | M0)) /*SDRC_D15*/\ + MUX_VAL(CP(SDRC_D16), (IEN | PTD | DIS | M0)) /*SDRC_D16*/\ + MUX_VAL(CP(SDRC_D17), (IEN | PTD | DIS | M0)) /*SDRC_D17*/\ + MUX_VAL(CP(SDRC_D18), (IEN | PTD | DIS | M0)) /*SDRC_D18*/\ + MUX_VAL(CP(SDRC_D19), (IEN | PTD | DIS | M0)) /*SDRC_D19*/\ + MUX_VAL(CP(SDRC_D20), (IEN | PTD | DIS | M0)) /*SDRC_D20*/\ + MUX_VAL(CP(SDRC_D21), (IEN | PTD | DIS | M0)) /*SDRC_D21*/\ + MUX_VAL(CP(SDRC_D22), (IEN | PTD | DIS | M0)) /*SDRC_D22*/\ + MUX_VAL(CP(SDRC_D23), (IEN | PTD | DIS | M0)) /*SDRC_D23*/\ + MUX_VAL(CP(SDRC_D24), (IEN | PTD | DIS | M0)) /*SDRC_D24*/\ + MUX_VAL(CP(SDRC_D25), (IEN | PTD | DIS | M0)) /*SDRC_D25*/\ + MUX_VAL(CP(SDRC_D26), (IEN | PTD | DIS | M0)) /*SDRC_D26*/\ + MUX_VAL(CP(SDRC_D27), (IEN | PTD | DIS | M0)) /*SDRC_D27*/\ + MUX_VAL(CP(SDRC_D28), (IEN | PTD | DIS | M0)) /*SDRC_D28*/\ + MUX_VAL(CP(SDRC_D29), (IEN | PTD | DIS | M0)) /*SDRC_D29*/\ + MUX_VAL(CP(SDRC_D30), (IEN | PTD | DIS | M0)) /*SDRC_D30*/\ + MUX_VAL(CP(SDRC_D31), (IEN | PTD | DIS | M0)) /*SDRC_D31*/\ + MUX_VAL(CP(SDRC_CLK), (IEN | PTD | DIS | M0)) /*SDRC_CLK*/\ + MUX_VAL(CP(SDRC_DQS0), (IEN | PTD | DIS | M0)) /*SDRC_DQS0*/\ + MUX_VAL(CP(SDRC_DQS1), (IEN | PTD | DIS | M0)) /*SDRC_DQS1*/\ + MUX_VAL(CP(SDRC_DQS2), (IEN | PTD | DIS | M0)) /*SDRC_DQS2*/\ + MUX_VAL(CP(SDRC_DQS3), (IEN | PTD | DIS | M0)) /*SDRC_DQS3*/\ + /*GPMC*/\ + MUX_VAL(CP(GPMC_A1), (IDIS | PTD | DIS | M0)) /*GPMC_A1*/\ + MUX_VAL(CP(GPMC_A2), (IDIS | PTD | DIS | M0)) /*GPMC_A2*/\ + MUX_VAL(CP(GPMC_A3), (IDIS | PTD | DIS | M0)) /*GPMC_A3*/\ + MUX_VAL(CP(GPMC_A4), (IDIS | PTD | DIS | M0)) /*GPMC_A4*/\ + MUX_VAL(CP(GPMC_A5), (IDIS | PTD | DIS | M0)) /*GPMC_A5*/\ + MUX_VAL(CP(GPMC_A6), (IDIS | PTD | DIS | M0)) /*GPMC_A6*/\ + MUX_VAL(CP(GPMC_A7), (IDIS | PTD | DIS | M0)) /*GPMC_A7*/\ + MUX_VAL(CP(GPMC_A8), (IDIS | PTD | DIS | M0)) /*GPMC_A8*/\ + MUX_VAL(CP(GPMC_A9), (IDIS | PTD | DIS | M0)) /*GPMC_A9*/\ + MUX_VAL(CP(GPMC_A10), (IDIS | PTD | DIS | M0)) /*GPMC_A10*/\ + MUX_VAL(CP(GPMC_D0), (IEN | PTD | DIS | M0)) /*GPMC_D0*/\ + MUX_VAL(CP(GPMC_D1), (IEN | PTD | DIS | M0)) /*GPMC_D1*/\ + MUX_VAL(CP(GPMC_D2), (IEN | PTD | DIS | M0)) /*GPMC_D2*/\ + MUX_VAL(CP(GPMC_D3), (IEN | PTD | DIS | M0)) /*GPMC_D3*/\ + MUX_VAL(CP(GPMC_D4), (IEN | PTD | DIS | M0)) /*GPMC_D4*/\ + MUX_VAL(CP(GPMC_D5), (IEN | PTD | DIS | M0)) /*GPMC_D5*/\ + MUX_VAL(CP(GPMC_D6), (IEN | PTD | DIS | M0)) /*GPMC_D6*/\ + MUX_VAL(CP(GPMC_D7), (IEN | PTD | DIS | M0)) /*GPMC_D7*/\ + MUX_VAL(CP(GPMC_D8), (IEN | PTD | DIS | M0)) /*GPMC_D8*/\ + MUX_VAL(CP(GPMC_D9), (IEN | PTD | DIS | M0)) /*GPMC_D9*/\ + MUX_VAL(CP(GPMC_D10), (IEN | PTD | DIS | M0)) /*GPMC_D10*/\ + MUX_VAL(CP(GPMC_D11), (IEN | PTD | DIS | M0)) /*GPMC_D11*/\ + MUX_VAL(CP(GPMC_D12), (IEN | PTD | DIS | M0)) /*GPMC_D12*/\ + MUX_VAL(CP(GPMC_D13), (IEN | PTD | DIS | M0)) /*GPMC_D13*/\ + MUX_VAL(CP(GPMC_D14), (IEN | PTD | DIS | M0)) /*GPMC_D14*/\ + MUX_VAL(CP(GPMC_D15), (IEN | PTD | DIS | M0)) /*GPMC_D15*/\ + MUX_VAL(CP(GPMC_NCS0), (IDIS | PTU | EN | M0)) /*GPMC_nCS0*/\ + MUX_VAL(CP(GPMC_NCS1), (IDIS | PTU | EN | M0)) /*GPMC_nCS1*/\ + MUX_VAL(CP(GPMC_NCS2), (IDIS | PTU | EN | M0)) /*GPMC_nCS2*/\ + MUX_VAL(CP(GPMC_NCS3), (IDIS | PTU | EN | M0)) /*GPMC_nCS3*/\ + MUX_VAL(CP(GPMC_NCS4), (IDIS | PTU | EN | M0)) /*GPMC_nCS4*/\ + MUX_VAL(CP(GPMC_NCS5), (IDIS | PTD | DIS | M0)) /*GPMC_nCS5*/\ + MUX_VAL(CP(GPMC_NCS6), (IEN | PTD | DIS | M1)) /*nDMA_REQ2*/\ + MUX_VAL(CP(GPMC_NCS7), (IEN | PTU | EN | M1)) /*nDMA_REQ3*/\ + MUX_VAL(CP(GPMC_NBE1), (IEN | PTD | DIS | M0)) /*GPMC_nBE1*/\ + MUX_VAL(CP(GPMC_WAIT2), (IEN | PTU | EN | M0)) /*GPMC_WAIT2*/\ + MUX_VAL(CP(GPMC_WAIT3), (IEN | PTU | EN | M0)) /*GPMC_WAIT3*/\ + MUX_VAL(CP(GPMC_CLK), (IDIS | PTD | DIS | M0)) /*GPMC_CLK*/\ + MUX_VAL(CP(GPMC_NADV_ALE), (IDIS | PTD | DIS | M0)) /*GPMC_nADV*/\ + MUX_VAL(CP(GPMC_NOE), (IDIS | PTD | DIS | M0)) /*GPMC_nOE*/\ + MUX_VAL(CP(GPMC_NWE), (IDIS | PTD | DIS | M0)) /*GPMC_nWE*/\ + MUX_VAL(CP(GPMC_NBE0_CLE), (IDIS | PTD | DIS | M0)) /*GPMC_nBE0*/\ + MUX_VAL(CP(GPMC_NWP), (IEN | PTD | DIS | M0)) /*GPMC_nWP*/\ + MUX_VAL(CP(GPMC_WAIT0), (IEN | PTU | EN | M0)) /*GPMC_WAIT0*/\ + MUX_VAL(CP(GPMC_WAIT1), (IEN | PTU | EN | M0)) /*GPMC_WAIT1*/\ + /*DSS*/\ + MUX_VAL(CP(DSS_PCLK), (IDIS | PTD | DIS | M0)) /*DSS_PCLK*/\ + MUX_VAL(CP(DSS_HSYNC), (IDIS | PTD | DIS | M0)) /*DSS_HSYNC*/\ + MUX_VAL(CP(DSS_VSYNC), (IDIS | PTD | DIS | M0)) /*DSS_VSYNC*/\ + MUX_VAL(CP(DSS_ACBIAS), (IDIS | PTD | DIS | M0)) /*DSS_ACBIAS*/\ + MUX_VAL(CP(DSS_DATA0), (IDIS | PTD | DIS | M0)) /*DSS_DATA0*/\ + MUX_VAL(CP(DSS_DATA1), (IDIS | PTD | DIS | M0)) /*DSS_DATA1*/\ + MUX_VAL(CP(DSS_DATA2), (IDIS | PTD | DIS | M0)) /*DSS_DATA2*/\ + MUX_VAL(CP(DSS_DATA3), (IDIS | PTD | DIS | M0)) /*DSS_DATA3*/\ + MUX_VAL(CP(DSS_DATA4), (IDIS | PTD | DIS | M0)) /*DSS_DATA4*/\ + MUX_VAL(CP(DSS_DATA5), (IDIS | PTD | DIS | M0)) /*DSS_DATA5*/\ + MUX_VAL(CP(DSS_DATA6), (IDIS | PTD | DIS | M0)) /*DSS_DATA6*/\ + MUX_VAL(CP(DSS_DATA7), (IDIS | PTD | DIS | M0)) /*DSS_DATA7*/\ + MUX_VAL(CP(DSS_DATA8), (IDIS | PTD | DIS | M0)) /*DSS_DATA8*/\ + MUX_VAL(CP(DSS_DATA9), (IDIS | PTD | DIS | M0)) /*DSS_DATA9*/\ + MUX_VAL(CP(DSS_DATA10), (IDIS | PTD | DIS | M0)) /*DSS_DATA10*/\ + MUX_VAL(CP(DSS_DATA11), (IDIS | PTD | DIS | M0)) /*DSS_DATA11*/\ + MUX_VAL(CP(DSS_DATA12), (IDIS | PTD | DIS | M0)) /*DSS_DATA12*/\ + MUX_VAL(CP(DSS_DATA13), (IDIS | PTD | DIS | M0)) /*DSS_DATA13*/\ + MUX_VAL(CP(DSS_DATA14), (IDIS | PTD | DIS | M0)) /*DSS_DATA14*/\ + MUX_VAL(CP(DSS_DATA15), (IDIS | PTD | DIS | M0)) /*DSS_DATA15*/\ + MUX_VAL(CP(DSS_DATA16), (IDIS | PTD | DIS | M0)) /*DSS_DATA16*/\ + MUX_VAL(CP(DSS_DATA17), (IDIS | PTD | DIS | M0)) /*DSS_DATA17*/\ + MUX_VAL(CP(DSS_DATA18), (IDIS | PTD | DIS | M0)) /*DSS_DATA18*/\ + MUX_VAL(CP(DSS_DATA19), (IDIS | PTD | DIS | M0)) /*DSS_DATA19*/\ + MUX_VAL(CP(DSS_DATA20), (IDIS | PTD | DIS | M0)) /*DSS_DATA20*/\ + MUX_VAL(CP(DSS_DATA21), (IDIS | PTD | DIS | M0)) /*DSS_DATA21*/\ + MUX_VAL(CP(DSS_DATA22), (IDIS | PTD | DIS | M0)) /*DSS_DATA22*/\ + MUX_VAL(CP(DSS_DATA23), (IDIS | PTD | DIS | M0)) /*DSS_DATA23*/\ + /*CAMERA*/\ + MUX_VAL(CP(CAM_HS), (IEN | PTU | EN | M0)) /*CAM_HS */\ + MUX_VAL(CP(CAM_VS), (IEN | PTU | EN | M0)) /*CAM_VS */\ + MUX_VAL(CP(CAM_XCLKA), (IDIS | PTD | DIS | M0)) /*CAM_XCLKA*/\ + MUX_VAL(CP(CAM_PCLK), (IEN | PTU | EN | M0)) /*CAM_PCLK*/\ + MUX_VAL(CP(CAM_FLD), (IDIS | PTD | DIS | M4)) /*GPIO_98*/\ + MUX_VAL(CP(CAM_D0), (IEN | PTD | DIS | M0)) /*CAM_D0*/\ + MUX_VAL(CP(CAM_D1), (IEN | PTD | DIS | M0)) /*CAM_D1*/\ + MUX_VAL(CP(CAM_D2), (IEN | PTD | DIS | M0)) /*CAM_D2*/\ + MUX_VAL(CP(CAM_D3), (IEN | PTD | DIS | M0)) /*CAM_D3*/\ + MUX_VAL(CP(CAM_D4), (IEN | PTD | DIS | M0)) /*CAM_D4*/\ + MUX_VAL(CP(CAM_D5), (IEN | PTD | DIS | M0)) /*CAM_D5*/\ + MUX_VAL(CP(CAM_D6), (IEN | PTD | DIS | M0)) /*CAM_D6*/\ + MUX_VAL(CP(CAM_D7), (IEN | PTD | DIS | M0)) /*CAM_D7*/\ + MUX_VAL(CP(CAM_D8), (IEN | PTD | DIS | M0)) /*CAM_D8*/\ + MUX_VAL(CP(CAM_D9), (IEN | PTD | DIS | M0)) /*CAM_D9*/\ + MUX_VAL(CP(CAM_D10), (IEN | PTD | DIS | M0)) /*CAM_D10*/\ + MUX_VAL(CP(CAM_D11), (IEN | PTD | DIS | M0)) /*CAM_D11*/\ + MUX_VAL(CP(CAM_XCLKB), (IDIS | PTD | DIS | M0)) /*CAM_XCLKB*/\ + MUX_VAL(CP(CAM_WEN), (IEN | PTD | DIS | M4)) /*GPIO_167*/\ + MUX_VAL(CP(CAM_STROBE), (IDIS | PTD | DIS | M0)) /*CAM_STROBE*/\ + MUX_VAL(CP(CSI2_DX0), (IEN | PTD | DIS | M0)) /*CSI2_DX0*/\ + MUX_VAL(CP(CSI2_DY0), (IEN | PTD | DIS | M0)) /*CSI2_DY0*/\ + MUX_VAL(CP(CSI2_DX1), (IEN | PTD | DIS | M0)) /*CSI2_DX1*/\ + MUX_VAL(CP(CSI2_DY1), (IEN | PTD | DIS | M0)) /*CSI2_DY1*/\ + /*Audio Interface */\ + MUX_VAL(CP(MCBSP2_FSX), (IEN | PTD | DIS | M0)) /*McBSP2_FSX*/\ + MUX_VAL(CP(MCBSP2_CLKX), (IEN | PTD | DIS | M0)) /*McBSP2_CLK*/\ + MUX_VAL(CP(MCBSP2_DR), (IEN | PTD | DIS | M0)) /*McBSP2_DR*/\ + MUX_VAL(CP(MCBSP2_DX), (IDIS | PTD | DIS | M0)) /*McBSP2_DX*/\ + /*Expansion card */\ + MUX_VAL(CP(MMC1_CLK), (IDIS | PTU | EN | M0)) /*MMC1_CLK*/\ + MUX_VAL(CP(MMC1_CMD), (IEN | PTU | EN | M0)) /*MMC1_CMD*/\ + MUX_VAL(CP(MMC1_DAT0), (IEN | PTU | EN | M0)) /*MMC1_DAT0*/\ + MUX_VAL(CP(MMC1_DAT1), (IEN | PTU | EN | M0)) /*MMC1_DAT1*/\ + MUX_VAL(CP(MMC1_DAT2), (IEN | PTU | EN | M0)) /*MMC1_DAT2*/\ + MUX_VAL(CP(MMC1_DAT3), (IEN | PTU | EN | M0)) /*MMC1_DAT3*/\ + MUX_VAL(CP(MMC1_DAT4), (IEN | PTU | EN | M0)) /*MMC1_DAT4*/\ + MUX_VAL(CP(MMC1_DAT5), (IEN | PTU | EN | M0)) /*MMC1_DAT5*/\ + MUX_VAL(CP(MMC1_DAT6), (IEN | PTU | EN | M0)) /*MMC1_DAT6*/\ + MUX_VAL(CP(MMC1_DAT7), (IEN | PTU | EN | M0)) /*MMC1_DAT7*/\ + /*Wireless LAN */\ + MUX_VAL(CP(MMC2_CLK), (IEN | PTU | EN | M4)) /*GPIO_130*/\ + MUX_VAL(CP(MMC2_CMD), (IEN | PTU | EN | M4)) /*GPIO_131*/\ + MUX_VAL(CP(MMC2_DAT0), (IEN | PTU | EN | M4)) /*GPIO_132*/\ + MUX_VAL(CP(MMC2_DAT1), (IEN | PTU | EN | M4)) /*GPIO_133*/\ + MUX_VAL(CP(MMC2_DAT2), (IEN | PTU | EN | M4)) /*GPIO_134*/\ + MUX_VAL(CP(MMC2_DAT3), (IEN | PTU | EN | M4)) /*GPIO_135*/\ + MUX_VAL(CP(MMC2_DAT4), (IEN | PTU | EN | M4)) /*GPIO_136*/\ + MUX_VAL(CP(MMC2_DAT5), (IEN | PTU | EN | M4)) /*GPIO_137*/\ + MUX_VAL(CP(MMC2_DAT6), (IEN | PTU | EN | M4)) /*GPIO_138*/\ + MUX_VAL(CP(MMC2_DAT7), (IEN | PTU | EN | M4)) /*GPIO_139*/\ + /*Bluetooth*/\ + MUX_VAL(CP(MCBSP3_DX), (IEN | PTD | DIS | M1)) /*UART2_CTS*/\ + MUX_VAL(CP(MCBSP3_DR), (IDIS | PTD | DIS | M1)) /*UART2_RTS*/\ + MUX_VAL(CP(MCBSP3_CLKX), (IDIS | PTD | DIS | M1)) /*UART2_TX*/\ + MUX_VAL(CP(MCBSP3_FSX), (IEN | PTD | DIS | M1)) /*UART2_RX*/\ + MUX_VAL(CP(UART2_CTS), (IEN | PTD | DIS | M4)) /*GPIO_144*/\ + MUX_VAL(CP(UART2_RTS), (IEN | PTD | DIS | M4)) /*GPIO_145*/\ + MUX_VAL(CP(UART2_TX), (IEN | PTD | DIS | M4)) /*GPIO_146*/\ + MUX_VAL(CP(UART2_RX), (IEN | PTD | DIS | M4)) /*GPIO_147*/\ + /*Modem Interface */\ + MUX_VAL(CP(UART1_TX), (IDIS | PTD | DIS | M0)) /*UART1_TX*/\ + MUX_VAL(CP(UART1_RTS), (IDIS | PTD | DIS | M4)) /*GPIO_149*/ \ + MUX_VAL(CP(UART1_CTS), (IDIS | PTD | DIS | M4)) /*GPIO_150*/ \ + MUX_VAL(CP(UART1_RX), (IEN | PTD | DIS | M0)) /*UART1_RX*/\ + MUX_VAL(CP(MCBSP4_CLKX), (IEN | PTD | DIS | M1)) /*SSI1_DAT*/\ + MUX_VAL(CP(MCBSP4_DR), (IEN | PTD | DIS | M1)) /*SSI1_FLAG*/\ + MUX_VAL(CP(MCBSP4_DX), (IEN | PTD | DIS | M1)) /*SSI1_RDY*/\ + MUX_VAL(CP(MCBSP4_FSX), (IEN | PTD | DIS | M1)) /*SSI1_WAKE*/\ + MUX_VAL(CP(MCBSP1_CLKR), (IDIS | PTD | DIS | M4)) /*GPIO_156*/\ + MUX_VAL(CP(MCBSP1_FSR), (IDIS | PTU | EN | M4)) /*GPIO_157*/\ + MUX_VAL(CP(MCBSP1_DX), (IDIS | PTD | DIS | M4)) /*GPIO_158*/\ + MUX_VAL(CP(MCBSP1_DR), (IDIS | PTD | DIS | M4)) /*GPIO_159*/\ + MUX_VAL(CP(MCBSP_CLKS), (IEN | PTU | DIS | M0)) /*McBSP_CLKS*/\ + MUX_VAL(CP(MCBSP1_FSX), (IDIS | PTD | DIS | M4)) /*GPIO_161*/\ + MUX_VAL(CP(MCBSP1_CLKX), (IDIS | PTD | DIS | M4)) /*GPIO_162*/\ + /*Serial Interface*/\ + MUX_VAL(CP(UART3_CTS_RCTX), (IEN | PTD | EN | M0)) /*UART3_CTS*/\ + MUX_VAL(CP(UART3_RTS_SD), (IDIS | PTD | DIS | M0)) /*UART3_RTS*/\ + MUX_VAL(CP(UART3_RX_IRRX), (IEN | PTD | DIS | M0)) /*UART3_RX*/\ + MUX_VAL(CP(UART3_TX_IRTX), (IDIS | PTD | DIS | M0)) /*UART3_TX*/\ + MUX_VAL(CP(HSUSB0_CLK), (IEN | PTD | DIS | M0)) /*HSUSB0_CLK*/\ + MUX_VAL(CP(HSUSB0_STP), (IDIS | PTU | EN | M0)) /*HSUSB0_STP*/\ + MUX_VAL(CP(HSUSB0_DIR), (IEN | PTD | DIS | M0)) /*HSUSB0_DIR*/\ + MUX_VAL(CP(HSUSB0_NXT), (IEN | PTD | DIS | M0)) /*HSUSB0_NXT*/\ + MUX_VAL(CP(HSUSB0_DATA0), (IEN | PTD | DIS | M0)) /*HSUSB0_DA0*/\ + MUX_VAL(CP(HSUSB0_DATA1), (IEN | PTD | DIS | M0)) /*HSUSB0_DA1*/\ + MUX_VAL(CP(HSUSB0_DATA2), (IEN | PTD | DIS | M0)) /*HSUSB0_DA2*/\ + MUX_VAL(CP(HSUSB0_DATA3), (IEN | PTD | DIS | M0)) /*HSUSB0_DA3*/\ + MUX_VAL(CP(HSUSB0_DATA4), (IEN | PTD | DIS | M0)) /*HSUSB0_DA4*/\ + MUX_VAL(CP(HSUSB0_DATA5), (IEN | PTD | DIS | M0)) /*HSUSB0_DA5*/\ + MUX_VAL(CP(HSUSB0_DATA6), (IEN | PTD | DIS | M0)) /*HSUSB0_DA6*/\ + MUX_VAL(CP(HSUSB0_DATA7), (IEN | PTD | DIS | M0)) /*HSUSB0_DA7*/\ + MUX_VAL(CP(I2C1_SCL), (IEN | PTU | EN | M0)) /*I2C1_SCL*/\ + MUX_VAL(CP(I2C1_SDA), (IEN | PTU | EN | M0)) /*I2C1_SDA*/\ + MUX_VAL(CP(I2C2_SCL), (IEN | PTU | EN | M4)) /*GPIO_168*/\ + MUX_VAL(CP(I2C2_SDA), (IEN | PTU | EN | M4)) /*GPIO_183*/\ + MUX_VAL(CP(I2C3_SCL), (IEN | PTU | EN | M0)) /*I2C3_SCL*/\ + MUX_VAL(CP(I2C3_SDA), (IEN | PTU | EN | M0)) /*I2C3_SDA*/\ + MUX_VAL(CP(I2C4_SCL), (IEN | PTU | EN | M0)) /*I2C4_SCL*/\ + MUX_VAL(CP(I2C4_SDA), (IEN | PTU | EN | M0)) /*I2C4_SDA*/\ + MUX_VAL(CP(HDQ_SIO), (IDIS | PTU | EN | M4)) /*GPIO_170*/\ + MUX_VAL(CP(MCSPI1_CLK), (IEN | PTU | EN | M4)) /*GPIO_171*/\ + MUX_VAL(CP(MCSPI1_SIMO), (IEN | PTU | EN | M4)) /*GPIO_172*/\ + MUX_VAL(CP(MCSPI1_SOMI), (IEN | PTD | DIS | M0)) /*McSPI1_SOM*/\ + MUX_VAL(CP(MCSPI1_CS0), (IEN | PTD | EN | M0)) /*McSPI1_CS0*/\ + MUX_VAL(CP(MCSPI1_CS1), (IDIS | PTD | EN | M0)) /*McSPI1_CS1*/\ + MUX_VAL(CP(MCSPI1_CS2), (IDIS | PTD | DIS | M4)) /*GPIO_176*/\ + /* USB EHCI (port 2) */\ + MUX_VAL(CP(MCSPI1_CS3), (IEN | PTU | DIS | M3)) /*HSUSB2_DA2*/\ + MUX_VAL(CP(MCSPI2_CLK), (IEN | PTU | DIS | M3)) /*HSUSB2_DA7*/\ + MUX_VAL(CP(MCSPI2_SIMO), (IEN | PTU | DIS | M3)) /*HSUSB2_DA4*/\ + MUX_VAL(CP(MCSPI2_SOMI), (IEN | PTU | DIS | M3)) /*HSUSB2_DA5*/\ + MUX_VAL(CP(MCSPI2_CS0), (IEN | PTU | DIS | M3)) /*HSUSB2_DA6*/\ + MUX_VAL(CP(MCSPI2_CS1), (IEN | PTU | DIS | M3)) /*HSUSB2_DA3*/\ + MUX_VAL(CP(ETK_D10_ES2), (IDIS | PTU | DIS | M3)) /*HSUSB2_CLK*/\ + MUX_VAL(CP(ETK_D11_ES2), (IDIS | PTU | DIS | M3)) /*HSUSB2_STP*/\ + MUX_VAL(CP(ETK_D12_ES2), (IEN | PTU | DIS | M3)) /*HSUSB2_DIR*/\ + MUX_VAL(CP(ETK_D13_ES2), (IEN | PTU | DIS | M3)) /*HSUSB2_NXT*/\ + MUX_VAL(CP(ETK_D14_ES2), (IEN | PTU | DIS | M3)) /*HSUSB2_DA0*/\ + MUX_VAL(CP(ETK_D15_ES2), (IEN | PTU | DIS | M3)) /*HSUSB2_DA1*/\ + /*Control and debug */\ + MUX_VAL(CP(SYS_32K), (IEN | PTD | DIS | M0)) /*SYS_32K*/\ + MUX_VAL(CP(SYS_CLKREQ), (IEN | PTD | DIS | M0)) /*SYS_CLKREQ*/\ + MUX_VAL(CP(SYS_NIRQ), (IEN | PTU | EN | M0)) /*SYS_nIRQ*/\ + MUX_VAL(CP(SYS_BOOT0), (IEN | PTD | DIS | M4)) /*GPIO_2*/\ + MUX_VAL(CP(SYS_BOOT1), (IEN | PTD | DIS | M4)) /*GPIO_3*/\ + MUX_VAL(CP(SYS_BOOT2), (IEN | PTD | DIS | M4)) /*MMC1_WP*/\ + MUX_VAL(CP(SYS_BOOT3), (IEN | PTD | DIS | M4)) /*GPIO_5*/\ + MUX_VAL(CP(SYS_BOOT4), (IEN | PTD | DIS | M4)) /*GPIO_6*/\ + MUX_VAL(CP(SYS_BOOT5), (IEN | PTD | DIS | M4)) /*GPIO_7*/\ + MUX_VAL(CP(SYS_BOOT6), (IDIS | PTD | DIS | M4)) /*GPIO_8*/ \ + MUX_VAL(CP(SYS_OFF_MODE), (IEN | PTD | DIS | M0)) /*SYS_OFF_MD*/\ + MUX_VAL(CP(SYS_CLKOUT1), (IEN | PTD | DIS | M0)) /*SYS_CLKOUT*/\ + MUX_VAL(CP(SYS_CLKOUT2), (IEN | PTU | EN | M4)) /*GPIO_186*/\ + MUX_VAL(CP(ETK_CLK_ES2), (IDIS | PTU | EN | M3)) /*HSUSB1_STP*/\ + MUX_VAL(CP(ETK_CTL_ES2), (IDIS | PTU | DIS | M3)) /*HSUSB1_CLK*/\ + MUX_VAL(CP(ETK_D0_ES2), (IEN | PTU | DIS | M3)) /*HSUSB1_DA0*/\ + MUX_VAL(CP(ETK_D1_ES2), (IEN | PTU | DIS | M3)) /*HSUSB1_DA1*/\ + MUX_VAL(CP(ETK_D2_ES2), (IEN | PTU | DIS | M3)) /*HSUSB1_DA2*/\ + MUX_VAL(CP(ETK_D3_ES2), (IEN | PTU | DIS | M3)) /*HSUSB1_DA7*/\ + MUX_VAL(CP(ETK_D4_ES2), (IEN | PTU | DIS | M3)) /*HSUSB1_DA4*/\ + MUX_VAL(CP(ETK_D5_ES2), (IEN | PTU | DIS | M3)) /*HSUSB1_DA5*/\ + MUX_VAL(CP(ETK_D6_ES2), (IEN | PTU | DIS | M3)) /*HSUSB1_DA6*/\ + MUX_VAL(CP(ETK_D7_ES2), (IEN | PTU | DIS | M3)) /*HSUSB1_DA3*/\ + MUX_VAL(CP(ETK_D8_ES2), (IEN | PTU | DIS | M3)) /*HSUSB1_DIR*/\ + MUX_VAL(CP(ETK_D9_ES2), (IEN | PTU | DIS | M3)) /*HSUSB1_NXT*/\ + MUX_VAL(CP(D2D_MCAD1), (IEN | PTD | EN | M0)) /*d2d_mcad1*/\ + MUX_VAL(CP(D2D_MCAD2), (IEN | PTD | EN | M0)) /*d2d_mcad2*/\ + MUX_VAL(CP(D2D_MCAD3), (IEN | PTD | EN | M0)) /*d2d_mcad3*/\ + MUX_VAL(CP(D2D_MCAD4), (IEN | PTD | EN | M0)) /*d2d_mcad4*/\ + MUX_VAL(CP(D2D_MCAD5), (IEN | PTD | EN | M0)) /*d2d_mcad5*/\ + MUX_VAL(CP(D2D_MCAD6), (IEN | PTD | EN | M0)) /*d2d_mcad6*/\ + MUX_VAL(CP(D2D_MCAD7), (IEN | PTD | EN | M0)) /*d2d_mcad7*/\ + MUX_VAL(CP(D2D_MCAD8), (IEN | PTD | EN | M0)) /*d2d_mcad8*/\ + MUX_VAL(CP(D2D_MCAD9), (IEN | PTD | EN | M0)) /*d2d_mcad9*/\ + MUX_VAL(CP(D2D_MCAD10), (IEN | PTD | EN | M0)) /*d2d_mcad10*/\ + MUX_VAL(CP(D2D_MCAD11), (IEN | PTD | EN | M0)) /*d2d_mcad11*/\ + MUX_VAL(CP(D2D_MCAD12), (IEN | PTD | EN | M0)) /*d2d_mcad12*/\ + MUX_VAL(CP(D2D_MCAD13), (IEN | PTD | EN | M0)) /*d2d_mcad13*/\ + MUX_VAL(CP(D2D_MCAD14), (IEN | PTD | EN | M0)) /*d2d_mcad14*/\ + MUX_VAL(CP(D2D_MCAD15), (IEN | PTD | EN | M0)) /*d2d_mcad15*/\ + MUX_VAL(CP(D2D_MCAD16), (IEN | PTD | EN | M0)) /*d2d_mcad16*/\ + MUX_VAL(CP(D2D_MCAD17), (IEN | PTD | EN | M0)) /*d2d_mcad17*/\ + MUX_VAL(CP(D2D_MCAD18), (IEN | PTD | EN | M0)) /*d2d_mcad18*/\ + MUX_VAL(CP(D2D_MCAD19), (IEN | PTD | EN | M0)) /*d2d_mcad19*/\ + MUX_VAL(CP(D2D_MCAD20), (IEN | PTD | EN | M0)) /*d2d_mcad20*/\ + MUX_VAL(CP(D2D_MCAD21), (IEN | PTD | EN | M0)) /*d2d_mcad21*/\ + MUX_VAL(CP(D2D_MCAD22), (IEN | PTD | EN | M0)) /*d2d_mcad22*/\ + MUX_VAL(CP(D2D_MCAD23), (IEN | PTD | EN | M0)) /*d2d_mcad23*/\ + MUX_VAL(CP(D2D_MCAD24), (IEN | PTD | EN | M0)) /*d2d_mcad24*/\ + MUX_VAL(CP(D2D_MCAD25), (IEN | PTD | EN | M0)) /*d2d_mcad25*/\ + MUX_VAL(CP(D2D_MCAD26), (IEN | PTD | EN | M0)) /*d2d_mcad26*/\ + MUX_VAL(CP(D2D_MCAD27), (IEN | PTD | EN | M0)) /*d2d_mcad27*/\ + MUX_VAL(CP(D2D_MCAD28), (IEN | PTD | EN | M0)) /*d2d_mcad28*/\ + MUX_VAL(CP(D2D_MCAD29), (IEN | PTD | EN | M0)) /*d2d_mcad29*/\ + MUX_VAL(CP(D2D_MCAD30), (IEN | PTD | EN | M0)) /*d2d_mcad30*/\ + MUX_VAL(CP(D2D_MCAD31), (IEN | PTD | EN | M0)) /*d2d_mcad31*/\ + MUX_VAL(CP(D2D_MCAD32), (IEN | PTD | EN | M0)) /*d2d_mcad32*/\ + MUX_VAL(CP(D2D_MCAD33), (IEN | PTD | EN | M0)) /*d2d_mcad33*/\ + MUX_VAL(CP(D2D_MCAD34), (IEN | PTD | EN | M0)) /*d2d_mcad34*/\ + MUX_VAL(CP(D2D_MCAD35), (IEN | PTD | EN | M0)) /*d2d_mcad35*/\ + MUX_VAL(CP(D2D_MCAD36), (IEN | PTD | EN | M0)) /*d2d_mcad36*/\ + MUX_VAL(CP(D2D_CLK26MI), (IEN | PTD | DIS | M0)) /*d2d_clk26m*/\ + MUX_VAL(CP(D2D_NRESPWRON), (IEN | PTD | EN | M0)) /*d2d_nrespw*/\ + MUX_VAL(CP(D2D_NRESWARM), (IEN | PTU | EN | M0)) /*d2d_nreswa*/\ + MUX_VAL(CP(D2D_ARM9NIRQ), (IEN | PTD | DIS | M0)) /*d2d_arm9ni*/\ + MUX_VAL(CP(D2D_UMA2P6FIQ), (IEN | PTD | DIS | M0)) /*d2d_uma2p6*/\ + MUX_VAL(CP(D2D_SPINT), (IEN | PTD | EN | M0)) /*d2d_spint*/\ + MUX_VAL(CP(D2D_FRINT), (IEN | PTD | EN | M0)) /*d2d_frint*/\ + MUX_VAL(CP(D2D_DMAREQ0), (IEN | PTD | DIS | M0)) /*d2d_dmare0*/\ + MUX_VAL(CP(D2D_DMAREQ1), (IEN | PTD | DIS | M0)) /*d2d_dmare1*/\ + MUX_VAL(CP(D2D_DMAREQ2), (IEN | PTD | DIS | M0)) /*d2d_dmare2*/\ + MUX_VAL(CP(D2D_DMAREQ3), (IEN | PTD | DIS | M0)) /*d2d_dmare3*/\ + MUX_VAL(CP(D2D_N3GTRST), (IEN | PTD | DIS | M0)) /*d2d_n3gtrs*/\ + MUX_VAL(CP(D2D_N3GTDI), (IEN | PTD | DIS | M0)) /*d2d_n3gtdi*/\ + MUX_VAL(CP(D2D_N3GTDO), (IEN | PTD | DIS | M0)) /*d2d_n3gtdo*/\ + MUX_VAL(CP(D2D_N3GTMS), (IEN | PTD | DIS | M0)) /*d2d_n3gtms*/\ + MUX_VAL(CP(D2D_N3GTCK), (IEN | PTD | DIS | M0)) /*d2d_n3gtck*/\ + MUX_VAL(CP(D2D_N3GRTCK), (IEN | PTD | DIS | M0)) /*d2d_n3grtc*/\ + MUX_VAL(CP(D2D_MSTDBY), (IEN | PTU | EN | M0)) /*d2d_mstdby*/\ + MUX_VAL(CP(D2D_SWAKEUP), (IEN | PTD | EN | M0)) /*d2d_swakeu*/\ + MUX_VAL(CP(D2D_IDLEREQ), (IEN | PTD | DIS | M0)) /*d2d_idlere*/\ + MUX_VAL(CP(D2D_IDLEACK), (IEN | PTU | EN | M0)) /*d2d_idleac*/\ + MUX_VAL(CP(D2D_MWRITE), (IEN | PTD | DIS | M0)) /*d2d_mwrite*/\ + MUX_VAL(CP(D2D_SWRITE), (IEN | PTD | DIS | M0)) /*d2d_swrite*/\ + MUX_VAL(CP(D2D_MREAD), (IEN | PTD | DIS | M0)) /*d2d_mread*/\ + MUX_VAL(CP(D2D_SREAD), (IEN | PTD | DIS | M0)) /*d2d_sread*/\ + MUX_VAL(CP(D2D_MBUSFLAG), (IEN | PTD | DIS | M0)) /*d2d_mbusfl*/\ + MUX_VAL(CP(D2D_SBUSFLAG), (IEN | PTD | DIS | M0)) /*d2d_sbusfl*/\ + MUX_VAL(CP(SDRC_CKE0), (IDIS | PTU | EN | M0)) /*sdrc_cke0*/\ + MUX_VAL(CP(SDRC_CKE1), (IDIS | PTU | EN | M0)) /*sdrc_cke1*/ + +#define MUX_RX51_C() \ + MUX_VAL(CP(MCBSP3_DX), (IEN | PTD | DIS | M4)) /*GPIO_140*/\ + MUX_VAL(CP(MCBSP3_DR), (IEN | PTD | DIS | M4)) /*GPIO_142*/\ + MUX_VAL(CP(MCBSP3_CLKX), (IEN | PTD | DIS | M4)) /*GPIO_141*/\ + MUX_VAL(CP(UART2_CTS), (IEN | PTU | EN | M0)) /*UART2_CTS*/\ + MUX_VAL(CP(UART2_RTS), (IDIS | PTD | DIS | M0)) /*UART2_RTS*/\ + MUX_VAL(CP(UART2_TX), (IDIS | PTD | DIS | M0)) /*UART2_TX*/ + +#endif diff --git a/boards.cfg b/boards.cfg index 2f90dbf..3a3b9fe 100644 --- a/boards.cfg +++ b/boards.cfg @@ -214,6 +214,7 @@ omap3_evm_quick_nand arm armv7 evm ti omap3_sdp3430 arm armv7 sdp3430 ti omap3 devkit8000 arm armv7 devkit8000 timll omap3 twister arm armv7 twister technexion omap3 +nokia_rx51 arm armv7 rx51 nokia omap3 omap4_panda arm armv7 panda ti omap4 omap4_sdp4430 arm armv7 sdp4430 ti omap4 omap5_evm arm armv7 omap5_evm ti omap5 diff --git a/include/configs/nokia_rx51.h b/include/configs/nokia_rx51.h new file mode 100644 index 0000000..9045535 --- /dev/null +++ b/include/configs/nokia_rx51.h @@ -0,0 +1,362 @@ +/* + * (C) Copyright 2011-2012 + * Pali Rohár pali.rohar@gmail.com + * + * (C) Copyright 2010 + * Alistair Buxton a.j.buxton@gmail.com + * + * Derived from Beagle Board code: + * (C) Copyright 2006-2008 + * Texas Instruments. + * Richard Woodruff r-woodruff2@ti.com + * Syed Mohammed Khasim x0khasim@ti.com + * + * Configuration settings for the Nokia RX-51 aka N900. + * + * 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 as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#ifndef __CONFIG_H +#define __CONFIG_H + +/* + * High Level Configuration Options + */ + +#define CONFIG_OMAP /* in a TI OMAP core */ +#define CONFIG_OMAP34XX /* which is a 34XX */ +#define CONFIG_OMAP3430 /* which is in a 3430 */ +#define CONFIG_OMAP3_RX51 /* working with RX51 */ +#define CONFIG_SYS_L2CACHE_OFF /* pretend there is no L2 CACHE */ + +/* It doesn't really matter what we set this to. NOLO will load u-boot.bin + * in a random place anyway, and we have to copy. + */ +#define CONFIG_SYS_TEXT_BASE 0x80008000 + +#define CONFIG_SDRC /* The chip has SDRC controller */ + +#include <asm/arch/cpu.h> /* get chip and board defs */ +#include <asm/arch/omap3.h> +#include <asm/arch/mem.h> + +/* + * Display CPU and Board information + */ +#define CONFIG_DISPLAY_CPUINFO +#define CONFIG_DISPLAY_BOARDINFO + +/* Clock Defines */ +#define V_OSCK 26000000 /* Clock output from T2 */ +#define V_SCLK (V_OSCK >> 1) + +#undef CONFIG_USE_IRQ /* no support for IRQs */ +#define CONFIG_MISC_INIT_R +#define CONFIG_SKIP_LOWLEVEL_INIT /* NOLO set everything up */ + +#define CONFIG_CMDLINE_TAG /* enable passing kernel command line string */ +#define CONFIG_INITRD_TAG /* enable passing initrd */ + +/* + * Size of malloc() pool + */ +#define CONFIG_ENV_SIZE (128 << 10) /* 128 KiB Sector */ +#define CONFIG_UBI_SIZE (512 << 10) /* 512 KiB Sector */ +#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + CONFIG_UBI_SIZE + \ + (128 << 10)) + +/* + * Hardware drivers + */ + +/* + * NS16550 Configuration + */ +#define V_NS16550_CLK 48000000 /* 48MHz (APLL96/2) */ + +#define CONFIG_SYS_NS16550 +#define CONFIG_SYS_NS16550_SERIAL +#define CONFIG_SYS_NS16550_REG_SIZE (-4) +#define CONFIG_SYS_NS16550_CLK V_NS16550_CLK + +/* + * select serial console configuration + */ +#define CONFIG_CONS_INDEX 3 +#define CONFIG_SYS_NS16550_COM3 OMAP34XX_UART3 +#define CONFIG_SERIAL3 3 /* UART3 on RX-51 */ + +/* allow to overwrite serial and ethaddr */ +#define CONFIG_ENV_OVERWRITE +#define CONFIG_BAUDRATE 115200 +#define CONFIG_SYS_BAUDRATE_TABLE {4800, 9600, 19200, 38400, 57600, 115200} +#define CONFIG_MMC +#define CONFIG_GENERIC_MMC +#define CONFIG_OMAP_HSMMC +#define CONFIG_DOS_PARTITION + +/* USB - broken */ +#define CONFIG_MUSB_UDC +#define CONFIG_USB_OMAP3 +#define CONFIG_TWL4030_USB + +/* USB device configuration - broken */ +#define CONFIG_USB_DEVICE +/* FIXME: usbtty breaks maemo pr1.2 kernel booting +#define CONFIG_USB_TTY +*/ +#define CONFIG_SYS_CONSOLE_IS_IN_ENV +#define CONFIG_SYS_NO_FLASH + +/* OneNand support is disabled, because U-Boot image is too big */ +/* Uncomment next line to enable it */ +/* #define ONENAND_SUPPORT */ + +/* commands to include */ +#include <config_cmd_default.h> + +#define CONFIG_CMD_EXT2 /* EXT2 Support */ +#define CONFIG_CMD_FAT /* FAT support */ + +#define CONFIG_CMD_I2C /* I2C serial bus support */ +#define CONFIG_CMD_MMC /* MMC support */ + +#define CONFIG_CMD_CLEAR /* ANSI terminal clear screen command */ + +#ifdef ONENAND_SUPPORT +#define CONFIG_CMD_ONENAND /* NAND support */ +#define CONFIG_CMD_MTDPARTS /* mtd parts support */ +#define CONFIG_CMD_UBI /* UBI Support */ +#define CONFIG_CMD_UBIFS /* UBIFS Support */ +#endif + +#undef CONFIG_CMD_FPGA /* FPGA configuration Support */ +#undef CONFIG_CMD_IMI /* iminfo */ +#undef CONFIG_CMD_NET /* bootp, tftpboot, rarpboot */ +#undef CONFIG_CMD_NFS /* NFS support */ + +#define CONFIG_OMAP3_SPI +#define CONFIG_HARD_I2C +#define CONFIG_SYS_I2C_SPEED 100000 +#define CONFIG_SYS_I2C_SLAVE 1 +#define CONFIG_SYS_I2C_BUS 0 +#define CONFIG_SYS_I2C_BUS_SELECT 1 +#define CONFIG_DRIVER_OMAP34XX_I2C 1 + +/* + * TWL4030 + */ +#define CONFIG_TWL4030_POWER +#define CONFIG_TWL4030_LED +#define CONFIG_TWL4030_KEYPAD + +/* + * Board NAND Info. + */ +#ifdef ONENAND_SUPPORT +#define PISMO1_NAND_SIZE GPMC_SIZE_128M +#define PISMO1_ONEN_SIZE GPMC_SIZE_128M +#define CONFIG_SYS_ONENAND_BASE ONENAND_MAP +#define CONFIG_MTD_DEVICE +#define CONFIG_MTD_PARTITIONS +#define CONFIG_RBTREE +#define CONFIG_LZO +#define MTDIDS_DEFAULT "onenand0=onenand" +#define MTDPARTS_DEFAULT "mtdparts=onenand:128k(bootloader)," \ + "384k(config),256k(log),2m(kernel)," \ + "2m(initfs),-(rootfs)" +#else +#define MTDPARTS_DEFAULT +#endif + +/* Watchdog support */ +#define CONFIG_HW_WATCHDOG + +/* + * Framebuffer + */ +/* Video console */ +#define CONFIG_VIDEO +#define CONFIG_CFB_CONSOLE +#define CONFIG_CFB_CONSOLE_ANSI /* Enable ANSI escape codes in framebuffer */ +#define CONFIG_VIDEO_LOGO +#define VIDEO_FB_16BPP_PIXEL_SWAP +#define VIDEO_FB_16BPP_WORD_SWAP +#define CONFIG_VIDEO_SW_CURSOR +#define CONFIG_SPLASH_SCREEN + +/* functions for cfb_console */ +#define VIDEO_KBD_INIT_FCT rx51_kp_init() +#define VIDEO_TSTC_FCT rx51_kp_tstc +#define VIDEO_GETC_FCT rx51_kp_getc +#ifndef __ASSEMBLY__ +int rx51_kp_init(void); +int rx51_kp_tstc(void); +int rx51_kp_getc(void); +#endif + +/* Environment information */ +#define CONFIG_BOOTDELAY 3 + +#define CONFIG_EXTRA_ENV_SETTINGS \ + "mtdparts=" MTDPARTS_DEFAULT "\0" \ + "usbtty=cdc_acm\0" \ + "stdin=vga\0" \ + "stdout=vga\0" \ + "stderr=vga\0" \ + "setcon=setenv stdin ${con};" \ + "setenv stdout ${con};" \ + "setenv stderr ${con}\0" \ + "sercon=setenv con serial; run setcon\0" \ + "usbcon=setenv con usbtty; run setcon\0" \ + "vgacon=setenv con vga; run setcon\0" \ + "switchmmc=mmc dev ${mmcnum}\0" \ + "kernaddr=0x82008000\0" \ + "initrdaddr=0x84008000\0" \ + "scriptaddr=0x86008000\0" \ + "fileload=${mmctype}load mmc ${mmcnum}:${mmcpart} " \ + "${loadaddr} ${mmcfile}\0" \ + "kernload=setenv loadaddr ${kernaddr};" \ + "setenv mmcfile ${mmckernfile};" \ + "run fileload\0" \ + "initrdload=setenv loadaddr ${initrdaddr};" \ + "setenv mmcfile ${mmcinitrdfile};" \ + "run fileload\0" \ + "scriptload=setenv loadaddr ${scriptaddr};" \ + "setenv mmcfile ${mmcscriptfile};" \ + "run fileload\0" \ + "scriptboot=echo Running ${mmcscriptfile} from mmc " \ + "${mmcnum}:${mmcpart} ...; source ${scriptaddr}\0" \ + "kernboot=echo Booting ${mmckernfile} from mmc " \ + "${mmcnum}:${mmcpart} ...; bootm ${kernaddr}\0" \ + "kerninitrdboot=echo Booting ${mmckernfile} ${mmcinitrdfile} from mmc "\ + "${mmcnum}:${mmcpart} ...; bootm ${kernaddr} ${initrdaddr}\0" \ + "noloboot=echo Booting NOLO supplied kernel ...;" \ + "setenv atagaddr ${init_atagaddr};" \ + "bootm ${init_kernaddr}\0" \ + "trymmcscriptboot=if run switchmmc; then " \ + "if run scriptload; then " \ + "run scriptboot;" \ + "fi;" \ + "fi\0" \ + "trymmckernboot=if run switchmmc; then " \ + "if run kernload; then " \ + "run kernboot;" \ + "fi;" \ + "fi\0" \ + "trymmckerninitrdboot=if run switchmmc; then " \ + "if run initrdload; then " \ + "if run kernload; then " \ + "run kerninitrdboot;" \ + "fi;" \ + "fi; " \ + "fi\0" \ + "trymmcpartboot=setenv mmcscriptfile boot.scr; run trymmcscriptboot;" \ + "setenv mmckernfile uImage; run trymmckernboot\0" \ + "trymmcallpartboot=setenv mmcpart 1; run trymmcpartboot;" \ + "setenv mmcpart 2; run trymmcpartboot;" \ + "setenv mmcpart 3; run trymmcpartboot;" \ + "setenv mmcpart 4; run trymmcpartboot\0" \ + "trymmcboot=if run switchmmc; then " \ + "setenv mmctype fat;" \ + "run trymmcallpartboot;" \ + "setenv mmctype ext2;" \ + "run trymmcallpartboot;" \ + "fi\0" \ + "emmcboot=setenv mmcnum 1; run trymmcboot\0" \ + "sdboot=setenv mmcnum 0; run trymmcboot\0" + +#define CONFIG_PREBOOT \ + "if test $slide_sw != open; then run noloboot; fi;" + +#define CONFIG_PREMONITOR \ + "echo Extra commands:;" \ + "echo run sercon - Use serial port for control.;" \ + "echo run usbcon - Use usbtty for control.;" \ + "echo run vgacon - Use framebuffer/keyboard.;" \ + "echo run sdboot - Boot from SD card slot.;" \ + "echo run emmcboot - Boot internal eMMC memory.;" \ + "echo run noloboot - Boot kernel loaded by NOLO.;" \ + "echo" + +#define CONFIG_BOOTCOMMAND \ + "run sdboot;" \ + "run emmcboot;" \ + "run noloboot;" \ + "echo" + +#define CONFIG_AUTO_COMPLETE + +/* + * Miscellaneous configurable options + */ +#define CONFIG_SYS_LONGHELP /* undef to save memory */ +#define CONFIG_SYS_HUSH_PARSER /* use "hush" command parser */ +#define CONFIG_SYS_PROMPT_HUSH_PS2 "> " +#define CONFIG_SYS_PROMPT "Nokia RX-51 # " +#define CONFIG_SYS_CBSIZE 256 /* Console I/O Buffer Size */ +/* Print Buffer Size */ +#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \ + sizeof(CONFIG_SYS_PROMPT) + 16) +#define CONFIG_SYS_MAXARGS 16 /* max number of command args */ +/* Boot Argument Buffer Size */ +#define CONFIG_SYS_BARGSIZE (CONFIG_SYS_CBSIZE) + +#define CONFIG_SYS_MEMTEST_START (OMAP34XX_SDRC_CS0) +#define CONFIG_SYS_MEMTEST_END (OMAP34XX_SDRC_CS0 + 0x01F00000)/*31MB*/ + +/* default load address */ +#define CONFIG_SYS_LOAD_ADDR (OMAP34XX_SDRC_CS0) + +/* + * OMAP3 has 12 GP timers, they can be driven by the system clock + * (12/13/16.8/19.2/38.4MHz) or by 32KHz clock. We use 13MHz (V_SCLK). + * This rate is divided by a local divisor. + */ +#define CONFIG_SYS_TIMERBASE (OMAP34XX_GPT2) +#define CONFIG_SYS_PTV 2 /* Divisor: 2^(PTV+1) => 8 */ +#define CONFIG_SYS_HZ 1000 + +/*----------------------------------------------------------------------- + * Stack sizes + * + * The stack sizes are set up in start.S using the settings below + */ +#define CONFIG_STACKSIZE (128 << 10) /* regular stack 128 KiB */ + +/*----------------------------------------------------------------------- + * Physical Memory Map + */ +#define CONFIG_NR_DRAM_BANKS 2 /* CS1 may or may not be populated */ +#define PHYS_SDRAM_1 OMAP34XX_SDRC_CS0 +#define PHYS_SDRAM_2 OMAP34XX_SDRC_CS1 + +/*----------------------------------------------------------------------- + * FLASH and environment organization + */ + +#define CONFIG_ENV_IS_NOWHERE + +#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM_1 +#define CONFIG_SYS_INIT_RAM_ADDR 0x4020f800 +#define CONFIG_SYS_INIT_RAM_SIZE 0x800 +#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_INIT_RAM_ADDR + \ + CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE) + +#endif /* __CONFIG_H */

* Added some ANSI escape codes definitions in common.h * Configuration is done via env variables bootmenu_delay and bootmenu_<num>:
bootmenu_delay=<delay> bootmenu_<num>="<title>=<commands>"
(title and commands are separated by first char '=')
<delay> is delay in seconds of autobooting first entry <num> is boot menu entry, starting from zero <title> is text shown in boot screen <commands> are commands which will be executed when menu entry is selected
* First argument of bootmenu command override bootmenu_delay env * If env bootmenu_delay or bootmenu arg is not specified, delay is 10 seconds * If delay is 0, no entry will be shown on screen and first will be called * If delay is less then 0, no autoboot delay will be used * Boot Menu will stop finding next menu entry if last was not defined * Boot Menu always add menu entry "U-Boot console" at end of all entries
* Example using:
setenv bootmenu_0 Boot 1. kernel=bootm 0x82000000 # Set first menu entry setenv bootmenu_1 Boot 2. kernel=bootm 0x83000000 # Set second menu entry setenv bootmenu_2 Reset board=reset # Set third menu entry setenv bootmenu_3 U-Boot boot order=boot # Set fourth menu entry setenv bootmenu_4 # Empty string is end of all bootmenu entries bootmenu 20 # Run bootmenu with autoboot delay 20s
Signed-off-by: Pali Rohár pali.rohar@gmail.com --- Changes since original version: - ANSI bootmenu command: use puts instead printf - Merged parts of patch "Add some ANSI escape codes definitions in common.h"
common/Makefile | 1 + common/cmd_bootmenu.c | 366 ++++++++++++++++++++++++++++++++++++++++++++++ include/common.h | 13 ++ include/config_cmd_all.h | 1 + 4 files changed, 381 insertions(+), 0 deletions(-) create mode 100644 common/cmd_bootmenu.c
diff --git a/common/Makefile b/common/Makefile index e1efd45..7402bfb 100644 --- a/common/Makefile +++ b/common/Makefile @@ -67,6 +67,7 @@ COBJS-$(CONFIG_CMD_SOURCE) += cmd_source.o COBJS-$(CONFIG_CMD_BDI) += cmd_bdinfo.o COBJS-$(CONFIG_CMD_BEDBUG) += bedbug.o cmd_bedbug.o COBJS-$(CONFIG_CMD_BMP) += cmd_bmp.o +COBJS-$(CONFIG_CMD_BOOTMENU) += cmd_bootmenu.o COBJS-$(CONFIG_CMD_BOOTLDR) += cmd_bootldr.o COBJS-$(CONFIG_CMD_CACHE) += cmd_cache.o COBJS-$(CONFIG_CMD_CLEAR) += cmd_clear.o diff --git a/common/cmd_bootmenu.c b/common/cmd_bootmenu.c new file mode 100644 index 0000000..931ed18 --- /dev/null +++ b/common/cmd_bootmenu.c @@ -0,0 +1,366 @@ +/* + * (C) Copyright 2011 Pali Rohár pali.rohar@gmail.com + * + * 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 as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <common.h> +#include <command.h> +#include <watchdog.h> +#include <linux/string.h> + +#ifdef CONFIG_SYS_HUSH_PARSER +#include <hush.h> +#endif + +static char *get_option(int n) +{ + + char name[] = "bootmenu_\0\0"; + + if (n < 0 || n > 99) + return NULL; + + sprintf(name+9, "%d", n); + + return getenv(name); + +} + +static char *get_end_of_title(char *str) +{ + + if (!str) + return NULL; + + return strchr(str, '='); + +} + +static int print_title(char *begin, char *end) +{ + + if (!begin || !end || end < begin) + return 1; + + while (begin != end) + putc(*(begin++)); + + return 0; + +} + +static int print_entry(int n, int reverse) +{ + + char *str = get_option(n); + char *end = get_end_of_title(str); + + if (!end) + return 1; + + printf(ANSI_CURSOR_POSITION, n+4, 1); + + if (reverse) + puts(ANSI_COLOR_REVERSE); + + puts(" "); + print_title(str, end); + puts(ANSI_CLEAR_LINE_TO_END); + + if (reverse) + puts(ANSI_COLOR_RESET); + + return 0; + +} + +static int print_menu(int active) +{ + + int n = 0; + + printf(ANSI_CURSOR_POSITION, 1, 1); + puts(ANSI_CLEAR_LINE); + printf(ANSI_CURSOR_POSITION, 2, 1); + puts(" *** U-Boot BOOT MENU ***"); + puts(ANSI_CLEAR_LINE_TO_END); + printf(ANSI_CURSOR_POSITION, 3, 1); + puts(ANSI_CLEAR_LINE); + + while (1) { + + int ret = print_entry(n, n == active ? 1 : 0); + + if (ret == 1) + break; + + ++n; + + } + + printf(ANSI_CURSOR_POSITION, n+4, 1); + + if (n == active) + puts(ANSI_COLOR_REVERSE); + + puts(" U-Boot console"); + puts(ANSI_CLEAR_LINE_TO_END); + + if (n == active) + puts(ANSI_COLOR_RESET); + + printf(ANSI_CURSOR_POSITION, n+5, 1); + puts(ANSI_CLEAR_LINE); + printf(ANSI_CURSOR_POSITION, n+6, 1); + puts(" Press UP/DOWN to move, ENTER to select"); + puts(ANSI_CLEAR_LINE_TO_END); + printf(ANSI_CURSOR_POSITION, n+7, 1); + puts(ANSI_CLEAR_LINE); + + return n; + +} + +int do_bootmenu(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]) +{ + + int active = 0; + int abort = 0; + int key = 0; /* 0 - NONE, 1 - UP, 2 - DOWN, 3 - SELECT */ + int esc = 0; + int count = 0; + int delay = 10; + int instant = 0; + char *delay_str = NULL; + + if (argc >= 2) + delay_str = argv[1]; + + if (!delay_str) + delay_str = getenv("bootmenu_delay"); + + if (delay_str) + delay = (int)simple_strtol(delay_str, NULL, 10); + + if (delay == 0) { + + /* prevent setting U-Boot console as first menu entry */ + if (get_end_of_title(get_option(0))) + count = 1; + + instant = 1; + + } + + if (delay < 0) + abort = 1; + + if (!instant) { + + puts(ANSI_CURSOR_HIDE); + puts(ANSI_CLEAR_CONSOLE); + printf(ANSI_CURSOR_POSITION, 1, 1); + + } + + while (1) { + + if (abort || delay > 0) + count = print_menu(active); + + if (!abort) { + + if (delay > 0) + printf(" Hit any key to stop autoboot: %2d ", + delay); + + while (delay > 0) { + + int i; + + for (i = 0; i < 100; ++i) { + + if (tstc()) { + + abort = 1; + key = getc(); + + if (key == '\e') { + esc = 1; + key = 0; + } else if (key == '\r') + key = 3; + else + key = 0; + + break; + + } + + WATCHDOG_RESET(); + udelay(10000); + + } + + if (abort) + break; + + --delay; + printf("\b\b\b%2d ", delay); + + } + + if (delay <= 0) + key = 3; + + } else { + + while (!tstc()) { + + WATCHDOG_RESET(); + udelay(10000); + + } + + key = getc(); + + if (esc == 0) { + + if (key == '\e') { + esc = 1; + key = 0; + } + + } else if (esc == 1) { + + if (key == '[') { + esc = 2; + key = 0; + } else + esc = 0; + + } else if (esc == 2 || esc == 3) { + + if (esc == 2 && key == '1') { + esc = 3; + key = 0; + } else + esc = 0; + + if (key == 'A') + key = 1; + else if (key == 'B') + key = 2; + else + key = 0; + + } + + if (key == '\r') + key = 3; + + } + + if (key == 1) { + + if (active > 0) + --active; + + } else if (key == 2) { + + if (active < count) + ++active; + + } else if (key == 3) { + + char *str; + char *end; + + putc('\n'); + + if (!instant) { + + puts(ANSI_CURSOR_SHOW); + puts(ANSI_CLEAR_CONSOLE); + printf(ANSI_CURSOR_POSITION, 1, 1); + + } + + WATCHDOG_RESET(); + + /* last entry is always U-Boot console */ + if (active == count) { + + puts("Starting U-Boot console\n\n"); + return 0; + + } + + str = get_option(active); + end = get_end_of_title(str); + + if (!end) { + + printf("Invalid Boot Menu entry %d\n", active); + puts("Starting U-Boot console\n\n"); + return 0; + + } + + if (!end[1]) { + + printf("Invalid Boot Menu entry %d: ", active); + print_title(str, end); + puts("\nStarting U-Boot console\n\n"); + return 0; + + } + + printf("Booting Boot Menu entry %d: ", active); + print_title(str, end); + puts(" ...\n\n"); + +#ifndef CONFIG_SYS_HUSH_PARSER + run_command(end+1, 0); +#else + parse_string_outer(end+1, FLAG_PARSE_SEMICOLON | + FLAG_EXIT_FROM_LOOP); +#endif + + printf("\nFailed booting Boot Menu entry %d: ", active); + print_title(str, end); + puts("\nStarting U-Boot console\n\n"); + return 0; + + } + + } + + /* never happends */ + return 1; + +} + +U_BOOT_CMD( + bootmenu, 2, 1, do_bootmenu, + "ANSI terminal bootmenu", + "[delay]\n" + " - show ANSI terminal bootmenu with autoboot delay (default 10s)" +); diff --git a/include/common.h b/include/common.h index 9c0449e..c6dd2ea 100644 --- a/include/common.h +++ b/include/common.h @@ -754,8 +754,21 @@ int disable_ctrlc (int); /* 1 to disable, 0 to enable Control-C detect */ * ANSI terminal */
+#define ANSI_CURSOR_UP "\e[%dA" +#define ANSI_CURSOR_DOWN "\e[%dB" +#define ANSI_CURSOR_FORWARD "\e[%dC" +#define ANSI_CURSOR_BACK "\e[%dD" +#define ANSI_CURSOR_NEXTLINE "\e[%dE" +#define ANSI_CURSOR_PREVIOUSLINE "\e[%dF" +#define ANSI_CURSOR_COLUMN "\e[%dG" #define ANSI_CURSOR_POSITION "\e[%d;%dH" +#define ANSI_CURSOR_SHOW "\e[?25h" +#define ANSI_CURSOR_HIDE "\e[?25l" #define ANSI_CLEAR_CONSOLE "\e[2J" +#define ANSI_CLEAR_LINE_TO_END "\e[0K" +#define ANSI_CLEAR_LINE "\e[2K" +#define ANSI_COLOR_RESET "\e[0m" +#define ANSI_COLOR_REVERSE "\e[7m"
/* * STDIO based functions (can always be used) diff --git a/include/config_cmd_all.h b/include/config_cmd_all.h index 3f25eba..8c0a648 100644 --- a/include/config_cmd_all.h +++ b/include/config_cmd_all.h @@ -20,6 +20,7 @@ #define CONFIG_CMD_BEDBUG /* Include BedBug Debugger */ #define CONFIG_CMD_BMP /* BMP support */ #define CONFIG_CMD_BOOTD /* bootd */ +#define CONFIG_CMD_BOOTMENU /* ANSI terminal Boot Menu */ #define CONFIG_CMD_BSP /* Board Specific functions */ #define CONFIG_CMD_CACHE /* icache, dcache */ #define CONFIG_CMD_CDP /* Cisco Discovery Protocol */

- Added some ANSI escape codes definitions in common.h
- Configuration is done via env variables bootmenu_delay and
bootmenu_<num>:
bootmenu_delay=<delay> bootmenu_<num>="<title>=<commands>" (title and commands are separated by first char '=') <delay> is delay in seconds of autobooting first entry <num> is boot menu entry, starting from zero <title> is text shown in boot screen <commands> are commands which will be executed when menu entry is
selected
Do you need this command if you already have common/menu.c?
M
- First argument of bootmenu command override bootmenu_delay env
- If env bootmenu_delay or bootmenu arg is not specified, delay is 10
seconds * If delay is 0, no entry will be shown on screen and first will be called * If delay is less then 0, no autoboot delay will be used
Boot Menu will stop finding next menu entry if last was not defined
Boot Menu always add menu entry "U-Boot console" at end of all entries
Example using:
setenv bootmenu_0 Boot 1. kernel=bootm 0x82000000 # Set first menu
entry setenv bootmenu_1 Boot 2. kernel=bootm 0x83000000 # Set second menu entry setenv bootmenu_2 Reset board=reset # Set third menu entry setenv bootmenu_3 U-Boot boot order=boot # Set fourth menu entry setenv bootmenu_4 # Empty string is end of all bootmenu entries bootmenu 20 # Run bootmenu with autoboot delay 20s
Signed-off-by: Pali Rohár pali.rohar@gmail.com
Changes since original version:
- ANSI bootmenu command: use puts instead printf
- Merged parts of patch "Add some ANSI escape codes definitions in
common.h"
common/Makefile | 1 + common/cmd_bootmenu.c | 366 ++++++++++++++++++++++++++++++++++++++++++++++ include/common.h | 13 ++ include/config_cmd_all.h | 1 + 4 files changed, 381 insertions(+), 0 deletions(-) create mode 100644 common/cmd_bootmenu.c
diff --git a/common/Makefile b/common/Makefile index e1efd45..7402bfb 100644 --- a/common/Makefile +++ b/common/Makefile @@ -67,6 +67,7 @@ COBJS-$(CONFIG_CMD_SOURCE) += cmd_source.o COBJS-$(CONFIG_CMD_BDI) += cmd_bdinfo.o COBJS-$(CONFIG_CMD_BEDBUG) += bedbug.o cmd_bedbug.o COBJS-$(CONFIG_CMD_BMP) += cmd_bmp.o +COBJS-$(CONFIG_CMD_BOOTMENU) += cmd_bootmenu.o COBJS-$(CONFIG_CMD_BOOTLDR) += cmd_bootldr.o COBJS-$(CONFIG_CMD_CACHE) += cmd_cache.o COBJS-$(CONFIG_CMD_CLEAR) += cmd_clear.o diff --git a/common/cmd_bootmenu.c b/common/cmd_bootmenu.c new file mode 100644 index 0000000..931ed18 --- /dev/null +++ b/common/cmd_bootmenu.c @@ -0,0 +1,366 @@ +/*
- (C) Copyright 2011 Pali Rohár pali.rohar@gmail.com
- 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 as
- published by the Free Software Foundation; either version 2 of
- the License, or (at your option) any later version.
- 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.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- MA 02111-1307 USA
- */
+#include <common.h> +#include <command.h> +#include <watchdog.h> +#include <linux/string.h>
+#ifdef CONFIG_SYS_HUSH_PARSER +#include <hush.h> +#endif
+static char *get_option(int n) +{
- char name[] = "bootmenu_\0\0";
- if (n < 0 || n > 99)
return NULL;
- sprintf(name+9, "%d", n);
- return getenv(name);
+}
+static char *get_end_of_title(char *str) +{
- if (!str)
return NULL;
- return strchr(str, '=');
+}
+static int print_title(char *begin, char *end) +{
- if (!begin || !end || end < begin)
return 1;
- while (begin != end)
putc(*(begin++));
- return 0;
+}
+static int print_entry(int n, int reverse) +{
- char *str = get_option(n);
- char *end = get_end_of_title(str);
- if (!end)
return 1;
- printf(ANSI_CURSOR_POSITION, n+4, 1);
- if (reverse)
puts(ANSI_COLOR_REVERSE);
- puts(" ");
- print_title(str, end);
- puts(ANSI_CLEAR_LINE_TO_END);
- if (reverse)
puts(ANSI_COLOR_RESET);
- return 0;
+}
+static int print_menu(int active) +{
- int n = 0;
- printf(ANSI_CURSOR_POSITION, 1, 1);
- puts(ANSI_CLEAR_LINE);
- printf(ANSI_CURSOR_POSITION, 2, 1);
- puts(" *** U-Boot BOOT MENU ***");
- puts(ANSI_CLEAR_LINE_TO_END);
- printf(ANSI_CURSOR_POSITION, 3, 1);
- puts(ANSI_CLEAR_LINE);
- while (1) {
int ret = print_entry(n, n == active ? 1 : 0);
if (ret == 1)
break;
++n;
- }
- printf(ANSI_CURSOR_POSITION, n+4, 1);
- if (n == active)
puts(ANSI_COLOR_REVERSE);
- puts(" U-Boot console");
- puts(ANSI_CLEAR_LINE_TO_END);
- if (n == active)
puts(ANSI_COLOR_RESET);
- printf(ANSI_CURSOR_POSITION, n+5, 1);
- puts(ANSI_CLEAR_LINE);
- printf(ANSI_CURSOR_POSITION, n+6, 1);
- puts(" Press UP/DOWN to move, ENTER to select");
- puts(ANSI_CLEAR_LINE_TO_END);
- printf(ANSI_CURSOR_POSITION, n+7, 1);
- puts(ANSI_CLEAR_LINE);
- return n;
+}
+int do_bootmenu(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]) +{
- int active = 0;
- int abort = 0;
- int key = 0; /* 0 - NONE, 1 - UP, 2 - DOWN, 3 - SELECT */
- int esc = 0;
- int count = 0;
- int delay = 10;
- int instant = 0;
- char *delay_str = NULL;
- if (argc >= 2)
delay_str = argv[1];
- if (!delay_str)
delay_str = getenv("bootmenu_delay");
- if (delay_str)
delay = (int)simple_strtol(delay_str, NULL, 10);
- if (delay == 0) {
/* prevent setting U-Boot console as first menu entry */
if (get_end_of_title(get_option(0)))
count = 1;
instant = 1;
- }
- if (delay < 0)
abort = 1;
- if (!instant) {
puts(ANSI_CURSOR_HIDE);
puts(ANSI_CLEAR_CONSOLE);
printf(ANSI_CURSOR_POSITION, 1, 1);
- }
- while (1) {
if (abort || delay > 0)
count = print_menu(active);
if (!abort) {
if (delay > 0)
printf(" Hit any key to stop autoboot: %2d ",
delay);
while (delay > 0) {
int i;
for (i = 0; i < 100; ++i) {
if (tstc()) {
abort = 1;
key = getc();
if (key == '\e') {
esc = 1;
key = 0;
} else if (key == '\r')
key = 3;
else
key = 0;
break;
}
WATCHDOG_RESET();
udelay(10000);
}
if (abort)
break;
--delay;
printf("\b\b\b%2d ", delay);
}
if (delay <= 0)
key = 3;
} else {
while (!tstc()) {
WATCHDOG_RESET();
udelay(10000);
}
key = getc();
if (esc == 0) {
if (key == '\e') {
esc = 1;
key = 0;
}
} else if (esc == 1) {
if (key == '[') {
esc = 2;
key = 0;
} else
esc = 0;
} else if (esc == 2 || esc == 3) {
if (esc == 2 && key == '1') {
esc = 3;
key = 0;
} else
esc = 0;
if (key == 'A')
key = 1;
else if (key == 'B')
key = 2;
else
key = 0;
}
if (key == '\r')
key = 3;
}
if (key == 1) {
if (active > 0)
--active;
} else if (key == 2) {
if (active < count)
++active;
} else if (key == 3) {
char *str;
char *end;
putc('\n');
if (!instant) {
puts(ANSI_CURSOR_SHOW);
puts(ANSI_CLEAR_CONSOLE);
printf(ANSI_CURSOR_POSITION, 1, 1);
}
WATCHDOG_RESET();
/* last entry is always U-Boot console */
if (active == count) {
puts("Starting U-Boot console\n\n");
return 0;
}
str = get_option(active);
end = get_end_of_title(str);
if (!end) {
printf("Invalid Boot Menu entry %d\n", active);
puts("Starting U-Boot console\n\n");
return 0;
}
if (!end[1]) {
printf("Invalid Boot Menu entry %d: ", active);
print_title(str, end);
puts("\nStarting U-Boot console\n\n");
return 0;
}
printf("Booting Boot Menu entry %d: ", active);
print_title(str, end);
puts(" ...\n\n");
+#ifndef CONFIG_SYS_HUSH_PARSER
run_command(end+1, 0);
+#else
parse_string_outer(end+1, FLAG_PARSE_SEMICOLON |
FLAG_EXIT_FROM_LOOP);
+#endif
printf("\nFailed booting Boot Menu entry %d: ", active);
print_title(str, end);
puts("\nStarting U-Boot console\n\n");
return 0;
}
- }
- /* never happends */
- return 1;
+}
+U_BOOT_CMD(
- bootmenu, 2, 1, do_bootmenu,
- "ANSI terminal bootmenu",
- "[delay]\n"
- " - show ANSI terminal bootmenu with autoboot delay (default 10s)"
+); diff --git a/include/common.h b/include/common.h index 9c0449e..c6dd2ea 100644 --- a/include/common.h +++ b/include/common.h @@ -754,8 +754,21 @@ int disable_ctrlc (int); /* 1 to disable, 0 to
enable
Control-C detect */ * ANSI terminal */
+#define ANSI_CURSOR_UP "\e[%dA" +#define ANSI_CURSOR_DOWN "\e[%dB" +#define ANSI_CURSOR_FORWARD "\e[%dC" +#define ANSI_CURSOR_BACK "\e[%dD" +#define ANSI_CURSOR_NEXTLINE "\e[%dE" +#define ANSI_CURSOR_PREVIOUSLINE "\e[%dF" +#define ANSI_CURSOR_COLUMN "\e[%dG" #define ANSI_CURSOR_POSITION "\e[%d;%dH" +#define ANSI_CURSOR_SHOW "\e[?25h" +#define ANSI_CURSOR_HIDE "\e[?25l" #define ANSI_CLEAR_CONSOLE "\e[2J" +#define ANSI_CLEAR_LINE_TO_END "\e[0K" +#define ANSI_CLEAR_LINE "\e[2K" +#define ANSI_COLOR_RESET "\e[0m" +#define ANSI_COLOR_REVERSE "\e[7m"
/*
- STDIO based functions (can always be used)
diff --git a/include/config_cmd_all.h b/include/config_cmd_all.h index 3f25eba..8c0a648 100644 --- a/include/config_cmd_all.h +++ b/include/config_cmd_all.h @@ -20,6 +20,7 @@ #define CONFIG_CMD_BEDBUG /* Include BedBug Debugger */ #define CONFIG_CMD_BMP /* BMP support */ #define CONFIG_CMD_BOOTD /* bootd */ +#define CONFIG_CMD_BOOTMENU /* ANSI terminal Boot Menu */ #define CONFIG_CMD_BSP /* Board Specific functions */ #define CONFIG_CMD_CACHE /* icache, dcache */ #define CONFIG_CMD_CDP /* Cisco Discovery Protocol */

On Wednesday 25 January 2012 19:18:50 Marek Vasut wrote:
Do you need this command if you already have common/menu.c?
I need menu which can work with ANSI terminal and framebuffer on device screen. Something which can easy choose booting system...
I can look at menu.c if it can replace my bootmenu (or change bootmenu code to use menu.c)...
Anyway this patch [13] and next [14] can be reviewed separatly. Nokia RX-51 support is in patches 1-12. Patch 14 is additional for rx51, which only add this bootmenu support. U-Boot rx51 port working fine without 13 and 14.

On Wed, Jan 25, 2012 at 08:57:19PM +0100, Pali Rohár wrote:
On Wednesday 25 January 2012 19:18:50 Marek Vasut wrote:
Do you need this command if you already have common/menu.c?
I need menu which can work with ANSI terminal and framebuffer on device screen. Something which can easy choose booting system...
I can look at menu.c if it can replace my bootmenu (or change bootmenu code to use menu.c)...
Anyway this patch [13] and next [14] can be reviewed separatly. Nokia RX-51 support is in patches 1-12. Patch 14 is additional for rx51, which only add this bootmenu support. U-Boot rx51 port working fine without 13 and 14.
Regardless of whatever when you add new commands it might be useful to add some documentation in doc directory.
S.

On Wednesday 25 January 2012 14:57:19 Pali Rohár wrote:
On Wednesday 25 January 2012 19:18:50 Marek Vasut wrote:
Do you need this command if you already have common/menu.c?
I need menu which can work with ANSI terminal and framebuffer on device screen. Something which can easy choose booting system...
I can look at menu.c if it can replace my bootmenu (or change bootmenu code to use menu.c)...
yes, as i suggested before, you should be merging with the existing menu code and not proposing parallel implementations
so NAK this for now -mike

* default bootmenu entries: NOLO kernel, internal eMMC memory, external SD card, u-boot boot order
* when keyboard slide is closed always boot NOLO kernel
* when keyborad slide is open in CONFIG_PREBOOT try load bootmenu.scr from first FAT partition of internal eMMC memory (also known as MyDocs) which (should) overwrite default bootmenu entries
Signed-off-by: Pali Rohár pali.rohar@gmail.com Acked-by: Tom Rini trini@ti.com --- Changes since original version: - Fixed name of env variables
include/configs/nokia_rx51.h | 21 +++++++++++++++++---- 1 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/include/configs/nokia_rx51.h b/include/configs/nokia_rx51.h index 9045535..8d6596b 100644 --- a/include/configs/nokia_rx51.h +++ b/include/configs/nokia_rx51.h @@ -137,6 +137,7 @@ #define CONFIG_CMD_I2C /* I2C serial bus support */ #define CONFIG_CMD_MMC /* MMC support */
+#define CONFIG_CMD_BOOTMENU /* ANSI terminal Boot Menu */ #define CONFIG_CMD_CLEAR /* ANSI terminal clear screen command */
#ifdef ONENAND_SUPPORT @@ -212,8 +213,6 @@ int rx51_kp_getc(void); #endif
/* Environment information */ -#define CONFIG_BOOTDELAY 3 - #define CONFIG_EXTRA_ENV_SETTINGS \ "mtdparts=" MTDPARTS_DEFAULT "\0" \ "usbtty=cdc_acm\0" \ @@ -280,10 +279,22 @@ int rx51_kp_getc(void); "run trymmcallpartboot;" \ "fi\0" \ "emmcboot=setenv mmcnum 1; run trymmcboot\0" \ - "sdboot=setenv mmcnum 0; run trymmcboot\0" + "sdboot=setenv mmcnum 0; run trymmcboot\0" \ + "menucmd=bootmenu\0" \ + "bootmenu_0=Internal flash=run noloboot\0" \ + "bootmenu_1=Internal eMMC=run immcboot\0" \ + "bootmenu_2=External SD card=run emmcboot\0" \ + "bootmenu_3=U-Boot boot order=boot\0" \ + "bootmenu_delay=3\0"
#define CONFIG_PREBOOT \ - "if test $slide_sw != open; then run noloboot; fi;" + "if test $slide_sw = open; then " \ + "setenv mmcnum 1; setenv mmcpart 1; setenv mmctype fat;" \ + "setenv mmcscriptfile bootmenu.scr;" \ + "run trymmcscriptboot;" \ + "else " \ + "setenv bootmenu_delay 0;" \ + "fi"
#define CONFIG_PREMONITOR \ "echo Extra commands:;" \ @@ -301,6 +312,8 @@ int rx51_kp_getc(void); "run noloboot;" \ "echo"
+#define CONFIG_MENUCMD + #define CONFIG_AUTO_COMPLETE
/*

Wolfgang,
On 01/25/2012 01:27 AM, Pali Rohár wrote:
This patch series add support for new board Nokia RX-51 (aka N900). Last two patches adding on screen bootmenu support.
This series supersedes the last sent version.
Just to let you know, I went through this submission off-list with Pali sorting out the revisions etc and in the end it all got too complicated, so I suggested it should be submitted again from scratch (although it does have rudimentary change logs from the previously posted version)
Regards,
Graeme

On Tue, Jan 24, 2012 at 03:27:57PM +0100, Pali Rohár wrote:
This patch series add support for new board Nokia RX-51 (aka N900). Last two patches adding on screen bootmenu support.
This series supersedes the last sent version.
A quick offtopic question - how do you replace boot loader on N900?
Thanks a lot, S.

On Wednesday 25 January 2012 04:48:00 Sergey Lapin wrote:
On Tue, Jan 24, 2012 at 03:27:57PM +0100, Pali Rohár wrote:
This patch series add support for new board Nokia RX-51 (aka N900). Last two patches adding on screen bootmenu support.
This series supersedes the last sent version.
A quick offtopic question - how do you replace boot loader on N900?
Thanks a lot, S.
See commit message in: [PATCH 12/14] New board support: Nokia RX-51 aka N900
Bootloader is not replacing (yet). Instead U-Boot is flashed into kernel area and loaded by proprietary NOLO bootloader. NOLO can load only one image and only from kernel area - so it does not support dualbooting.
Kernel image can be attached into U-Boot binary (at pos. 0x40000) and flashed into nand kernel area (2MB is enought for U-Boot with kernel). And then U-Boot can boot attached kernel image or load/boot it from SD/eMMC.

On Wednesday 25 January 2012 04:48:00 Sergey Lapin wrote:
On Tue, Jan 24, 2012 at 03:27:57PM +0100, Pali Rohár wrote:
This patch series add support for new board Nokia RX-51 (aka N900). Last two patches adding on screen bootmenu support.
This series supersedes the last sent version.
A quick offtopic question - how do you replace boot loader on N900?
Thanks a lot, S.
See commit message in: [PATCH 12/14] New board support: Nokia RX-51 aka N900
Bootloader is not replacing (yet). Instead U-Boot is flashed into kernel area and loaded by proprietary NOLO bootloader. NOLO can load only one image and only from kernel area - so it does not support dualbooting.
So why not just replace the bootloader right away?
Kernel image can be attached into U-Boot binary (at pos. 0x40000) and flashed into nand kernel area (2MB is enought for U-Boot with kernel). And then U-Boot can boot attached kernel image or load/boot it from SD/eMMC.

On Wednesday 25 January 2012 19:20:01 Marek Vasut wrote:
So why not just replace the bootloader right away?
Booting process on n900: 1. Omap bootrom 2. Nokia X-Loader 3. Nokia NOLO Bootloader 4. Linux kernel ...
Nokia X-Loader and NOLO are stored in first nand part. It has size 128kB. Nokia X-Loader is signed (size 14.5kB), so cannot be replaced. NOLO bootloader is not signed (so theoretically can be replaced), but size is limited to 113kB. I do not know how to compile U-Boot binary with size < 113kB...
Size of part where is stored linux kernel has 2MB and it is enought for U-Boot with kernel image (~200kB + ~1.6MB). Also U-Boot can boot kernel from eMMC/SD.

On Wednesday 25 January 2012 19:20:01 Marek Vasut wrote:
So why not just replace the bootloader right away?
Booting process on n900:
- Omap bootrom
- Nokia X-Loader
- Nokia NOLO Bootloader
- Linux kernel
...
To make it clear, I own N900 myself ;-)
Nokia X-Loader and NOLO are stored in first nand part. It has size 128kB. Nokia X-Loader is signed (size 14.5kB), so cannot be replaced. NOLO bootloader is not signed (so theoretically can be replaced), but size is limited to 113kB. I do not know how to compile U-Boot binary with size < 113kB...
Size of part where is stored linux kernel has 2MB and it is enought for U-Boot with kernel image (~200kB + ~1.6MB). Also U-Boot can boot kernel from eMMC/SD.
You didn't answer my question, so again ... why can't you replace NOLO? Because there's the 113kb limit? Use SPL then.
M

On Wednesday 25 January 2012 21:56:37 Marek Vasut wrote:
On Wednesday 25 January 2012 19:20:01 Marek Vasut wrote:
So why not just replace the bootloader right away?
Booting process on n900:
- Omap bootrom
- Nokia X-Loader
- Nokia NOLO Bootloader
- Linux kernel
...
To make it clear, I own N900 myself ;-)
Nokia X-Loader and NOLO are stored in first nand part. It has size 128kB. Nokia X-Loader is signed (size 14.5kB), so cannot be replaced. NOLO bootloader is not signed (so theoretically can be replaced), but size is limited to 113kB. I do not know how to compile U-Boot binary with size < 113kB...
Size of part where is stored linux kernel has 2MB and it is enought for U-Boot with kernel image (~200kB + ~1.6MB). Also U-Boot can boot kernel from eMMC/SD.
You didn't answer my question, so again ... why can't you replace NOLO? Because there's the 113kb limit? Use SPL then.
I only tried to boot U-Boot in qemu wich increased boot part - but not worked. (NOLO in qemu can boot u-boot without problems). So NOLO do some extra work - which I do not know... Also limit is problem to test on real n900.

On Wednesday 25 January 2012 21:56:37 Marek Vasut wrote:
On Wednesday 25 January 2012 19:20:01 Marek Vasut wrote:
So why not just replace the bootloader right away?
Booting process on n900:
- Omap bootrom
- Nokia X-Loader
- Nokia NOLO Bootloader
- Linux kernel
...
To make it clear, I own N900 myself ;-)
Nokia X-Loader and NOLO are stored in first nand part. It has size 128kB. Nokia X-Loader is signed (size 14.5kB), so cannot be replaced. NOLO bootloader is not signed (so theoretically can be replaced), but size is limited to 113kB. I do not know how to compile U-Boot binary with size < 113kB...
Size of part where is stored linux kernel has 2MB and it is enought for U-Boot with kernel image (~200kB + ~1.6MB). Also U-Boot can boot kernel from eMMC/SD.
You didn't answer my question, so again ... why can't you replace NOLO? Because there's the 113kb limit? Use SPL then.
I only tried to boot U-Boot in qemu wich increased boot part - but not worked. (NOLO in qemu can boot u-boot without problems). So NOLO do some extra work - which I do not know... Also limit is problem to test on real n900.
What do you mean? Did you crack yours open? Can you connect JTAG to the device? I didn't check on mine.

On Wednesday 25 January 2012 22:29:16 Marek Vasut wrote:
On Wednesday 25 January 2012 21:56:37 Marek Vasut wrote:
On Wednesday 25 January 2012 19:20:01 Marek Vasut wrote:
So why not just replace the bootloader right away?
Booting process on n900:
- Omap bootrom
- Nokia X-Loader
- Nokia NOLO Bootloader
- Linux kernel
...
To make it clear, I own N900 myself ;-)
Nokia X-Loader and NOLO are stored in first nand part. It has size 128kB. Nokia X-Loader is signed (size 14.5kB), so cannot be replaced. NOLO bootloader is not signed (so theoretically can be replaced), but size is limited to 113kB. I do not know how to compile U-Boot binary with size < 113kB...
Size of part where is stored linux kernel has 2MB and it is enought for U-Boot with kernel image (~200kB + ~1.6MB). Also U-Boot can boot kernel from eMMC/SD.
You didn't answer my question, so again ... why can't you replace NOLO? Because there's the 113kb limit? Use SPL then.
I only tried to boot U-Boot in qemu wich increased boot part - but not worked. (NOLO in qemu can boot u-boot without problems). So NOLO do some extra work - which I do not know... Also limit is problem to test on real n900.
What do you mean? Did you crack yours open? Can you connect JTAG to the device? I didn't check on mine.
I have no idea if N900 has JTAG. And I think that nobody cracked X-Loader yet.
NOLO bootloader can be replaced/flashed via flasher-3.5 app throw USB. Also when NOLO is damaged (or cleared/replaced) it can restored - coldflashed again via flasher-3.5.
What I tried: I created mtd image where was X-Loader, NOLO and U-Boot. QEmu RX51 successfull booted this image and I got serial console and video screen output.
But when I created mtd image where was only X-Loader an U-Boot, QEmu RX51 was unable to boot (it freezed).
So NOLO executing some code which inilialize board or someting else which must be done in U-Boot board code. There is no documentation or info about NOLO, so I cannot create working NOLO replacement.

On Wednesday 25 January 2012 22:29:16 Marek Vasut wrote:
On Wednesday 25 January 2012 21:56:37 Marek Vasut wrote:
On Wednesday 25 January 2012 19:20:01 Marek Vasut wrote:
So why not just replace the bootloader right away?
Booting process on n900:
- Omap bootrom
- Nokia X-Loader
- Nokia NOLO Bootloader
- Linux kernel
...
To make it clear, I own N900 myself ;-)
Nokia X-Loader and NOLO are stored in first nand part. It has size 128kB. Nokia X-Loader is signed (size 14.5kB), so cannot be replaced. NOLO bootloader is not signed (so theoretically can be replaced), but size is limited to 113kB. I do not know how to compile U-Boot binary with size < 113kB...
Size of part where is stored linux kernel has 2MB and it is enought for U-Boot with kernel image (~200kB + ~1.6MB). Also U-Boot can boot kernel from eMMC/SD.
You didn't answer my question, so again ... why can't you replace NOLO? Because there's the 113kb limit? Use SPL then.
I only tried to boot U-Boot in qemu wich increased boot part - but not worked. (NOLO in qemu can boot u-boot without problems). So NOLO do some extra work - which I do not know... Also limit is problem to test on real n900.
What do you mean? Did you crack yours open? Can you connect JTAG to the device? I didn't check on mine.
I have no idea if N900 has JTAG. And I think that nobody cracked X-Loader yet.
What do you mean, you don't need xloader, u-boot SPL can replace it.
NOLO bootloader can be replaced/flashed via flasher-3.5 app throw USB. Also when NOLO is damaged (or cleared/replaced) it can restored - coldflashed again via flasher-3.5.
I know. So ... ? Basically you can use the TI flashes too since it all goes through the bootrom, right?
What I tried: I created mtd image where was X-Loader, NOLO and U-Boot. QEmu RX51 successfull booted this image and I got serial console and video screen output.
But when I created mtd image where was only X-Loader an U-Boot, QEmu RX51 was unable to boot (it freezed).
Why? Where? You know you can debug U-Boot in QEMU with GDB and diag the problem properly?
So NOLO executing some code which inilialize board or someting else which must be done in U-Boot board code. There is no documentation or info about NOLO, so I cannot create working NOLO replacement.
Yes you can, either observe it or disas it.
M

On Wed, Jan 25, 2012 at 11:00:34PM +0100, Marek Vasut wrote:
On Wednesday 25 January 2012 22:29:16 Marek Vasut wrote:
On Wednesday 25 January 2012 21:56:37 Marek Vasut wrote:
On Wednesday 25 January 2012 19:20:01 Marek Vasut wrote: > So why not just replace the bootloader right away?
Booting process on n900:
- Omap bootrom
- Nokia X-Loader
- Nokia NOLO Bootloader
- Linux kernel
...
To make it clear, I own N900 myself ;-)
Nokia X-Loader and NOLO are stored in first nand part. It has size 128kB. Nokia X-Loader is signed (size 14.5kB), so cannot be replaced. NOLO bootloader is not signed (so theoretically can be replaced), but size is limited to 113kB. I do not know how to compile U-Boot binary with size < 113kB...
Size of part where is stored linux kernel has 2MB and it is enought for U-Boot with kernel image (~200kB + ~1.6MB). Also U-Boot can boot kernel from eMMC/SD.
You didn't answer my question, so again ... why can't you replace NOLO? Because there's the 113kb limit? Use SPL then.
I only tried to boot U-Boot in qemu wich increased boot part - but not worked. (NOLO in qemu can boot u-boot without problems). So NOLO do some extra work - which I do not know... Also limit is problem to test on real n900.
What do you mean? Did you crack yours open? Can you connect JTAG to the device? I didn't check on mine.
I have no idea if N900 has JTAG. And I think that nobody cracked X-Loader yet.
What do you mean, you don't need xloader, u-boot SPL can replace it.
Yes and no. No, becaue you nor I have no Nokia's signing key(s) to sign SPL binary for OMAP's secure boot ROM. IIRC N950/N9 is even more strict regarding that, am I right?
NOLO bootloader can be replaced/flashed via flasher-3.5 app throw USB. Also when NOLO is damaged (or cleared/replaced) it can restored - coldflashed again via flasher-3.5.
I know. So ... ? Basically you can use the TI flashes too since it all goes through the bootrom, right?
Butrom requires signed binary.
What I tried: I created mtd image where was X-Loader, NOLO and U-Boot. QEmu RX51 successfull booted this image and I got serial console and video screen output.
But when I created mtd image where was only X-Loader an U-Boot, QEmu RX51 was unable to boot (it freezed).
Why? Where? You know you can debug U-Boot in QEMU with GDB and diag the problem properly?
Any volunteers? (I own N900 too, ah, I own 3 of tham, damnit)
So NOLO executing some code which inilialize board or someting else which must be done in U-Boot board code. There is no documentation or info about NOLO, so I cannot create working NOLO replacement.
Yes you can, either observe it or disas it.
M
All the best, S.

On Thursday 26 January 2012 11:25:59 Sergey Lapin wrote:
On Wed, Jan 25, 2012 at 11:00:34PM +0100, Marek Vasut wrote:
What do you mean, you don't need xloader, u-boot SPL can replace it.
Yes and no. No, becaue you nor I have no Nokia's signing key(s) to sign SPL binary for OMAP's secure boot ROM. IIRC N950/N9 is even more strict regarding that, am I right?
You are right, we cannot sign SPL binary for N900 because we do not have key. Signing key has only somebody in Nokia (or in TI). I do not have N950/N9 so I do not know anything about new devices.
I know. So ... ? Basically you can use the TI flashes too since it all goes through the bootrom, right?
Butrom requires signed binary.
Yes and format of signed binary is not published by TI (there are only some RE info about Motorola Omap devices).
What I tried: I created mtd image where was X-Loader, NOLO and U-Boot. QEmu RX51 successfull booted this image and I got serial console and video screen output.
But when I created mtd image where was only X-Loader an U-Boot, QEmu RX51 was unable to boot (it freezed).
Why? Where? You know you can debug U-Boot in QEMU with GDB and diag the problem properly?
Any volunteers? (I own N900 too, ah, I own 3 of tham, damnit)
I can try to play with SPL U-Boot binary and X-Loader in qemu. But this and next month I do not have time for it...

On Thursday 26 January 2012 11:25:59 Sergey Lapin wrote:
On Wed, Jan 25, 2012 at 11:00:34PM +0100, Marek Vasut wrote:
What do you mean, you don't need xloader, u-boot SPL can replace it.
Yes and no. No, becaue you nor I have no Nokia's signing key(s) to sign SPL binary for OMAP's secure boot ROM. IIRC N950/N9 is even more strict regarding that, am I right?
You are right, we cannot sign SPL binary for N900 because we do not have key. Signing key has only somebody in Nokia (or in TI). I do not have N950/N9 so I do not know anything about new devices.
I know. So ... ? Basically you can use the TI flashes too since it all goes through the bootrom, right?
Butrom requires signed binary.
Yes and format of signed binary is not published by TI (there are only some RE info about Motorola Omap devices).
What I tried: I created mtd image where was X-Loader, NOLO and U-Boot. QEmu RX51 successfull booted this image and I got serial console and video screen output.
But when I created mtd image where was only X-Loader an U-Boot, QEmu RX51 was unable to boot (it freezed).
Why? Where? You know you can debug U-Boot in QEMU with GDB and diag the problem properly?
Any volunteers? (I own N900 too, ah, I own 3 of tham, damnit)
I can try to play with SPL U-Boot binary and X-Loader in qemu. But this and next month I do not have time for it...
You're just lazy ... what exam can take you so much time ? :-p

On Thu, Jan 26, 2012 at 05:39:13PM +0100, Pali Rohár wrote:
On Thursday 26 January 2012 11:25:59 Sergey Lapin wrote:
On Wed, Jan 25, 2012 at 11:00:34PM +0100, Marek Vasut wrote:
What do you mean, you don't need xloader, u-boot SPL can replace it.
Yes and no. No, becaue you nor I have no Nokia's signing key(s) to sign SPL binary for OMAP's secure boot ROM. IIRC N950/N9 is even more strict regarding that, am I right?
You are right, we cannot sign SPL binary for N900 because we do not have key. Signing key has only somebody in Nokia (or in TI). I do not have N950/N9 so I do not know anything about new devices.
Probably autobuilder does have a key, but the question is if key is different for each device or not.
I know. So ... ? Basically you can use the TI flashes too since it all goes through the bootrom, right?
Butrom requires signed binary.
Yes and format of signed binary is not published by TI (there are only some RE info about Motorola Omap devices).
Well, format is somewhat documented in public TI specifications, but that won't help anyway becase of OMAP's little OTP memory...
I can try to play with SPL U-Boot binary and X-Loader in qemu. But this and next month I do not have time for it...
Me neither.
All the best, S.

On Friday 27 January 2012 03:59:41 Sergey Lapin wrote:
On Thu, Jan 26, 2012 at 05:39:13PM +0100, Pali Rohár wrote:
On Thursday 26 January 2012 11:25:59 Sergey Lapin wrote:
On Wed, Jan 25, 2012 at 11:00:34PM +0100, Marek Vasut wrote:
What do you mean, you don't need xloader, u-boot SPL can replace it.
Yes and no. No, becaue you nor I have no Nokia's signing key(s) to sign SPL binary for OMAP's secure boot ROM. IIRC N950/N9 is even more strict regarding that, am I right?
You are right, we cannot sign SPL binary for N900 because we do not have key. Signing key has only somebody in Nokia (or in TI). I do not have N950/N9 so I do not know anything about new devices.
Probably autobuilder does have a key, but the question is if key is different for each device or not.
There are more (about 80) HW revisions of Nokia N900. And only 5 different X- Loader images (which are part of public Nokia N900 firmware).
So max. 5 different keys for all N900 devices. (or maybe in one X-Loader image are more signatures?)
I know. So ... ? Basically you can use the TI flashes too since it all goes through the bootrom, right?
Butrom requires signed binary.
Yes and format of signed binary is not published by TI (there are only some RE info about Motorola Omap devices).
Well, format is somewhat documented in public TI specifications, but that won't help anyway becase of OMAP's little OTP memory...
If you find can you write link for that specification?

On Wed, Jan 25, 2012 at 11:00:34PM +0100, Marek Vasut wrote:
On Wednesday 25 January 2012 22:29:16 Marek Vasut wrote:
On Wednesday 25 January 2012 21:56:37 Marek Vasut wrote:
> On Wednesday 25 January 2012 19:20:01 Marek Vasut wrote: > > So why not just replace the bootloader right away? > > Booting process on n900: > 1. Omap bootrom > 2. Nokia X-Loader > 3. Nokia NOLO Bootloader > 4. Linux kernel > ...
To make it clear, I own N900 myself ;-)
> Nokia X-Loader and NOLO are stored in first nand part. It has > size 128kB. Nokia X-Loader is signed (size 14.5kB), so cannot > be replaced. NOLO bootloader is not signed (so theoretically > can be replaced), but size is limited to 113kB. I do not know > how to compile U-Boot binary with size < 113kB... > > Size of part where is stored linux kernel has 2MB and it is > enought for > U-Boot with kernel image (~200kB + ~1.6MB). Also U-Boot can > boot kernel > from eMMC/SD.
You didn't answer my question, so again ... why can't you replace NOLO? Because there's the 113kb limit? Use SPL then.
I only tried to boot U-Boot in qemu wich increased boot part - but not worked. (NOLO in qemu can boot u-boot without problems). So NOLO do some extra work - which I do not know... Also limit is problem to test on real n900.
What do you mean? Did you crack yours open? Can you connect JTAG to the device? I didn't check on mine.
I have no idea if N900 has JTAG. And I think that nobody cracked X-Loader yet.
What do you mean, you don't need xloader, u-boot SPL can replace it.
Yes and no. No, becaue you nor I have no Nokia's signing key(s) to sign SPL binary for OMAP's secure boot ROM. IIRC N950/N9 is even more strict regarding that, am I right?
Yea ... I was explained later how messed up it is ... so it'd probably be for the best now to replace NOLO with U-Boot SPL.
M
NOLO bootloader can be replaced/flashed via flasher-3.5 app throw USB. Also when NOLO is damaged (or cleared/replaced) it can restored - coldflashed again via flasher-3.5.
I know. So ... ? Basically you can use the TI flashes too since it all goes through the bootrom, right?
Butrom requires signed binary.
What I tried: I created mtd image where was X-Loader, NOLO and U-Boot. QEmu RX51 successfull booted this image and I got serial console and video screen output.
But when I created mtd image where was only X-Loader an U-Boot, QEmu RX51 was unable to boot (it freezed).
Why? Where? You know you can debug U-Boot in QEMU with GDB and diag the problem properly?
Any volunteers? (I own N900 too, ah, I own 3 of tham, damnit)
So NOLO executing some code which inilialize board or someting else which must be done in U-Boot board code. There is no documentation or info about NOLO, so I cannot create working NOLO replacement.
Yes you can, either observe it or disas it.
M
All the best, S.

This patch series add support for new board Nokia RX-51 (aka N900). Last two patches adding on screen bootmenu support.
Isn't on-screen bootmenu already supported by common/menu.c stuff ?
This series supersedes the last sent version.
So ... this is V2? What are the changes from previous version of the series? Please read Submitting patches on the wiki next time.
Pali Rohár (14): arm,omap3: Define save_boot_params in lowlevel_init.S for SPL only arm: Optionally use existing atags in bootm.c Add power bus message definitions in twl4030.h Fix function readline in main.c cfb_console: Fix function console_scrollup cfb_console: Add function console_clear and console_clear_line cfb_console: Add functions for moving with cursor cfb_console: Add support for some ANSI terminal escape codes New command clear: Clear the ANSI terminal New config variable CONFIG_MENUCMD New config variable CONFIG_PREMONITOR New board support: Nokia RX-51 aka N900 New command bootmenu: ANSI terminal Boot Menu support RX-51: Add support for bootmenu
README | 2 + arch/arm/cpu/armv7/omap3/lowlevel_init.S | 4 +- arch/arm/lib/bootm.c | 39 +++- board/nokia/rx51/Makefile | 46 ++++ board/nokia/rx51/lowlevel_init.S | 79 ++++++ board/nokia/rx51/rx51.c | 381 ++++++++++++++++++++++++++++++ board/nokia/rx51/rx51.h | 378 +++++++++++++++++++++++++++++ boards.cfg | 1 + common/Makefile | 2 + common/cmd_bootmenu.c | 366 ++++++++++++++++++++++++++++ common/cmd_clear.c | 42 ++++ common/env_common.c | 3 + common/main.c | 89 ++++++- drivers/video/cfb_console.c | 346 +++++++++++++++++++++++++-- include/common.h | 20 ++ include/config_cmd_all.h | 2 + include/configs/nokia_rx51.h | 375 +++++++++++++++++++++++++++++ include/twl4030.h | 98 ++++++++ 18 files changed, 2233 insertions(+), 40 deletions(-) create mode 100644 board/nokia/rx51/Makefile create mode 100644 board/nokia/rx51/lowlevel_init.S create mode 100644 board/nokia/rx51/rx51.c create mode 100644 board/nokia/rx51/rx51.h create mode 100644 common/cmd_bootmenu.c create mode 100644 common/cmd_clear.c create mode 100644 include/configs/nokia_rx51.h

Hi Marek,
On 01/26/2012 04:59 AM, Marek Vasut wrote:
This patch series add support for new board Nokia RX-51 (aka N900). Last two patches adding on screen bootmenu support.
Isn't on-screen bootmenu already supported by common/menu.c stuff ?
This series supersedes the last sent version.
So ... this is V2? What are the changes from previous version of the series? Please read Submitting patches on the wiki next time.
I've been through the revision/submission for this series extensively off-list with Pali in order to attempt to fix-up the initial revision non-compliance issues (as well as commit messages, trivial style issues etc)
It got to the point were maintaining the revision history consistent with the previous series was a bit of a 'train wreck' so let's all forget about it (call the last lot an RFC) and move on :)
Regards,
Graeme

On Tuesday 24 January 2012 15:27:57 you wrote:
This patch series add support for new board Nokia RX-51 (aka N900). Last two patches adding on screen bootmenu support.
This series supersedes the last sent version.
Pali Rohár (14): arm,omap3: Define save_boot_params in lowlevel_init.S for SPL only arm: Optionally use existing atags in bootm.c Add power bus message definitions in twl4030.h Fix function readline in main.c cfb_console: Fix function console_scrollup cfb_console: Add function console_clear and console_clear_line cfb_console: Add functions for moving with cursor cfb_console: Add support for some ANSI terminal escape codes New command clear: Clear the ANSI terminal New config variable CONFIG_MENUCMD New config variable CONFIG_PREMONITOR New board support: Nokia RX-51 aka N900 New command bootmenu: ANSI terminal Boot Menu support RX-51: Add support for bootmenu
README | 2 + arch/arm/cpu/armv7/omap3/lowlevel_init.S | 4 +- arch/arm/lib/bootm.c | 39 +++- board/nokia/rx51/Makefile | 46 ++++ board/nokia/rx51/lowlevel_init.S | 79 ++++++ board/nokia/rx51/rx51.c | 381 ++++++++++++++++++++++++++++++ board/nokia/rx51/rx51.h | 378 +++++++++++++++++++++++++++++ boards.cfg | 1 + common/Makefile | 2 + common/cmd_bootmenu.c | 366 ++++++++++++++++++++++++++++ common/cmd_clear.c | 42 ++++ common/env_common.c | 3 + common/main.c | 89 ++++++- drivers/video/cfb_console.c | 346 +++++++++++++++++++++++++-- include/common.h | 20 ++ include/config_cmd_all.h | 2 + include/configs/nokia_rx51.h | 375 +++++++++++++++++++++++++++++ include/twl4030.h | 98 ++++++++ 18 files changed, 2233 insertions(+), 40 deletions(-) create mode 100644 board/nokia/rx51/Makefile create mode 100644 board/nokia/rx51/lowlevel_init.S create mode 100644 board/nokia/rx51/rx51.c create mode 100644 board/nokia/rx51/rx51.h create mode 100644 common/cmd_bootmenu.c create mode 100644 common/cmd_clear.c create mode 100644 include/configs/nokia_rx51.h
Please look at my post: http://lists.denx.de/pipermail/u-boot/2012-January/115778.html
After that commit, framebuffer output on Nokia RX51 not working...

On Tuesday 24 January 2012 15:27:57 you wrote:
This patch series add support for new board Nokia RX-51 (aka N900). Last two patches adding on screen bootmenu support.
This series supersedes the last sent version.
Pali Rohár (14): arm,omap3: Define save_boot_params in lowlevel_init.S for SPL only arm: Optionally use existing atags in bootm.c Add power bus message definitions in twl4030.h Fix function readline in main.c cfb_console: Fix function console_scrollup cfb_console: Add function console_clear and console_clear_line cfb_console: Add functions for moving with cursor cfb_console: Add support for some ANSI terminal escape codes New command clear: Clear the ANSI terminal New config variable CONFIG_MENUCMD New config variable CONFIG_PREMONITOR New board support: Nokia RX-51 aka N900 New command bootmenu: ANSI terminal Boot Menu support RX-51: Add support for bootmenu
README | 2 + arch/arm/cpu/armv7/omap3/lowlevel_init.S | 4 +- arch/arm/lib/bootm.c | 39 +++- board/nokia/rx51/Makefile | 46 ++++ board/nokia/rx51/lowlevel_init.S | 79 ++++++ board/nokia/rx51/rx51.c | 381
++++++++++++++++++++++++++++++ board/nokia/rx51/rx51.h | 378 +++++++++++++++++++++++++++++ boards.cfg
| 1 +
common/Makefile | 2 + common/cmd_bootmenu.c | 366
++++++++++++++++++++++++++++ common/cmd_clear.c | 42 ++++
common/env_common.c | 3 + common/main.c | 89 ++++++- drivers/video/cfb_console.c | 346 +++++++++++++++++++++++++--
include/common.h | 20 ++
include/config_cmd_all.h | 2 + include/configs/nokia_rx51.h | 375
+++++++++++++++++++++++++++++ include/twl4030.h | 98 ++++++++
18 files changed, 2233 insertions(+), 40 deletions(-) create mode 100644 board/nokia/rx51/Makefile create mode 100644 board/nokia/rx51/lowlevel_init.S create mode 100644 board/nokia/rx51/rx51.c create mode 100644 board/nokia/rx51/rx51.h create mode 100644 common/cmd_bootmenu.c create mode 100644 common/cmd_clear.c create mode 100644 include/configs/nokia_rx51.h
Please look at my post: http://lists.denx.de/pipermail/u-boot/2012-January/115778.html
After that commit, framebuffer output on Nokia RX51 not working...
Can you PLEASE keep the involved parties in Cc? Otherwise people just won't notice your damn mail because they usually ignore emails not addressed to them!
M

On Tuesday 24 January 2012 15:27:57 Pali Rohár wrote:
This patch series add support for new board Nokia RX-51 (aka N900). Last two patches adding on screen bootmenu support.
This series supersedes the last sent version.
Hi, what is state of this patch series? From our discussion is only problematic bootmenu part, but other could be OK.
So what is needed for including this patches (without bootmenu support) to uboot master?

On Tuesday 24 January 2012 15:27:57 Pali Rohár wrote:
This patch series add support for new board Nokia RX-51 (aka N900). Last two patches adding on screen bootmenu support.
This series supersedes the last sent version.
Hi, what is state of this patch series? From our discussion is only problematic bootmenu part, but other could be OK.
So what is needed for including this patches (without bootmenu support) to uboot master?
You should probably split the patches into smaller series and resubmit individually.
M

On Sunday 26 February 2012 17:08:04 Marek Vasut wrote:
On Tuesday 24 January 2012 15:27:57 Pali Rohár wrote:
This patch series add support for new board Nokia RX-51 (aka N900). Last two patches adding on screen bootmenu support.
This series supersedes the last sent version.
Hi, what is state of this patch series? From our discussion is only problematic bootmenu part, but other could be OK.
So what is needed for including this patches (without bootmenu support) to uboot master?
You should probably split the patches into smaller series and resubmit individually.
yeah, we aren't keen on manually trying to pick things out of a patchset since it's hard for us to know what is required to be together. a patchset, by nature, should be merged as a group. -mike

On Sunday 26 February 2012 23:10:18 Mike Frysinger wrote:
On Sunday 26 February 2012 17:08:04 Marek Vasut wrote:
On Tuesday 24 January 2012 15:27:57 Pali Rohár wrote:
This patch series add support for new board Nokia RX-51 (aka N900). Last two patches adding on screen bootmenu support.
This series supersedes the last sent version.
Hi, what is state of this patch series? From our discussion is only problematic bootmenu part, but other could be OK.
So what is needed for including this patches (without bootmenu support) to uboot master?
You should probably split the patches into smaller series and resubmit individually.
yeah, we aren't keen on manually trying to pick things out of a patchset since it's hard for us to know what is required to be together. a patchset, by nature, should be merged as a group. -mike
Ok, I will create new patchset and fix known problems (CONFIG_CMDLINE_EDITING)

On Sunday 26 February 2012 23:10:18 Mike Frysinger wrote:
On Sunday 26 February 2012 17:08:04 Marek Vasut wrote:
On Tuesday 24 January 2012 15:27:57 Pali Rohár wrote:
This patch series add support for new board Nokia RX-51 (aka N900). Last two patches adding on screen bootmenu support.
This series supersedes the last sent version.
Hi, what is state of this patch series? From our discussion is only problematic bootmenu part, but other could be OK.
So what is needed for including this patches (without bootmenu support) to uboot master?
You should probably split the patches into smaller series and resubmit individually.
yeah, we aren't keen on manually trying to pick things out of a patchset since it's hard for us to know what is required to be together. a patchset, by nature, should be merged as a group. -mike
Ok, I will create new patchset and fix known problems (CONFIG_CMDLINE_EDITING)
Thanks

On Monday 27 February 2012 21:55:31 Marek Vasut wrote:
On Sunday 26 February 2012 23:10:18 Mike Frysinger wrote:
On Sunday 26 February 2012 17:08:04 Marek Vasut wrote:
On Tuesday 24 January 2012 15:27:57 Pali Rohár wrote:
This patch series add support for new board Nokia RX-51 (aka N900). Last two patches adding on screen bootmenu support.
This series supersedes the last sent version.
Hi, what is state of this patch series? From our discussion is only problematic bootmenu part, but other could be OK.
So what is needed for including this patches (without bootmenu support) to uboot master?
You should probably split the patches into smaller series and resubmit individually.
yeah, we aren't keen on manually trying to pick things out of a patchset since it's hard for us to know what is required to be together. a patchset, by nature, should be merged as a group. -mike
Ok, I will create new patchset and fix known problems (CONFIG_CMDLINE_EDITING)
Thanks
U-Boot on Nokia N900 is broken due to bug in MMC and framebuffer driver. See: http://lists.denx.de/pipermail/u-boot/2012-January/115778.html http://lists.denx.de/pipermail/u-boot/2012-March/119330.html
Until now *nobody* responce to the first reported problem (2 months old). I will not do anything with Nokia N900 U-Boot code until both problem will be fixed!

Dear Pali Rohar,
I suggest you to read through this whole mail properly, do not get angry by the first few lines.
U-Boot on Nokia N900 is broken due to bug in MMC and framebuffer driver. See: http://lists.denx.de/pipermail/u-boot/2012-January/115778.html http://lists.denx.de/pipermail/u-boot/2012-March/119330.html
Until now *nobody* responce to the first reported problem (2 months old). I will not do anything with Nokia N900 U-Boot code until both problem will be fixed!
Firstly, we are very grateful for properly reported bugs!
Yet you probably misunderstood how whole this free software/open source thing works.
If you found a bug noone else noticed, you are not ever supposed to expect people on the mailing list to fall on their backs, drop everything they are doing and start fixing your problem. This is because they didn't observe any trouble and so this has no priority for them.
And this is especially true for out-of-tree ports. N900 is good example of such category.
Now if you actually report a bug to the mailing list and this bug goes unnoticed for an extended period of time, you're supposed to send subsequent email in order to alarm the people on the mailing list the bug report is still relevant.
In case of U-Boot and Linux kernel, there is a list of maintainers in the MAINTAINERS file in the source tree, you are supposed to put these people in the Cc of such reports, this will greatly improve your chance of getting response and help. In case of U-Boot, there is also a list of custodians available here:
http://www.denx.de/wiki/U-Boot/Custodians
But considering you are yourself a software engineer, the best approach to the problem you're observing is to actually debug the issue you're seeing and submit a patch for it. Next, fix your patches for N900 and submit them. It'd be a good idea to put a note in the patchset cover message that this depends on your previous fix.
Now, to the problems you're observing:
1) Video; check if you have the following defined in your board config:
#define CONFIG_VIDEO #define CONFIG_VIDEO_SW_CURSOR #define CONFIG_CFB_CONSOLE #define CONFIG_VGA_AS_SINGLE_DEVICE #define CONFIG_SYS_WHITE_ON_BLACK
I understand that you probably want to second and the last define from the list above, which solves your "invert" problem and swcursor problem.
2) MMC; I believe Tom can comment on this one.
On a final note, I believe you should adjust your behaviour towards the mailing list. The U-Boot project, as well as many other FOSS projects, is a collective effort to achieve the best possible result for everyone. But for such model to work, everyone must first give and take only afterwards and never too much.
Best regards Marek Vasut

On Sunday 04 March 2012 21:57:23 Marek Vasut wrote:
Dear Pali Rohar,
I suggest you to read through this whole mail properly, do not get angry by the first few lines.
U-Boot on Nokia N900 is broken due to bug in MMC and framebuffer driver. See: http://lists.denx.de/pipermail/u-boot/2012-January/115778.html http://lists.denx.de/pipermail/u-boot/2012-March/119330.html
Until now *nobody* responce to the first reported problem (2 months old). I will not do anything with Nokia N900 U-Boot code until both problem will be fixed!
Firstly, we are very grateful for properly reported bugs!
Yet you probably misunderstood how whole this free software/open source thing works.
If you found a bug noone else noticed, you are not ever supposed to expect people on the mailing list to fall on their backs, drop everything they are doing and start fixing your problem. This is because they didn't observe any trouble and so this has no priority for them.
And this is especially true for out-of-tree ports. N900 is good example of such category.
Now if you actually report a bug to the mailing list and this bug goes unnoticed for an extended period of time, you're supposed to send subsequent email in order to alarm the people on the mailing list the bug report is still relevant.
In case of U-Boot and Linux kernel, there is a list of maintainers in the MAINTAINERS file in the source tree, you are supposed to put these people in the Cc of such reports, this will greatly improve your chance of getting response and help. In case of U-Boot, there is also a list of custodians available here:
http://www.denx.de/wiki/U-Boot/Custodians
But considering you are yourself a software engineer, the best approach to the problem you're observing is to actually debug the issue you're seeing and submit a patch for it. Next, fix your patches for N900 and submit them. It'd be a good idea to put a note in the patchset cover message that this depends on your previous fix.
Now, to the problems you're observing:
- Video; check if you have the following defined in your board config:
#define CONFIG_VIDEO #define CONFIG_VIDEO_SW_CURSOR #define CONFIG_CFB_CONSOLE #define CONFIG_VGA_AS_SINGLE_DEVICE #define CONFIG_SYS_WHITE_ON_BLACK
I understand that you probably want to second and the last define from the list above, which solves your "invert" problem and swcursor problem.
- MMC; I believe Tom can comment on this one.
On a final note, I believe you should adjust your behaviour towards the mailing list. The U-Boot project, as well as many other FOSS projects, is a collective effort to achieve the best possible result for everyone. But for such model to work, everyone must first give and take only afterwards and never too much.
Best regards Marek Vasut
Ok. I already sent mail about problem 1) to video maintainer and also sent bug remainder to this list. Now I sent some more info about that problem, so maybe someone could help me.
I understand you, but mails without response look like ignored. Also now with U-Boot master Nokia port does not working, so it cannot be merged to master. I belive that you do not want/need not working code.
I'm not angry, but now I'm stucked, because I (and nobody other) was not able to fix problem 1) and problem 1) must be fixed before pushing rx51 patches to master. So I cannot work on rx51 patches...

On Sunday 04 March 2012 21:57:23 Marek Vasut wrote:
Dear Pali Rohar,
I suggest you to read through this whole mail properly, do not get angry by the first few lines.
U-Boot on Nokia N900 is broken due to bug in MMC and framebuffer driver. See: http://lists.denx.de/pipermail/u-boot/2012-January/115778.html http://lists.denx.de/pipermail/u-boot/2012-March/119330.html
Until now *nobody* responce to the first reported problem (2 months old). I will not do anything with Nokia N900 U-Boot code until both problem will be fixed!
Firstly, we are very grateful for properly reported bugs!
Yet you probably misunderstood how whole this free software/open source thing works.
If you found a bug noone else noticed, you are not ever supposed to expect people on the mailing list to fall on their backs, drop everything they are doing and start fixing your problem. This is because they didn't observe any trouble and so this has no priority for them.
And this is especially true for out-of-tree ports. N900 is good example of such category.
Now if you actually report a bug to the mailing list and this bug goes unnoticed for an extended period of time, you're supposed to send subsequent email in order to alarm the people on the mailing list the bug report is still relevant.
In case of U-Boot and Linux kernel, there is a list of maintainers in the MAINTAINERS file in the source tree, you are supposed to put these people in the Cc of such reports, this will greatly improve your chance of getting response and help. In case of U-Boot, there is also a list of custodians
available here: http://www.denx.de/wiki/U-Boot/Custodians
But considering you are yourself a software engineer, the best approach to the problem you're observing is to actually debug the issue you're seeing and submit a patch for it. Next, fix your patches for N900 and submit them. It'd be a good idea to put a note in the patchset cover message that this depends on your previous fix.
Now, to the problems you're observing:
- Video; check if you have the following defined in your board config:
#define CONFIG_VIDEO #define CONFIG_VIDEO_SW_CURSOR #define CONFIG_CFB_CONSOLE #define CONFIG_VGA_AS_SINGLE_DEVICE #define CONFIG_SYS_WHITE_ON_BLACK
I understand that you probably want to second and the last define from the list above, which solves your "invert" problem and swcursor problem.
- MMC; I believe Tom can comment on this one.
On a final note, I believe you should adjust your behaviour towards the mailing list. The U-Boot project, as well as many other FOSS projects, is a collective effort to achieve the best possible result for everyone. But for such model to work, everyone must first give and take only afterwards and never too much.
Best regards Marek Vasut
Dear Pali Rohar,
Ok. I already sent mail about problem 1) to video maintainer and also sent bug remainder to this list. Now I sent some more info about that problem, so maybe someone could help me.
Did you try the above solution for the video issues?
I understand you, but mails without response look like ignored.
That's why you need to prod, prod and prod ... in a sane way ;-)
Also now with U-Boot master Nokia port does not working, so it cannot be merged to master. I belive that you do not want/need not working code.
That's true, but you can always fix your issues locally and submit those fixed upstream, followed by your newly working code.
I'm not angry, but now I'm stucked, because I (and nobody other) was not able to fix problem 1) and problem 1) must be fixed before pushing rx51 patches to master. So I cannot work on rx51 patches...
So why don't YOU fix the problem? Maybe we should try diagnosing it?
I might have some time after NSWI075 on tuesday, ending 19:00, you might want to catch me afterwards and we can look into it for a bit?
Best regards Marek Vasut

On Sunday 04 March 2012 22:50:53 Marek Vasut wrote:
Did you try the above solution for the video issues?
Not yet. I will try it.
So why don't YOU fix the problem? Maybe we should try diagnosing it?
I might have some time after NSWI075 on tuesday, ending 19:00, you might want to catch me afterwards and we can look into it for a bit?
Sorry but in tuesday at that time I have NJAZ090 (which I really need)...

Dear Pali,
In message 2426868.sD2XDEqcqE@pali you wrote:
- Video; check if you have the following defined in your board config:
#define CONFIG_VIDEO #define CONFIG_VIDEO_SW_CURSOR #define CONFIG_CFB_CONSOLE #define CONFIG_VGA_AS_SINGLE_DEVICE #define CONFIG_SYS_WHITE_ON_BLACK
I understand that you probably want to second and the last define from the list above, which solves your "invert" problem and swcursor problem.
...
I'm not angry, but now I'm stucked, because I (and nobody other) was not able to fix problem 1) and problem 1) must be fixed before pushing rx51 patches to master. So I cannot work on rx51 patches...
Did you actually read what Marek wrote?
Did you check your configuration, and//or try changing it as suggested? What was the result?
Best regards,
Wolfgang Denk

On Sunday 04 March 2012 23:09:38 Wolfgang Denk wrote:
Dear Pali,
In message 2426868.sD2XDEqcqE@pali you wrote:
- Video; check if you have the following defined in your board config:
#define CONFIG_VIDEO #define CONFIG_VIDEO_SW_CURSOR #define CONFIG_CFB_CONSOLE #define CONFIG_VGA_AS_SINGLE_DEVICE #define CONFIG_SYS_WHITE_ON_BLACK
I understand that you probably want to second and the last define from the list above, which solves your "invert" problem and swcursor problem.
...
I'm not angry, but now I'm stucked, because I (and nobody other) was not able to fix problem 1) and problem 1) must be fixed before pushing rx51 patches to master. So I cannot work on rx51 patches...
Did you actually read what Marek wrote?
Did you check your configuration, and//or try changing it as suggested? What was the result?
Best regards,
Wolfgang Denk
Hi, I did not tried what Marek suggested yet. I will write if it worked or not

On Sunday 04 March 2012 16:35:44 Pali Rohár wrote:
I'm not angry, but now I'm stucked, because I (and nobody other) was not able to fix problem 1) and problem 1) must be fixed before pushing rx51 patches to master. So I cannot work on rx51 patches...
i don't think these things are true. you can push your patches even though there are known bugs in other pieces of the tree. i'm sure other people have done this before (i know i have). -mike

On Sunday 04 March 2012 23:26:29 Mike Frysinger wrote:
On Sunday 04 March 2012 16:35:44 Pali Rohár wrote:
I'm not angry, but now I'm stucked, because I (and nobody other) was not able to fix problem 1) and problem 1) must be fixed before pushing rx51 patches to master. So I cannot work on rx51 patches...
i don't think these things are true. you can push your patches even though there are known bugs in other pieces of the tree. i'm sure other people have done this before (i know i have). -mike
Ok, I can create new rx51 patch series, which fix known problmes in board code, but it will work only with reverted some commits.

On Monday 05 March 2012 16:58:47 Pali Rohár wrote:
On Sunday 04 March 2012 23:26:29 Mike Frysinger wrote:
On Sunday 04 March 2012 16:35:44 Pali Rohár wrote:
I'm not angry, but now I'm stucked, because I (and nobody other) was not able to fix problem 1) and problem 1) must be fixed before pushing rx51 patches to master. So I cannot work on rx51 patches...
i don't think these things are true. you can push your patches even though there are known bugs in other pieces of the tree. i'm sure other people have done this before (i know i have).
Ok, I can create new rx51 patch series, which fix known problmes in board code, but it will work only with reverted some commits.
presumably you're talking about mmc and video misbehavior in which case that's OK ... after all, nothing is stopping people from adding new changes which would break your board at runtime even after you merge. -mike

On Sunday 04 March 2012 21:57:23 Marek Vasut wrote:
- Video; check if you have the following defined in your board config:
#define CONFIG_VIDEO #define CONFIG_VIDEO_SW_CURSOR #define CONFIG_CFB_CONSOLE
Above options was already enabled.
#define CONFIG_VGA_AS_SINGLE_DEVICE
When I enabled this option U-Boot freezed. No idea why. So I did not enabled it again.
#define CONFIG_SYS_WHITE_ON_BLACK
This option has no effect on video output problem.
So adding these new definitions not helped me. But Anatolij Gustschin already sent patch which fixed this problem.

On Sunday 04 March 2012 15:21:23 Pali Rohár wrote:
U-Boot on Nokia N900 is broken due to bug in MMC and framebuffer driver. See: http://lists.denx.de/pipermail/u-boot/2012-January/115778.html http://lists.denx.de/pipermail/u-boot/2012-March/119330.html
Until now *nobody* responce to the first reported problem (2 months old). I will not do anything with Nokia N900 U-Boot code until both problem will be fixed!
this is an open source project. bugs don't get fixed just because you ask for them. there's a bit of give & take here. support for this board would be great, but it's not like other devs on this project need it in the tree. -mike

This patch series add support for new board Nokia RX-51 (aka N900). This patch series supersedes version v1. It was rebased on top of u-boot master and in this version was dropped BootMenu support.
Patch details:
Already commited (dropped) patches: arm,omap3: Define save_boot_params in lowlevel_init.S for SPL only
Dropped patches: Fix function readline in main.c cfb_console: Fix function console_scrollup New config variable CONFIG_MENUCMD New command bootmenu: ANSI terminal Boot Menu support RX-51: Add support for bootmenu
New patches: cfb_console: Fix function console_back cfb_console: Ignore bell character video: cfb_console: flush dcache for frame buffer in DRAM
Anatolij Gustschin (1): video: cfb_console: flush dcache for frame buffer in DRAM
Pali Rohár (10): arm: Optionally use existing atags in bootm.c Add power bus message definitions in twl4030.h cfb_console: Fix function console_back cfb_console: Add function console_clear and console_clear_line cfb_console: Add functions for moving with cursor cfb_console: Add support for some ANSI terminal escape codes cfb_console: Ignore bell character New command clear: Clear the ANSI terminal New config variable CONFIG_PREMONITOR New board support: Nokia RX-51 aka N900
README | 5 + arch/arm/lib/bootm.c | 60 +++--- board/nokia/rx51/Makefile | 46 +++++ board/nokia/rx51/lowlevel_init.S | 71 +++++++ board/nokia/rx51/rx51.c | 380 +++++++++++++++++++++++++++++++++++ board/nokia/rx51/rx51.h | 378 +++++++++++++++++++++++++++++++++++ boards.cfg | 1 + common/Makefile | 1 + common/cmd_clear.c | 42 ++++ common/env_common.c | 3 + common/main.c | 4 + drivers/video/cfb_console.c | 404 +++++++++++++++++++++++++++++++++++--- include/common.h | 7 + include/config_cmd_all.h | 1 + include/configs/nokia_rx51.h | 373 +++++++++++++++++++++++++++++++++++ include/twl4030.h | 98 +++++++++ 16 files changed, 1829 insertions(+), 45 deletions(-) create mode 100644 board/nokia/rx51/Makefile create mode 100644 board/nokia/rx51/lowlevel_init.S create mode 100644 board/nokia/rx51/rx51.c create mode 100644 board/nokia/rx51/rx51.h create mode 100644 common/cmd_clear.c create mode 100644 include/configs/nokia_rx51.h

This patch adapts the bootm command so that it can use an existing atags command set up by a previous bootloader. If the environment variable "atagaddr" is unset, bootm behaves as normal. If "atagaddr" is set, bootm will use atags address from environment variable and also append new boot args (if specified in u-boot). For example, if a previous boot loader already set up the atags struct at 0x80000100:
setenv atagaddr 0x80000100; bootm 0x80008000
Signed-off-by: Pali Rohár pali.rohar@gmail.com --- Changes since v1: - Rebased on u-boot master
Changes since original version: - Added info to README file - Added local define CONFIG_SETUP_ANY_TAG - Fixed compile warning - Fixed commit message - Check if atagaddr is not NULL
README | 2 ++ arch/arm/lib/bootm.c | 60 ++++++++++++++++++++++++++++++++------------------ 2 files changed, 40 insertions(+), 22 deletions(-)
diff --git a/README b/README index 43074cf..60ad9c2 100644 --- a/README +++ b/README @@ -3687,6 +3687,8 @@ Some configuration options can be set using Environment Variables.
List of environment variables (most likely not complete):
+ atagaddr - bootm will use ATAGs struct from specified address (arm only) + baudrate - see CONFIG_BAUDRATE
bootdelay - see CONFIG_BOOTDELAY diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c index 599547d..0f3c97b 100644 --- a/arch/arm/lib/bootm.c +++ b/arch/arm/lib/bootm.c @@ -42,6 +42,10 @@ DECLARE_GLOBAL_DATA_PTR; defined(CONFIG_INITRD_TAG) || \ defined(CONFIG_SERIAL_TAG) || \ defined(CONFIG_REVISION_TAG) + #define CONFIG_SETUP_ANY_TAG +#endif + +#ifdef CONFIG_SETUP_ANY_TAG static struct tag *params; #endif
@@ -106,11 +110,7 @@ static void announce_and_cleanup(void) cleanup_before_linux(); }
-#if defined(CONFIG_SETUP_MEMORY_TAGS) || \ - defined(CONFIG_CMDLINE_TAG) || \ - defined(CONFIG_INITRD_TAG) || \ - defined(CONFIG_SERIAL_TAG) || \ - defined(CONFIG_REVISION_TAG) +#ifdef CONFIG_SETUP_ANY_TAG static void setup_start_tag (bd_t *bd) { params = (struct tag *)bd->bi_boot_params; @@ -217,11 +217,7 @@ void setup_revision_tag(struct tag **in_params) } #endif
-#if defined(CONFIG_SETUP_MEMORY_TAGS) || \ - defined(CONFIG_CMDLINE_TAG) || \ - defined(CONFIG_INITRD_TAG) || \ - defined(CONFIG_SERIAL_TAG) || \ - defined(CONFIG_REVISION_TAG) +#ifdef CONFIG_SETUP_ANY_TAG static void setup_end_tag(bd_t *bd) { params->hdr.tag = ATAG_NONE; @@ -280,13 +276,23 @@ static void boot_prep_linux(bootm_headers_t *images) } else #endif { -#if defined(CONFIG_SETUP_MEMORY_TAGS) || \ - defined(CONFIG_CMDLINE_TAG) || \ - defined(CONFIG_INITRD_TAG) || \ - defined(CONFIG_SERIAL_TAG) || \ - defined(CONFIG_REVISION_TAG) + char *atagaddr = getenv("atagaddr"); debug("using: ATAGS\n"); - setup_start_tag(gd->bd); + + if (atagaddr) + gd->bd->bi_boot_params = simple_strtoul(atagaddr, NULL, 16); + + if (gd->bd->bi_boot_params) { + printf("Using existing atags at %#lx\n", gd->bd->bi_boot_params); + + params = (struct tag *) gd->bd->bi_boot_params; + while (params->hdr.size > 0) + params = tag_next(params); + } else { +#ifdef CONFIG_SETUP_ANY_TAG + setup_start_tag(gd->bd); +#endif + } #ifdef CONFIG_SERIAL_TAG setup_serial_tag(¶ms); #endif @@ -297,18 +303,28 @@ static void boot_prep_linux(bootm_headers_t *images) setup_revision_tag(¶ms); #endif #ifdef CONFIG_SETUP_MEMORY_TAGS - setup_memory_tags(gd->bd); + if (!atagaddr) + setup_memory_tags(gd->bd); #endif #ifdef CONFIG_INITRD_TAG if (images->rd_start && images->rd_end) setup_initrd_tag(gd->bd, images->rd_start, images->rd_end); #endif - setup_end_tag(gd->bd); -#else /* all tags */ - printf("FDT and ATAGS support not compiled in - hanging\n"); - hang(); -#endif /* all tags */ + if (atagaddr) { + if (params->hdr.size > 0) + setup_end_tag(gd->bd); + } else { +#ifdef CONFIG_SETUP_ANY_TAG + setup_end_tag(gd->bd); +#endif + } +#ifndef CONFIG_SETUP_ANY_TAG + if (!atagaddr) { + printf("FDT and ATAGS support not compiled in - hanging\n"); + hang(); + } +#endif } }

Dear =?UTF-8?q?Pali=20Roh=C3=A1r?=,
In message 1335634011-9104-2-git-send-email-pali.rohar@gmail.com you wrote:
VGhpcyBwYXRjaCBhZGFwdHMgdGhlIGJvb3RtIGNvbW1hbmQgc28gdGhhdCBpdCBjYW4gdXNlIGFu IGV4aXN0aW5nIGF0YWdzIGNvbW1hbmQKc2V0IHVwIGJ5IGEgcHJldmlvdXMgYm9vdGxvYWRlci4g SWYgdGhlIGVudmlyb25tZW50IHZhcmlhYmxlICJhdGFnYWRkciIgaXMgdW5zZXQsCmJvb3RtIGJl aGF2ZXMgYXMgbm9ybWFsLiBJZiAiYXRhZ2FkZHIiIGlzIHNldCwgYm9vdG0gd2lsbCB1c2UgYXRh Z3MgYWRkcmVzcyBmcm9tCmVudmlyb25tZW50IHZhcmlhYmxlIGFuZCBhbHNvIGFwcGVuZCBuZXcg
...
Please stop posting your patches with base64 Content-transfer-encoding; thanks.
Please also run all your patches through checkpatch _before_ posting, and fix warnings and errors.
For example, this patch has a number of too long lines which cause WARNING: line over 80 characters
Please fix all such issues, and resubmit.
Thanks.
Best regards,
Wolfgang Denk

On Saturday 28 April 2012 23:20:04 Wolfgang Denk wrote:
Please stop posting your patches with base64 Content-transfer-encoding; thanks.
How can I tell this to git format-patch and git send-email? Also I looked in my mailbox and all emails have no base64 header, but Content-Transfer-Encoding: 8bit
Please also run all your patches through checkpatch _before_ posting, and fix warnings and errors.
Ok, I forgot to run checkpatch on this patch. But I ran checkpatch on all other patches and checkpatch did not show any other warnings or errors.
For example, this patch has a number of too long lines which cause WARNING: line over 80 characters
Please fix all such issues, and resubmit.
Thanks.
Best regards,
Wolfgang Denk

Dear Pali =?ISO-8859-1?Q?Roh=E1r?=,
In message 2099459.BqkWJMp2Uq@pali you wrote:
On Saturday 28 April 2012 23:20:04 Wolfgang Denk wrote:
Please stop posting your patches with base64 Content-transfer-encoding; thanks.
How can I tell this to git format-patch and git send-email? Also I looked in my mailbox and all emails have no base64 header, but Content-Transfer-Encoding: 8bit
Do not use funny characters in the commit message.
Try sending a patch to yourself first and verify that git-send-email does not need to base64 encode it.
Such patches are also all undigestable by patchwork.
Best regards,
Wolfgang Denk

Dear Pali Rohár,
This patch adapts the bootm command so that it can use an existing atags command set up by a previous bootloader. If the environment variable "atagaddr" is unset, bootm behaves as normal. If "atagaddr" is set, bootm will use atags address from environment variable and also append new boot args (if specified in u-boot). For example, if a previous boot loader already set up the atags struct at 0x80000100:
Won't it be easier to create a preprocessing function that'd fill gd properly, so uboot can generate the atags through standard means then?
setenv atagaddr 0x80000100; bootm 0x80008000
Signed-off-by: Pali Rohár pali.rohar@gmail.com
Changes since v1:
- Rebased on u-boot master
Changes since original version:
- Added info to README file
- Added local define CONFIG_SETUP_ANY_TAG
- Fixed compile warning
- Fixed commit message
- Check if atagaddr is not NULL
README | 2 ++ arch/arm/lib/bootm.c | 60 ++++++++++++++++++++++++++++++++------------------ 2 files changed, 40 insertions(+), 22 deletions(-)
diff --git a/README b/README index 43074cf..60ad9c2 100644 --- a/README +++ b/README @@ -3687,6 +3687,8 @@ Some configuration options can be set using Environment Variables.
List of environment variables (most likely not complete):
atagaddr - bootm will use ATAGs struct from specified address (arm only)
baudrate - see CONFIG_BAUDRATE
bootdelay - see CONFIG_BOOTDELAY
diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c index 599547d..0f3c97b 100644 --- a/arch/arm/lib/bootm.c +++ b/arch/arm/lib/bootm.c @@ -42,6 +42,10 @@ DECLARE_GLOBAL_DATA_PTR; defined(CONFIG_INITRD_TAG) || \ defined(CONFIG_SERIAL_TAG) || \ defined(CONFIG_REVISION_TAG)
#define CONFIG_SETUP_ANY_TAG
+#endif
+#ifdef CONFIG_SETUP_ANY_TAG static struct tag *params; #endif
@@ -106,11 +110,7 @@ static void announce_and_cleanup(void) cleanup_before_linux(); }
-#if defined(CONFIG_SETUP_MEMORY_TAGS) || \
- defined(CONFIG_CMDLINE_TAG) || \
- defined(CONFIG_INITRD_TAG) || \
- defined(CONFIG_SERIAL_TAG) || \
- defined(CONFIG_REVISION_TAG)
+#ifdef CONFIG_SETUP_ANY_TAG static void setup_start_tag (bd_t *bd) { params = (struct tag *)bd->bi_boot_params; @@ -217,11 +217,7 @@ void setup_revision_tag(struct tag **in_params) } #endif
-#if defined(CONFIG_SETUP_MEMORY_TAGS) || \
- defined(CONFIG_CMDLINE_TAG) || \
- defined(CONFIG_INITRD_TAG) || \
- defined(CONFIG_SERIAL_TAG) || \
- defined(CONFIG_REVISION_TAG)
+#ifdef CONFIG_SETUP_ANY_TAG static void setup_end_tag(bd_t *bd) { params->hdr.tag = ATAG_NONE; @@ -280,13 +276,23 @@ static void boot_prep_linux(bootm_headers_t *images) } else #endif { -#if defined(CONFIG_SETUP_MEMORY_TAGS) || \
- defined(CONFIG_CMDLINE_TAG) || \
- defined(CONFIG_INITRD_TAG) || \
- defined(CONFIG_SERIAL_TAG) || \
- defined(CONFIG_REVISION_TAG)
debug("using: ATAGS\n");char *atagaddr = getenv("atagaddr");
setup_start_tag(gd->bd);
if (atagaddr)
gd->bd->bi_boot_params = simple_strtoul(atagaddr, NULL,
16);
if (gd->bd->bi_boot_params) {
printf("Using existing atags at %#lx\n", gd->bd-
bi_boot_params);
params = (struct tag *) gd->bd->bi_boot_params;
while (params->hdr.size > 0)
params = tag_next(params);
} else {
+#ifdef CONFIG_SETUP_ANY_TAG
setup_start_tag(gd->bd);
+#endif
}
#ifdef CONFIG_SERIAL_TAG setup_serial_tag(¶ms); #endif @@ -297,18 +303,28 @@ static void boot_prep_linux(bootm_headers_t *images) setup_revision_tag(¶ms); #endif #ifdef CONFIG_SETUP_MEMORY_TAGS
setup_memory_tags(gd->bd);
if (!atagaddr)
setup_memory_tags(gd->bd);
#endif #ifdef CONFIG_INITRD_TAG if (images->rd_start && images->rd_end) setup_initrd_tag(gd->bd, images->rd_start, images->rd_end); #endif
setup_end_tag(gd->bd);
-#else /* all tags */
printf("FDT and ATAGS support not compiled in - hanging\n");
hang();
-#endif /* all tags */
if (atagaddr) {
if (params->hdr.size > 0)
setup_end_tag(gd->bd);
} else {
+#ifdef CONFIG_SETUP_ANY_TAG
setup_end_tag(gd->bd);
+#endif
}
+#ifndef CONFIG_SETUP_ANY_TAG
if (!atagaddr) {
printf("FDT and ATAGS support not compiled in -
hanging\n");
hang();
}
+#endif } }

On Sunday 29 April 2012 00:15:23 Marek Vasut wrote:
Won't it be easier to create a preprocessing function that'd fill gd properly, so uboot can generate the atags through standard means then?
Do you mean to generate/copy other atags in board code? This will not work because u-boot (in bootm.c) always passing ATAG_CORE in function setup_start_tag. And I do not want to pass ATAG_CORE two times to kernel (once which I copy from other bootloader and once which generate u-boot).

Dear Pali Rohár,
On Sunday 29 April 2012 00:15:23 Marek Vasut wrote:
Won't it be easier to create a preprocessing function that'd fill gd properly, so uboot can generate the atags through standard means then?
Do you mean to generate/copy other atags in board code? This will not work because u-boot (in bootm.c) always passing ATAG_CORE in function setup_start_tag. And I do not want to pass ATAG_CORE two times to kernel (once which I copy from other bootloader and once which generate u-boot).
No, I mean parse the old ATAGS from nolo and fill u-boot's internal structures with that. Then let uboot generate the ATAGS from it's internal structures as usual.
Best regards, Marek Vasut

On Sunday 29 April 2012 11:10:42 Marek Vasut wrote:
Dear Pali Rohár,
On Sunday 29 April 2012 00:15:23 Marek Vasut wrote:
Won't it be easier to create a preprocessing function that'd fill gd properly, so uboot can generate the atags through standard means then?
Do you mean to generate/copy other atags in board code? This will not work because u-boot (in bootm.c) always passing ATAG_CORE in function setup_start_tag. And I do not want to pass ATAG_CORE two times to kernel (once which I copy from other bootloader and once which generate u-boot).
No, I mean parse the old ATAGS from nolo and fill u-boot's internal structures with that. Then let uboot generate the ATAGS from it's internal structures as usual.
Best regards, Marek Vasut
Ok, but what to do with non-standard omap/maemo atags which is used only for maemo (atag for bootreason, atag for bootmode ...)? U-Boot does not have internal structures for these non-standrad atags and also does not support passing it.

Dear Pali Rohár,
On Sunday 29 April 2012 11:10:42 Marek Vasut wrote:
Dear Pali Rohár,
On Sunday 29 April 2012 00:15:23 Marek Vasut wrote:
Won't it be easier to create a preprocessing function that'd fill gd properly, so uboot can generate the atags through standard means then?
Do you mean to generate/copy other atags in board code? This will not work because u-boot (in bootm.c) always passing ATAG_CORE in function setup_start_tag. And I do not want to pass ATAG_CORE two times to kernel (once which I copy from other bootloader and once which generate u-boot).
No, I mean parse the old ATAGS from nolo and fill u-boot's internal structures with that. Then let uboot generate the ATAGS from it's internal structures as usual.
Best regards, Marek Vasut
Ok, but what to do with non-standard omap/maemo atags which is used only for maemo (atag for bootreason, atag for bootmode ...)? U-Boot does not have internal structures for these non-standrad atags and also does not support passing it.
Implement support for passing ad-hoc additional non-standard atags then?
Best regards, Marek Vasut

On Sunday 29 April 2012 15:08:00 you wrote:
Dear Pali Rohár,
On Sunday 29 April 2012 11:10:42 Marek Vasut wrote:
Dear Pali Rohár,
On Sunday 29 April 2012 00:15:23 Marek Vasut wrote:
Won't it be easier to create a preprocessing function that'd fill gd properly, so uboot can generate the atags through standard means then?
Do you mean to generate/copy other atags in board code? This will not work because u-boot (in bootm.c) always passing ATAG_CORE in function setup_start_tag. And I do not want to pass ATAG_CORE two times to kernel (once which I copy from other bootloader and once which generate u-boot).
No, I mean parse the old ATAGS from nolo and fill u-boot's internal structures with that. Then let uboot generate the ATAGS from it's internal structures as usual.
Best regards, Marek Vasut
Ok, but what to do with non-standard omap/maemo atags which is used only for maemo (atag for bootreason, atag for bootmode ...)? U-Boot does not have internal structures for these non-standrad atags and also does not support passing it.
Implement support for passing ad-hoc additional non-standard atags then?
Best regards, Marek Vasut
Hi, what do you think about adding function setup_board_tags which will be implemented in board code?
diff --git a/arch/arm/include/asm/setup.h b/arch/arm/include/asm/setup.h index 89df4dc..572cb2a 100644 --- a/arch/arm/include/asm/setup.h +++ b/arch/arm/include/asm/setup.h @@ -267,3 +267,10 @@ struct meminfo { extern struct meminfo meminfo;
#endif + +/* + * Board specified tags + */ +#ifdef CONFIG_SETUP_BOARD_TAGS +void setup_board_tags(struct tag **in_params); +#endif diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c index 599547d..9c27405 100644 --- a/arch/arm/lib/bootm.c +++ b/arch/arm/lib/bootm.c @@ -111,6 +111,15 @@ static void announce_and_cleanup(void) defined(CONFIG_INITRD_TAG) || \ defined(CONFIG_SERIAL_TAG) || \ defined(CONFIG_REVISION_TAG) +#ifndef CONFIG_ATAG_CORE_FLAGS +#define CONFIG_ATAG_CORE_FLAGS 0 +#endif +#ifndef CONFIG_ATAG_CORE_PAGESIZE +#define CONFIG_ATAG_CORE_PAGESIZE 0 +#endif +#ifndef CONFIG_ATAG_CORE_ROOTDEV +#define CONFIG_ATAG_CORE_ROOTDEV 0 +#endif static void setup_start_tag (bd_t *bd) { params = (struct tag *)bd->bi_boot_params; @@ -118,9 +127,9 @@ static void setup_start_tag (bd_t *bd) params->hdr.tag = ATAG_CORE; params->hdr.size = tag_size (tag_core);
- params->u.core.flags = 0; - params->u.core.pagesize = 0; - params->u.core.rootdev = 0; + params->u.core.flags = CONFIG_ATAG_CORE_FLAGS; + params->u.core.pagesize = CONFIG_ATAG_CORE_PAGESIZE; + params->u.core.rootdev = CONFIG_ATAG_CORE_ROOTDEV;
params = tag_next (params); } @@ -304,6 +313,9 @@ static void boot_prep_linux(bootm_headers_t *images) setup_initrd_tag(gd->bd, images->rd_start, images->rd_end); #endif +#ifdef CONFIG_SETUP_BOARD_TAGS + setup_board_tags(¶ms); +#endif setup_end_tag(gd->bd); #else /* all tags */ printf("FDT and ATAGS support not compiled in - hanging\n");

On Saturday 28 April 2012 13:26:41 Pali Rohár wrote:
defined(CONFIG_INITRD_TAG) || \ defined(CONFIG_SERIAL_TAG) || \ defined(CONFIG_REVISION_TAG)
#define CONFIG_SETUP_ANY_TAG
don't indent the "#" -mike

On Saturday 28 April 2012 19:22:38 Mike Frysinger wrote:
On Saturday 28 April 2012 13:26:41 Pali Rohár wrote:
defined(CONFIG_INITRD_TAG) || \ defined(CONFIG_SERIAL_TAG) || \ defined(CONFIG_REVISION_TAG)
#define CONFIG_SETUP_ANY_TAG
don't indent the "#" -mike
Ok.

* Code copied from linux kernel 3.0.0 from file include/linux/i2c/twl.h
Signed-off-by: Pali Rohár pali.rohar@gmail.com --- Changes since original version: - Fixed commit message
include/twl4030.h | 98 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+)
diff --git a/include/twl4030.h b/include/twl4030.h index 9cd32ab..0c17f59 100644 --- a/include/twl4030.h +++ b/include/twl4030.h @@ -151,6 +151,103 @@ #define TWL4030_PM_MASTER_SW_EVENTS_DEVSLP (1 << 1) #define TWL4030_PM_MASTER_SW_EVENTS_DEVOFF (1 << 0)
+/* Power bus message definitions */ + +/* The TWL4030/5030 splits its power-management resources (the various + * regulators, clock and reset lines) into 3 processor groups - P1, P2 and + * P3. These groups can then be configured to transition between sleep, wait-on + * and active states by sending messages to the power bus. See Section 5.4.2 + * Power Resources of TWL4030 TRM + */ + +/* Processor groups */ +#define DEV_GRP_NULL 0x0 +#define DEV_GRP_P1 0x1 /* P1: all OMAP devices */ +#define DEV_GRP_P2 0x2 /* P2: all Modem devices */ +#define DEV_GRP_P3 0x4 /* P3: all peripheral devices */ + +/* Resource groups */ +#define RES_GRP_RES 0x0 /* Reserved */ +#define RES_GRP_PP 0x1 /* Power providers */ +#define RES_GRP_RC 0x2 /* Reset and control */ +#define RES_GRP_PP_RC 0x3 +#define RES_GRP_PR 0x4 /* Power references */ +#define RES_GRP_PP_PR 0x5 +#define RES_GRP_RC_PR 0x6 +#define RES_GRP_ALL 0x7 /* All resource groups */ + +#define RES_TYPE2_R0 0x0 + +#define RES_TYPE_ALL 0x7 + +/* Resource states */ +#define RES_STATE_WRST 0xF +#define RES_STATE_ACTIVE 0xE +#define RES_STATE_SLEEP 0x8 +#define RES_STATE_OFF 0x0 + +/* Power resources */ + +/* Power providers */ +#define RES_VAUX1 1 +#define RES_VAUX2 2 +#define RES_VAUX3 3 +#define RES_VAUX4 4 +#define RES_VMMC1 5 +#define RES_VMMC2 6 +#define RES_VPLL1 7 +#define RES_VPLL2 8 +#define RES_VSIM 9 +#define RES_VDAC 10 +#define RES_VINTANA1 11 +#define RES_VINTANA2 12 +#define RES_VINTDIG 13 +#define RES_VIO 14 +#define RES_VDD1 15 +#define RES_VDD2 16 +#define RES_VUSB_1V5 17 +#define RES_VUSB_1V8 18 +#define RES_VUSB_3V1 19 +#define RES_VUSBCP 20 +#define RES_REGEN 21 +/* Reset and control */ +#define RES_NRES_PWRON 22 +#define RES_CLKEN 23 +#define RES_SYSEN 24 +#define RES_HFCLKOUT 25 +#define RES_32KCLKOUT 26 +#define RES_RESET 27 +/* Power Reference */ +#define RES_Main_Ref 28 + +#define TOTAL_RESOURCES 28 +/* + * Power Bus Message Format ... these can be sent individually by Linux, + * but are usually part of downloaded scripts that are run when various + * power events are triggered. + * + * Broadcast Message (16 Bits): + * DEV_GRP[15:13] MT[12] RES_GRP[11:9] RES_TYPE2[8:7] RES_TYPE[6:4] + * RES_STATE[3:0] + * + * Singular Message (16 Bits): + * DEV_GRP[15:13] MT[12] RES_ID[11:4] RES_STATE[3:0] + */ + +#define MSG_BROADCAST(devgrp, grp, type, type2, state) \ + ((devgrp) << 13 | 1 << 12 | (grp) << 9 | (type2) << 7 \ + | (type) << 4 | (state)) + +#define MSG_SINGULAR(devgrp, id, state) \ + ((devgrp) << 13 | 0 << 12 | (id) << 4 | (state)) + +#define MSG_BROADCAST_ALL(devgrp, state) \ + ((devgrp) << 5 | (state)) + +#define MSG_BROADCAST_REF MSG_BROADCAST_ALL +#define MSG_BROADCAST_PROV MSG_BROADCAST_ALL +#define MSG_BROADCAST__CLK_RST MSG_BROADCAST_ALL + /* Power Managment Receiver */ #define TWL4030_PM_RECEIVER_SC_CONFIG 0x5B #define TWL4030_PM_RECEIVER_SC_DETECT1 0x5C @@ -311,6 +408,7 @@ #define TWL4030_PM_RECEIVER_VDAC_VSEL_18 0x03 #define TWL4030_PM_RECEIVER_VMMC1_VSEL_30 0x02 #define TWL4030_PM_RECEIVER_VMMC1_VSEL_32 0x03 +#define TWL4030_PM_RECEIVER_VSIM_VSEL_18 0x03
/* Device Selection in PM Receiver Module */ #define TWL4030_PM_RECEIVER_DEV_GRP_P1 0x20

* Do not disable and enable cursor again
Signed-off-by: Pali Rohár pali.rohar@gmail.com --- drivers/video/cfb_console.c | 2 -- 1 file changed, 2 deletions(-)
diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c index 904caf7..51ea167 100644 --- a/drivers/video/cfb_console.c +++ b/drivers/video/cfb_console.c @@ -721,7 +721,6 @@ static void console_scrollup(void)
static void console_back(void) { - CURSOR_OFF; console_col--;
if (console_col < 0) { @@ -730,7 +729,6 @@ static void console_back(void) if (console_row < 0) console_row = 0; } - CURSOR_SET; }
static void console_newline(void)

Dear Pali Rohár,
- Do not disable and enable cursor again
Can you elaborate please?
Signed-off-by: Pali Rohár pali.rohar@gmail.com
drivers/video/cfb_console.c | 2 -- 1 file changed, 2 deletions(-)
diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c index 904caf7..51ea167 100644 --- a/drivers/video/cfb_console.c +++ b/drivers/video/cfb_console.c @@ -721,7 +721,6 @@ static void console_scrollup(void)
static void console_back(void) {
CURSOR_OFF; console_col--;
if (console_col < 0) {
@@ -730,7 +729,6 @@ static void console_back(void) if (console_row < 0) console_row = 0; }
- CURSOR_SET;
}
static void console_newline(void)
Best regards, Marek Vasut

On Sunday 29 April 2012 00:15:58 Marek Vasut wrote:
Dear Pali Rohár,
- Do not disable and enable cursor again
Can you elaborate please?
console_back is called only from cfb putc function which already turn off cursor at begin and turn on at the end of call.
So function console_back will have always disabled cursor and is not needed to call turning it off again.

Dear Pali =?ISO-8859-1?Q?Roh=E1r?=,
In message 1581447.hx3godgTju@pali you wrote:
Can you elaborate please?
console_back is called only from cfb putc function which already turn off cursor at begin and turn on at the end of call.
So function console_back will have always disabled cursor and is not needed to call turning it off again.
Such assumptions need to be documented, then.
Best regards,
Wolfgang Denk

Hi,
On Sat, 28 Apr 2012 19:26:43 +0200 Pali Rohár pali.rohar@gmail.com wrote:
- Do not disable and enable cursor again
Signed-off-by: Pali Rohár pali.rohar@gmail.com
drivers/video/cfb_console.c | 2 -- 1 file changed, 2 deletions(-)
Applied to u-boot-video/master after extending the commit log.
Thanks, Anatolij

On Saturday 19 May 2012 21:16:13 Anatolij Gustschin wrote:
Hi,
On Sat, 28 Apr 2012 19:26:43 +0200
Pali Rohár pali.rohar@gmail.com wrote:
- Do not disable and enable cursor again
Signed-off-by: Pali Rohár pali.rohar@gmail.com
drivers/video/cfb_console.c | 2 -- 1 file changed, 2 deletions(-)
Applied to u-boot-video/master after extending the commit log.
Thanks, Anatolij
Ok, when this patch will be in u-boot master?

Hi,
On Fri, 01 Jun 2012 20:42:29 +0200 Pali Rohár pali.rohar@gmail.com wrote: ...
Ok, when this patch will be in u-boot master?
I'm going to submit my pull request soon. It will be in master when Wolfgang pulls my tree.
Thanks, Anatolij

* console_clear - clear full console framebuffer output * console_clear_line - clear part of specified line (or full)
Signed-off-by: Pali Rohár pali.rohar@gmail.com --- Changes since original version: - Fixed commit message
drivers/video/cfb_console.c | 64 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 52 insertions(+), 12 deletions(-)
diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c index 51ea167..0d1e6b2 100644 --- a/drivers/video/cfb_console.c +++ b/drivers/video/cfb_console.c @@ -683,6 +683,57 @@ static void memcpyl(int *d, int *s, int c) } #endif
+static void console_clear(void) +{ +#ifdef VIDEO_HW_RECTFILL + video_hw_rectfill(VIDEO_PIXEL_SIZE, /* bytes per pixel */ + 0, /* dest pos x */ + video_logo_height, /* dest pos y */ + VIDEO_VISIBLE_COLS, /* frame width */ + VIDEO_VISIBLE_ROWS, /* frame height */ + bgx /* fill color */ + ); +#else + memsetl(CONSOLE_ROW_FIRST, CONSOLE_SIZE, bgx); +#endif +} + +static void console_clear_line(int line, int begin, int end) +{ +#ifdef VIDEO_HW_RECTFILL + video_hw_rectfill(VIDEO_PIXEL_SIZE, /* bytes per pixel */ + /* FIXME: correct? */ + VIDEO_FONT_WIDTH * begin, /* dest pos x */ + /* FIXME: correct? */ + video_logo_height + + CONSOLE_ROW_SIZE * line, /* dest pos y */ + /* FIXME: correct? */ + VIDEO_FONT_WIDTH * (end - begin), /* frame width */ + VIDEO_FONT_HEIGHT, /* frame height */ + bgx /* fill color */ + ); +#else + int i; + if (begin == 0 && end == CONSOLE_COLS) + memsetl(CONSOLE_ROW_FIRST + + CONSOLE_ROW_SIZE * line, /* offset of row */ + CONSOLE_ROW_SIZE >> 2, /* length of row */ + bgx /* fill color */ + ); + else + for (i = 0; i < VIDEO_FONT_HEIGHT; ++i) + memsetl(CONSOLE_ROW_FIRST + + CONSOLE_ROW_SIZE * line + /* offset of row */ + VIDEO_FONT_WIDTH * + VIDEO_PIXEL_SIZE * begin + /* offset of col */ + i * VIDEO_LINE_LEN, /* col offset of i line */ + (VIDEO_FONT_WIDTH * VIDEO_PIXEL_SIZE * + (end - begin + 1)) >> 2, /* length to end */ + bgx /* fill color */ + ); +#endif +} + static void console_scrollup(void) { /* copy up rows ignoring the first one */ @@ -705,18 +756,7 @@ static void console_scrollup(void) #endif
/* clear the last one */ -#ifdef VIDEO_HW_RECTFILL - video_hw_rectfill(VIDEO_PIXEL_SIZE, /* bytes per pixel */ - 0, /* dest pos x */ - VIDEO_VISIBLE_ROWS - - VIDEO_FONT_HEIGHT, /* dest pos y */ - VIDEO_VISIBLE_COLS, /* frame width */ - VIDEO_FONT_HEIGHT, /* frame height */ - CONSOLE_BG_COL /* fill color */ - ); -#else - memsetl(CONSOLE_ROW_LAST, CONSOLE_ROW_SIZE >> 2, CONSOLE_BG_COL); -#endif + console_clear_line(CONSOLE_ROWS-1, 0, CONSOLE_COLS); }
static void console_back(void)

Dear Pali Rohár,
- console_clear - clear full console framebuffer output
- console_clear_line - clear part of specified line (or full)
Signed-off-by: Pali Rohár pali.rohar@gmail.com
Changes since original version:
- Fixed commit message
drivers/video/cfb_console.c | 64 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 52 insertions(+), 12 deletions(-)
diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c index 51ea167..0d1e6b2 100644 --- a/drivers/video/cfb_console.c +++ b/drivers/video/cfb_console.c @@ -683,6 +683,57 @@ static void memcpyl(int *d, int *s, int c) } #endif
+static void console_clear(void) +{ +#ifdef VIDEO_HW_RECTFILL
- video_hw_rectfill(VIDEO_PIXEL_SIZE, /* bytes per pixel */
0, /* dest pos x */
video_logo_height, /* dest pos y */
VIDEO_VISIBLE_COLS, /* frame width */
VIDEO_VISIBLE_ROWS, /* frame height */
bgx /* fill color */
- );
+#else
- memsetl(CONSOLE_ROW_FIRST, CONSOLE_SIZE, bgx);
+#endif +}
+static void console_clear_line(int line, int begin, int end) +{ +#ifdef VIDEO_HW_RECTFILL
- video_hw_rectfill(VIDEO_PIXEL_SIZE, /* bytes per pixel */
/* FIXME: correct? */
VIDEO_FONT_WIDTH * begin, /* dest pos x */
Maybe you want to prepare these parameters into some variables at the begining of this function? Also, your comments make no sense.
/* FIXME: correct? */
video_logo_height +
CONSOLE_ROW_SIZE * line, /* dest pos y */
/* FIXME: correct? */
Uh ... fixme ;-)
VIDEO_FONT_WIDTH * (end - begin), /* frame width */
VIDEO_FONT_HEIGHT, /* frame height */
bgx /* fill color */
);
+#else
- int i;
- if (begin == 0 && end == CONSOLE_COLS)
memsetl(CONSOLE_ROW_FIRST +
CONSOLE_ROW_SIZE * line, /* offset of row */
CONSOLE_ROW_SIZE >> 2, /* length of row */
bgx /* fill color */
);
- else
for (i = 0; i < VIDEO_FONT_HEIGHT; ++i)
memsetl(CONSOLE_ROW_FIRST +
CONSOLE_ROW_SIZE * line + /* offset of row */
VIDEO_FONT_WIDTH *
VIDEO_PIXEL_SIZE * begin + /* offset of col */
i * VIDEO_LINE_LEN, /* col offset of i line */
(VIDEO_FONT_WIDTH * VIDEO_PIXEL_SIZE *
(end - begin + 1)) >> 2, /* length to end */
bgx /* fill color */
);
+#endif +}
static void console_scrollup(void) { /* copy up rows ignoring the first one */ @@ -705,18 +756,7 @@ static void console_scrollup(void) #endif
/* clear the last one */ -#ifdef VIDEO_HW_RECTFILL
- video_hw_rectfill(VIDEO_PIXEL_SIZE, /* bytes per pixel */
0, /* dest pos x */
VIDEO_VISIBLE_ROWS
- VIDEO_FONT_HEIGHT, /* dest pos y */
VIDEO_VISIBLE_COLS, /* frame width */
VIDEO_FONT_HEIGHT, /* frame height */
CONSOLE_BG_COL /* fill color */
);
-#else
- memsetl(CONSOLE_ROW_LAST, CONSOLE_ROW_SIZE >> 2, CONSOLE_BG_COL);
-#endif
- console_clear_line(CONSOLE_ROWS-1, 0, CONSOLE_COLS);
}
static void console_back(void)

* console_cursor_fix - fix cursor position (check for out of screen) * console_cursor_up, console_cursor_down, console_cursor_left, console_cursor_right, console_cursor_set_position for change cursor position * console_newline - added param to specify count of creating new lines * console_previewsline - opposite of console_newline
Signed-off-by: Pali Rohár pali.rohar@gmail.com --- Changes since original version: - Fixed commit message
drivers/video/cfb_console.c | 64 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 58 insertions(+), 6 deletions(-)
diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c index 0d1e6b2..43eb994 100644 --- a/drivers/video/cfb_console.c +++ b/drivers/video/cfb_console.c @@ -771,9 +771,54 @@ static void console_back(void) } }
-static void console_newline(void) +static void console_cursor_fix(void) { - console_row++; + if (console_row < 0) + console_row = 0; + if (console_row >= CONSOLE_ROWS) + console_row = CONSOLE_ROWS-1; + if (console_col < 0) + console_col = 0; + if (console_col >= CONSOLE_COLS) + console_col = CONSOLE_COLS-1; +} + +static void console_cursor_up(int n) +{ + console_row -= n; + console_cursor_fix(); +} + +static void console_cursor_down(int n) +{ + console_row += n; + console_cursor_fix(); +} + +static void console_cursor_left(int n) +{ + console_col -= n; + console_cursor_fix(); +} + +static void console_cursor_right(int n) +{ + console_col += n; + console_cursor_fix(); +} + +static void console_cursor_set_position(int row, int col) +{ + if (console_row != -1) + console_row = row; + if (console_col != -1) + console_col = col; + console_cursor_fix(); +} + +static void console_newline(int n) +{ + console_row += n; console_col = 0;
/* Check if we need to scroll the terminal */ @@ -782,10 +827,17 @@ static void console_newline(void) console_scrollup();
/* Decrement row number */ - console_row--; + console_row = CONSOLE_ROWS-1; } }
+static void console_previewsline(int n) +{ + /* FIXME: also scroll terminal ? */ + console_row -= n; + console_cursor_fix(); +} + static void console_cr(void) { console_col = 0; @@ -804,7 +856,7 @@ void video_putc(const char c)
case '\n': /* next line */ if (console_col || (!console_col && nl)) - console_newline(); + console_newline(1); nl = 1; break;
@@ -813,7 +865,7 @@ void video_putc(const char c) console_col &= ~0x0007;
if (console_col >= CONSOLE_COLS) - console_newline(); + console_newline(1); break;
case 8: /* backspace */ @@ -827,7 +879,7 @@ void video_putc(const char c)
/* check for newline */ if (console_col >= CONSOLE_COLS) { - console_newline(); + console_newline(1); nl = 0; } }

Dear Pali Rohár,
- console_cursor_fix - fix cursor position (check for out of screen)
- console_cursor_up, console_cursor_down, console_cursor_left, console_cursor_right, console_cursor_set_position for change cursor
position * console_newline - added param to specify count of creating new lines * console_previewsline - opposite of console_newline
How/where do you use these? Documentation entry is missing and there're no comments in the code.
Signed-off-by: Pali Rohár pali.rohar@gmail.com
Changes since original version:
- Fixed commit message
drivers/video/cfb_console.c | 64 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 58 insertions(+), 6 deletions(-)
diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c index 0d1e6b2..43eb994 100644 --- a/drivers/video/cfb_console.c +++ b/drivers/video/cfb_console.c @@ -771,9 +771,54 @@ static void console_back(void) } }
-static void console_newline(void) +static void console_cursor_fix(void) {
- console_row++;
- if (console_row < 0)
console_row = 0;
- if (console_row >= CONSOLE_ROWS)
console_row = CONSOLE_ROWS-1;
- if (console_col < 0)
console_col = 0;
- if (console_col >= CONSOLE_COLS)
console_col = CONSOLE_COLS-1;
+}
+static void console_cursor_up(int n) +{
- console_row -= n;
- console_cursor_fix();
+}
+static void console_cursor_down(int n) +{
- console_row += n;
- console_cursor_fix();
+}
+static void console_cursor_left(int n) +{
- console_col -= n;
- console_cursor_fix();
+}
+static void console_cursor_right(int n) +{
- console_col += n;
- console_cursor_fix();
+}
+static void console_cursor_set_position(int row, int col) +{
- if (console_row != -1)
console_row = row;
- if (console_col != -1)
console_col = col;
- console_cursor_fix();
+}
+static void console_newline(int n) +{
console_row += n; console_col = 0;
/* Check if we need to scroll the terminal */
@@ -782,10 +827,17 @@ static void console_newline(void) console_scrollup();
/* Decrement row number */
console_row--;
}console_row = CONSOLE_ROWS-1;
}
+static void console_previewsline(int n) +{
- /* FIXME: also scroll terminal ? */
- console_row -= n;
- console_cursor_fix();
+}
static void console_cr(void) { console_col = 0; @@ -804,7 +856,7 @@ void video_putc(const char c)
case '\n': /* next line */ if (console_col || (!console_col && nl))
console_newline();
nl = 1; break;console_newline(1);
@@ -813,7 +865,7 @@ void video_putc(const char c) console_col &= ~0x0007;
if (console_col >= CONSOLE_COLS)
console_newline();
console_newline(1);
break;
case 8: /* backspace */
@@ -827,7 +879,7 @@ void video_putc(const char c)
/* check for newline */ if (console_col >= CONSOLE_COLS) {
console_newline();
} }console_newline(1); nl = 0;

On Sunday 29 April 2012 00:18:21 Marek Vasut wrote:
Dear Pali Rohár,
- console_cursor_fix - fix cursor position (check for out of
screen) * console_cursor_up, console_cursor_down, console_cursor_left,> console_cursor_right, console_cursor_set_position for change cursor> position * console_newline - added param to specify count of creating new lines * console_previewsline - opposite of console_newline
How/where do you use these? Documentation entry is missing and there're no comments in the code.
In ansi terminal.

Dear Pali Rohár,
On Sunday 29 April 2012 00:18:21 Marek Vasut wrote:
Dear Pali Rohár,
- console_cursor_fix - fix cursor position (check for out of
screen) * console_cursor_up, console_cursor_down, console_cursor_left,>
console_cursor_right, console_cursor_set_position for change cursor>
position * console_newline - added param to specify count of creating new lines * console_previewsline - opposite of console_newline
How/where do you use these? Documentation entry is missing and there're no comments in the code.
In ansi terminal.
Mailing list isn't really the proper place for documentation ;-)
Best regards, Marek Vasut

Dear Pali =?ISO-8859-1?Q?Roh=E1r?=,
In message 1704132.kQI9AKOLjq@pali you wrote:
How/where do you use these? Documentation entry is missing and there're no comments in the code.
In ansi terminal.
I cannot parse this. Where is the documentation?
Best regards,
Wolfgang Denk

From: Pali Rohár pali.rohar@gmail.com
console_clear_line() clears part of specified line or the full line.
Signed-off-by: Pali Rohár pali.rohar@gmail.com Signed-off-by: Anatolij Gustschin agust@denx.de --- Changes since v2: - remove console_clear() from this patch, it should be added in another patch which uses this function - fix arguments for hw accelerated fill and drop FIXME comments - fix console_clear_line() end argument, as we start counting columns from zero - fix coding style - extend comments - tested the code with hw accelerated fill
drivers/video/cfb_console.c | 49 +++++++++++++++++++++++++++++++----------- 1 files changed, 36 insertions(+), 13 deletions(-)
diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c index 51ea167..6fa61d2 100644 --- a/drivers/video/cfb_console.c +++ b/drivers/video/cfb_console.c @@ -683,6 +683,41 @@ static void memcpyl(int *d, int *s, int c) } #endif
+static void console_clear_line(int line, int begin, int end) +{ +#ifdef VIDEO_HW_RECTFILL + video_hw_rectfill(VIDEO_PIXEL_SIZE, /* bytes per pixel */ + VIDEO_FONT_WIDTH * begin, /* dest pos x */ + video_logo_height + + VIDEO_FONT_HEIGHT * line, /* dest pos y */ + VIDEO_FONT_WIDTH * (end - begin + 1), /* fr. width */ + VIDEO_FONT_HEIGHT, /* frame height */ + bgx /* fill color */ + ); +#else + if (begin == 0 && (end + 1) == CONSOLE_COLS) { + memsetl(CONSOLE_ROW_FIRST + + CONSOLE_ROW_SIZE * line, /* offset of row */ + CONSOLE_ROW_SIZE >> 2, /* length of row */ + bgx /* fill color */ + ); + } else { + void *offset; + int i, size; + + offset = CONSOLE_ROW_FIRST + + CONSOLE_ROW_SIZE * line + /* offset of row */ + VIDEO_FONT_WIDTH * + VIDEO_PIXEL_SIZE * begin; /* offset of col */ + size = VIDEO_FONT_WIDTH * VIDEO_PIXEL_SIZE * (end - begin + 1); + size >>= 2; /* length to end for memsetl() */ + /* fill at col offset of i'th line using bgx as fill color */ + for (i = 0; i < VIDEO_FONT_HEIGHT; i++) + memsetl(offset + i * VIDEO_LINE_LEN, size, bgx); + } +#endif +} + static void console_scrollup(void) { /* copy up rows ignoring the first one */ @@ -703,20 +738,8 @@ static void console_scrollup(void) memcpyl(CONSOLE_ROW_FIRST, CONSOLE_ROW_SECOND, CONSOLE_SCROLL_SIZE >> 2); #endif - /* clear the last one */ -#ifdef VIDEO_HW_RECTFILL - video_hw_rectfill(VIDEO_PIXEL_SIZE, /* bytes per pixel */ - 0, /* dest pos x */ - VIDEO_VISIBLE_ROWS - - VIDEO_FONT_HEIGHT, /* dest pos y */ - VIDEO_VISIBLE_COLS, /* frame width */ - VIDEO_FONT_HEIGHT, /* frame height */ - CONSOLE_BG_COL /* fill color */ - ); -#else - memsetl(CONSOLE_ROW_LAST, CONSOLE_ROW_SIZE >> 2, CONSOLE_BG_COL); -#endif + console_clear_line(CONSOLE_ROWS - 1, 0, CONSOLE_COLS - 1); }
static void console_back(void)

On Sun, 20 May 2012 22:38:08 +0200 Anatolij Gustschin agust@denx.de wrote:
From: Pali Rohár pali.rohar@gmail.com
console_clear_line() clears part of specified line or the full line.
The patch numbering is wrong, actually it should be [PATCH v3 04/11]. Sorry about that.
Thanks, Anatolij

On Sun, 20 May 2012 22:38:08 +0200 Anatolij Gustschin agust@denx.de wrote:
From: Pali Rohár pali.rohar@gmail.com
console_clear_line() clears part of specified line or the full line.
Signed-off-by: Pali Rohár pali.rohar@gmail.com Signed-off-by: Anatolij Gustschin agust@denx.de
Changes since v2:
- remove console_clear() from this patch, it should be added in another patch which uses this function
- fix arguments for hw accelerated fill and drop FIXME comments
- fix console_clear_line() end argument, as we start counting columns from zero
- fix coding style
- extend comments
- tested the code with hw accelerated fill
drivers/video/cfb_console.c | 49 +++++++++++++++++++++++++++++++----------- 1 files changed, 36 insertions(+), 13 deletions(-)
Applied to u-boot-video/master. Thanks!
Anatolij

* This patch add support for move cursor and reverse colors via ANSI espace codes in cfb_console driver * ANSI escape codes can be enabled/disabled via CONFIG_CFB_CONSOLE_ANSI
Signed-off-by: Pali Rohár pali.rohar@gmail.com --- Changes since v1: - Added support ANSI code show/hide cursor - Added info to README
Changes since original version: - Fixed commit message
README | 3 + drivers/video/cfb_console.c | 234 ++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 234 insertions(+), 3 deletions(-)
diff --git a/README b/README index 60ad9c2..4a610f7 100644 --- a/README +++ b/README @@ -613,6 +613,9 @@ The following options need to be configured: additional board info beside the logo
+ When CONFIG_CFB_CONSOLE_ANSI is defined, console will have + ANSI terminal support. Needed for CONFIG_CMDLINE_EDITING. + When CONFIG_CFB_CONSOLE is defined, video console is default i/o. Serial console can be forced with environment 'console=serial'. diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c index 43eb994..c9f9765 100644 --- a/drivers/video/cfb_console.c +++ b/drivers/video/cfb_console.c @@ -377,6 +377,11 @@ static int console_row; /* cursor row */
static u32 eorx, fgx, bgx; /* color pats */
+static char ansi_buf[10] = { 0, }; +static int ansi_buf_size; +static int ansi_colors_need_revert; +static int ansi_cursor_hidden; + static const int video_font_draw_table8[] = { 0x00000000, 0x000000ff, 0x0000ff00, 0x0000ffff, 0x00ff0000, 0x00ff00ff, 0x00ffff00, 0x00ffffff, @@ -602,6 +607,14 @@ static void video_putchar(int xx, int yy, unsigned char c) video_drawchars(xx, yy + video_logo_height, &c, 1); }
+static void console_swap_colors(void) +{ + eorx = fgx; + fgx = bgx; + bgx = eorx; + eorx = fgx ^ bgx; +} + #if defined(CONFIG_CONSOLE_CURSOR) || defined(CONFIG_VIDEO_SW_CURSOR) static void video_set_cursor(void) { @@ -843,11 +856,12 @@ static void console_cr(void) console_col = 0; }
-void video_putc(const char c) +static void parse_putc(const char c) { static int nl = 1;
- CURSOR_OFF; + if (!ansi_cursor_hidden) + CURSOR_OFF;
switch (c) { case 13: /* back to first column */ @@ -883,7 +897,221 @@ void video_putc(const char c) nl = 0; } } - CURSOR_SET; + + if (!ansi_cursor_hidden) + CURSOR_SET; +} + +void video_putc(const char c) +{ +#ifdef CONFIG_CFB_CONSOLE_ANSI + int i; + + if (c == 27) { + for (i = 0; i < ansi_buf_size; ++i) + parse_putc(ansi_buf[i]); + ansi_buf[0] = 27; + ansi_buf_size = 1; + return; + } + + if (ansi_buf_size > 0) { + /* + 0 - ESC + 1 - [ + 2 - num1 + 3 - .. + 4 - ; + 5 - num2 + 6 - .. + 7 - cchar + */ + int next = 0; + + int flush = 0; + int fail = 0; + + int num1 = 0; + int num2 = 0; + int cchar = 0; + + ansi_buf[ansi_buf_size++] = c; + + if (ansi_buf_size >= sizeof(ansi_buf)) + fail = 1; + + for (i = 0; i < ansi_buf_size; ++i) { + if (fail) + break; + + switch (next) { + case 0: + if (ansi_buf[i] == 27) + next = 1; + else + fail = 1; + break; + + case 1: + if (ansi_buf[i] == '[') + next = 2; + else + fail = 1; + break; + + case 2: + if (ansi_buf[i] >= '0' && ansi_buf[i] <= '9') { + num1 = ansi_buf[i]-'0'; + next = 3; + } else if (ansi_buf[i] != '?') { + --i; + num1 = 1; + next = 4; + } + break; + + case 3: + if (ansi_buf[i] >= '0' && ansi_buf[i] <= '9') { + num1 *= 10; + num1 += ansi_buf[i]-'0'; + } else { + --i; + next = 4; + } + break; + + case 4: + if (ansi_buf[i] != ';') { + --i; + next = 7; + } else + next = 5; + break; + + case 5: + if (ansi_buf[i] >= '0' && ansi_buf[i] <= '9') { + num2 = ansi_buf[i]-'0'; + next = 6; + } else + fail = 1; + break; + + case 6: + if (ansi_buf[i] >= '0' && ansi_buf[i] <= '9') { + num2 *= 10; + num2 += ansi_buf[i]-'0'; + } else { + --i; + next = 7; + } + break; + + case 7: + if ((ansi_buf[i] >= 'A' && ansi_buf[i] <= 'H') + || ansi_buf[i] == 'J' + || ansi_buf[i] == 'K' + || ansi_buf[i] == 'h' + || ansi_buf[i] == 'l' + || ansi_buf[i] == 'm') { + cchar = ansi_buf[i]; + flush = 1; + } else + fail = 1; + break; + } + } + + if (fail) { + for (i = 0; i < ansi_buf_size; ++i) + parse_putc(ansi_buf[i]); + ansi_buf_size = 0; + return; + } + + if (flush) { + if (!ansi_cursor_hidden) + CURSOR_OFF; + ansi_buf_size = 0; + switch (cchar) { + case 'A': + /* move cursor num1 rows up */ + console_cursor_up(num1); + break; + case 'B': + /* move cursor num1 rows down */ + console_cursor_down(num1); + break; + case 'C': + /* move cursor num1 columns forward */ + console_cursor_right(num1); + break; + case 'D': + /* move cursor num1 columns back */ + console_cursor_left(num1); + break; + case 'E': + /* move cursor num1 rows up at begin of row */ + console_previewsline(num1); + break; + case 'F': + /* move cursor num1 rows down at begin of row */ + console_newline(num1); + break; + case 'G': + /* move cursor to column num1 */ + console_cursor_set_position(-1, num1-1); + break; + case 'H': + /* move cursor to row num1, column num2 */ + console_cursor_set_position(num1-1, num2-1); + break; + case 'J': + /* clear console and move cursor to 0, 0 */ + console_clear(); + console_cursor_set_position(0, 0); + break; + case 'K': + /* clear line */ + if (num1 == 0) + console_clear_line(console_row, + console_col, + CONSOLE_COLS-1); + else if (num1 == 1) + console_clear_line(console_row, + 0, console_col); + else + console_clear_line(console_row, + 0, CONSOLE_COLS-1); + break; + case 'h': + ansi_cursor_hidden = 0; + break; + case 'l': + ansi_cursor_hidden = 1; + break; + case 'm': + if (num1 == 0) { /* reset swapped colors */ + if (ansi_colors_need_revert) { + console_swap_colors(); + ansi_colors_need_revert = 0; + } + } else if (num1 == 7) { /* once swap colors */ + if (!ansi_colors_need_revert) { + console_swap_colors(); + ansi_colors_need_revert = 1; + } + } + break; + } + if (!ansi_cursor_hidden) + CURSOR_SET; + } + } else { + parse_putc(c); + } +#else + parse_putc(c); +#endif }
void video_puts(const char *s)

Dear Pali Rohár,
- This patch add support for move cursor and reverse colors via ANSI espace codes in cfb_console driver
- ANSI escape codes can be enabled/disabled via CONFIG_CFB_CONSOLE_ANSI
Signed-off-by: Pali Rohár pali.rohar@gmail.com
Changes since v1:
- Added support ANSI code show/hide cursor
- Added info to README
Changes since original version:
- Fixed commit message
README | 3 + drivers/video/cfb_console.c | 234 ++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 234 insertions(+), 3 deletions(-)
diff --git a/README b/README index 60ad9c2..4a610f7 100644 --- a/README +++ b/README @@ -613,6 +613,9 @@ The following options need to be configured: additional board info beside the logo
When CONFIG_CFB_CONSOLE_ANSI is defined, console will have
ANSI terminal support. Needed for CONFIG_CMDLINE_EDITING.
- When CONFIG_CFB_CONSOLE is defined, video console is default i/o. Serial console can be forced with environment 'console=serial'.
diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c index 43eb994..c9f9765 100644 --- a/drivers/video/cfb_console.c +++ b/drivers/video/cfb_console.c @@ -377,6 +377,11 @@ static int console_row; /* cursor row */
static u32 eorx, fgx, bgx; /* color pats */
+static char ansi_buf[10] = { 0, }; +static int ansi_buf_size; +static int ansi_colors_need_revert; +static int ansi_cursor_hidden;
static const int video_font_draw_table8[] = { 0x00000000, 0x000000ff, 0x0000ff00, 0x0000ffff, 0x00ff0000, 0x00ff00ff, 0x00ffff00, 0x00ffffff, @@ -602,6 +607,14 @@ static void video_putchar(int xx, int yy, unsigned char c) video_drawchars(xx, yy + video_logo_height, &c, 1); }
+static void console_swap_colors(void) +{
- eorx = fgx;
- fgx = bgx;
- bgx = eorx;
- eorx = fgx ^ bgx;
+}
#if defined(CONFIG_CONSOLE_CURSOR) || defined(CONFIG_VIDEO_SW_CURSOR) static void video_set_cursor(void) { @@ -843,11 +856,12 @@ static void console_cr(void) console_col = 0; }
-void video_putc(const char c) +static void parse_putc(const char c) { static int nl = 1;
- CURSOR_OFF;
if (!ansi_cursor_hidden)
CURSOR_OFF;
switch (c) { case 13: /* back to first column */
@@ -883,7 +897,221 @@ void video_putc(const char c) nl = 0; } }
- CURSOR_SET;
- if (!ansi_cursor_hidden)
CURSOR_SET;
+}
+void video_putc(const char c) +{ +#ifdef CONFIG_CFB_CONSOLE_ANSI
- int i;
- if (c == 27) {
for (i = 0; i < ansi_buf_size; ++i)
parse_putc(ansi_buf[i]);
ansi_buf[0] = 27;
ansi_buf_size = 1;
return;
- }
- if (ansi_buf_size > 0) {
/*
0 - ESC
1 - [
2 - num1
3 - ..
4 - ;
5 - num2
6 - ..
7 - cchar
wrong comment ... did you even run these patches through checkpatch? Run them and resubmit please, I'm ending my review here.
*/
int next = 0;
int flush = 0;
int fail = 0;
int num1 = 0;
int num2 = 0;
int cchar = 0;
ansi_buf[ansi_buf_size++] = c;
if (ansi_buf_size >= sizeof(ansi_buf))
fail = 1;
for (i = 0; i < ansi_buf_size; ++i) {
if (fail)
break;
switch (next) {
case 0:
if (ansi_buf[i] == 27)
next = 1;
else
fail = 1;
break;
case 1:
if (ansi_buf[i] == '[')
next = 2;
else
fail = 1;
break;
case 2:
if (ansi_buf[i] >= '0' && ansi_buf[i] <= '9') {
num1 = ansi_buf[i]-'0';
next = 3;
} else if (ansi_buf[i] != '?') {
--i;
num1 = 1;
next = 4;
}
break;
case 3:
if (ansi_buf[i] >= '0' && ansi_buf[i] <= '9') {
num1 *= 10;
num1 += ansi_buf[i]-'0';
} else {
--i;
next = 4;
}
break;
case 4:
if (ansi_buf[i] != ';') {
--i;
next = 7;
} else
next = 5;
break;
case 5:
if (ansi_buf[i] >= '0' && ansi_buf[i] <= '9') {
num2 = ansi_buf[i]-'0';
next = 6;
} else
fail = 1;
break;
case 6:
if (ansi_buf[i] >= '0' && ansi_buf[i] <= '9') {
num2 *= 10;
num2 += ansi_buf[i]-'0';
} else {
--i;
next = 7;
}
break;
case 7:
if ((ansi_buf[i] >= 'A' && ansi_buf[i] <= 'H')
|| ansi_buf[i] == 'J'
|| ansi_buf[i] == 'K'
|| ansi_buf[i] == 'h'
|| ansi_buf[i] == 'l'
|| ansi_buf[i] == 'm') {
cchar = ansi_buf[i];
flush = 1;
} else
fail = 1;
break;
}
}
if (fail) {
for (i = 0; i < ansi_buf_size; ++i)
parse_putc(ansi_buf[i]);
ansi_buf_size = 0;
return;
}
if (flush) {
if (!ansi_cursor_hidden)
CURSOR_OFF;
ansi_buf_size = 0;
switch (cchar) {
case 'A':
/* move cursor num1 rows up */
console_cursor_up(num1);
break;
case 'B':
/* move cursor num1 rows down */
console_cursor_down(num1);
break;
case 'C':
/* move cursor num1 columns forward */
console_cursor_right(num1);
break;
case 'D':
/* move cursor num1 columns back */
console_cursor_left(num1);
break;
case 'E':
/* move cursor num1 rows up at begin of row */
console_previewsline(num1);
break;
case 'F':
/* move cursor num1 rows down at begin of row */
console_newline(num1);
break;
case 'G':
/* move cursor to column num1 */
console_cursor_set_position(-1, num1-1);
break;
case 'H':
/* move cursor to row num1, column num2 */
console_cursor_set_position(num1-1, num2-1);
break;
case 'J':
/* clear console and move cursor to 0, 0 */
console_clear();
console_cursor_set_position(0, 0);
break;
case 'K':
/* clear line */
if (num1 == 0)
console_clear_line(console_row,
console_col,
CONSOLE_COLS-1);
else if (num1 == 1)
console_clear_line(console_row,
0, console_col);
else
console_clear_line(console_row,
0, CONSOLE_COLS-1);
break;
case 'h':
ansi_cursor_hidden = 0;
break;
case 'l':
ansi_cursor_hidden = 1;
break;
case 'm':
if (num1 == 0) { /* reset swapped colors */
if (ansi_colors_need_revert) {
console_swap_colors();
ansi_colors_need_revert = 0;
}
} else if (num1 == 7) { /* once swap colors */
if (!ansi_colors_need_revert) {
console_swap_colors();
ansi_colors_need_revert = 1;
}
}
break;
}
if (!ansi_cursor_hidden)
CURSOR_SET;
}
- } else {
parse_putc(c);
- }
+#else
- parse_putc(c);
+#endif }
void video_puts(const char *s)

On Sunday 29 April 2012 00:19:03 Marek Vasut wrote:
- if (ansi_buf_size > 0) {
/*
0 - ESC
1 - [
2 - num1
3 - ..
4 - ;
5 - num2
6 - ..
7 - cchar
wrong comment ... did you even run these patches through checkpatch? Run them and resubmit please, I'm ending my review here.
Yes, I all patches except first is OK for checkpatch. It show no errors and no warnings.

Dear Pali =?ISO-8859-1?Q?Roh=E1r?=,
In message 3284404.3VX1zBQJtc@pali you wrote:
- if (ansi_buf_size > 0) {
/*
0 - ESC
1 - [
2 - num1
3 - ..
4 - ;
5 - num2
6 - ..
7 - cchar
wrong comment ... did you even run these patches through checkpatch? Run them and resubmit please, I'm ending my review here.
Yes, I all patches except first is OK for checkpatch. It show no errors and no warnings.
Nevertheless, this violates the CodingStyle (see entry for multiline comments); please fix globally.
Best regards,
Wolfgang Denk

Signed-off-by: Pali Rohár pali.rohar@gmail.com --- drivers/video/cfb_console.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c index c9f9765..dae2178 100644 --- a/drivers/video/cfb_console.c +++ b/drivers/video/cfb_console.c @@ -886,6 +886,9 @@ static void parse_putc(const char c) console_back(); break;
+ case 7: /* bell */ + break; /* ignored */ + default: /* draw the char */ video_putchar(console_col * VIDEO_FONT_WIDTH, console_row * VIDEO_FONT_HEIGHT, c);

Hi,
On Sat, 28 Apr 2012 19:26:47 +0200 Pali Rohár pali.rohar@gmail.com wrote:
Signed-off-by: Pali Rohár pali.rohar@gmail.com
drivers/video/cfb_console.c | 3 +++ 1 file changed, 3 insertions(+)
Applied to u-boot-video/master. Thanks!
Anatolij

From: Anatolij Gustschin agust@denx.de
Data cache flushing is required for frame buffer in RAM to fix the distorted console text output. Currently this text distortion is observed with cfb on beageboard and N900 when running with data cache enabled.
Reported-by: Pali Rohár pali.rohar@gmail.com Tested-by: Pali Rohár pali.rohar@gmail.com Signed-off-by: Anatolij Gustschin agust@denx.de --- Changes since original version: - Rebased on Nokia RX-51 patch series - Call flush_cache in console_clear too
drivers/video/cfb_console.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+)
diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c index dae2178..b8416d9 100644 --- a/drivers/video/cfb_console.c +++ b/drivers/video/cfb_console.c @@ -360,6 +360,8 @@ void console_cursor(int state); extern void video_get_info_str(int line_number, char *info); #endif
+DECLARE_GLOBAL_DATA_PTR; + /* Locals */ static GraphicDevice *pGD; /* Pointer to Graphic array */
@@ -382,6 +384,8 @@ static int ansi_buf_size; static int ansi_colors_need_revert; static int ansi_cursor_hidden;
+static int cfb_do_flush_cache; + static const int video_font_draw_table8[] = { 0x00000000, 0x000000ff, 0x0000ff00, 0x0000ffff, 0x00ff0000, 0x00ff00ff, 0x00ffff00, 0x00ffffff, @@ -558,6 +562,8 @@ static void video_drawchars(int xx, int yy, unsigned char *s, int count) SWAP32((video_font_draw_table32 [bits & 15][3] & eorx) ^ bgx); } + if (cfb_do_flush_cache) + flush_cache((ulong)dest0, 32); dest0 += VIDEO_FONT_WIDTH * VIDEO_PIXEL_SIZE; s++; } @@ -634,6 +640,8 @@ static void video_invertchar(int xx, int yy) for (x = firstx; x < lastx; x++) { u8 *dest = (u8 *)(video_fb_address) + x + y; *dest = ~*dest; + if (cfb_do_flush_cache) + flush_cache((ulong)dest, 4); } } } @@ -709,6 +717,8 @@ static void console_clear(void) #else memsetl(CONSOLE_ROW_FIRST, CONSOLE_SIZE, bgx); #endif + if (cfb_do_flush_cache) + flush_cache((ulong)CONSOLE_ROW_FIRST, CONSOLE_SIZE); }
static void console_clear_line(int line, int begin, int end) @@ -745,6 +755,8 @@ static void console_clear_line(int line, int begin, int end) bgx /* fill color */ ); #endif + if (cfb_do_flush_cache) + flush_cache((ulong)CONSOLE_ROW_FIRST, CONSOLE_SIZE); }
static void console_scrollup(void) @@ -1972,6 +1984,29 @@ static void *video_logo(void) } #endif
+static int cfb_fb_is_in_dram(void) +{ + bd_t *bd = gd->bd; + ulong start, end; + int i; + + for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) { +#if defined(CONFIG_ARM) || defined(CONFIG_AVR32) || defined(COFNIG_NDS32) || \ +defined(CONFIG_SANDBOX) || defined(CONFIG_X86) + start = bd->bi_dram[i].start; + end = bd->bi_dram[i].start + bd->bi_dram[i].size - 1; +#else + start = bd->bi_memstart; + end = bd->bi_memsize; +#endif + + if ((ulong)video_fb_address >= start && + (ulong)video_fb_address < end) + return 1; + } + return 0; +} + static int video_init(void) { unsigned char color8; @@ -1985,6 +2020,8 @@ static int video_init(void) video_init_hw_cursor(VIDEO_FONT_WIDTH, VIDEO_FONT_HEIGHT); #endif
+ cfb_do_flush_cache = cfb_fb_is_in_dram() && dcache_status(); + /* Init drawing pats */ switch (VIDEO_DATA_FORMAT) { case GDF__8BIT_INDEX:

* Command can be enabled by CONFIG_CMD_CLEAR * Added some ANSI escape codes definitions in common.h
Signed-off-by: Pali Rohár pali.rohar@gmail.com Cc: Marcel Mol marcel@mesa.nl --- Changes since original version: - Renamed command clr to clear - Use puts instead printf - Move cursor to pos1,1 - Merged parts of patch "Add some ANSI escape codes definitions in common.h"
common/Makefile | 1 + common/cmd_clear.c | 42 ++++++++++++++++++++++++++++++++++++++++++ include/common.h | 7 +++++++ include/config_cmd_all.h | 1 + 4 files changed, 51 insertions(+) create mode 100644 common/cmd_clear.c
diff --git a/common/Makefile b/common/Makefile index d9f10f3..0682a49 100644 --- a/common/Makefile +++ b/common/Makefile @@ -70,6 +70,7 @@ COBJS-$(CONFIG_CMD_BEDBUG) += bedbug.o cmd_bedbug.o COBJS-$(CONFIG_CMD_BMP) += cmd_bmp.o COBJS-$(CONFIG_CMD_BOOTLDR) += cmd_bootldr.o COBJS-$(CONFIG_CMD_CACHE) += cmd_cache.o +COBJS-$(CONFIG_CMD_CLEAR) += cmd_clear.o COBJS-$(CONFIG_CMD_CONSOLE) += cmd_console.o COBJS-$(CONFIG_CMD_CPLBINFO) += cmd_cplbinfo.o COBJS-$(CONFIG_DATAFLASH_MMC_SELECT) += cmd_dataflash_mmc_mux.o diff --git a/common/cmd_clear.c b/common/cmd_clear.c new file mode 100644 index 0000000..597611e --- /dev/null +++ b/common/cmd_clear.c @@ -0,0 +1,42 @@ +/* + * Copyright 2011 + * Marcel Mol, MESA Consulting, marcel@mesa.nl + * + * Copyright 2011 + * Pali Rohár, pali.rohar@gmail.com + * + * 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 as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <common.h> +#include <command.h> + +static int do_clear(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) +{ + puts(ANSI_CLEAR_CONSOLE); + printf(ANSI_CURSOR_POSITION, 1, 1); + return 0; +} + +U_BOOT_CMD( + clear, CONFIG_SYS_MAXARGS, 1, do_clear, + "clear", + "\n" + " - clear screen and move cursor to top of screen" +); diff --git a/include/common.h b/include/common.h index 4b5841e..26bfd95 100644 --- a/include/common.h +++ b/include/common.h @@ -743,6 +743,13 @@ void clear_ctrlc (void); /* clear the Control-C condition */ int disable_ctrlc (int); /* 1 to disable, 0 to enable Control-C detect */
/* + * ANSI terminal + */ + +#define ANSI_CURSOR_POSITION "\e[%d;%dH" +#define ANSI_CLEAR_CONSOLE "\e[2J" + +/* * STDIO based functions (can always be used) */ /* serial stuff */ diff --git a/include/config_cmd_all.h b/include/config_cmd_all.h index 2c6b829..243098a 100644 --- a/include/config_cmd_all.h +++ b/include/config_cmd_all.h @@ -24,6 +24,7 @@ #define CONFIG_CMD_BSP /* Board Specific functions */ #define CONFIG_CMD_CACHE /* icache, dcache */ #define CONFIG_CMD_CDP /* Cisco Discovery Protocol */ +#define CONFIG_CMD_CLEAR /* ANSI clear screen command */ #define CONFIG_CMD_CONSOLE /* coninfo */ #define CONFIG_CMD_DATE /* support for RTC, date/time...*/ #define CONFIG_CMD_DHCP /* DHCP Support */

Dear =?UTF-8?q?Pali=20Roh=C3=A1r?=,
In message 1335634011-9104-10-git-send-email-pali.rohar@gmail.com you wrote:
- Command can be enabled by CONFIG_CMD_CLEAR
- Added some ANSI escape codes definitions in common.h
Signed-off-by: Pali Rohár pali.rohar@gmail.com Cc: Marcel Mol marcel@mesa.nl
Changes since original version:
- Renamed command clr to clear
- Use puts instead printf
- Move cursor to pos1,1
- Merged parts of patch "Add some ANSI escape codes definitions in common.h"
common/Makefile | 1 + common/cmd_clear.c | 42 ++++++++++++++++++++++++++++++++++++++++++ include/common.h | 7 +++++++ include/config_cmd_all.h | 1 + 4 files changed, 51 insertions(+) create mode 100644 common/cmd_clear.c
Adding this to the config_cmd_all settings changes a _real_lot_ of board, most of which have zero interest in this function as they don't have any graphics display at all.
Also, the ANSI control sequences should go into a separate header file, not into common.h .
Thanks.
Best regards,
Wolfgang Denk

* if defined run env "premonitor" before Main Loop for Monitor Processing
Signed-off-by: Pali Rohár pali.rohar@gmail.com --- Changes since v1: - use run_command instead run_command2
Changes since original version: - removed #ifdef CONFIG_PREMONITOR in main.c
common/env_common.c | 3 +++ common/main.c | 4 ++++ 2 files changed, 7 insertions(+)
diff --git a/common/env_common.c b/common/env_common.c index c33d22d..f1b2e3e 100644 --- a/common/env_common.c +++ b/common/env_common.c @@ -92,6 +92,9 @@ const uchar default_environment[] = { #ifdef CONFIG_PREBOOT "preboot=" CONFIG_PREBOOT "\0" #endif +#ifdef CONFIG_PREMONITOR + "premonitor=" CONFIG_PREMONITOR "\0" +#endif #ifdef CONFIG_ROOTPATH "rootpath=" CONFIG_ROOTPATH "\0" #endif diff --git a/common/main.c b/common/main.c index 3b9e39a..aa5eb72 100644 --- a/common/main.c +++ b/common/main.c @@ -397,6 +397,10 @@ void main_loop (void) #endif /* CONFIG_MENUKEY */ #endif /* CONFIG_BOOTDELAY */
+ s = getenv("premonitor"); + if (s) + run_command(s, 0); + /* * Main Loop for Monitor Command Processing */

Dear =?UTF-8?q?Pali=20Roh=C3=A1r?=,
In message 1335634011-9104-11-git-send-email-pali.rohar@gmail.com you wrote:
- if defined run env "premonitor" before Main Loop for Monitor Processing
What would be the difference compared to "preboot" ?
Best regards,
Wolfgang Denk

On Saturday 28 April 2012 22:39:51 Wolfgang Denk wrote:
Dear =?UTF-8?q?Pali=20Roh=C3=A1r?=,
In message <1335634011-9104-11-git-send-email-
pali.rohar@gmail.com> you wrote:
- if defined run env "premonitor" before Main Loop for
Monitor Processing
What would be the difference compared to "preboot" ?
I need to run some script before monitor code but after menucmd. And preboot is called before bootdelay and also before menucmd. So I added premonitor which is called before monitor, but after bootdelay and menucmd.

Dear Pali =?ISO-8859-1?Q?Roh=E1r?=,
In message 1886523.MLHYlDJPrM@pali you wrote:
I need to run some script before monitor code but after menucmd. And preboot is called before bootdelay and also before menucmd. So I added premonitor which is called before monitor, but after bootdelay and menucmd.
What do you mean "after menucmd"? If you use a menu, why not run thse actions as part of the menu selected commands?
I do not want to add a growing list of locations in common code just because single boards feel they ned to run commands here or there.
Best regards,
Wolfgang Denk

This board definition results in a u-boot.bin which can be chainloaded from NOLO in qemu or on a real N900. It does very little hardware config because NOLO has already configured the board. Only needed is enabling internal eMMC memory via twl4030 regulator which is not enabled by NOLO.
NOLO is expecting a kernel image and will treat any image it finds in onenand as such. This u-boot is intended to be flashed to the N900 like a kernel. In order to transparently boot the original kernel, it will be appended to u-boot.bin at 0x40000. NOLO will load the entire image into memory and execute u-boot, which saves the ATAGs set by NOLO. Then the bootscripts will attempt to load uImage or boot.scr from a fat or ext2 filesystem in external SD card or internal eMMC memory. If this fails or keyboard is closed the appended kernel image will be booted using the stored ATAGs (see boot order).
There is support for hardware watchdog. It is started by NOLO so u-boot must kick watchdog to prevent reboot device (but not very often, max every 2 seconds). There is also support for framebuffer display output with ANSI espace codes and the N900 HW keyboard input. USB tty works but is disabled because it prevents the current Maemo kernel from booting.
Based on previous work by: Alistair Buxton a.j.buxton@gmail.com
Default boot order:
* 0. if keyboard is closed boot automatically attached kernel image * 1. try boot from external SD card * 2. try boot from internal eMMC memory * 3. try boot from attached kernel image
Boot from SD or eMMC in this order:
* find boot.scr on first fat partition * find uImage on first fat parition * same order for 2. - 4. fat partition
* find boot.scr on first ext2 partition * find uImage on first ext2 parition * same order for 2. - 4. ext2 partition
Available additional commands/variables:
* run sercon - Use serial port for control * run usbcon - Use usbtty for control * run vgacon - Use framebuffer and HW keyboard for control (default)
* run sdboot - Boot from external SD card (see boot order) * run emmcboot - Boot from internal eMMC memory (see boot order) * run attachboot - Boot attached kernel image (attached to U-Boot binary)
* run scriptload - Load boot script ${mmcscriptfile} * run scriptboot - Run loaded boot script * run kernload - Load kernel image ${mmckernfile} * run initrdload - Load initrd image ${mmcinitrdfile} * run kernboot - Boot loaded kernel image * run kerninitrdboot - Boot loaded kernel image with loaded initrd image
* run trymmcscriptboot - Try to load and boot script ${mmcscriptfile} * run trymmckernboot - Try to load and boot kernel image ${mmckernfile} * run trymmckerninitrdboot - Try to load and boot kernel image ${mmckernfile} with initrd image ${mmcinitrdfile}
Variables for loading files from mmc:
* mmc ${mmcnum} (0 - external, 1 - internal) * partition number ${mmcpart} (1 - 4) * parition type ${mmctype} (fat, ext2)
Signed-off-by: Pali Rohár pali.rohar@gmail.com --- Changes since v1: - Set correct configs for Memory Map - Enable passing memory tag to kernel atags - Use gpio input command for detecting keyboard slide - Restore powerbus state after calling twl4030 regulator code - Renamed command noloboot to attachboot - Atag address must be always 0x80000100, removed code from lowlevel - Added usb vendor, product id and product name - Enabled command line editing - Fixed keymap and cursor keys
Changes since original version: - Removed Makefile targets: clean and distclean - Rewrited bootcommand and env variables in nokia_rx51.h - Removed useless CONFIG defines in nokia_rx51.h - Disable L2 cache with CONFIG_SYS_L2CACHE_OFF - fixed battery draining - Added onenand support (default disabled due to big u-boot size) - Moved inlined asm code to new file lowlevel_init.S - Fixed commit message
board/nokia/rx51/Makefile | 46 +++++ board/nokia/rx51/lowlevel_init.S | 71 +++++++ board/nokia/rx51/rx51.c | 380 ++++++++++++++++++++++++++++++++++++++ board/nokia/rx51/rx51.h | 378 +++++++++++++++++++++++++++++++++++++ boards.cfg | 1 + include/configs/nokia_rx51.h | 373 +++++++++++++++++++++++++++++++++++++ 6 files changed, 1249 insertions(+) create mode 100644 board/nokia/rx51/Makefile create mode 100644 board/nokia/rx51/lowlevel_init.S create mode 100644 board/nokia/rx51/rx51.c create mode 100644 board/nokia/rx51/rx51.h create mode 100644 include/configs/nokia_rx51.h
diff --git a/board/nokia/rx51/Makefile b/board/nokia/rx51/Makefile new file mode 100644 index 0000000..86fb48c --- /dev/null +++ b/board/nokia/rx51/Makefile @@ -0,0 +1,46 @@ +# +# (C) Copyright 2000, 2001, 2002 +# Wolfgang Denk, DENX Software Engineering, wd@denx.de. +# +# 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 as +# published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# + +include $(TOPDIR)/config.mk + +LIB = $(obj)lib$(BOARD).o + +COBJS-y := $(BOARD).o +SOBJS-y := lowlevel_init.o + +COBJS := $(sort $(COBJS-y)) +SOBJS := $(sort $(SOBJS-y)) +SRCS := $(COBJS:.o=.c) $(SOBJS:.o=.S) +OBJS := $(addprefix $(obj),$(COBJS)) $(addprefix $(obj),$(SOBJS)) + +$(LIB): $(obj).depend $(OBJS) + $(call cmd_link_o_target, $(OBJS)) + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +######################################################################### diff --git a/board/nokia/rx51/lowlevel_init.S b/board/nokia/rx51/lowlevel_init.S new file mode 100644 index 0000000..efcf85b --- /dev/null +++ b/board/nokia/rx51/lowlevel_init.S @@ -0,0 +1,71 @@ +/* + * (C) Copyright 2011-2012 + * Pali Rohár pali.rohar@gmail.com + * + * 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 as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#define KERNEL_OFFSET 0x40000 +#define KERNEL_MAXSIZE 0x200000 /* 2MB */ + +startaddr: /* address where should be u-boot after relocation */ + .word CONFIG_SYS_TEXT_BASE + +relocaddr: /* address of this relocaddr section after relocation */ + .word . /* address of section (calculated at compile time) */ + +.global rx51_kernaddr +rx51_kernaddr: +kernaddr: /* stored attached kernel address */ + .word CONFIG_SYS_TEXT_BASE + KERNEL_OFFSET + +/* + * Routine: save_boot_params (called after reset from start.S) + * Description: Save atag address and attached kernel address. + * Move u-boot to address CONFIG_SYS_TEXT_BASE + */ + +.global save_boot_params +save_boot_params: /* function save_boot_params, called after reset */ + adr r0, relocaddr /* r0 - address of section relocaddr */ + ldr r1, relocaddr /* r1 - address of relocaddr after relocation */ + sub r0, r0, r1 /* r1 - calculated offset for relocation */ + ldr r1, startaddr /* r1 - address of u-boot after relocation */ + add r0, r0, r1 /* r0 - address where is u-boot now */ + /* (address after relocation + offset) */ + + cmp r0, r1 + bne reloc /* relocate if u-boot is not at correct address */ + bx lr /* else return (to reset, relocation is not needed) */ + +reloc: + add r2, r0, #KERNEL_OFFSET /* r2 - address of attached kernel */ + /* (u-boot address + kernel offset) */ + str r2, kernaddr /* store kernel address to memory */ + add r2, r0, #KERNEL_MAXSIZE /* r2 - address - end of kernel image */ + /* (u-boot address + kernel max size */ + +loop: + ldmia r0!, {r3 - r10} /* copy from source address (r0) */ + stmia r1!, {r3 - r10} /* copy to destination address (r1) */ + cmp r0, r2 + bne loop /* until end of kernel image (r2) */ + + ldr pc, startaddr /* jump to start section */ +/* (where should be u-boot after relocation) and restart u-boot */ diff --git a/board/nokia/rx51/rx51.c b/board/nokia/rx51/rx51.c new file mode 100644 index 0000000..bce454d --- /dev/null +++ b/board/nokia/rx51/rx51.c @@ -0,0 +1,380 @@ +/* + * (C) Copyright 2011-2012 + * Pali Rohár pali.rohar@gmail.com + * + * (C) Copyright 2010 + * Alistair Buxton a.j.buxton@gmail.com + * + * Derived from Beagle Board and 3430 SDP code: + * (C) Copyright 2004-2008 + * Texas Instruments, <www.ti.com> + * + * Author : + * Sunil Kumar sunilsaini05@gmail.com + * Shashi Ranjan shashiranjanmca05@gmail.com + * + * Richard Woodruff r-woodruff2@ti.com + * Syed Mohammed Khasim khasim@ti.com + * + * 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 as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <common.h> +#include <twl4030.h> +#include <i2c.h> +#include <video_fb.h> +#include <asm/io.h> +#include <asm/bitops.h> +#include <asm/mach-types.h> +#include <asm/arch/mux.h> +#include <asm/arch/sys_proto.h> +#include <asm/arch/mmc_host_def.h> + +#include "rx51.h" + +DECLARE_GLOBAL_DATA_PTR; + +GraphicDevice gdev; + +const omap3_sysinfo sysinfo = { + DDR_STACKED, + "Nokia RX-51", + "OneNAND" +}; + +/* + * Routine: board_init + * Description: Early hardware init. + */ +int board_init(void) +{ + gpmc_init(); /* in SRAM or SDRAM, finish GPMC */ + /* board id for Linux */ + gd->bd->bi_arch_number = MACH_TYPE_NOKIA_RX51; + /* boot param addr */ + gd->bd->bi_boot_params = OMAP34XX_SDRC_CS0 + 0x100; + + return 0; +} + +/* + * Routine: video_hw_init + * Description: Set up the GraphicDevice depending on sys_boot. + */ +void *video_hw_init(void) +{ + /* fill in Graphic Device */ + gdev.frameAdrs = 0x8f9c0000; + gdev.winSizeX = 800; + gdev.winSizeY = 480; + gdev.gdfBytesPP = 2; + gdev.gdfIndex = GDF_16BIT_565RGB; + memset((void *)gdev.frameAdrs, 0, 0xbb800); + return (void *) &gdev; +} + +/* + * Routine: twl4030_regulator_set_mode + * Description: Set twl4030 regulator mode over i2c powerbus. + */ +static void twl4030_regulator_set_mode(u8 id, u8 mode) +{ + u16 msg = MSG_SINGULAR(DEV_GRP_P1, id, mode); + twl4030_i2c_write_u8(TWL4030_CHIP_PM_MASTER, msg >> 8, + TWL4030_PM_MASTER_PB_WORD_MSB); + twl4030_i2c_write_u8(TWL4030_CHIP_PM_MASTER, msg & 0xff, + TWL4030_PM_MASTER_PB_WORD_LSB); +} + +/* + * Routine: misc_init_r + * Description: Configure board specific parts. + */ +int misc_init_r(void) +{ + char buf[12]; + u8 state; + + /* initialize twl4030 power managment */ + twl4030_power_init(); + + /* set VSIM to 1.8V */ + twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VSIM_DEDICATED, + TWL4030_PM_RECEIVER_VSIM_VSEL_18, + TWL4030_PM_RECEIVER_VSIM_DEV_GRP, + TWL4030_PM_RECEIVER_DEV_GRP_P1); + + /* store I2C access state */ + twl4030_i2c_read_u8(TWL4030_CHIP_PM_MASTER, &state, + TWL4030_PM_MASTER_PB_CFG); + + /* enable I2C access to powerbus (needed for twl4030 regulator) */ + twl4030_i2c_write_u8(TWL4030_CHIP_PM_MASTER, 0x02, + TWL4030_PM_MASTER_PB_CFG); + + /* set VAUX3, VSIM and VMMC1 state to active - enable eMMC memory */ + twl4030_regulator_set_mode(RES_VAUX3, RES_STATE_ACTIVE); + twl4030_regulator_set_mode(RES_VSIM, RES_STATE_ACTIVE); + twl4030_regulator_set_mode(RES_VMMC1, RES_STATE_ACTIVE); + + /* restore I2C access state */ + twl4030_i2c_write_u8(TWL4030_CHIP_PM_MASTER, state, + TWL4030_PM_MASTER_PB_CFG); + + /* set env variable rx51_kernaddr for calculated address of kernel */ + sprintf(buf, "%#x", rx51_kernaddr); + setenv("rx51_kernaddr", buf); + + dieid_num_r(); + + return 0; +} + +/* + * Routine: set_muxconf_regs + * Description: Setting up the configuration Mux registers specific to the + * hardware. Many pins need to be moved from protect to primary + * mode. + */ +void set_muxconf_regs(void) +{ + MUX_RX51(); +} + +static unsigned long int twl_wd_time; /* last time of watchdog reset */ +static unsigned long int twl_i2c_lock; + +/* + * Routine: hw_watchdog_reset + * Description: Reset timeout of twl4030 watchdog. + */ +void hw_watchdog_reset(void) +{ + u8 timeout = 0; + + /* do not reset watchdog too often - max every 4s */ + if (get_timer(twl_wd_time) < 4 * CONFIG_SYS_HZ) + return; + + /* localy lock twl4030 i2c bus */ + if (test_and_set_bit(0, &twl_i2c_lock)) + return; + + /* read actual watchdog timeout */ + twl4030_i2c_read_u8(TWL4030_CHIP_PM_RECEIVER, &timeout, + TWL4030_PM_RECEIVER_WATCHDOG_CFG); + + /* timeout 0 means watchdog is disabled */ + /* reset watchdog timeout to 31s (maximum) */ + if (timeout != 0) + twl4030_i2c_write_u8(TWL4030_CHIP_PM_RECEIVER, 31, + TWL4030_PM_RECEIVER_WATCHDOG_CFG); + + /* store last watchdog reset time */ + twl_wd_time = get_timer(0); + + /* localy unlock twl4030 i2c bus */ + test_and_clear_bit(0, &twl_i2c_lock); +} + +/* + * TWL4030 keypad handler for cfb_console + */ + +static const char keymap[] = { + /* normal */ + 'q', 'o', 'p', ',', '\b', 0, 'a', 's', + 'w', 'd', 'f', 'g', 'h', 'j', 'k', 'l', + 'e', '.', 0, '\r', 0, 'z', 'x', 'c', + 'r', 'v', 'b', 'n', 'm', ' ', ' ', 0, + 't', 0, 0, 0, 0, 0, 0, 0, + 'y', 0, 0, 0, 0, 0, 0, 0, + 'u', 0, 0, 0, 0, 0, 0, 0, + 'i', 5, 6, 0, 0, 0, 0, 0, + /* fn */ + '1', '9', '0', '=', '\b', 0, '*', '+', + '2', '#', '-', '_', '(', ')', '&', '!', + '3', '?', '^', '\r', 0, 156, '$', 238, + '4', '/', '\', '"', ''', '@', 0, '<', + '5', '|', '>', 0, 0, 0, 0, 0, + '6', 0, 0, 0, 0, 0, 0, 0, + '7', 0, 0, 0, 0, 0, 0, 0, + '8', 16, 17, 0, 0, 0, 0, 0, +}; + +static u8 keys[8]; +static u8 old_keys[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +#define KEYBUF_SIZE 32 +static u8 keybuf[KEYBUF_SIZE]; +static u8 keybuf_head; +static u8 keybuf_tail; + +/* + * Routine: rx51_kp_init + * Description: Initialize HW keyboard. + */ +int rx51_kp_init(void) +{ + int ret = 0; + u8 ctrl; + ret = twl4030_i2c_read_u8(TWL4030_CHIP_KEYPAD, &ctrl, + TWL4030_KEYPAD_KEYP_CTRL_REG); + + if (!ret) { + /* turn on keyboard and use hardware scanning */ + ctrl |= TWL4030_KEYPAD_CTRL_KBD_ON; + ctrl |= TWL4030_KEYPAD_CTRL_SOFT_NRST; + ctrl |= TWL4030_KEYPAD_CTRL_SOFTMODEN; + ret |= twl4030_i2c_write_u8(TWL4030_CHIP_KEYPAD, ctrl, + TWL4030_KEYPAD_KEYP_CTRL_REG); + /* enable key event status */ + ret |= twl4030_i2c_write_u8(TWL4030_CHIP_KEYPAD, 0xfe, + TWL4030_KEYPAD_KEYP_IMR1); + /* enable interrupt generation on rising and falling */ + /* this is a workaround for qemu twl4030 emulation */ + ret |= twl4030_i2c_write_u8(TWL4030_CHIP_KEYPAD, 0x57, + TWL4030_KEYPAD_KEYP_EDR); + /* enable ISR clear on read */ + ret |= twl4030_i2c_write_u8(TWL4030_CHIP_KEYPAD, 0x05, + TWL4030_KEYPAD_KEYP_SIH_CTRL); + } + return ret; +} + +static void rx51_kp_fill(u8 k, u8 mods) +{ + if (!(mods & 2) && (k == 18 || k == 31 || k == 33 || k == 34)) { + /* cursor keys, without fn */ + keybuf[keybuf_tail++] = '\e'; + keybuf_tail %= KEYBUF_SIZE; + keybuf[keybuf_tail++] = '['; + keybuf_tail %= KEYBUF_SIZE; + if (k == 18) /* up */ + keybuf[keybuf_tail++] = 'A'; + else if (k == 31) /* left */ + keybuf[keybuf_tail++] = 'D'; + else if (k == 33) /* down */ + keybuf[keybuf_tail++] = 'B'; + else if (k == 34) /* right */ + keybuf[keybuf_tail++] = 'C'; + keybuf_tail %= KEYBUF_SIZE; + return; + } + + if (mods & 2) { /* fn */ + k = keymap[k+64]; + } else { + k = keymap[k]; + if (mods & 1) { /* ctrl */ + if (k >= 'a' && k <= 'z') + k -= 'a' - 1; + } + if (mods & 4) { /* shift */ + if (k >= 'a' && k <= 'z') + k += 'A' - 'a'; + else if (k == '.') + k = ':'; + else if (k == ',') + k = ';'; + } + } + keybuf[keybuf_tail++] = k; + keybuf_tail %= KEYBUF_SIZE; +} + +/* + * Routine: rx51_kp_tstc + * Description: Test if key was pressed (from buffer). + */ +int rx51_kp_tstc(void) +{ + u8 c, r, dk, i; + u8 intr; + u8 mods; + + /* localy lock twl4030 i2c bus */ + if (test_and_set_bit(0, &twl_i2c_lock)) + return 0; + + /* twl4030 remembers up to 2 events */ + for (i = 0; i < 2; i++) { + + /* check interrupt register for events */ + twl4030_i2c_read_u8(TWL4030_CHIP_KEYPAD, &intr, + TWL4030_KEYPAD_KEYP_ISR1+(2*i)); + + if (intr&1) { /* got an event */ + + /* read the key state */ + i2c_read(TWL4030_CHIP_KEYPAD, + TWL4030_KEYPAD_FULL_CODE_7_0, 1, keys, 8); + + /* cut out modifier keys from the keystate */ + mods = keys[4] >> 4; + keys[4] &= 0x0f; + + for (c = 0; c < 8; c++) { + + /* get newly pressed keys only */ + dk = ((keys[c] ^ old_keys[c])&keys[c]); + old_keys[c] = keys[c]; + + /* fill the keybuf */ + for (r = 0; r < 8; r++) { + if (dk&1) + rx51_kp_fill((c*8)+r, mods); + dk = dk >> 1; + } + + } + + } + + } + + /* localy unlock twl4030 i2c bus */ + test_and_clear_bit(0, &twl_i2c_lock); + + return (KEYBUF_SIZE + keybuf_tail - keybuf_head)%KEYBUF_SIZE; +} + +/* + * Routine: rx51_kp_getc + * Description: Get last pressed key (from buffer). + */ +int rx51_kp_getc(void) +{ + keybuf_head %= KEYBUF_SIZE; + while (!rx51_kp_tstc()) { + udelay(1); + hw_watchdog_reset(); + } + return keybuf[keybuf_head++]; +} + +/* + * Routine: board_mmc_init + * Description: Initialize mmc devices. + */ +int board_mmc_init(bd_t *bis) +{ + omap_mmc_init(0); + omap_mmc_init(1); + return 0; +} diff --git a/board/nokia/rx51/rx51.h b/board/nokia/rx51/rx51.h new file mode 100644 index 0000000..362928f --- /dev/null +++ b/board/nokia/rx51/rx51.h @@ -0,0 +1,378 @@ +/* + * (C) Copyright 2011-2012 + * Pali Rohár pali.rohar@gmail.com + * + * (C) Copyright 2008 + * Dirk Behme dirk.behme@gmail.com + * + * 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 as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ +#ifndef _RX51_H_ +#define _RX51_H_ + +extern u32 rx51_atagaddr; /* atag address */ +extern u32 rx51_kernaddr; /* attached kernel address */ + +/* + * IEN - Input Enable + * IDIS - Input Disable + * PTD - Pull type Down + * PTU - Pull type Up + * DIS - Pull type selection is inactive + * EN - Pull type selection is active + * M0 - Mode 0 + * The commented string gives the final mux configuration for that pin + */ +#define MUX_RX51() \ + /*SDRC*/\ + MUX_VAL(CP(SDRC_D0), (IEN | PTD | DIS | M0)) /*SDRC_D0*/\ + MUX_VAL(CP(SDRC_D1), (IEN | PTD | DIS | M0)) /*SDRC_D1*/\ + MUX_VAL(CP(SDRC_D2), (IEN | PTD | DIS | M0)) /*SDRC_D2*/\ + MUX_VAL(CP(SDRC_D3), (IEN | PTD | DIS | M0)) /*SDRC_D3*/\ + MUX_VAL(CP(SDRC_D4), (IEN | PTD | DIS | M0)) /*SDRC_D4*/\ + MUX_VAL(CP(SDRC_D5), (IEN | PTD | DIS | M0)) /*SDRC_D5*/\ + MUX_VAL(CP(SDRC_D6), (IEN | PTD | DIS | M0)) /*SDRC_D6*/\ + MUX_VAL(CP(SDRC_D7), (IEN | PTD | DIS | M0)) /*SDRC_D7*/\ + MUX_VAL(CP(SDRC_D8), (IEN | PTD | DIS | M0)) /*SDRC_D8*/\ + MUX_VAL(CP(SDRC_D9), (IEN | PTD | DIS | M0)) /*SDRC_D9*/\ + MUX_VAL(CP(SDRC_D10), (IEN | PTD | DIS | M0)) /*SDRC_D10*/\ + MUX_VAL(CP(SDRC_D11), (IEN | PTD | DIS | M0)) /*SDRC_D11*/\ + MUX_VAL(CP(SDRC_D12), (IEN | PTD | DIS | M0)) /*SDRC_D12*/\ + MUX_VAL(CP(SDRC_D13), (IEN | PTD | DIS | M0)) /*SDRC_D13*/\ + MUX_VAL(CP(SDRC_D14), (IEN | PTD | DIS | M0)) /*SDRC_D14*/\ + MUX_VAL(CP(SDRC_D15), (IEN | PTD | DIS | M0)) /*SDRC_D15*/\ + MUX_VAL(CP(SDRC_D16), (IEN | PTD | DIS | M0)) /*SDRC_D16*/\ + MUX_VAL(CP(SDRC_D17), (IEN | PTD | DIS | M0)) /*SDRC_D17*/\ + MUX_VAL(CP(SDRC_D18), (IEN | PTD | DIS | M0)) /*SDRC_D18*/\ + MUX_VAL(CP(SDRC_D19), (IEN | PTD | DIS | M0)) /*SDRC_D19*/\ + MUX_VAL(CP(SDRC_D20), (IEN | PTD | DIS | M0)) /*SDRC_D20*/\ + MUX_VAL(CP(SDRC_D21), (IEN | PTD | DIS | M0)) /*SDRC_D21*/\ + MUX_VAL(CP(SDRC_D22), (IEN | PTD | DIS | M0)) /*SDRC_D22*/\ + MUX_VAL(CP(SDRC_D23), (IEN | PTD | DIS | M0)) /*SDRC_D23*/\ + MUX_VAL(CP(SDRC_D24), (IEN | PTD | DIS | M0)) /*SDRC_D24*/\ + MUX_VAL(CP(SDRC_D25), (IEN | PTD | DIS | M0)) /*SDRC_D25*/\ + MUX_VAL(CP(SDRC_D26), (IEN | PTD | DIS | M0)) /*SDRC_D26*/\ + MUX_VAL(CP(SDRC_D27), (IEN | PTD | DIS | M0)) /*SDRC_D27*/\ + MUX_VAL(CP(SDRC_D28), (IEN | PTD | DIS | M0)) /*SDRC_D28*/\ + MUX_VAL(CP(SDRC_D29), (IEN | PTD | DIS | M0)) /*SDRC_D29*/\ + MUX_VAL(CP(SDRC_D30), (IEN | PTD | DIS | M0)) /*SDRC_D30*/\ + MUX_VAL(CP(SDRC_D31), (IEN | PTD | DIS | M0)) /*SDRC_D31*/\ + MUX_VAL(CP(SDRC_CLK), (IEN | PTD | DIS | M0)) /*SDRC_CLK*/\ + MUX_VAL(CP(SDRC_DQS0), (IEN | PTD | DIS | M0)) /*SDRC_DQS0*/\ + MUX_VAL(CP(SDRC_DQS1), (IEN | PTD | DIS | M0)) /*SDRC_DQS1*/\ + MUX_VAL(CP(SDRC_DQS2), (IEN | PTD | DIS | M0)) /*SDRC_DQS2*/\ + MUX_VAL(CP(SDRC_DQS3), (IEN | PTD | DIS | M0)) /*SDRC_DQS3*/\ + /*GPMC*/\ + MUX_VAL(CP(GPMC_A1), (IDIS | PTD | DIS | M0)) /*GPMC_A1*/\ + MUX_VAL(CP(GPMC_A2), (IDIS | PTD | DIS | M0)) /*GPMC_A2*/\ + MUX_VAL(CP(GPMC_A3), (IDIS | PTD | DIS | M0)) /*GPMC_A3*/\ + MUX_VAL(CP(GPMC_A4), (IDIS | PTD | DIS | M0)) /*GPMC_A4*/\ + MUX_VAL(CP(GPMC_A5), (IDIS | PTD | DIS | M0)) /*GPMC_A5*/\ + MUX_VAL(CP(GPMC_A6), (IDIS | PTD | DIS | M0)) /*GPMC_A6*/\ + MUX_VAL(CP(GPMC_A7), (IDIS | PTD | DIS | M0)) /*GPMC_A7*/\ + MUX_VAL(CP(GPMC_A8), (IDIS | PTD | DIS | M0)) /*GPMC_A8*/\ + MUX_VAL(CP(GPMC_A9), (IDIS | PTD | DIS | M0)) /*GPMC_A9*/\ + MUX_VAL(CP(GPMC_A10), (IDIS | PTD | DIS | M0)) /*GPMC_A10*/\ + MUX_VAL(CP(GPMC_D0), (IEN | PTD | DIS | M0)) /*GPMC_D0*/\ + MUX_VAL(CP(GPMC_D1), (IEN | PTD | DIS | M0)) /*GPMC_D1*/\ + MUX_VAL(CP(GPMC_D2), (IEN | PTD | DIS | M0)) /*GPMC_D2*/\ + MUX_VAL(CP(GPMC_D3), (IEN | PTD | DIS | M0)) /*GPMC_D3*/\ + MUX_VAL(CP(GPMC_D4), (IEN | PTD | DIS | M0)) /*GPMC_D4*/\ + MUX_VAL(CP(GPMC_D5), (IEN | PTD | DIS | M0)) /*GPMC_D5*/\ + MUX_VAL(CP(GPMC_D6), (IEN | PTD | DIS | M0)) /*GPMC_D6*/\ + MUX_VAL(CP(GPMC_D7), (IEN | PTD | DIS | M0)) /*GPMC_D7*/\ + MUX_VAL(CP(GPMC_D8), (IEN | PTD | DIS | M0)) /*GPMC_D8*/\ + MUX_VAL(CP(GPMC_D9), (IEN | PTD | DIS | M0)) /*GPMC_D9*/\ + MUX_VAL(CP(GPMC_D10), (IEN | PTD | DIS | M0)) /*GPMC_D10*/\ + MUX_VAL(CP(GPMC_D11), (IEN | PTD | DIS | M0)) /*GPMC_D11*/\ + MUX_VAL(CP(GPMC_D12), (IEN | PTD | DIS | M0)) /*GPMC_D12*/\ + MUX_VAL(CP(GPMC_D13), (IEN | PTD | DIS | M0)) /*GPMC_D13*/\ + MUX_VAL(CP(GPMC_D14), (IEN | PTD | DIS | M0)) /*GPMC_D14*/\ + MUX_VAL(CP(GPMC_D15), (IEN | PTD | DIS | M0)) /*GPMC_D15*/\ + MUX_VAL(CP(GPMC_NCS0), (IDIS | PTU | EN | M0)) /*GPMC_nCS0*/\ + MUX_VAL(CP(GPMC_NCS1), (IDIS | PTU | EN | M0)) /*GPMC_nCS1*/\ + MUX_VAL(CP(GPMC_NCS2), (IDIS | PTU | EN | M0)) /*GPMC_nCS2*/\ + MUX_VAL(CP(GPMC_NCS3), (IDIS | PTU | EN | M0)) /*GPMC_nCS3*/\ + MUX_VAL(CP(GPMC_NCS4), (IDIS | PTU | EN | M0)) /*GPMC_nCS4*/\ + MUX_VAL(CP(GPMC_NCS5), (IDIS | PTD | DIS | M0)) /*GPMC_nCS5*/\ + MUX_VAL(CP(GPMC_NCS6), (IEN | PTD | DIS | M1)) /*nDMA_REQ2*/\ + MUX_VAL(CP(GPMC_NCS7), (IEN | PTU | EN | M1)) /*nDMA_REQ3*/\ + MUX_VAL(CP(GPMC_NBE1), (IEN | PTD | DIS | M0)) /*GPMC_nBE1*/\ + MUX_VAL(CP(GPMC_WAIT2), (IEN | PTU | EN | M0)) /*GPMC_WAIT2*/\ + MUX_VAL(CP(GPMC_WAIT3), (IEN | PTU | EN | M0)) /*GPMC_WAIT3*/\ + MUX_VAL(CP(GPMC_CLK), (IDIS | PTD | DIS | M0)) /*GPMC_CLK*/\ + MUX_VAL(CP(GPMC_NADV_ALE), (IDIS | PTD | DIS | M0)) /*GPMC_nADV*/\ + MUX_VAL(CP(GPMC_NOE), (IDIS | PTD | DIS | M0)) /*GPMC_nOE*/\ + MUX_VAL(CP(GPMC_NWE), (IDIS | PTD | DIS | M0)) /*GPMC_nWE*/\ + MUX_VAL(CP(GPMC_NBE0_CLE), (IDIS | PTD | DIS | M0)) /*GPMC_nBE0*/\ + MUX_VAL(CP(GPMC_NWP), (IEN | PTD | DIS | M0)) /*GPMC_nWP*/\ + MUX_VAL(CP(GPMC_WAIT0), (IEN | PTU | EN | M0)) /*GPMC_WAIT0*/\ + MUX_VAL(CP(GPMC_WAIT1), (IEN | PTU | EN | M0)) /*GPMC_WAIT1*/\ + /*DSS*/\ + MUX_VAL(CP(DSS_PCLK), (IDIS | PTD | DIS | M0)) /*DSS_PCLK*/\ + MUX_VAL(CP(DSS_HSYNC), (IDIS | PTD | DIS | M0)) /*DSS_HSYNC*/\ + MUX_VAL(CP(DSS_VSYNC), (IDIS | PTD | DIS | M0)) /*DSS_VSYNC*/\ + MUX_VAL(CP(DSS_ACBIAS), (IDIS | PTD | DIS | M0)) /*DSS_ACBIAS*/\ + MUX_VAL(CP(DSS_DATA0), (IDIS | PTD | DIS | M0)) /*DSS_DATA0*/\ + MUX_VAL(CP(DSS_DATA1), (IDIS | PTD | DIS | M0)) /*DSS_DATA1*/\ + MUX_VAL(CP(DSS_DATA2), (IDIS | PTD | DIS | M0)) /*DSS_DATA2*/\ + MUX_VAL(CP(DSS_DATA3), (IDIS | PTD | DIS | M0)) /*DSS_DATA3*/\ + MUX_VAL(CP(DSS_DATA4), (IDIS | PTD | DIS | M0)) /*DSS_DATA4*/\ + MUX_VAL(CP(DSS_DATA5), (IDIS | PTD | DIS | M0)) /*DSS_DATA5*/\ + MUX_VAL(CP(DSS_DATA6), (IDIS | PTD | DIS | M0)) /*DSS_DATA6*/\ + MUX_VAL(CP(DSS_DATA7), (IDIS | PTD | DIS | M0)) /*DSS_DATA7*/\ + MUX_VAL(CP(DSS_DATA8), (IDIS | PTD | DIS | M0)) /*DSS_DATA8*/\ + MUX_VAL(CP(DSS_DATA9), (IDIS | PTD | DIS | M0)) /*DSS_DATA9*/\ + MUX_VAL(CP(DSS_DATA10), (IDIS | PTD | DIS | M0)) /*DSS_DATA10*/\ + MUX_VAL(CP(DSS_DATA11), (IDIS | PTD | DIS | M0)) /*DSS_DATA11*/\ + MUX_VAL(CP(DSS_DATA12), (IDIS | PTD | DIS | M0)) /*DSS_DATA12*/\ + MUX_VAL(CP(DSS_DATA13), (IDIS | PTD | DIS | M0)) /*DSS_DATA13*/\ + MUX_VAL(CP(DSS_DATA14), (IDIS | PTD | DIS | M0)) /*DSS_DATA14*/\ + MUX_VAL(CP(DSS_DATA15), (IDIS | PTD | DIS | M0)) /*DSS_DATA15*/\ + MUX_VAL(CP(DSS_DATA16), (IDIS | PTD | DIS | M0)) /*DSS_DATA16*/\ + MUX_VAL(CP(DSS_DATA17), (IDIS | PTD | DIS | M0)) /*DSS_DATA17*/\ + MUX_VAL(CP(DSS_DATA18), (IDIS | PTD | DIS | M0)) /*DSS_DATA18*/\ + MUX_VAL(CP(DSS_DATA19), (IDIS | PTD | DIS | M0)) /*DSS_DATA19*/\ + MUX_VAL(CP(DSS_DATA20), (IDIS | PTD | DIS | M0)) /*DSS_DATA20*/\ + MUX_VAL(CP(DSS_DATA21), (IDIS | PTD | DIS | M0)) /*DSS_DATA21*/\ + MUX_VAL(CP(DSS_DATA22), (IDIS | PTD | DIS | M0)) /*DSS_DATA22*/\ + MUX_VAL(CP(DSS_DATA23), (IDIS | PTD | DIS | M0)) /*DSS_DATA23*/\ + /*CAMERA*/\ + MUX_VAL(CP(CAM_HS), (IEN | PTU | EN | M0)) /*CAM_HS */\ + MUX_VAL(CP(CAM_VS), (IEN | PTU | EN | M0)) /*CAM_VS */\ + MUX_VAL(CP(CAM_XCLKA), (IDIS | PTD | DIS | M0)) /*CAM_XCLKA*/\ + MUX_VAL(CP(CAM_PCLK), (IEN | PTU | EN | M0)) /*CAM_PCLK*/\ + MUX_VAL(CP(CAM_FLD), (IDIS | PTD | DIS | M4)) /*GPIO_98*/\ + MUX_VAL(CP(CAM_D0), (IEN | PTD | DIS | M0)) /*CAM_D0*/\ + MUX_VAL(CP(CAM_D1), (IEN | PTD | DIS | M0)) /*CAM_D1*/\ + MUX_VAL(CP(CAM_D2), (IEN | PTD | DIS | M0)) /*CAM_D2*/\ + MUX_VAL(CP(CAM_D3), (IEN | PTD | DIS | M0)) /*CAM_D3*/\ + MUX_VAL(CP(CAM_D4), (IEN | PTD | DIS | M0)) /*CAM_D4*/\ + MUX_VAL(CP(CAM_D5), (IEN | PTD | DIS | M0)) /*CAM_D5*/\ + MUX_VAL(CP(CAM_D6), (IEN | PTD | DIS | M0)) /*CAM_D6*/\ + MUX_VAL(CP(CAM_D7), (IEN | PTD | DIS | M0)) /*CAM_D7*/\ + MUX_VAL(CP(CAM_D8), (IEN | PTD | DIS | M0)) /*CAM_D8*/\ + MUX_VAL(CP(CAM_D9), (IEN | PTD | DIS | M0)) /*CAM_D9*/\ + MUX_VAL(CP(CAM_D10), (IEN | PTD | DIS | M0)) /*CAM_D10*/\ + MUX_VAL(CP(CAM_D11), (IEN | PTD | DIS | M0)) /*CAM_D11*/\ + MUX_VAL(CP(CAM_XCLKB), (IDIS | PTD | DIS | M0)) /*CAM_XCLKB*/\ + MUX_VAL(CP(CAM_WEN), (IEN | PTD | DIS | M4)) /*GPIO_167*/\ + MUX_VAL(CP(CAM_STROBE), (IDIS | PTD | DIS | M0)) /*CAM_STROBE*/\ + MUX_VAL(CP(CSI2_DX0), (IEN | PTD | DIS | M0)) /*CSI2_DX0*/\ + MUX_VAL(CP(CSI2_DY0), (IEN | PTD | DIS | M0)) /*CSI2_DY0*/\ + MUX_VAL(CP(CSI2_DX1), (IEN | PTD | DIS | M0)) /*CSI2_DX1*/\ + MUX_VAL(CP(CSI2_DY1), (IEN | PTD | DIS | M0)) /*CSI2_DY1*/\ + /*Audio Interface */\ + MUX_VAL(CP(MCBSP2_FSX), (IEN | PTD | DIS | M0)) /*McBSP2_FSX*/\ + MUX_VAL(CP(MCBSP2_CLKX), (IEN | PTD | DIS | M0)) /*McBSP2_CLK*/\ + MUX_VAL(CP(MCBSP2_DR), (IEN | PTD | DIS | M0)) /*McBSP2_DR*/\ + MUX_VAL(CP(MCBSP2_DX), (IDIS | PTD | DIS | M0)) /*McBSP2_DX*/\ + /*Expansion card */\ + MUX_VAL(CP(MMC1_CLK), (IDIS | PTU | EN | M0)) /*MMC1_CLK*/\ + MUX_VAL(CP(MMC1_CMD), (IEN | PTU | EN | M0)) /*MMC1_CMD*/\ + MUX_VAL(CP(MMC1_DAT0), (IEN | PTU | EN | M0)) /*MMC1_DAT0*/\ + MUX_VAL(CP(MMC1_DAT1), (IEN | PTU | EN | M0)) /*MMC1_DAT1*/\ + MUX_VAL(CP(MMC1_DAT2), (IEN | PTU | EN | M0)) /*MMC1_DAT2*/\ + MUX_VAL(CP(MMC1_DAT3), (IEN | PTU | EN | M0)) /*MMC1_DAT3*/\ + MUX_VAL(CP(MMC1_DAT4), (IEN | PTU | EN | M0)) /*MMC1_DAT4*/\ + MUX_VAL(CP(MMC1_DAT5), (IEN | PTU | EN | M0)) /*MMC1_DAT5*/\ + MUX_VAL(CP(MMC1_DAT6), (IEN | PTU | EN | M0)) /*MMC1_DAT6*/\ + MUX_VAL(CP(MMC1_DAT7), (IEN | PTU | EN | M0)) /*MMC1_DAT7*/\ + /*Wireless LAN */\ + MUX_VAL(CP(MMC2_CLK), (IEN | PTU | EN | M4)) /*GPIO_130*/\ + MUX_VAL(CP(MMC2_CMD), (IEN | PTU | EN | M4)) /*GPIO_131*/\ + MUX_VAL(CP(MMC2_DAT0), (IEN | PTU | EN | M4)) /*GPIO_132*/\ + MUX_VAL(CP(MMC2_DAT1), (IEN | PTU | EN | M4)) /*GPIO_133*/\ + MUX_VAL(CP(MMC2_DAT2), (IEN | PTU | EN | M4)) /*GPIO_134*/\ + MUX_VAL(CP(MMC2_DAT3), (IEN | PTU | EN | M4)) /*GPIO_135*/\ + MUX_VAL(CP(MMC2_DAT4), (IEN | PTU | EN | M4)) /*GPIO_136*/\ + MUX_VAL(CP(MMC2_DAT5), (IEN | PTU | EN | M4)) /*GPIO_137*/\ + MUX_VAL(CP(MMC2_DAT6), (IEN | PTU | EN | M4)) /*GPIO_138*/\ + MUX_VAL(CP(MMC2_DAT7), (IEN | PTU | EN | M4)) /*GPIO_139*/\ + /*Bluetooth*/\ + MUX_VAL(CP(MCBSP3_DX), (IEN | PTD | DIS | M1)) /*UART2_CTS*/\ + MUX_VAL(CP(MCBSP3_DR), (IDIS | PTD | DIS | M1)) /*UART2_RTS*/\ + MUX_VAL(CP(MCBSP3_CLKX), (IDIS | PTD | DIS | M1)) /*UART2_TX*/\ + MUX_VAL(CP(MCBSP3_FSX), (IEN | PTD | DIS | M1)) /*UART2_RX*/\ + MUX_VAL(CP(UART2_CTS), (IEN | PTD | DIS | M4)) /*GPIO_144*/\ + MUX_VAL(CP(UART2_RTS), (IEN | PTD | DIS | M4)) /*GPIO_145*/\ + MUX_VAL(CP(UART2_TX), (IEN | PTD | DIS | M4)) /*GPIO_146*/\ + MUX_VAL(CP(UART2_RX), (IEN | PTD | DIS | M4)) /*GPIO_147*/\ + /*Modem Interface */\ + MUX_VAL(CP(UART1_TX), (IDIS | PTD | DIS | M0)) /*UART1_TX*/\ + MUX_VAL(CP(UART1_RTS), (IDIS | PTD | DIS | M4)) /*GPIO_149*/ \ + MUX_VAL(CP(UART1_CTS), (IDIS | PTD | DIS | M4)) /*GPIO_150*/ \ + MUX_VAL(CP(UART1_RX), (IEN | PTD | DIS | M0)) /*UART1_RX*/\ + MUX_VAL(CP(MCBSP4_CLKX), (IEN | PTD | DIS | M1)) /*SSI1_DAT*/\ + MUX_VAL(CP(MCBSP4_DR), (IEN | PTD | DIS | M1)) /*SSI1_FLAG*/\ + MUX_VAL(CP(MCBSP4_DX), (IEN | PTD | DIS | M1)) /*SSI1_RDY*/\ + MUX_VAL(CP(MCBSP4_FSX), (IEN | PTD | DIS | M1)) /*SSI1_WAKE*/\ + MUX_VAL(CP(MCBSP1_CLKR), (IDIS | PTD | DIS | M4)) /*GPIO_156*/\ + MUX_VAL(CP(MCBSP1_FSR), (IDIS | PTU | EN | M4)) /*GPIO_157*/\ + MUX_VAL(CP(MCBSP1_DX), (IDIS | PTD | DIS | M4)) /*GPIO_158*/\ + MUX_VAL(CP(MCBSP1_DR), (IDIS | PTD | DIS | M4)) /*GPIO_159*/\ + MUX_VAL(CP(MCBSP_CLKS), (IEN | PTU | DIS | M0)) /*McBSP_CLKS*/\ + MUX_VAL(CP(MCBSP1_FSX), (IDIS | PTD | DIS | M4)) /*GPIO_161*/\ + MUX_VAL(CP(MCBSP1_CLKX), (IDIS | PTD | DIS | M4)) /*GPIO_162*/\ + /*Serial Interface*/\ + MUX_VAL(CP(UART3_CTS_RCTX), (IEN | PTD | EN | M0)) /*UART3_CTS*/\ + MUX_VAL(CP(UART3_RTS_SD), (IDIS | PTD | DIS | M0)) /*UART3_RTS*/\ + MUX_VAL(CP(UART3_RX_IRRX), (IEN | PTD | DIS | M0)) /*UART3_RX*/\ + MUX_VAL(CP(UART3_TX_IRTX), (IDIS | PTD | DIS | M0)) /*UART3_TX*/\ + MUX_VAL(CP(HSUSB0_CLK), (IEN | PTD | DIS | M0)) /*HSUSB0_CLK*/\ + MUX_VAL(CP(HSUSB0_STP), (IDIS | PTU | EN | M0)) /*HSUSB0_STP*/\ + MUX_VAL(CP(HSUSB0_DIR), (IEN | PTD | DIS | M0)) /*HSUSB0_DIR*/\ + MUX_VAL(CP(HSUSB0_NXT), (IEN | PTD | DIS | M0)) /*HSUSB0_NXT*/\ + MUX_VAL(CP(HSUSB0_DATA0), (IEN | PTD | DIS | M0)) /*HSUSB0_DA0*/\ + MUX_VAL(CP(HSUSB0_DATA1), (IEN | PTD | DIS | M0)) /*HSUSB0_DA1*/\ + MUX_VAL(CP(HSUSB0_DATA2), (IEN | PTD | DIS | M0)) /*HSUSB0_DA2*/\ + MUX_VAL(CP(HSUSB0_DATA3), (IEN | PTD | DIS | M0)) /*HSUSB0_DA3*/\ + MUX_VAL(CP(HSUSB0_DATA4), (IEN | PTD | DIS | M0)) /*HSUSB0_DA4*/\ + MUX_VAL(CP(HSUSB0_DATA5), (IEN | PTD | DIS | M0)) /*HSUSB0_DA5*/\ + MUX_VAL(CP(HSUSB0_DATA6), (IEN | PTD | DIS | M0)) /*HSUSB0_DA6*/\ + MUX_VAL(CP(HSUSB0_DATA7), (IEN | PTD | DIS | M0)) /*HSUSB0_DA7*/\ + MUX_VAL(CP(I2C1_SCL), (IEN | PTU | EN | M0)) /*I2C1_SCL*/\ + MUX_VAL(CP(I2C1_SDA), (IEN | PTU | EN | M0)) /*I2C1_SDA*/\ + MUX_VAL(CP(I2C2_SCL), (IEN | PTU | EN | M4)) /*GPIO_168*/\ + MUX_VAL(CP(I2C2_SDA), (IEN | PTU | EN | M4)) /*GPIO_183*/\ + MUX_VAL(CP(I2C3_SCL), (IEN | PTU | EN | M0)) /*I2C3_SCL*/\ + MUX_VAL(CP(I2C3_SDA), (IEN | PTU | EN | M0)) /*I2C3_SDA*/\ + MUX_VAL(CP(I2C4_SCL), (IEN | PTU | EN | M0)) /*I2C4_SCL*/\ + MUX_VAL(CP(I2C4_SDA), (IEN | PTU | EN | M0)) /*I2C4_SDA*/\ + MUX_VAL(CP(HDQ_SIO), (IDIS | PTU | EN | M4)) /*GPIO_170*/\ + MUX_VAL(CP(MCSPI1_CLK), (IEN | PTU | EN | M4)) /*GPIO_171*/\ + MUX_VAL(CP(MCSPI1_SIMO), (IEN | PTU | EN | M4)) /*GPIO_172*/\ + MUX_VAL(CP(MCSPI1_SOMI), (IEN | PTD | DIS | M0)) /*McSPI1_SOM*/\ + MUX_VAL(CP(MCSPI1_CS0), (IEN | PTD | EN | M0)) /*McSPI1_CS0*/\ + MUX_VAL(CP(MCSPI1_CS1), (IDIS | PTD | EN | M0)) /*McSPI1_CS1*/\ + MUX_VAL(CP(MCSPI1_CS2), (IDIS | PTD | DIS | M4)) /*GPIO_176*/\ + /* USB EHCI (port 2) */\ + MUX_VAL(CP(MCSPI1_CS3), (IEN | PTU | DIS | M3)) /*HSUSB2_DA2*/\ + MUX_VAL(CP(MCSPI2_CLK), (IEN | PTU | DIS | M3)) /*HSUSB2_DA7*/\ + MUX_VAL(CP(MCSPI2_SIMO), (IEN | PTU | DIS | M3)) /*HSUSB2_DA4*/\ + MUX_VAL(CP(MCSPI2_SOMI), (IEN | PTU | DIS | M3)) /*HSUSB2_DA5*/\ + MUX_VAL(CP(MCSPI2_CS0), (IEN | PTU | DIS | M3)) /*HSUSB2_DA6*/\ + MUX_VAL(CP(MCSPI2_CS1), (IEN | PTU | DIS | M3)) /*HSUSB2_DA3*/\ + MUX_VAL(CP(ETK_D10_ES2), (IDIS | PTU | DIS | M3)) /*HSUSB2_CLK*/\ + MUX_VAL(CP(ETK_D11_ES2), (IDIS | PTU | DIS | M3)) /*HSUSB2_STP*/\ + MUX_VAL(CP(ETK_D12_ES2), (IEN | PTU | DIS | M3)) /*HSUSB2_DIR*/\ + MUX_VAL(CP(ETK_D13_ES2), (IEN | PTU | DIS | M3)) /*HSUSB2_NXT*/\ + MUX_VAL(CP(ETK_D14_ES2), (IEN | PTU | DIS | M3)) /*HSUSB2_DA0*/\ + MUX_VAL(CP(ETK_D15_ES2), (IEN | PTU | DIS | M3)) /*HSUSB2_DA1*/\ + /*Control and debug */\ + MUX_VAL(CP(SYS_32K), (IEN | PTD | DIS | M0)) /*SYS_32K*/\ + MUX_VAL(CP(SYS_CLKREQ), (IEN | PTD | DIS | M0)) /*SYS_CLKREQ*/\ + MUX_VAL(CP(SYS_NIRQ), (IEN | PTU | EN | M0)) /*SYS_nIRQ*/\ + MUX_VAL(CP(SYS_BOOT0), (IEN | PTD | DIS | M4)) /*GPIO_2*/\ + MUX_VAL(CP(SYS_BOOT1), (IEN | PTD | DIS | M4)) /*GPIO_3*/\ + MUX_VAL(CP(SYS_BOOT2), (IEN | PTD | DIS | M4)) /*MMC1_WP*/\ + MUX_VAL(CP(SYS_BOOT3), (IEN | PTD | DIS | M4)) /*GPIO_5*/\ + MUX_VAL(CP(SYS_BOOT4), (IEN | PTD | DIS | M4)) /*GPIO_6*/\ + MUX_VAL(CP(SYS_BOOT5), (IEN | PTD | DIS | M4)) /*GPIO_7*/\ + MUX_VAL(CP(SYS_BOOT6), (IDIS | PTD | DIS | M4)) /*GPIO_8*/ \ + MUX_VAL(CP(SYS_OFF_MODE), (IEN | PTD | DIS | M0)) /*SYS_OFF_MD*/\ + MUX_VAL(CP(SYS_CLKOUT1), (IEN | PTD | DIS | M0)) /*SYS_CLKOUT*/\ + MUX_VAL(CP(SYS_CLKOUT2), (IEN | PTU | EN | M4)) /*GPIO_186*/\ + MUX_VAL(CP(ETK_CLK_ES2), (IDIS | PTU | EN | M3)) /*HSUSB1_STP*/\ + MUX_VAL(CP(ETK_CTL_ES2), (IDIS | PTU | DIS | M3)) /*HSUSB1_CLK*/\ + MUX_VAL(CP(ETK_D0_ES2), (IEN | PTU | DIS | M3)) /*HSUSB1_DA0*/\ + MUX_VAL(CP(ETK_D1_ES2), (IEN | PTU | DIS | M3)) /*HSUSB1_DA1*/\ + MUX_VAL(CP(ETK_D2_ES2), (IEN | PTU | DIS | M3)) /*HSUSB1_DA2*/\ + MUX_VAL(CP(ETK_D3_ES2), (IEN | PTU | DIS | M3)) /*HSUSB1_DA7*/\ + MUX_VAL(CP(ETK_D4_ES2), (IEN | PTU | DIS | M3)) /*HSUSB1_DA4*/\ + MUX_VAL(CP(ETK_D5_ES2), (IEN | PTU | DIS | M3)) /*HSUSB1_DA5*/\ + MUX_VAL(CP(ETK_D6_ES2), (IEN | PTU | DIS | M3)) /*HSUSB1_DA6*/\ + MUX_VAL(CP(ETK_D7_ES2), (IEN | PTU | DIS | M3)) /*HSUSB1_DA3*/\ + MUX_VAL(CP(ETK_D8_ES2), (IEN | PTU | DIS | M3)) /*HSUSB1_DIR*/\ + MUX_VAL(CP(ETK_D9_ES2), (IEN | PTU | DIS | M3)) /*HSUSB1_NXT*/\ + MUX_VAL(CP(D2D_MCAD1), (IEN | PTD | EN | M0)) /*d2d_mcad1*/\ + MUX_VAL(CP(D2D_MCAD2), (IEN | PTD | EN | M0)) /*d2d_mcad2*/\ + MUX_VAL(CP(D2D_MCAD3), (IEN | PTD | EN | M0)) /*d2d_mcad3*/\ + MUX_VAL(CP(D2D_MCAD4), (IEN | PTD | EN | M0)) /*d2d_mcad4*/\ + MUX_VAL(CP(D2D_MCAD5), (IEN | PTD | EN | M0)) /*d2d_mcad5*/\ + MUX_VAL(CP(D2D_MCAD6), (IEN | PTD | EN | M0)) /*d2d_mcad6*/\ + MUX_VAL(CP(D2D_MCAD7), (IEN | PTD | EN | M0)) /*d2d_mcad7*/\ + MUX_VAL(CP(D2D_MCAD8), (IEN | PTD | EN | M0)) /*d2d_mcad8*/\ + MUX_VAL(CP(D2D_MCAD9), (IEN | PTD | EN | M0)) /*d2d_mcad9*/\ + MUX_VAL(CP(D2D_MCAD10), (IEN | PTD | EN | M0)) /*d2d_mcad10*/\ + MUX_VAL(CP(D2D_MCAD11), (IEN | PTD | EN | M0)) /*d2d_mcad11*/\ + MUX_VAL(CP(D2D_MCAD12), (IEN | PTD | EN | M0)) /*d2d_mcad12*/\ + MUX_VAL(CP(D2D_MCAD13), (IEN | PTD | EN | M0)) /*d2d_mcad13*/\ + MUX_VAL(CP(D2D_MCAD14), (IEN | PTD | EN | M0)) /*d2d_mcad14*/\ + MUX_VAL(CP(D2D_MCAD15), (IEN | PTD | EN | M0)) /*d2d_mcad15*/\ + MUX_VAL(CP(D2D_MCAD16), (IEN | PTD | EN | M0)) /*d2d_mcad16*/\ + MUX_VAL(CP(D2D_MCAD17), (IEN | PTD | EN | M0)) /*d2d_mcad17*/\ + MUX_VAL(CP(D2D_MCAD18), (IEN | PTD | EN | M0)) /*d2d_mcad18*/\ + MUX_VAL(CP(D2D_MCAD19), (IEN | PTD | EN | M0)) /*d2d_mcad19*/\ + MUX_VAL(CP(D2D_MCAD20), (IEN | PTD | EN | M0)) /*d2d_mcad20*/\ + MUX_VAL(CP(D2D_MCAD21), (IEN | PTD | EN | M0)) /*d2d_mcad21*/\ + MUX_VAL(CP(D2D_MCAD22), (IEN | PTD | EN | M0)) /*d2d_mcad22*/\ + MUX_VAL(CP(D2D_MCAD23), (IEN | PTD | EN | M0)) /*d2d_mcad23*/\ + MUX_VAL(CP(D2D_MCAD24), (IEN | PTD | EN | M0)) /*d2d_mcad24*/\ + MUX_VAL(CP(D2D_MCAD25), (IEN | PTD | EN | M0)) /*d2d_mcad25*/\ + MUX_VAL(CP(D2D_MCAD26), (IEN | PTD | EN | M0)) /*d2d_mcad26*/\ + MUX_VAL(CP(D2D_MCAD27), (IEN | PTD | EN | M0)) /*d2d_mcad27*/\ + MUX_VAL(CP(D2D_MCAD28), (IEN | PTD | EN | M0)) /*d2d_mcad28*/\ + MUX_VAL(CP(D2D_MCAD29), (IEN | PTD | EN | M0)) /*d2d_mcad29*/\ + MUX_VAL(CP(D2D_MCAD30), (IEN | PTD | EN | M0)) /*d2d_mcad30*/\ + MUX_VAL(CP(D2D_MCAD31), (IEN | PTD | EN | M0)) /*d2d_mcad31*/\ + MUX_VAL(CP(D2D_MCAD32), (IEN | PTD | EN | M0)) /*d2d_mcad32*/\ + MUX_VAL(CP(D2D_MCAD33), (IEN | PTD | EN | M0)) /*d2d_mcad33*/\ + MUX_VAL(CP(D2D_MCAD34), (IEN | PTD | EN | M0)) /*d2d_mcad34*/\ + MUX_VAL(CP(D2D_MCAD35), (IEN | PTD | EN | M0)) /*d2d_mcad35*/\ + MUX_VAL(CP(D2D_MCAD36), (IEN | PTD | EN | M0)) /*d2d_mcad36*/\ + MUX_VAL(CP(D2D_CLK26MI), (IEN | PTD | DIS | M0)) /*d2d_clk26m*/\ + MUX_VAL(CP(D2D_NRESPWRON), (IEN | PTD | EN | M0)) /*d2d_nrespw*/\ + MUX_VAL(CP(D2D_NRESWARM), (IEN | PTU | EN | M0)) /*d2d_nreswa*/\ + MUX_VAL(CP(D2D_ARM9NIRQ), (IEN | PTD | DIS | M0)) /*d2d_arm9ni*/\ + MUX_VAL(CP(D2D_UMA2P6FIQ), (IEN | PTD | DIS | M0)) /*d2d_uma2p6*/\ + MUX_VAL(CP(D2D_SPINT), (IEN | PTD | EN | M0)) /*d2d_spint*/\ + MUX_VAL(CP(D2D_FRINT), (IEN | PTD | EN | M0)) /*d2d_frint*/\ + MUX_VAL(CP(D2D_DMAREQ0), (IEN | PTD | DIS | M0)) /*d2d_dmare0*/\ + MUX_VAL(CP(D2D_DMAREQ1), (IEN | PTD | DIS | M0)) /*d2d_dmare1*/\ + MUX_VAL(CP(D2D_DMAREQ2), (IEN | PTD | DIS | M0)) /*d2d_dmare2*/\ + MUX_VAL(CP(D2D_DMAREQ3), (IEN | PTD | DIS | M0)) /*d2d_dmare3*/\ + MUX_VAL(CP(D2D_N3GTRST), (IEN | PTD | DIS | M0)) /*d2d_n3gtrs*/\ + MUX_VAL(CP(D2D_N3GTDI), (IEN | PTD | DIS | M0)) /*d2d_n3gtdi*/\ + MUX_VAL(CP(D2D_N3GTDO), (IEN | PTD | DIS | M0)) /*d2d_n3gtdo*/\ + MUX_VAL(CP(D2D_N3GTMS), (IEN | PTD | DIS | M0)) /*d2d_n3gtms*/\ + MUX_VAL(CP(D2D_N3GTCK), (IEN | PTD | DIS | M0)) /*d2d_n3gtck*/\ + MUX_VAL(CP(D2D_N3GRTCK), (IEN | PTD | DIS | M0)) /*d2d_n3grtc*/\ + MUX_VAL(CP(D2D_MSTDBY), (IEN | PTU | EN | M0)) /*d2d_mstdby*/\ + MUX_VAL(CP(D2D_SWAKEUP), (IEN | PTD | EN | M0)) /*d2d_swakeu*/\ + MUX_VAL(CP(D2D_IDLEREQ), (IEN | PTD | DIS | M0)) /*d2d_idlere*/\ + MUX_VAL(CP(D2D_IDLEACK), (IEN | PTU | EN | M0)) /*d2d_idleac*/\ + MUX_VAL(CP(D2D_MWRITE), (IEN | PTD | DIS | M0)) /*d2d_mwrite*/\ + MUX_VAL(CP(D2D_SWRITE), (IEN | PTD | DIS | M0)) /*d2d_swrite*/\ + MUX_VAL(CP(D2D_MREAD), (IEN | PTD | DIS | M0)) /*d2d_mread*/\ + MUX_VAL(CP(D2D_SREAD), (IEN | PTD | DIS | M0)) /*d2d_sread*/\ + MUX_VAL(CP(D2D_MBUSFLAG), (IEN | PTD | DIS | M0)) /*d2d_mbusfl*/\ + MUX_VAL(CP(D2D_SBUSFLAG), (IEN | PTD | DIS | M0)) /*d2d_sbusfl*/\ + MUX_VAL(CP(SDRC_CKE0), (IDIS | PTU | EN | M0)) /*sdrc_cke0*/\ + MUX_VAL(CP(SDRC_CKE1), (IDIS | PTU | EN | M0)) /*sdrc_cke1*/ + +#define MUX_RX51_C() \ + MUX_VAL(CP(MCBSP3_DX), (IEN | PTD | DIS | M4)) /*GPIO_140*/\ + MUX_VAL(CP(MCBSP3_DR), (IEN | PTD | DIS | M4)) /*GPIO_142*/\ + MUX_VAL(CP(MCBSP3_CLKX), (IEN | PTD | DIS | M4)) /*GPIO_141*/\ + MUX_VAL(CP(UART2_CTS), (IEN | PTU | EN | M0)) /*UART2_CTS*/\ + MUX_VAL(CP(UART2_RTS), (IDIS | PTD | DIS | M0)) /*UART2_RTS*/\ + MUX_VAL(CP(UART2_TX), (IDIS | PTD | DIS | M0)) /*UART2_TX*/ + +#endif diff --git a/boards.cfg b/boards.cfg index 3cf75c3..9c78a7b 100644 --- a/boards.cfg +++ b/boards.cfg @@ -214,6 +214,7 @@ devkit8000 arm armv7 devkit8000 timll mcx arm armv7 mcx htkw omap3 tricorder arm armv7 tricorder corscience omap3 twister arm armv7 twister technexion omap3 +nokia_rx51 arm armv7 rx51 nokia omap3 omap4_panda arm armv7 panda ti omap4 omap4_sdp4430 arm armv7 sdp4430 ti omap4 omap5_evm arm armv7 omap5_evm ti omap5 diff --git a/include/configs/nokia_rx51.h b/include/configs/nokia_rx51.h new file mode 100644 index 0000000..ac5136a --- /dev/null +++ b/include/configs/nokia_rx51.h @@ -0,0 +1,373 @@ +/* + * (C) Copyright 2011-2012 + * Pali Rohár pali.rohar@gmail.com + * + * (C) Copyright 2010 + * Alistair Buxton a.j.buxton@gmail.com + * + * Derived from Beagle Board code: + * (C) Copyright 2006-2008 + * Texas Instruments. + * Richard Woodruff r-woodruff2@ti.com + * Syed Mohammed Khasim x0khasim@ti.com + * + * Configuration settings for the Nokia RX-51 aka N900. + * + * 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 as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#ifndef __CONFIG_H +#define __CONFIG_H + +/* + * High Level Configuration Options + */ + +#define CONFIG_OMAP /* in a TI OMAP core */ +#define CONFIG_OMAP34XX /* which is a 34XX */ +#define CONFIG_OMAP3430 /* which is in a 3430 */ +#define CONFIG_OMAP3_RX51 /* working with RX51 */ +#define CONFIG_SYS_L2CACHE_OFF /* pretend there is no L2 CACHE */ + +/* It doesn't really matter what we set this to. NOLO will load u-boot.bin + * in a random place anyway, and we have to copy. + */ +#define CONFIG_SYS_TEXT_BASE 0x80008000 + +#define CONFIG_SDRC /* The chip has SDRC controller */ + +#include <asm/arch/cpu.h> /* get chip and board defs */ +#include <asm/arch/omap3.h> +#include <asm/arch/mem.h> + +/* + * Display CPU and Board information + */ +#define CONFIG_DISPLAY_CPUINFO +#define CONFIG_DISPLAY_BOARDINFO + +/* Clock Defines */ +#define V_OSCK 26000000 /* Clock output from T2 */ +#define V_SCLK (V_OSCK >> 1) + +#undef CONFIG_USE_IRQ /* no support for IRQs */ +#define CONFIG_MISC_INIT_R +#define CONFIG_SKIP_LOWLEVEL_INIT /* NOLO set everything up */ + +#define CONFIG_CMDLINE_TAG /* enable passing kernel command line string */ +#define CONFIG_INITRD_TAG /* enable passing initrd */ +#define CONFIG_SETUP_MEMORY_TAGS /* enable memory tag */ + +/* + * Size of malloc() pool + */ +#define CONFIG_ENV_SIZE (128 << 10) /* 128 KiB Sector */ +#define CONFIG_UBI_SIZE (512 << 10) /* 512 KiB Sector */ +#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + CONFIG_UBI_SIZE + \ + (128 << 10)) + +/* + * Hardware drivers + */ + +/* + * NS16550 Configuration + */ +#define V_NS16550_CLK 48000000 /* 48MHz (APLL96/2) */ + +#define CONFIG_SYS_NS16550 +#define CONFIG_SYS_NS16550_SERIAL +#define CONFIG_SYS_NS16550_REG_SIZE (-4) +#define CONFIG_SYS_NS16550_CLK V_NS16550_CLK + +/* + * select serial console configuration + */ +#define CONFIG_CONS_INDEX 3 +#define CONFIG_SYS_NS16550_COM3 OMAP34XX_UART3 +#define CONFIG_SERIAL3 3 /* UART3 on RX-51 */ + +/* allow to overwrite serial and ethaddr */ +#define CONFIG_ENV_OVERWRITE +#define CONFIG_BAUDRATE 115200 +#define CONFIG_SYS_BAUDRATE_TABLE {4800, 9600, 19200, 38400, 57600, 115200} +#define CONFIG_MMC +#define CONFIG_GENERIC_MMC +#define CONFIG_OMAP_HSMMC +#define CONFIG_DOS_PARTITION + +/* USB */ +#define CONFIG_MUSB_UDC +#define CONFIG_MUSB_HDC +#define CONFIG_USB_OMAP3 +#define CONFIG_TWL4030_USB + +/* USB device configuration */ +#define CONFIG_USB_DEVICE +/* Maemo kernel 2.6.28 will crash if u-boot enable usb tty */ +/* +#define CONFIG_USB_TTY +*/ +#define CONFIG_USBD_VENDORID 0x0421 +#define CONFIG_USBD_PRODUCTID 0x01c8 +#define CONFIG_USBD_MANUFACTURER "Nokia" +#define CONFIG_USBD_PRODUCT_NAME "N900" + +#define CONFIG_SYS_CONSOLE_IS_IN_ENV +#define CONFIG_SYS_NO_FLASH + +/* OneNand support is disabled, because U-Boot image is too big */ +/* Uncomment next line to enable it */ +/* #define ONENAND_SUPPORT */ + +/* commands to include */ +#include <config_cmd_default.h> + +#define CONFIG_CMD_EXT2 /* EXT2 Support */ +#define CONFIG_CMD_FAT /* FAT support */ + +#define CONFIG_CMD_I2C /* I2C serial bus support */ +#define CONFIG_CMD_MMC /* MMC support */ +#define CONFIG_CMD_GPIO /* Enable gpio command */ + +#define CONFIG_CMDLINE_EDITING /* add command line history */ +#define CONFIG_AUTO_COMPLETE /* add autocompletion support */ + +#define CONFIG_CMD_CLEAR /* ANSI terminal clear screen command */ + +#ifdef ONENAND_SUPPORT +#define CONFIG_CMD_ONENAND /* NAND support */ +#define CONFIG_CMD_MTDPARTS /* mtd parts support */ +#define CONFIG_CMD_UBI /* UBI Support */ +#define CONFIG_CMD_UBIFS /* UBIFS Support */ +#endif + +#undef CONFIG_CMD_FPGA /* FPGA configuration Support */ +#undef CONFIG_CMD_IMI /* iminfo */ +#undef CONFIG_CMD_NET /* bootp, tftpboot, rarpboot */ +#undef CONFIG_CMD_NFS /* NFS support */ + +#define CONFIG_OMAP3_SPI +#define CONFIG_HARD_I2C +#define CONFIG_SYS_I2C_SPEED 100000 +#define CONFIG_SYS_I2C_SLAVE 1 +#define CONFIG_SYS_I2C_BUS 0 +#define CONFIG_SYS_I2C_BUS_SELECT 1 +#define CONFIG_DRIVER_OMAP34XX_I2C 1 + +/* + * TWL4030 + */ +#define CONFIG_TWL4030_POWER +#define CONFIG_TWL4030_LED +#define CONFIG_TWL4030_KEYPAD + +/* + * Board NAND Info. + */ +#ifdef ONENAND_SUPPORT +#define PISMO1_NAND_SIZE GPMC_SIZE_128M +#define PISMO1_ONEN_SIZE GPMC_SIZE_128M +#define CONFIG_SYS_ONENAND_BASE ONENAND_MAP +#define CONFIG_MTD_DEVICE +#define CONFIG_MTD_PARTITIONS +#define CONFIG_RBTREE +#define CONFIG_LZO +#define MTDIDS_DEFAULT "onenand0=onenand" +#define MTDPARTS_DEFAULT "mtdparts=onenand:128k(bootloader)," \ + "384k(config),256k(log),2m(kernel)," \ + "2m(initfs),-(rootfs)" +#else +#define MTDPARTS_DEFAULT +#endif + +/* Watchdog support */ +#define CONFIG_HW_WATCHDOG + +/* + * Framebuffer + */ +/* Video console */ +#define CONFIG_VIDEO +#define CONFIG_CFB_CONSOLE +#define CONFIG_CFB_CONSOLE_ANSI /* Enable ANSI escape codes in framebuffer */ +#define CONFIG_VIDEO_LOGO +#define VIDEO_FB_16BPP_PIXEL_SWAP +#define VIDEO_FB_16BPP_WORD_SWAP +#define CONFIG_VIDEO_SW_CURSOR +#define CONFIG_SPLASH_SCREEN + +/* functions for cfb_console */ +#define VIDEO_KBD_INIT_FCT rx51_kp_init() +#define VIDEO_TSTC_FCT rx51_kp_tstc +#define VIDEO_GETC_FCT rx51_kp_getc +#ifndef __ASSEMBLY__ +int rx51_kp_init(void); +int rx51_kp_tstc(void); +int rx51_kp_getc(void); +#endif + +/* Environment information */ +#define CONFIG_BOOTDELAY 3 + +#define CONFIG_EXTRA_ENV_SETTINGS \ + "mtdparts=" MTDPARTS_DEFAULT "\0" \ + "usbtty=cdc_acm\0" \ + "stdin=vga\0" \ + "stdout=vga\0" \ + "stderr=vga\0" \ + "setcon=setenv stdin ${con};" \ + "setenv stdout ${con};" \ + "setenv stderr ${con}\0" \ + "sercon=setenv con serial; run setcon\0" \ + "usbcon=setenv con usbtty; run setcon\0" \ + "vgacon=setenv con vga; run setcon\0" \ + "slide=gpio input 71\0" \ + "switchmmc=mmc dev ${mmcnum}\0" \ + "kernaddr=0x82008000\0" \ + "initrdaddr=0x84008000\0" \ + "scriptaddr=0x86008000\0" \ + "fileload=${mmctype}load mmc ${mmcnum}:${mmcpart} " \ + "${loadaddr} ${mmcfile}\0" \ + "kernload=setenv loadaddr ${kernaddr};" \ + "setenv mmcfile ${mmckernfile};" \ + "run fileload\0" \ + "initrdload=setenv loadaddr ${initrdaddr};" \ + "setenv mmcfile ${mmcinitrdfile};" \ + "run fileload\0" \ + "scriptload=setenv loadaddr ${scriptaddr};" \ + "setenv mmcfile ${mmcscriptfile};" \ + "run fileload\0" \ + "scriptboot=echo Running ${mmcscriptfile} from mmc " \ + "${mmcnum}:${mmcpart} ...; source ${scriptaddr}\0" \ + "kernboot=echo Booting ${mmckernfile} from mmc " \ + "${mmcnum}:${mmcpart} ...; bootm ${kernaddr}\0" \ + "kerninitrdboot=echo Booting ${mmckernfile} ${mmcinitrdfile} from mmc "\ + "${mmcnum}:${mmcpart} ...; bootm ${kernaddr} ${initrdaddr}\0" \ + "attachboot=echo Booting attached kernel image ...;" \ + "setenv atagaddr 0x80000100;" \ + "bootm ${rx51_kernaddr}\0" \ + "trymmcscriptboot=if run switchmmc; then " \ + "if run scriptload; then " \ + "run scriptboot;" \ + "fi;" \ + "fi\0" \ + "trymmckernboot=if run switchmmc; then " \ + "if run kernload; then " \ + "run kernboot;" \ + "fi;" \ + "fi\0" \ + "trymmckerninitrdboot=if run switchmmc; then " \ + "if run initrdload; then " \ + "if run kernload; then " \ + "run kerninitrdboot;" \ + "fi;" \ + "fi; " \ + "fi\0" \ + "trymmcpartboot=setenv mmcscriptfile boot.scr; run trymmcscriptboot;" \ + "setenv mmckernfile uImage; run trymmckernboot\0" \ + "trymmcallpartboot=setenv mmcpart 1; run trymmcpartboot;" \ + "setenv mmcpart 2; run trymmcpartboot;" \ + "setenv mmcpart 3; run trymmcpartboot;" \ + "setenv mmcpart 4; run trymmcpartboot\0" \ + "trymmcboot=if run switchmmc; then " \ + "setenv mmctype fat;" \ + "run trymmcallpartboot;" \ + "setenv mmctype ext2;" \ + "run trymmcallpartboot;" \ + "fi\0" \ + "emmcboot=setenv mmcnum 1; run trymmcboot\0" \ + "sdboot=setenv mmcnum 0; run trymmcboot\0" \ + "" + +#define CONFIG_PREBOOT \ + "if run slide; then true; else run attachboot; fi" + +#define CONFIG_PREMONITOR \ + "echo Extra commands:;" \ + "echo run sercon - Use serial port for control.;" \ + "echo run usbcon - Use usbtty for control.;" \ + "echo run vgacon - Use framebuffer/keyboard.;" \ + "echo run sdboot - Boot from SD card slot.;" \ + "echo run emmcboot - Boot internal eMMC memory.;" \ + "echo run attachboot - Boot attached kernel image.;" \ + "echo" + +#define CONFIG_BOOTCOMMAND \ + "run sdboot;" \ + "run emmcboot;" \ + "run attachboot;" \ + "echo" + +/* + * Miscellaneous configurable options + */ +#define CONFIG_SYS_LONGHELP /* undef to save memory */ +#define CONFIG_SYS_HUSH_PARSER /* use "hush" command parser */ +#define CONFIG_SYS_PROMPT_HUSH_PS2 "> " +#define CONFIG_SYS_PROMPT "Nokia RX-51 # " +#define CONFIG_SYS_CBSIZE 256 /* Console I/O Buffer Size */ +/* Print Buffer Size */ +#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \ + sizeof(CONFIG_SYS_PROMPT) + 16) +#define CONFIG_SYS_MAXARGS 16 /* max number of command args */ +/* Boot Argument Buffer Size */ +#define CONFIG_SYS_BARGSIZE (CONFIG_SYS_CBSIZE) + +#define CONFIG_SYS_MEMTEST_START (OMAP34XX_SDRC_CS0) +#define CONFIG_SYS_MEMTEST_END (OMAP34XX_SDRC_CS0 + 0x01F00000)/*31MB*/ + +/* default load address */ +#define CONFIG_SYS_LOAD_ADDR (OMAP34XX_SDRC_CS0) + +/* + * OMAP3 has 12 GP timers, they can be driven by the system clock + * (12/13/16.8/19.2/38.4MHz) or by 32KHz clock. We use 13MHz (V_SCLK). + * This rate is divided by a local divisor. + */ +#define CONFIG_SYS_TIMERBASE (OMAP34XX_GPT2) +#define CONFIG_SYS_PTV 2 /* Divisor: 2^(PTV+1) => 8 */ +#define CONFIG_SYS_HZ 1000 + +/*----------------------------------------------------------------------- + * Stack sizes + * + * The stack sizes are set up in start.S using the settings below + */ +#define CONFIG_STACKSIZE (128 << 10) /* regular stack 128 KiB */ + +/*----------------------------------------------------------------------- + * Physical Memory Map + */ +#define CONFIG_NR_DRAM_BANKS 2 +#define PHYS_SDRAM_1 OMAP34XX_SDRC_CS0 + +/*----------------------------------------------------------------------- + * FLASH and environment organization + */ + +#define CONFIG_ENV_IS_NOWHERE + +#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM_1 +#define CONFIG_SYS_INIT_RAM_ADDR 0x4020f800 +#define CONFIG_SYS_INIT_RAM_SIZE 0x800 +#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_INIT_RAM_ADDR + \ + CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE) + +#endif /* __CONFIG_H */

Dear =?UTF-8?q?Pali=20Roh=C3=A1r?=,
In message 1335634011-9104-12-git-send-email-pali.rohar@gmail.com you wrote:
VGhpcyBib2FyZCBkZWZpbml0aW9uIHJlc3VsdHMgaW4gYSB1LWJvb3QuYmluIHdoaWNoIGNhbiBi ZSBjaGFpbmxvYWRlZApmcm9tIE5PTE8gaW4gcWVtdSBvciBvbiBhIHJlYWwgTjkwMC4gSXQgZG9l cyB2ZXJ5IGxpdHRsZSBoYXJkd2FyZSBjb25maWcKYmVjYXVzZSBOT0xPIGhhcyBhbHJlYWR5IGNv bmZpZ3VyZWQgdGhlIGJvYXJkLiBPbmx5IG5lZWRlZCBpcyBlbmFibGluZwppbnRlcm5hbCBlTU1D
...
Please stop sending base64 encoded patches! Send plain text only!
This board definition results in a u-boot.bin which can be chainloaded from NOLO in qemu or on a real N900. It does very little hardware config because NOLO has already configured the board. Only needed is enabling internal eMMC memory via twl4030 regulator which is not enabled by NOLO.
NOLO is expecting a kernel image and will treat any image it finds in onenand as such. This u-boot is intended to be flashed to the N900 like a kernel. In order to transparently boot the original kernel, it will be appended to u-boot.bin at 0x40000. NOLO will load the entire image into memory and execute u-boot, which saves the ATAGs set by NOLO. Then the bootscripts will attempt to load uImage or boot.scr from a fat or ext2 filesystem in external SD card or internal eMMC memory. If this fails or keyboard is closed the appended kernel image will be booted using the stored ATAGs (see boot order).
There is support for hardware watchdog. It is started by NOLO so u-boot must kick watchdog to prevent reboot device (but not very often, max every 2 seconds). There is also support for framebuffer display output with ANSI espace codes and the N900 HW keyboard input. USB tty works but is disabled because it prevents the current Maemo kernel from booting.
Based on previous work by: Alistair Buxton a.j.buxton@gmail.com
Default boot order:
- if keyboard is closed boot automatically attached kernel image
- try boot from external SD card
- try boot from internal eMMC memory
- try boot from attached kernel image
Boot from SD or eMMC in this order:
find boot.scr on first fat partition
find uImage on first fat parition
same order for 2. - 4. fat partition
find boot.scr on first ext2 partition
find uImage on first ext2 parition
same order for 2. - 4. ext2 partition
Available additional commands/variables:
run sercon - Use serial port for control
run usbcon - Use usbtty for control
run vgacon - Use framebuffer and HW keyboard for control (default)
run sdboot - Boot from external SD card (see boot order)
run emmcboot - Boot from internal eMMC memory (see boot order)
run attachboot - Boot attached kernel image (attached to U-Boot binary)
run scriptload - Load boot script ${mmcscriptfile}
run scriptboot - Run loaded boot script
run kernload - Load kernel image ${mmckernfile}
run initrdload - Load initrd image ${mmcinitrdfile}
run kernboot - Boot loaded kernel image
run kerninitrdboot - Boot loaded kernel image with loaded initrd image
run trymmcscriptboot - Try to load and boot script ${mmcscriptfile}
run trymmckernboot - Try to load and boot kernel image ${mmckernfile}
run trymmckerninitrdboot - Try to load and boot kernel image ${mmckernfile} with initrd image ${mmcinitrdfile}
Variables for loading files from mmc:
- mmc ${mmcnum} (0 - external, 1 - internal)
- partition number ${mmcpart} (1 - 4)
- parition type ${mmctype} (fat, ext2)
While it is a good idea to provide documentation, this is the wrong place for it. Here in the commit message is about the last place where most of the users will search for it. Please provide a README for this board - either in the board directory, or in doc/
BUt also keep in mind that this is a maintenance problem - who will make sure that this documentation gets updated when someone changes to code?
board/nokia/rx51/Makefile | 46 +++++ board/nokia/rx51/lowlevel_init.S | 71 +++++++ board/nokia/rx51/rx51.c | 380 ++++++++++++++++++++++++++++++++++++++ board/nokia/rx51/rx51.h | 378 +++++++++++++++++++++++++++++++++++++ boards.cfg | 1 + include/configs/nokia_rx51.h | 373 +++++++++++++++++++++++++++++++++++++ 6 files changed, 1249 insertions(+) create mode 100644 board/nokia/rx51/Makefile create mode 100644 board/nokia/rx51/lowlevel_init.S create mode 100644 board/nokia/rx51/rx51.c create mode 100644 board/nokia/rx51/rx51.h create mode 100644 include/configs/nokia_rx51.h
Entry in MAINTAINERS missing.
+/*
- Size of malloc() pool
- */
+#define CONFIG_ENV_SIZE (128 << 10) /* 128 KiB Sector */ +#define CONFIG_UBI_SIZE (512 << 10) /* 512 KiB Sector */ +#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + CONFIG_UBI_SIZE + \
(128 << 10))
Comment appears to be misplaced.
+/* Maemo kernel 2.6.28 will crash if u-boot enable usb tty */ +/* +#define CONFIG_USB_TTY +*/
Please remove dead code.
+/* OneNand support is disabled, because U-Boot image is too big */ +/* Uncomment next line to enable it */ +/* #define ONENAND_SUPPORT */
Incorrect multiline comment / please remove dead code.
Best regards,
Wolfgang Denk

On Saturday 28 April 2012 23:32:25 Wolfgang Denk wrote:
Please stop sending base64 encoded patches! Send plain text only!
I used git format-patch and git send-email. Is there easy way how to tell this to git?
While it is a good idea to provide documentation, this is the wrong place for it. Here in the commit message is about the last place where most of the users will search for it. Please provide a README for this board - either in the board directory, or in doc/
Is doc/README.nokia_rx51 correct place?
BUt also keep in mind that this is a maintenance problem - who will make sure that this documentation gets updated when someone changes to code?
board/nokia/rx51/Makefile | 46 +++++ board/nokia/rx51/lowlevel_init.S | 71 +++++++ board/nokia/rx51/rx51.c | 380 ++++++++++++++++++++++++++++++++++++++ board/nokia/rx51/rx51.h | 378 +++++++++++++++++++++++++++++++++++++ boards.cfg | 1 + include/configs/nokia_rx51.h | 373 +++++++++++++++++++++++++++++++++++++ 6 files changed, 1249 insertions(+) create mode 100644 board/nokia/rx51/Makefile create mode 100644 board/nokia/rx51/lowlevel_init.S create mode 100644 board/nokia/rx51/rx51.c create mode 100644 board/nokia/rx51/rx51.h create mode 100644 include/configs/nokia_rx51.h
Entry in MAINTAINERS missing.
Ok, I will add myself to MAINTAINERS.
+/*
- Size of malloc() pool
- */
+#define CONFIG_ENV_SIZE (128 << 10) /* 128 KiB
Sector */
+#define CONFIG_UBI_SIZE (512 << 10) /* 512 KiB
Sector */
+#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + CONFIG_UBI_SIZE + \ + (128 << 10))
Comment appears to be misplaced.
Ok, comment will be removed.
+/* Maemo kernel 2.6.28 will crash if u-boot enable usb tty */ +/* +#define CONFIG_USB_TTY +*/
Please remove dead code.
usb tty is usefull for debuging u-boot. because this device does not have easy access to serial console, usb tty is only option how to connect u-boot terminal to pc. but default (and still only one working on this device) kernel crash when u-boot enable usb tty. I want to have usb tty option in u-boot and belive that one day will be some upstream linux kernel with fixed usb drivers working on nokia n900.
+/* OneNand support is disabled, because U-Boot image is too big */ +/* Uncomment next line to enable it */ +/* #define ONENAND_SUPPORT */
Incorrect multiline comment / please remove dead code.
How to write correct comment?
Also onenand code working fine, but when is enabled u-boot binary is too big and cannot be flashed into this device. But for testing in qemu or booting u-boot with enabled onenand support stored in mmc via flashed u-boot (with disabled onenand support) working too.
Is there way how to decrease u-boot binary size?
Best regards,
Wolfgang Denk

Dear Pali Rohár,
On Saturday 28 April 2012 23:32:25 Wolfgang Denk wrote:
Please stop sending base64 encoded patches! Send plain text only!
I used git format-patch and git send-email. Is there easy way how to tell this to git?
While it is a good idea to provide documentation, this is the wrong place for it. Here in the commit message is about the last place where most of the users will search for it. Please provide a README for this board - either in the board directory, or in doc/
Is doc/README.nokia_rx51 correct place?
BUt also keep in mind that this is a maintenance problem - who will make sure that this documentation gets updated when someone changes to code?
board/nokia/rx51/Makefile | 46 +++++ board/nokia/rx51/lowlevel_init.S | 71 +++++++ board/nokia/rx51/rx51.c | 380 ++++++++++++++++++++++++++++++++++++++ board/nokia/rx51/rx51.h | 378 +++++++++++++++++++++++++++++++++++++ boards.cfg
| 1 +
include/configs/nokia_rx51.h | 373 +++++++++++++++++++++++++++++++++++++ 6 files changed, 1249 insertions(+) create mode 100644 board/nokia/rx51/Makefile create mode 100644 board/nokia/rx51/lowlevel_init.S create mode 100644 board/nokia/rx51/rx51.c create mode 100644 board/nokia/rx51/rx51.h create mode 100644 include/configs/nokia_rx51.h
Entry in MAINTAINERS missing.
Ok, I will add myself to MAINTAINERS.
+/*
- Size of malloc() pool
- */
+#define CONFIG_ENV_SIZE (128 << 10) /* 128 KiB
Sector */
+#define CONFIG_UBI_SIZE (512 << 10) /* 512 KiB
Sector */
+#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + CONFIG_UBI_SIZE + \ + (128 << 10))
Comment appears to be misplaced.
Ok, comment will be removed.
+/* Maemo kernel 2.6.28 will crash if u-boot enable usb tty */ +/* +#define CONFIG_USB_TTY +*/
Please remove dead code.
usb tty is usefull for debuging u-boot. because this device does not have easy access to serial console, usb tty is only option how to connect u-boot terminal to pc. but default (and still only one working on this device) kernel crash when u-boot enable usb tty. I want to have usb tty option in u-boot and belive that one day will be some upstream linux kernel with fixed usb drivers working on nokia n900.
+/* OneNand support is disabled, because U-Boot image is too big */ +/* Uncomment next line to enable it */ +/* #define ONENAND_SUPPORT */
Incorrect multiline comment / please remove dead code.
How to write correct comment?
/* * BLURB blurb BLurB ... * Blurb, hardware on fire * foo bar it doesn't work. */
Also onenand code working fine, but when is enabled u-boot binary is too big and cannot be flashed into this device. But for testing in qemu or booting u-boot with enabled onenand support stored in mmc via flashed u-boot (with disabled onenand support) working too.
Is there way how to decrease u-boot binary size?
Try compiling it in thumb mode? I think Tom Rini added support for that and tested it on omap.
Best regards,
Wolfgang Denk

On Sun, Apr 29, 2012 at 11:18:48AM +0200, Marek Vasut wrote:
Dear Pali Roh?r,
[snip]
Also onenand code working fine, but when is enabled u-boot binary is too big and cannot be flashed into this device. But for testing in qemu or booting u-boot with enabled onenand support stored in mmc via flashed u-boot (with disabled onenand support) working too.
Is there way how to decrease u-boot binary size?
Try compiling it in thumb mode? I think Tom Rini added support for that and tested it on omap.
Aneesh V did the real work for thumb mode for omap4/5, I just picked it up and addressed some comments. It's currently in u-boot-arm/master.

Dear Tom Rini,
On Sun, Apr 29, 2012 at 11:18:48AM +0200, Marek Vasut wrote:
Dear Pali Roh?r,
[snip]
Also onenand code working fine, but when is enabled u-boot binary is too big and cannot be flashed into this device. But for testing in qemu or booting u-boot with enabled onenand support stored in mmc via flashed u-boot (with disabled onenand support) working too.
Is there way how to decrease u-boot binary size?
Try compiling it in thumb mode? I think Tom Rini added support for that and tested it on omap.
Aneesh V did the real work for thumb mode for omap4/5, I just picked it up and addressed some comments. It's currently in u-boot-arm/master.
Since all omap3+ are cortexA, they have thumb2 support, so it should work, correct?
Best regards, Marek Vasut

On 04/30/2012 04:42 PM, Marek Vasut wrote:
Dear Tom Rini,
On Sun, Apr 29, 2012 at 11:18:48AM +0200, Marek Vasut wrote:
Dear Pali Roh?r,
[snip]
Also onenand code working fine, but when is enabled u-boot binary is too big and cannot be flashed into this device. But for testing in qemu or booting u-boot with enabled onenand support stored in mmc via flashed u-boot (with disabled onenand support) working too.
Is there way how to decrease u-boot binary size?
Try compiling it in thumb mode? I think Tom Rini added support for that and tested it on omap.
Aneesh V did the real work for thumb mode for omap4/5, I just picked it up and addressed some comments. It's currently in u-boot-arm/master.
Since all omap3+ are cortexA, they have thumb2 support, so it should work, correct?
Correct. It is opt-in per-board.

On Monday 30 April 2012 16:37:55 Tom Rini wrote:
On Sun, Apr 29, 2012 at 11:18:48AM +0200, Marek Vasut wrote:
Dear Pali Roh?r,
[snip]
Also onenand code working fine, but when is enabled u-boot binary is too big and cannot be flashed into this device. But for testing in qemu or booting u-boot with enabled onenand support stored in mmc via flashed u-boot (with disabled onenand support) working too.
Is there way how to decrease u-boot binary size?
Try compiling it in thumb mode? I think Tom Rini added support for that and tested it on omap.
Aneesh V did the real work for thumb mode for omap4/5, I just picked it up and addressed some comments. It's currently in u-boot-arm/master.
But N900 is omap3. Has u-boot thumb support for omap3 boards too?

Dear Pali Rohár,
On Monday 30 April 2012 16:37:55 Tom Rini wrote:
On Sun, Apr 29, 2012 at 11:18:48AM +0200, Marek Vasut wrote:
Dear Pali Roh?r,
[snip]
Also onenand code working fine, but when is enabled u-boot binary is too big and cannot be flashed into this device. But for testing in qemu or booting u-boot with enabled onenand support stored in mmc via flashed u-boot (with disabled onenand support) working too.
Is there way how to decrease u-boot binary size?
Try compiling it in thumb mode? I think Tom Rini added support for that and tested it on omap.
Aneesh V did the real work for thumb mode for omap4/5, I just picked it up and addressed some comments. It's currently in u-boot-arm/master.
But N900 is omap3. Has u-boot thumb support for omap3 boards too?
OMAP3 has the same (CortexA8) core, it will work on it too. Dunno if it's enabled for OMAP3 now, but it shouldn't be hard to do so.
Best regards, Marek Vasut

On Friday 01 June 2012 20:48:15 Marek Vasut wrote:
Dear Pali Rohár,
On Monday 30 April 2012 16:37:55 Tom Rini wrote:
On Sun, Apr 29, 2012 at 11:18:48AM +0200, Marek Vasut
wrote:
Dear Pali Roh?r,
[snip]
Also onenand code working fine, but when is enabled u-boot binary is too big and cannot be flashed into this device. But for testing in qemu or booting u-boot with enabled onenand support stored in mmc via flashed u-boot (with disabled onenand support) working too.
Is there way how to decrease u-boot binary size?
Try compiling it in thumb mode? I think Tom Rini added support for that and tested it on omap.
Aneesh V did the real work for thumb mode for omap4/5, I just picked it up and addressed some comments. It's currently in u-boot-arm/master.
But N900 is omap3. Has u-boot thumb support for omap3 boards too?
OMAP3 has the same (CortexA8) core, it will work on it too. Dunno if it's enabled for OMAP3 now, but it shouldn't be hard to do so.
Best regards, Marek Vasut
There is one HW problem with thumb on N900: thumb mode is buggy and thumb compiled applications crashing. But finaly last month we found solution for this problem. Errata 430973 workaround, calling uboot function omap3_emu_romcode_call for setting IBE bit in AUX CR. So now Ubuntu (which is thumb compiled) booting and working.
So for using thumb mode on N900 we first need to call first that function. It is possible to build u-boot in some mixed mode (some parts in arm and some in thumb)? Now omap3_emu_romcode_call is called from misc_init_r rx51 board code.

Dear Pali Rohár,
On Friday 01 June 2012 20:48:15 Marek Vasut wrote:
Dear Pali Rohár,
On Monday 30 April 2012 16:37:55 Tom Rini wrote:
On Sun, Apr 29, 2012 at 11:18:48AM +0200, Marek Vasut
wrote:
Dear Pali Roh?r,
[snip]
Also onenand code working fine, but when is enabled u-boot binary is too big and cannot be flashed into this device. But for testing in qemu or booting u-boot with enabled onenand support stored in mmc via flashed u-boot (with disabled onenand support) working too.
Is there way how to decrease u-boot binary size?
Try compiling it in thumb mode? I think Tom Rini added support for that and tested it on omap.
Aneesh V did the real work for thumb mode for omap4/5, I just picked it up and addressed some comments. It's currently in u-boot-arm/master.
But N900 is omap3. Has u-boot thumb support for omap3 boards too?
OMAP3 has the same (CortexA8) core, it will work on it too. Dunno if it's enabled for OMAP3 now, but it shouldn't be hard to do so.
Best regards, Marek Vasut
There is one HW problem with thumb on N900: thumb mode is buggy and thumb compiled applications crashing.
What? Is it the CPU being buggy?
But finaly last month we found solution for this problem. Errata 430973 workaround,
Errata of what?
calling uboot function omap3_emu_romcode_call for setting IBE bit in AUX CR.
What exactly does it do?
So now Ubuntu (which is thumb compiled) booting and working.
Urh.
So for using thumb mode on N900 we first need to call first that function. It is possible to build u-boot in some mixed mode (some parts in arm and some in thumb)?
That's what you usually do -- you always start in ARM mode, then you switch to thumb mode. It's possible to mix thumb and arm of course, that's what normally happens.
Now omap3_emu_romcode_call is called from misc_init_r rx51 board code.
So this problem isn't present on all omap3s ?
Best regards, Marek Vasut

Dear Pali =?ISO-8859-1?Q?Roh=E1r?=,
In message 2499233.2JzaJFJkCD@pali you wrote:
Please stop sending base64 encoded patches! Send plain text only!
I used git format-patch and git send-email. Is there easy way how to tell this to git?
Yes: do not use characters that cause problems.
While it is a good idea to provide documentation, this is the wrong place for it. Here in the commit message is about the last place where most of the users will search for it. Please provide a README for this board - either in the board directory, or in doc/
Is doc/README.nokia_rx51 correct place?
It ist what many other boards used, so it would be fine.
Personally, I don;t like this ever growing list of board specific documentation in doc; my personal preference would be something like board/nokia/rx51/README instead... Feel free to chose.
Comment appears to be misplaced.
Ok, comment will be removed.
Rather fix it.
+/* Maemo kernel 2.6.28 will crash if u-boot enable usb tty */ +/* +#define CONFIG_USB_TTY +*/
Please remove dead code.
usb tty is usefull for debuging u-boot. because this device does not have easy access to serial console, usb tty is only option how to connect u-boot terminal to pc. but default (and still only one working on this device) kernel crash when u-boot enable usb tty. I want to have usb tty option in u-boot and belive that one day will be some upstream linux kernel with fixed usb drivers working on nokia n900.
As is, it is dead code and should be removed (not to mention that this is another case of incorrect multi-line comment style).
Please feel free to add such a description to the documentation.
Incorrect multiline comment / please remove dead code.
How to write correct comment?
See http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=Do...
Is there way how to decrease u-boot binary size?
Omit features ...
Best regards,
Wolfgang Denk

This patch series add support for new board Nokia RX-51 (aka N900). This patch series supersedes version v2.
Patch details:
Already commited (dropped) patches: cfb_console: Fix function console_back cfb_console: Add function console_clear and console_clear_line cfb_console: Add functions for moving with cursor cfb_console: Ignore bell character
Dropped patches: arm: Optionally use existing atags in bootm.c New command clear: Clear the ANSI terminal New config variable CONFIG_PREMONITOR
New patches: arm bootm: Allow to pass board specified atags arm bootm: Do not append zero ATAG_MEM
Pali Rohár (5): arm bootm: Allow to pass board specified atags arm bootm: Do not append zero ATAG_MEM Add power bus message definitions in twl4030.h cfb_console: Add support for some ANSI terminal escape codes New board support: Nokia RX-51 aka N900
MAINTAINERS | 4 + README | 3 + arch/arm/include/asm/setup.h | 5 + arch/arm/lib/bootm.c | 8 + board/nokia/rx51/Makefile | 46 +++ board/nokia/rx51/lowlevel_init.S | 209 ++++++++++++ board/nokia/rx51/rx51.c | 673 ++++++++++++++++++++++++++++++++++++++ board/nokia/rx51/rx51.h | 389 ++++++++++++++++++++++ board/nokia/rx51/tag_omap.h | 311 ++++++++++++++++++ boards.cfg | 1 + doc/README.nokia_rx51 | 104 ++++++ drivers/video/cfb_console.c | 313 +++++++++++++++++- include/configs/nokia_rx51.h | 452 +++++++++++++++++++++++++ include/twl4030.h | 98 ++++++ 14 files changed, 2607 insertions(+), 9 deletions(-) create mode 100644 board/nokia/rx51/Makefile create mode 100644 board/nokia/rx51/lowlevel_init.S create mode 100644 board/nokia/rx51/rx51.c create mode 100644 board/nokia/rx51/rx51.h create mode 100644 board/nokia/rx51/tag_omap.h create mode 100644 doc/README.nokia_rx51 create mode 100644 include/configs/nokia_rx51.h

Signed-off-by: Pali Rohár pali.rohar@gmail.com --- arch/arm/include/asm/setup.h | 5 +++++ arch/arm/lib/bootm.c | 5 +++++ 2 files changed, 10 insertions(+)
diff --git a/arch/arm/include/asm/setup.h b/arch/arm/include/asm/setup.h index 89df4dc..78a7fac 100644 --- a/arch/arm/include/asm/setup.h +++ b/arch/arm/include/asm/setup.h @@ -267,3 +267,8 @@ struct meminfo { extern struct meminfo meminfo;
#endif + +/* + * Board specified tags + */ +void setup_board_tags(struct tag **in_params); diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c index a9070d5..c092bfa 100644 --- a/arch/arm/lib/bootm.c +++ b/arch/arm/lib/bootm.c @@ -266,6 +266,10 @@ static int create_fdt(bootm_headers_t *images) } #endif
+void __setup_board_tags(void) {} +void setup_board_tags(struct tag **in_params) + __attribute__((weak, alias("__setup_board_tags"))); + /* Subcommand: PREP */ static void boot_prep_linux(bootm_headers_t *images) { @@ -307,6 +311,7 @@ static void boot_prep_linux(bootm_headers_t *images) setup_initrd_tag(gd->bd, images->rd_start, images->rd_end); #endif + setup_board_tags(¶ms); setup_end_tag(gd->bd); #else /* all tags */ printf("FDT and ATAGS support not compiled in - hanging\n");

Dear Pali Rohár,
... missing commit message ...
Signed-off-by: Pali Rohár pali.rohar@gmail.com
arch/arm/include/asm/setup.h | 5 +++++ arch/arm/lib/bootm.c | 5 +++++ 2 files changed, 10 insertions(+)
... missing changelog ...
diff --git a/arch/arm/include/asm/setup.h b/arch/arm/include/asm/setup.h index 89df4dc..78a7fac 100644 --- a/arch/arm/include/asm/setup.h +++ b/arch/arm/include/asm/setup.h @@ -267,3 +267,8 @@ struct meminfo { extern struct meminfo meminfo;
#endif
+/*
- Board specified tags
- */
What's this ?
+void setup_board_tags(struct tag **in_params); diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c index a9070d5..c092bfa 100644 --- a/arch/arm/lib/bootm.c +++ b/arch/arm/lib/bootm.c @@ -266,6 +266,10 @@ static int create_fdt(bootm_headers_t *images) } #endif
+void __setup_board_tags(void) {} +void setup_board_tags(struct tag **in_params)
- __attribute__((weak, alias("__setup_board_tags")));
__weak void setup...(...) {} works just fine. Include linux/compiler.h
/* Subcommand: PREP */ static void boot_prep_linux(bootm_headers_t *images) { @@ -307,6 +311,7 @@ static void boot_prep_linux(bootm_headers_t *images) setup_initrd_tag(gd->bd, images->rd_start, images->rd_end); #endif
setup_end_tag(gd->bd);setup_board_tags(¶ms);
#else /* all tags */ printf("FDT and ATAGS support not compiled in - hanging\n");
Best regards, Marek Vasut

On Sunday 14 October 2012 01:43:25 Marek Vasut wrote:
Dear Pali Rohár,
... missing commit message ...
Is not subject enought?
Signed-off-by: Pali Rohár pali.rohar@gmail.com
arch/arm/include/asm/setup.h | 5 +++++ arch/arm/lib/bootm.c | 5 +++++ 2 files changed, 10 insertions(+)
... missing changelog ...
There is no changelog. This patch is new in v3. I wrote it in mail [PATCH v3 0/5].
diff --git a/arch/arm/include/asm/setup.h b/arch/arm/include/asm/setup.h index 89df4dc..78a7fac 100644 --- a/arch/arm/include/asm/setup.h +++ b/arch/arm/include/asm/setup.h @@ -267,3 +267,8 @@ struct meminfo {
extern struct meminfo meminfo;
#endif
+/*
- Board specified tags
- */
What's this ?
Function which allow to pass board specified (non standard) atags. It is what you suggested: http://www.mail-archive.com/u-boot@lists.denx.de/msg82803.html
+void setup_board_tags(struct tag **in_params); diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c index a9070d5..c092bfa 100644 --- a/arch/arm/lib/bootm.c +++ b/arch/arm/lib/bootm.c @@ -266,6 +266,10 @@ static int create_fdt(bootm_headers_t *images)> } #endif
+void __setup_board_tags(void) {} +void setup_board_tags(struct tag **in_params)
- __attribute__((weak, alias("__setup_board_tags")));
__weak void setup...(...) {} works just fine. Include linux/compiler.h
I did not know about __weak. I will change it.

Dear Pali Rohár,
On Sunday 14 October 2012 01:43:25 Marek Vasut wrote:
Dear Pali Rohár,
... missing commit message ...
Is not subject enought?
Sorry, but no.
Signed-off-by: Pali Rohár pali.rohar@gmail.com
arch/arm/include/asm/setup.h | 5 +++++ arch/arm/lib/bootm.c | 5 +++++ 2 files changed, 10 insertions(+)
... missing changelog ...
There is no changelog. This patch is new in v3. I wrote it in mail [PATCH v3 0/5].
Good
diff --git a/arch/arm/include/asm/setup.h b/arch/arm/include/asm/setup.h index 89df4dc..78a7fac 100644 --- a/arch/arm/include/asm/setup.h +++ b/arch/arm/include/asm/setup.h @@ -267,3 +267,8 @@ struct meminfo {
extern struct meminfo meminfo;
#endif
+/*
- Board specified tags
- */
What's this ?
Function which allow to pass board specified (non standard) atags.It is what you suggested: http://www.mail-archive.com/u-boot@lists.denx.de/msg82803.html
Oh, there's one more line below. OK.
+void setup_board_tags(struct tag **in_params); diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c index a9070d5..c092bfa 100644 --- a/arch/arm/lib/bootm.c +++ b/arch/arm/lib/bootm.c @@ -266,6 +266,10 @@ static int create_fdt(bootm_headers_t *images)>
} #endif
+void __setup_board_tags(void) {} +void setup_board_tags(struct tag **in_params)
- __attribute__((weak, alias("__setup_board_tags")));
__weak void setup...(...) {} works just fine. Include linux/compiler.h
I did not know about __weak. I will change it.
Best regards, Marek Vasut

On Sunday 14 October 2012 02:18:02 Marek Vasut wrote:
Dear Pali Rohár,
On Sunday 14 October 2012 01:43:25 Marek Vasut wrote:
Dear Pali Rohár,
... missing commit message ...
Is not subject enought?
Sorry, but no.
Commit message: With this patch is possible to pass board specified atags. Board can implement function setup_board_tags which could append or change atags before booting kernel.

If dram bank size is calculated at runtime, it can be zero on some boards. This patch added code which ignore these zero bank size in ATAG_MEM.
Signed-off-by: Pali Rohár pali.rohar@gmail.com --- arch/arm/lib/bootm.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c index c092bfa..925925d 100644 --- a/arch/arm/lib/bootm.c +++ b/arch/arm/lib/bootm.c @@ -132,6 +132,9 @@ static void setup_memory_tags(bd_t *bd) int i;
for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) { + if (bd->bi_dram[i].size == 0) + continue; + params->hdr.tag = ATAG_MEM; params->hdr.size = tag_size (tag_mem32);

Dear Pali Rohár,
If dram bank size is calculated at runtime, it can be zero on some boards. This patch added code which ignore these zero bank size in ATAG_MEM.
Signed-off-by: Pali Rohár pali.rohar@gmail.com
arch/arm/lib/bootm.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c index c092bfa..925925d 100644 --- a/arch/arm/lib/bootm.c +++ b/arch/arm/lib/bootm.c @@ -132,6 +132,9 @@ static void setup_memory_tags(bd_t *bd) int i;
for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
if (bd->bi_dram[i].size == 0)
continue;
This doesn't look right at all, your board is misconfigured if bd->bi_dram[i] == 0. Did you misconfigure CONFIG_NR_DRAM_BANKS ?
params->hdr.tag = ATAG_MEM; params->hdr.size = tag_size (tag_mem32);
Best regards, Marek Vasut

On Sunday 14 October 2012 01:45:06 Marek Vasut wrote:
for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
if (bd->bi_dram[i].size == 0)
continue;
This doesn't look right at all, your board is misconfigured if bd->bi_dram[i] == 0. Did you misconfigure CONFIG_NR_DRAM_BANKS ?
On some N900 devices there are two banks and on some only one. If there is only one it has size 256 MB and if there are two both has 128 MB. CONFIG_NR_DRAM_BANKS must be specified at compile time, but for N900 I need runtime detection.

Dear Pali Rohár,
On Sunday 14 October 2012 01:45:06 Marek Vasut wrote:
for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
if (bd->bi_dram[i].size == 0)
continue;
This doesn't look right at all, your board is misconfigured if bd->bi_dram[i] == 0. Did you misconfigure CONFIG_NR_DRAM_BANKS ?
On some N900 devices there are two banks and on some only one. If there is only one it has size 256 MB and if there are two both has 128 MB. CONFIG_NR_DRAM_BANKS must be specified at compile time, but for N900 I need runtime detection.
How can that be? Are these two banks contiguous?
Best regards, Marek Vasut

On Sunday 14 October 2012 02:17:01 Marek Vasut wrote:
Dear Pali Rohár,
On Sunday 14 October 2012 01:45:06 Marek Vasut wrote:
for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
if (bd->bi_dram[i].size == 0)
continue;
This doesn't look right at all, your board is misconfigured if bd->bi_dram[i] == 0. Did you misconfigure CONFIG_NR_DRAM_BANKS ?
On some N900 devices there are two banks and on some only one. If there is only one it has size 256 MB and if there are two both has 128 MB. CONFIG_NR_DRAM_BANKS must be specified at compile time, but for N900 I need runtime detection.
How can that be? Are these two banks contiguous?
Yes.

Dear Pali Rohár,
On Sunday 14 October 2012 02:17:01 Marek Vasut wrote:
Dear Pali Rohár,
On Sunday 14 October 2012 01:45:06 Marek Vasut wrote:
for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
if (bd->bi_dram[i].size == 0)
continue;
This doesn't look right at all, your board is misconfigured if bd->bi_dram[i] == 0. Did you misconfigure CONFIG_NR_DRAM_BANKS ?
On some N900 devices there are two banks and on some only one. If there is only one it has size 256 MB and if there are two both has 128 MB. CONFIG_NR_DRAM_BANKS must be specified at compile time, but for N900 I need runtime detection.
How can that be? Are these two banks contiguous?
Yes.
And how does the memory map differ in case of device with one 256MB block then ?
Best regards, Marek Vasut

On Sunday 14 October 2012 02:27:05 Marek Vasut wrote:
Dear Pali Rohár,
On Sunday 14 October 2012 02:17:01 Marek Vasut wrote:
Dear Pali Rohár,
On Sunday 14 October 2012 01:45:06 Marek Vasut wrote:
for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
if (bd->bi_dram[i].size == 0)
continue;
This doesn't look right at all, your board is misconfigured if bd->bi_dram[i] == 0. Did you misconfigure CONFIG_NR_DRAM_BANKS ?
On some N900 devices there are two banks and on some only one. If there is only one it has size 256 MB and if there are two both has 128 MB. CONFIG_NR_DRAM_BANKS must be specified at compile time, but for N900 I need runtime detection.
How can that be? Are these two banks contiguous?
Yes.
And how does the memory map differ in case of device with one 256MB block then ?
Memory map is same, from 0x80000000 to 0x90000000.
For two bank devices uboot reports: size=08000000 start=80000000 size=08000000 start=88000000
And for one: size=10000000 start=80000000 size=00000000 start=90000000

Dear Pali Rohár,
On Sunday 14 October 2012 02:27:05 Marek Vasut wrote:
Dear Pali Rohár,
On Sunday 14 October 2012 02:17:01 Marek Vasut wrote:
Dear Pali Rohár,
On Sunday 14 October 2012 01:45:06 Marek Vasut wrote:
> for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) { > > + if (bd->bi_dram[i].size == 0) > + continue;
This doesn't look right at all, your board is misconfigured if bd->bi_dram[i] == 0. Did you misconfigure CONFIG_NR_DRAM_BANKS ?
On some N900 devices there are two banks and on some only one. If there is only one it has size 256 MB and if there are two both has 128 MB. CONFIG_NR_DRAM_BANKS must be specified at compile time, but for N900 I need runtime detection.
How can that be? Are these two banks contiguous?
Yes.
And how does the memory map differ in case of device with one 256MB block then ?
Memory map is same, from 0x80000000 to 0x90000000.
For two bank devices uboot reports: size=08000000 start=80000000 size=08000000 start=88000000
And for one: size=10000000 start=80000000 size=00000000 start=90000000
Tom, can this not be handled as a single area? How does the omap memory layout look?
Best regards, Marek Vasut

On Sun, Oct 14, 2012 at 03:08:20AM +0200, Marek Vasut wrote:
Dear Pali Roh?r,
On Sunday 14 October 2012 02:27:05 Marek Vasut wrote:
Dear Pali Roh?r,
On Sunday 14 October 2012 02:17:01 Marek Vasut wrote:
Dear Pali Roh?r,
On Sunday 14 October 2012 01:45:06 Marek Vasut wrote: > > for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) { > > > > + if (bd->bi_dram[i].size == 0) > > + continue; > > This doesn't look right at all, your board is > misconfigured > if > bd->bi_dram[i] == 0. Did you misconfigure > CONFIG_NR_DRAM_BANKS > ?
On some N900 devices there are two banks and on some only one. If there is only one it has size 256 MB and if there are two both has 128 MB. CONFIG_NR_DRAM_BANKS must be specified at compile time, but for N900 I need runtime detection.
How can that be? Are these two banks contiguous?
Yes.
And how does the memory map differ in case of device with one 256MB block then ?
Memory map is same, from 0x80000000 to 0x90000000.
For two bank devices uboot reports: size=08000000 start=80000000 size=08000000 start=88000000
And for one: size=10000000 start=80000000 size=00000000 start=90000000
Tom, can this not be handled as a single area? How does the omap memory layout look?
On other platforms we simply lie about the number of banks as at least today nothing is re-using the number of banks and re-reconfiguring DDR. Making n900 also just claim one bank and then reporting the correct total memory size as the size of that one bank will put it into good company at least.

* Code copied from linux kernel 3.0.0 from file include/linux/i2c/twl.h
Signed-off-by: Pali Rohár pali.rohar@gmail.com --- include/twl4030.h | 98 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+)
diff --git a/include/twl4030.h b/include/twl4030.h index 9cd32ab..0c17f59 100644 --- a/include/twl4030.h +++ b/include/twl4030.h @@ -151,6 +151,103 @@ #define TWL4030_PM_MASTER_SW_EVENTS_DEVSLP (1 << 1) #define TWL4030_PM_MASTER_SW_EVENTS_DEVOFF (1 << 0)
+/* Power bus message definitions */ + +/* The TWL4030/5030 splits its power-management resources (the various + * regulators, clock and reset lines) into 3 processor groups - P1, P2 and + * P3. These groups can then be configured to transition between sleep, wait-on + * and active states by sending messages to the power bus. See Section 5.4.2 + * Power Resources of TWL4030 TRM + */ + +/* Processor groups */ +#define DEV_GRP_NULL 0x0 +#define DEV_GRP_P1 0x1 /* P1: all OMAP devices */ +#define DEV_GRP_P2 0x2 /* P2: all Modem devices */ +#define DEV_GRP_P3 0x4 /* P3: all peripheral devices */ + +/* Resource groups */ +#define RES_GRP_RES 0x0 /* Reserved */ +#define RES_GRP_PP 0x1 /* Power providers */ +#define RES_GRP_RC 0x2 /* Reset and control */ +#define RES_GRP_PP_RC 0x3 +#define RES_GRP_PR 0x4 /* Power references */ +#define RES_GRP_PP_PR 0x5 +#define RES_GRP_RC_PR 0x6 +#define RES_GRP_ALL 0x7 /* All resource groups */ + +#define RES_TYPE2_R0 0x0 + +#define RES_TYPE_ALL 0x7 + +/* Resource states */ +#define RES_STATE_WRST 0xF +#define RES_STATE_ACTIVE 0xE +#define RES_STATE_SLEEP 0x8 +#define RES_STATE_OFF 0x0 + +/* Power resources */ + +/* Power providers */ +#define RES_VAUX1 1 +#define RES_VAUX2 2 +#define RES_VAUX3 3 +#define RES_VAUX4 4 +#define RES_VMMC1 5 +#define RES_VMMC2 6 +#define RES_VPLL1 7 +#define RES_VPLL2 8 +#define RES_VSIM 9 +#define RES_VDAC 10 +#define RES_VINTANA1 11 +#define RES_VINTANA2 12 +#define RES_VINTDIG 13 +#define RES_VIO 14 +#define RES_VDD1 15 +#define RES_VDD2 16 +#define RES_VUSB_1V5 17 +#define RES_VUSB_1V8 18 +#define RES_VUSB_3V1 19 +#define RES_VUSBCP 20 +#define RES_REGEN 21 +/* Reset and control */ +#define RES_NRES_PWRON 22 +#define RES_CLKEN 23 +#define RES_SYSEN 24 +#define RES_HFCLKOUT 25 +#define RES_32KCLKOUT 26 +#define RES_RESET 27 +/* Power Reference */ +#define RES_Main_Ref 28 + +#define TOTAL_RESOURCES 28 +/* + * Power Bus Message Format ... these can be sent individually by Linux, + * but are usually part of downloaded scripts that are run when various + * power events are triggered. + * + * Broadcast Message (16 Bits): + * DEV_GRP[15:13] MT[12] RES_GRP[11:9] RES_TYPE2[8:7] RES_TYPE[6:4] + * RES_STATE[3:0] + * + * Singular Message (16 Bits): + * DEV_GRP[15:13] MT[12] RES_ID[11:4] RES_STATE[3:0] + */ + +#define MSG_BROADCAST(devgrp, grp, type, type2, state) \ + ((devgrp) << 13 | 1 << 12 | (grp) << 9 | (type2) << 7 \ + | (type) << 4 | (state)) + +#define MSG_SINGULAR(devgrp, id, state) \ + ((devgrp) << 13 | 0 << 12 | (id) << 4 | (state)) + +#define MSG_BROADCAST_ALL(devgrp, state) \ + ((devgrp) << 5 | (state)) + +#define MSG_BROADCAST_REF MSG_BROADCAST_ALL +#define MSG_BROADCAST_PROV MSG_BROADCAST_ALL +#define MSG_BROADCAST__CLK_RST MSG_BROADCAST_ALL + /* Power Managment Receiver */ #define TWL4030_PM_RECEIVER_SC_CONFIG 0x5B #define TWL4030_PM_RECEIVER_SC_DETECT1 0x5C @@ -311,6 +408,7 @@ #define TWL4030_PM_RECEIVER_VDAC_VSEL_18 0x03 #define TWL4030_PM_RECEIVER_VMMC1_VSEL_30 0x02 #define TWL4030_PM_RECEIVER_VMMC1_VSEL_32 0x03 +#define TWL4030_PM_RECEIVER_VSIM_VSEL_18 0x03
/* Device Selection in PM Receiver Module */ #define TWL4030_PM_RECEIVER_DEV_GRP_P1 0x20

Dear Pali Rohár,
- Code copied from linux kernel 3.0.0 from file include/linux/i2c/twl.h
Missing commit ... see http://www.denx.de/wiki/U-Boot/Patches#Attributing_Code_Copyrights_Sign [...]
Missing changelog
[...]
Best regards, Marek Vasut

On Sunday 14 October 2012 01:46:30 you wrote:
Dear Pali Rohár,
- Code copied from linux kernel 3.0.0 from file
include/linux/i2c/twl.h
Missing commit ... see http://www.denx.de/wiki/U-Boot/Patches#Attributing_Code_Copyrig hts_Sign
"... provide terse but precise information which exact version or even commit ID was used ..."
I copied code from 3.0.0 tarball, so I do not know commit ID. But 3.0.0 is exact version.
[...]
Missing changelog
Nothing was changed.

Dear Pali Rohár,
On Sunday 14 October 2012 01:46:30 you wrote:
Dear Pali Rohár,
- Code copied from linux kernel 3.0.0 from file
include/linux/i2c/twl.h
Missing commit ... see http://www.denx.de/wiki/U-Boot/Patches#Attributing_Code_Copyrig hts_Sign
"... provide terse but precise information which exact version or even commit ID was used ..."
I copied code from 3.0.0 tarball, so I do not know commit ID. But 3.0.0 is exact version.
Look here:
http://git.kernel.org/?p=linux/kernel/git/marex/linux-2.6.git;a=summary
[...]
Missing changelog
Nothing was changed.
It'd be good to state that.
Best regards, Marek Vasut

On Sunday 14 October 2012 02:16:10 Marek Vasut wrote:
Dear Pali Rohár,
On Sunday 14 October 2012 01:46:30 you wrote:
Dear Pali Rohár,
- Code copied from linux kernel 3.0.0 from file
include/linux/i2c/twl.h
Missing commit ... see http://www.denx.de/wiki/U-Boot/Patches#Attributing_Code_Cop yrig hts_Sign
"... provide terse but precise information which exact version or even commit ID was used ..."
I copied code from 3.0.0 tarball, so I do not know commit ID. But 3.0.0 is exact version.
Look here:
http://git.kernel.org/?p=linux/kernel/git/marex/linux-2.6.git;a =summary
Ok, last commit before 3.0.0 release was 6523b148b44be38d89c2ee9865d34da30d9f5f1c

Dear Pali Rohár,
On Sunday 14 October 2012 02:16:10 Marek Vasut wrote:
Dear Pali Rohár,
On Sunday 14 October 2012 01:46:30 you wrote:
Dear Pali Rohár,
- Code copied from linux kernel 3.0.0 from file
include/linux/i2c/twl.h
Missing commit ... see http://www.denx.de/wiki/U-Boot/Patches#Attributing_Code_Cop yrig hts_Sign
"... provide terse but precise information which exact version or even commit ID was used ..."
I copied code from 3.0.0 tarball, so I do not know commit ID. But 3.0.0 is exact version.
Look here:
http://git.kernel.org/?p=linux/kernel/git/marex/linux-2.6.git;a =summary
Ok, last commit before 3.0.0 release was 6523b148b44be38d89c2ee9865d34da30d9f5f1c
Please put it into the commit message.
Best regards, Marek Vasut

* This patch add support for move cursor, reverse colors and clear console via ANSI espace codes in cfb_console driver * ANSI escape codes can be enabled/disabled via CONFIG_CFB_CONSOLE_ANSI
Signed-off-by: Pali Rohár pali.rohar@gmail.com --- Changes since v2: - Fixed multiline comments
Changes since v1: - Added support ANSI code show/hide cursor - Added info to README
Changes since original version: - Fixed commit message
README | 3 + drivers/video/cfb_console.c | 313 +++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 307 insertions(+), 9 deletions(-)
diff --git a/README b/README index 9804cea..d45a91d 100644 --- a/README +++ b/README @@ -655,6 +655,9 @@ The following options need to be configured: additional board info beside the logo
+ When CONFIG_CFB_CONSOLE_ANSI is defined, console will have + ANSI terminal support. Needed for CONFIG_CMDLINE_EDITING. + When CONFIG_CFB_CONSOLE is defined, video console is default i/o. Serial console can be forced with environment 'console=serial'. diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c index 9f7794f..3ed96d3 100644 --- a/drivers/video/cfb_console.c +++ b/drivers/video/cfb_console.c @@ -385,6 +385,11 @@ static u32 eorx, fgx, bgx; /* color pats */
static int cfb_do_flush_cache;
+static char ansi_buf[10] = { 0, }; +static int ansi_buf_size; +static int ansi_colors_need_revert; +static int ansi_cursor_hidden; + static const int video_font_draw_table8[] = { 0x00000000, 0x000000ff, 0x0000ff00, 0x0000ffff, 0x00ff0000, 0x00ff00ff, 0x00ffff00, 0x00ffffff, @@ -612,6 +617,14 @@ static void video_putchar(int xx, int yy, unsigned char c) video_drawchars(xx, yy + video_logo_height, &c, 1); }
+static void console_swap_colors(void) +{ + eorx = fgx; + fgx = bgx; + bgx = eorx; + eorx = fgx ^ bgx; +} + #if defined(CONFIG_CONSOLE_CURSOR) || defined(CONFIG_VIDEO_SW_CURSOR) static void video_set_cursor(void) { @@ -695,6 +708,21 @@ static void memcpyl(int *d, int *s, int c) } #endif
+static void console_clear(void) +{ +#ifdef VIDEO_HW_RECTFILL + video_hw_rectfill(VIDEO_PIXEL_SIZE, /* bytes per pixel */ + 0, /* dest pos x */ + video_logo_height, /* dest pos y */ + VIDEO_VISIBLE_COLS, /* frame width */ + VIDEO_VISIBLE_ROWS, /* frame height */ + bgx /* fill color */ + ); +#else + memsetl(CONSOLE_ROW_FIRST, CONSOLE_SIZE, bgx); +#endif +} + static void console_clear_line(int line, int begin, int end) { #ifdef VIDEO_HW_RECTFILL @@ -768,9 +796,54 @@ static void console_back(void) } }
-static void console_newline(void) +static void console_cursor_fix(void) +{ + if (console_row < 0) + console_row = 0; + if (console_row >= CONSOLE_ROWS) + console_row = CONSOLE_ROWS-1; + if (console_col < 0) + console_col = 0; + if (console_col >= CONSOLE_COLS) + console_col = CONSOLE_COLS-1; +} + +static void console_cursor_up(int n) +{ + console_row -= n; + console_cursor_fix(); +} + +static void console_cursor_down(int n) +{ + console_row += n; + console_cursor_fix(); +} + +static void console_cursor_left(int n) +{ + console_col -= n; + console_cursor_fix(); +} + +static void console_cursor_right(int n) +{ + console_col += n; + console_cursor_fix(); +} + +static void console_cursor_set_position(int row, int col) +{ + if (console_row != -1) + console_row = row; + if (console_col != -1) + console_col = col; + console_cursor_fix(); +} + +static void console_newline(int n) { - console_row++; + console_row += n; console_col = 0;
/* Check if we need to scroll the terminal */ @@ -779,20 +852,28 @@ static void console_newline(void) console_scrollup();
/* Decrement row number */ - console_row--; + console_row = CONSOLE_ROWS-1; } }
+static void console_previewsline(int n) +{ + /* FIXME: also scroll terminal ? */ + console_row -= n; + console_cursor_fix(); +} + static void console_cr(void) { console_col = 0; }
-void video_putc(const char c) +static void parse_putc(const char c) { static int nl = 1;
- CURSOR_OFF; + if (!ansi_cursor_hidden) + CURSOR_OFF;
switch (c) { case 13: /* back to first column */ @@ -801,7 +882,7 @@ void video_putc(const char c)
case '\n': /* next line */ if (console_col || (!console_col && nl)) - console_newline(); + console_newline(1); nl = 1; break;
@@ -810,7 +891,7 @@ void video_putc(const char c) console_col &= ~0x0007;
if (console_col >= CONSOLE_COLS) - console_newline(); + console_newline(1); break;
case 8: /* backspace */ @@ -827,11 +908,225 @@ void video_putc(const char c)
/* check for newline */ if (console_col >= CONSOLE_COLS) { - console_newline(); + console_newline(1); nl = 0; } } - CURSOR_SET; + + if (!ansi_cursor_hidden) + CURSOR_SET; +} + +void video_putc(const char c) +{ +#ifdef CONFIG_CFB_CONSOLE_ANSI + int i; + + if (c == 27) { + for (i = 0; i < ansi_buf_size; ++i) + parse_putc(ansi_buf[i]); + ansi_buf[0] = 27; + ansi_buf_size = 1; + return; + } + + if (ansi_buf_size > 0) { + /* + * 0 - ESC + * 1 - [ + * 2 - num1 + * 3 - .. + * 4 - ; + * 5 - num2 + * 6 - .. + * - cchar + */ + int next = 0; + + int flush = 0; + int fail = 0; + + int num1 = 0; + int num2 = 0; + int cchar = 0; + + ansi_buf[ansi_buf_size++] = c; + + if (ansi_buf_size >= sizeof(ansi_buf)) + fail = 1; + + for (i = 0; i < ansi_buf_size; ++i) { + if (fail) + break; + + switch (next) { + case 0: + if (ansi_buf[i] == 27) + next = 1; + else + fail = 1; + break; + + case 1: + if (ansi_buf[i] == '[') + next = 2; + else + fail = 1; + break; + + case 2: + if (ansi_buf[i] >= '0' && ansi_buf[i] <= '9') { + num1 = ansi_buf[i]-'0'; + next = 3; + } else if (ansi_buf[i] != '?') { + --i; + num1 = 1; + next = 4; + } + break; + + case 3: + if (ansi_buf[i] >= '0' && ansi_buf[i] <= '9') { + num1 *= 10; + num1 += ansi_buf[i]-'0'; + } else { + --i; + next = 4; + } + break; + + case 4: + if (ansi_buf[i] != ';') { + --i; + next = 7; + } else + next = 5; + break; + + case 5: + if (ansi_buf[i] >= '0' && ansi_buf[i] <= '9') { + num2 = ansi_buf[i]-'0'; + next = 6; + } else + fail = 1; + break; + + case 6: + if (ansi_buf[i] >= '0' && ansi_buf[i] <= '9') { + num2 *= 10; + num2 += ansi_buf[i]-'0'; + } else { + --i; + next = 7; + } + break; + + case 7: + if ((ansi_buf[i] >= 'A' && ansi_buf[i] <= 'H') + || ansi_buf[i] == 'J' + || ansi_buf[i] == 'K' + || ansi_buf[i] == 'h' + || ansi_buf[i] == 'l' + || ansi_buf[i] == 'm') { + cchar = ansi_buf[i]; + flush = 1; + } else + fail = 1; + break; + } + } + + if (fail) { + for (i = 0; i < ansi_buf_size; ++i) + parse_putc(ansi_buf[i]); + ansi_buf_size = 0; + return; + } + + if (flush) { + if (!ansi_cursor_hidden) + CURSOR_OFF; + ansi_buf_size = 0; + switch (cchar) { + case 'A': + /* move cursor num1 rows up */ + console_cursor_up(num1); + break; + case 'B': + /* move cursor num1 rows down */ + console_cursor_down(num1); + break; + case 'C': + /* move cursor num1 columns forward */ + console_cursor_right(num1); + break; + case 'D': + /* move cursor num1 columns back */ + console_cursor_left(num1); + break; + case 'E': + /* move cursor num1 rows up at begin of row */ + console_previewsline(num1); + break; + case 'F': + /* move cursor num1 rows down at begin of row */ + console_newline(num1); + break; + case 'G': + /* move cursor to column num1 */ + console_cursor_set_position(-1, num1-1); + break; + case 'H': + /* move cursor to row num1, column num2 */ + console_cursor_set_position(num1-1, num2-1); + break; + case 'J': + /* clear console and move cursor to 0, 0 */ + console_clear(); + console_cursor_set_position(0, 0); + break; + case 'K': + /* clear line */ + if (num1 == 0) + console_clear_line(console_row, + console_col, + CONSOLE_COLS-1); + else if (num1 == 1) + console_clear_line(console_row, + 0, console_col); + else + console_clear_line(console_row, + 0, CONSOLE_COLS-1); + break; + case 'h': + ansi_cursor_hidden = 0; + break; + case 'l': + ansi_cursor_hidden = 1; + break; + case 'm': + if (num1 == 0) { /* reset swapped colors */ + if (ansi_colors_need_revert) { + console_swap_colors(); + ansi_colors_need_revert = 0; + } + } else if (num1 == 7) { /* once swap colors */ + if (!ansi_colors_need_revert) { + console_swap_colors(); + ansi_colors_need_revert = 1; + } + } + break; + } + if (!ansi_cursor_hidden) + CURSOR_SET; + } + } else { + parse_putc(c); + } +#else + parse_putc(c); +#endif }
void video_puts(const char *s)

Dear Pali Rohár,
- This patch add support for move cursor, reverse colors and clear console via ANSI espace codes in cfb_console driver
- ANSI escape codes can be enabled/disabled via CONFIG_CFB_CONSOLE_ANSI
Signed-off-by: Pali Rohár pali.rohar@gmail.com
Missing v3?
Changes since v2:
- Fixed multiline comments
Changes since v1:
- Added support ANSI code show/hide cursor
- Added info to README
[...]
I'll leave the rest of the patch up to Anatolij, he's The Expert.
Best regards, Marek Vasut

On Sunday 14 October 2012 01:48:20 Marek Vasut wrote:
Dear Pali Rohár,
- This patch add support for move cursor, reverse colors and
clear console> via ANSI espace codes in cfb_console driver
- ANSI escape codes can be enabled/disabled via
CONFIG_CFB_CONSOLE_ANSI> Signed-off-by: Pali Rohár pali.rohar@gmail.com
Missing v3?
In "Changes since v2" I wrote what was changed in open interval between v2 and v3. So it is not missing :-)
Changes since v2:
- Fixed multiline comments
Changes since v1:
- Added support ANSI code show/hide cursor
- Added info to README
[...]
I'll leave the rest of the patch up to Anatolij, he's The Expert.
Best regards, Marek Vasut

Dear Pali Rohár,
On Sunday 14 October 2012 01:48:20 Marek Vasut wrote:
Dear Pali Rohár,
- This patch add support for move cursor, reverse colors and
clear console>
via ANSI espace codes in cfb_console driver
- ANSI escape codes can be enabled/disabled via
CONFIG_CFB_CONSOLE_ANSI>
Signed-off-by: Pali Rohár pali.rohar@gmail.com
Missing v3?
In "Changes since v2" I wrote what was changed in open interval between v2 and v3. So it is not missing :-)
Please stop inventing new ways of writing changelog and obey: http://www.denx.de/wiki/U-Boot/Patches
Changes since v2:
- Fixed multiline comments
Changes since v1:
- Added support ANSI code show/hide cursor
- Added info to README
[...]
I'll leave the rest of the patch up to Anatolij, he's The Expert.
Best regards, Marek Vasut
Best regards, Marek Vasut

Based on previous work by: Alistair Buxton a.j.buxton@gmail.com
Signed-off-by: Pali Rohár pali.rohar@gmail.com Cc: Ивайло Димитров freemangordon@abv.bg --- Changes since v2: - Added documentation in doc/README.nokia_rx51 - Updated MAINTAINERS - Fixed Fix omap_mmc_init - Code for errata 430973 workaround - Added board specified atag support - Generate omap atag table instead reusing from NOLO - Load bootmenu.src always - Enabled ext4 support - Fixed comments - Reserve protected RAM for attached kernel - Rewritten assembler code in lowlevel_init.S - Reset lp5523 led on init
Changes since v1: - Set correct configs for Memory Map - Enable passing memory tag to kernel atags - Use gpio input command for detecting keyboard slide - Restore powerbus state after calling twl4030 regulator code - Renamed command noloboot to attachboot - Atag address must be always 0x80000100, removed code from lowlevel - Added usb vendor, product id and product name - Enabled command line editing - Fixed keymap and cursor keys
Changes since original version: - Removed Makefile targets: clean and distclean - Rewrited bootcommand and env variables in nokia_rx51.h - Removed useless CONFIG defines in nokia_rx51.h - Disable L2 cache with CONFIG_SYS_L2CACHE_OFF - fixed battery draining - Added onenand support (default disabled due to big u-boot size) - Moved inlined asm code to new file lowlevel_init.S - Fixed commit message
MAINTAINERS | 4 + board/nokia/rx51/Makefile | 46 +++ board/nokia/rx51/lowlevel_init.S | 209 ++++++++++++ board/nokia/rx51/rx51.c | 673 ++++++++++++++++++++++++++++++++++++++ board/nokia/rx51/rx51.h | 389 ++++++++++++++++++++++ board/nokia/rx51/tag_omap.h | 311 ++++++++++++++++++ boards.cfg | 1 + doc/README.nokia_rx51 | 104 ++++++ include/configs/nokia_rx51.h | 452 +++++++++++++++++++++++++ 9 files changed, 2189 insertions(+) create mode 100644 board/nokia/rx51/Makefile create mode 100644 board/nokia/rx51/lowlevel_init.S create mode 100644 board/nokia/rx51/rx51.c create mode 100644 board/nokia/rx51/rx51.h create mode 100644 board/nokia/rx51/tag_omap.h create mode 100644 doc/README.nokia_rx51 create mode 100644 include/configs/nokia_rx51.h
diff --git a/MAINTAINERS b/MAINTAINERS index 971235b..613d8cd 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1009,6 +1009,10 @@ Nobuhiro Iwamatsu nobuhiro.iwamatsu.yj@renesas.com
armadillo-800eva R8A7740 (RMOBILE SoC)
+Pali Rohár pali.rohar@gmail.com + + nokia_rx51 ARM ARMV7 (OMAP3xx SoC) + -------------------------------------------------------------------------
Unknown / orphaned boards: diff --git a/board/nokia/rx51/Makefile b/board/nokia/rx51/Makefile new file mode 100644 index 0000000..86fb48c --- /dev/null +++ b/board/nokia/rx51/Makefile @@ -0,0 +1,46 @@ +# +# (C) Copyright 2000, 2001, 2002 +# Wolfgang Denk, DENX Software Engineering, wd@denx.de. +# +# 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 as +# published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# + +include $(TOPDIR)/config.mk + +LIB = $(obj)lib$(BOARD).o + +COBJS-y := $(BOARD).o +SOBJS-y := lowlevel_init.o + +COBJS := $(sort $(COBJS-y)) +SOBJS := $(sort $(SOBJS-y)) +SRCS := $(COBJS:.o=.c) $(SOBJS:.o=.S) +OBJS := $(addprefix $(obj),$(COBJS)) $(addprefix $(obj),$(SOBJS)) + +$(LIB): $(obj).depend $(OBJS) + $(call cmd_link_o_target, $(OBJS)) + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +######################################################################### diff --git a/board/nokia/rx51/lowlevel_init.S b/board/nokia/rx51/lowlevel_init.S new file mode 100644 index 0000000..055b103 --- /dev/null +++ b/board/nokia/rx51/lowlevel_init.S @@ -0,0 +1,209 @@ +/* + * (C) Copyright 2011-2012 + * Pali Rohár pali.rohar@gmail.com + * + * 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 as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <config.h> + +relocaddr: /* address of this relocaddr section after coping */ + .word . /* address of section (calculated at compile time) */ + +startaddr: /* address of u-boot after copying */ + .word CONFIG_SYS_TEXT_BASE + +kernaddr: /* address of kernel after copying */ + .word KERNEL_ADDRESS + +kernsize: /* maximal size of kernel image */ + .word KERNEL_MAXSIZE + +kernoffs: /* offset of kernel image in loaded u-boot */ + .word KERNEL_OFFSET + +imagesize: /* maximal size of image */ + .word IMAGE_MAXSIZE + +ih_magic: /* IH_MAGIC in big endian from include/image.h */ + .word 0x56190527 + +/* + * Routine: save_boot_params (called after reset from start.S) + * Description: Copy attached kernel to address KERNEL_ADDRESS + * Copy u-boot to address CONFIG_SYS_TEXT_BASE + * Return to copied u-boot address + */ + +.global save_boot_params +save_boot_params: + + +/* Copy valid attached kernel to address KERNEL_ADDRESS */ + +copy_kernel_start: + adr r0, relocaddr /* r0 - address of section relocaddr */ + ldr r1, relocaddr /* r1 - address of relocaddr after relocation */ + cmp r0, r1 + + /* r4 - calculated offset */ + subhi r4, r0, r1 + sublo r4, r1, r0 + + /* r0 - start of kernel before */ + ldr r0, startaddr + addhi r0, r0, r4 + sublo r0, r0, r4 + ldr r1, kernoffs + add r0, r0, r1 + + /* r3 - start of kernel after */ + ldr r3, kernaddr + + /* r2 - end of kernel after */ + ldr r1, kernsize + add r2, r3, r1 + + /* r1 - end of kernel before */ + add r1, r0, r1 + + /* remove header in target kernel */ + mov r5, #0 + str r5, [r3] + + /* check for valid kernel uImage */ + ldr r4, [r0] /* r4 - 4 bytes header of kernel */ + ldr r5, ih_magic /* r5 - IH_MAGIC */ + cmp r4, r5 + bne copy_kernel_end /* skip if invalid image */ + +copy_kernel_loop: + ldmdb r1!, {r3 - r10} + stmdb r2!, {r3 - r10} + cmp r1, r0 + bhi copy_kernel_loop + +copy_kernel_end: + mov r5, #0 + str r5, [r0] /* remove 4 bytes header of kernel */ + + +/* Fix u-boot code */ + +fix_start: + adr r0, relocaddr /* r0 - address of section relocaddr */ + ldr r1, relocaddr /* r1 - address of relocaddr after relocation */ + cmp r0, r1 + + beq copy_uboot_end /* skip if u-boot is on correct address */ + + /* r5 - calculated offset */ + subhi r5, r0, r1 + sublo r5, r1, r0 + + /* r6 - maximal u-boot size */ + ldr r6, imagesize + + /* fix return address */ + subhi lr, lr, r5 + addlo lr, lr, r5 + + /* r1 - start of u-boot after */ + ldr r1, startaddr + + /* r0 - start of u-boot before */ + addhi r0, r1, r5 + sublo r0, r1, r5 + + /* check if we need to move uboot copy code before calling it */ + cmp r5, r6 + bhi copy_uboot_start /* now coping u-boot code directly is safe */ + + +copy_code_start: + /* r0 - start of u-boot before */ + /* r1 - start of u-boot after */ + /* r6 - maximal u-boot size */ + + /* r7 - maximal kernel size */ + ldr r7, kernsize + + /* r4 - end of kernel before */ + add r4, r0, r6 + add r4, r4, r7 + + /* r5 - end of u-boot after */ + ldr r5, startaddr + add r5, r5, r6 + + /* r2 - start of loop code after */ + cmp r4, r5 /* higher address (r4 or r5) */ + movhs r2, r4 + movlo r2, r5 + + /* r3 - end of loop code before */ + adr r3, end + + /* r4 - end of loop code after */ + adr r4, copy_uboot_start + sub r4, r3, r4 + add r4, r2, r4 + +copy_code_loop: + ldmdb r3!, {r7 - r10} + stmdb r4!, {r7 - r10} + cmp r4, r2 + bhi copy_code_loop + +copy_code_end: + mov pc, r2 + + +/* Copy u-boot to address CONFIG_SYS_TEXT_BASE */ + +copy_uboot_start: + /* r0 - start of u-boot before */ + /* r1 - start of u-boot after */ + /* r6 - maximal u-boot size */ + + /* r2 - end of u-boot after */ + add r2, r1, r6 + + /* condition for copying from left to right */ + cmp r0, r1 + addlo r1, r0, r6 /* r1 - end of u-boot before */ + blo copy_uboot_loop_right + +copy_uboot_loop_left: + ldmia r0!, {r3 - r10} + stmia r1!, {r3 - r10} + cmp r1, r2 + blo copy_uboot_loop_left + b copy_uboot_end + +copy_uboot_loop_right: + ldmdb r1!, {r3 - r10} + stmdb r2!, {r3 - r10} + cmp r1, r0 + bhi copy_uboot_loop_right + +copy_uboot_end: + bx lr + +end: diff --git a/board/nokia/rx51/rx51.c b/board/nokia/rx51/rx51.c new file mode 100644 index 0000000..79342eb --- /dev/null +++ b/board/nokia/rx51/rx51.c @@ -0,0 +1,673 @@ +/* + * (C) Copyright 2012 + * Ивайло Димитров freemangordon@abv.bg + * + * (C) Copyright 2011-2012 + * Pali Rohár pali.rohar@gmail.com + * + * (C) Copyright 2010 + * Alistair Buxton a.j.buxton@gmail.com + * + * Derived from Beagle Board and 3430 SDP code: + * (C) Copyright 2004-2008 + * Texas Instruments, <www.ti.com> + * + * Author : + * Sunil Kumar sunilsaini05@gmail.com + * Shashi Ranjan shashiranjanmca05@gmail.com + * + * Richard Woodruff r-woodruff2@ti.com + * Syed Mohammed Khasim khasim@ti.com + * + * 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 as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <common.h> +#include <malloc.h> +#include <twl4030.h> +#include <i2c.h> +#include <video_fb.h> +#include <asm/io.h> +#include <asm/setup.h> +#include <asm/bitops.h> +#include <asm/mach-types.h> +#include <asm/arch/mux.h> +#include <asm/arch/sys_proto.h> +#include <asm/arch/mmc_host_def.h> + +#include "rx51.h" +#include "tag_omap.h" + +DECLARE_GLOBAL_DATA_PTR; + +GraphicDevice gdev; + +const omap3_sysinfo sysinfo = { + DDR_STACKED, + "Nokia RX-51", + "OneNAND" +}; + +/* This structure contains default omap tags needed for booting Maemo 5 */ +static struct tag_omap omap[] = { + OMAP_TAG_UART_CONFIG(0x04), + OMAP_TAG_SERIAL_CONSOLE_CONFIG(0x03, 0x01C200), + OMAP_TAG_LCD_CONFIG("acx565akm", "internal", 90, 0x18), + OMAP_TAG_GPIO_SWITCH_CONFIG("cam_focus", 0x44, 0x1, 0x2, 0x0), + OMAP_TAG_GPIO_SWITCH_CONFIG("cam_launch", 0x45, 0x1, 0x2, 0x0), + OMAP_TAG_GPIO_SWITCH_CONFIG("cam_shutter", 0x6e, 0x1, 0x0, 0x0), + OMAP_TAG_GPIO_SWITCH_CONFIG("cmt_apeslpx", 0x46, 0x2, 0x2, 0x0), + OMAP_TAG_GPIO_SWITCH_CONFIG("cmt_bsi", 0x9d, 0x2, 0x2, 0x0), + OMAP_TAG_GPIO_SWITCH_CONFIG("cmt_en", 0x4a, 0x2, 0x2, 0x0), + OMAP_TAG_GPIO_SWITCH_CONFIG("cmt_rst", 0x4b, 0x6, 0x2, 0x0), + OMAP_TAG_GPIO_SWITCH_CONFIG("cmt_rst_rq", 0x49, 0x6, 0x2, 0x0), + OMAP_TAG_GPIO_SWITCH_CONFIG("cmt_wddis", 0x0d, 0x2, 0x2, 0x0), + OMAP_TAG_GPIO_SWITCH_CONFIG("headphone", 0xb1, 0x1, 0x1, 0x0), + OMAP_TAG_GPIO_SWITCH_CONFIG("kb_lock", 0x71, 0x1, 0x0, 0x0), + OMAP_TAG_GPIO_SWITCH_CONFIG("proximity", 0x59, 0x0, 0x0, 0x0), + OMAP_TAG_GPIO_SWITCH_CONFIG("sleep_ind", 0xa2, 0x2, 0x2, 0x0), + OMAP_TAG_GPIO_SWITCH_CONFIG("slide", GPIO_SLIDE, 0x0, 0x0, 0x0), + OMAP_TAG_WLAN_CX3110X_CONFIG(0x25, 0xff, 87, 42, -1), + OMAP_TAG_PARTITION_CONFIG(PART1_NAME, PART1_SIZE * PART1_MULL, + PART1_OFFS, PART1_MASK), + OMAP_TAG_PARTITION_CONFIG(PART2_NAME, PART2_SIZE * PART2_MULL, + PART2_OFFS, PART2_MASK), + OMAP_TAG_PARTITION_CONFIG(PART3_NAME, PART3_SIZE * PART3_MULL, + PART3_OFFS, PART3_MASK), + OMAP_TAG_PARTITION_CONFIG(PART4_NAME, PART4_SIZE * PART4_MULL, + PART4_OFFS, PART4_MASK), + OMAP_TAG_PARTITION_CONFIG(PART5_NAME, PART5_SIZE * PART5_MULL, + PART5_OFFS, PART5_MASK), + OMAP_TAG_PARTITION_CONFIG(PART6_NAME, PART6_SIZE * PART6_MULL, + PART6_OFFS, PART6_MASK), + OMAP_TAG_BOOT_REASON_CONFIG("pwr_key"), + OMAP_TAG_VERSION_STR_CONFIG("product", "RX-51"), + OMAP_TAG_VERSION_STR_CONFIG("hw-build", "2101"), + OMAP_TAG_VERSION_STR_CONFIG("nolo", "1.4.14"), + OMAP_TAG_VERSION_STR_CONFIG("boot-mode", "normal"), + { } +}; + +static char *boot_reason_ptr; +static char *hw_build_ptr; +static char *nolo_version_ptr; +static char *boot_mode_ptr; + +/* + * Routine: init_omap_tags + * Description: Initialize pointers to values in tag_omap + */ +static void init_omap_tags(void) +{ + char *component; + char *version; + int i = 0; + while (omap[i].hdr.tag) { + switch (omap[i].hdr.tag) { + case OMAP_TAG_BOOT_REASON: + boot_reason_ptr = omap[i].u.boot_reason.reason_str; + break; + case OMAP_TAG_VERSION_STR: + component = omap[i].u.version.component; + version = omap[i].u.version.version; + if (strcmp(component, "hw-build") == 0) + hw_build_ptr = version; + else if (strcmp(component, "nolo") == 0) + nolo_version_ptr = version; + else if (strcmp(component, "boot-mode") == 0) + boot_mode_ptr = version; + break; + } + ++i; + } +} + +static void reuse_omap_atags(struct tag_omap *t) +{ + char *component; + char *version; + while (t->hdr.tag) { + switch (t->hdr.tag) { + case OMAP_TAG_BOOT_REASON: + memset(boot_reason_ptr, 0, 12); + strcpy(boot_reason_ptr, t->u.boot_reason.reason_str); + break; + case OMAP_TAG_VERSION_STR: + component = t->u.version.component; + version = t->u.version.version; + if (strcmp(component, "hw-build") == 0) { + memset(hw_build_ptr, 0, 12); + strcpy(hw_build_ptr, version); + } else if (strcmp(component, "nolo") == 0) { + memset(nolo_version_ptr, 0, 12); + strcpy(nolo_version_ptr, version); + } else if (strcmp(component, "boot-mode") == 0) { + memset(boot_mode_ptr, 0, 12); + strcpy(boot_mode_ptr, version); + } + break; + } + t = tag_omap_next(t); + } +} + +/* + * Routine: reuse_atags + * Description: Reuse atags from previous bootloader. + * Reuse only only HW build, boot reason, boot mode and nolo + */ +static void reuse_atags(void) +{ + struct tag *t = (struct tag *)gd->bd->bi_boot_params; + + /* First tag must be ATAG_CORE */ + if (t->hdr.tag != ATAG_CORE) + return; + + if (!boot_reason_ptr || !hw_build_ptr) + return; + + /* Last tag must be ATAG_NONE */ + while (t->hdr.tag != ATAG_NONE) { + switch (t->hdr.tag) { + case ATAG_REVISION: + memset(hw_build_ptr, 0, 12); + sprintf(hw_build_ptr, "%x", t->u.revision.rev); + break; + case ATAG_BOARD: + reuse_omap_atags((struct tag_omap *)&t->u); + break; + } + t = tag_next(t); + } +} + +/* + * Routine: board_init + * Description: Early hardware init. + */ +int board_init(void) +{ + gpmc_init(); /* in SRAM or SDRAM, finish GPMC */ + /* board id for Linux */ + gd->bd->bi_arch_number = MACH_TYPE_NOKIA_RX51; + /* boot param addr */ + gd->bd->bi_boot_params = OMAP34XX_SDRC_CS0 + 0x100; + + return 0; +} + +/* + * Routine: get_board_revision + * Description: Return board revision. + */ +u32 get_board_rev(void) +{ + return simple_strtol(hw_build_ptr, NULL, 16); +} + +/* + * Routine: setup_board_tags + * Description: Append board specific boot tags. + */ +void setup_board_tags(struct tag **in_params) +{ + int setup_console_atag; + char *setup_boot_reason_atag; + char *setup_boot_mode_atag; + char *str; + int i; + int size; + int total_size; + struct tag *params; + struct tag_omap *t; + + params = (struct tag *)gd->bd->bi_boot_params; + + params->u.core.flags = 0x0; + params->u.core.pagesize = 0x1000; + params->u.core.rootdev = 0x0; + + /* append omap atag only if env setup_omap_atag is set to 1 */ + str = getenv("setup_omap_atag"); + if (!str || strcmp(str, "1") != 0) + return; + + str = getenv("setup_console_atag"); + if (str && strcmp(str, "1") == 0) + setup_console_atag = 1; + else + setup_console_atag = 0; + + setup_boot_reason_atag = getenv("setup_boot_reason_atag"); + setup_boot_mode_atag = getenv("setup_boot_mode_atag"); + + params = *in_params; + t = (struct tag_omap *)¶ms->u; + total_size = sizeof(struct tag_header); + + for (i = 0; omap[i].hdr.tag; ++i) { + + /* skip serial console tag */ + if (!setup_console_atag && + omap[i].hdr.tag == OMAP_TAG_SERIAL_CONSOLE) + continue; + + size = omap[i].hdr.size + sizeof(struct tag_omap_header); + memcpy(t, &omap[i], size); + + /* set uart tag to 0 - disable serial console */ + if (!setup_console_atag && omap[i].hdr.tag == OMAP_TAG_UART) + t->u.uart.enabled_uarts = 0; + + /* change boot reason */ + if (setup_boot_reason_atag && + omap[i].hdr.tag == OMAP_TAG_BOOT_REASON) { + memset(t->u.boot_reason.reason_str, 0, 12); + strcpy(t->u.boot_reason.reason_str, + setup_boot_reason_atag); + } + + /* change boot mode */ + if (setup_boot_mode_atag && + omap[i].hdr.tag == OMAP_TAG_VERSION_STR && + strcmp(omap[i].u.version.component, "boot-mode") == 0) { + memset(t->u.version.version, 0, 12); + strcpy(t->u.version.version, setup_boot_mode_atag); + } + + total_size += size; + t = tag_omap_next(t); + + } + + params->hdr.tag = ATAG_BOARD; + params->hdr.size = total_size >> 2; + params = tag_next(params); + + *in_params = params; +} + +/* + * Routine: video_hw_init + * Description: Set up the GraphicDevice depending on sys_boot. + */ +void *video_hw_init(void) +{ + /* fill in Graphic Device */ + gdev.frameAdrs = 0x8f9c0000; + gdev.winSizeX = 800; + gdev.winSizeY = 480; + gdev.gdfBytesPP = 2; + gdev.gdfIndex = GDF_16BIT_565RGB; + memset((void *)gdev.frameAdrs, 0, 0xbb800); + return (void *) &gdev; +} + +/* + * Routine: twl4030_regulator_set_mode + * Description: Set twl4030 regulator mode over i2c powerbus. + */ +static void twl4030_regulator_set_mode(u8 id, u8 mode) +{ + u16 msg = MSG_SINGULAR(DEV_GRP_P1, id, mode); + twl4030_i2c_write_u8(TWL4030_CHIP_PM_MASTER, msg >> 8, + TWL4030_PM_MASTER_PB_WORD_MSB); + twl4030_i2c_write_u8(TWL4030_CHIP_PM_MASTER, msg & 0xff, + TWL4030_PM_MASTER_PB_WORD_LSB); +} + +static void omap3_emu_romcode_call(u32 service_id, u32 *parameters) +{ + u32 i, num_params = *parameters; + u32 *sram_scratch_space = (u32 *)OMAP3_PUBLIC_SRAM_SCRATCH_AREA; + + /* + * copy the parameters to an un-cached area to avoid coherency + * issues + */ + for (i = 0; i < num_params; i++) { + __raw_writel(*parameters, sram_scratch_space); + parameters++; + sram_scratch_space++; + } + + /* Now make the PPA call */ + do_omap3_emu_romcode_call(service_id, OMAP3_PUBLIC_SRAM_SCRATCH_AREA); +} + +/* + * Routine: omap3_update_aux_cr_secure_rx51 + * Description: Modify the contents Auxiliary Control Register. + * Parameters: + * set_bits - bits to set in ACR + * clr_bits - bits to clear in ACR + */ +static void omap3_update_aux_cr_secure_rx51(u32 set_bits, u32 clear_bits) +{ + struct emu_hal_params_rx51 emu_romcode_params = { 0, }; + u32 acr; + + /* Read ACR */ + asm volatile ("mrc p15, 0, %0, c1, c0, 1" : "=r" (acr)); + acr &= ~clear_bits; + acr |= set_bits; + + emu_romcode_params.num_params = 2; + emu_romcode_params.param1 = acr; + + omap3_emu_romcode_call(OMAP3_EMU_HAL_API_WRITE_ACR, + (u32 *)&emu_romcode_params); +} + +/* + * Routine: misc_init_r + * Description: Configure board specific parts. + */ +int misc_init_r(void) +{ + char buf[12]; + u8 state; + + /* reset lp5523 led */ + i2c_set_bus_num(1); + state = 0xff; + i2c_write(0x32, 0x3d, 1, &state, 1); + i2c_set_bus_num(0); + + /* initialize twl4030 power managment */ + twl4030_power_init(); + + /* set VSIM to 1.8V */ + twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VSIM_DEDICATED, + TWL4030_PM_RECEIVER_VSIM_VSEL_18, + TWL4030_PM_RECEIVER_VSIM_DEV_GRP, + TWL4030_PM_RECEIVER_DEV_GRP_P1); + + /* store I2C access state */ + twl4030_i2c_read_u8(TWL4030_CHIP_PM_MASTER, &state, + TWL4030_PM_MASTER_PB_CFG); + + /* enable I2C access to powerbus (needed for twl4030 regulator) */ + twl4030_i2c_write_u8(TWL4030_CHIP_PM_MASTER, 0x02, + TWL4030_PM_MASTER_PB_CFG); + + /* set VAUX3, VSIM and VMMC1 state to active - enable eMMC memory */ + twl4030_regulator_set_mode(RES_VAUX3, RES_STATE_ACTIVE); + twl4030_regulator_set_mode(RES_VSIM, RES_STATE_ACTIVE); + twl4030_regulator_set_mode(RES_VMMC1, RES_STATE_ACTIVE); + + /* restore I2C access state */ + twl4030_i2c_write_u8(TWL4030_CHIP_PM_MASTER, state, + TWL4030_PM_MASTER_PB_CFG); + + /* set env variable attkernaddr for relocated kernel */ + sprintf(buf, "%#x", KERNEL_ADDRESS); + setenv("attkernaddr", buf); + + /* initialize omap tags */ + init_omap_tags(); + + /* reuse atags from previous bootloader */ + reuse_atags(); + + dieid_num_r(); + print_cpuinfo(); + + /* + * Cortex-A8(r1p0..r1p2) errata 430973 workaround + * Set IBE bit in Auxiliary Control Register + */ + omap3_update_aux_cr_secure_rx51(1 << 6, 0); + + return 0; +} + +/* + * Routine: set_muxconf_regs + * Description: Setting up the configuration Mux registers specific to the + * hardware. Many pins need to be moved from protect to primary + * mode. + */ +void set_muxconf_regs(void) +{ + MUX_RX51(); +} + +static unsigned long int twl_wd_time; /* last time of watchdog reset */ +static unsigned long int twl_i2c_lock; + +/* + * Routine: hw_watchdog_reset + * Description: Reset timeout of twl4030 watchdog. + */ +void hw_watchdog_reset(void) +{ + u8 timeout = 0; + + /* do not reset watchdog too often - max every 4s */ + if (get_timer(twl_wd_time) < 4 * CONFIG_SYS_HZ) + return; + + /* localy lock twl4030 i2c bus */ + if (test_and_set_bit(0, &twl_i2c_lock)) + return; + + /* read actual watchdog timeout */ + twl4030_i2c_read_u8(TWL4030_CHIP_PM_RECEIVER, &timeout, + TWL4030_PM_RECEIVER_WATCHDOG_CFG); + + /* timeout 0 means watchdog is disabled */ + /* reset watchdog timeout to 31s (maximum) */ + if (timeout != 0) + twl4030_i2c_write_u8(TWL4030_CHIP_PM_RECEIVER, 31, + TWL4030_PM_RECEIVER_WATCHDOG_CFG); + + /* store last watchdog reset time */ + twl_wd_time = get_timer(0); + + /* localy unlock twl4030 i2c bus */ + test_and_clear_bit(0, &twl_i2c_lock); +} + +/* + * TWL4030 keypad handler for cfb_console + */ + +static const char keymap[] = { + /* normal */ + 'q', 'o', 'p', ',', '\b', 0, 'a', 's', + 'w', 'd', 'f', 'g', 'h', 'j', 'k', 'l', + 'e', '.', 0, '\r', 0, 'z', 'x', 'c', + 'r', 'v', 'b', 'n', 'm', ' ', ' ', 0, + 't', 0, 0, 0, 0, 0, 0, 0, + 'y', 0, 0, 0, 0, 0, 0, 0, + 'u', 0, 0, 0, 0, 0, 0, 0, + 'i', 5, 6, 0, 0, 0, 0, 0, + /* fn */ + '1', '9', '0', '=', '\b', 0, '*', '+', + '2', '#', '-', '_', '(', ')', '&', '!', + '3', '?', '^', '\r', 0, 156, '$', 238, + '4', '/', '\', '"', ''', '@', 0, '<', + '5', '|', '>', 0, 0, 0, 0, 0, + '6', 0, 0, 0, 0, 0, 0, 0, + '7', 0, 0, 0, 0, 0, 0, 0, + '8', 16, 17, 0, 0, 0, 0, 0, +}; + +static u8 keys[8]; +static u8 old_keys[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +#define KEYBUF_SIZE 32 +static u8 keybuf[KEYBUF_SIZE]; +static u8 keybuf_head; +static u8 keybuf_tail; + +/* + * Routine: rx51_kp_init + * Description: Initialize HW keyboard. + */ +int rx51_kp_init(void) +{ + int ret = 0; + u8 ctrl; + ret = twl4030_i2c_read_u8(TWL4030_CHIP_KEYPAD, &ctrl, + TWL4030_KEYPAD_KEYP_CTRL_REG); + + if (!ret) { + /* turn on keyboard and use hardware scanning */ + ctrl |= TWL4030_KEYPAD_CTRL_KBD_ON; + ctrl |= TWL4030_KEYPAD_CTRL_SOFT_NRST; + ctrl |= TWL4030_KEYPAD_CTRL_SOFTMODEN; + ret |= twl4030_i2c_write_u8(TWL4030_CHIP_KEYPAD, ctrl, + TWL4030_KEYPAD_KEYP_CTRL_REG); + /* enable key event status */ + ret |= twl4030_i2c_write_u8(TWL4030_CHIP_KEYPAD, 0xfe, + TWL4030_KEYPAD_KEYP_IMR1); + /* enable interrupt generation on rising and falling */ + /* this is a workaround for qemu twl4030 emulation */ + ret |= twl4030_i2c_write_u8(TWL4030_CHIP_KEYPAD, 0x57, + TWL4030_KEYPAD_KEYP_EDR); + /* enable ISR clear on read */ + ret |= twl4030_i2c_write_u8(TWL4030_CHIP_KEYPAD, 0x05, + TWL4030_KEYPAD_KEYP_SIH_CTRL); + } + return ret; +} + +static void rx51_kp_fill(u8 k, u8 mods) +{ + if (!(mods & 2) && (k == 18 || k == 31 || k == 33 || k == 34)) { + /* cursor keys, without fn */ + keybuf[keybuf_tail++] = '\e'; + keybuf_tail %= KEYBUF_SIZE; + keybuf[keybuf_tail++] = '['; + keybuf_tail %= KEYBUF_SIZE; + if (k == 18) /* up */ + keybuf[keybuf_tail++] = 'A'; + else if (k == 31) /* left */ + keybuf[keybuf_tail++] = 'D'; + else if (k == 33) /* down */ + keybuf[keybuf_tail++] = 'B'; + else if (k == 34) /* right */ + keybuf[keybuf_tail++] = 'C'; + keybuf_tail %= KEYBUF_SIZE; + return; + } + + if (mods & 2) { /* fn */ + k = keymap[k+64]; + } else { + k = keymap[k]; + if (mods & 1) { /* ctrl */ + if (k >= 'a' && k <= 'z') + k -= 'a' - 1; + } + if (mods & 4) { /* shift */ + if (k >= 'a' && k <= 'z') + k += 'A' - 'a'; + else if (k == '.') + k = ':'; + else if (k == ',') + k = ';'; + } + } + keybuf[keybuf_tail++] = k; + keybuf_tail %= KEYBUF_SIZE; +} + +/* + * Routine: rx51_kp_tstc + * Description: Test if key was pressed (from buffer). + */ +int rx51_kp_tstc(void) +{ + u8 c, r, dk, i; + u8 intr; + u8 mods; + + /* localy lock twl4030 i2c bus */ + if (test_and_set_bit(0, &twl_i2c_lock)) + return 0; + + /* twl4030 remembers up to 2 events */ + for (i = 0; i < 2; i++) { + + /* check interrupt register for events */ + twl4030_i2c_read_u8(TWL4030_CHIP_KEYPAD, &intr, + TWL4030_KEYPAD_KEYP_ISR1+(2*i)); + + if (intr&1) { /* got an event */ + + /* read the key state */ + i2c_read(TWL4030_CHIP_KEYPAD, + TWL4030_KEYPAD_FULL_CODE_7_0, 1, keys, 8); + + /* cut out modifier keys from the keystate */ + mods = keys[4] >> 4; + keys[4] &= 0x0f; + + for (c = 0; c < 8; c++) { + + /* get newly pressed keys only */ + dk = ((keys[c] ^ old_keys[c])&keys[c]); + old_keys[c] = keys[c]; + + /* fill the keybuf */ + for (r = 0; r < 8; r++) { + if (dk&1) + rx51_kp_fill((c*8)+r, mods); + dk = dk >> 1; + } + + } + + } + + } + + /* localy unlock twl4030 i2c bus */ + test_and_clear_bit(0, &twl_i2c_lock); + + return (KEYBUF_SIZE + keybuf_tail - keybuf_head)%KEYBUF_SIZE; +} + +/* + * Routine: rx51_kp_getc + * Description: Get last pressed key (from buffer). + */ +int rx51_kp_getc(void) +{ + keybuf_head %= KEYBUF_SIZE; + while (!rx51_kp_tstc()) { + udelay(1); + hw_watchdog_reset(); + } + return keybuf[keybuf_head++]; +} + +/* + * Routine: board_mmc_init + * Description: Initialize mmc devices. + */ +int board_mmc_init(bd_t *bis) +{ + omap_mmc_init(0, 0, 0); + omap_mmc_init(1, 0, 0); + return 0; +} diff --git a/board/nokia/rx51/rx51.h b/board/nokia/rx51/rx51.h new file mode 100644 index 0000000..e66e241 --- /dev/null +++ b/board/nokia/rx51/rx51.h @@ -0,0 +1,389 @@ +/* + * (C) Copyright 2012 + * Ивайло Димитров freemangordon@abv.bg + * + * (C) Copyright 2011-2012 + * Pali Rohár pali.rohar@gmail.com + * + * (C) Copyright 2008 + * Dirk Behme dirk.behme@gmail.com + * + * 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 as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ +#ifndef _RX51_H_ +#define _RX51_H_ + +/* Needed for ROM SMC call */ +struct emu_hal_params_rx51 { + u32 num_params; + u32 param1; + u32 param2; + u32 param3; + u32 param4; +}; + +int print_cpuinfo(void); + +/* + * IEN - Input Enable + * IDIS - Input Disable + * PTD - Pull type Down + * PTU - Pull type Up + * DIS - Pull type selection is inactive + * EN - Pull type selection is active + * M0 - Mode 0 + * The commented string gives the final mux configuration for that pin + */ +#define MUX_RX51() \ +/* SDRC */\ + MUX_VAL(CP(SDRC_D0), (IEN | PTD | DIS | M0)) /*SDRC_D0*/\ + MUX_VAL(CP(SDRC_D1), (IEN | PTD | DIS | M0)) /*SDRC_D1*/\ + MUX_VAL(CP(SDRC_D2), (IEN | PTD | DIS | M0)) /*SDRC_D2*/\ + MUX_VAL(CP(SDRC_D3), (IEN | PTD | DIS | M0)) /*SDRC_D3*/\ + MUX_VAL(CP(SDRC_D4), (IEN | PTD | DIS | M0)) /*SDRC_D4*/\ + MUX_VAL(CP(SDRC_D5), (IEN | PTD | DIS | M0)) /*SDRC_D5*/\ + MUX_VAL(CP(SDRC_D6), (IEN | PTD | DIS | M0)) /*SDRC_D6*/\ + MUX_VAL(CP(SDRC_D7), (IEN | PTD | DIS | M0)) /*SDRC_D7*/\ + MUX_VAL(CP(SDRC_D8), (IEN | PTD | DIS | M0)) /*SDRC_D8*/\ + MUX_VAL(CP(SDRC_D9), (IEN | PTD | DIS | M0)) /*SDRC_D9*/\ + MUX_VAL(CP(SDRC_D10), (IEN | PTD | DIS | M0)) /*SDRC_D10*/\ + MUX_VAL(CP(SDRC_D11), (IEN | PTD | DIS | M0)) /*SDRC_D11*/\ + MUX_VAL(CP(SDRC_D12), (IEN | PTD | DIS | M0)) /*SDRC_D12*/\ + MUX_VAL(CP(SDRC_D13), (IEN | PTD | DIS | M0)) /*SDRC_D13*/\ + MUX_VAL(CP(SDRC_D14), (IEN | PTD | DIS | M0)) /*SDRC_D14*/\ + MUX_VAL(CP(SDRC_D15), (IEN | PTD | DIS | M0)) /*SDRC_D15*/\ + MUX_VAL(CP(SDRC_D16), (IEN | PTD | DIS | M0)) /*SDRC_D16*/\ + MUX_VAL(CP(SDRC_D17), (IEN | PTD | DIS | M0)) /*SDRC_D17*/\ + MUX_VAL(CP(SDRC_D18), (IEN | PTD | DIS | M0)) /*SDRC_D18*/\ + MUX_VAL(CP(SDRC_D19), (IEN | PTD | DIS | M0)) /*SDRC_D19*/\ + MUX_VAL(CP(SDRC_D20), (IEN | PTD | DIS | M0)) /*SDRC_D20*/\ + MUX_VAL(CP(SDRC_D21), (IEN | PTD | DIS | M0)) /*SDRC_D21*/\ + MUX_VAL(CP(SDRC_D22), (IEN | PTD | DIS | M0)) /*SDRC_D22*/\ + MUX_VAL(CP(SDRC_D23), (IEN | PTD | DIS | M0)) /*SDRC_D23*/\ + MUX_VAL(CP(SDRC_D24), (IEN | PTD | DIS | M0)) /*SDRC_D24*/\ + MUX_VAL(CP(SDRC_D25), (IEN | PTD | DIS | M0)) /*SDRC_D25*/\ + MUX_VAL(CP(SDRC_D26), (IEN | PTD | DIS | M0)) /*SDRC_D26*/\ + MUX_VAL(CP(SDRC_D27), (IEN | PTD | DIS | M0)) /*SDRC_D27*/\ + MUX_VAL(CP(SDRC_D28), (IEN | PTD | DIS | M0)) /*SDRC_D28*/\ + MUX_VAL(CP(SDRC_D29), (IEN | PTD | DIS | M0)) /*SDRC_D29*/\ + MUX_VAL(CP(SDRC_D30), (IEN | PTD | DIS | M0)) /*SDRC_D30*/\ + MUX_VAL(CP(SDRC_D31), (IEN | PTD | DIS | M0)) /*SDRC_D31*/\ + MUX_VAL(CP(SDRC_CLK), (IEN | PTD | DIS | M0)) /*SDRC_CLK*/\ + MUX_VAL(CP(SDRC_DQS0), (IEN | PTD | DIS | M0)) /*SDRC_DQS0*/\ + MUX_VAL(CP(SDRC_DQS1), (IEN | PTD | DIS | M0)) /*SDRC_DQS1*/\ + MUX_VAL(CP(SDRC_DQS2), (IEN | PTD | DIS | M0)) /*SDRC_DQS2*/\ + MUX_VAL(CP(SDRC_DQS3), (IEN | PTD | DIS | M0)) /*SDRC_DQS3*/\ +/* GPMC */\ + MUX_VAL(CP(GPMC_A1), (IDIS | PTD | DIS | M0)) /*GPMC_A1*/\ + MUX_VAL(CP(GPMC_A2), (IDIS | PTD | DIS | M0)) /*GPMC_A2*/\ + MUX_VAL(CP(GPMC_A3), (IDIS | PTD | DIS | M0)) /*GPMC_A3*/\ + MUX_VAL(CP(GPMC_A4), (IDIS | PTD | DIS | M0)) /*GPMC_A4*/\ + MUX_VAL(CP(GPMC_A5), (IDIS | PTD | DIS | M0)) /*GPMC_A5*/\ + MUX_VAL(CP(GPMC_A6), (IDIS | PTD | DIS | M0)) /*GPMC_A6*/\ + MUX_VAL(CP(GPMC_A7), (IDIS | PTD | DIS | M0)) /*GPMC_A7*/\ + MUX_VAL(CP(GPMC_A8), (IDIS | PTD | DIS | M0)) /*GPMC_A8*/\ + MUX_VAL(CP(GPMC_A9), (IDIS | PTD | DIS | M0)) /*GPMC_A9*/\ + MUX_VAL(CP(GPMC_A10), (IDIS | PTD | DIS | M0)) /*GPMC_A10*/\ + MUX_VAL(CP(GPMC_D0), (IEN | PTD | DIS | M0)) /*GPMC_D0*/\ + MUX_VAL(CP(GPMC_D1), (IEN | PTD | DIS | M0)) /*GPMC_D1*/\ + MUX_VAL(CP(GPMC_D2), (IEN | PTD | DIS | M0)) /*GPMC_D2*/\ + MUX_VAL(CP(GPMC_D3), (IEN | PTD | DIS | M0)) /*GPMC_D3*/\ + MUX_VAL(CP(GPMC_D4), (IEN | PTD | DIS | M0)) /*GPMC_D4*/\ + MUX_VAL(CP(GPMC_D5), (IEN | PTD | DIS | M0)) /*GPMC_D5*/\ + MUX_VAL(CP(GPMC_D6), (IEN | PTD | DIS | M0)) /*GPMC_D6*/\ + MUX_VAL(CP(GPMC_D7), (IEN | PTD | DIS | M0)) /*GPMC_D7*/\ + MUX_VAL(CP(GPMC_D8), (IEN | PTD | DIS | M0)) /*GPMC_D8*/\ + MUX_VAL(CP(GPMC_D9), (IEN | PTD | DIS | M0)) /*GPMC_D9*/\ + MUX_VAL(CP(GPMC_D10), (IEN | PTD | DIS | M0)) /*GPMC_D10*/\ + MUX_VAL(CP(GPMC_D11), (IEN | PTD | DIS | M0)) /*GPMC_D11*/\ + MUX_VAL(CP(GPMC_D12), (IEN | PTD | DIS | M0)) /*GPMC_D12*/\ + MUX_VAL(CP(GPMC_D13), (IEN | PTD | DIS | M0)) /*GPMC_D13*/\ + MUX_VAL(CP(GPMC_D14), (IEN | PTD | DIS | M0)) /*GPMC_D14*/\ + MUX_VAL(CP(GPMC_D15), (IEN | PTD | DIS | M0)) /*GPMC_D15*/\ + MUX_VAL(CP(GPMC_NCS0), (IDIS | PTU | EN | M0)) /*GPMC_nCS0*/\ + MUX_VAL(CP(GPMC_NCS1), (IDIS | PTU | EN | M0)) /*GPMC_nCS1*/\ + MUX_VAL(CP(GPMC_NCS2), (IDIS | PTU | EN | M0)) /*GPMC_nCS2*/\ + MUX_VAL(CP(GPMC_NCS3), (IDIS | PTU | EN | M0)) /*GPMC_nCS3*/\ + MUX_VAL(CP(GPMC_NCS4), (IDIS | PTU | EN | M0)) /*GPMC_nCS4*/\ + MUX_VAL(CP(GPMC_NCS5), (IDIS | PTD | DIS | M0)) /*GPMC_nCS5*/\ + MUX_VAL(CP(GPMC_NCS6), (IEN | PTD | DIS | M1)) /*nDMA_REQ2*/\ + MUX_VAL(CP(GPMC_NCS7), (IEN | PTU | EN | M1)) /*nDMA_REQ3*/\ + MUX_VAL(CP(GPMC_NBE1), (IEN | PTD | DIS | M0)) /*GPMC_nBE1*/\ + MUX_VAL(CP(GPMC_WAIT2), (IEN | PTU | EN | M0)) /*GPMC_WAIT2*/\ + MUX_VAL(CP(GPMC_WAIT3), (IEN | PTU | EN | M0)) /*GPMC_WAIT3*/\ + MUX_VAL(CP(GPMC_CLK), (IDIS | PTD | DIS | M0)) /*GPMC_CLK*/\ + MUX_VAL(CP(GPMC_NADV_ALE), (IDIS | PTD | DIS | M0)) /*GPMC_nADV*/\ + MUX_VAL(CP(GPMC_NOE), (IDIS | PTD | DIS | M0)) /*GPMC_nOE*/\ + MUX_VAL(CP(GPMC_NWE), (IDIS | PTD | DIS | M0)) /*GPMC_nWE*/\ + MUX_VAL(CP(GPMC_NBE0_CLE), (IDIS | PTD | DIS | M0)) /*GPMC_nBE0*/\ + MUX_VAL(CP(GPMC_NWP), (IEN | PTD | DIS | M0)) /*GPMC_nWP*/\ + MUX_VAL(CP(GPMC_WAIT0), (IEN | PTU | EN | M0)) /*GPMC_WAIT0*/\ + MUX_VAL(CP(GPMC_WAIT1), (IEN | PTU | EN | M0)) /*GPMC_WAIT1*/\ +/* DSS */\ + MUX_VAL(CP(DSS_PCLK), (IDIS | PTD | DIS | M0)) /*DSS_PCLK*/\ + MUX_VAL(CP(DSS_HSYNC), (IDIS | PTD | DIS | M0)) /*DSS_HSYNC*/\ + MUX_VAL(CP(DSS_VSYNC), (IDIS | PTD | DIS | M0)) /*DSS_VSYNC*/\ + MUX_VAL(CP(DSS_ACBIAS), (IDIS | PTD | DIS | M0)) /*DSS_ACBIAS*/\ + MUX_VAL(CP(DSS_DATA0), (IDIS | PTD | DIS | M0)) /*DSS_DATA0*/\ + MUX_VAL(CP(DSS_DATA1), (IDIS | PTD | DIS | M0)) /*DSS_DATA1*/\ + MUX_VAL(CP(DSS_DATA2), (IDIS | PTD | DIS | M0)) /*DSS_DATA2*/\ + MUX_VAL(CP(DSS_DATA3), (IDIS | PTD | DIS | M0)) /*DSS_DATA3*/\ + MUX_VAL(CP(DSS_DATA4), (IDIS | PTD | DIS | M0)) /*DSS_DATA4*/\ + MUX_VAL(CP(DSS_DATA5), (IDIS | PTD | DIS | M0)) /*DSS_DATA5*/\ + MUX_VAL(CP(DSS_DATA6), (IDIS | PTD | DIS | M0)) /*DSS_DATA6*/\ + MUX_VAL(CP(DSS_DATA7), (IDIS | PTD | DIS | M0)) /*DSS_DATA7*/\ + MUX_VAL(CP(DSS_DATA8), (IDIS | PTD | DIS | M0)) /*DSS_DATA8*/\ + MUX_VAL(CP(DSS_DATA9), (IDIS | PTD | DIS | M0)) /*DSS_DATA9*/\ + MUX_VAL(CP(DSS_DATA10), (IDIS | PTD | DIS | M0)) /*DSS_DATA10*/\ + MUX_VAL(CP(DSS_DATA11), (IDIS | PTD | DIS | M0)) /*DSS_DATA11*/\ + MUX_VAL(CP(DSS_DATA12), (IDIS | PTD | DIS | M0)) /*DSS_DATA12*/\ + MUX_VAL(CP(DSS_DATA13), (IDIS | PTD | DIS | M0)) /*DSS_DATA13*/\ + MUX_VAL(CP(DSS_DATA14), (IDIS | PTD | DIS | M0)) /*DSS_DATA14*/\ + MUX_VAL(CP(DSS_DATA15), (IDIS | PTD | DIS | M0)) /*DSS_DATA15*/\ + MUX_VAL(CP(DSS_DATA16), (IDIS | PTD | DIS | M0)) /*DSS_DATA16*/\ + MUX_VAL(CP(DSS_DATA17), (IDIS | PTD | DIS | M0)) /*DSS_DATA17*/\ + MUX_VAL(CP(DSS_DATA18), (IDIS | PTD | DIS | M0)) /*DSS_DATA18*/\ + MUX_VAL(CP(DSS_DATA19), (IDIS | PTD | DIS | M0)) /*DSS_DATA19*/\ + MUX_VAL(CP(DSS_DATA20), (IDIS | PTD | DIS | M0)) /*DSS_DATA20*/\ + MUX_VAL(CP(DSS_DATA21), (IDIS | PTD | DIS | M0)) /*DSS_DATA21*/\ + MUX_VAL(CP(DSS_DATA22), (IDIS | PTD | DIS | M0)) /*DSS_DATA22*/\ + MUX_VAL(CP(DSS_DATA23), (IDIS | PTD | DIS | M0)) /*DSS_DATA23*/\ +/* CAMERA */\ + MUX_VAL(CP(CAM_HS), (IEN | PTU | EN | M0)) /*CAM_HS*/\ + MUX_VAL(CP(CAM_VS), (IEN | PTU | EN | M0)) /*CAM_VS*/\ + MUX_VAL(CP(CAM_XCLKA), (IDIS | PTD | DIS | M0)) /*CAM_XCLKA*/\ + MUX_VAL(CP(CAM_PCLK), (IEN | PTU | EN | M0)) /*CAM_PCLK*/\ + MUX_VAL(CP(CAM_FLD), (IDIS | PTD | DIS | M4)) /*GPIO_98*/\ + MUX_VAL(CP(CAM_D0), (IEN | PTD | DIS | M0)) /*CAM_D0*/\ + MUX_VAL(CP(CAM_D1), (IEN | PTD | DIS | M0)) /*CAM_D1*/\ + MUX_VAL(CP(CAM_D2), (IEN | PTD | DIS | M0)) /*CAM_D2*/\ + MUX_VAL(CP(CAM_D3), (IEN | PTD | DIS | M0)) /*CAM_D3*/\ + MUX_VAL(CP(CAM_D4), (IEN | PTD | DIS | M0)) /*CAM_D4*/\ + MUX_VAL(CP(CAM_D5), (IEN | PTD | DIS | M0)) /*CAM_D5*/\ + MUX_VAL(CP(CAM_D6), (IEN | PTD | DIS | M0)) /*CAM_D6*/\ + MUX_VAL(CP(CAM_D7), (IEN | PTD | DIS | M0)) /*CAM_D7*/\ + MUX_VAL(CP(CAM_D8), (IEN | PTD | DIS | M0)) /*CAM_D8*/\ + MUX_VAL(CP(CAM_D9), (IEN | PTD | DIS | M0)) /*CAM_D9*/\ + MUX_VAL(CP(CAM_D10), (IEN | PTD | DIS | M0)) /*CAM_D10*/\ + MUX_VAL(CP(CAM_D11), (IEN | PTD | DIS | M0)) /*CAM_D11*/\ + MUX_VAL(CP(CAM_XCLKB), (IDIS | PTD | DIS | M0)) /*CAM_XCLKB*/\ + MUX_VAL(CP(CAM_WEN), (IEN | PTD | DIS | M4)) /*GPIO_167*/\ + MUX_VAL(CP(CAM_STROBE), (IDIS | PTD | DIS | M0)) /*CAM_STROBE*/\ + MUX_VAL(CP(CSI2_DX0), (IEN | PTD | DIS | M0)) /*CSI2_DX0*/\ + MUX_VAL(CP(CSI2_DY0), (IEN | PTD | DIS | M0)) /*CSI2_DY0*/\ + MUX_VAL(CP(CSI2_DX1), (IEN | PTD | DIS | M0)) /*CSI2_DX1*/\ + MUX_VAL(CP(CSI2_DY1), (IEN | PTD | DIS | M0)) /*CSI2_DY1*/\ +/* Audio Interface */\ + MUX_VAL(CP(MCBSP2_FSX), (IEN | PTD | DIS | M0)) /*McBSP2_FSX*/\ + MUX_VAL(CP(MCBSP2_CLKX), (IEN | PTD | DIS | M0)) /*McBSP2_CLK*/\ + MUX_VAL(CP(MCBSP2_DR), (IEN | PTD | DIS | M0)) /*McBSP2_DR*/\ + MUX_VAL(CP(MCBSP2_DX), (IDIS | PTD | DIS | M0)) /*McBSP2_DX*/\ +/* Expansion card */\ + MUX_VAL(CP(MMC1_CLK), (IDIS | PTU | EN | M0)) /*MMC1_CLK*/\ + MUX_VAL(CP(MMC1_CMD), (IEN | PTU | EN | M0)) /*MMC1_CMD*/\ + MUX_VAL(CP(MMC1_DAT0), (IEN | PTU | EN | M0)) /*MMC1_DAT0*/\ + MUX_VAL(CP(MMC1_DAT1), (IEN | PTU | EN | M0)) /*MMC1_DAT1*/\ + MUX_VAL(CP(MMC1_DAT2), (IEN | PTU | EN | M0)) /*MMC1_DAT2*/\ + MUX_VAL(CP(MMC1_DAT3), (IEN | PTU | EN | M0)) /*MMC1_DAT3*/\ + MUX_VAL(CP(MMC1_DAT4), (IEN | PTU | EN | M0)) /*MMC1_DAT4*/\ + MUX_VAL(CP(MMC1_DAT5), (IEN | PTU | EN | M0)) /*MMC1_DAT5*/\ + MUX_VAL(CP(MMC1_DAT6), (IEN | PTU | EN | M0)) /*MMC1_DAT6*/\ + MUX_VAL(CP(MMC1_DAT7), (IEN | PTU | EN | M0)) /*MMC1_DAT7*/\ +/* Wireless LAN */\ + MUX_VAL(CP(MMC2_CLK), (IEN | PTU | EN | M4)) /*GPIO_130*/\ + MUX_VAL(CP(MMC2_CMD), (IEN | PTU | EN | M4)) /*GPIO_131*/\ + MUX_VAL(CP(MMC2_DAT0), (IEN | PTU | EN | M4)) /*GPIO_132*/\ + MUX_VAL(CP(MMC2_DAT1), (IEN | PTU | EN | M4)) /*GPIO_133*/\ + MUX_VAL(CP(MMC2_DAT2), (IEN | PTU | EN | M4)) /*GPIO_134*/\ + MUX_VAL(CP(MMC2_DAT3), (IEN | PTU | EN | M4)) /*GPIO_135*/\ + MUX_VAL(CP(MMC2_DAT4), (IEN | PTU | EN | M4)) /*GPIO_136*/\ + MUX_VAL(CP(MMC2_DAT5), (IEN | PTU | EN | M4)) /*GPIO_137*/\ + MUX_VAL(CP(MMC2_DAT6), (IEN | PTU | EN | M4)) /*GPIO_138*/\ + MUX_VAL(CP(MMC2_DAT7), (IEN | PTU | EN | M4)) /*GPIO_139*/\ +/* Bluetooth */\ + MUX_VAL(CP(MCBSP3_DX), (IEN | PTD | DIS | M1)) /*UART2_CTS*/\ + MUX_VAL(CP(MCBSP3_DR), (IDIS | PTD | DIS | M1)) /*UART2_RTS*/\ + MUX_VAL(CP(MCBSP3_CLKX), (IDIS | PTD | DIS | M1)) /*UART2_TX*/\ + MUX_VAL(CP(MCBSP3_FSX), (IEN | PTD | DIS | M1)) /*UART2_RX*/\ + MUX_VAL(CP(UART2_CTS), (IEN | PTD | DIS | M4)) /*GPIO_144*/\ + MUX_VAL(CP(UART2_RTS), (IEN | PTD | DIS | M4)) /*GPIO_145*/\ + MUX_VAL(CP(UART2_TX), (IEN | PTD | DIS | M4)) /*GPIO_146*/\ + MUX_VAL(CP(UART2_RX), (IEN | PTD | DIS | M4)) /*GPIO_147*/\ +/* Modem Interface */\ + MUX_VAL(CP(UART1_TX), (IDIS | PTD | DIS | M0)) /*UART1_TX*/\ + MUX_VAL(CP(UART1_RTS), (IDIS | PTD | DIS | M4)) /*GPIO_149*/\ + MUX_VAL(CP(UART1_CTS), (IDIS | PTD | DIS | M4)) /*GPIO_150*/\ + MUX_VAL(CP(UART1_RX), (IEN | PTD | DIS | M0)) /*UART1_RX*/\ + MUX_VAL(CP(MCBSP4_CLKX), (IEN | PTD | DIS | M1)) /*SSI1_DAT*/\ + MUX_VAL(CP(MCBSP4_DR), (IEN | PTD | DIS | M1)) /*SSI1_FLAG*/\ + MUX_VAL(CP(MCBSP4_DX), (IEN | PTD | DIS | M1)) /*SSI1_RDY*/\ + MUX_VAL(CP(MCBSP4_FSX), (IEN | PTD | DIS | M1)) /*SSI1_WAKE*/\ + MUX_VAL(CP(MCBSP1_CLKR), (IDIS | PTD | DIS | M4)) /*GPIO_156*/\ + MUX_VAL(CP(MCBSP1_FSR), (IDIS | PTU | EN | M4)) /*GPIO_157*/\ + MUX_VAL(CP(MCBSP1_DX), (IDIS | PTD | DIS | M4)) /*GPIO_158*/\ + MUX_VAL(CP(MCBSP1_DR), (IDIS | PTD | DIS | M4)) /*GPIO_159*/\ + MUX_VAL(CP(MCBSP_CLKS), (IEN | PTU | DIS | M0)) /*McBSP_CLKS*/\ + MUX_VAL(CP(MCBSP1_FSX), (IDIS | PTD | DIS | M4)) /*GPIO_161*/\ + MUX_VAL(CP(MCBSP1_CLKX), (IDIS | PTD | DIS | M4)) /*GPIO_162*/\ +/* Serial Interface */\ + MUX_VAL(CP(UART3_CTS_RCTX), (IEN | PTD | EN | M0)) /*UART3_CTS*/\ + MUX_VAL(CP(UART3_RTS_SD), (IDIS | PTD | DIS | M0)) /*UART3_RTS*/\ + MUX_VAL(CP(UART3_RX_IRRX), (IEN | PTD | DIS | M0)) /*UART3_RX*/\ + MUX_VAL(CP(UART3_TX_IRTX), (IDIS | PTD | DIS | M0)) /*UART3_TX*/\ + MUX_VAL(CP(HSUSB0_CLK), (IEN | PTD | DIS | M0)) /*HSUSB0_CLK*/\ + MUX_VAL(CP(HSUSB0_STP), (IDIS | PTU | EN | M0)) /*HSUSB0_STP*/\ + MUX_VAL(CP(HSUSB0_DIR), (IEN | PTD | DIS | M0)) /*HSUSB0_DIR*/\ + MUX_VAL(CP(HSUSB0_NXT), (IEN | PTD | DIS | M0)) /*HSUSB0_NXT*/\ + MUX_VAL(CP(HSUSB0_DATA0), (IEN | PTD | DIS | M0)) /*HSUSB0_DA0*/\ + MUX_VAL(CP(HSUSB0_DATA1), (IEN | PTD | DIS | M0)) /*HSUSB0_DA1*/\ + MUX_VAL(CP(HSUSB0_DATA2), (IEN | PTD | DIS | M0)) /*HSUSB0_DA2*/\ + MUX_VAL(CP(HSUSB0_DATA3), (IEN | PTD | DIS | M0)) /*HSUSB0_DA3*/\ + MUX_VAL(CP(HSUSB0_DATA4), (IEN | PTD | DIS | M0)) /*HSUSB0_DA4*/\ + MUX_VAL(CP(HSUSB0_DATA5), (IEN | PTD | DIS | M0)) /*HSUSB0_DA5*/\ + MUX_VAL(CP(HSUSB0_DATA6), (IEN | PTD | DIS | M0)) /*HSUSB0_DA6*/\ + MUX_VAL(CP(HSUSB0_DATA7), (IEN | PTD | DIS | M0)) /*HSUSB0_DA7*/\ + MUX_VAL(CP(I2C1_SCL), (IEN | PTU | EN | M0)) /*I2C1_SCL*/\ + MUX_VAL(CP(I2C1_SDA), (IEN | PTU | EN | M0)) /*I2C1_SDA*/\ + MUX_VAL(CP(I2C2_SCL), (IEN | PTU | EN | M4)) /*GPIO_168*/\ + MUX_VAL(CP(I2C2_SDA), (IEN | PTU | EN | M4)) /*GPIO_183*/\ + MUX_VAL(CP(I2C3_SCL), (IEN | PTU | EN | M0)) /*I2C3_SCL*/\ + MUX_VAL(CP(I2C3_SDA), (IEN | PTU | EN | M0)) /*I2C3_SDA*/\ + MUX_VAL(CP(I2C4_SCL), (IEN | PTU | EN | M0)) /*I2C4_SCL*/\ + MUX_VAL(CP(I2C4_SDA), (IEN | PTU | EN | M0)) /*I2C4_SDA*/\ + MUX_VAL(CP(HDQ_SIO), (IDIS | PTU | EN | M4)) /*GPIO_170*/\ + MUX_VAL(CP(MCSPI1_CLK), (IEN | PTU | EN | M4)) /*GPIO_171*/\ + MUX_VAL(CP(MCSPI1_SIMO), (IEN | PTU | EN | M4)) /*GPIO_172*/\ + MUX_VAL(CP(MCSPI1_SOMI), (IEN | PTD | DIS | M0)) /*McSPI1_SOM*/\ + MUX_VAL(CP(MCSPI1_CS0), (IEN | PTD | EN | M0)) /*McSPI1_CS0*/\ + MUX_VAL(CP(MCSPI1_CS1), (IDIS | PTD | EN | M0)) /*McSPI1_CS1*/\ + MUX_VAL(CP(MCSPI1_CS2), (IDIS | PTD | DIS | M4)) /*GPIO_176*/\ +/* USB EHCI (port 2) */\ + MUX_VAL(CP(MCSPI1_CS3), (IEN | PTU | DIS | M3)) /*HSUSB2_DA2*/\ + MUX_VAL(CP(MCSPI2_CLK), (IEN | PTU | DIS | M3)) /*HSUSB2_DA7*/\ + MUX_VAL(CP(MCSPI2_SIMO), (IEN | PTU | DIS | M3)) /*HSUSB2_DA4*/\ + MUX_VAL(CP(MCSPI2_SOMI), (IEN | PTU | DIS | M3)) /*HSUSB2_DA5*/\ + MUX_VAL(CP(MCSPI2_CS0), (IEN | PTU | DIS | M3)) /*HSUSB2_DA6*/\ + MUX_VAL(CP(MCSPI2_CS1), (IEN | PTU | DIS | M3)) /*HSUSB2_DA3*/\ + MUX_VAL(CP(ETK_D10_ES2), (IDIS | PTU | DIS | M3)) /*HSUSB2_CLK*/\ + MUX_VAL(CP(ETK_D11_ES2), (IDIS | PTU | DIS | M3)) /*HSUSB2_STP*/\ + MUX_VAL(CP(ETK_D12_ES2), (IEN | PTU | DIS | M3)) /*HSUSB2_DIR*/\ + MUX_VAL(CP(ETK_D13_ES2), (IEN | PTU | DIS | M3)) /*HSUSB2_NXT*/\ + MUX_VAL(CP(ETK_D14_ES2), (IEN | PTU | DIS | M3)) /*HSUSB2_DA0*/\ + MUX_VAL(CP(ETK_D15_ES2), (IEN | PTU | DIS | M3)) /*HSUSB2_DA1*/\ +/* Control and debug */\ + MUX_VAL(CP(SYS_32K), (IEN | PTD | DIS | M0)) /*SYS_32K*/\ + MUX_VAL(CP(SYS_CLKREQ), (IEN | PTD | DIS | M0)) /*SYS_CLKREQ*/\ + MUX_VAL(CP(SYS_NIRQ), (IEN | PTU | EN | M0)) /*SYS_nIRQ*/\ + MUX_VAL(CP(SYS_BOOT0), (IEN | PTD | DIS | M4)) /*GPIO_2*/\ + MUX_VAL(CP(SYS_BOOT1), (IEN | PTD | DIS | M4)) /*GPIO_3*/\ + MUX_VAL(CP(SYS_BOOT2), (IEN | PTD | DIS | M4)) /*MMC1_WP*/\ + MUX_VAL(CP(SYS_BOOT3), (IEN | PTD | DIS | M4)) /*GPIO_5*/\ + MUX_VAL(CP(SYS_BOOT4), (IEN | PTD | DIS | M4)) /*GPIO_6*/\ + MUX_VAL(CP(SYS_BOOT5), (IEN | PTD | DIS | M4)) /*GPIO_7*/\ + MUX_VAL(CP(SYS_BOOT6), (IDIS | PTD | DIS | M4)) /*GPIO_8*/\ + MUX_VAL(CP(SYS_OFF_MODE), (IEN | PTD | DIS | M0)) /*SYS_OFF_MD*/\ + MUX_VAL(CP(SYS_CLKOUT1), (IEN | PTD | DIS | M0)) /*SYS_CLKOUT*/\ + MUX_VAL(CP(SYS_CLKOUT2), (IEN | PTU | EN | M4)) /*GPIO_186*/\ + MUX_VAL(CP(ETK_CLK_ES2), (IDIS | PTU | EN | M3)) /*HSUSB1_STP*/\ + MUX_VAL(CP(ETK_CTL_ES2), (IDIS | PTU | DIS | M3)) /*HSUSB1_CLK*/\ + MUX_VAL(CP(ETK_D0_ES2), (IEN | PTU | DIS | M3)) /*HSUSB1_DA0*/\ + MUX_VAL(CP(ETK_D1_ES2), (IEN | PTU | DIS | M3)) /*HSUSB1_DA1*/\ + MUX_VAL(CP(ETK_D2_ES2), (IEN | PTU | DIS | M3)) /*HSUSB1_DA2*/\ + MUX_VAL(CP(ETK_D3_ES2), (IEN | PTU | DIS | M3)) /*HSUSB1_DA7*/\ + MUX_VAL(CP(ETK_D4_ES2), (IEN | PTU | DIS | M3)) /*HSUSB1_DA4*/\ + MUX_VAL(CP(ETK_D5_ES2), (IEN | PTU | DIS | M3)) /*HSUSB1_DA5*/\ + MUX_VAL(CP(ETK_D6_ES2), (IEN | PTU | DIS | M3)) /*HSUSB1_DA6*/\ + MUX_VAL(CP(ETK_D7_ES2), (IEN | PTU | DIS | M3)) /*HSUSB1_DA3*/\ + MUX_VAL(CP(ETK_D8_ES2), (IEN | PTU | DIS | M3)) /*HSUSB1_DIR*/\ + MUX_VAL(CP(ETK_D9_ES2), (IEN | PTU | DIS | M3)) /*HSUSB1_NXT*/\ + MUX_VAL(CP(D2D_MCAD1), (IEN | PTD | EN | M0)) /*d2d_mcad1*/\ + MUX_VAL(CP(D2D_MCAD2), (IEN | PTD | EN | M0)) /*d2d_mcad2*/\ + MUX_VAL(CP(D2D_MCAD3), (IEN | PTD | EN | M0)) /*d2d_mcad3*/\ + MUX_VAL(CP(D2D_MCAD4), (IEN | PTD | EN | M0)) /*d2d_mcad4*/\ + MUX_VAL(CP(D2D_MCAD5), (IEN | PTD | EN | M0)) /*d2d_mcad5*/\ + MUX_VAL(CP(D2D_MCAD6), (IEN | PTD | EN | M0)) /*d2d_mcad6*/\ + MUX_VAL(CP(D2D_MCAD7), (IEN | PTD | EN | M0)) /*d2d_mcad7*/\ + MUX_VAL(CP(D2D_MCAD8), (IEN | PTD | EN | M0)) /*d2d_mcad8*/\ + MUX_VAL(CP(D2D_MCAD9), (IEN | PTD | EN | M0)) /*d2d_mcad9*/\ + MUX_VAL(CP(D2D_MCAD10), (IEN | PTD | EN | M0)) /*d2d_mcad10*/\ + MUX_VAL(CP(D2D_MCAD11), (IEN | PTD | EN | M0)) /*d2d_mcad11*/\ + MUX_VAL(CP(D2D_MCAD12), (IEN | PTD | EN | M0)) /*d2d_mcad12*/\ + MUX_VAL(CP(D2D_MCAD13), (IEN | PTD | EN | M0)) /*d2d_mcad13*/\ + MUX_VAL(CP(D2D_MCAD14), (IEN | PTD | EN | M0)) /*d2d_mcad14*/\ + MUX_VAL(CP(D2D_MCAD15), (IEN | PTD | EN | M0)) /*d2d_mcad15*/\ + MUX_VAL(CP(D2D_MCAD16), (IEN | PTD | EN | M0)) /*d2d_mcad16*/\ + MUX_VAL(CP(D2D_MCAD17), (IEN | PTD | EN | M0)) /*d2d_mcad17*/\ + MUX_VAL(CP(D2D_MCAD18), (IEN | PTD | EN | M0)) /*d2d_mcad18*/\ + MUX_VAL(CP(D2D_MCAD19), (IEN | PTD | EN | M0)) /*d2d_mcad19*/\ + MUX_VAL(CP(D2D_MCAD20), (IEN | PTD | EN | M0)) /*d2d_mcad20*/\ + MUX_VAL(CP(D2D_MCAD21), (IEN | PTD | EN | M0)) /*d2d_mcad21*/\ + MUX_VAL(CP(D2D_MCAD22), (IEN | PTD | EN | M0)) /*d2d_mcad22*/\ + MUX_VAL(CP(D2D_MCAD23), (IEN | PTD | EN | M0)) /*d2d_mcad23*/\ + MUX_VAL(CP(D2D_MCAD24), (IEN | PTD | EN | M0)) /*d2d_mcad24*/\ + MUX_VAL(CP(D2D_MCAD25), (IEN | PTD | EN | M0)) /*d2d_mcad25*/\ + MUX_VAL(CP(D2D_MCAD26), (IEN | PTD | EN | M0)) /*d2d_mcad26*/\ + MUX_VAL(CP(D2D_MCAD27), (IEN | PTD | EN | M0)) /*d2d_mcad27*/\ + MUX_VAL(CP(D2D_MCAD28), (IEN | PTD | EN | M0)) /*d2d_mcad28*/\ + MUX_VAL(CP(D2D_MCAD29), (IEN | PTD | EN | M0)) /*d2d_mcad29*/\ + MUX_VAL(CP(D2D_MCAD30), (IEN | PTD | EN | M0)) /*d2d_mcad30*/\ + MUX_VAL(CP(D2D_MCAD31), (IEN | PTD | EN | M0)) /*d2d_mcad31*/\ + MUX_VAL(CP(D2D_MCAD32), (IEN | PTD | EN | M0)) /*d2d_mcad32*/\ + MUX_VAL(CP(D2D_MCAD33), (IEN | PTD | EN | M0)) /*d2d_mcad33*/\ + MUX_VAL(CP(D2D_MCAD34), (IEN | PTD | EN | M0)) /*d2d_mcad34*/\ + MUX_VAL(CP(D2D_MCAD35), (IEN | PTD | EN | M0)) /*d2d_mcad35*/\ + MUX_VAL(CP(D2D_MCAD36), (IEN | PTD | EN | M0)) /*d2d_mcad36*/\ + MUX_VAL(CP(D2D_CLK26MI), (IEN | PTD | DIS | M0)) /*d2d_clk26m*/\ + MUX_VAL(CP(D2D_NRESPWRON), (IEN | PTD | EN | M0)) /*d2d_nrespw*/\ + MUX_VAL(CP(D2D_NRESWARM), (IEN | PTU | EN | M0)) /*d2d_nreswa*/\ + MUX_VAL(CP(D2D_ARM9NIRQ), (IEN | PTD | DIS | M0)) /*d2d_arm9ni*/\ + MUX_VAL(CP(D2D_UMA2P6FIQ), (IEN | PTD | DIS | M0)) /*d2d_uma2p6*/\ + MUX_VAL(CP(D2D_SPINT), (IEN | PTD | EN | M0)) /*d2d_spint*/\ + MUX_VAL(CP(D2D_FRINT), (IEN | PTD | EN | M0)) /*d2d_frint*/\ + MUX_VAL(CP(D2D_DMAREQ0), (IEN | PTD | DIS | M0)) /*d2d_dmare0*/\ + MUX_VAL(CP(D2D_DMAREQ1), (IEN | PTD | DIS | M0)) /*d2d_dmare1*/\ + MUX_VAL(CP(D2D_DMAREQ2), (IEN | PTD | DIS | M0)) /*d2d_dmare2*/\ + MUX_VAL(CP(D2D_DMAREQ3), (IEN | PTD | DIS | M0)) /*d2d_dmare3*/\ + MUX_VAL(CP(D2D_N3GTRST), (IEN | PTD | DIS | M0)) /*d2d_n3gtrs*/\ + MUX_VAL(CP(D2D_N3GTDI), (IEN | PTD | DIS | M0)) /*d2d_n3gtdi*/\ + MUX_VAL(CP(D2D_N3GTDO), (IEN | PTD | DIS | M0)) /*d2d_n3gtdo*/\ + MUX_VAL(CP(D2D_N3GTMS), (IEN | PTD | DIS | M0)) /*d2d_n3gtms*/\ + MUX_VAL(CP(D2D_N3GTCK), (IEN | PTD | DIS | M0)) /*d2d_n3gtck*/\ + MUX_VAL(CP(D2D_N3GRTCK), (IEN | PTD | DIS | M0)) /*d2d_n3grtc*/\ + MUX_VAL(CP(D2D_MSTDBY), (IEN | PTU | EN | M0)) /*d2d_mstdby*/\ + MUX_VAL(CP(D2D_SWAKEUP), (IEN | PTD | EN | M0)) /*d2d_swakeu*/\ + MUX_VAL(CP(D2D_IDLEREQ), (IEN | PTD | DIS | M0)) /*d2d_idlere*/\ + MUX_VAL(CP(D2D_IDLEACK), (IEN | PTU | EN | M0)) /*d2d_idleac*/\ + MUX_VAL(CP(D2D_MWRITE), (IEN | PTD | DIS | M0)) /*d2d_mwrite*/\ + MUX_VAL(CP(D2D_SWRITE), (IEN | PTD | DIS | M0)) /*d2d_swrite*/\ + MUX_VAL(CP(D2D_MREAD), (IEN | PTD | DIS | M0)) /*d2d_mread*/\ + MUX_VAL(CP(D2D_SREAD), (IEN | PTD | DIS | M0)) /*d2d_sread*/\ + MUX_VAL(CP(D2D_MBUSFLAG), (IEN | PTD | DIS | M0)) /*d2d_mbusfl*/\ + MUX_VAL(CP(D2D_SBUSFLAG), (IEN | PTD | DIS | M0)) /*d2d_sbusfl*/\ + MUX_VAL(CP(SDRC_CKE0), (IDIS | PTU | EN | M0)) /*sdrc_cke0*/\ + MUX_VAL(CP(SDRC_CKE1), (IDIS | PTU | EN | M0)) /*sdrc_cke1*/ + +#define MUX_RX51_C() \ + MUX_VAL(CP(MCBSP3_DX), (IEN | PTD | DIS | M4)) /*GPIO_140*/\ + MUX_VAL(CP(MCBSP3_DR), (IEN | PTD | DIS | M4)) /*GPIO_142*/\ + MUX_VAL(CP(MCBSP3_CLKX), (IEN | PTD | DIS | M4)) /*GPIO_141*/\ + MUX_VAL(CP(UART2_CTS), (IEN | PTU | EN | M0)) /*UART2_CTS*/\ + MUX_VAL(CP(UART2_RTS), (IDIS | PTD | DIS | M0)) /*UART2_RTS*/\ + MUX_VAL(CP(UART2_TX), (IDIS | PTD | DIS | M0)) /*UART2_TX*/ + +#endif diff --git a/board/nokia/rx51/tag_omap.h b/board/nokia/rx51/tag_omap.h new file mode 100644 index 0000000..60fa26f --- /dev/null +++ b/board/nokia/rx51/tag_omap.h @@ -0,0 +1,311 @@ +/* + * (C) Copyright 2011-2012 + * Pali Rohár pali.rohar@gmail.com + * + * (C) Copyright 2011 + * marcel@mesa.nl, Mesa Consulting B.V. + * + * (C) Copyright 2004-2005 + * Nokia Corporation + * + * 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 as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + + +/* + * Code copied from maemo kernel 2.6.28 file + * arch/arm/plat-omap/include/mach/board.h + * + * Information structures for board-specific data + * + * Copyright (C) 2004 Nokia Corporation + * Written by Juha Yrjölä juha.yrjola@nokia.com + */ + +/* Different peripheral ids */ +#define OMAP_TAG_CLOCK 0x4f01 +#define OMAP_TAG_SERIAL_CONSOLE 0x4f03 +#define OMAP_TAG_USB 0x4f04 +#define OMAP_TAG_LCD 0x4f05 +#define OMAP_TAG_GPIO_SWITCH 0x4f06 +#define OMAP_TAG_UART 0x4f07 +#define OMAP_TAG_FBMEM 0x4f08 +#define OMAP_TAG_STI_CONSOLE 0x4f09 +#define OMAP_TAG_CAMERA_SENSOR 0x4f0a +#define OMAP_TAG_PARTITION 0x4f0b +#define OMAP_TAG_TEA5761 0x4f10 +#define OMAP_TAG_TMP105 0x4f11 + +#define OMAP_TAG_BOOT_REASON 0x4f80 +#define OMAP_TAG_FLASH_PART_STR 0x4f81 +#define OMAP_TAG_VERSION_STR 0x4f82 + +#define OMAP_TAG_NOKIA_BT 0x4e01 +#define OMAP_TAG_WLAN_CX3110X 0x4e02 +#define OMAP_TAG_CBUS 0x4e03 +#define OMAP_TAG_EM_ASIC_BB5 0x4e04 + + +struct omap_clock_config { + /* 0 for 12 MHz, 1 for 13 MHz and 2 for 19.2 MHz */ + u8 system_clock_type; +}; + +struct omap_serial_console_config { + u8 console_uart; + u32 console_speed; +}; + +struct omap_sti_console_config { + unsigned enable:1; + u8 channel; +}; + +struct omap_usb_config { + /* Configure drivers according to the connectors on your board: + * - "A" connector (rectagular) + * ... for host/OHCI use, set "register_host". + * - "B" connector (squarish) or "Mini-B" + * ... for device/gadget use, set "register_dev". + * - "Mini-AB" connector (very similar to Mini-B) + * ... for OTG use as device OR host, initialize "otg" + */ + unsigned register_host:1; + unsigned register_dev:1; + u8 otg; /* port number, 1-based: usb1 == 2 */ + + u8 hmc_mode; + + /* implicitly true if otg: host supports remote wakeup? */ + u8 rwc; + + /* signaling pins used to talk to transceiver on usbN: + * 0 == usbN unused + * 2 == usb0-only, using internal transceiver + * 3 == 3 wire bidirectional + * 4 == 4 wire bidirectional + * 6 == 6 wire unidirectional (or TLL) + */ + u8 pins[3]; +}; + +struct omap_lcd_config { + char panel_name[16]; + char ctrl_name[16]; + s16 nreset_gpio; + u8 data_lines; +}; + +struct omap_fbmem_config { + u32 start; + u32 size; +}; + +struct omap_gpio_switch_config { + char name[12]; + u16 gpio; + u8 flags:4; + u8 type:4; + unsigned int key_code:24; /* Linux key code */ +}; + +struct omap_uart_config { + /* Bit field of UARTs present; bit 0 --> UART1 */ + unsigned int enabled_uarts; +}; + +struct omap_tea5761_config { + u16 enable_gpio; +}; + +struct omap_partition_config { + char name[16]; + unsigned int size; + unsigned int offset; + /* same as in include/linux/mtd/partitions.h */ + unsigned int mask_flags; +}; + +struct omap_flash_part_str_config { + char part_table[0]; +}; + +struct omap_boot_reason_config { + char reason_str[12]; +}; + +struct omap_version_config { + char component[12]; + char version[12]; +}; + +/* + * Code copied from maemo kernel 2.6.28 file + * arch/arm/plat-omap/include/mach/board-nokia.h + * + * Information structures for Nokia-specific board config data + * + * Copyright (C) 2005 Nokia Corporation + */ + +struct omap_bluetooth_config { + u8 chip_type; + u8 bt_wakeup_gpio; + u8 host_wakeup_gpio; + u8 reset_gpio; + u8 bt_uart; + u8 bd_addr[6]; + u8 bt_sysclk; +}; + +struct omap_wlan_cx3110x_config { + u8 chip_type; + u8 reserverd; + s16 power_gpio; + s16 irq_gpio; + s16 spi_cs_gpio; +}; + +struct omap_cbus_config { + s16 clk_gpio; + s16 dat_gpio; + s16 sel_gpio; +}; + +struct omap_em_asic_bb5_config { + s16 retu_irq_gpio; + s16 tahvo_irq_gpio; +}; + +/* + * omap_tag handling + * + * processing omap tag structures + * + * Copyright (C) 2011 marcel@mesa.nl, Mesa Consulting B.V. + * Copyright (C) 2012 Pali Rohár pali.rohar@gmail.com + */ + +/* TI OMAP specific information */ +#define ATAG_BOARD 0x414f4d50 + +struct tag_omap_header { + u16 tag; + u16 size; +}; + +struct tag_omap { + struct tag_omap_header hdr; + union { + struct omap_clock_config clock; + struct omap_serial_console_config serial_console; + struct omap_sti_console_config sti_console; + struct omap_usb_config usb; + struct omap_lcd_config lcd; + struct omap_fbmem_config fbmem; + struct omap_gpio_switch_config gpio_switch; + struct omap_uart_config uart; + struct omap_tea5761_config tea5761; + struct omap_partition_config partition; + struct omap_flash_part_str_config flash_part_str; + struct omap_boot_reason_config boot_reason; + struct omap_version_config version; + struct omap_bluetooth_config bluetooth; + struct omap_wlan_cx3110x_config wlan_cx3110x; + struct omap_cbus_config cbus; + struct omap_em_asic_bb5_config em_asic_bb5; + } u; +}; + +#define tag_omap_next(t) ((struct tag_omap *)((u8 *)(t) + \ + (t)->hdr.size + sizeof(struct tag_omap_header))) + +#define OMAP_TAG_HEADER_CONFIG(config, type) \ + .hdr.tag = config, \ + .hdr.size = sizeof(struct type) + +#define OMAP_TAG_UART_CONFIG(p1) \ + { \ + OMAP_TAG_HEADER_CONFIG(OMAP_TAG_UART, omap_uart_config), \ + .u.uart.enabled_uarts = p1, \ + } + +#define OMAP_TAG_SERIAL_CONSOLE_CONFIG(p1, p2) \ + { \ + OMAP_TAG_HEADER_CONFIG(OMAP_TAG_SERIAL_CONSOLE, \ + omap_serial_console_config), \ + .u.serial_console.console_uart = p1, \ + .u.serial_console.console_speed = p2, \ + } + +#define OMAP_TAG_LCD_CONFIG(p1, p2, p3, p4) \ + { \ + OMAP_TAG_HEADER_CONFIG(OMAP_TAG_LCD, omap_lcd_config), \ + .u.lcd.panel_name = p1, \ + .u.lcd.ctrl_name = p2, \ + .u.lcd.nreset_gpio = p3, \ + .u.lcd.data_lines = p4, \ + } + +#define OMAP_TAG_GPIO_SWITCH_CONFIG(p1, p2, p3, p4, p5) \ + { \ + OMAP_TAG_HEADER_CONFIG(OMAP_TAG_GPIO_SWITCH, \ + omap_gpio_switch_config), \ + .u.gpio_switch.name = p1, \ + .u.gpio_switch.gpio = p2, \ + .u.gpio_switch.flags = p3, \ + .u.gpio_switch.type = p4, \ + .u.gpio_switch.key_code = p5, \ + } + +#define OMAP_TAG_WLAN_CX3110X_CONFIG(p1, p2, p3, p4, p5) \ + { \ + OMAP_TAG_HEADER_CONFIG(OMAP_TAG_WLAN_CX3110X, \ + omap_wlan_cx3110x_config), \ + .u.wlan_cx3110x.chip_type = p1, \ + .u.wlan_cx3110x.reserverd = p2, \ + .u.wlan_cx3110x.power_gpio = p3, \ + .u.wlan_cx3110x.irq_gpio = p4, \ + .u.wlan_cx3110x.spi_cs_gpio = p5, \ + } + +#define OMAP_TAG_PARTITION_CONFIG(p1, p2, p3, p4) \ + { \ + OMAP_TAG_HEADER_CONFIG(OMAP_TAG_PARTITION, \ + omap_partition_config), \ + .u.partition.name = p1, \ + .u.partition.size = p2, \ + .u.partition.offset = p3, \ + .u.partition.mask_flags = p4, \ + } + +#define OMAP_TAG_BOOT_REASON_CONFIG(p1) \ + { \ + OMAP_TAG_HEADER_CONFIG(OMAP_TAG_BOOT_REASON, \ + omap_boot_reason_config), \ + .u.boot_reason.reason_str = p1, \ + } + +#define OMAP_TAG_VERSION_STR_CONFIG(p1, p2) \ + { \ + OMAP_TAG_HEADER_CONFIG(OMAP_TAG_VERSION_STR, \ + omap_version_config), \ + .u.version.component = p1, \ + .u.version.version = p2, \ + } diff --git a/boards.cfg b/boards.cfg index 4b17289..0647b3e 100644 --- a/boards.cfg +++ b/boards.cfg @@ -264,6 +264,7 @@ devkit8000 arm armv7 devkit8000 timll mcx arm armv7 mcx htkw omap3 tricorder arm armv7 tricorder corscience omap3 twister arm armv7 twister technexion omap3 +nokia_rx51 arm armv7 rx51 nokia omap3 omap4_panda arm armv7 panda ti omap4 omap4_sdp4430 arm armv7 sdp4430 ti omap4 omap5_evm arm armv7 omap5_evm ti omap5 diff --git a/doc/README.nokia_rx51 b/doc/README.nokia_rx51 new file mode 100644 index 0000000..a8fdfcd --- /dev/null +++ b/doc/README.nokia_rx51 @@ -0,0 +1,104 @@ +Board: Nokia RX-51 aka N900 + +This board definition results in a u-boot.bin which can be chainloaded +from NOLO in qemu or on a real N900. It does very little hardware config +because NOLO has already configured the board. Only needed is enabling +internal eMMC memory via twl4030 regulator which is not enabled by NOLO. + +NOLO is expecting a kernel image and will treat any image it finds in +onenand as such. This u-boot is intended to be flashed to the N900 like +a kernel. In order to transparently boot the original kernel, it will be +appended to u-boot.bin at 0x40000. NOLO will load the entire image into +(random) memory and execute u-boot, which saves hw revision, boot reason +and boot mode ATAGs set by NOLO. Then the bootscripts will attempt to load +uImage or boot.scr from a fat, ext2/ext3 or ext4 filesystem in external +SD card or internal eMMC memory. If this fails or keyboard is closed then +the appended kernel image will be booted using some generated and some +stored ATAGs (see boot order). + +There is support for hardware watchdog. Hardware watchdog is started by +NOLO so u-boot must kick watchdog to prevent reboot device (but not very +often, max every 2 seconds). There is also support for framebuffer display +output with ANSI espace codes and the N900 HW keyboard input. USB tty works +but is disabled because it prevents the current Maemo kernel from booting. + +When U-Boot is starting it enable IBE bit in Auxiliary Control Register, +which is needed for Thumb-2 ISA support. It is workaround for errata 430973. + +Default boot order: + + * 0. if keyboard is closed boot automatically attached kernel image + * 1. try boot from external SD card + * 2. try boot from internal eMMC memory + * 3. try boot from attached kernel image + +Boot from SD or eMMC in this order: + + * 1. + * 1.1 find boot.scr on first fat partition + * 1.2 find uImage on first fat parition + * 1.3 same order for 2. - 4. fat partition + * 2. same as 1. but for ext2/3 partition + * 3. same as 1. but for ext4 partition + + +Available additional commands/variables: + + * run sercon - Use serial port for control + * run usbcon - Use usbtty for control + * run vgacon - Use framebuffer and HW keyboard for control (default) + + * run sdboot - Boot from external SD card (see boot order) + * run emmcboot - Boot from internal eMMC memory (see boot order) + * run attachboot - Boot attached kernel image (attached to U-Boot binary) + + * run scriptload - Load boot script ${mmcscriptfile} + * run scriptboot - Run loaded boot script + * run kernload - Load kernel image ${mmckernfile} + * run initrdload - Load initrd image ${mmcinitrdfile} + * run kernboot - Boot loaded kernel image + * run kerninitrdboot - Boot loaded kernel image with loaded initrd image + + * run trymmcscriptboot - Try to load and boot script ${mmcscriptfile} + * run trymmckernboot - Try to load and boot kernel image ${mmckernfile} + * run trymmckerninitrdboot - Try to load and boot kernel image ${mmckernfile} + with initrd image ${mmcinitrdfile} + +Additional variables for loading files from mmc: + + * mmc ${mmcnum} (0 - external, 1 - internal) + * partition number ${mmcpart} (1 - 4) + * parition type ${mmctype} (fat, ext2) + +Additional varuables for booting kernel: + + * setup_omap_atag - Add OMAP table into atags structure (needs maemo kernel) + * setup_console_atag - Enable serial console in OMAP table + * setup_boot_reason_atag - Change boot reason in OMAP table + * setup_boot_mode_atag - Change boot mode in OMAP table + +USB TTY: + + Maemo kernel 2.6.28 will crash if u-boot enable usb tty. So USB TTY is disabled. + For enabling USB TTY just add this line to file include/configs/nokia_rx51.h + + #define CONFIG_USB_TTY + + +ONENAND support: + + ONENAND support is disabled because not working yet and cause linux kernel to + crash or no access to mtd. For enabling ONENAND support add this line at begin + of file include/configs/nokia_rx51.h + + #define ONENAND_SUPPORT + + +UBIFS support: + + UBIFS support is disabled, because U-Boot image is too big and cannot be + flashed with attached zImage to RX-51 kernel nand area. For enabling UBIFS + support first enable ONENAND support and then add this line at begin of file + include/configs/nokia_rx51.h + + #define UBIFS_SUPPORT diff --git a/include/configs/nokia_rx51.h b/include/configs/nokia_rx51.h new file mode 100644 index 0000000..ba4662d --- /dev/null +++ b/include/configs/nokia_rx51.h @@ -0,0 +1,452 @@ +/* + * (C) Copyright 2011-2012 + * Pali Rohár pali.rohar@gmail.com + * + * (C) Copyright 2010 + * Alistair Buxton a.j.buxton@gmail.com + * + * Derived from Beagle Board code: + * (C) Copyright 2006-2008 + * Texas Instruments. + * Richard Woodruff r-woodruff2@ti.com + * Syed Mohammed Khasim x0khasim@ti.com + * + * Configuration settings for the Nokia RX-51 aka N900. + * + * 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 as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#ifndef __CONFIG_H +#define __CONFIG_H + +/* + * High Level Configuration Options + */ + +#define CONFIG_OMAP /* in a TI OMAP core */ +#define CONFIG_OMAP34XX /* which is a 34XX */ +#define CONFIG_OMAP3430 /* which is in a 3430 */ +#define CONFIG_OMAP3_RX51 /* working with RX51 */ +#define CONFIG_SYS_L2CACHE_OFF /* pretend there is no L2 CACHE */ + +/* + * Nokia X-Loader loading secondary image to address 0x80400000 + * NOLO loading boot image to random place, so it doesn't really + * matter what we set this to. We have to copy u-boot to this address + */ +#define CONFIG_SYS_TEXT_BASE 0x80008000 + +#define CONFIG_SDRC /* The chip has SDRC controller */ + +#include <asm/arch/cpu.h> /* get chip and board defs */ +#include <asm/arch/omap3.h> +#include <asm/arch/mem.h> + +#define tostring(s) #s +#define stringify(s) tostring(s) + +/* + * Display CPU and Board information + */ +#define CONFIG_DISPLAY_CPUINFO +#define CONFIG_DISPLAY_BOARDINFO + +/* Clock Defines */ +#define V_OSCK 26000000 /* Clock output from T2 */ +#define V_SCLK (V_OSCK >> 1) + +#undef CONFIG_USE_IRQ /* no support for IRQs */ +#define CONFIG_MISC_INIT_R +#define CONFIG_SKIP_LOWLEVEL_INIT /* X-Loader set everything up */ + +#define CONFIG_CMDLINE_TAG /* enable passing kernel command line string */ +#define CONFIG_INITRD_TAG /* enable passing initrd */ +#define CONFIG_REVISION_TAG /* enable passing revision tag*/ +#define CONFIG_SETUP_MEMORY_TAGS /* enable memory tag */ + +/* + * Size of malloc() pool + */ +#define CONFIG_ENV_SIZE (128 << 10) +#define CONFIG_UBI_SIZE (512 << 10) +#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + CONFIG_UBI_SIZE + \ + (128 << 10)) + +/* + * Hardware drivers + */ + +/* + * NS16550 Configuration + */ +#define V_NS16550_CLK 48000000 /* 48MHz (APLL96/2) */ + +#define CONFIG_SYS_NS16550 +#define CONFIG_SYS_NS16550_SERIAL +#define CONFIG_SYS_NS16550_REG_SIZE (-4) +#define CONFIG_SYS_NS16550_CLK V_NS16550_CLK + +/* + * select serial console configuration + */ +#define CONFIG_CONS_INDEX 3 +#define CONFIG_SYS_NS16550_COM3 OMAP34XX_UART3 +#define CONFIG_SERIAL3 3 /* UART3 on RX-51 */ + +/* allow to overwrite serial and ethaddr */ +#define CONFIG_ENV_OVERWRITE +#define CONFIG_BAUDRATE 115200 +#define CONFIG_SYS_BAUDRATE_TABLE { 4800, 9600, 19200, 38400, 57600, 115200 } +#define CONFIG_MMC +#define CONFIG_GENERIC_MMC +#define CONFIG_OMAP_HSMMC +#define CONFIG_DOS_PARTITION + +/* USB */ +#define CONFIG_MUSB_UDC +#define CONFIG_MUSB_HDC +#define CONFIG_USB_OMAP3 +#define CONFIG_TWL4030_USB + +/* USB device configuration */ +#define CONFIG_USB_DEVICE +#define CONFIG_USBD_VENDORID 0x0421 +#define CONFIG_USBD_PRODUCTID 0x01c8 +#define CONFIG_USBD_MANUFACTURER "Nokia" +#define CONFIG_USBD_PRODUCT_NAME "N900" + +#define CONFIG_SYS_CONSOLE_IS_IN_ENV +#define CONFIG_SYS_NO_FLASH + +/* commands to include */ +#include <config_cmd_default.h> + +#define CONFIG_CMD_EXT2 /* EXT2 Support */ +#define CONFIG_CMD_EXT4 /* EXT4 Support */ +#define CONFIG_CMD_FAT /* FAT support */ + +#define CONFIG_CMD_I2C /* I2C serial bus support */ +#define CONFIG_CMD_MMC /* MMC support */ +#define CONFIG_CMD_GPIO /* Enable gpio command */ + +#define CONFIG_CMDLINE_EDITING /* add command line history */ +#define CONFIG_AUTO_COMPLETE /* add autocompletion support */ + +#define CONFIG_CMD_CLEAR /* ANSI terminal clear screen command */ + +#ifdef ONENAND_SUPPORT + +#define CONFIG_CMD_ONENAND /* ONENAND support */ +#define CONFIG_CMD_MTDPARTS /* mtd parts support */ + +#ifdef UBIFS_SUPPORT +#define CONFIG_CMD_UBI /* UBI Support */ +#define CONFIG_CMD_UBIFS /* UBIFS Support */ +#endif + +#endif + +/* commands not needed from config_cmd_default.h */ +#undef CONFIG_CMD_FPGA /* FPGA configuration Support */ +#undef CONFIG_CMD_IMI /* iminfo */ +#undef CONFIG_CMD_NET /* bootp, tftpboot, rarpboot */ +#undef CONFIG_CMD_NFS /* NFS support */ +#undef CONFIG_CMD_SAVEENV /* saveenv */ +#undef CONFIG_CMD_SETGETDCR /* DCR support on 4xx */ + +#define CONFIG_OMAP3_SPI +#define CONFIG_HARD_I2C +#define CONFIG_SYS_I2C_SPEED 100000 +#define CONFIG_SYS_I2C_SLAVE 1 +#define CONFIG_DRIVER_OMAP34XX_I2C + +/* + * TWL4030 + */ +#define CONFIG_TWL4030_POWER +#define CONFIG_TWL4030_LED +#define CONFIG_TWL4030_KEYPAD + +#define CONFIG_OMAP_GPIO +#define GPIO_SLIDE 71 + +/* + * Board ONENAND Info. + */ + +#define PART1_NAME "bootloader" +#define PART1_SIZE 128 +#define PART1_MULL 1024 +#define PART1_SUFF "k" +#define PART1_OFFS 0x00000000 +#define PART1_MASK 0x00000003 + +#define PART2_NAME "config" +#define PART2_SIZE 384 +#define PART2_MULL 1024 +#define PART2_SUFF "k" +#define PART2_OFFS 0x00020000 +#define PART2_MASK 0x00000000 + +#define PART3_NAME "log" +#define PART3_SIZE 256 +#define PART3_MULL 1024 +#define PART3_SUFF "k" +#define PART3_OFFS 0x00080000 +#define PART3_MASK 0x00000000 + +#define PART4_NAME "kernel" +#define PART4_SIZE 2 +#define PART4_MULL 1024*1024 +#define PART4_SUFF "m" +#define PART4_OFFS 0x000c0000 +#define PART4_MASK 0x00000000 + +#define PART5_NAME "initfs" +#define PART5_SIZE 2 +#define PART5_MULL 1024*1024 +#define PART5_SUFF "m" +#define PART5_OFFS 0x002c0000 +#define PART5_MASK 0x00000000 + +#define PART6_NAME "rootfs" +#define PART6_SIZE 257280 +#define PART6_MULL 1024 +#define PART6_SUFF "k" +#define PART6_OFFS 0x004c0000 +#define PART6_MASK 0x00000000 + +#ifdef ONENAND_SUPPORT + +#define PISMO1_NAND_SIZE GPMC_SIZE_128M +#define PISMO1_ONEN_SIZE GPMC_SIZE_128M +#define CONFIG_SYS_ONENAND_BASE ONENAND_MAP +#define CONFIG_MTD_DEVICE +#define CONFIG_MTD_PARTITIONS + +#ifdef UBIFS_SUPPORT +#define CONFIG_RBTREE +#define CONFIG_LZO +#endif + +#define MTDIDS_DEFAULT "onenand0=onenand" +#define MTDPARTS_DEFAULT "mtdparts=onenand:" \ + stringify(PART1_SIZE) PART1_SUFF "(" PART1_NAME ")ro," \ + stringify(PART2_SIZE) PART2_SUFF "(" PART2_NAME ")," \ + stringify(PART3_SIZE) PART3_SUFF "(" PART3_NAME ")," \ + stringify(PART4_SIZE) PART4_SUFF "(" PART4_NAME ")," \ + stringify(PART5_SIZE) PART5_SUFF "(" PART5_NAME ")," \ + "-(" PART6_NAME ")" + +#endif + +/* Watchdog support */ +#define CONFIG_HW_WATCHDOG + +/* + * Framebuffer + */ +/* Video console */ +#define CONFIG_VIDEO +#define CONFIG_CFB_CONSOLE +#define CONFIG_CFB_CONSOLE_ANSI /* Enable ANSI escape codes in framebuffer */ +#define CONFIG_VIDEO_LOGO +#define VIDEO_FB_16BPP_PIXEL_SWAP +#define VIDEO_FB_16BPP_WORD_SWAP +#define CONFIG_VIDEO_SW_CURSOR +#define CONFIG_SPLASH_SCREEN + +/* functions for cfb_console */ +#define VIDEO_KBD_INIT_FCT rx51_kp_init() +#define VIDEO_TSTC_FCT rx51_kp_tstc +#define VIDEO_GETC_FCT rx51_kp_getc +#ifndef __ASSEMBLY__ +int rx51_kp_init(void); +int rx51_kp_tstc(void); +int rx51_kp_getc(void); +#endif + +#ifndef MTDPARTS_DEFAULT +#define MTDPARTS_DEFAULT +#endif + +/* Environment information */ +#define CONFIG_BOOTDELAY 3 + +#define CONFIG_EXTRA_ENV_SETTINGS \ + "mtdparts=" MTDPARTS_DEFAULT "\0" \ + "usbtty=cdc_acm\0" \ + "stdin=vga\0" \ + "stdout=vga\0" \ + "stderr=vga\0" \ + "setcon=setenv stdin ${con};" \ + "setenv stdout ${con};" \ + "setenv stderr ${con}\0" \ + "sercon=setenv con serial; run setcon\0" \ + "usbcon=setenv con usbtty; run setcon\0" \ + "vgacon=setenv con vga; run setcon\0" \ + "slide=gpio input " stringify(GPIO_SLIDE) "\0" \ + "switchmmc=mmc dev ${mmcnum}\0" \ + "kernaddr=0x82008000\0" \ + "initrdaddr=0x84008000\0" \ + "scriptaddr=0x86008000\0" \ + "fileload=${mmctype}load mmc ${mmcnum}:${mmcpart} " \ + "${loadaddr} ${mmcfile}\0" \ + "kernload=setenv loadaddr ${kernaddr};" \ + "setenv mmcfile ${mmckernfile};" \ + "run fileload\0" \ + "initrdload=setenv loadaddr ${initrdaddr};" \ + "setenv mmcfile ${mmcinitrdfile};" \ + "run fileload\0" \ + "scriptload=setenv loadaddr ${scriptaddr};" \ + "setenv mmcfile ${mmcscriptfile};" \ + "run fileload\0" \ + "scriptboot=echo Running ${mmcscriptfile} from mmc " \ + "${mmcnum}:${mmcpart} ...; source ${scriptaddr}\0" \ + "kernboot=echo Booting ${mmckernfile} from mmc " \ + "${mmcnum}:${mmcpart} ...; bootm ${kernaddr}\0" \ + "kerninitrdboot=echo Booting ${mmckernfile} ${mmcinitrdfile} from mmc "\ + "${mmcnum}:${mmcpart} ...; bootm ${kernaddr} ${initrdaddr}\0" \ + "attachboot=echo Booting attached kernel image ...;" \ + "setenv setup_omap_atag 1;" \ + "bootm ${attkernaddr};" \ + "setenv setup_omap_atag\0" \ + "trymmcscriptboot=if run switchmmc; then " \ + "if run scriptload; then " \ + "run scriptboot;" \ + "fi;" \ + "fi\0" \ + "trymmckernboot=if run switchmmc; then " \ + "if run kernload; then " \ + "run kernboot;" \ + "fi;" \ + "fi\0" \ + "trymmckerninitrdboot=if run switchmmc; then " \ + "if run initrdload; then " \ + "if run kernload; then " \ + "run kerninitrdboot;" \ + "fi;" \ + "fi; " \ + "fi\0" \ + "trymmcpartboot=setenv mmcscriptfile boot.scr; run trymmcscriptboot;" \ + "setenv mmckernfile uImage; run trymmckernboot\0" \ + "trymmcallpartboot=setenv mmcpart 1; run trymmcpartboot;" \ + "setenv mmcpart 2; run trymmcpartboot;" \ + "setenv mmcpart 3; run trymmcpartboot;" \ + "setenv mmcpart 4; run trymmcpartboot\0" \ + "trymmcboot=if run switchmmc; then " \ + "setenv mmctype fat;" \ + "run trymmcallpartboot;" \ + "setenv mmctype ext2;" \ + "run trymmcallpartboot;" \ + "setenv mmctype ext4;" \ + "run trymmcallpartboot;" \ + "fi\0" \ + "emmcboot=setenv mmcnum 1; run trymmcboot\0" \ + "sdboot=setenv mmcnum 0; run trymmcboot\0" \ + "" + +#define CONFIG_PREBOOT \ + "if run slide; then true; else run attachboot; fi;" \ + "echo Extra commands:;" \ + "echo run sercon - Use serial port for control.;" \ + "echo run usbcon - Use usbtty for control.;" \ + "echo run vgacon - Use framebuffer/keyboard.;" \ + "echo run sdboot - Boot from SD card slot.;" \ + "echo run emmcboot - Boot internal eMMC memory.;" \ + "echo run attachboot - Boot attached kernel image.;" \ + "echo" + +#define CONFIG_BOOTCOMMAND \ + "run sdboot;" \ + "run emmcboot;" \ + "run attachboot;" \ + "echo" + +/* + * Miscellaneous configurable options + */ +#define CONFIG_SYS_LONGHELP /* undef to save memory */ +#define CONFIG_SYS_HUSH_PARSER /* use "hush" command parser */ +#define CONFIG_SYS_PROMPT_HUSH_PS2 "> " +#define CONFIG_SYS_PROMPT "Nokia RX-51 # " +#define CONFIG_SYS_CBSIZE 256 /* Console I/O Buffer Size */ +/* Print Buffer Size */ +#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \ + sizeof(CONFIG_SYS_PROMPT) + 16) +#define CONFIG_SYS_MAXARGS 16 /* max number of command args */ +/* Boot Argument Buffer Size */ +#define CONFIG_SYS_BARGSIZE (CONFIG_SYS_CBSIZE) + +#define CONFIG_SYS_MEMTEST_START (OMAP34XX_SDRC_CS0) +#define CONFIG_SYS_MEMTEST_END (OMAP34XX_SDRC_CS0 + 0x01F00000)/*31MB*/ + +/* default load address */ +#define CONFIG_SYS_LOAD_ADDR (OMAP34XX_SDRC_CS0) + +/* + * OMAP3 has 12 GP timers, they can be driven by the system clock + * (12/13/16.8/19.2/38.4MHz) or by 32KHz clock. We use 13MHz (V_SCLK). + * This rate is divided by a local divisor. + */ +#define CONFIG_SYS_TIMERBASE (OMAP34XX_GPT2) +#define CONFIG_SYS_PTV 2 /* Divisor: 2^(PTV+1) => 8 */ +#define CONFIG_SYS_HZ 1000 + +/* + * Stack sizes + * + * The stack sizes are set up in start.S using the settings below + */ +#define CONFIG_STACKSIZE (128 << 10) /* regular stack 128 KiB */ + +/* + * Physical Memory Map + */ +#define CONFIG_NR_DRAM_BANKS 2 +#define PHYS_SDRAM_1 OMAP34XX_SDRC_CS0 + +/* + * FLASH and environment organization + */ + +#define CONFIG_ENV_IS_NOWHERE + +#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM_1 +#define CONFIG_SYS_INIT_RAM_ADDR 0x4020f800 +#define CONFIG_SYS_INIT_RAM_SIZE 0x800 +#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_INIT_RAM_ADDR + \ + CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE) + +/* + * Attached kernel image + */ + +#define SDRAM_SIZE 0x10000000 /* 256 MB */ +#define SDRAM_END (CONFIG_SYS_SDRAM_BASE + SDRAM_SIZE) + +#define IMAGE_MAXSIZE 0x1FF800 /* 2 MB - 2 kB */ +#define KERNEL_OFFSET 0x40000 /* 256 kB */ +#define KERNEL_MAXSIZE (IMAGE_MAXSIZE-KERNEL_OFFSET) +#define KERNEL_ADDRESS (SDRAM_END-KERNEL_MAXSIZE) + +/* Reserve protected RAM for attached kernel */ +#define CONFIG_PRAM ((KERNEL_MAXSIZE >> 10)+1) + +#endif /* __CONFIG_H */

Dear Pali Rohár,
Based on previous work by: Alistair Buxton a.j.buxton@gmail.com
Signed-off-by: Pali Rohár pali.rohar@gmail.com Cc: Ивайло Димитров freemangordon@abv.bg
Can we please stick to ASCII instead of UTF8?
Cc: Ivaylo Dimitrov (if I'm not mistaken)
Changes since v2:
- Added documentation in doc/README.nokia_rx51
- Updated MAINTAINERS
- Fixed Fix omap_mmc_init
- Code for errata 430973 workaround
- Added board specified atag support
- Generate omap atag table instead reusing from NOLO
- Load bootmenu.src always
- Enabled ext4 support
- Fixed comments
- Reserve protected RAM for attached kernel
- Rewritten assembler code in lowlevel_init.S
- Reset lp5523 led on init
Changes since v1:
- Set correct configs for Memory Map
- Enable passing memory tag to kernel atags
- Use gpio input command for detecting keyboard slide
- Restore powerbus state after calling twl4030 regulator code
- Renamed command noloboot to attachboot
- Atag address must be always 0x80000100, removed code from lowlevel
- Added usb vendor, product id and product name
- Enabled command line editing
- Fixed keymap and cursor keys
Changes since original version:
- Removed Makefile targets: clean and distclean
- Rewrited bootcommand and env variables in nokia_rx51.h
- Removed useless CONFIG defines in nokia_rx51.h
- Disable L2 cache with CONFIG_SYS_L2CACHE_OFF - fixed battery draining
- Added onenand support (default disabled due to big u-boot size)
- Moved inlined asm code to new file lowlevel_init.S
- Fixed commit message
MAINTAINERS | 4 + board/nokia/rx51/Makefile | 46 +++ board/nokia/rx51/lowlevel_init.S | 209 ++++++++++++ board/nokia/rx51/rx51.c | 673 ++++++++++++++++++++++++++++++++++++++ board/nokia/rx51/rx51.h | 389 ++++++++++++++++++++++ board/nokia/rx51/tag_omap.h | 311 ++++++++++++++++++ boards.cfg | 1 + doc/README.nokia_rx51 | 104 ++++++ include/configs/nokia_rx51.h | 452 +++++++++++++++++++++++++ 9 files changed, 2189 insertions(+) create mode 100644 board/nokia/rx51/Makefile create mode 100644 board/nokia/rx51/lowlevel_init.S create mode 100644 board/nokia/rx51/rx51.c create mode 100644 board/nokia/rx51/rx51.h create mode 100644 board/nokia/rx51/tag_omap.h create mode 100644 doc/README.nokia_rx51 create mode 100644 include/configs/nokia_rx51.h
diff --git a/MAINTAINERS b/MAINTAINERS index 971235b..613d8cd 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1009,6 +1009,10 @@ Nobuhiro Iwamatsu nobuhiro.iwamatsu.yj@renesas.com
armadillo-800eva R8A7740 (RMOBILE SoC)
+Pali Rohár pali.rohar@gmail.com
- nokia_rx51 ARM ARMV7 (OMAP3xx SoC)
OMAP3xxx or OMAP34xx
[..]
+relocaddr: /* address of this relocaddr section after coping */
- .word . /* address of section (calculated at compile time) */
+startaddr: /* address of u-boot after copying */
- .word CONFIG_SYS_TEXT_BASE
+kernaddr: /* address of kernel after copying */
- .word KERNEL_ADDRESS
+kernsize: /* maximal size of kernel image */
- .word KERNEL_MAXSIZE
+kernoffs: /* offset of kernel image in loaded u-boot */
- .word KERNEL_OFFSET
+imagesize: /* maximal size of image */
- .word IMAGE_MAXSIZE
+ih_magic: /* IH_MAGIC in big endian from include/image.h */
- .word 0x56190527
+/*
Try using the new kerneldoc style, the tools are now in.
See eg. here about the annotations: http://permalink.gmane.org/gmane.comp.boot-loaders.u-boot/144173
Also see: http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=Do... doc-nano-HOWTO.txt
- Routine: save_boot_params (called after reset from start.S)
- Description: Copy attached kernel to address KERNEL_ADDRESS
Copy u-boot to address CONFIG_SYS_TEXT_BASE
Return to copied u-boot address
- */
+.global save_boot_params +save_boot_params:
[...]
How much of the assembler crap can be made C?
[...]
+static char *boot_reason_ptr; +static char *hw_build_ptr; +static char *nolo_version_ptr; +static char *boot_mode_ptr;
+/*
- Routine: init_omap_tags
- Description: Initialize pointers to values in tag_omap
- */
+static void init_omap_tags(void) +{
- char *component;
- char *version;
- int i = 0;
- while (omap[i].hdr.tag) {
switch (omap[i].hdr.tag) {
case OMAP_TAG_BOOT_REASON:
boot_reason_ptr = omap[i].u.boot_reason.reason_str;
break;
case OMAP_TAG_VERSION_STR:
component = omap[i].u.version.component;
version = omap[i].u.version.version;
if (strcmp(component, "hw-build") == 0)
hw_build_ptr = version;
else if (strcmp(component, "nolo") == 0)
nolo_version_ptr = version;
else if (strcmp(component, "boot-mode") == 0)
boot_mode_ptr = version;
break;
default: missing.
}
++i;
i++;
- }
+}
[...]
- /* append omap atag only if env setup_omap_atag is set to 1 */
- str = getenv("setup_omap_atag");
- if (!str || strcmp(str, "1") != 0)
str[0] == '1' ? But still, you only want to check if it's defined, no?
[...]
+/*
- Routine: twl4030_regulator_set_mode
- Description: Set twl4030 regulator mode over i2c powerbus.
- */
+static void twl4030_regulator_set_mode(u8 id, u8 mode) +{
- u16 msg = MSG_SINGULAR(DEV_GRP_P1, id, mode);
- twl4030_i2c_write_u8(TWL4030_CHIP_PM_MASTER, msg >> 8,
TWL4030_PM_MASTER_PB_WORD_MSB);
- twl4030_i2c_write_u8(TWL4030_CHIP_PM_MASTER, msg & 0xff,
TWL4030_PM_MASTER_PB_WORD_LSB);
Uh, is this somehow special that you can't do longer transfer?
+}
+static void omap3_emu_romcode_call(u32 service_id, u32 *parameters) +{
- u32 i, num_params = *parameters;
- u32 *sram_scratch_space = (u32 *)OMAP3_PUBLIC_SRAM_SCRATCH_AREA;
- /*
* copy the parameters to an un-cached area to avoid coherency
* issues
*/
_WHAT_ ?!
Use dcache_flush(). The Omap3 rom won't cope with cache memory? Actually -- why do you even do call into ROM ?
- for (i = 0; i < num_params; i++) {
__raw_writel(*parameters, sram_scratch_space);
parameters++;
sram_scratch_space++;
- }
- /* Now make the PPA call */
- do_omap3_emu_romcode_call(service_id, OMAP3_PUBLIC_SRAM_SCRATCH_AREA);
+}
[...]
- /* set env variable attkernaddr for relocated kernel */
- sprintf(buf, "%#x", KERNEL_ADDRESS);
- setenv("attkernaddr", buf);
Uhhh ? This definitelly isn't right! What are you trying to achieve here?
- /* initialize omap tags */
- init_omap_tags();
- /* reuse atags from previous bootloader */
- reuse_atags();
- dieid_num_r();
- print_cpuinfo();
- /*
* Cortex-A8(r1p0..r1p2) errata 430973 workaround
* Set IBE bit in Auxiliary Control Register
*/
- omap3_update_aux_cr_secure_rx51(1 << 6, 0);
- return 0;
+}
+/*
- Routine: set_muxconf_regs
- Description: Setting up the configuration Mux registers specific to the
hardware. Many pins need to be moved from protect to primary
mode.
- */
+void set_muxconf_regs(void) +{
- MUX_RX51();
+}
+static unsigned long int twl_wd_time; /* last time of watchdog reset */ +static unsigned long int twl_i2c_lock;
Are you sure you want to use global vars for these? These won't work before reloc!
[..]
+static u8 keys[8]; +static u8 old_keys[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +#define KEYBUF_SIZE 32 +static u8 keybuf[KEYBUF_SIZE]; +static u8 keybuf_head; +static u8 keybuf_tail;
How much of this can be made const ?
+/*
- Routine: rx51_kp_init
- Description: Initialize HW keyboard.
- */
+int rx51_kp_init(void) +{
- int ret = 0;
- u8 ctrl;
- ret = twl4030_i2c_read_u8(TWL4030_CHIP_KEYPAD, &ctrl,
TWL4030_KEYPAD_KEYP_CTRL_REG);
if (ret) return;
... do the rest here without additional indent ...
- if (!ret) {
/* turn on keyboard and use hardware scanning */
ctrl |= TWL4030_KEYPAD_CTRL_KBD_ON;
[...]
+static void rx51_kp_fill(u8 k, u8 mods) +{
This magic needs at least _some_ documentation.
- if (!(mods & 2) && (k == 18 || k == 31 || k == 33 || k == 34)) {
/* cursor keys, without fn */
keybuf[keybuf_tail++] = '\e';
[...]
+int rx51_kp_tstc(void) +{
- u8 c, r, dk, i;
- u8 intr;
- u8 mods;
- /* localy lock twl4030 i2c bus */
- if (test_and_set_bit(0, &twl_i2c_lock))
return 0;
- /* twl4030 remembers up to 2 events */
- for (i = 0; i < 2; i++) {
/* check interrupt register for events */
twl4030_i2c_read_u8(TWL4030_CHIP_KEYPAD, &intr,
TWL4030_KEYPAD_KEYP_ISR1+(2*i));
if (intr&1) { /* got an event */
I will let you think about how to optimize the indent depth here ...
/* read the key state */
i2c_read(TWL4030_CHIP_KEYPAD,
TWL4030_KEYPAD_FULL_CODE_7_0, 1, keys, 8);
/* cut out modifier keys from the keystate */
mods = keys[4] >> 4;
keys[4] &= 0x0f;
for (c = 0; c < 8; c++) {
/* get newly pressed keys only */
dk = ((keys[c] ^ old_keys[c])&keys[c]);
old_keys[c] = keys[c];
/* fill the keybuf */
for (r = 0; r < 8; r++) {
if (dk&1)
[...]
+/*
- Routine: rx51_kp_getc
- Description: Get last pressed key (from buffer).
- */
+int rx51_kp_getc(void) +{
- keybuf_head %= KEYBUF_SIZE;
- while (!rx51_kp_tstc()) {
udelay(1);
hw_watchdog_reset();
WATCHDOG_RESET() and drop the udelay();
- }
- return keybuf[keybuf_head++];
+}
+/*
- Routine: board_mmc_init
- Description: Initialize mmc devices.
- */
+int board_mmc_init(bd_t *bis) +{
- omap_mmc_init(0, 0, 0);
- omap_mmc_init(1, 0, 0);
- return 0;
+}
[...]
+#define tostring(s) #s +#define stringify(s) tostring(s)
We do have __stringify(), use that! [...]

Hi Marek,
On Sun, 14 Oct 2012 02:06:49 +0200, Marek Vasut marex@denx.de wrote:
Dear Pali Rohár,
Based on previous work by: Alistair Buxton a.j.buxton@gmail.com
Signed-off-by: Pali Rohár pali.rohar@gmail.com Cc: Ивайло Димитров freemangordon@abv.bg
Can we please stick to ASCII instead of UTF8?
(cc:ing Wolfgang)
Not to nitpick too much here since for this particular contributor it will not make a difference, but UTF-8 in e-mail addresses is fine to me [1] and is useful for people whose roman-alphabet-based names include diacritics not available in ASCII.
Thus, as far as constraints on e-mail addresses are concerned, I'd rather allow UTF-8 but impose the use of the roman alphabet (if needed, by transliterating) as opposed to e.g. using the cyrillic alphabet, or ideograms, because the common language here is English, so everyone posting here is at least used to roman, but not necessarily to other alphabets or writing systems.
[1] if not always to 'pwclient git-am', but then 'pwclient get' + 'git am' works fine.
Amicalement,

On Sunday 14 October 2012 02:06:49 Marek Vasut wrote:
diff --git a/MAINTAINERS b/MAINTAINERS index 971235b..613d8cd 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1009,6 +1009,10 @@ Nobuhiro Iwamatsu nobuhiro.iwamatsu.yj@renesas.com> armadillo-800eva R8A7740 (RMOBILE SoC)
+Pali Rohár pali.rohar@gmail.com
- nokia_rx51 ARM ARMV7 (OMAP3xx SoC)
OMAP3xxx or OMAP34xx
Ok.
+relocaddr: /* address of this relocaddr section after coping */ + .word . /* address of section (calculated
at
compile time) */ + +startaddr: /* address of u-boot after copying */
- .word CONFIG_SYS_TEXT_BASE
+kernaddr: /* address of kernel after copying */
- .word KERNEL_ADDRESS
+kernsize: /* maximal size of kernel image */
- .word KERNEL_MAXSIZE
+kernoffs: /* offset of kernel image in loaded u-boot
*/
- .word KERNEL_OFFSET
+imagesize: /* maximal size of image */
- .word IMAGE_MAXSIZE
+ih_magic: /* IH_MAGIC in big endian from
include/image.h */
- .word 0x56190527
+/*
Try using the new kerneldoc style, the tools are now in.
See eg. here about the annotations: http://permalink.gmane.org/gmane.comp.boot-loaders.u-boot/14417 3
Also see: http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.gi t;a=blob;f=Documentation/kernel- doc-nano-HOWTO.txt
Ok.
- Routine: save_boot_params (called after reset from
start.S) + * Description: Copy attached kernel to address KERNEL_ADDRESS + * Copy u-boot to address CONFIG_SYS_TEXT_BASE + * Return to copied u-boot address
- */
+.global save_boot_params
+save_boot_params:
[...]
How much of the assembler crap can be made C?
Nothing. This code must be in assembler because stack is not initialized. Also we must be sure that U-Boot will not overwrite attached kernel (with can be in U-Boot malloc/monitor area...)
+static char *boot_reason_ptr; +static char *hw_build_ptr; +static char *nolo_version_ptr; +static char *boot_mode_ptr;
+/*
- Routine: init_omap_tags
- Description: Initialize pointers to values in tag_omap
- */
+static void init_omap_tags(void) +{
- char *component;
- char *version;
- int i = 0;
- while (omap[i].hdr.tag) {
switch (omap[i].hdr.tag) {
case OMAP_TAG_BOOT_REASON:
boot_reason_ptr =
omap[i].u.boot_reason.reason_str;
break;
case OMAP_TAG_VERSION_STR:
component = omap[i].u.version.component;
version = omap[i].u.version.version;
if (strcmp(component, "hw-build") == 0)
hw_build_ptr = version;
else if (strcmp(component, "nolo") == 0)
nolo_version_ptr = version;
else if (strcmp(component, "boot-mode") == 0)
boot_mode_ptr = version;
break;
default: missing.
Is really needed? (if yes, I can add default: break;)
}
++i;
i++;
Reason? ++i and i++ are same (for this situation).
- /* append omap atag only if env setup_omap_atag is set to
1
*/ + str = getenv("setup_omap_atag");
- if (!str || strcmp(str, "1") != 0)
str[0] == '1' ? But still, you only want to check if it's defined, no?
Hm, I'm checking if setup_omap_atag is 1. But is it problem?
+/*
- Routine: twl4030_regulator_set_mode
- Description: Set twl4030 regulator mode over i2c
powerbus.
- */
+static void twl4030_regulator_set_mode(u8 id, u8 mode) +{
- u16 msg = MSG_SINGULAR(DEV_GRP_P1, id, mode);
- twl4030_i2c_write_u8(TWL4030_CHIP_PM_MASTER, msg >> 8,
TWL4030_PM_MASTER_PB_WORD_MSB);
- twl4030_i2c_write_u8(TWL4030_CHIP_PM_MASTER, msg & 0xff,
TWL4030_PM_MASTER_PB_WORD_LSB);
Uh, is this somehow special that you can't do longer transfer?
I do not know how, because registers are different (MSB and LSB).
- /* set env variable attkernaddr for relocated kernel */
- sprintf(buf, "%#x", KERNEL_ADDRESS);
- setenv("attkernaddr", buf);
Uhhh ? This definitelly isn't right! What are you trying to achieve here?
I think it is right. I want to store address of kernel (in hex with leading 0x) to env attkernaddr. And %#x is doing it.
+static unsigned long int twl_wd_time; /* last time of watchdog reset */ +static unsigned long int twl_i2c_lock;
Are you sure you want to use global vars for these? These won't work before reloc!
Why it does not work before reloc? U-Boot is on n900 always started from RAM.
+static u8 keys[8]; +static u8 old_keys[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +#define KEYBUF_SIZE 32 +static u8 keybuf[KEYBUF_SIZE]; +static u8 keybuf_head; +static u8 keybuf_tail;
How much of this can be made const ?
Nothing. All is for keyboard and is changed by keyboard functions (tstc, getc)
This magic needs at least _some_ documentation.
- if (!(mods & 2) && (k == 18 || k == 31 || k == 33 || k ==
34)) { + /* cursor keys, without fn */
keybuf[keybuf_tail++] = '\e';
there is "cursor keys without fn" (fn is "meta" key on n900). So this condition check if some cursor key (without fn) was pressed.
+int rx51_kp_tstc(void) +{
- u8 c, r, dk, i;
- u8 intr;
- u8 mods;
- /* localy lock twl4030 i2c bus */
- if (test_and_set_bit(0, &twl_i2c_lock))
return 0;
- /* twl4030 remembers up to 2 events */
- for (i = 0; i < 2; i++) {
/* check interrupt register for events */
twl4030_i2c_read_u8(TWL4030_CHIP_KEYPAD, &intr,
TWL4030_KEYPAD_KEYP_ISR1+(2*i));
if (intr&1) { /* got an event */
I will let you think about how to optimize the indent depth here ...
Ok, I will optimize indentation. This code (keyboard support) was written by Alistair Buxton and I reused it with minimal changes.
+#define tostring(s) #s +#define stringify(s) tostring(s)
We do have __stringify(), use that!
Ok, in April (when I wrote this part of code) __stringify was not in U-Boot (I checked it).

Dear Pali Rohár,
[...]
Nothing. This code must be in assembler because stack is not initialized. Also we must be sure that U-Boot will not overwrite attached kernel (with can be in U-Boot malloc/monitor area...)
Don't we have something that can reserve a memory area?
+static char *boot_reason_ptr; +static char *hw_build_ptr; +static char *nolo_version_ptr; +static char *boot_mode_ptr;
+/*
- Routine: init_omap_tags
- Description: Initialize pointers to values in tag_omap
- */
+static void init_omap_tags(void) +{
- char *component;
- char *version;
- int i = 0;
- while (omap[i].hdr.tag) {
switch (omap[i].hdr.tag) {
case OMAP_TAG_BOOT_REASON:
boot_reason_ptr =
omap[i].u.boot_reason.reason_str;
break;
case OMAP_TAG_VERSION_STR:
component = omap[i].u.version.component;
version = omap[i].u.version.version;
if (strcmp(component, "hw-build") == 0)
hw_build_ptr = version;
else if (strcmp(component, "nolo") == 0)
nolo_version_ptr = version;
else if (strcmp(component, "boot-mode") == 0)
boot_mode_ptr = version;
break;
default: missing.
Is really needed? (if yes, I can add default: break;)
It's a good practice.
}
++i;
i++;
Reason? ++i and i++ are same (for this situation).
On arm, yes, on intel, no in certain cases. Also, to keep the code consistent, go with postdecrement.
- /* append omap atag only if env setup_omap_atag is set to
1
*/ + str = getenv("setup_omap_atag");
- if (!str || strcmp(str, "1") != 0)
str[0] == '1' ? But still, you only want to check if it's defined, no?
Hm, I'm checking if setup_omap_atag is 1. But is it problem?
Then why not str[0] == '1' ?
+/*
- Routine: twl4030_regulator_set_mode
- Description: Set twl4030 regulator mode over i2c
powerbus.
- */
+static void twl4030_regulator_set_mode(u8 id, u8 mode) +{
- u16 msg = MSG_SINGULAR(DEV_GRP_P1, id, mode);
- twl4030_i2c_write_u8(TWL4030_CHIP_PM_MASTER, msg >> 8,
TWL4030_PM_MASTER_PB_WORD_MSB);
- twl4030_i2c_write_u8(TWL4030_CHIP_PM_MASTER, msg & 0xff,
TWL4030_PM_MASTER_PB_WORD_LSB);
Uh, is this somehow special that you can't do longer transfer?
I do not know how, because registers are different (MSB and LSB).
Investigate ;-)
- /* set env variable attkernaddr for relocated kernel */
- sprintf(buf, "%#x", KERNEL_ADDRESS);
- setenv("attkernaddr", buf);
Uhhh ? This definitelly isn't right! What are you trying to achieve here?
I think it is right. I want to store address of kernel (in hex with leading 0x) to env attkernaddr. And %#x is doing it.
Ah, now that you mentioned that you don't want kernel to be rewritten, I see the point of this variable.
+static unsigned long int twl_wd_time; /* last time of watchdog reset */ +static unsigned long int twl_i2c_lock;
Are you sure you want to use global vars for these? These won't work before reloc!
Why it does not work before reloc? U-Boot is on n900 always started from RAM.
The BSS isn't cleared though.
+static u8 keys[8]; +static u8 old_keys[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +#define KEYBUF_SIZE 32 +static u8 keybuf[KEYBUF_SIZE]; +static u8 keybuf_head; +static u8 keybuf_tail;
How much of this can be made const ?
Nothing. All is for keyboard and is changed by keyboard functions (tstc, getc)
This magic needs at least _some_ documentation.
- if (!(mods & 2) && (k == 18 || k == 31 || k == 33 || k ==
34)) { + /* cursor keys, without fn */
keybuf[keybuf_tail++] = '\e';
there is "cursor keys without fn" (fn is "meta" key on n900). So this condition check if some cursor key (without fn) was pressed.
Good, document it.
+int rx51_kp_tstc(void) +{
- u8 c, r, dk, i;
- u8 intr;
- u8 mods;
- /* localy lock twl4030 i2c bus */
- if (test_and_set_bit(0, &twl_i2c_lock))
return 0;
- /* twl4030 remembers up to 2 events */
- for (i = 0; i < 2; i++) {
/* check interrupt register for events */
twl4030_i2c_read_u8(TWL4030_CHIP_KEYPAD, &intr,
TWL4030_KEYPAD_KEYP_ISR1+(2*i));
if (intr&1) { /* got an event */
I will let you think about how to optimize the indent depth here ...
Ok, I will optimize indentation. This code (keyboard support) was written by Alistair Buxton and I reused it with minimal changes.
That doesn't justify it ;-)
+#define tostring(s) #s +#define stringify(s) tostring(s)
We do have __stringify(), use that!
Ok, in April (when I wrote this part of code) __stringify was not in U-Boot (I checked it).
Yep, time changed.
Best regards, Marek Vasut

On Tuesday 16 October 2012 16:55:20 Marek Vasut wrote:
Dear Pali Rohár,
[...]
Nothing. This code must be in assembler because stack is not initialized. Also we must be sure that U-Boot will not overwrite attached kernel (with can be in U-Boot malloc/monitor area...)
Don't we have something that can reserve a memory area?
I'm using CONFIG_PRAM and KERNEL_ADDRESS is calculated from protected ram. But previous bootloader (NOLO) loading u-boot (+ attached kernel) at random address, so it can be in u-boot malloc area. That assembler code is called after reset and copy attached kernel to protected ram (so U-Boot will not touch it) and U-Boot to correct address.
}
++i;
i++;
Reason? ++i and i++ are same (for this situation).
On arm, yes, on intel, no in certain cases. Also, to keep the code consistent, go with postdecrement.
What is different on intel (without assigning value of i)?
- /* append omap atag only if env setup_omap_atag is set
to
1
*/ + str = getenv("setup_omap_atag");
- if (!str || strcmp(str, "1") != 0)
str[0] == '1' ? But still, you only want to check if it's defined, no?
Hm, I'm checking if setup_omap_atag is 1. But is it problem?
Then why not str[0] == '1' ?
Ok.
+/*
- Routine: twl4030_regulator_set_mode
- Description: Set twl4030 regulator mode over i2c
powerbus.
- */
+static void twl4030_regulator_set_mode(u8 id, u8 mode) +{
- u16 msg = MSG_SINGULAR(DEV_GRP_P1, id, mode);
- twl4030_i2c_write_u8(TWL4030_CHIP_PM_MASTER, msg >> 8,
TWL4030_PM_MASTER_PB_WORD_MSB);
- twl4030_i2c_write_u8(TWL4030_CHIP_PM_MASTER, msg &
0xff,
TWL4030_PM_MASTER_PB_WORD_LSB);
Uh, is this somehow special that you can't do longer transfer?
I do not know how, because registers are different (MSB and LSB).
Investigate ;-)
I think it is not possible. Registers are in bad order. (So on some high endian system it could be possible)
Also in linux twl regulator driver is used two calls see: https://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=blob;f=drive... regulator.c;hb=HEAD#l327
+static unsigned long int twl_wd_time; /* last time of watchdog reset */ +static unsigned long int twl_i2c_lock;
Are you sure you want to use global vars for these? These won't work before reloc!
Why it does not work before reloc? U-Boot is on n900 always started from RAM.
The BSS isn't cleared though.
So how to fix it? I need to share these vars in more functions.
+static u8 keys[8]; +static u8 old_keys[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +#define KEYBUF_SIZE 32 +static u8 keybuf[KEYBUF_SIZE]; +static u8 keybuf_head; +static u8 keybuf_tail;
How much of this can be made const ?
Nothing. All is for keyboard and is changed by keyboard functions (tstc, getc)
This magic needs at least _some_ documentation.
- if (!(mods & 2) && (k == 18 || k == 31 || k == 33 || k
== 34)) { + /* cursor keys, without fn */
keybuf[keybuf_tail++] = '\e';
there is "cursor keys without fn" (fn is "meta" key on n900). So this condition check if some cursor key (without fn) was pressed.
Good, document it.
Ok.

Dear Pali Rohár,
[...]
Reason? ++i and i++ are same (for this situation).
On arm, yes, on intel, no in certain cases. Also, to keep the code consistent, go with postdecrement.
What is different on intel (without assigning value of i)?
IIRC the prefetch behaves differently. Ccing Graeme, but this might be a question to the GCC guys.
- /* append omap atag only if env setup_omap_atag is set
to
1
*/ + str = getenv("setup_omap_atag");
- if (!str || strcmp(str, "1") != 0)
str[0] == '1' ? But still, you only want to check if it's defined, no?
Hm, I'm checking if setup_omap_atag is 1. But is it problem?
Then why not str[0] == '1' ?
Ok.
+/*
- Routine: twl4030_regulator_set_mode
- Description: Set twl4030 regulator mode over i2c
powerbus.
- */
+static void twl4030_regulator_set_mode(u8 id, u8 mode) +{
- u16 msg = MSG_SINGULAR(DEV_GRP_P1, id, mode);
- twl4030_i2c_write_u8(TWL4030_CHIP_PM_MASTER, msg >> 8,
TWL4030_PM_MASTER_PB_WORD_MSB);
- twl4030_i2c_write_u8(TWL4030_CHIP_PM_MASTER, msg &
0xff,
TWL4030_PM_MASTER_PB_WORD_LSB);
Uh, is this somehow special that you can't do longer transfer?
I do not know how, because registers are different (MSB and LSB).
Investigate ;-)
I think it is not possible. Registers are in bad order. (So on some high endian system it could be possible)
High endian :-)
Also in linux twl regulator driver is used two calls see: https://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=blob;f=driv ers/regulator/twl- regulator.c;hb=HEAD#l327
ok
+static unsigned long int twl_wd_time; /* last time of watchdog reset */ +static unsigned long int twl_i2c_lock;
Are you sure you want to use global vars for these? These won't work before reloc!
Why it does not work before reloc? U-Boot is on n900 always started from RAM.
The BSS isn't cleared though.
So how to fix it? I need to share these vars in more functions.
Make a struct and pass it around? Or if it's used only _after_ relocation, these will work.
+static u8 keys[8]; +static u8 old_keys[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +#define KEYBUF_SIZE 32 +static u8 keybuf[KEYBUF_SIZE]; +static u8 keybuf_head; +static u8 keybuf_tail;
How much of this can be made const ?
Nothing. All is for keyboard and is changed by keyboard functions (tstc, getc)
This magic needs at least _some_ documentation.
- if (!(mods & 2) && (k == 18 || k == 31 || k == 33 || k
== 34)) { + /* cursor keys, without fn */
keybuf[keybuf_tail++] = '\e';
there is "cursor keys without fn" (fn is "meta" key on n900). So this condition check if some cursor key (without fn) was pressed.
Good, document it.
Ok.

On Tuesday 16 October 2012 17:57:09 Marek Vasut wrote:
+static unsigned long int twl_wd_time; /* last time of watchdog reset */ +static unsigned long int twl_i2c_lock;
Are you sure you want to use global vars for these? These won't work before reloc!
Why it does not work before reloc? U-Boot is on n900 always started from RAM.
The BSS isn't cleared though.
So how to fix it? I need to share these vars in more functions.
Make a struct and pass it around? Or if it's used only _after_ relocation, these will work.
It is used for keyboard input (tstc, getc) and watchdog reset. All functions are global for uboot, so parameters are fixed. Keyboard input is initialized in console_init_r.
I tested U-Boot on real N900 and in qemu N900 and both watchdog kicking & keyboard input worked without problem.

This patch series add support for new board Nokia RX-51 (aka N900). This patch series supersedes version v3.
Pali Rohár (5): arm bootm: Allow to pass board specified atags arm bootm: Do not append zero ATAG_MEM Add power bus message definitions in twl4030.h cfb_console: Add support for some ANSI terminal escape codes New board support: Nokia RX-51 aka N900
MAINTAINERS | 4 + README | 3 + arch/arm/include/asm/setup.h | 5 + arch/arm/lib/bootm.c | 7 + board/nokia/rx51/Makefile | 46 +++ board/nokia/rx51/lowlevel_init.S | 209 ++++++++++++ board/nokia/rx51/rx51.c | 679 ++++++++++++++++++++++++++++++++++++++ board/nokia/rx51/rx51.h | 389 ++++++++++++++++++++++ board/nokia/rx51/tag_omap.h | 311 +++++++++++++++++ boards.cfg | 1 + doc/README.nokia_rx51 | 104 ++++++ drivers/video/cfb_console.c | 313 +++++++++++++++++- include/configs/nokia_rx51.h | 450 +++++++++++++++++++++++++ include/twl4030.h | 98 ++++++ 14 files changed, 2610 insertions(+), 9 deletions(-) create mode 100644 board/nokia/rx51/Makefile create mode 100644 board/nokia/rx51/lowlevel_init.S create mode 100644 board/nokia/rx51/rx51.c create mode 100644 board/nokia/rx51/rx51.h create mode 100644 board/nokia/rx51/tag_omap.h create mode 100644 doc/README.nokia_rx51 create mode 100644 include/configs/nokia_rx51.h

Board can implement function setup_board_tags which is used for adding atags
Signed-off-by: Pali Rohár pali.rohar@gmail.com --- Changes in v4: - Added commit message - Use __weak instead gcc attribute
arch/arm/include/asm/setup.h | 5 +++++ arch/arm/lib/bootm.c | 4 ++++ 2 files changed, 9 insertions(+)
diff --git a/arch/arm/include/asm/setup.h b/arch/arm/include/asm/setup.h index 89df4dc..78a7fac 100644 --- a/arch/arm/include/asm/setup.h +++ b/arch/arm/include/asm/setup.h @@ -267,3 +267,8 @@ struct meminfo { extern struct meminfo meminfo;
#endif + +/* + * Board specified tags + */ +void setup_board_tags(struct tag **in_params); diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c index a9070d5..9323db0 100644 --- a/arch/arm/lib/bootm.c +++ b/arch/arm/lib/bootm.c @@ -34,6 +34,7 @@ #include <libfdt.h> #include <fdt_support.h> #include <asm/bootm.h> +#include <linux/compiler.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -266,6 +267,8 @@ static int create_fdt(bootm_headers_t *images) } #endif
+__weak void setup_board_tags(struct tag **in_params) {} + /* Subcommand: PREP */ static void boot_prep_linux(bootm_headers_t *images) { @@ -307,6 +310,7 @@ static void boot_prep_linux(bootm_headers_t *images) setup_initrd_tag(gd->bd, images->rd_start, images->rd_end); #endif + setup_board_tags(¶ms); setup_end_tag(gd->bd); #else /* all tags */ printf("FDT and ATAGS support not compiled in - hanging\n");

If dram bank size is calculated at runtime, it can be zero on some boards. This patch added code which ignore these zero bank size in ATAG_MEM.
Signed-off-by: Pali Rohár pali.rohar@gmail.com --- Changes in v4: - No changes
arch/arm/lib/bootm.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c index 9323db0..d5811e0 100644 --- a/arch/arm/lib/bootm.c +++ b/arch/arm/lib/bootm.c @@ -133,6 +133,9 @@ static void setup_memory_tags(bd_t *bd) int i;
for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) { + if (bd->bi_dram[i].size == 0) + continue; + params->hdr.tag = ATAG_MEM; params->hdr.size = tag_size (tag_mem32);

Dear Pali Rohár,
If dram bank size is calculated at runtime, it can be zero on some boards. This patch added code which ignore these zero bank size in ATAG_MEM.
Signed-off-by: Pali Rohár pali.rohar@gmail.com
Changes in v4:
- No changes
Did we not discuss this patch?
arch/arm/lib/bootm.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c index 9323db0..d5811e0 100644 --- a/arch/arm/lib/bootm.c +++ b/arch/arm/lib/bootm.c @@ -133,6 +133,9 @@ static void setup_memory_tags(bd_t *bd) int i;
for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
if (bd->bi_dram[i].size == 0)
continue;
- params->hdr.tag = ATAG_MEM; params->hdr.size = tag_size (tag_mem32);
Best regards, Marek Vasut

On Saturday 20 October 2012 11:34:20 Marek Vasut wrote:
Dear Pali Rohár,
If dram bank size is calculated at runtime, it can be zero on some boards. This patch added code which ignore these zero bank size in ATAG_MEM.
Signed-off-by: Pali Rohár pali.rohar@gmail.com
Changes in v4:
- No changes
Did we not discuss this patch?
Yes, but there was no change, see: http://www.mail-archive.com/u-boot@lists.denx.de/msg96706.html

On Sat, Oct 20, 2012 at 11:41:51AM +0200, Pali Roh?r wrote:
On Saturday 20 October 2012 11:34:20 Marek Vasut wrote:
Dear Pali Roh??r,
If dram bank size is calculated at runtime, it can be zero on some boards. This patch added code which ignore these zero bank size in ATAG_MEM.
Signed-off-by: Pali Roh??r pali.rohar@gmail.com
Changes in v4:
- No changes
Did we not discuss this patch?
Yes, but there was no change, see: http://www.mail-archive.com/u-boot@lists.denx.de/msg96706.html
I'm sorry if I wasn't clear then. This change should not be needed as N900 should simply always say 1 bank and the correct total memory size of all populated memory banks. Is the problem that in the ATAGs we're re-using we have a zero-size memory ATAG?

On Fri, Oct 19, 2012 at 02:00:05PM +0200, Pali Roh??r wrote:
If dram bank size is calculated at runtime, it can be zero on some boards. This patch added code which ignore these zero bank size in ATAG_MEM.
Signed-off-by: Pali Roh??r pali.rohar@gmail.com
My reading of the kernel's arm_add_memory says that empty ATAG_MEM tags are handled correctly (which is to say, parsed and found as -EINVAL). So if we _have_to_ we can add this change.

Dear Tom Rini,
On Fri, Oct 19, 2012 at 02:00:05PM +0200, Pali Roh??r wrote:
If dram bank size is calculated at runtime, it can be zero on some boards. This patch added code which ignore these zero bank size in ATAG_MEM.
Signed-off-by: Pali Roh??r pali.rohar@gmail.com
My reading of the kernel's arm_add_memory says that empty ATAG_MEM tags are handled correctly (which is to say, parsed and found as -EINVAL). So if we _have_to_ we can add this change.
I don't think we _have_to_ ...
Best regards, Marek Vasut

On Sat, Oct 27, 2012 at 05:29:32PM +0200, Marek Vasut wrote:
Dear Tom Rini,
On Fri, Oct 19, 2012 at 02:00:05PM +0200, Pali Roh??r wrote:
If dram bank size is calculated at runtime, it can be zero on some boards. This patch added code which ignore these zero bank size in ATAG_MEM.
Signed-off-by: Pali Roh??r pali.rohar@gmail.com
My reading of the kernel's arm_add_memory says that empty ATAG_MEM tags are handled correctly (which is to say, parsed and found as -EINVAL). So if we _have_to_ we can add this change.
I don't think we _have_to_ ...
Indeed. After talking with Pali on irc some more and checking things again, we can simply drop this patch. Other platforms pass 0 size ATAG_MEM to the kernel and have for ages, so it's handled.

* Code copied from linux kernel 3.0.0 from file include/linux/i2c/twl.h * commit 6523b148b44be38d89c2ee9865d34da30d9f5f1c
Signed-off-by: Pali Rohár pali.rohar@gmail.com --- Changes in v4: - Added commit id to commit message
include/twl4030.h | 98 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+)
diff --git a/include/twl4030.h b/include/twl4030.h index 9cd32ab..0c17f59 100644 --- a/include/twl4030.h +++ b/include/twl4030.h @@ -151,6 +151,103 @@ #define TWL4030_PM_MASTER_SW_EVENTS_DEVSLP (1 << 1) #define TWL4030_PM_MASTER_SW_EVENTS_DEVOFF (1 << 0)
+/* Power bus message definitions */ + +/* The TWL4030/5030 splits its power-management resources (the various + * regulators, clock and reset lines) into 3 processor groups - P1, P2 and + * P3. These groups can then be configured to transition between sleep, wait-on + * and active states by sending messages to the power bus. See Section 5.4.2 + * Power Resources of TWL4030 TRM + */ + +/* Processor groups */ +#define DEV_GRP_NULL 0x0 +#define DEV_GRP_P1 0x1 /* P1: all OMAP devices */ +#define DEV_GRP_P2 0x2 /* P2: all Modem devices */ +#define DEV_GRP_P3 0x4 /* P3: all peripheral devices */ + +/* Resource groups */ +#define RES_GRP_RES 0x0 /* Reserved */ +#define RES_GRP_PP 0x1 /* Power providers */ +#define RES_GRP_RC 0x2 /* Reset and control */ +#define RES_GRP_PP_RC 0x3 +#define RES_GRP_PR 0x4 /* Power references */ +#define RES_GRP_PP_PR 0x5 +#define RES_GRP_RC_PR 0x6 +#define RES_GRP_ALL 0x7 /* All resource groups */ + +#define RES_TYPE2_R0 0x0 + +#define RES_TYPE_ALL 0x7 + +/* Resource states */ +#define RES_STATE_WRST 0xF +#define RES_STATE_ACTIVE 0xE +#define RES_STATE_SLEEP 0x8 +#define RES_STATE_OFF 0x0 + +/* Power resources */ + +/* Power providers */ +#define RES_VAUX1 1 +#define RES_VAUX2 2 +#define RES_VAUX3 3 +#define RES_VAUX4 4 +#define RES_VMMC1 5 +#define RES_VMMC2 6 +#define RES_VPLL1 7 +#define RES_VPLL2 8 +#define RES_VSIM 9 +#define RES_VDAC 10 +#define RES_VINTANA1 11 +#define RES_VINTANA2 12 +#define RES_VINTDIG 13 +#define RES_VIO 14 +#define RES_VDD1 15 +#define RES_VDD2 16 +#define RES_VUSB_1V5 17 +#define RES_VUSB_1V8 18 +#define RES_VUSB_3V1 19 +#define RES_VUSBCP 20 +#define RES_REGEN 21 +/* Reset and control */ +#define RES_NRES_PWRON 22 +#define RES_CLKEN 23 +#define RES_SYSEN 24 +#define RES_HFCLKOUT 25 +#define RES_32KCLKOUT 26 +#define RES_RESET 27 +/* Power Reference */ +#define RES_Main_Ref 28 + +#define TOTAL_RESOURCES 28 +/* + * Power Bus Message Format ... these can be sent individually by Linux, + * but are usually part of downloaded scripts that are run when various + * power events are triggered. + * + * Broadcast Message (16 Bits): + * DEV_GRP[15:13] MT[12] RES_GRP[11:9] RES_TYPE2[8:7] RES_TYPE[6:4] + * RES_STATE[3:0] + * + * Singular Message (16 Bits): + * DEV_GRP[15:13] MT[12] RES_ID[11:4] RES_STATE[3:0] + */ + +#define MSG_BROADCAST(devgrp, grp, type, type2, state) \ + ((devgrp) << 13 | 1 << 12 | (grp) << 9 | (type2) << 7 \ + | (type) << 4 | (state)) + +#define MSG_SINGULAR(devgrp, id, state) \ + ((devgrp) << 13 | 0 << 12 | (id) << 4 | (state)) + +#define MSG_BROADCAST_ALL(devgrp, state) \ + ((devgrp) << 5 | (state)) + +#define MSG_BROADCAST_REF MSG_BROADCAST_ALL +#define MSG_BROADCAST_PROV MSG_BROADCAST_ALL +#define MSG_BROADCAST__CLK_RST MSG_BROADCAST_ALL + /* Power Managment Receiver */ #define TWL4030_PM_RECEIVER_SC_CONFIG 0x5B #define TWL4030_PM_RECEIVER_SC_DETECT1 0x5C @@ -311,6 +408,7 @@ #define TWL4030_PM_RECEIVER_VDAC_VSEL_18 0x03 #define TWL4030_PM_RECEIVER_VMMC1_VSEL_30 0x02 #define TWL4030_PM_RECEIVER_VMMC1_VSEL_32 0x03 +#define TWL4030_PM_RECEIVER_VSIM_VSEL_18 0x03
/* Device Selection in PM Receiver Module */ #define TWL4030_PM_RECEIVER_DEV_GRP_P1 0x20

* This patch add support for move cursor, reverse colors and clear console via ANSI espace codes in cfb_console driver * ANSI escape codes can be enabled/disabled via CONFIG_CFB_CONSOLE_ANSI
Signed-off-by: Pali Rohár pali.rohar@gmail.com --- Changes in v4: - No changes
Changes in v3: - Fixed multiline comments
Changes in v2: - Added support ANSI code show/hide cursor - Added info to README
Changes since original version: - Fixed commit message
README | 3 + drivers/video/cfb_console.c | 313 +++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 307 insertions(+), 9 deletions(-)
diff --git a/README b/README index 9804cea..d45a91d 100644 --- a/README +++ b/README @@ -655,6 +655,9 @@ The following options need to be configured: additional board info beside the logo
+ When CONFIG_CFB_CONSOLE_ANSI is defined, console will have + ANSI terminal support. Needed for CONFIG_CMDLINE_EDITING. + When CONFIG_CFB_CONSOLE is defined, video console is default i/o. Serial console can be forced with environment 'console=serial'. diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c index 9f7794f..3ed96d3 100644 --- a/drivers/video/cfb_console.c +++ b/drivers/video/cfb_console.c @@ -385,6 +385,11 @@ static u32 eorx, fgx, bgx; /* color pats */
static int cfb_do_flush_cache;
+static char ansi_buf[10] = { 0, }; +static int ansi_buf_size; +static int ansi_colors_need_revert; +static int ansi_cursor_hidden; + static const int video_font_draw_table8[] = { 0x00000000, 0x000000ff, 0x0000ff00, 0x0000ffff, 0x00ff0000, 0x00ff00ff, 0x00ffff00, 0x00ffffff, @@ -612,6 +617,14 @@ static void video_putchar(int xx, int yy, unsigned char c) video_drawchars(xx, yy + video_logo_height, &c, 1); }
+static void console_swap_colors(void) +{ + eorx = fgx; + fgx = bgx; + bgx = eorx; + eorx = fgx ^ bgx; +} + #if defined(CONFIG_CONSOLE_CURSOR) || defined(CONFIG_VIDEO_SW_CURSOR) static void video_set_cursor(void) { @@ -695,6 +708,21 @@ static void memcpyl(int *d, int *s, int c) } #endif
+static void console_clear(void) +{ +#ifdef VIDEO_HW_RECTFILL + video_hw_rectfill(VIDEO_PIXEL_SIZE, /* bytes per pixel */ + 0, /* dest pos x */ + video_logo_height, /* dest pos y */ + VIDEO_VISIBLE_COLS, /* frame width */ + VIDEO_VISIBLE_ROWS, /* frame height */ + bgx /* fill color */ + ); +#else + memsetl(CONSOLE_ROW_FIRST, CONSOLE_SIZE, bgx); +#endif +} + static void console_clear_line(int line, int begin, int end) { #ifdef VIDEO_HW_RECTFILL @@ -768,9 +796,54 @@ static void console_back(void) } }
-static void console_newline(void) +static void console_cursor_fix(void) +{ + if (console_row < 0) + console_row = 0; + if (console_row >= CONSOLE_ROWS) + console_row = CONSOLE_ROWS-1; + if (console_col < 0) + console_col = 0; + if (console_col >= CONSOLE_COLS) + console_col = CONSOLE_COLS-1; +} + +static void console_cursor_up(int n) +{ + console_row -= n; + console_cursor_fix(); +} + +static void console_cursor_down(int n) +{ + console_row += n; + console_cursor_fix(); +} + +static void console_cursor_left(int n) +{ + console_col -= n; + console_cursor_fix(); +} + +static void console_cursor_right(int n) +{ + console_col += n; + console_cursor_fix(); +} + +static void console_cursor_set_position(int row, int col) +{ + if (console_row != -1) + console_row = row; + if (console_col != -1) + console_col = col; + console_cursor_fix(); +} + +static void console_newline(int n) { - console_row++; + console_row += n; console_col = 0;
/* Check if we need to scroll the terminal */ @@ -779,20 +852,28 @@ static void console_newline(void) console_scrollup();
/* Decrement row number */ - console_row--; + console_row = CONSOLE_ROWS-1; } }
+static void console_previewsline(int n) +{ + /* FIXME: also scroll terminal ? */ + console_row -= n; + console_cursor_fix(); +} + static void console_cr(void) { console_col = 0; }
-void video_putc(const char c) +static void parse_putc(const char c) { static int nl = 1;
- CURSOR_OFF; + if (!ansi_cursor_hidden) + CURSOR_OFF;
switch (c) { case 13: /* back to first column */ @@ -801,7 +882,7 @@ void video_putc(const char c)
case '\n': /* next line */ if (console_col || (!console_col && nl)) - console_newline(); + console_newline(1); nl = 1; break;
@@ -810,7 +891,7 @@ void video_putc(const char c) console_col &= ~0x0007;
if (console_col >= CONSOLE_COLS) - console_newline(); + console_newline(1); break;
case 8: /* backspace */ @@ -827,11 +908,225 @@ void video_putc(const char c)
/* check for newline */ if (console_col >= CONSOLE_COLS) { - console_newline(); + console_newline(1); nl = 0; } } - CURSOR_SET; + + if (!ansi_cursor_hidden) + CURSOR_SET; +} + +void video_putc(const char c) +{ +#ifdef CONFIG_CFB_CONSOLE_ANSI + int i; + + if (c == 27) { + for (i = 0; i < ansi_buf_size; ++i) + parse_putc(ansi_buf[i]); + ansi_buf[0] = 27; + ansi_buf_size = 1; + return; + } + + if (ansi_buf_size > 0) { + /* + * 0 - ESC + * 1 - [ + * 2 - num1 + * 3 - .. + * 4 - ; + * 5 - num2 + * 6 - .. + * - cchar + */ + int next = 0; + + int flush = 0; + int fail = 0; + + int num1 = 0; + int num2 = 0; + int cchar = 0; + + ansi_buf[ansi_buf_size++] = c; + + if (ansi_buf_size >= sizeof(ansi_buf)) + fail = 1; + + for (i = 0; i < ansi_buf_size; ++i) { + if (fail) + break; + + switch (next) { + case 0: + if (ansi_buf[i] == 27) + next = 1; + else + fail = 1; + break; + + case 1: + if (ansi_buf[i] == '[') + next = 2; + else + fail = 1; + break; + + case 2: + if (ansi_buf[i] >= '0' && ansi_buf[i] <= '9') { + num1 = ansi_buf[i]-'0'; + next = 3; + } else if (ansi_buf[i] != '?') { + --i; + num1 = 1; + next = 4; + } + break; + + case 3: + if (ansi_buf[i] >= '0' && ansi_buf[i] <= '9') { + num1 *= 10; + num1 += ansi_buf[i]-'0'; + } else { + --i; + next = 4; + } + break; + + case 4: + if (ansi_buf[i] != ';') { + --i; + next = 7; + } else + next = 5; + break; + + case 5: + if (ansi_buf[i] >= '0' && ansi_buf[i] <= '9') { + num2 = ansi_buf[i]-'0'; + next = 6; + } else + fail = 1; + break; + + case 6: + if (ansi_buf[i] >= '0' && ansi_buf[i] <= '9') { + num2 *= 10; + num2 += ansi_buf[i]-'0'; + } else { + --i; + next = 7; + } + break; + + case 7: + if ((ansi_buf[i] >= 'A' && ansi_buf[i] <= 'H') + || ansi_buf[i] == 'J' + || ansi_buf[i] == 'K' + || ansi_buf[i] == 'h' + || ansi_buf[i] == 'l' + || ansi_buf[i] == 'm') { + cchar = ansi_buf[i]; + flush = 1; + } else + fail = 1; + break; + } + } + + if (fail) { + for (i = 0; i < ansi_buf_size; ++i) + parse_putc(ansi_buf[i]); + ansi_buf_size = 0; + return; + } + + if (flush) { + if (!ansi_cursor_hidden) + CURSOR_OFF; + ansi_buf_size = 0; + switch (cchar) { + case 'A': + /* move cursor num1 rows up */ + console_cursor_up(num1); + break; + case 'B': + /* move cursor num1 rows down */ + console_cursor_down(num1); + break; + case 'C': + /* move cursor num1 columns forward */ + console_cursor_right(num1); + break; + case 'D': + /* move cursor num1 columns back */ + console_cursor_left(num1); + break; + case 'E': + /* move cursor num1 rows up at begin of row */ + console_previewsline(num1); + break; + case 'F': + /* move cursor num1 rows down at begin of row */ + console_newline(num1); + break; + case 'G': + /* move cursor to column num1 */ + console_cursor_set_position(-1, num1-1); + break; + case 'H': + /* move cursor to row num1, column num2 */ + console_cursor_set_position(num1-1, num2-1); + break; + case 'J': + /* clear console and move cursor to 0, 0 */ + console_clear(); + console_cursor_set_position(0, 0); + break; + case 'K': + /* clear line */ + if (num1 == 0) + console_clear_line(console_row, + console_col, + CONSOLE_COLS-1); + else if (num1 == 1) + console_clear_line(console_row, + 0, console_col); + else + console_clear_line(console_row, + 0, CONSOLE_COLS-1); + break; + case 'h': + ansi_cursor_hidden = 0; + break; + case 'l': + ansi_cursor_hidden = 1; + break; + case 'm': + if (num1 == 0) { /* reset swapped colors */ + if (ansi_colors_need_revert) { + console_swap_colors(); + ansi_colors_need_revert = 0; + } + } else if (num1 == 7) { /* once swap colors */ + if (!ansi_colors_need_revert) { + console_swap_colors(); + ansi_colors_need_revert = 1; + } + } + break; + } + if (!ansi_cursor_hidden) + CURSOR_SET; + } + } else { + parse_putc(c); + } +#else + parse_putc(c); +#endif }
void video_puts(const char *s)

From: Pali Rohár pali.rohar@gmail.com
Add optional support for some ANSI escape sequences to the cfb_console driver. Define CONFIG_CFB_CONSOLE_ANSI to enable cursor moving, color reverting and clearing the cfb console via ANSI escape codes.
Signed-off-by: Pali Rohár pali.rohar@gmail.com Signed-off-by: Anatolij Gustschin agust@denx.de --- Changes in v5: - do not init global ansi_buf[] - cleanup build warnings shown when compiling without CONFIG_CFB_CONSOLE_ANSI - reorder some functions and put them under ANSI support ifdef - revise commit log and description in README - fix typos and some minor style issues
README | 4 + drivers/video/cfb_console.c | 328 +++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 323 insertions(+), 9 deletions(-)
diff --git a/README b/README index df4aed1..61e2e1f 100644 --- a/README +++ b/README @@ -655,6 +655,10 @@ The following options need to be configured: additional board info beside the logo
+ When CONFIG_CFB_CONSOLE_ANSI is defined, console will support + a limited number of ANSI escape sequences (cursor control, + erase functions and limited graphics rendition control). + When CONFIG_CFB_CONSOLE is defined, video console is default i/o. Serial console can be forced with environment 'console=serial'. diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c index 9f7794f..9c67b63 100644 --- a/drivers/video/cfb_console.c +++ b/drivers/video/cfb_console.c @@ -385,6 +385,13 @@ static u32 eorx, fgx, bgx; /* color pats */
static int cfb_do_flush_cache;
+#ifdef CONFIG_CFB_CONSOLE_ANSI +static char ansi_buf[10]; +static int ansi_buf_size; +static int ansi_colors_need_revert; +static int ansi_cursor_hidden; +#endif + static const int video_font_draw_table8[] = { 0x00000000, 0x000000ff, 0x0000ff00, 0x0000ffff, 0x00ff0000, 0x00ff00ff, 0x00ffff00, 0x00ffffff, @@ -768,9 +775,97 @@ static void console_back(void) } }
-static void console_newline(void) +#ifdef CONFIG_CFB_CONSOLE_ANSI + +static void console_clear(void) +{ +#ifdef VIDEO_HW_RECTFILL + video_hw_rectfill(VIDEO_PIXEL_SIZE, /* bytes per pixel */ + 0, /* dest pos x */ + video_logo_height, /* dest pos y */ + VIDEO_VISIBLE_COLS, /* frame width */ + VIDEO_VISIBLE_ROWS, /* frame height */ + bgx /* fill color */ + ); +#else + memsetl(CONSOLE_ROW_FIRST, CONSOLE_SIZE, bgx); +#endif +} + +static void console_cursor_fix(void) +{ + if (console_row < 0) + console_row = 0; + if (console_row >= CONSOLE_ROWS) + console_row = CONSOLE_ROWS - 1; + if (console_col < 0) + console_col = 0; + if (console_col >= CONSOLE_COLS) + console_col = CONSOLE_COLS - 1; +} + +static void console_cursor_up(int n) +{ + console_row -= n; + console_cursor_fix(); +} + +static void console_cursor_down(int n) +{ + console_row += n; + console_cursor_fix(); +} + +static void console_cursor_left(int n) +{ + console_col -= n; + console_cursor_fix(); +} + +static void console_cursor_right(int n) +{ + console_col += n; + console_cursor_fix(); +} + +static void console_cursor_set_position(int row, int col) +{ + if (console_row != -1) + console_row = row; + if (console_col != -1) + console_col = col; + console_cursor_fix(); +} + +static void console_previousline(int n) { - console_row++; + /* FIXME: also scroll terminal ? */ + console_row -= n; + console_cursor_fix(); +} + +static void console_swap_colors(void) +{ + eorx = fgx; + fgx = bgx; + bgx = eorx; + eorx = fgx ^ bgx; +} + +static inline int console_cursor_is_visible(void) +{ + return !ansi_cursor_hidden; +} +#else +static inline int console_cursor_is_visible(void) +{ + return 1; +} +#endif + +static void console_newline(int n) +{ + console_row += n; console_col = 0;
/* Check if we need to scroll the terminal */ @@ -779,7 +874,7 @@ static void console_newline(void) console_scrollup();
/* Decrement row number */ - console_row--; + console_row = CONSOLE_ROWS - 1; } }
@@ -788,11 +883,12 @@ static void console_cr(void) console_col = 0; }
-void video_putc(const char c) +static void parse_putc(const char c) { static int nl = 1;
- CURSOR_OFF; + if (console_cursor_is_visible()) + CURSOR_OFF;
switch (c) { case 13: /* back to first column */ @@ -801,7 +897,7 @@ void video_putc(const char c)
case '\n': /* next line */ if (console_col || (!console_col && nl)) - console_newline(); + console_newline(1); nl = 1; break;
@@ -810,7 +906,7 @@ void video_putc(const char c) console_col &= ~0x0007;
if (console_col >= CONSOLE_COLS) - console_newline(); + console_newline(1); break;
case 8: /* backspace */ @@ -827,11 +923,225 @@ void video_putc(const char c)
/* check for newline */ if (console_col >= CONSOLE_COLS) { - console_newline(); + console_newline(1); nl = 0; } } - CURSOR_SET; + + if (console_cursor_is_visible()) + CURSOR_SET; +} + +void video_putc(const char c) +{ +#ifdef CONFIG_CFB_CONSOLE_ANSI + int i; + + if (c == 27) { + for (i = 0; i < ansi_buf_size; ++i) + parse_putc(ansi_buf[i]); + ansi_buf[0] = 27; + ansi_buf_size = 1; + return; + } + + if (ansi_buf_size > 0) { + /* + * 0 - ESC + * 1 - [ + * 2 - num1 + * 3 - .. + * 4 - ; + * 5 - num2 + * 6 - .. + * - cchar + */ + int next = 0; + + int flush = 0; + int fail = 0; + + int num1 = 0; + int num2 = 0; + int cchar = 0; + + ansi_buf[ansi_buf_size++] = c; + + if (ansi_buf_size >= sizeof(ansi_buf)) + fail = 1; + + for (i = 0; i < ansi_buf_size; ++i) { + if (fail) + break; + + switch (next) { + case 0: + if (ansi_buf[i] == 27) + next = 1; + else + fail = 1; + break; + + case 1: + if (ansi_buf[i] == '[') + next = 2; + else + fail = 1; + break; + + case 2: + if (ansi_buf[i] >= '0' && ansi_buf[i] <= '9') { + num1 = ansi_buf[i]-'0'; + next = 3; + } else if (ansi_buf[i] != '?') { + --i; + num1 = 1; + next = 4; + } + break; + + case 3: + if (ansi_buf[i] >= '0' && ansi_buf[i] <= '9') { + num1 *= 10; + num1 += ansi_buf[i]-'0'; + } else { + --i; + next = 4; + } + break; + + case 4: + if (ansi_buf[i] != ';') { + --i; + next = 7; + } else + next = 5; + break; + + case 5: + if (ansi_buf[i] >= '0' && ansi_buf[i] <= '9') { + num2 = ansi_buf[i]-'0'; + next = 6; + } else + fail = 1; + break; + + case 6: + if (ansi_buf[i] >= '0' && ansi_buf[i] <= '9') { + num2 *= 10; + num2 += ansi_buf[i]-'0'; + } else { + --i; + next = 7; + } + break; + + case 7: + if ((ansi_buf[i] >= 'A' && ansi_buf[i] <= 'H') + || ansi_buf[i] == 'J' + || ansi_buf[i] == 'K' + || ansi_buf[i] == 'h' + || ansi_buf[i] == 'l' + || ansi_buf[i] == 'm') { + cchar = ansi_buf[i]; + flush = 1; + } else + fail = 1; + break; + } + } + + if (fail) { + for (i = 0; i < ansi_buf_size; ++i) + parse_putc(ansi_buf[i]); + ansi_buf_size = 0; + return; + } + + if (flush) { + if (!ansi_cursor_hidden) + CURSOR_OFF; + ansi_buf_size = 0; + switch (cchar) { + case 'A': + /* move cursor num1 rows up */ + console_cursor_up(num1); + break; + case 'B': + /* move cursor num1 rows down */ + console_cursor_down(num1); + break; + case 'C': + /* move cursor num1 columns forward */ + console_cursor_right(num1); + break; + case 'D': + /* move cursor num1 columns back */ + console_cursor_left(num1); + break; + case 'E': + /* move cursor num1 rows up at begin of row */ + console_previousline(num1); + break; + case 'F': + /* move cursor num1 rows down at begin of row */ + console_newline(num1); + break; + case 'G': + /* move cursor to column num1 */ + console_cursor_set_position(-1, num1-1); + break; + case 'H': + /* move cursor to row num1, column num2 */ + console_cursor_set_position(num1-1, num2-1); + break; + case 'J': + /* clear console and move cursor to 0, 0 */ + console_clear(); + console_cursor_set_position(0, 0); + break; + case 'K': + /* clear line */ + if (num1 == 0) + console_clear_line(console_row, + console_col, + CONSOLE_COLS-1); + else if (num1 == 1) + console_clear_line(console_row, + 0, console_col); + else + console_clear_line(console_row, + 0, CONSOLE_COLS-1); + break; + case 'h': + ansi_cursor_hidden = 0; + break; + case 'l': + ansi_cursor_hidden = 1; + break; + case 'm': + if (num1 == 0) { /* reset swapped colors */ + if (ansi_colors_need_revert) { + console_swap_colors(); + ansi_colors_need_revert = 0; + } + } else if (num1 == 7) { /* once swap colors */ + if (!ansi_colors_need_revert) { + console_swap_colors(); + ansi_colors_need_revert = 1; + } + } + break; + } + if (!ansi_cursor_hidden) + CURSOR_SET; + } + } else { + parse_putc(c); + } +#else + parse_putc(c); +#endif }
void video_puts(const char *s)

On Saturday 20 October 2012 01:30:09 Anatolij Gustschin wrote:
From: Pali Rohár pali.rohar@gmail.com
Add optional support for some ANSI escape sequences to the cfb_console driver. Define CONFIG_CFB_CONSOLE_ANSI to enable cursor moving, color reverting and clearing the cfb console via ANSI escape codes.
Signed-off-by: Pali Rohár pali.rohar@gmail.com Signed-off-by: Anatolij Gustschin agust@denx.de
Changes in v5:
- do not init global ansi_buf[]
- cleanup build warnings shown when compiling without
CONFIG_CFB_CONSOLE_ANSI - reorder some functions and put them under ANSI support ifdef - revise commit log and description in README
- fix typos and some minor style issues
I tested v5 and for rx51 working fine.

Hi,
On Fri, 19 Oct 2012 14:00:07 +0200 Pali Rohár pali.rohar@gmail.com wrote: ...
When CONFIG_CFB_CONSOLE_ANSI is defined, console will have
ANSI terminal support. Needed for CONFIG_CMDLINE_EDITING.
What do you mean here? Doesn't command line editing work without ANSI support in cfb?
- When CONFIG_CFB_CONSOLE is defined, video console is default i/o. Serial console can be forced with environment 'console=serial'.
diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c index 9f7794f..3ed96d3 100644 --- a/drivers/video/cfb_console.c +++ b/drivers/video/cfb_console.c @@ -385,6 +385,11 @@ static u32 eorx, fgx, bgx; /* color pats */
static int cfb_do_flush_cache;
+static char ansi_buf[10] = { 0, };
initialisation is not needed here. I've fixed some issues with this patch, please test v5.
Thanks, Anatolij

On Saturday 20 October 2012 01:38:14 Anatolij Gustschin wrote:
Hi,
On Fri, 19 Oct 2012 14:00:07 +0200 Pali Rohár pali.rohar@gmail.com wrote: ...
When CONFIG_CFB_CONSOLE_ANSI is defined, console will
have
ANSI terminal support. Needed for
CONFIG_CMDLINE_EDITING.
What do you mean here? Doesn't command line editing work without ANSI support in cfb?
CONFIG_CMDLINE_EDITING using ansi escape codes, so in cfb it not working without CONFIG_CFB_CONSOLE_ANSI.

This patch adding support for new board Nokia RX-51 (N900).
Based on previous work by: Alistair Buxton a.j.buxton@gmail.com
Signed-off-by: Pali Rohár pali.rohar@gmail.com Cc: Ивайло Димитров freemangordon@abv.bg --- Changes in v4: - Fixed MAINTAINERS - Added default to switches - Added some documentation to code - Optimize indent depth - Using __stringify
Changes in v3: - Added documentation in doc/README.nokia_rx51 - Updated MAINTAINERS - Fixed Fix omap_mmc_init - Code for errata 430973 workaround - Added board specified atag support - Generate omap atag table instead reusing from NOLO - Load bootmenu.src always - Enabled ext4 support - Fixed comments - Reserve protected RAM for attached kernel - Rewritten assembler code in lowlevel_init.S - Reset lp5523 led on init
Changes in v2: - Set correct configs for Memory Map - Enable passing memory tag to kernel atags - Use gpio input command for detecting keyboard slide - Restore powerbus state after calling twl4030 regulator code - Renamed command noloboot to attachboot - Atag address must be always 0x80000100, removed code from lowlevel - Added usb vendor, product id and product name - Enabled command line editing - Fixed keymap and cursor keys
Changes since original version: - Removed Makefile targets: clean and distclean - Rewrited bootcommand and env variables in nokia_rx51.h - Removed useless CONFIG defines in nokia_rx51.h - Disable L2 cache with CONFIG_SYS_L2CACHE_OFF - fixed battery draining - Added onenand support (default disabled due to big u-boot size) - Moved inlined asm code to new file lowlevel_init.S - Fixed commit message
MAINTAINERS | 4 + board/nokia/rx51/Makefile | 46 +++ board/nokia/rx51/lowlevel_init.S | 209 ++++++++++++ board/nokia/rx51/rx51.c | 679 ++++++++++++++++++++++++++++++++++++++ board/nokia/rx51/rx51.h | 389 ++++++++++++++++++++++ board/nokia/rx51/tag_omap.h | 311 +++++++++++++++++ boards.cfg | 1 + doc/README.nokia_rx51 | 104 ++++++ include/configs/nokia_rx51.h | 450 +++++++++++++++++++++++++ 9 files changed, 2193 insertions(+) create mode 100644 board/nokia/rx51/Makefile create mode 100644 board/nokia/rx51/lowlevel_init.S create mode 100644 board/nokia/rx51/rx51.c create mode 100644 board/nokia/rx51/rx51.h create mode 100644 board/nokia/rx51/tag_omap.h create mode 100644 doc/README.nokia_rx51 create mode 100644 include/configs/nokia_rx51.h
diff --git a/MAINTAINERS b/MAINTAINERS index 971235b..9e0b1b2 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1009,6 +1009,10 @@ Nobuhiro Iwamatsu nobuhiro.iwamatsu.yj@renesas.com
armadillo-800eva R8A7740 (RMOBILE SoC)
+Pali Rohár pali.rohar@gmail.com + + nokia_rx51 ARM ARMV7 (OMAP34xx SoC) + -------------------------------------------------------------------------
Unknown / orphaned boards: diff --git a/board/nokia/rx51/Makefile b/board/nokia/rx51/Makefile new file mode 100644 index 0000000..86fb48c --- /dev/null +++ b/board/nokia/rx51/Makefile @@ -0,0 +1,46 @@ +# +# (C) Copyright 2000, 2001, 2002 +# Wolfgang Denk, DENX Software Engineering, wd@denx.de. +# +# 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 as +# published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# + +include $(TOPDIR)/config.mk + +LIB = $(obj)lib$(BOARD).o + +COBJS-y := $(BOARD).o +SOBJS-y := lowlevel_init.o + +COBJS := $(sort $(COBJS-y)) +SOBJS := $(sort $(SOBJS-y)) +SRCS := $(COBJS:.o=.c) $(SOBJS:.o=.S) +OBJS := $(addprefix $(obj),$(COBJS)) $(addprefix $(obj),$(SOBJS)) + +$(LIB): $(obj).depend $(OBJS) + $(call cmd_link_o_target, $(OBJS)) + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +######################################################################### diff --git a/board/nokia/rx51/lowlevel_init.S b/board/nokia/rx51/lowlevel_init.S new file mode 100644 index 0000000..055b103 --- /dev/null +++ b/board/nokia/rx51/lowlevel_init.S @@ -0,0 +1,209 @@ +/* + * (C) Copyright 2011-2012 + * Pali Rohár pali.rohar@gmail.com + * + * 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 as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <config.h> + +relocaddr: /* address of this relocaddr section after coping */ + .word . /* address of section (calculated at compile time) */ + +startaddr: /* address of u-boot after copying */ + .word CONFIG_SYS_TEXT_BASE + +kernaddr: /* address of kernel after copying */ + .word KERNEL_ADDRESS + +kernsize: /* maximal size of kernel image */ + .word KERNEL_MAXSIZE + +kernoffs: /* offset of kernel image in loaded u-boot */ + .word KERNEL_OFFSET + +imagesize: /* maximal size of image */ + .word IMAGE_MAXSIZE + +ih_magic: /* IH_MAGIC in big endian from include/image.h */ + .word 0x56190527 + +/* + * Routine: save_boot_params (called after reset from start.S) + * Description: Copy attached kernel to address KERNEL_ADDRESS + * Copy u-boot to address CONFIG_SYS_TEXT_BASE + * Return to copied u-boot address + */ + +.global save_boot_params +save_boot_params: + + +/* Copy valid attached kernel to address KERNEL_ADDRESS */ + +copy_kernel_start: + adr r0, relocaddr /* r0 - address of section relocaddr */ + ldr r1, relocaddr /* r1 - address of relocaddr after relocation */ + cmp r0, r1 + + /* r4 - calculated offset */ + subhi r4, r0, r1 + sublo r4, r1, r0 + + /* r0 - start of kernel before */ + ldr r0, startaddr + addhi r0, r0, r4 + sublo r0, r0, r4 + ldr r1, kernoffs + add r0, r0, r1 + + /* r3 - start of kernel after */ + ldr r3, kernaddr + + /* r2 - end of kernel after */ + ldr r1, kernsize + add r2, r3, r1 + + /* r1 - end of kernel before */ + add r1, r0, r1 + + /* remove header in target kernel */ + mov r5, #0 + str r5, [r3] + + /* check for valid kernel uImage */ + ldr r4, [r0] /* r4 - 4 bytes header of kernel */ + ldr r5, ih_magic /* r5 - IH_MAGIC */ + cmp r4, r5 + bne copy_kernel_end /* skip if invalid image */ + +copy_kernel_loop: + ldmdb r1!, {r3 - r10} + stmdb r2!, {r3 - r10} + cmp r1, r0 + bhi copy_kernel_loop + +copy_kernel_end: + mov r5, #0 + str r5, [r0] /* remove 4 bytes header of kernel */ + + +/* Fix u-boot code */ + +fix_start: + adr r0, relocaddr /* r0 - address of section relocaddr */ + ldr r1, relocaddr /* r1 - address of relocaddr after relocation */ + cmp r0, r1 + + beq copy_uboot_end /* skip if u-boot is on correct address */ + + /* r5 - calculated offset */ + subhi r5, r0, r1 + sublo r5, r1, r0 + + /* r6 - maximal u-boot size */ + ldr r6, imagesize + + /* fix return address */ + subhi lr, lr, r5 + addlo lr, lr, r5 + + /* r1 - start of u-boot after */ + ldr r1, startaddr + + /* r0 - start of u-boot before */ + addhi r0, r1, r5 + sublo r0, r1, r5 + + /* check if we need to move uboot copy code before calling it */ + cmp r5, r6 + bhi copy_uboot_start /* now coping u-boot code directly is safe */ + + +copy_code_start: + /* r0 - start of u-boot before */ + /* r1 - start of u-boot after */ + /* r6 - maximal u-boot size */ + + /* r7 - maximal kernel size */ + ldr r7, kernsize + + /* r4 - end of kernel before */ + add r4, r0, r6 + add r4, r4, r7 + + /* r5 - end of u-boot after */ + ldr r5, startaddr + add r5, r5, r6 + + /* r2 - start of loop code after */ + cmp r4, r5 /* higher address (r4 or r5) */ + movhs r2, r4 + movlo r2, r5 + + /* r3 - end of loop code before */ + adr r3, end + + /* r4 - end of loop code after */ + adr r4, copy_uboot_start + sub r4, r3, r4 + add r4, r2, r4 + +copy_code_loop: + ldmdb r3!, {r7 - r10} + stmdb r4!, {r7 - r10} + cmp r4, r2 + bhi copy_code_loop + +copy_code_end: + mov pc, r2 + + +/* Copy u-boot to address CONFIG_SYS_TEXT_BASE */ + +copy_uboot_start: + /* r0 - start of u-boot before */ + /* r1 - start of u-boot after */ + /* r6 - maximal u-boot size */ + + /* r2 - end of u-boot after */ + add r2, r1, r6 + + /* condition for copying from left to right */ + cmp r0, r1 + addlo r1, r0, r6 /* r1 - end of u-boot before */ + blo copy_uboot_loop_right + +copy_uboot_loop_left: + ldmia r0!, {r3 - r10} + stmia r1!, {r3 - r10} + cmp r1, r2 + blo copy_uboot_loop_left + b copy_uboot_end + +copy_uboot_loop_right: + ldmdb r1!, {r3 - r10} + stmdb r2!, {r3 - r10} + cmp r1, r0 + bhi copy_uboot_loop_right + +copy_uboot_end: + bx lr + +end: diff --git a/board/nokia/rx51/rx51.c b/board/nokia/rx51/rx51.c new file mode 100644 index 0000000..60446cb --- /dev/null +++ b/board/nokia/rx51/rx51.c @@ -0,0 +1,679 @@ +/* + * (C) Copyright 2012 + * Ивайло Димитров freemangordon@abv.bg + * + * (C) Copyright 2011-2012 + * Pali Rohár pali.rohar@gmail.com + * + * (C) Copyright 2010 + * Alistair Buxton a.j.buxton@gmail.com + * + * Derived from Beagle Board and 3430 SDP code: + * (C) Copyright 2004-2008 + * Texas Instruments, <www.ti.com> + * + * Author : + * Sunil Kumar sunilsaini05@gmail.com + * Shashi Ranjan shashiranjanmca05@gmail.com + * + * Richard Woodruff r-woodruff2@ti.com + * Syed Mohammed Khasim khasim@ti.com + * + * 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 as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <common.h> +#include <watchdog.h> +#include <malloc.h> +#include <twl4030.h> +#include <i2c.h> +#include <video_fb.h> +#include <asm/io.h> +#include <asm/setup.h> +#include <asm/bitops.h> +#include <asm/mach-types.h> +#include <asm/arch/mux.h> +#include <asm/arch/sys_proto.h> +#include <asm/arch/mmc_host_def.h> + +#include "rx51.h" +#include "tag_omap.h" + +DECLARE_GLOBAL_DATA_PTR; + +GraphicDevice gdev; + +const omap3_sysinfo sysinfo = { + DDR_STACKED, + "Nokia RX-51", + "OneNAND" +}; + +/* This structure contains default omap tags needed for booting Maemo 5 */ +static struct tag_omap omap[] = { + OMAP_TAG_UART_CONFIG(0x04), + OMAP_TAG_SERIAL_CONSOLE_CONFIG(0x03, 0x01C200), + OMAP_TAG_LCD_CONFIG("acx565akm", "internal", 90, 0x18), + OMAP_TAG_GPIO_SWITCH_CONFIG("cam_focus", 0x44, 0x1, 0x2, 0x0), + OMAP_TAG_GPIO_SWITCH_CONFIG("cam_launch", 0x45, 0x1, 0x2, 0x0), + OMAP_TAG_GPIO_SWITCH_CONFIG("cam_shutter", 0x6e, 0x1, 0x0, 0x0), + OMAP_TAG_GPIO_SWITCH_CONFIG("cmt_apeslpx", 0x46, 0x2, 0x2, 0x0), + OMAP_TAG_GPIO_SWITCH_CONFIG("cmt_bsi", 0x9d, 0x2, 0x2, 0x0), + OMAP_TAG_GPIO_SWITCH_CONFIG("cmt_en", 0x4a, 0x2, 0x2, 0x0), + OMAP_TAG_GPIO_SWITCH_CONFIG("cmt_rst", 0x4b, 0x6, 0x2, 0x0), + OMAP_TAG_GPIO_SWITCH_CONFIG("cmt_rst_rq", 0x49, 0x6, 0x2, 0x0), + OMAP_TAG_GPIO_SWITCH_CONFIG("cmt_wddis", 0x0d, 0x2, 0x2, 0x0), + OMAP_TAG_GPIO_SWITCH_CONFIG("headphone", 0xb1, 0x1, 0x1, 0x0), + OMAP_TAG_GPIO_SWITCH_CONFIG("kb_lock", 0x71, 0x1, 0x0, 0x0), + OMAP_TAG_GPIO_SWITCH_CONFIG("proximity", 0x59, 0x0, 0x0, 0x0), + OMAP_TAG_GPIO_SWITCH_CONFIG("sleep_ind", 0xa2, 0x2, 0x2, 0x0), + OMAP_TAG_GPIO_SWITCH_CONFIG("slide", GPIO_SLIDE, 0x0, 0x0, 0x0), + OMAP_TAG_WLAN_CX3110X_CONFIG(0x25, 0xff, 87, 42, -1), + OMAP_TAG_PARTITION_CONFIG(PART1_NAME, PART1_SIZE * PART1_MULL, + PART1_OFFS, PART1_MASK), + OMAP_TAG_PARTITION_CONFIG(PART2_NAME, PART2_SIZE * PART2_MULL, + PART2_OFFS, PART2_MASK), + OMAP_TAG_PARTITION_CONFIG(PART3_NAME, PART3_SIZE * PART3_MULL, + PART3_OFFS, PART3_MASK), + OMAP_TAG_PARTITION_CONFIG(PART4_NAME, PART4_SIZE * PART4_MULL, + PART4_OFFS, PART4_MASK), + OMAP_TAG_PARTITION_CONFIG(PART5_NAME, PART5_SIZE * PART5_MULL, + PART5_OFFS, PART5_MASK), + OMAP_TAG_PARTITION_CONFIG(PART6_NAME, PART6_SIZE * PART6_MULL, + PART6_OFFS, PART6_MASK), + OMAP_TAG_BOOT_REASON_CONFIG("pwr_key"), + OMAP_TAG_VERSION_STR_CONFIG("product", "RX-51"), + OMAP_TAG_VERSION_STR_CONFIG("hw-build", "2101"), + OMAP_TAG_VERSION_STR_CONFIG("nolo", "1.4.14"), + OMAP_TAG_VERSION_STR_CONFIG("boot-mode", "normal"), + { } +}; + +static char *boot_reason_ptr; +static char *hw_build_ptr; +static char *nolo_version_ptr; +static char *boot_mode_ptr; + +/* + * Routine: init_omap_tags + * Description: Initialize pointers to values in tag_omap + */ +static void init_omap_tags(void) +{ + char *component; + char *version; + int i = 0; + while (omap[i].hdr.tag) { + switch (omap[i].hdr.tag) { + case OMAP_TAG_BOOT_REASON: + boot_reason_ptr = omap[i].u.boot_reason.reason_str; + break; + case OMAP_TAG_VERSION_STR: + component = omap[i].u.version.component; + version = omap[i].u.version.version; + if (strcmp(component, "hw-build") == 0) + hw_build_ptr = version; + else if (strcmp(component, "nolo") == 0) + nolo_version_ptr = version; + else if (strcmp(component, "boot-mode") == 0) + boot_mode_ptr = version; + break; + default: + break; + } + i++; + } +} + +static void reuse_omap_atags(struct tag_omap *t) +{ + char *component; + char *version; + while (t->hdr.tag) { + switch (t->hdr.tag) { + case OMAP_TAG_BOOT_REASON: + memset(boot_reason_ptr, 0, 12); + strcpy(boot_reason_ptr, t->u.boot_reason.reason_str); + break; + case OMAP_TAG_VERSION_STR: + component = t->u.version.component; + version = t->u.version.version; + if (strcmp(component, "hw-build") == 0) { + memset(hw_build_ptr, 0, 12); + strcpy(hw_build_ptr, version); + } else if (strcmp(component, "nolo") == 0) { + memset(nolo_version_ptr, 0, 12); + strcpy(nolo_version_ptr, version); + } else if (strcmp(component, "boot-mode") == 0) { + memset(boot_mode_ptr, 0, 12); + strcpy(boot_mode_ptr, version); + } + break; + default: + break; + } + t = tag_omap_next(t); + } +} + +/* + * Routine: reuse_atags + * Description: Reuse atags from previous bootloader. + * Reuse only only HW build, boot reason, boot mode and nolo + */ +static void reuse_atags(void) +{ + struct tag *t = (struct tag *)gd->bd->bi_boot_params; + + /* First tag must be ATAG_CORE */ + if (t->hdr.tag != ATAG_CORE) + return; + + if (!boot_reason_ptr || !hw_build_ptr) + return; + + /* Last tag must be ATAG_NONE */ + while (t->hdr.tag != ATAG_NONE) { + switch (t->hdr.tag) { + case ATAG_REVISION: + memset(hw_build_ptr, 0, 12); + sprintf(hw_build_ptr, "%x", t->u.revision.rev); + break; + case ATAG_BOARD: + reuse_omap_atags((struct tag_omap *)&t->u); + break; + default: + break; + } + t = tag_next(t); + } +} + +/* + * Routine: board_init + * Description: Early hardware init. + */ +int board_init(void) +{ + gpmc_init(); /* in SRAM or SDRAM, finish GPMC */ + /* board id for Linux */ + gd->bd->bi_arch_number = MACH_TYPE_NOKIA_RX51; + /* boot param addr */ + gd->bd->bi_boot_params = OMAP34XX_SDRC_CS0 + 0x100; + + return 0; +} + +/* + * Routine: get_board_revision + * Description: Return board revision. + */ +u32 get_board_rev(void) +{ + return simple_strtol(hw_build_ptr, NULL, 16); +} + +/* + * Routine: setup_board_tags + * Description: Append board specific boot tags. + */ +void setup_board_tags(struct tag **in_params) +{ + int setup_console_atag; + char *setup_boot_reason_atag; + char *setup_boot_mode_atag; + char *str; + int i; + int size; + int total_size; + struct tag *params; + struct tag_omap *t; + + params = (struct tag *)gd->bd->bi_boot_params; + + params->u.core.flags = 0x0; + params->u.core.pagesize = 0x1000; + params->u.core.rootdev = 0x0; + + /* append omap atag only if env setup_omap_atag is set to 1 */ + str = getenv("setup_omap_atag"); + if (!str || str[0] != '1') + return; + + str = getenv("setup_console_atag"); + if (str && str[0] == '1') + setup_console_atag = 1; + else + setup_console_atag = 0; + + setup_boot_reason_atag = getenv("setup_boot_reason_atag"); + setup_boot_mode_atag = getenv("setup_boot_mode_atag"); + + params = *in_params; + t = (struct tag_omap *)¶ms->u; + total_size = sizeof(struct tag_header); + + for (i = 0; omap[i].hdr.tag; i++) { + + /* skip serial console tag */ + if (!setup_console_atag && + omap[i].hdr.tag == OMAP_TAG_SERIAL_CONSOLE) + continue; + + size = omap[i].hdr.size + sizeof(struct tag_omap_header); + memcpy(t, &omap[i], size); + + /* set uart tag to 0 - disable serial console */ + if (!setup_console_atag && omap[i].hdr.tag == OMAP_TAG_UART) + t->u.uart.enabled_uarts = 0; + + /* change boot reason */ + if (setup_boot_reason_atag && + omap[i].hdr.tag == OMAP_TAG_BOOT_REASON) { + memset(t->u.boot_reason.reason_str, 0, 12); + strcpy(t->u.boot_reason.reason_str, + setup_boot_reason_atag); + } + + /* change boot mode */ + if (setup_boot_mode_atag && + omap[i].hdr.tag == OMAP_TAG_VERSION_STR && + strcmp(omap[i].u.version.component, "boot-mode") == 0) { + memset(t->u.version.version, 0, 12); + strcpy(t->u.version.version, setup_boot_mode_atag); + } + + total_size += size; + t = tag_omap_next(t); + + } + + params->hdr.tag = ATAG_BOARD; + params->hdr.size = total_size >> 2; + params = tag_next(params); + + *in_params = params; +} + +/* + * Routine: video_hw_init + * Description: Set up the GraphicDevice depending on sys_boot. + */ +void *video_hw_init(void) +{ + /* fill in Graphic Device */ + gdev.frameAdrs = 0x8f9c0000; + gdev.winSizeX = 800; + gdev.winSizeY = 480; + gdev.gdfBytesPP = 2; + gdev.gdfIndex = GDF_16BIT_565RGB; + memset((void *)gdev.frameAdrs, 0, 0xbb800); + return (void *) &gdev; +} + +/* + * Routine: twl4030_regulator_set_mode + * Description: Set twl4030 regulator mode over i2c powerbus. + */ +static void twl4030_regulator_set_mode(u8 id, u8 mode) +{ + u16 msg = MSG_SINGULAR(DEV_GRP_P1, id, mode); + twl4030_i2c_write_u8(TWL4030_CHIP_PM_MASTER, msg >> 8, + TWL4030_PM_MASTER_PB_WORD_MSB); + twl4030_i2c_write_u8(TWL4030_CHIP_PM_MASTER, msg & 0xff, + TWL4030_PM_MASTER_PB_WORD_LSB); +} + +static void omap3_emu_romcode_call(u32 service_id, u32 *parameters) +{ + u32 i, num_params = *parameters; + u32 *sram_scratch_space = (u32 *)OMAP3_PUBLIC_SRAM_SCRATCH_AREA; + + /* + * copy the parameters to an un-cached area to avoid coherency + * issues + */ + for (i = 0; i < num_params; i++) { + __raw_writel(*parameters, sram_scratch_space); + parameters++; + sram_scratch_space++; + } + + /* Now make the PPA call */ + do_omap3_emu_romcode_call(service_id, OMAP3_PUBLIC_SRAM_SCRATCH_AREA); +} + +/* + * Routine: omap3_update_aux_cr_secure_rx51 + * Description: Modify the contents Auxiliary Control Register. + * Parameters: + * set_bits - bits to set in ACR + * clr_bits - bits to clear in ACR + */ +static void omap3_update_aux_cr_secure_rx51(u32 set_bits, u32 clear_bits) +{ + struct emu_hal_params_rx51 emu_romcode_params = { 0, }; + u32 acr; + + /* Read ACR */ + asm volatile ("mrc p15, 0, %0, c1, c0, 1" : "=r" (acr)); + acr &= ~clear_bits; + acr |= set_bits; + + emu_romcode_params.num_params = 2; + emu_romcode_params.param1 = acr; + + omap3_emu_romcode_call(OMAP3_EMU_HAL_API_WRITE_ACR, + (u32 *)&emu_romcode_params); +} + +/* + * Routine: misc_init_r + * Description: Configure board specific parts. + */ +int misc_init_r(void) +{ + char buf[12]; + u8 state; + + /* reset lp5523 led */ + i2c_set_bus_num(1); + state = 0xff; + i2c_write(0x32, 0x3d, 1, &state, 1); + i2c_set_bus_num(0); + + /* initialize twl4030 power managment */ + twl4030_power_init(); + + /* set VSIM to 1.8V */ + twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VSIM_DEDICATED, + TWL4030_PM_RECEIVER_VSIM_VSEL_18, + TWL4030_PM_RECEIVER_VSIM_DEV_GRP, + TWL4030_PM_RECEIVER_DEV_GRP_P1); + + /* store I2C access state */ + twl4030_i2c_read_u8(TWL4030_CHIP_PM_MASTER, &state, + TWL4030_PM_MASTER_PB_CFG); + + /* enable I2C access to powerbus (needed for twl4030 regulator) */ + twl4030_i2c_write_u8(TWL4030_CHIP_PM_MASTER, 0x02, + TWL4030_PM_MASTER_PB_CFG); + + /* set VAUX3, VSIM and VMMC1 state to active - enable eMMC memory */ + twl4030_regulator_set_mode(RES_VAUX3, RES_STATE_ACTIVE); + twl4030_regulator_set_mode(RES_VSIM, RES_STATE_ACTIVE); + twl4030_regulator_set_mode(RES_VMMC1, RES_STATE_ACTIVE); + + /* restore I2C access state */ + twl4030_i2c_write_u8(TWL4030_CHIP_PM_MASTER, state, + TWL4030_PM_MASTER_PB_CFG); + + /* set env variable attkernaddr for relocated kernel */ + sprintf(buf, "%#x", KERNEL_ADDRESS); + setenv("attkernaddr", buf); + + /* initialize omap tags */ + init_omap_tags(); + + /* reuse atags from previous bootloader */ + reuse_atags(); + + dieid_num_r(); + print_cpuinfo(); + + /* + * Cortex-A8(r1p0..r1p2) errata 430973 workaround + * Set IBE bit in Auxiliary Control Register + */ + omap3_update_aux_cr_secure_rx51(1 << 6, 0); + + return 0; +} + +/* + * Routine: set_muxconf_regs + * Description: Setting up the configuration Mux registers specific to the + * hardware. Many pins need to be moved from protect to primary + * mode. + */ +void set_muxconf_regs(void) +{ + MUX_RX51(); +} + +static unsigned long int twl_wd_time; /* last time of watchdog reset */ +static unsigned long int twl_i2c_lock; + +/* + * Routine: hw_watchdog_reset + * Description: Reset timeout of twl4030 watchdog. + */ +void hw_watchdog_reset(void) +{ + u8 timeout = 0; + + /* do not reset watchdog too often - max every 4s */ + if (get_timer(twl_wd_time) < 4 * CONFIG_SYS_HZ) + return; + + /* localy lock twl4030 i2c bus */ + if (test_and_set_bit(0, &twl_i2c_lock)) + return; + + /* read actual watchdog timeout */ + twl4030_i2c_read_u8(TWL4030_CHIP_PM_RECEIVER, &timeout, + TWL4030_PM_RECEIVER_WATCHDOG_CFG); + + /* timeout 0 means watchdog is disabled */ + /* reset watchdog timeout to 31s (maximum) */ + if (timeout != 0) + twl4030_i2c_write_u8(TWL4030_CHIP_PM_RECEIVER, 31, + TWL4030_PM_RECEIVER_WATCHDOG_CFG); + + /* store last watchdog reset time */ + twl_wd_time = get_timer(0); + + /* localy unlock twl4030 i2c bus */ + test_and_clear_bit(0, &twl_i2c_lock); +} + +/* + * TWL4030 keypad handler for cfb_console + */ + +static const char keymap[] = { + /* normal */ + 'q', 'o', 'p', ',', '\b', 0, 'a', 's', + 'w', 'd', 'f', 'g', 'h', 'j', 'k', 'l', + 'e', '.', 0, '\r', 0, 'z', 'x', 'c', + 'r', 'v', 'b', 'n', 'm', ' ', ' ', 0, + 't', 0, 0, 0, 0, 0, 0, 0, + 'y', 0, 0, 0, 0, 0, 0, 0, + 'u', 0, 0, 0, 0, 0, 0, 0, + 'i', 5, 6, 0, 0, 0, 0, 0, + /* fn */ + '1', '9', '0', '=', '\b', 0, '*', '+', + '2', '#', '-', '_', '(', ')', '&', '!', + '3', '?', '^', '\r', 0, 156, '$', 238, + '4', '/', '\', '"', ''', '@', 0, '<', + '5', '|', '>', 0, 0, 0, 0, 0, + '6', 0, 0, 0, 0, 0, 0, 0, + '7', 0, 0, 0, 0, 0, 0, 0, + '8', 16, 17, 0, 0, 0, 0, 0, +}; + +static u8 keys[8]; +static u8 old_keys[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +#define KEYBUF_SIZE 32 +static u8 keybuf[KEYBUF_SIZE]; +static u8 keybuf_head; +static u8 keybuf_tail; + +/* + * Routine: rx51_kp_init + * Description: Initialize HW keyboard. + */ +int rx51_kp_init(void) +{ + int ret = 0; + u8 ctrl; + ret = twl4030_i2c_read_u8(TWL4030_CHIP_KEYPAD, &ctrl, + TWL4030_KEYPAD_KEYP_CTRL_REG); + + if (ret) + return ret; + + /* turn on keyboard and use hardware scanning */ + ctrl |= TWL4030_KEYPAD_CTRL_KBD_ON; + ctrl |= TWL4030_KEYPAD_CTRL_SOFT_NRST; + ctrl |= TWL4030_KEYPAD_CTRL_SOFTMODEN; + ret |= twl4030_i2c_write_u8(TWL4030_CHIP_KEYPAD, ctrl, + TWL4030_KEYPAD_KEYP_CTRL_REG); + /* enable key event status */ + ret |= twl4030_i2c_write_u8(TWL4030_CHIP_KEYPAD, 0xfe, + TWL4030_KEYPAD_KEYP_IMR1); + /* enable interrupt generation on rising and falling */ + /* this is a workaround for qemu twl4030 emulation */ + ret |= twl4030_i2c_write_u8(TWL4030_CHIP_KEYPAD, 0x57, + TWL4030_KEYPAD_KEYP_EDR); + /* enable ISR clear on read */ + ret |= twl4030_i2c_write_u8(TWL4030_CHIP_KEYPAD, 0x05, + TWL4030_KEYPAD_KEYP_SIH_CTRL); + return 0; +} + +static void rx51_kp_fill(u8 k, u8 mods) +{ + /* check if some cursor key without meta fn key was pressed */ + if (!(mods & 2) && (k == 18 || k == 31 || k == 33 || k == 34)) { + keybuf[keybuf_tail++] = '\e'; + keybuf_tail %= KEYBUF_SIZE; + keybuf[keybuf_tail++] = '['; + keybuf_tail %= KEYBUF_SIZE; + if (k == 18) /* up */ + keybuf[keybuf_tail++] = 'A'; + else if (k == 31) /* left */ + keybuf[keybuf_tail++] = 'D'; + else if (k == 33) /* down */ + keybuf[keybuf_tail++] = 'B'; + else if (k == 34) /* right */ + keybuf[keybuf_tail++] = 'C'; + keybuf_tail %= KEYBUF_SIZE; + return; + } + + if (mods & 2) { /* fn meta key was pressed */ + k = keymap[k+64]; + } else { + k = keymap[k]; + if (mods & 1) { /* ctrl key was pressed */ + if (k >= 'a' && k <= 'z') + k -= 'a' - 1; + } + if (mods & 4) { /* shift key was pressed */ + if (k >= 'a' && k <= 'z') + k += 'A' - 'a'; + else if (k == '.') + k = ':'; + else if (k == ',') + k = ';'; + } + } + keybuf[keybuf_tail++] = k; + keybuf_tail %= KEYBUF_SIZE; +} + +/* + * Routine: rx51_kp_tstc + * Description: Test if key was pressed (from buffer). + */ +int rx51_kp_tstc(void) +{ + u8 c, r, dk, i; + u8 intr; + u8 mods; + + /* localy lock twl4030 i2c bus */ + if (test_and_set_bit(0, &twl_i2c_lock)) + return 0; + + /* twl4030 remembers up to 2 events */ + for (i = 0; i < 2; i++) { + + /* check interrupt register for events */ + twl4030_i2c_read_u8(TWL4030_CHIP_KEYPAD, &intr, + TWL4030_KEYPAD_KEYP_ISR1+(2*i)); + + /* no event */ + if (!(intr&1)) + continue; + + /* read the key state */ + i2c_read(TWL4030_CHIP_KEYPAD, + TWL4030_KEYPAD_FULL_CODE_7_0, 1, keys, 8); + + /* cut out modifier keys from the keystate */ + mods = keys[4] >> 4; + keys[4] &= 0x0f; + + for (c = 0; c < 8; c++) { + + /* get newly pressed keys only */ + dk = ((keys[c] ^ old_keys[c])&keys[c]); + old_keys[c] = keys[c]; + + /* fill the keybuf */ + for (r = 0; r < 8; r++) { + if (dk&1) + rx51_kp_fill((c*8)+r, mods); + dk = dk >> 1; + } + + } + + } + + /* localy unlock twl4030 i2c bus */ + test_and_clear_bit(0, &twl_i2c_lock); + + return (KEYBUF_SIZE + keybuf_tail - keybuf_head)%KEYBUF_SIZE; +} + +/* + * Routine: rx51_kp_getc + * Description: Get last pressed key (from buffer). + */ +int rx51_kp_getc(void) +{ + keybuf_head %= KEYBUF_SIZE; + while (!rx51_kp_tstc()) + WATCHDOG_RESET(); + return keybuf[keybuf_head++]; +} + +/* + * Routine: board_mmc_init + * Description: Initialize mmc devices. + */ +int board_mmc_init(bd_t *bis) +{ + omap_mmc_init(0, 0, 0); + omap_mmc_init(1, 0, 0); + return 0; +} diff --git a/board/nokia/rx51/rx51.h b/board/nokia/rx51/rx51.h new file mode 100644 index 0000000..e66e241 --- /dev/null +++ b/board/nokia/rx51/rx51.h @@ -0,0 +1,389 @@ +/* + * (C) Copyright 2012 + * Ивайло Димитров freemangordon@abv.bg + * + * (C) Copyright 2011-2012 + * Pali Rohár pali.rohar@gmail.com + * + * (C) Copyright 2008 + * Dirk Behme dirk.behme@gmail.com + * + * 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 as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ +#ifndef _RX51_H_ +#define _RX51_H_ + +/* Needed for ROM SMC call */ +struct emu_hal_params_rx51 { + u32 num_params; + u32 param1; + u32 param2; + u32 param3; + u32 param4; +}; + +int print_cpuinfo(void); + +/* + * IEN - Input Enable + * IDIS - Input Disable + * PTD - Pull type Down + * PTU - Pull type Up + * DIS - Pull type selection is inactive + * EN - Pull type selection is active + * M0 - Mode 0 + * The commented string gives the final mux configuration for that pin + */ +#define MUX_RX51() \ +/* SDRC */\ + MUX_VAL(CP(SDRC_D0), (IEN | PTD | DIS | M0)) /*SDRC_D0*/\ + MUX_VAL(CP(SDRC_D1), (IEN | PTD | DIS | M0)) /*SDRC_D1*/\ + MUX_VAL(CP(SDRC_D2), (IEN | PTD | DIS | M0)) /*SDRC_D2*/\ + MUX_VAL(CP(SDRC_D3), (IEN | PTD | DIS | M0)) /*SDRC_D3*/\ + MUX_VAL(CP(SDRC_D4), (IEN | PTD | DIS | M0)) /*SDRC_D4*/\ + MUX_VAL(CP(SDRC_D5), (IEN | PTD | DIS | M0)) /*SDRC_D5*/\ + MUX_VAL(CP(SDRC_D6), (IEN | PTD | DIS | M0)) /*SDRC_D6*/\ + MUX_VAL(CP(SDRC_D7), (IEN | PTD | DIS | M0)) /*SDRC_D7*/\ + MUX_VAL(CP(SDRC_D8), (IEN | PTD | DIS | M0)) /*SDRC_D8*/\ + MUX_VAL(CP(SDRC_D9), (IEN | PTD | DIS | M0)) /*SDRC_D9*/\ + MUX_VAL(CP(SDRC_D10), (IEN | PTD | DIS | M0)) /*SDRC_D10*/\ + MUX_VAL(CP(SDRC_D11), (IEN | PTD | DIS | M0)) /*SDRC_D11*/\ + MUX_VAL(CP(SDRC_D12), (IEN | PTD | DIS | M0)) /*SDRC_D12*/\ + MUX_VAL(CP(SDRC_D13), (IEN | PTD | DIS | M0)) /*SDRC_D13*/\ + MUX_VAL(CP(SDRC_D14), (IEN | PTD | DIS | M0)) /*SDRC_D14*/\ + MUX_VAL(CP(SDRC_D15), (IEN | PTD | DIS | M0)) /*SDRC_D15*/\ + MUX_VAL(CP(SDRC_D16), (IEN | PTD | DIS | M0)) /*SDRC_D16*/\ + MUX_VAL(CP(SDRC_D17), (IEN | PTD | DIS | M0)) /*SDRC_D17*/\ + MUX_VAL(CP(SDRC_D18), (IEN | PTD | DIS | M0)) /*SDRC_D18*/\ + MUX_VAL(CP(SDRC_D19), (IEN | PTD | DIS | M0)) /*SDRC_D19*/\ + MUX_VAL(CP(SDRC_D20), (IEN | PTD | DIS | M0)) /*SDRC_D20*/\ + MUX_VAL(CP(SDRC_D21), (IEN | PTD | DIS | M0)) /*SDRC_D21*/\ + MUX_VAL(CP(SDRC_D22), (IEN | PTD | DIS | M0)) /*SDRC_D22*/\ + MUX_VAL(CP(SDRC_D23), (IEN | PTD | DIS | M0)) /*SDRC_D23*/\ + MUX_VAL(CP(SDRC_D24), (IEN | PTD | DIS | M0)) /*SDRC_D24*/\ + MUX_VAL(CP(SDRC_D25), (IEN | PTD | DIS | M0)) /*SDRC_D25*/\ + MUX_VAL(CP(SDRC_D26), (IEN | PTD | DIS | M0)) /*SDRC_D26*/\ + MUX_VAL(CP(SDRC_D27), (IEN | PTD | DIS | M0)) /*SDRC_D27*/\ + MUX_VAL(CP(SDRC_D28), (IEN | PTD | DIS | M0)) /*SDRC_D28*/\ + MUX_VAL(CP(SDRC_D29), (IEN | PTD | DIS | M0)) /*SDRC_D29*/\ + MUX_VAL(CP(SDRC_D30), (IEN | PTD | DIS | M0)) /*SDRC_D30*/\ + MUX_VAL(CP(SDRC_D31), (IEN | PTD | DIS | M0)) /*SDRC_D31*/\ + MUX_VAL(CP(SDRC_CLK), (IEN | PTD | DIS | M0)) /*SDRC_CLK*/\ + MUX_VAL(CP(SDRC_DQS0), (IEN | PTD | DIS | M0)) /*SDRC_DQS0*/\ + MUX_VAL(CP(SDRC_DQS1), (IEN | PTD | DIS | M0)) /*SDRC_DQS1*/\ + MUX_VAL(CP(SDRC_DQS2), (IEN | PTD | DIS | M0)) /*SDRC_DQS2*/\ + MUX_VAL(CP(SDRC_DQS3), (IEN | PTD | DIS | M0)) /*SDRC_DQS3*/\ +/* GPMC */\ + MUX_VAL(CP(GPMC_A1), (IDIS | PTD | DIS | M0)) /*GPMC_A1*/\ + MUX_VAL(CP(GPMC_A2), (IDIS | PTD | DIS | M0)) /*GPMC_A2*/\ + MUX_VAL(CP(GPMC_A3), (IDIS | PTD | DIS | M0)) /*GPMC_A3*/\ + MUX_VAL(CP(GPMC_A4), (IDIS | PTD | DIS | M0)) /*GPMC_A4*/\ + MUX_VAL(CP(GPMC_A5), (IDIS | PTD | DIS | M0)) /*GPMC_A5*/\ + MUX_VAL(CP(GPMC_A6), (IDIS | PTD | DIS | M0)) /*GPMC_A6*/\ + MUX_VAL(CP(GPMC_A7), (IDIS | PTD | DIS | M0)) /*GPMC_A7*/\ + MUX_VAL(CP(GPMC_A8), (IDIS | PTD | DIS | M0)) /*GPMC_A8*/\ + MUX_VAL(CP(GPMC_A9), (IDIS | PTD | DIS | M0)) /*GPMC_A9*/\ + MUX_VAL(CP(GPMC_A10), (IDIS | PTD | DIS | M0)) /*GPMC_A10*/\ + MUX_VAL(CP(GPMC_D0), (IEN | PTD | DIS | M0)) /*GPMC_D0*/\ + MUX_VAL(CP(GPMC_D1), (IEN | PTD | DIS | M0)) /*GPMC_D1*/\ + MUX_VAL(CP(GPMC_D2), (IEN | PTD | DIS | M0)) /*GPMC_D2*/\ + MUX_VAL(CP(GPMC_D3), (IEN | PTD | DIS | M0)) /*GPMC_D3*/\ + MUX_VAL(CP(GPMC_D4), (IEN | PTD | DIS | M0)) /*GPMC_D4*/\ + MUX_VAL(CP(GPMC_D5), (IEN | PTD | DIS | M0)) /*GPMC_D5*/\ + MUX_VAL(CP(GPMC_D6), (IEN | PTD | DIS | M0)) /*GPMC_D6*/\ + MUX_VAL(CP(GPMC_D7), (IEN | PTD | DIS | M0)) /*GPMC_D7*/\ + MUX_VAL(CP(GPMC_D8), (IEN | PTD | DIS | M0)) /*GPMC_D8*/\ + MUX_VAL(CP(GPMC_D9), (IEN | PTD | DIS | M0)) /*GPMC_D9*/\ + MUX_VAL(CP(GPMC_D10), (IEN | PTD | DIS | M0)) /*GPMC_D10*/\ + MUX_VAL(CP(GPMC_D11), (IEN | PTD | DIS | M0)) /*GPMC_D11*/\ + MUX_VAL(CP(GPMC_D12), (IEN | PTD | DIS | M0)) /*GPMC_D12*/\ + MUX_VAL(CP(GPMC_D13), (IEN | PTD | DIS | M0)) /*GPMC_D13*/\ + MUX_VAL(CP(GPMC_D14), (IEN | PTD | DIS | M0)) /*GPMC_D14*/\ + MUX_VAL(CP(GPMC_D15), (IEN | PTD | DIS | M0)) /*GPMC_D15*/\ + MUX_VAL(CP(GPMC_NCS0), (IDIS | PTU | EN | M0)) /*GPMC_nCS0*/\ + MUX_VAL(CP(GPMC_NCS1), (IDIS | PTU | EN | M0)) /*GPMC_nCS1*/\ + MUX_VAL(CP(GPMC_NCS2), (IDIS | PTU | EN | M0)) /*GPMC_nCS2*/\ + MUX_VAL(CP(GPMC_NCS3), (IDIS | PTU | EN | M0)) /*GPMC_nCS3*/\ + MUX_VAL(CP(GPMC_NCS4), (IDIS | PTU | EN | M0)) /*GPMC_nCS4*/\ + MUX_VAL(CP(GPMC_NCS5), (IDIS | PTD | DIS | M0)) /*GPMC_nCS5*/\ + MUX_VAL(CP(GPMC_NCS6), (IEN | PTD | DIS | M1)) /*nDMA_REQ2*/\ + MUX_VAL(CP(GPMC_NCS7), (IEN | PTU | EN | M1)) /*nDMA_REQ3*/\ + MUX_VAL(CP(GPMC_NBE1), (IEN | PTD | DIS | M0)) /*GPMC_nBE1*/\ + MUX_VAL(CP(GPMC_WAIT2), (IEN | PTU | EN | M0)) /*GPMC_WAIT2*/\ + MUX_VAL(CP(GPMC_WAIT3), (IEN | PTU | EN | M0)) /*GPMC_WAIT3*/\ + MUX_VAL(CP(GPMC_CLK), (IDIS | PTD | DIS | M0)) /*GPMC_CLK*/\ + MUX_VAL(CP(GPMC_NADV_ALE), (IDIS | PTD | DIS | M0)) /*GPMC_nADV*/\ + MUX_VAL(CP(GPMC_NOE), (IDIS | PTD | DIS | M0)) /*GPMC_nOE*/\ + MUX_VAL(CP(GPMC_NWE), (IDIS | PTD | DIS | M0)) /*GPMC_nWE*/\ + MUX_VAL(CP(GPMC_NBE0_CLE), (IDIS | PTD | DIS | M0)) /*GPMC_nBE0*/\ + MUX_VAL(CP(GPMC_NWP), (IEN | PTD | DIS | M0)) /*GPMC_nWP*/\ + MUX_VAL(CP(GPMC_WAIT0), (IEN | PTU | EN | M0)) /*GPMC_WAIT0*/\ + MUX_VAL(CP(GPMC_WAIT1), (IEN | PTU | EN | M0)) /*GPMC_WAIT1*/\ +/* DSS */\ + MUX_VAL(CP(DSS_PCLK), (IDIS | PTD | DIS | M0)) /*DSS_PCLK*/\ + MUX_VAL(CP(DSS_HSYNC), (IDIS | PTD | DIS | M0)) /*DSS_HSYNC*/\ + MUX_VAL(CP(DSS_VSYNC), (IDIS | PTD | DIS | M0)) /*DSS_VSYNC*/\ + MUX_VAL(CP(DSS_ACBIAS), (IDIS | PTD | DIS | M0)) /*DSS_ACBIAS*/\ + MUX_VAL(CP(DSS_DATA0), (IDIS | PTD | DIS | M0)) /*DSS_DATA0*/\ + MUX_VAL(CP(DSS_DATA1), (IDIS | PTD | DIS | M0)) /*DSS_DATA1*/\ + MUX_VAL(CP(DSS_DATA2), (IDIS | PTD | DIS | M0)) /*DSS_DATA2*/\ + MUX_VAL(CP(DSS_DATA3), (IDIS | PTD | DIS | M0)) /*DSS_DATA3*/\ + MUX_VAL(CP(DSS_DATA4), (IDIS | PTD | DIS | M0)) /*DSS_DATA4*/\ + MUX_VAL(CP(DSS_DATA5), (IDIS | PTD | DIS | M0)) /*DSS_DATA5*/\ + MUX_VAL(CP(DSS_DATA6), (IDIS | PTD | DIS | M0)) /*DSS_DATA6*/\ + MUX_VAL(CP(DSS_DATA7), (IDIS | PTD | DIS | M0)) /*DSS_DATA7*/\ + MUX_VAL(CP(DSS_DATA8), (IDIS | PTD | DIS | M0)) /*DSS_DATA8*/\ + MUX_VAL(CP(DSS_DATA9), (IDIS | PTD | DIS | M0)) /*DSS_DATA9*/\ + MUX_VAL(CP(DSS_DATA10), (IDIS | PTD | DIS | M0)) /*DSS_DATA10*/\ + MUX_VAL(CP(DSS_DATA11), (IDIS | PTD | DIS | M0)) /*DSS_DATA11*/\ + MUX_VAL(CP(DSS_DATA12), (IDIS | PTD | DIS | M0)) /*DSS_DATA12*/\ + MUX_VAL(CP(DSS_DATA13), (IDIS | PTD | DIS | M0)) /*DSS_DATA13*/\ + MUX_VAL(CP(DSS_DATA14), (IDIS | PTD | DIS | M0)) /*DSS_DATA14*/\ + MUX_VAL(CP(DSS_DATA15), (IDIS | PTD | DIS | M0)) /*DSS_DATA15*/\ + MUX_VAL(CP(DSS_DATA16), (IDIS | PTD | DIS | M0)) /*DSS_DATA16*/\ + MUX_VAL(CP(DSS_DATA17), (IDIS | PTD | DIS | M0)) /*DSS_DATA17*/\ + MUX_VAL(CP(DSS_DATA18), (IDIS | PTD | DIS | M0)) /*DSS_DATA18*/\ + MUX_VAL(CP(DSS_DATA19), (IDIS | PTD | DIS | M0)) /*DSS_DATA19*/\ + MUX_VAL(CP(DSS_DATA20), (IDIS | PTD | DIS | M0)) /*DSS_DATA20*/\ + MUX_VAL(CP(DSS_DATA21), (IDIS | PTD | DIS | M0)) /*DSS_DATA21*/\ + MUX_VAL(CP(DSS_DATA22), (IDIS | PTD | DIS | M0)) /*DSS_DATA22*/\ + MUX_VAL(CP(DSS_DATA23), (IDIS | PTD | DIS | M0)) /*DSS_DATA23*/\ +/* CAMERA */\ + MUX_VAL(CP(CAM_HS), (IEN | PTU | EN | M0)) /*CAM_HS*/\ + MUX_VAL(CP(CAM_VS), (IEN | PTU | EN | M0)) /*CAM_VS*/\ + MUX_VAL(CP(CAM_XCLKA), (IDIS | PTD | DIS | M0)) /*CAM_XCLKA*/\ + MUX_VAL(CP(CAM_PCLK), (IEN | PTU | EN | M0)) /*CAM_PCLK*/\ + MUX_VAL(CP(CAM_FLD), (IDIS | PTD | DIS | M4)) /*GPIO_98*/\ + MUX_VAL(CP(CAM_D0), (IEN | PTD | DIS | M0)) /*CAM_D0*/\ + MUX_VAL(CP(CAM_D1), (IEN | PTD | DIS | M0)) /*CAM_D1*/\ + MUX_VAL(CP(CAM_D2), (IEN | PTD | DIS | M0)) /*CAM_D2*/\ + MUX_VAL(CP(CAM_D3), (IEN | PTD | DIS | M0)) /*CAM_D3*/\ + MUX_VAL(CP(CAM_D4), (IEN | PTD | DIS | M0)) /*CAM_D4*/\ + MUX_VAL(CP(CAM_D5), (IEN | PTD | DIS | M0)) /*CAM_D5*/\ + MUX_VAL(CP(CAM_D6), (IEN | PTD | DIS | M0)) /*CAM_D6*/\ + MUX_VAL(CP(CAM_D7), (IEN | PTD | DIS | M0)) /*CAM_D7*/\ + MUX_VAL(CP(CAM_D8), (IEN | PTD | DIS | M0)) /*CAM_D8*/\ + MUX_VAL(CP(CAM_D9), (IEN | PTD | DIS | M0)) /*CAM_D9*/\ + MUX_VAL(CP(CAM_D10), (IEN | PTD | DIS | M0)) /*CAM_D10*/\ + MUX_VAL(CP(CAM_D11), (IEN | PTD | DIS | M0)) /*CAM_D11*/\ + MUX_VAL(CP(CAM_XCLKB), (IDIS | PTD | DIS | M0)) /*CAM_XCLKB*/\ + MUX_VAL(CP(CAM_WEN), (IEN | PTD | DIS | M4)) /*GPIO_167*/\ + MUX_VAL(CP(CAM_STROBE), (IDIS | PTD | DIS | M0)) /*CAM_STROBE*/\ + MUX_VAL(CP(CSI2_DX0), (IEN | PTD | DIS | M0)) /*CSI2_DX0*/\ + MUX_VAL(CP(CSI2_DY0), (IEN | PTD | DIS | M0)) /*CSI2_DY0*/\ + MUX_VAL(CP(CSI2_DX1), (IEN | PTD | DIS | M0)) /*CSI2_DX1*/\ + MUX_VAL(CP(CSI2_DY1), (IEN | PTD | DIS | M0)) /*CSI2_DY1*/\ +/* Audio Interface */\ + MUX_VAL(CP(MCBSP2_FSX), (IEN | PTD | DIS | M0)) /*McBSP2_FSX*/\ + MUX_VAL(CP(MCBSP2_CLKX), (IEN | PTD | DIS | M0)) /*McBSP2_CLK*/\ + MUX_VAL(CP(MCBSP2_DR), (IEN | PTD | DIS | M0)) /*McBSP2_DR*/\ + MUX_VAL(CP(MCBSP2_DX), (IDIS | PTD | DIS | M0)) /*McBSP2_DX*/\ +/* Expansion card */\ + MUX_VAL(CP(MMC1_CLK), (IDIS | PTU | EN | M0)) /*MMC1_CLK*/\ + MUX_VAL(CP(MMC1_CMD), (IEN | PTU | EN | M0)) /*MMC1_CMD*/\ + MUX_VAL(CP(MMC1_DAT0), (IEN | PTU | EN | M0)) /*MMC1_DAT0*/\ + MUX_VAL(CP(MMC1_DAT1), (IEN | PTU | EN | M0)) /*MMC1_DAT1*/\ + MUX_VAL(CP(MMC1_DAT2), (IEN | PTU | EN | M0)) /*MMC1_DAT2*/\ + MUX_VAL(CP(MMC1_DAT3), (IEN | PTU | EN | M0)) /*MMC1_DAT3*/\ + MUX_VAL(CP(MMC1_DAT4), (IEN | PTU | EN | M0)) /*MMC1_DAT4*/\ + MUX_VAL(CP(MMC1_DAT5), (IEN | PTU | EN | M0)) /*MMC1_DAT5*/\ + MUX_VAL(CP(MMC1_DAT6), (IEN | PTU | EN | M0)) /*MMC1_DAT6*/\ + MUX_VAL(CP(MMC1_DAT7), (IEN | PTU | EN | M0)) /*MMC1_DAT7*/\ +/* Wireless LAN */\ + MUX_VAL(CP(MMC2_CLK), (IEN | PTU | EN | M4)) /*GPIO_130*/\ + MUX_VAL(CP(MMC2_CMD), (IEN | PTU | EN | M4)) /*GPIO_131*/\ + MUX_VAL(CP(MMC2_DAT0), (IEN | PTU | EN | M4)) /*GPIO_132*/\ + MUX_VAL(CP(MMC2_DAT1), (IEN | PTU | EN | M4)) /*GPIO_133*/\ + MUX_VAL(CP(MMC2_DAT2), (IEN | PTU | EN | M4)) /*GPIO_134*/\ + MUX_VAL(CP(MMC2_DAT3), (IEN | PTU | EN | M4)) /*GPIO_135*/\ + MUX_VAL(CP(MMC2_DAT4), (IEN | PTU | EN | M4)) /*GPIO_136*/\ + MUX_VAL(CP(MMC2_DAT5), (IEN | PTU | EN | M4)) /*GPIO_137*/\ + MUX_VAL(CP(MMC2_DAT6), (IEN | PTU | EN | M4)) /*GPIO_138*/\ + MUX_VAL(CP(MMC2_DAT7), (IEN | PTU | EN | M4)) /*GPIO_139*/\ +/* Bluetooth */\ + MUX_VAL(CP(MCBSP3_DX), (IEN | PTD | DIS | M1)) /*UART2_CTS*/\ + MUX_VAL(CP(MCBSP3_DR), (IDIS | PTD | DIS | M1)) /*UART2_RTS*/\ + MUX_VAL(CP(MCBSP3_CLKX), (IDIS | PTD | DIS | M1)) /*UART2_TX*/\ + MUX_VAL(CP(MCBSP3_FSX), (IEN | PTD | DIS | M1)) /*UART2_RX*/\ + MUX_VAL(CP(UART2_CTS), (IEN | PTD | DIS | M4)) /*GPIO_144*/\ + MUX_VAL(CP(UART2_RTS), (IEN | PTD | DIS | M4)) /*GPIO_145*/\ + MUX_VAL(CP(UART2_TX), (IEN | PTD | DIS | M4)) /*GPIO_146*/\ + MUX_VAL(CP(UART2_RX), (IEN | PTD | DIS | M4)) /*GPIO_147*/\ +/* Modem Interface */\ + MUX_VAL(CP(UART1_TX), (IDIS | PTD | DIS | M0)) /*UART1_TX*/\ + MUX_VAL(CP(UART1_RTS), (IDIS | PTD | DIS | M4)) /*GPIO_149*/\ + MUX_VAL(CP(UART1_CTS), (IDIS | PTD | DIS | M4)) /*GPIO_150*/\ + MUX_VAL(CP(UART1_RX), (IEN | PTD | DIS | M0)) /*UART1_RX*/\ + MUX_VAL(CP(MCBSP4_CLKX), (IEN | PTD | DIS | M1)) /*SSI1_DAT*/\ + MUX_VAL(CP(MCBSP4_DR), (IEN | PTD | DIS | M1)) /*SSI1_FLAG*/\ + MUX_VAL(CP(MCBSP4_DX), (IEN | PTD | DIS | M1)) /*SSI1_RDY*/\ + MUX_VAL(CP(MCBSP4_FSX), (IEN | PTD | DIS | M1)) /*SSI1_WAKE*/\ + MUX_VAL(CP(MCBSP1_CLKR), (IDIS | PTD | DIS | M4)) /*GPIO_156*/\ + MUX_VAL(CP(MCBSP1_FSR), (IDIS | PTU | EN | M4)) /*GPIO_157*/\ + MUX_VAL(CP(MCBSP1_DX), (IDIS | PTD | DIS | M4)) /*GPIO_158*/\ + MUX_VAL(CP(MCBSP1_DR), (IDIS | PTD | DIS | M4)) /*GPIO_159*/\ + MUX_VAL(CP(MCBSP_CLKS), (IEN | PTU | DIS | M0)) /*McBSP_CLKS*/\ + MUX_VAL(CP(MCBSP1_FSX), (IDIS | PTD | DIS | M4)) /*GPIO_161*/\ + MUX_VAL(CP(MCBSP1_CLKX), (IDIS | PTD | DIS | M4)) /*GPIO_162*/\ +/* Serial Interface */\ + MUX_VAL(CP(UART3_CTS_RCTX), (IEN | PTD | EN | M0)) /*UART3_CTS*/\ + MUX_VAL(CP(UART3_RTS_SD), (IDIS | PTD | DIS | M0)) /*UART3_RTS*/\ + MUX_VAL(CP(UART3_RX_IRRX), (IEN | PTD | DIS | M0)) /*UART3_RX*/\ + MUX_VAL(CP(UART3_TX_IRTX), (IDIS | PTD | DIS | M0)) /*UART3_TX*/\ + MUX_VAL(CP(HSUSB0_CLK), (IEN | PTD | DIS | M0)) /*HSUSB0_CLK*/\ + MUX_VAL(CP(HSUSB0_STP), (IDIS | PTU | EN | M0)) /*HSUSB0_STP*/\ + MUX_VAL(CP(HSUSB0_DIR), (IEN | PTD | DIS | M0)) /*HSUSB0_DIR*/\ + MUX_VAL(CP(HSUSB0_NXT), (IEN | PTD | DIS | M0)) /*HSUSB0_NXT*/\ + MUX_VAL(CP(HSUSB0_DATA0), (IEN | PTD | DIS | M0)) /*HSUSB0_DA0*/\ + MUX_VAL(CP(HSUSB0_DATA1), (IEN | PTD | DIS | M0)) /*HSUSB0_DA1*/\ + MUX_VAL(CP(HSUSB0_DATA2), (IEN | PTD | DIS | M0)) /*HSUSB0_DA2*/\ + MUX_VAL(CP(HSUSB0_DATA3), (IEN | PTD | DIS | M0)) /*HSUSB0_DA3*/\ + MUX_VAL(CP(HSUSB0_DATA4), (IEN | PTD | DIS | M0)) /*HSUSB0_DA4*/\ + MUX_VAL(CP(HSUSB0_DATA5), (IEN | PTD | DIS | M0)) /*HSUSB0_DA5*/\ + MUX_VAL(CP(HSUSB0_DATA6), (IEN | PTD | DIS | M0)) /*HSUSB0_DA6*/\ + MUX_VAL(CP(HSUSB0_DATA7), (IEN | PTD | DIS | M0)) /*HSUSB0_DA7*/\ + MUX_VAL(CP(I2C1_SCL), (IEN | PTU | EN | M0)) /*I2C1_SCL*/\ + MUX_VAL(CP(I2C1_SDA), (IEN | PTU | EN | M0)) /*I2C1_SDA*/\ + MUX_VAL(CP(I2C2_SCL), (IEN | PTU | EN | M4)) /*GPIO_168*/\ + MUX_VAL(CP(I2C2_SDA), (IEN | PTU | EN | M4)) /*GPIO_183*/\ + MUX_VAL(CP(I2C3_SCL), (IEN | PTU | EN | M0)) /*I2C3_SCL*/\ + MUX_VAL(CP(I2C3_SDA), (IEN | PTU | EN | M0)) /*I2C3_SDA*/\ + MUX_VAL(CP(I2C4_SCL), (IEN | PTU | EN | M0)) /*I2C4_SCL*/\ + MUX_VAL(CP(I2C4_SDA), (IEN | PTU | EN | M0)) /*I2C4_SDA*/\ + MUX_VAL(CP(HDQ_SIO), (IDIS | PTU | EN | M4)) /*GPIO_170*/\ + MUX_VAL(CP(MCSPI1_CLK), (IEN | PTU | EN | M4)) /*GPIO_171*/\ + MUX_VAL(CP(MCSPI1_SIMO), (IEN | PTU | EN | M4)) /*GPIO_172*/\ + MUX_VAL(CP(MCSPI1_SOMI), (IEN | PTD | DIS | M0)) /*McSPI1_SOM*/\ + MUX_VAL(CP(MCSPI1_CS0), (IEN | PTD | EN | M0)) /*McSPI1_CS0*/\ + MUX_VAL(CP(MCSPI1_CS1), (IDIS | PTD | EN | M0)) /*McSPI1_CS1*/\ + MUX_VAL(CP(MCSPI1_CS2), (IDIS | PTD | DIS | M4)) /*GPIO_176*/\ +/* USB EHCI (port 2) */\ + MUX_VAL(CP(MCSPI1_CS3), (IEN | PTU | DIS | M3)) /*HSUSB2_DA2*/\ + MUX_VAL(CP(MCSPI2_CLK), (IEN | PTU | DIS | M3)) /*HSUSB2_DA7*/\ + MUX_VAL(CP(MCSPI2_SIMO), (IEN | PTU | DIS | M3)) /*HSUSB2_DA4*/\ + MUX_VAL(CP(MCSPI2_SOMI), (IEN | PTU | DIS | M3)) /*HSUSB2_DA5*/\ + MUX_VAL(CP(MCSPI2_CS0), (IEN | PTU | DIS | M3)) /*HSUSB2_DA6*/\ + MUX_VAL(CP(MCSPI2_CS1), (IEN | PTU | DIS | M3)) /*HSUSB2_DA3*/\ + MUX_VAL(CP(ETK_D10_ES2), (IDIS | PTU | DIS | M3)) /*HSUSB2_CLK*/\ + MUX_VAL(CP(ETK_D11_ES2), (IDIS | PTU | DIS | M3)) /*HSUSB2_STP*/\ + MUX_VAL(CP(ETK_D12_ES2), (IEN | PTU | DIS | M3)) /*HSUSB2_DIR*/\ + MUX_VAL(CP(ETK_D13_ES2), (IEN | PTU | DIS | M3)) /*HSUSB2_NXT*/\ + MUX_VAL(CP(ETK_D14_ES2), (IEN | PTU | DIS | M3)) /*HSUSB2_DA0*/\ + MUX_VAL(CP(ETK_D15_ES2), (IEN | PTU | DIS | M3)) /*HSUSB2_DA1*/\ +/* Control and debug */\ + MUX_VAL(CP(SYS_32K), (IEN | PTD | DIS | M0)) /*SYS_32K*/\ + MUX_VAL(CP(SYS_CLKREQ), (IEN | PTD | DIS | M0)) /*SYS_CLKREQ*/\ + MUX_VAL(CP(SYS_NIRQ), (IEN | PTU | EN | M0)) /*SYS_nIRQ*/\ + MUX_VAL(CP(SYS_BOOT0), (IEN | PTD | DIS | M4)) /*GPIO_2*/\ + MUX_VAL(CP(SYS_BOOT1), (IEN | PTD | DIS | M4)) /*GPIO_3*/\ + MUX_VAL(CP(SYS_BOOT2), (IEN | PTD | DIS | M4)) /*MMC1_WP*/\ + MUX_VAL(CP(SYS_BOOT3), (IEN | PTD | DIS | M4)) /*GPIO_5*/\ + MUX_VAL(CP(SYS_BOOT4), (IEN | PTD | DIS | M4)) /*GPIO_6*/\ + MUX_VAL(CP(SYS_BOOT5), (IEN | PTD | DIS | M4)) /*GPIO_7*/\ + MUX_VAL(CP(SYS_BOOT6), (IDIS | PTD | DIS | M4)) /*GPIO_8*/\ + MUX_VAL(CP(SYS_OFF_MODE), (IEN | PTD | DIS | M0)) /*SYS_OFF_MD*/\ + MUX_VAL(CP(SYS_CLKOUT1), (IEN | PTD | DIS | M0)) /*SYS_CLKOUT*/\ + MUX_VAL(CP(SYS_CLKOUT2), (IEN | PTU | EN | M4)) /*GPIO_186*/\ + MUX_VAL(CP(ETK_CLK_ES2), (IDIS | PTU | EN | M3)) /*HSUSB1_STP*/\ + MUX_VAL(CP(ETK_CTL_ES2), (IDIS | PTU | DIS | M3)) /*HSUSB1_CLK*/\ + MUX_VAL(CP(ETK_D0_ES2), (IEN | PTU | DIS | M3)) /*HSUSB1_DA0*/\ + MUX_VAL(CP(ETK_D1_ES2), (IEN | PTU | DIS | M3)) /*HSUSB1_DA1*/\ + MUX_VAL(CP(ETK_D2_ES2), (IEN | PTU | DIS | M3)) /*HSUSB1_DA2*/\ + MUX_VAL(CP(ETK_D3_ES2), (IEN | PTU | DIS | M3)) /*HSUSB1_DA7*/\ + MUX_VAL(CP(ETK_D4_ES2), (IEN | PTU | DIS | M3)) /*HSUSB1_DA4*/\ + MUX_VAL(CP(ETK_D5_ES2), (IEN | PTU | DIS | M3)) /*HSUSB1_DA5*/\ + MUX_VAL(CP(ETK_D6_ES2), (IEN | PTU | DIS | M3)) /*HSUSB1_DA6*/\ + MUX_VAL(CP(ETK_D7_ES2), (IEN | PTU | DIS | M3)) /*HSUSB1_DA3*/\ + MUX_VAL(CP(ETK_D8_ES2), (IEN | PTU | DIS | M3)) /*HSUSB1_DIR*/\ + MUX_VAL(CP(ETK_D9_ES2), (IEN | PTU | DIS | M3)) /*HSUSB1_NXT*/\ + MUX_VAL(CP(D2D_MCAD1), (IEN | PTD | EN | M0)) /*d2d_mcad1*/\ + MUX_VAL(CP(D2D_MCAD2), (IEN | PTD | EN | M0)) /*d2d_mcad2*/\ + MUX_VAL(CP(D2D_MCAD3), (IEN | PTD | EN | M0)) /*d2d_mcad3*/\ + MUX_VAL(CP(D2D_MCAD4), (IEN | PTD | EN | M0)) /*d2d_mcad4*/\ + MUX_VAL(CP(D2D_MCAD5), (IEN | PTD | EN | M0)) /*d2d_mcad5*/\ + MUX_VAL(CP(D2D_MCAD6), (IEN | PTD | EN | M0)) /*d2d_mcad6*/\ + MUX_VAL(CP(D2D_MCAD7), (IEN | PTD | EN | M0)) /*d2d_mcad7*/\ + MUX_VAL(CP(D2D_MCAD8), (IEN | PTD | EN | M0)) /*d2d_mcad8*/\ + MUX_VAL(CP(D2D_MCAD9), (IEN | PTD | EN | M0)) /*d2d_mcad9*/\ + MUX_VAL(CP(D2D_MCAD10), (IEN | PTD | EN | M0)) /*d2d_mcad10*/\ + MUX_VAL(CP(D2D_MCAD11), (IEN | PTD | EN | M0)) /*d2d_mcad11*/\ + MUX_VAL(CP(D2D_MCAD12), (IEN | PTD | EN | M0)) /*d2d_mcad12*/\ + MUX_VAL(CP(D2D_MCAD13), (IEN | PTD | EN | M0)) /*d2d_mcad13*/\ + MUX_VAL(CP(D2D_MCAD14), (IEN | PTD | EN | M0)) /*d2d_mcad14*/\ + MUX_VAL(CP(D2D_MCAD15), (IEN | PTD | EN | M0)) /*d2d_mcad15*/\ + MUX_VAL(CP(D2D_MCAD16), (IEN | PTD | EN | M0)) /*d2d_mcad16*/\ + MUX_VAL(CP(D2D_MCAD17), (IEN | PTD | EN | M0)) /*d2d_mcad17*/\ + MUX_VAL(CP(D2D_MCAD18), (IEN | PTD | EN | M0)) /*d2d_mcad18*/\ + MUX_VAL(CP(D2D_MCAD19), (IEN | PTD | EN | M0)) /*d2d_mcad19*/\ + MUX_VAL(CP(D2D_MCAD20), (IEN | PTD | EN | M0)) /*d2d_mcad20*/\ + MUX_VAL(CP(D2D_MCAD21), (IEN | PTD | EN | M0)) /*d2d_mcad21*/\ + MUX_VAL(CP(D2D_MCAD22), (IEN | PTD | EN | M0)) /*d2d_mcad22*/\ + MUX_VAL(CP(D2D_MCAD23), (IEN | PTD | EN | M0)) /*d2d_mcad23*/\ + MUX_VAL(CP(D2D_MCAD24), (IEN | PTD | EN | M0)) /*d2d_mcad24*/\ + MUX_VAL(CP(D2D_MCAD25), (IEN | PTD | EN | M0)) /*d2d_mcad25*/\ + MUX_VAL(CP(D2D_MCAD26), (IEN | PTD | EN | M0)) /*d2d_mcad26*/\ + MUX_VAL(CP(D2D_MCAD27), (IEN | PTD | EN | M0)) /*d2d_mcad27*/\ + MUX_VAL(CP(D2D_MCAD28), (IEN | PTD | EN | M0)) /*d2d_mcad28*/\ + MUX_VAL(CP(D2D_MCAD29), (IEN | PTD | EN | M0)) /*d2d_mcad29*/\ + MUX_VAL(CP(D2D_MCAD30), (IEN | PTD | EN | M0)) /*d2d_mcad30*/\ + MUX_VAL(CP(D2D_MCAD31), (IEN | PTD | EN | M0)) /*d2d_mcad31*/\ + MUX_VAL(CP(D2D_MCAD32), (IEN | PTD | EN | M0)) /*d2d_mcad32*/\ + MUX_VAL(CP(D2D_MCAD33), (IEN | PTD | EN | M0)) /*d2d_mcad33*/\ + MUX_VAL(CP(D2D_MCAD34), (IEN | PTD | EN | M0)) /*d2d_mcad34*/\ + MUX_VAL(CP(D2D_MCAD35), (IEN | PTD | EN | M0)) /*d2d_mcad35*/\ + MUX_VAL(CP(D2D_MCAD36), (IEN | PTD | EN | M0)) /*d2d_mcad36*/\ + MUX_VAL(CP(D2D_CLK26MI), (IEN | PTD | DIS | M0)) /*d2d_clk26m*/\ + MUX_VAL(CP(D2D_NRESPWRON), (IEN | PTD | EN | M0)) /*d2d_nrespw*/\ + MUX_VAL(CP(D2D_NRESWARM), (IEN | PTU | EN | M0)) /*d2d_nreswa*/\ + MUX_VAL(CP(D2D_ARM9NIRQ), (IEN | PTD | DIS | M0)) /*d2d_arm9ni*/\ + MUX_VAL(CP(D2D_UMA2P6FIQ), (IEN | PTD | DIS | M0)) /*d2d_uma2p6*/\ + MUX_VAL(CP(D2D_SPINT), (IEN | PTD | EN | M0)) /*d2d_spint*/\ + MUX_VAL(CP(D2D_FRINT), (IEN | PTD | EN | M0)) /*d2d_frint*/\ + MUX_VAL(CP(D2D_DMAREQ0), (IEN | PTD | DIS | M0)) /*d2d_dmare0*/\ + MUX_VAL(CP(D2D_DMAREQ1), (IEN | PTD | DIS | M0)) /*d2d_dmare1*/\ + MUX_VAL(CP(D2D_DMAREQ2), (IEN | PTD | DIS | M0)) /*d2d_dmare2*/\ + MUX_VAL(CP(D2D_DMAREQ3), (IEN | PTD | DIS | M0)) /*d2d_dmare3*/\ + MUX_VAL(CP(D2D_N3GTRST), (IEN | PTD | DIS | M0)) /*d2d_n3gtrs*/\ + MUX_VAL(CP(D2D_N3GTDI), (IEN | PTD | DIS | M0)) /*d2d_n3gtdi*/\ + MUX_VAL(CP(D2D_N3GTDO), (IEN | PTD | DIS | M0)) /*d2d_n3gtdo*/\ + MUX_VAL(CP(D2D_N3GTMS), (IEN | PTD | DIS | M0)) /*d2d_n3gtms*/\ + MUX_VAL(CP(D2D_N3GTCK), (IEN | PTD | DIS | M0)) /*d2d_n3gtck*/\ + MUX_VAL(CP(D2D_N3GRTCK), (IEN | PTD | DIS | M0)) /*d2d_n3grtc*/\ + MUX_VAL(CP(D2D_MSTDBY), (IEN | PTU | EN | M0)) /*d2d_mstdby*/\ + MUX_VAL(CP(D2D_SWAKEUP), (IEN | PTD | EN | M0)) /*d2d_swakeu*/\ + MUX_VAL(CP(D2D_IDLEREQ), (IEN | PTD | DIS | M0)) /*d2d_idlere*/\ + MUX_VAL(CP(D2D_IDLEACK), (IEN | PTU | EN | M0)) /*d2d_idleac*/\ + MUX_VAL(CP(D2D_MWRITE), (IEN | PTD | DIS | M0)) /*d2d_mwrite*/\ + MUX_VAL(CP(D2D_SWRITE), (IEN | PTD | DIS | M0)) /*d2d_swrite*/\ + MUX_VAL(CP(D2D_MREAD), (IEN | PTD | DIS | M0)) /*d2d_mread*/\ + MUX_VAL(CP(D2D_SREAD), (IEN | PTD | DIS | M0)) /*d2d_sread*/\ + MUX_VAL(CP(D2D_MBUSFLAG), (IEN | PTD | DIS | M0)) /*d2d_mbusfl*/\ + MUX_VAL(CP(D2D_SBUSFLAG), (IEN | PTD | DIS | M0)) /*d2d_sbusfl*/\ + MUX_VAL(CP(SDRC_CKE0), (IDIS | PTU | EN | M0)) /*sdrc_cke0*/\ + MUX_VAL(CP(SDRC_CKE1), (IDIS | PTU | EN | M0)) /*sdrc_cke1*/ + +#define MUX_RX51_C() \ + MUX_VAL(CP(MCBSP3_DX), (IEN | PTD | DIS | M4)) /*GPIO_140*/\ + MUX_VAL(CP(MCBSP3_DR), (IEN | PTD | DIS | M4)) /*GPIO_142*/\ + MUX_VAL(CP(MCBSP3_CLKX), (IEN | PTD | DIS | M4)) /*GPIO_141*/\ + MUX_VAL(CP(UART2_CTS), (IEN | PTU | EN | M0)) /*UART2_CTS*/\ + MUX_VAL(CP(UART2_RTS), (IDIS | PTD | DIS | M0)) /*UART2_RTS*/\ + MUX_VAL(CP(UART2_TX), (IDIS | PTD | DIS | M0)) /*UART2_TX*/ + +#endif diff --git a/board/nokia/rx51/tag_omap.h b/board/nokia/rx51/tag_omap.h new file mode 100644 index 0000000..60fa26f --- /dev/null +++ b/board/nokia/rx51/tag_omap.h @@ -0,0 +1,311 @@ +/* + * (C) Copyright 2011-2012 + * Pali Rohár pali.rohar@gmail.com + * + * (C) Copyright 2011 + * marcel@mesa.nl, Mesa Consulting B.V. + * + * (C) Copyright 2004-2005 + * Nokia Corporation + * + * 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 as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + + +/* + * Code copied from maemo kernel 2.6.28 file + * arch/arm/plat-omap/include/mach/board.h + * + * Information structures for board-specific data + * + * Copyright (C) 2004 Nokia Corporation + * Written by Juha Yrjölä juha.yrjola@nokia.com + */ + +/* Different peripheral ids */ +#define OMAP_TAG_CLOCK 0x4f01 +#define OMAP_TAG_SERIAL_CONSOLE 0x4f03 +#define OMAP_TAG_USB 0x4f04 +#define OMAP_TAG_LCD 0x4f05 +#define OMAP_TAG_GPIO_SWITCH 0x4f06 +#define OMAP_TAG_UART 0x4f07 +#define OMAP_TAG_FBMEM 0x4f08 +#define OMAP_TAG_STI_CONSOLE 0x4f09 +#define OMAP_TAG_CAMERA_SENSOR 0x4f0a +#define OMAP_TAG_PARTITION 0x4f0b +#define OMAP_TAG_TEA5761 0x4f10 +#define OMAP_TAG_TMP105 0x4f11 + +#define OMAP_TAG_BOOT_REASON 0x4f80 +#define OMAP_TAG_FLASH_PART_STR 0x4f81 +#define OMAP_TAG_VERSION_STR 0x4f82 + +#define OMAP_TAG_NOKIA_BT 0x4e01 +#define OMAP_TAG_WLAN_CX3110X 0x4e02 +#define OMAP_TAG_CBUS 0x4e03 +#define OMAP_TAG_EM_ASIC_BB5 0x4e04 + + +struct omap_clock_config { + /* 0 for 12 MHz, 1 for 13 MHz and 2 for 19.2 MHz */ + u8 system_clock_type; +}; + +struct omap_serial_console_config { + u8 console_uart; + u32 console_speed; +}; + +struct omap_sti_console_config { + unsigned enable:1; + u8 channel; +}; + +struct omap_usb_config { + /* Configure drivers according to the connectors on your board: + * - "A" connector (rectagular) + * ... for host/OHCI use, set "register_host". + * - "B" connector (squarish) or "Mini-B" + * ... for device/gadget use, set "register_dev". + * - "Mini-AB" connector (very similar to Mini-B) + * ... for OTG use as device OR host, initialize "otg" + */ + unsigned register_host:1; + unsigned register_dev:1; + u8 otg; /* port number, 1-based: usb1 == 2 */ + + u8 hmc_mode; + + /* implicitly true if otg: host supports remote wakeup? */ + u8 rwc; + + /* signaling pins used to talk to transceiver on usbN: + * 0 == usbN unused + * 2 == usb0-only, using internal transceiver + * 3 == 3 wire bidirectional + * 4 == 4 wire bidirectional + * 6 == 6 wire unidirectional (or TLL) + */ + u8 pins[3]; +}; + +struct omap_lcd_config { + char panel_name[16]; + char ctrl_name[16]; + s16 nreset_gpio; + u8 data_lines; +}; + +struct omap_fbmem_config { + u32 start; + u32 size; +}; + +struct omap_gpio_switch_config { + char name[12]; + u16 gpio; + u8 flags:4; + u8 type:4; + unsigned int key_code:24; /* Linux key code */ +}; + +struct omap_uart_config { + /* Bit field of UARTs present; bit 0 --> UART1 */ + unsigned int enabled_uarts; +}; + +struct omap_tea5761_config { + u16 enable_gpio; +}; + +struct omap_partition_config { + char name[16]; + unsigned int size; + unsigned int offset; + /* same as in include/linux/mtd/partitions.h */ + unsigned int mask_flags; +}; + +struct omap_flash_part_str_config { + char part_table[0]; +}; + +struct omap_boot_reason_config { + char reason_str[12]; +}; + +struct omap_version_config { + char component[12]; + char version[12]; +}; + +/* + * Code copied from maemo kernel 2.6.28 file + * arch/arm/plat-omap/include/mach/board-nokia.h + * + * Information structures for Nokia-specific board config data + * + * Copyright (C) 2005 Nokia Corporation + */ + +struct omap_bluetooth_config { + u8 chip_type; + u8 bt_wakeup_gpio; + u8 host_wakeup_gpio; + u8 reset_gpio; + u8 bt_uart; + u8 bd_addr[6]; + u8 bt_sysclk; +}; + +struct omap_wlan_cx3110x_config { + u8 chip_type; + u8 reserverd; + s16 power_gpio; + s16 irq_gpio; + s16 spi_cs_gpio; +}; + +struct omap_cbus_config { + s16 clk_gpio; + s16 dat_gpio; + s16 sel_gpio; +}; + +struct omap_em_asic_bb5_config { + s16 retu_irq_gpio; + s16 tahvo_irq_gpio; +}; + +/* + * omap_tag handling + * + * processing omap tag structures + * + * Copyright (C) 2011 marcel@mesa.nl, Mesa Consulting B.V. + * Copyright (C) 2012 Pali Rohár pali.rohar@gmail.com + */ + +/* TI OMAP specific information */ +#define ATAG_BOARD 0x414f4d50 + +struct tag_omap_header { + u16 tag; + u16 size; +}; + +struct tag_omap { + struct tag_omap_header hdr; + union { + struct omap_clock_config clock; + struct omap_serial_console_config serial_console; + struct omap_sti_console_config sti_console; + struct omap_usb_config usb; + struct omap_lcd_config lcd; + struct omap_fbmem_config fbmem; + struct omap_gpio_switch_config gpio_switch; + struct omap_uart_config uart; + struct omap_tea5761_config tea5761; + struct omap_partition_config partition; + struct omap_flash_part_str_config flash_part_str; + struct omap_boot_reason_config boot_reason; + struct omap_version_config version; + struct omap_bluetooth_config bluetooth; + struct omap_wlan_cx3110x_config wlan_cx3110x; + struct omap_cbus_config cbus; + struct omap_em_asic_bb5_config em_asic_bb5; + } u; +}; + +#define tag_omap_next(t) ((struct tag_omap *)((u8 *)(t) + \ + (t)->hdr.size + sizeof(struct tag_omap_header))) + +#define OMAP_TAG_HEADER_CONFIG(config, type) \ + .hdr.tag = config, \ + .hdr.size = sizeof(struct type) + +#define OMAP_TAG_UART_CONFIG(p1) \ + { \ + OMAP_TAG_HEADER_CONFIG(OMAP_TAG_UART, omap_uart_config), \ + .u.uart.enabled_uarts = p1, \ + } + +#define OMAP_TAG_SERIAL_CONSOLE_CONFIG(p1, p2) \ + { \ + OMAP_TAG_HEADER_CONFIG(OMAP_TAG_SERIAL_CONSOLE, \ + omap_serial_console_config), \ + .u.serial_console.console_uart = p1, \ + .u.serial_console.console_speed = p2, \ + } + +#define OMAP_TAG_LCD_CONFIG(p1, p2, p3, p4) \ + { \ + OMAP_TAG_HEADER_CONFIG(OMAP_TAG_LCD, omap_lcd_config), \ + .u.lcd.panel_name = p1, \ + .u.lcd.ctrl_name = p2, \ + .u.lcd.nreset_gpio = p3, \ + .u.lcd.data_lines = p4, \ + } + +#define OMAP_TAG_GPIO_SWITCH_CONFIG(p1, p2, p3, p4, p5) \ + { \ + OMAP_TAG_HEADER_CONFIG(OMAP_TAG_GPIO_SWITCH, \ + omap_gpio_switch_config), \ + .u.gpio_switch.name = p1, \ + .u.gpio_switch.gpio = p2, \ + .u.gpio_switch.flags = p3, \ + .u.gpio_switch.type = p4, \ + .u.gpio_switch.key_code = p5, \ + } + +#define OMAP_TAG_WLAN_CX3110X_CONFIG(p1, p2, p3, p4, p5) \ + { \ + OMAP_TAG_HEADER_CONFIG(OMAP_TAG_WLAN_CX3110X, \ + omap_wlan_cx3110x_config), \ + .u.wlan_cx3110x.chip_type = p1, \ + .u.wlan_cx3110x.reserverd = p2, \ + .u.wlan_cx3110x.power_gpio = p3, \ + .u.wlan_cx3110x.irq_gpio = p4, \ + .u.wlan_cx3110x.spi_cs_gpio = p5, \ + } + +#define OMAP_TAG_PARTITION_CONFIG(p1, p2, p3, p4) \ + { \ + OMAP_TAG_HEADER_CONFIG(OMAP_TAG_PARTITION, \ + omap_partition_config), \ + .u.partition.name = p1, \ + .u.partition.size = p2, \ + .u.partition.offset = p3, \ + .u.partition.mask_flags = p4, \ + } + +#define OMAP_TAG_BOOT_REASON_CONFIG(p1) \ + { \ + OMAP_TAG_HEADER_CONFIG(OMAP_TAG_BOOT_REASON, \ + omap_boot_reason_config), \ + .u.boot_reason.reason_str = p1, \ + } + +#define OMAP_TAG_VERSION_STR_CONFIG(p1, p2) \ + { \ + OMAP_TAG_HEADER_CONFIG(OMAP_TAG_VERSION_STR, \ + omap_version_config), \ + .u.version.component = p1, \ + .u.version.version = p2, \ + } diff --git a/boards.cfg b/boards.cfg index 4b17289..0647b3e 100644 --- a/boards.cfg +++ b/boards.cfg @@ -264,6 +264,7 @@ devkit8000 arm armv7 devkit8000 timll mcx arm armv7 mcx htkw omap3 tricorder arm armv7 tricorder corscience omap3 twister arm armv7 twister technexion omap3 +nokia_rx51 arm armv7 rx51 nokia omap3 omap4_panda arm armv7 panda ti omap4 omap4_sdp4430 arm armv7 sdp4430 ti omap4 omap5_evm arm armv7 omap5_evm ti omap5 diff --git a/doc/README.nokia_rx51 b/doc/README.nokia_rx51 new file mode 100644 index 0000000..a8fdfcd --- /dev/null +++ b/doc/README.nokia_rx51 @@ -0,0 +1,104 @@ +Board: Nokia RX-51 aka N900 + +This board definition results in a u-boot.bin which can be chainloaded +from NOLO in qemu or on a real N900. It does very little hardware config +because NOLO has already configured the board. Only needed is enabling +internal eMMC memory via twl4030 regulator which is not enabled by NOLO. + +NOLO is expecting a kernel image and will treat any image it finds in +onenand as such. This u-boot is intended to be flashed to the N900 like +a kernel. In order to transparently boot the original kernel, it will be +appended to u-boot.bin at 0x40000. NOLO will load the entire image into +(random) memory and execute u-boot, which saves hw revision, boot reason +and boot mode ATAGs set by NOLO. Then the bootscripts will attempt to load +uImage or boot.scr from a fat, ext2/ext3 or ext4 filesystem in external +SD card or internal eMMC memory. If this fails or keyboard is closed then +the appended kernel image will be booted using some generated and some +stored ATAGs (see boot order). + +There is support for hardware watchdog. Hardware watchdog is started by +NOLO so u-boot must kick watchdog to prevent reboot device (but not very +often, max every 2 seconds). There is also support for framebuffer display +output with ANSI espace codes and the N900 HW keyboard input. USB tty works +but is disabled because it prevents the current Maemo kernel from booting. + +When U-Boot is starting it enable IBE bit in Auxiliary Control Register, +which is needed for Thumb-2 ISA support. It is workaround for errata 430973. + +Default boot order: + + * 0. if keyboard is closed boot automatically attached kernel image + * 1. try boot from external SD card + * 2. try boot from internal eMMC memory + * 3. try boot from attached kernel image + +Boot from SD or eMMC in this order: + + * 1. + * 1.1 find boot.scr on first fat partition + * 1.2 find uImage on first fat parition + * 1.3 same order for 2. - 4. fat partition + * 2. same as 1. but for ext2/3 partition + * 3. same as 1. but for ext4 partition + + +Available additional commands/variables: + + * run sercon - Use serial port for control + * run usbcon - Use usbtty for control + * run vgacon - Use framebuffer and HW keyboard for control (default) + + * run sdboot - Boot from external SD card (see boot order) + * run emmcboot - Boot from internal eMMC memory (see boot order) + * run attachboot - Boot attached kernel image (attached to U-Boot binary) + + * run scriptload - Load boot script ${mmcscriptfile} + * run scriptboot - Run loaded boot script + * run kernload - Load kernel image ${mmckernfile} + * run initrdload - Load initrd image ${mmcinitrdfile} + * run kernboot - Boot loaded kernel image + * run kerninitrdboot - Boot loaded kernel image with loaded initrd image + + * run trymmcscriptboot - Try to load and boot script ${mmcscriptfile} + * run trymmckernboot - Try to load and boot kernel image ${mmckernfile} + * run trymmckerninitrdboot - Try to load and boot kernel image ${mmckernfile} + with initrd image ${mmcinitrdfile} + +Additional variables for loading files from mmc: + + * mmc ${mmcnum} (0 - external, 1 - internal) + * partition number ${mmcpart} (1 - 4) + * parition type ${mmctype} (fat, ext2) + +Additional varuables for booting kernel: + + * setup_omap_atag - Add OMAP table into atags structure (needs maemo kernel) + * setup_console_atag - Enable serial console in OMAP table + * setup_boot_reason_atag - Change boot reason in OMAP table + * setup_boot_mode_atag - Change boot mode in OMAP table + +USB TTY: + + Maemo kernel 2.6.28 will crash if u-boot enable usb tty. So USB TTY is disabled. + For enabling USB TTY just add this line to file include/configs/nokia_rx51.h + + #define CONFIG_USB_TTY + + +ONENAND support: + + ONENAND support is disabled because not working yet and cause linux kernel to + crash or no access to mtd. For enabling ONENAND support add this line at begin + of file include/configs/nokia_rx51.h + + #define ONENAND_SUPPORT + + +UBIFS support: + + UBIFS support is disabled, because U-Boot image is too big and cannot be + flashed with attached zImage to RX-51 kernel nand area. For enabling UBIFS + support first enable ONENAND support and then add this line at begin of file + include/configs/nokia_rx51.h + + #define UBIFS_SUPPORT diff --git a/include/configs/nokia_rx51.h b/include/configs/nokia_rx51.h new file mode 100644 index 0000000..345f4bd --- /dev/null +++ b/include/configs/nokia_rx51.h @@ -0,0 +1,450 @@ +/* + * (C) Copyright 2011-2012 + * Pali Rohár pali.rohar@gmail.com + * + * (C) Copyright 2010 + * Alistair Buxton a.j.buxton@gmail.com + * + * Derived from Beagle Board code: + * (C) Copyright 2006-2008 + * Texas Instruments. + * Richard Woodruff r-woodruff2@ti.com + * Syed Mohammed Khasim x0khasim@ti.com + * + * Configuration settings for the Nokia RX-51 aka N900. + * + * 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 as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#ifndef __CONFIG_H +#define __CONFIG_H + +/* + * High Level Configuration Options + */ + +#define CONFIG_OMAP /* in a TI OMAP core */ +#define CONFIG_OMAP34XX /* which is a 34XX */ +#define CONFIG_OMAP3430 /* which is in a 3430 */ +#define CONFIG_OMAP3_RX51 /* working with RX51 */ +#define CONFIG_SYS_L2CACHE_OFF /* pretend there is no L2 CACHE */ + +/* + * Nokia X-Loader loading secondary image to address 0x80400000 + * NOLO loading boot image to random place, so it doesn't really + * matter what we set this to. We have to copy u-boot to this address + */ +#define CONFIG_SYS_TEXT_BASE 0x80008000 + +#define CONFIG_SDRC /* The chip has SDRC controller */ + +#include <asm/arch/cpu.h> /* get chip and board defs */ +#include <asm/arch/omap3.h> +#include <asm/arch/mem.h> +#include <linux/stringify.h> + +/* + * Display CPU and Board information + */ +#define CONFIG_DISPLAY_CPUINFO +#define CONFIG_DISPLAY_BOARDINFO + +/* Clock Defines */ +#define V_OSCK 26000000 /* Clock output from T2 */ +#define V_SCLK (V_OSCK >> 1) + +#undef CONFIG_USE_IRQ /* no support for IRQs */ +#define CONFIG_MISC_INIT_R +#define CONFIG_SKIP_LOWLEVEL_INIT /* X-Loader set everything up */ + +#define CONFIG_CMDLINE_TAG /* enable passing kernel command line string */ +#define CONFIG_INITRD_TAG /* enable passing initrd */ +#define CONFIG_REVISION_TAG /* enable passing revision tag*/ +#define CONFIG_SETUP_MEMORY_TAGS /* enable memory tag */ + +/* + * Size of malloc() pool + */ +#define CONFIG_ENV_SIZE (128 << 10) +#define CONFIG_UBI_SIZE (512 << 10) +#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + CONFIG_UBI_SIZE + \ + (128 << 10)) + +/* + * Hardware drivers + */ + +/* + * NS16550 Configuration + */ +#define V_NS16550_CLK 48000000 /* 48MHz (APLL96/2) */ + +#define CONFIG_SYS_NS16550 +#define CONFIG_SYS_NS16550_SERIAL +#define CONFIG_SYS_NS16550_REG_SIZE (-4) +#define CONFIG_SYS_NS16550_CLK V_NS16550_CLK + +/* + * select serial console configuration + */ +#define CONFIG_CONS_INDEX 3 +#define CONFIG_SYS_NS16550_COM3 OMAP34XX_UART3 +#define CONFIG_SERIAL3 3 /* UART3 on RX-51 */ + +/* allow to overwrite serial and ethaddr */ +#define CONFIG_ENV_OVERWRITE +#define CONFIG_BAUDRATE 115200 +#define CONFIG_SYS_BAUDRATE_TABLE { 4800, 9600, 19200, 38400, 57600, 115200 } +#define CONFIG_MMC +#define CONFIG_GENERIC_MMC +#define CONFIG_OMAP_HSMMC +#define CONFIG_DOS_PARTITION + +/* USB */ +#define CONFIG_MUSB_UDC +#define CONFIG_MUSB_HDC +#define CONFIG_USB_OMAP3 +#define CONFIG_TWL4030_USB + +/* USB device configuration */ +#define CONFIG_USB_DEVICE +#define CONFIG_USBD_VENDORID 0x0421 +#define CONFIG_USBD_PRODUCTID 0x01c8 +#define CONFIG_USBD_MANUFACTURER "Nokia" +#define CONFIG_USBD_PRODUCT_NAME "N900" + +#define CONFIG_SYS_CONSOLE_IS_IN_ENV +#define CONFIG_SYS_NO_FLASH + +/* commands to include */ +#include <config_cmd_default.h> + +#define CONFIG_CMD_EXT2 /* EXT2 Support */ +#define CONFIG_CMD_EXT4 /* EXT4 Support */ +#define CONFIG_CMD_FAT /* FAT support */ + +#define CONFIG_CMD_I2C /* I2C serial bus support */ +#define CONFIG_CMD_MMC /* MMC support */ +#define CONFIG_CMD_GPIO /* Enable gpio command */ + +#define CONFIG_CMDLINE_EDITING /* add command line history */ +#define CONFIG_AUTO_COMPLETE /* add autocompletion support */ + +#define CONFIG_CMD_CLEAR /* ANSI terminal clear screen command */ + +#ifdef ONENAND_SUPPORT + +#define CONFIG_CMD_ONENAND /* ONENAND support */ +#define CONFIG_CMD_MTDPARTS /* mtd parts support */ + +#ifdef UBIFS_SUPPORT +#define CONFIG_CMD_UBI /* UBI Support */ +#define CONFIG_CMD_UBIFS /* UBIFS Support */ +#endif + +#endif + +/* commands not needed from config_cmd_default.h */ +#undef CONFIG_CMD_FPGA /* FPGA configuration Support */ +#undef CONFIG_CMD_IMI /* iminfo */ +#undef CONFIG_CMD_NET /* bootp, tftpboot, rarpboot */ +#undef CONFIG_CMD_NFS /* NFS support */ +#undef CONFIG_CMD_SAVEENV /* saveenv */ +#undef CONFIG_CMD_SETGETDCR /* DCR support on 4xx */ + +#define CONFIG_OMAP3_SPI +#define CONFIG_HARD_I2C +#define CONFIG_SYS_I2C_SPEED 100000 +#define CONFIG_SYS_I2C_SLAVE 1 +#define CONFIG_DRIVER_OMAP34XX_I2C + +/* + * TWL4030 + */ +#define CONFIG_TWL4030_POWER +#define CONFIG_TWL4030_LED +#define CONFIG_TWL4030_KEYPAD + +#define CONFIG_OMAP_GPIO +#define GPIO_SLIDE 71 + +/* + * Board ONENAND Info. + */ + +#define PART1_NAME "bootloader" +#define PART1_SIZE 128 +#define PART1_MULL 1024 +#define PART1_SUFF "k" +#define PART1_OFFS 0x00000000 +#define PART1_MASK 0x00000003 + +#define PART2_NAME "config" +#define PART2_SIZE 384 +#define PART2_MULL 1024 +#define PART2_SUFF "k" +#define PART2_OFFS 0x00020000 +#define PART2_MASK 0x00000000 + +#define PART3_NAME "log" +#define PART3_SIZE 256 +#define PART3_MULL 1024 +#define PART3_SUFF "k" +#define PART3_OFFS 0x00080000 +#define PART3_MASK 0x00000000 + +#define PART4_NAME "kernel" +#define PART4_SIZE 2 +#define PART4_MULL 1024*1024 +#define PART4_SUFF "m" +#define PART4_OFFS 0x000c0000 +#define PART4_MASK 0x00000000 + +#define PART5_NAME "initfs" +#define PART5_SIZE 2 +#define PART5_MULL 1024*1024 +#define PART5_SUFF "m" +#define PART5_OFFS 0x002c0000 +#define PART5_MASK 0x00000000 + +#define PART6_NAME "rootfs" +#define PART6_SIZE 257280 +#define PART6_MULL 1024 +#define PART6_SUFF "k" +#define PART6_OFFS 0x004c0000 +#define PART6_MASK 0x00000000 + +#ifdef ONENAND_SUPPORT + +#define PISMO1_NAND_SIZE GPMC_SIZE_128M +#define PISMO1_ONEN_SIZE GPMC_SIZE_128M +#define CONFIG_SYS_ONENAND_BASE ONENAND_MAP +#define CONFIG_MTD_DEVICE +#define CONFIG_MTD_PARTITIONS + +#ifdef UBIFS_SUPPORT +#define CONFIG_RBTREE +#define CONFIG_LZO +#endif + +#define MTDIDS_DEFAULT "onenand0=onenand" +#define MTDPARTS_DEFAULT "mtdparts=onenand:" \ + __stringify(PART1_SIZE) PART1_SUFF "(" PART1_NAME ")ro," \ + __stringify(PART2_SIZE) PART2_SUFF "(" PART2_NAME ")," \ + __stringify(PART3_SIZE) PART3_SUFF "(" PART3_NAME ")," \ + __stringify(PART4_SIZE) PART4_SUFF "(" PART4_NAME ")," \ + __stringify(PART5_SIZE) PART5_SUFF "(" PART5_NAME ")," \ + "-(" PART6_NAME ")" + +#endif + +/* Watchdog support */ +#define CONFIG_HW_WATCHDOG + +/* + * Framebuffer + */ +/* Video console */ +#define CONFIG_VIDEO +#define CONFIG_CFB_CONSOLE +#define CONFIG_CFB_CONSOLE_ANSI /* Enable ANSI escape codes in framebuffer */ +#define CONFIG_VIDEO_LOGO +#define VIDEO_FB_16BPP_PIXEL_SWAP +#define VIDEO_FB_16BPP_WORD_SWAP +#define CONFIG_VIDEO_SW_CURSOR +#define CONFIG_SPLASH_SCREEN + +/* functions for cfb_console */ +#define VIDEO_KBD_INIT_FCT rx51_kp_init() +#define VIDEO_TSTC_FCT rx51_kp_tstc +#define VIDEO_GETC_FCT rx51_kp_getc +#ifndef __ASSEMBLY__ +int rx51_kp_init(void); +int rx51_kp_tstc(void); +int rx51_kp_getc(void); +#endif + +#ifndef MTDPARTS_DEFAULT +#define MTDPARTS_DEFAULT +#endif + +/* Environment information */ +#define CONFIG_BOOTDELAY 3 + +#define CONFIG_EXTRA_ENV_SETTINGS \ + "mtdparts=" MTDPARTS_DEFAULT "\0" \ + "usbtty=cdc_acm\0" \ + "stdin=vga\0" \ + "stdout=vga\0" \ + "stderr=vga\0" \ + "setcon=setenv stdin ${con};" \ + "setenv stdout ${con};" \ + "setenv stderr ${con}\0" \ + "sercon=setenv con serial; run setcon\0" \ + "usbcon=setenv con usbtty; run setcon\0" \ + "vgacon=setenv con vga; run setcon\0" \ + "slide=gpio input " __stringify(GPIO_SLIDE) "\0" \ + "switchmmc=mmc dev ${mmcnum}\0" \ + "kernaddr=0x82008000\0" \ + "initrdaddr=0x84008000\0" \ + "scriptaddr=0x86008000\0" \ + "fileload=${mmctype}load mmc ${mmcnum}:${mmcpart} " \ + "${loadaddr} ${mmcfile}\0" \ + "kernload=setenv loadaddr ${kernaddr};" \ + "setenv mmcfile ${mmckernfile};" \ + "run fileload\0" \ + "initrdload=setenv loadaddr ${initrdaddr};" \ + "setenv mmcfile ${mmcinitrdfile};" \ + "run fileload\0" \ + "scriptload=setenv loadaddr ${scriptaddr};" \ + "setenv mmcfile ${mmcscriptfile};" \ + "run fileload\0" \ + "scriptboot=echo Running ${mmcscriptfile} from mmc " \ + "${mmcnum}:${mmcpart} ...; source ${scriptaddr}\0" \ + "kernboot=echo Booting ${mmckernfile} from mmc " \ + "${mmcnum}:${mmcpart} ...; bootm ${kernaddr}\0" \ + "kerninitrdboot=echo Booting ${mmckernfile} ${mmcinitrdfile} from mmc "\ + "${mmcnum}:${mmcpart} ...; bootm ${kernaddr} ${initrdaddr}\0" \ + "attachboot=echo Booting attached kernel image ...;" \ + "setenv setup_omap_atag 1;" \ + "bootm ${attkernaddr};" \ + "setenv setup_omap_atag\0" \ + "trymmcscriptboot=if run switchmmc; then " \ + "if run scriptload; then " \ + "run scriptboot;" \ + "fi;" \ + "fi\0" \ + "trymmckernboot=if run switchmmc; then " \ + "if run kernload; then " \ + "run kernboot;" \ + "fi;" \ + "fi\0" \ + "trymmckerninitrdboot=if run switchmmc; then " \ + "if run initrdload; then " \ + "if run kernload; then " \ + "run kerninitrdboot;" \ + "fi;" \ + "fi; " \ + "fi\0" \ + "trymmcpartboot=setenv mmcscriptfile boot.scr; run trymmcscriptboot;" \ + "setenv mmckernfile uImage; run trymmckernboot\0" \ + "trymmcallpartboot=setenv mmcpart 1; run trymmcpartboot;" \ + "setenv mmcpart 2; run trymmcpartboot;" \ + "setenv mmcpart 3; run trymmcpartboot;" \ + "setenv mmcpart 4; run trymmcpartboot\0" \ + "trymmcboot=if run switchmmc; then " \ + "setenv mmctype fat;" \ + "run trymmcallpartboot;" \ + "setenv mmctype ext2;" \ + "run trymmcallpartboot;" \ + "setenv mmctype ext4;" \ + "run trymmcallpartboot;" \ + "fi\0" \ + "emmcboot=setenv mmcnum 1; run trymmcboot\0" \ + "sdboot=setenv mmcnum 0; run trymmcboot\0" \ + "" + +#define CONFIG_PREBOOT \ + "if run slide; then true; else run attachboot; fi;" \ + "echo Extra commands:;" \ + "echo run sercon - Use serial port for control.;" \ + "echo run usbcon - Use usbtty for control.;" \ + "echo run vgacon - Use framebuffer/keyboard.;" \ + "echo run sdboot - Boot from SD card slot.;" \ + "echo run emmcboot - Boot internal eMMC memory.;" \ + "echo run attachboot - Boot attached kernel image.;" \ + "echo" + +#define CONFIG_BOOTCOMMAND \ + "run sdboot;" \ + "run emmcboot;" \ + "run attachboot;" \ + "echo" + +/* + * Miscellaneous configurable options + */ +#define CONFIG_SYS_LONGHELP /* undef to save memory */ +#define CONFIG_SYS_HUSH_PARSER /* use "hush" command parser */ +#define CONFIG_SYS_PROMPT_HUSH_PS2 "> " +#define CONFIG_SYS_PROMPT "Nokia RX-51 # " +#define CONFIG_SYS_CBSIZE 256 /* Console I/O Buffer Size */ +/* Print Buffer Size */ +#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \ + sizeof(CONFIG_SYS_PROMPT) + 16) +#define CONFIG_SYS_MAXARGS 16 /* max number of command args */ +/* Boot Argument Buffer Size */ +#define CONFIG_SYS_BARGSIZE (CONFIG_SYS_CBSIZE) + +#define CONFIG_SYS_MEMTEST_START (OMAP34XX_SDRC_CS0) +#define CONFIG_SYS_MEMTEST_END (OMAP34XX_SDRC_CS0 + 0x01F00000)/*31MB*/ + +/* default load address */ +#define CONFIG_SYS_LOAD_ADDR (OMAP34XX_SDRC_CS0) + +/* + * OMAP3 has 12 GP timers, they can be driven by the system clock + * (12/13/16.8/19.2/38.4MHz) or by 32KHz clock. We use 13MHz (V_SCLK). + * This rate is divided by a local divisor. + */ +#define CONFIG_SYS_TIMERBASE (OMAP34XX_GPT2) +#define CONFIG_SYS_PTV 2 /* Divisor: 2^(PTV+1) => 8 */ +#define CONFIG_SYS_HZ 1000 + +/* + * Stack sizes + * + * The stack sizes are set up in start.S using the settings below + */ +#define CONFIG_STACKSIZE (128 << 10) /* regular stack 128 KiB */ + +/* + * Physical Memory Map + */ +#define CONFIG_NR_DRAM_BANKS 2 +#define PHYS_SDRAM_1 OMAP34XX_SDRC_CS0 + +/* + * FLASH and environment organization + */ + +#define CONFIG_ENV_IS_NOWHERE + +#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM_1 +#define CONFIG_SYS_INIT_RAM_ADDR 0x4020f800 +#define CONFIG_SYS_INIT_RAM_SIZE 0x800 +#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_INIT_RAM_ADDR + \ + CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE) + +/* + * Attached kernel image + */ + +#define SDRAM_SIZE 0x10000000 /* 256 MB */ +#define SDRAM_END (CONFIG_SYS_SDRAM_BASE + SDRAM_SIZE) + +#define IMAGE_MAXSIZE 0x1FF800 /* 2 MB - 2 kB */ +#define KERNEL_OFFSET 0x40000 /* 256 kB */ +#define KERNEL_MAXSIZE (IMAGE_MAXSIZE-KERNEL_OFFSET) +#define KERNEL_ADDRESS (SDRAM_END-KERNEL_MAXSIZE) + +/* Reserve protected RAM for attached kernel */ +#define CONFIG_PRAM ((KERNEL_MAXSIZE >> 10)+1) + +#endif /* __CONFIG_H */

Hi Pali Rohár,
On 10/19/12 14:00, Pali Rohár wrote:
This patch adding support for new board Nokia RX-51 (N900).
Based on previous work by: Alistair Buxton a.j.buxton@gmail.com
Signed-off-by: Pali Rohár pali.rohar@gmail.com Cc: Ивайло Димитров freemangordon@abv.bg
[...]
diff --git a/board/nokia/rx51/rx51.c b/board/nokia/rx51/rx51.c new file mode 100644 index 0000000..60446cb --- /dev/null +++ b/board/nokia/rx51/rx51.c
[...]
+/*
- Routine: board_init
- Description: Early hardware init.
- */
+int board_init(void) +{
- gpmc_init(); /* in SRAM or SDRAM, finish GPMC */
- /* board id for Linux */
- gd->bd->bi_arch_number = MACH_TYPE_NOKIA_RX51;
This should be specified in the board config file (see CONFIG_MACH_TYPE in README), unless, you have multiple board types supported in the same board file/binary (which does not look like the case here) and it is runtime detectable.
- /* boot param addr */
- gd->bd->bi_boot_params = OMAP34XX_SDRC_CS0 + 0x100;
- return 0;
+}
[...]

On Tuesday 23 October 2012 09:20:39 Igor Grinberg wrote:
+/*
- Routine: board_init
- Description: Early hardware init.
- */
+int board_init(void) +{
- gpmc_init(); /* in SRAM or SDRAM, finish GPMC */
- /* board id for Linux */
- gd->bd->bi_arch_number = MACH_TYPE_NOKIA_RX51;
This should be specified in the board config file (see CONFIG_MACH_TYPE in README), unless, you have multiple board types supported in the same board file/binary (which does not look like the case here) and it is runtime detectable.
I sent new version of this patch.

Based on previous work by: Alistair Buxton a.j.buxton@gmail.com
Signed-off-by: Pali Rohár pali.rohar@gmail.com Cc: Ивайло Димитров freemangordon@abv.bg --- Changes in v5: - Define CONFIG_MACH_TYPE in config file - Remove gd->bd->bi_arch_number from board code
Changes in v4: - Fixed MAINTAINERS - Added default to switches - Added some documentation to code - Optimize indent depth - Using __stringify
Changes in v3: - Added documentation in doc/README.nokia_rx51 - Updated MAINTAINERS - Fixed Fix omap_mmc_init - Code for errata 430973 workaround - Added board specified atag support - Generate omap atag table instead reusing from NOLO - Load bootmenu.src always - Enabled ext4 support - Fixed comments - Reserve protected RAM for attached kernel - Rewritten assembler code in lowlevel_init.S - Reset lp5523 led on init
Changes in v2: - Set correct configs for Memory Map - Enable passing memory tag to kernel atags - Use gpio input command for detecting keyboard slide - Restore powerbus state after calling twl4030 regulator code - Renamed command noloboot to attachboot - Atag address must be always 0x80000100, removed code from lowlevel - Added usb vendor, product id and product name - Enabled command line editing - Fixed keymap and cursor keys
Changes since original version: - Removed Makefile targets: clean and distclean - Rewrited bootcommand and env variables in nokia_rx51.h - Removed useless CONFIG defines in nokia_rx51.h - Disable L2 cache with CONFIG_SYS_L2CACHE_OFF - fixed battery draining - Added onenand support (default disabled due to big u-boot size) - Moved inlined asm code to new file lowlevel_init.S - Fixed commit message
MAINTAINERS | 4 + board/nokia/rx51/Makefile | 46 +++ board/nokia/rx51/lowlevel_init.S | 209 ++++++++++++ board/nokia/rx51/rx51.c | 677 ++++++++++++++++++++++++++++++++++++++ board/nokia/rx51/rx51.h | 389 ++++++++++++++++++++++ board/nokia/rx51/tag_omap.h | 311 +++++++++++++++++ boards.cfg | 1 + doc/README.nokia_rx51 | 104 ++++++ include/configs/nokia_rx51.h | 452 +++++++++++++++++++++++++ 9 files changed, 2193 insertions(+) create mode 100644 board/nokia/rx51/Makefile create mode 100644 board/nokia/rx51/lowlevel_init.S create mode 100644 board/nokia/rx51/rx51.c create mode 100644 board/nokia/rx51/rx51.h create mode 100644 board/nokia/rx51/tag_omap.h create mode 100644 doc/README.nokia_rx51 create mode 100644 include/configs/nokia_rx51.h
diff --git a/MAINTAINERS b/MAINTAINERS index 971235b..9e0b1b2 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1009,6 +1009,10 @@ Nobuhiro Iwamatsu nobuhiro.iwamatsu.yj@renesas.com
armadillo-800eva R8A7740 (RMOBILE SoC)
+Pali Rohár pali.rohar@gmail.com + + nokia_rx51 ARM ARMV7 (OMAP34xx SoC) + -------------------------------------------------------------------------
Unknown / orphaned boards: diff --git a/board/nokia/rx51/Makefile b/board/nokia/rx51/Makefile new file mode 100644 index 0000000..86fb48c --- /dev/null +++ b/board/nokia/rx51/Makefile @@ -0,0 +1,46 @@ +# +# (C) Copyright 2000, 2001, 2002 +# Wolfgang Denk, DENX Software Engineering, wd@denx.de. +# +# 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 as +# published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# + +include $(TOPDIR)/config.mk + +LIB = $(obj)lib$(BOARD).o + +COBJS-y := $(BOARD).o +SOBJS-y := lowlevel_init.o + +COBJS := $(sort $(COBJS-y)) +SOBJS := $(sort $(SOBJS-y)) +SRCS := $(COBJS:.o=.c) $(SOBJS:.o=.S) +OBJS := $(addprefix $(obj),$(COBJS)) $(addprefix $(obj),$(SOBJS)) + +$(LIB): $(obj).depend $(OBJS) + $(call cmd_link_o_target, $(OBJS)) + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +######################################################################### diff --git a/board/nokia/rx51/lowlevel_init.S b/board/nokia/rx51/lowlevel_init.S new file mode 100644 index 0000000..055b103 --- /dev/null +++ b/board/nokia/rx51/lowlevel_init.S @@ -0,0 +1,209 @@ +/* + * (C) Copyright 2011-2012 + * Pali Rohár pali.rohar@gmail.com + * + * 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 as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <config.h> + +relocaddr: /* address of this relocaddr section after coping */ + .word . /* address of section (calculated at compile time) */ + +startaddr: /* address of u-boot after copying */ + .word CONFIG_SYS_TEXT_BASE + +kernaddr: /* address of kernel after copying */ + .word KERNEL_ADDRESS + +kernsize: /* maximal size of kernel image */ + .word KERNEL_MAXSIZE + +kernoffs: /* offset of kernel image in loaded u-boot */ + .word KERNEL_OFFSET + +imagesize: /* maximal size of image */ + .word IMAGE_MAXSIZE + +ih_magic: /* IH_MAGIC in big endian from include/image.h */ + .word 0x56190527 + +/* + * Routine: save_boot_params (called after reset from start.S) + * Description: Copy attached kernel to address KERNEL_ADDRESS + * Copy u-boot to address CONFIG_SYS_TEXT_BASE + * Return to copied u-boot address + */ + +.global save_boot_params +save_boot_params: + + +/* Copy valid attached kernel to address KERNEL_ADDRESS */ + +copy_kernel_start: + adr r0, relocaddr /* r0 - address of section relocaddr */ + ldr r1, relocaddr /* r1 - address of relocaddr after relocation */ + cmp r0, r1 + + /* r4 - calculated offset */ + subhi r4, r0, r1 + sublo r4, r1, r0 + + /* r0 - start of kernel before */ + ldr r0, startaddr + addhi r0, r0, r4 + sublo r0, r0, r4 + ldr r1, kernoffs + add r0, r0, r1 + + /* r3 - start of kernel after */ + ldr r3, kernaddr + + /* r2 - end of kernel after */ + ldr r1, kernsize + add r2, r3, r1 + + /* r1 - end of kernel before */ + add r1, r0, r1 + + /* remove header in target kernel */ + mov r5, #0 + str r5, [r3] + + /* check for valid kernel uImage */ + ldr r4, [r0] /* r4 - 4 bytes header of kernel */ + ldr r5, ih_magic /* r5 - IH_MAGIC */ + cmp r4, r5 + bne copy_kernel_end /* skip if invalid image */ + +copy_kernel_loop: + ldmdb r1!, {r3 - r10} + stmdb r2!, {r3 - r10} + cmp r1, r0 + bhi copy_kernel_loop + +copy_kernel_end: + mov r5, #0 + str r5, [r0] /* remove 4 bytes header of kernel */ + + +/* Fix u-boot code */ + +fix_start: + adr r0, relocaddr /* r0 - address of section relocaddr */ + ldr r1, relocaddr /* r1 - address of relocaddr after relocation */ + cmp r0, r1 + + beq copy_uboot_end /* skip if u-boot is on correct address */ + + /* r5 - calculated offset */ + subhi r5, r0, r1 + sublo r5, r1, r0 + + /* r6 - maximal u-boot size */ + ldr r6, imagesize + + /* fix return address */ + subhi lr, lr, r5 + addlo lr, lr, r5 + + /* r1 - start of u-boot after */ + ldr r1, startaddr + + /* r0 - start of u-boot before */ + addhi r0, r1, r5 + sublo r0, r1, r5 + + /* check if we need to move uboot copy code before calling it */ + cmp r5, r6 + bhi copy_uboot_start /* now coping u-boot code directly is safe */ + + +copy_code_start: + /* r0 - start of u-boot before */ + /* r1 - start of u-boot after */ + /* r6 - maximal u-boot size */ + + /* r7 - maximal kernel size */ + ldr r7, kernsize + + /* r4 - end of kernel before */ + add r4, r0, r6 + add r4, r4, r7 + + /* r5 - end of u-boot after */ + ldr r5, startaddr + add r5, r5, r6 + + /* r2 - start of loop code after */ + cmp r4, r5 /* higher address (r4 or r5) */ + movhs r2, r4 + movlo r2, r5 + + /* r3 - end of loop code before */ + adr r3, end + + /* r4 - end of loop code after */ + adr r4, copy_uboot_start + sub r4, r3, r4 + add r4, r2, r4 + +copy_code_loop: + ldmdb r3!, {r7 - r10} + stmdb r4!, {r7 - r10} + cmp r4, r2 + bhi copy_code_loop + +copy_code_end: + mov pc, r2 + + +/* Copy u-boot to address CONFIG_SYS_TEXT_BASE */ + +copy_uboot_start: + /* r0 - start of u-boot before */ + /* r1 - start of u-boot after */ + /* r6 - maximal u-boot size */ + + /* r2 - end of u-boot after */ + add r2, r1, r6 + + /* condition for copying from left to right */ + cmp r0, r1 + addlo r1, r0, r6 /* r1 - end of u-boot before */ + blo copy_uboot_loop_right + +copy_uboot_loop_left: + ldmia r0!, {r3 - r10} + stmia r1!, {r3 - r10} + cmp r1, r2 + blo copy_uboot_loop_left + b copy_uboot_end + +copy_uboot_loop_right: + ldmdb r1!, {r3 - r10} + stmdb r2!, {r3 - r10} + cmp r1, r0 + bhi copy_uboot_loop_right + +copy_uboot_end: + bx lr + +end: diff --git a/board/nokia/rx51/rx51.c b/board/nokia/rx51/rx51.c new file mode 100644 index 0000000..b2fe1c5 --- /dev/null +++ b/board/nokia/rx51/rx51.c @@ -0,0 +1,677 @@ +/* + * (C) Copyright 2012 + * Ивайло Димитров freemangordon@abv.bg + * + * (C) Copyright 2011-2012 + * Pali Rohár pali.rohar@gmail.com + * + * (C) Copyright 2010 + * Alistair Buxton a.j.buxton@gmail.com + * + * Derived from Beagle Board and 3430 SDP code: + * (C) Copyright 2004-2008 + * Texas Instruments, <www.ti.com> + * + * Author : + * Sunil Kumar sunilsaini05@gmail.com + * Shashi Ranjan shashiranjanmca05@gmail.com + * + * Richard Woodruff r-woodruff2@ti.com + * Syed Mohammed Khasim khasim@ti.com + * + * 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 as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <common.h> +#include <watchdog.h> +#include <malloc.h> +#include <twl4030.h> +#include <i2c.h> +#include <video_fb.h> +#include <asm/io.h> +#include <asm/setup.h> +#include <asm/bitops.h> +#include <asm/mach-types.h> +#include <asm/arch/mux.h> +#include <asm/arch/sys_proto.h> +#include <asm/arch/mmc_host_def.h> + +#include "rx51.h" +#include "tag_omap.h" + +DECLARE_GLOBAL_DATA_PTR; + +GraphicDevice gdev; + +const omap3_sysinfo sysinfo = { + DDR_STACKED, + "Nokia RX-51", + "OneNAND" +}; + +/* This structure contains default omap tags needed for booting Maemo 5 */ +static struct tag_omap omap[] = { + OMAP_TAG_UART_CONFIG(0x04), + OMAP_TAG_SERIAL_CONSOLE_CONFIG(0x03, 0x01C200), + OMAP_TAG_LCD_CONFIG("acx565akm", "internal", 90, 0x18), + OMAP_TAG_GPIO_SWITCH_CONFIG("cam_focus", 0x44, 0x1, 0x2, 0x0), + OMAP_TAG_GPIO_SWITCH_CONFIG("cam_launch", 0x45, 0x1, 0x2, 0x0), + OMAP_TAG_GPIO_SWITCH_CONFIG("cam_shutter", 0x6e, 0x1, 0x0, 0x0), + OMAP_TAG_GPIO_SWITCH_CONFIG("cmt_apeslpx", 0x46, 0x2, 0x2, 0x0), + OMAP_TAG_GPIO_SWITCH_CONFIG("cmt_bsi", 0x9d, 0x2, 0x2, 0x0), + OMAP_TAG_GPIO_SWITCH_CONFIG("cmt_en", 0x4a, 0x2, 0x2, 0x0), + OMAP_TAG_GPIO_SWITCH_CONFIG("cmt_rst", 0x4b, 0x6, 0x2, 0x0), + OMAP_TAG_GPIO_SWITCH_CONFIG("cmt_rst_rq", 0x49, 0x6, 0x2, 0x0), + OMAP_TAG_GPIO_SWITCH_CONFIG("cmt_wddis", 0x0d, 0x2, 0x2, 0x0), + OMAP_TAG_GPIO_SWITCH_CONFIG("headphone", 0xb1, 0x1, 0x1, 0x0), + OMAP_TAG_GPIO_SWITCH_CONFIG("kb_lock", 0x71, 0x1, 0x0, 0x0), + OMAP_TAG_GPIO_SWITCH_CONFIG("proximity", 0x59, 0x0, 0x0, 0x0), + OMAP_TAG_GPIO_SWITCH_CONFIG("sleep_ind", 0xa2, 0x2, 0x2, 0x0), + OMAP_TAG_GPIO_SWITCH_CONFIG("slide", GPIO_SLIDE, 0x0, 0x0, 0x0), + OMAP_TAG_WLAN_CX3110X_CONFIG(0x25, 0xff, 87, 42, -1), + OMAP_TAG_PARTITION_CONFIG(PART1_NAME, PART1_SIZE * PART1_MULL, + PART1_OFFS, PART1_MASK), + OMAP_TAG_PARTITION_CONFIG(PART2_NAME, PART2_SIZE * PART2_MULL, + PART2_OFFS, PART2_MASK), + OMAP_TAG_PARTITION_CONFIG(PART3_NAME, PART3_SIZE * PART3_MULL, + PART3_OFFS, PART3_MASK), + OMAP_TAG_PARTITION_CONFIG(PART4_NAME, PART4_SIZE * PART4_MULL, + PART4_OFFS, PART4_MASK), + OMAP_TAG_PARTITION_CONFIG(PART5_NAME, PART5_SIZE * PART5_MULL, + PART5_OFFS, PART5_MASK), + OMAP_TAG_PARTITION_CONFIG(PART6_NAME, PART6_SIZE * PART6_MULL, + PART6_OFFS, PART6_MASK), + OMAP_TAG_BOOT_REASON_CONFIG("pwr_key"), + OMAP_TAG_VERSION_STR_CONFIG("product", "RX-51"), + OMAP_TAG_VERSION_STR_CONFIG("hw-build", "2101"), + OMAP_TAG_VERSION_STR_CONFIG("nolo", "1.4.14"), + OMAP_TAG_VERSION_STR_CONFIG("boot-mode", "normal"), + { } +}; + +static char *boot_reason_ptr; +static char *hw_build_ptr; +static char *nolo_version_ptr; +static char *boot_mode_ptr; + +/* + * Routine: init_omap_tags + * Description: Initialize pointers to values in tag_omap + */ +static void init_omap_tags(void) +{ + char *component; + char *version; + int i = 0; + while (omap[i].hdr.tag) { + switch (omap[i].hdr.tag) { + case OMAP_TAG_BOOT_REASON: + boot_reason_ptr = omap[i].u.boot_reason.reason_str; + break; + case OMAP_TAG_VERSION_STR: + component = omap[i].u.version.component; + version = omap[i].u.version.version; + if (strcmp(component, "hw-build") == 0) + hw_build_ptr = version; + else if (strcmp(component, "nolo") == 0) + nolo_version_ptr = version; + else if (strcmp(component, "boot-mode") == 0) + boot_mode_ptr = version; + break; + default: + break; + } + i++; + } +} + +static void reuse_omap_atags(struct tag_omap *t) +{ + char *component; + char *version; + while (t->hdr.tag) { + switch (t->hdr.tag) { + case OMAP_TAG_BOOT_REASON: + memset(boot_reason_ptr, 0, 12); + strcpy(boot_reason_ptr, t->u.boot_reason.reason_str); + break; + case OMAP_TAG_VERSION_STR: + component = t->u.version.component; + version = t->u.version.version; + if (strcmp(component, "hw-build") == 0) { + memset(hw_build_ptr, 0, 12); + strcpy(hw_build_ptr, version); + } else if (strcmp(component, "nolo") == 0) { + memset(nolo_version_ptr, 0, 12); + strcpy(nolo_version_ptr, version); + } else if (strcmp(component, "boot-mode") == 0) { + memset(boot_mode_ptr, 0, 12); + strcpy(boot_mode_ptr, version); + } + break; + default: + break; + } + t = tag_omap_next(t); + } +} + +/* + * Routine: reuse_atags + * Description: Reuse atags from previous bootloader. + * Reuse only only HW build, boot reason, boot mode and nolo + */ +static void reuse_atags(void) +{ + struct tag *t = (struct tag *)gd->bd->bi_boot_params; + + /* First tag must be ATAG_CORE */ + if (t->hdr.tag != ATAG_CORE) + return; + + if (!boot_reason_ptr || !hw_build_ptr) + return; + + /* Last tag must be ATAG_NONE */ + while (t->hdr.tag != ATAG_NONE) { + switch (t->hdr.tag) { + case ATAG_REVISION: + memset(hw_build_ptr, 0, 12); + sprintf(hw_build_ptr, "%x", t->u.revision.rev); + break; + case ATAG_BOARD: + reuse_omap_atags((struct tag_omap *)&t->u); + break; + default: + break; + } + t = tag_next(t); + } +} + +/* + * Routine: board_init + * Description: Early hardware init. + */ +int board_init(void) +{ + /* in SRAM or SDRAM, finish GPMC */ + gpmc_init(); + /* boot param addr */ + gd->bd->bi_boot_params = OMAP34XX_SDRC_CS0 + 0x100; + return 0; +} + +/* + * Routine: get_board_revision + * Description: Return board revision. + */ +u32 get_board_rev(void) +{ + return simple_strtol(hw_build_ptr, NULL, 16); +} + +/* + * Routine: setup_board_tags + * Description: Append board specific boot tags. + */ +void setup_board_tags(struct tag **in_params) +{ + int setup_console_atag; + char *setup_boot_reason_atag; + char *setup_boot_mode_atag; + char *str; + int i; + int size; + int total_size; + struct tag *params; + struct tag_omap *t; + + params = (struct tag *)gd->bd->bi_boot_params; + + params->u.core.flags = 0x0; + params->u.core.pagesize = 0x1000; + params->u.core.rootdev = 0x0; + + /* append omap atag only if env setup_omap_atag is set to 1 */ + str = getenv("setup_omap_atag"); + if (!str || str[0] != '1') + return; + + str = getenv("setup_console_atag"); + if (str && str[0] == '1') + setup_console_atag = 1; + else + setup_console_atag = 0; + + setup_boot_reason_atag = getenv("setup_boot_reason_atag"); + setup_boot_mode_atag = getenv("setup_boot_mode_atag"); + + params = *in_params; + t = (struct tag_omap *)¶ms->u; + total_size = sizeof(struct tag_header); + + for (i = 0; omap[i].hdr.tag; i++) { + + /* skip serial console tag */ + if (!setup_console_atag && + omap[i].hdr.tag == OMAP_TAG_SERIAL_CONSOLE) + continue; + + size = omap[i].hdr.size + sizeof(struct tag_omap_header); + memcpy(t, &omap[i], size); + + /* set uart tag to 0 - disable serial console */ + if (!setup_console_atag && omap[i].hdr.tag == OMAP_TAG_UART) + t->u.uart.enabled_uarts = 0; + + /* change boot reason */ + if (setup_boot_reason_atag && + omap[i].hdr.tag == OMAP_TAG_BOOT_REASON) { + memset(t->u.boot_reason.reason_str, 0, 12); + strcpy(t->u.boot_reason.reason_str, + setup_boot_reason_atag); + } + + /* change boot mode */ + if (setup_boot_mode_atag && + omap[i].hdr.tag == OMAP_TAG_VERSION_STR && + strcmp(omap[i].u.version.component, "boot-mode") == 0) { + memset(t->u.version.version, 0, 12); + strcpy(t->u.version.version, setup_boot_mode_atag); + } + + total_size += size; + t = tag_omap_next(t); + + } + + params->hdr.tag = ATAG_BOARD; + params->hdr.size = total_size >> 2; + params = tag_next(params); + + *in_params = params; +} + +/* + * Routine: video_hw_init + * Description: Set up the GraphicDevice depending on sys_boot. + */ +void *video_hw_init(void) +{ + /* fill in Graphic Device */ + gdev.frameAdrs = 0x8f9c0000; + gdev.winSizeX = 800; + gdev.winSizeY = 480; + gdev.gdfBytesPP = 2; + gdev.gdfIndex = GDF_16BIT_565RGB; + memset((void *)gdev.frameAdrs, 0, 0xbb800); + return (void *) &gdev; +} + +/* + * Routine: twl4030_regulator_set_mode + * Description: Set twl4030 regulator mode over i2c powerbus. + */ +static void twl4030_regulator_set_mode(u8 id, u8 mode) +{ + u16 msg = MSG_SINGULAR(DEV_GRP_P1, id, mode); + twl4030_i2c_write_u8(TWL4030_CHIP_PM_MASTER, msg >> 8, + TWL4030_PM_MASTER_PB_WORD_MSB); + twl4030_i2c_write_u8(TWL4030_CHIP_PM_MASTER, msg & 0xff, + TWL4030_PM_MASTER_PB_WORD_LSB); +} + +static void omap3_emu_romcode_call(u32 service_id, u32 *parameters) +{ + u32 i, num_params = *parameters; + u32 *sram_scratch_space = (u32 *)OMAP3_PUBLIC_SRAM_SCRATCH_AREA; + + /* + * copy the parameters to an un-cached area to avoid coherency + * issues + */ + for (i = 0; i < num_params; i++) { + __raw_writel(*parameters, sram_scratch_space); + parameters++; + sram_scratch_space++; + } + + /* Now make the PPA call */ + do_omap3_emu_romcode_call(service_id, OMAP3_PUBLIC_SRAM_SCRATCH_AREA); +} + +/* + * Routine: omap3_update_aux_cr_secure_rx51 + * Description: Modify the contents Auxiliary Control Register. + * Parameters: + * set_bits - bits to set in ACR + * clr_bits - bits to clear in ACR + */ +static void omap3_update_aux_cr_secure_rx51(u32 set_bits, u32 clear_bits) +{ + struct emu_hal_params_rx51 emu_romcode_params = { 0, }; + u32 acr; + + /* Read ACR */ + asm volatile ("mrc p15, 0, %0, c1, c0, 1" : "=r" (acr)); + acr &= ~clear_bits; + acr |= set_bits; + + emu_romcode_params.num_params = 2; + emu_romcode_params.param1 = acr; + + omap3_emu_romcode_call(OMAP3_EMU_HAL_API_WRITE_ACR, + (u32 *)&emu_romcode_params); +} + +/* + * Routine: misc_init_r + * Description: Configure board specific parts. + */ +int misc_init_r(void) +{ + char buf[12]; + u8 state; + + /* reset lp5523 led */ + i2c_set_bus_num(1); + state = 0xff; + i2c_write(0x32, 0x3d, 1, &state, 1); + i2c_set_bus_num(0); + + /* initialize twl4030 power managment */ + twl4030_power_init(); + + /* set VSIM to 1.8V */ + twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VSIM_DEDICATED, + TWL4030_PM_RECEIVER_VSIM_VSEL_18, + TWL4030_PM_RECEIVER_VSIM_DEV_GRP, + TWL4030_PM_RECEIVER_DEV_GRP_P1); + + /* store I2C access state */ + twl4030_i2c_read_u8(TWL4030_CHIP_PM_MASTER, &state, + TWL4030_PM_MASTER_PB_CFG); + + /* enable I2C access to powerbus (needed for twl4030 regulator) */ + twl4030_i2c_write_u8(TWL4030_CHIP_PM_MASTER, 0x02, + TWL4030_PM_MASTER_PB_CFG); + + /* set VAUX3, VSIM and VMMC1 state to active - enable eMMC memory */ + twl4030_regulator_set_mode(RES_VAUX3, RES_STATE_ACTIVE); + twl4030_regulator_set_mode(RES_VSIM, RES_STATE_ACTIVE); + twl4030_regulator_set_mode(RES_VMMC1, RES_STATE_ACTIVE); + + /* restore I2C access state */ + twl4030_i2c_write_u8(TWL4030_CHIP_PM_MASTER, state, + TWL4030_PM_MASTER_PB_CFG); + + /* set env variable attkernaddr for relocated kernel */ + sprintf(buf, "%#x", KERNEL_ADDRESS); + setenv("attkernaddr", buf); + + /* initialize omap tags */ + init_omap_tags(); + + /* reuse atags from previous bootloader */ + reuse_atags(); + + dieid_num_r(); + print_cpuinfo(); + + /* + * Cortex-A8(r1p0..r1p2) errata 430973 workaround + * Set IBE bit in Auxiliary Control Register + */ + omap3_update_aux_cr_secure_rx51(1 << 6, 0); + + return 0; +} + +/* + * Routine: set_muxconf_regs + * Description: Setting up the configuration Mux registers specific to the + * hardware. Many pins need to be moved from protect to primary + * mode. + */ +void set_muxconf_regs(void) +{ + MUX_RX51(); +} + +static unsigned long int twl_wd_time; /* last time of watchdog reset */ +static unsigned long int twl_i2c_lock; + +/* + * Routine: hw_watchdog_reset + * Description: Reset timeout of twl4030 watchdog. + */ +void hw_watchdog_reset(void) +{ + u8 timeout = 0; + + /* do not reset watchdog too often - max every 4s */ + if (get_timer(twl_wd_time) < 4 * CONFIG_SYS_HZ) + return; + + /* localy lock twl4030 i2c bus */ + if (test_and_set_bit(0, &twl_i2c_lock)) + return; + + /* read actual watchdog timeout */ + twl4030_i2c_read_u8(TWL4030_CHIP_PM_RECEIVER, &timeout, + TWL4030_PM_RECEIVER_WATCHDOG_CFG); + + /* timeout 0 means watchdog is disabled */ + /* reset watchdog timeout to 31s (maximum) */ + if (timeout != 0) + twl4030_i2c_write_u8(TWL4030_CHIP_PM_RECEIVER, 31, + TWL4030_PM_RECEIVER_WATCHDOG_CFG); + + /* store last watchdog reset time */ + twl_wd_time = get_timer(0); + + /* localy unlock twl4030 i2c bus */ + test_and_clear_bit(0, &twl_i2c_lock); +} + +/* + * TWL4030 keypad handler for cfb_console + */ + +static const char keymap[] = { + /* normal */ + 'q', 'o', 'p', ',', '\b', 0, 'a', 's', + 'w', 'd', 'f', 'g', 'h', 'j', 'k', 'l', + 'e', '.', 0, '\r', 0, 'z', 'x', 'c', + 'r', 'v', 'b', 'n', 'm', ' ', ' ', 0, + 't', 0, 0, 0, 0, 0, 0, 0, + 'y', 0, 0, 0, 0, 0, 0, 0, + 'u', 0, 0, 0, 0, 0, 0, 0, + 'i', 5, 6, 0, 0, 0, 0, 0, + /* fn */ + '1', '9', '0', '=', '\b', 0, '*', '+', + '2', '#', '-', '_', '(', ')', '&', '!', + '3', '?', '^', '\r', 0, 156, '$', 238, + '4', '/', '\', '"', ''', '@', 0, '<', + '5', '|', '>', 0, 0, 0, 0, 0, + '6', 0, 0, 0, 0, 0, 0, 0, + '7', 0, 0, 0, 0, 0, 0, 0, + '8', 16, 17, 0, 0, 0, 0, 0, +}; + +static u8 keys[8]; +static u8 old_keys[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +#define KEYBUF_SIZE 32 +static u8 keybuf[KEYBUF_SIZE]; +static u8 keybuf_head; +static u8 keybuf_tail; + +/* + * Routine: rx51_kp_init + * Description: Initialize HW keyboard. + */ +int rx51_kp_init(void) +{ + int ret = 0; + u8 ctrl; + ret = twl4030_i2c_read_u8(TWL4030_CHIP_KEYPAD, &ctrl, + TWL4030_KEYPAD_KEYP_CTRL_REG); + + if (ret) + return ret; + + /* turn on keyboard and use hardware scanning */ + ctrl |= TWL4030_KEYPAD_CTRL_KBD_ON; + ctrl |= TWL4030_KEYPAD_CTRL_SOFT_NRST; + ctrl |= TWL4030_KEYPAD_CTRL_SOFTMODEN; + ret |= twl4030_i2c_write_u8(TWL4030_CHIP_KEYPAD, ctrl, + TWL4030_KEYPAD_KEYP_CTRL_REG); + /* enable key event status */ + ret |= twl4030_i2c_write_u8(TWL4030_CHIP_KEYPAD, 0xfe, + TWL4030_KEYPAD_KEYP_IMR1); + /* enable interrupt generation on rising and falling */ + /* this is a workaround for qemu twl4030 emulation */ + ret |= twl4030_i2c_write_u8(TWL4030_CHIP_KEYPAD, 0x57, + TWL4030_KEYPAD_KEYP_EDR); + /* enable ISR clear on read */ + ret |= twl4030_i2c_write_u8(TWL4030_CHIP_KEYPAD, 0x05, + TWL4030_KEYPAD_KEYP_SIH_CTRL); + return 0; +} + +static void rx51_kp_fill(u8 k, u8 mods) +{ + /* check if some cursor key without meta fn key was pressed */ + if (!(mods & 2) && (k == 18 || k == 31 || k == 33 || k == 34)) { + keybuf[keybuf_tail++] = '\e'; + keybuf_tail %= KEYBUF_SIZE; + keybuf[keybuf_tail++] = '['; + keybuf_tail %= KEYBUF_SIZE; + if (k == 18) /* up */ + keybuf[keybuf_tail++] = 'A'; + else if (k == 31) /* left */ + keybuf[keybuf_tail++] = 'D'; + else if (k == 33) /* down */ + keybuf[keybuf_tail++] = 'B'; + else if (k == 34) /* right */ + keybuf[keybuf_tail++] = 'C'; + keybuf_tail %= KEYBUF_SIZE; + return; + } + + if (mods & 2) { /* fn meta key was pressed */ + k = keymap[k+64]; + } else { + k = keymap[k]; + if (mods & 1) { /* ctrl key was pressed */ + if (k >= 'a' && k <= 'z') + k -= 'a' - 1; + } + if (mods & 4) { /* shift key was pressed */ + if (k >= 'a' && k <= 'z') + k += 'A' - 'a'; + else if (k == '.') + k = ':'; + else if (k == ',') + k = ';'; + } + } + keybuf[keybuf_tail++] = k; + keybuf_tail %= KEYBUF_SIZE; +} + +/* + * Routine: rx51_kp_tstc + * Description: Test if key was pressed (from buffer). + */ +int rx51_kp_tstc(void) +{ + u8 c, r, dk, i; + u8 intr; + u8 mods; + + /* localy lock twl4030 i2c bus */ + if (test_and_set_bit(0, &twl_i2c_lock)) + return 0; + + /* twl4030 remembers up to 2 events */ + for (i = 0; i < 2; i++) { + + /* check interrupt register for events */ + twl4030_i2c_read_u8(TWL4030_CHIP_KEYPAD, &intr, + TWL4030_KEYPAD_KEYP_ISR1+(2*i)); + + /* no event */ + if (!(intr&1)) + continue; + + /* read the key state */ + i2c_read(TWL4030_CHIP_KEYPAD, + TWL4030_KEYPAD_FULL_CODE_7_0, 1, keys, 8); + + /* cut out modifier keys from the keystate */ + mods = keys[4] >> 4; + keys[4] &= 0x0f; + + for (c = 0; c < 8; c++) { + + /* get newly pressed keys only */ + dk = ((keys[c] ^ old_keys[c])&keys[c]); + old_keys[c] = keys[c]; + + /* fill the keybuf */ + for (r = 0; r < 8; r++) { + if (dk&1) + rx51_kp_fill((c*8)+r, mods); + dk = dk >> 1; + } + + } + + } + + /* localy unlock twl4030 i2c bus */ + test_and_clear_bit(0, &twl_i2c_lock); + + return (KEYBUF_SIZE + keybuf_tail - keybuf_head)%KEYBUF_SIZE; +} + +/* + * Routine: rx51_kp_getc + * Description: Get last pressed key (from buffer). + */ +int rx51_kp_getc(void) +{ + keybuf_head %= KEYBUF_SIZE; + while (!rx51_kp_tstc()) + WATCHDOG_RESET(); + return keybuf[keybuf_head++]; +} + +/* + * Routine: board_mmc_init + * Description: Initialize mmc devices. + */ +int board_mmc_init(bd_t *bis) +{ + omap_mmc_init(0, 0, 0); + omap_mmc_init(1, 0, 0); + return 0; +} diff --git a/board/nokia/rx51/rx51.h b/board/nokia/rx51/rx51.h new file mode 100644 index 0000000..e66e241 --- /dev/null +++ b/board/nokia/rx51/rx51.h @@ -0,0 +1,389 @@ +/* + * (C) Copyright 2012 + * Ивайло Димитров freemangordon@abv.bg + * + * (C) Copyright 2011-2012 + * Pali Rohár pali.rohar@gmail.com + * + * (C) Copyright 2008 + * Dirk Behme dirk.behme@gmail.com + * + * 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 as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ +#ifndef _RX51_H_ +#define _RX51_H_ + +/* Needed for ROM SMC call */ +struct emu_hal_params_rx51 { + u32 num_params; + u32 param1; + u32 param2; + u32 param3; + u32 param4; +}; + +int print_cpuinfo(void); + +/* + * IEN - Input Enable + * IDIS - Input Disable + * PTD - Pull type Down + * PTU - Pull type Up + * DIS - Pull type selection is inactive + * EN - Pull type selection is active + * M0 - Mode 0 + * The commented string gives the final mux configuration for that pin + */ +#define MUX_RX51() \ +/* SDRC */\ + MUX_VAL(CP(SDRC_D0), (IEN | PTD | DIS | M0)) /*SDRC_D0*/\ + MUX_VAL(CP(SDRC_D1), (IEN | PTD | DIS | M0)) /*SDRC_D1*/\ + MUX_VAL(CP(SDRC_D2), (IEN | PTD | DIS | M0)) /*SDRC_D2*/\ + MUX_VAL(CP(SDRC_D3), (IEN | PTD | DIS | M0)) /*SDRC_D3*/\ + MUX_VAL(CP(SDRC_D4), (IEN | PTD | DIS | M0)) /*SDRC_D4*/\ + MUX_VAL(CP(SDRC_D5), (IEN | PTD | DIS | M0)) /*SDRC_D5*/\ + MUX_VAL(CP(SDRC_D6), (IEN | PTD | DIS | M0)) /*SDRC_D6*/\ + MUX_VAL(CP(SDRC_D7), (IEN | PTD | DIS | M0)) /*SDRC_D7*/\ + MUX_VAL(CP(SDRC_D8), (IEN | PTD | DIS | M0)) /*SDRC_D8*/\ + MUX_VAL(CP(SDRC_D9), (IEN | PTD | DIS | M0)) /*SDRC_D9*/\ + MUX_VAL(CP(SDRC_D10), (IEN | PTD | DIS | M0)) /*SDRC_D10*/\ + MUX_VAL(CP(SDRC_D11), (IEN | PTD | DIS | M0)) /*SDRC_D11*/\ + MUX_VAL(CP(SDRC_D12), (IEN | PTD | DIS | M0)) /*SDRC_D12*/\ + MUX_VAL(CP(SDRC_D13), (IEN | PTD | DIS | M0)) /*SDRC_D13*/\ + MUX_VAL(CP(SDRC_D14), (IEN | PTD | DIS | M0)) /*SDRC_D14*/\ + MUX_VAL(CP(SDRC_D15), (IEN | PTD | DIS | M0)) /*SDRC_D15*/\ + MUX_VAL(CP(SDRC_D16), (IEN | PTD | DIS | M0)) /*SDRC_D16*/\ + MUX_VAL(CP(SDRC_D17), (IEN | PTD | DIS | M0)) /*SDRC_D17*/\ + MUX_VAL(CP(SDRC_D18), (IEN | PTD | DIS | M0)) /*SDRC_D18*/\ + MUX_VAL(CP(SDRC_D19), (IEN | PTD | DIS | M0)) /*SDRC_D19*/\ + MUX_VAL(CP(SDRC_D20), (IEN | PTD | DIS | M0)) /*SDRC_D20*/\ + MUX_VAL(CP(SDRC_D21), (IEN | PTD | DIS | M0)) /*SDRC_D21*/\ + MUX_VAL(CP(SDRC_D22), (IEN | PTD | DIS | M0)) /*SDRC_D22*/\ + MUX_VAL(CP(SDRC_D23), (IEN | PTD | DIS | M0)) /*SDRC_D23*/\ + MUX_VAL(CP(SDRC_D24), (IEN | PTD | DIS | M0)) /*SDRC_D24*/\ + MUX_VAL(CP(SDRC_D25), (IEN | PTD | DIS | M0)) /*SDRC_D25*/\ + MUX_VAL(CP(SDRC_D26), (IEN | PTD | DIS | M0)) /*SDRC_D26*/\ + MUX_VAL(CP(SDRC_D27), (IEN | PTD | DIS | M0)) /*SDRC_D27*/\ + MUX_VAL(CP(SDRC_D28), (IEN | PTD | DIS | M0)) /*SDRC_D28*/\ + MUX_VAL(CP(SDRC_D29), (IEN | PTD | DIS | M0)) /*SDRC_D29*/\ + MUX_VAL(CP(SDRC_D30), (IEN | PTD | DIS | M0)) /*SDRC_D30*/\ + MUX_VAL(CP(SDRC_D31), (IEN | PTD | DIS | M0)) /*SDRC_D31*/\ + MUX_VAL(CP(SDRC_CLK), (IEN | PTD | DIS | M0)) /*SDRC_CLK*/\ + MUX_VAL(CP(SDRC_DQS0), (IEN | PTD | DIS | M0)) /*SDRC_DQS0*/\ + MUX_VAL(CP(SDRC_DQS1), (IEN | PTD | DIS | M0)) /*SDRC_DQS1*/\ + MUX_VAL(CP(SDRC_DQS2), (IEN | PTD | DIS | M0)) /*SDRC_DQS2*/\ + MUX_VAL(CP(SDRC_DQS3), (IEN | PTD | DIS | M0)) /*SDRC_DQS3*/\ +/* GPMC */\ + MUX_VAL(CP(GPMC_A1), (IDIS | PTD | DIS | M0)) /*GPMC_A1*/\ + MUX_VAL(CP(GPMC_A2), (IDIS | PTD | DIS | M0)) /*GPMC_A2*/\ + MUX_VAL(CP(GPMC_A3), (IDIS | PTD | DIS | M0)) /*GPMC_A3*/\ + MUX_VAL(CP(GPMC_A4), (IDIS | PTD | DIS | M0)) /*GPMC_A4*/\ + MUX_VAL(CP(GPMC_A5), (IDIS | PTD | DIS | M0)) /*GPMC_A5*/\ + MUX_VAL(CP(GPMC_A6), (IDIS | PTD | DIS | M0)) /*GPMC_A6*/\ + MUX_VAL(CP(GPMC_A7), (IDIS | PTD | DIS | M0)) /*GPMC_A7*/\ + MUX_VAL(CP(GPMC_A8), (IDIS | PTD | DIS | M0)) /*GPMC_A8*/\ + MUX_VAL(CP(GPMC_A9), (IDIS | PTD | DIS | M0)) /*GPMC_A9*/\ + MUX_VAL(CP(GPMC_A10), (IDIS | PTD | DIS | M0)) /*GPMC_A10*/\ + MUX_VAL(CP(GPMC_D0), (IEN | PTD | DIS | M0)) /*GPMC_D0*/\ + MUX_VAL(CP(GPMC_D1), (IEN | PTD | DIS | M0)) /*GPMC_D1*/\ + MUX_VAL(CP(GPMC_D2), (IEN | PTD | DIS | M0)) /*GPMC_D2*/\ + MUX_VAL(CP(GPMC_D3), (IEN | PTD | DIS | M0)) /*GPMC_D3*/\ + MUX_VAL(CP(GPMC_D4), (IEN | PTD | DIS | M0)) /*GPMC_D4*/\ + MUX_VAL(CP(GPMC_D5), (IEN | PTD | DIS | M0)) /*GPMC_D5*/\ + MUX_VAL(CP(GPMC_D6), (IEN | PTD | DIS | M0)) /*GPMC_D6*/\ + MUX_VAL(CP(GPMC_D7), (IEN | PTD | DIS | M0)) /*GPMC_D7*/\ + MUX_VAL(CP(GPMC_D8), (IEN | PTD | DIS | M0)) /*GPMC_D8*/\ + MUX_VAL(CP(GPMC_D9), (IEN | PTD | DIS | M0)) /*GPMC_D9*/\ + MUX_VAL(CP(GPMC_D10), (IEN | PTD | DIS | M0)) /*GPMC_D10*/\ + MUX_VAL(CP(GPMC_D11), (IEN | PTD | DIS | M0)) /*GPMC_D11*/\ + MUX_VAL(CP(GPMC_D12), (IEN | PTD | DIS | M0)) /*GPMC_D12*/\ + MUX_VAL(CP(GPMC_D13), (IEN | PTD | DIS | M0)) /*GPMC_D13*/\ + MUX_VAL(CP(GPMC_D14), (IEN | PTD | DIS | M0)) /*GPMC_D14*/\ + MUX_VAL(CP(GPMC_D15), (IEN | PTD | DIS | M0)) /*GPMC_D15*/\ + MUX_VAL(CP(GPMC_NCS0), (IDIS | PTU | EN | M0)) /*GPMC_nCS0*/\ + MUX_VAL(CP(GPMC_NCS1), (IDIS | PTU | EN | M0)) /*GPMC_nCS1*/\ + MUX_VAL(CP(GPMC_NCS2), (IDIS | PTU | EN | M0)) /*GPMC_nCS2*/\ + MUX_VAL(CP(GPMC_NCS3), (IDIS | PTU | EN | M0)) /*GPMC_nCS3*/\ + MUX_VAL(CP(GPMC_NCS4), (IDIS | PTU | EN | M0)) /*GPMC_nCS4*/\ + MUX_VAL(CP(GPMC_NCS5), (IDIS | PTD | DIS | M0)) /*GPMC_nCS5*/\ + MUX_VAL(CP(GPMC_NCS6), (IEN | PTD | DIS | M1)) /*nDMA_REQ2*/\ + MUX_VAL(CP(GPMC_NCS7), (IEN | PTU | EN | M1)) /*nDMA_REQ3*/\ + MUX_VAL(CP(GPMC_NBE1), (IEN | PTD | DIS | M0)) /*GPMC_nBE1*/\ + MUX_VAL(CP(GPMC_WAIT2), (IEN | PTU | EN | M0)) /*GPMC_WAIT2*/\ + MUX_VAL(CP(GPMC_WAIT3), (IEN | PTU | EN | M0)) /*GPMC_WAIT3*/\ + MUX_VAL(CP(GPMC_CLK), (IDIS | PTD | DIS | M0)) /*GPMC_CLK*/\ + MUX_VAL(CP(GPMC_NADV_ALE), (IDIS | PTD | DIS | M0)) /*GPMC_nADV*/\ + MUX_VAL(CP(GPMC_NOE), (IDIS | PTD | DIS | M0)) /*GPMC_nOE*/\ + MUX_VAL(CP(GPMC_NWE), (IDIS | PTD | DIS | M0)) /*GPMC_nWE*/\ + MUX_VAL(CP(GPMC_NBE0_CLE), (IDIS | PTD | DIS | M0)) /*GPMC_nBE0*/\ + MUX_VAL(CP(GPMC_NWP), (IEN | PTD | DIS | M0)) /*GPMC_nWP*/\ + MUX_VAL(CP(GPMC_WAIT0), (IEN | PTU | EN | M0)) /*GPMC_WAIT0*/\ + MUX_VAL(CP(GPMC_WAIT1), (IEN | PTU | EN | M0)) /*GPMC_WAIT1*/\ +/* DSS */\ + MUX_VAL(CP(DSS_PCLK), (IDIS | PTD | DIS | M0)) /*DSS_PCLK*/\ + MUX_VAL(CP(DSS_HSYNC), (IDIS | PTD | DIS | M0)) /*DSS_HSYNC*/\ + MUX_VAL(CP(DSS_VSYNC), (IDIS | PTD | DIS | M0)) /*DSS_VSYNC*/\ + MUX_VAL(CP(DSS_ACBIAS), (IDIS | PTD | DIS | M0)) /*DSS_ACBIAS*/\ + MUX_VAL(CP(DSS_DATA0), (IDIS | PTD | DIS | M0)) /*DSS_DATA0*/\ + MUX_VAL(CP(DSS_DATA1), (IDIS | PTD | DIS | M0)) /*DSS_DATA1*/\ + MUX_VAL(CP(DSS_DATA2), (IDIS | PTD | DIS | M0)) /*DSS_DATA2*/\ + MUX_VAL(CP(DSS_DATA3), (IDIS | PTD | DIS | M0)) /*DSS_DATA3*/\ + MUX_VAL(CP(DSS_DATA4), (IDIS | PTD | DIS | M0)) /*DSS_DATA4*/\ + MUX_VAL(CP(DSS_DATA5), (IDIS | PTD | DIS | M0)) /*DSS_DATA5*/\ + MUX_VAL(CP(DSS_DATA6), (IDIS | PTD | DIS | M0)) /*DSS_DATA6*/\ + MUX_VAL(CP(DSS_DATA7), (IDIS | PTD | DIS | M0)) /*DSS_DATA7*/\ + MUX_VAL(CP(DSS_DATA8), (IDIS | PTD | DIS | M0)) /*DSS_DATA8*/\ + MUX_VAL(CP(DSS_DATA9), (IDIS | PTD | DIS | M0)) /*DSS_DATA9*/\ + MUX_VAL(CP(DSS_DATA10), (IDIS | PTD | DIS | M0)) /*DSS_DATA10*/\ + MUX_VAL(CP(DSS_DATA11), (IDIS | PTD | DIS | M0)) /*DSS_DATA11*/\ + MUX_VAL(CP(DSS_DATA12), (IDIS | PTD | DIS | M0)) /*DSS_DATA12*/\ + MUX_VAL(CP(DSS_DATA13), (IDIS | PTD | DIS | M0)) /*DSS_DATA13*/\ + MUX_VAL(CP(DSS_DATA14), (IDIS | PTD | DIS | M0)) /*DSS_DATA14*/\ + MUX_VAL(CP(DSS_DATA15), (IDIS | PTD | DIS | M0)) /*DSS_DATA15*/\ + MUX_VAL(CP(DSS_DATA16), (IDIS | PTD | DIS | M0)) /*DSS_DATA16*/\ + MUX_VAL(CP(DSS_DATA17), (IDIS | PTD | DIS | M0)) /*DSS_DATA17*/\ + MUX_VAL(CP(DSS_DATA18), (IDIS | PTD | DIS | M0)) /*DSS_DATA18*/\ + MUX_VAL(CP(DSS_DATA19), (IDIS | PTD | DIS | M0)) /*DSS_DATA19*/\ + MUX_VAL(CP(DSS_DATA20), (IDIS | PTD | DIS | M0)) /*DSS_DATA20*/\ + MUX_VAL(CP(DSS_DATA21), (IDIS | PTD | DIS | M0)) /*DSS_DATA21*/\ + MUX_VAL(CP(DSS_DATA22), (IDIS | PTD | DIS | M0)) /*DSS_DATA22*/\ + MUX_VAL(CP(DSS_DATA23), (IDIS | PTD | DIS | M0)) /*DSS_DATA23*/\ +/* CAMERA */\ + MUX_VAL(CP(CAM_HS), (IEN | PTU | EN | M0)) /*CAM_HS*/\ + MUX_VAL(CP(CAM_VS), (IEN | PTU | EN | M0)) /*CAM_VS*/\ + MUX_VAL(CP(CAM_XCLKA), (IDIS | PTD | DIS | M0)) /*CAM_XCLKA*/\ + MUX_VAL(CP(CAM_PCLK), (IEN | PTU | EN | M0)) /*CAM_PCLK*/\ + MUX_VAL(CP(CAM_FLD), (IDIS | PTD | DIS | M4)) /*GPIO_98*/\ + MUX_VAL(CP(CAM_D0), (IEN | PTD | DIS | M0)) /*CAM_D0*/\ + MUX_VAL(CP(CAM_D1), (IEN | PTD | DIS | M0)) /*CAM_D1*/\ + MUX_VAL(CP(CAM_D2), (IEN | PTD | DIS | M0)) /*CAM_D2*/\ + MUX_VAL(CP(CAM_D3), (IEN | PTD | DIS | M0)) /*CAM_D3*/\ + MUX_VAL(CP(CAM_D4), (IEN | PTD | DIS | M0)) /*CAM_D4*/\ + MUX_VAL(CP(CAM_D5), (IEN | PTD | DIS | M0)) /*CAM_D5*/\ + MUX_VAL(CP(CAM_D6), (IEN | PTD | DIS | M0)) /*CAM_D6*/\ + MUX_VAL(CP(CAM_D7), (IEN | PTD | DIS | M0)) /*CAM_D7*/\ + MUX_VAL(CP(CAM_D8), (IEN | PTD | DIS | M0)) /*CAM_D8*/\ + MUX_VAL(CP(CAM_D9), (IEN | PTD | DIS | M0)) /*CAM_D9*/\ + MUX_VAL(CP(CAM_D10), (IEN | PTD | DIS | M0)) /*CAM_D10*/\ + MUX_VAL(CP(CAM_D11), (IEN | PTD | DIS | M0)) /*CAM_D11*/\ + MUX_VAL(CP(CAM_XCLKB), (IDIS | PTD | DIS | M0)) /*CAM_XCLKB*/\ + MUX_VAL(CP(CAM_WEN), (IEN | PTD | DIS | M4)) /*GPIO_167*/\ + MUX_VAL(CP(CAM_STROBE), (IDIS | PTD | DIS | M0)) /*CAM_STROBE*/\ + MUX_VAL(CP(CSI2_DX0), (IEN | PTD | DIS | M0)) /*CSI2_DX0*/\ + MUX_VAL(CP(CSI2_DY0), (IEN | PTD | DIS | M0)) /*CSI2_DY0*/\ + MUX_VAL(CP(CSI2_DX1), (IEN | PTD | DIS | M0)) /*CSI2_DX1*/\ + MUX_VAL(CP(CSI2_DY1), (IEN | PTD | DIS | M0)) /*CSI2_DY1*/\ +/* Audio Interface */\ + MUX_VAL(CP(MCBSP2_FSX), (IEN | PTD | DIS | M0)) /*McBSP2_FSX*/\ + MUX_VAL(CP(MCBSP2_CLKX), (IEN | PTD | DIS | M0)) /*McBSP2_CLK*/\ + MUX_VAL(CP(MCBSP2_DR), (IEN | PTD | DIS | M0)) /*McBSP2_DR*/\ + MUX_VAL(CP(MCBSP2_DX), (IDIS | PTD | DIS | M0)) /*McBSP2_DX*/\ +/* Expansion card */\ + MUX_VAL(CP(MMC1_CLK), (IDIS | PTU | EN | M0)) /*MMC1_CLK*/\ + MUX_VAL(CP(MMC1_CMD), (IEN | PTU | EN | M0)) /*MMC1_CMD*/\ + MUX_VAL(CP(MMC1_DAT0), (IEN | PTU | EN | M0)) /*MMC1_DAT0*/\ + MUX_VAL(CP(MMC1_DAT1), (IEN | PTU | EN | M0)) /*MMC1_DAT1*/\ + MUX_VAL(CP(MMC1_DAT2), (IEN | PTU | EN | M0)) /*MMC1_DAT2*/\ + MUX_VAL(CP(MMC1_DAT3), (IEN | PTU | EN | M0)) /*MMC1_DAT3*/\ + MUX_VAL(CP(MMC1_DAT4), (IEN | PTU | EN | M0)) /*MMC1_DAT4*/\ + MUX_VAL(CP(MMC1_DAT5), (IEN | PTU | EN | M0)) /*MMC1_DAT5*/\ + MUX_VAL(CP(MMC1_DAT6), (IEN | PTU | EN | M0)) /*MMC1_DAT6*/\ + MUX_VAL(CP(MMC1_DAT7), (IEN | PTU | EN | M0)) /*MMC1_DAT7*/\ +/* Wireless LAN */\ + MUX_VAL(CP(MMC2_CLK), (IEN | PTU | EN | M4)) /*GPIO_130*/\ + MUX_VAL(CP(MMC2_CMD), (IEN | PTU | EN | M4)) /*GPIO_131*/\ + MUX_VAL(CP(MMC2_DAT0), (IEN | PTU | EN | M4)) /*GPIO_132*/\ + MUX_VAL(CP(MMC2_DAT1), (IEN | PTU | EN | M4)) /*GPIO_133*/\ + MUX_VAL(CP(MMC2_DAT2), (IEN | PTU | EN | M4)) /*GPIO_134*/\ + MUX_VAL(CP(MMC2_DAT3), (IEN | PTU | EN | M4)) /*GPIO_135*/\ + MUX_VAL(CP(MMC2_DAT4), (IEN | PTU | EN | M4)) /*GPIO_136*/\ + MUX_VAL(CP(MMC2_DAT5), (IEN | PTU | EN | M4)) /*GPIO_137*/\ + MUX_VAL(CP(MMC2_DAT6), (IEN | PTU | EN | M4)) /*GPIO_138*/\ + MUX_VAL(CP(MMC2_DAT7), (IEN | PTU | EN | M4)) /*GPIO_139*/\ +/* Bluetooth */\ + MUX_VAL(CP(MCBSP3_DX), (IEN | PTD | DIS | M1)) /*UART2_CTS*/\ + MUX_VAL(CP(MCBSP3_DR), (IDIS | PTD | DIS | M1)) /*UART2_RTS*/\ + MUX_VAL(CP(MCBSP3_CLKX), (IDIS | PTD | DIS | M1)) /*UART2_TX*/\ + MUX_VAL(CP(MCBSP3_FSX), (IEN | PTD | DIS | M1)) /*UART2_RX*/\ + MUX_VAL(CP(UART2_CTS), (IEN | PTD | DIS | M4)) /*GPIO_144*/\ + MUX_VAL(CP(UART2_RTS), (IEN | PTD | DIS | M4)) /*GPIO_145*/\ + MUX_VAL(CP(UART2_TX), (IEN | PTD | DIS | M4)) /*GPIO_146*/\ + MUX_VAL(CP(UART2_RX), (IEN | PTD | DIS | M4)) /*GPIO_147*/\ +/* Modem Interface */\ + MUX_VAL(CP(UART1_TX), (IDIS | PTD | DIS | M0)) /*UART1_TX*/\ + MUX_VAL(CP(UART1_RTS), (IDIS | PTD | DIS | M4)) /*GPIO_149*/\ + MUX_VAL(CP(UART1_CTS), (IDIS | PTD | DIS | M4)) /*GPIO_150*/\ + MUX_VAL(CP(UART1_RX), (IEN | PTD | DIS | M0)) /*UART1_RX*/\ + MUX_VAL(CP(MCBSP4_CLKX), (IEN | PTD | DIS | M1)) /*SSI1_DAT*/\ + MUX_VAL(CP(MCBSP4_DR), (IEN | PTD | DIS | M1)) /*SSI1_FLAG*/\ + MUX_VAL(CP(MCBSP4_DX), (IEN | PTD | DIS | M1)) /*SSI1_RDY*/\ + MUX_VAL(CP(MCBSP4_FSX), (IEN | PTD | DIS | M1)) /*SSI1_WAKE*/\ + MUX_VAL(CP(MCBSP1_CLKR), (IDIS | PTD | DIS | M4)) /*GPIO_156*/\ + MUX_VAL(CP(MCBSP1_FSR), (IDIS | PTU | EN | M4)) /*GPIO_157*/\ + MUX_VAL(CP(MCBSP1_DX), (IDIS | PTD | DIS | M4)) /*GPIO_158*/\ + MUX_VAL(CP(MCBSP1_DR), (IDIS | PTD | DIS | M4)) /*GPIO_159*/\ + MUX_VAL(CP(MCBSP_CLKS), (IEN | PTU | DIS | M0)) /*McBSP_CLKS*/\ + MUX_VAL(CP(MCBSP1_FSX), (IDIS | PTD | DIS | M4)) /*GPIO_161*/\ + MUX_VAL(CP(MCBSP1_CLKX), (IDIS | PTD | DIS | M4)) /*GPIO_162*/\ +/* Serial Interface */\ + MUX_VAL(CP(UART3_CTS_RCTX), (IEN | PTD | EN | M0)) /*UART3_CTS*/\ + MUX_VAL(CP(UART3_RTS_SD), (IDIS | PTD | DIS | M0)) /*UART3_RTS*/\ + MUX_VAL(CP(UART3_RX_IRRX), (IEN | PTD | DIS | M0)) /*UART3_RX*/\ + MUX_VAL(CP(UART3_TX_IRTX), (IDIS | PTD | DIS | M0)) /*UART3_TX*/\ + MUX_VAL(CP(HSUSB0_CLK), (IEN | PTD | DIS | M0)) /*HSUSB0_CLK*/\ + MUX_VAL(CP(HSUSB0_STP), (IDIS | PTU | EN | M0)) /*HSUSB0_STP*/\ + MUX_VAL(CP(HSUSB0_DIR), (IEN | PTD | DIS | M0)) /*HSUSB0_DIR*/\ + MUX_VAL(CP(HSUSB0_NXT), (IEN | PTD | DIS | M0)) /*HSUSB0_NXT*/\ + MUX_VAL(CP(HSUSB0_DATA0), (IEN | PTD | DIS | M0)) /*HSUSB0_DA0*/\ + MUX_VAL(CP(HSUSB0_DATA1), (IEN | PTD | DIS | M0)) /*HSUSB0_DA1*/\ + MUX_VAL(CP(HSUSB0_DATA2), (IEN | PTD | DIS | M0)) /*HSUSB0_DA2*/\ + MUX_VAL(CP(HSUSB0_DATA3), (IEN | PTD | DIS | M0)) /*HSUSB0_DA3*/\ + MUX_VAL(CP(HSUSB0_DATA4), (IEN | PTD | DIS | M0)) /*HSUSB0_DA4*/\ + MUX_VAL(CP(HSUSB0_DATA5), (IEN | PTD | DIS | M0)) /*HSUSB0_DA5*/\ + MUX_VAL(CP(HSUSB0_DATA6), (IEN | PTD | DIS | M0)) /*HSUSB0_DA6*/\ + MUX_VAL(CP(HSUSB0_DATA7), (IEN | PTD | DIS | M0)) /*HSUSB0_DA7*/\ + MUX_VAL(CP(I2C1_SCL), (IEN | PTU | EN | M0)) /*I2C1_SCL*/\ + MUX_VAL(CP(I2C1_SDA), (IEN | PTU | EN | M0)) /*I2C1_SDA*/\ + MUX_VAL(CP(I2C2_SCL), (IEN | PTU | EN | M4)) /*GPIO_168*/\ + MUX_VAL(CP(I2C2_SDA), (IEN | PTU | EN | M4)) /*GPIO_183*/\ + MUX_VAL(CP(I2C3_SCL), (IEN | PTU | EN | M0)) /*I2C3_SCL*/\ + MUX_VAL(CP(I2C3_SDA), (IEN | PTU | EN | M0)) /*I2C3_SDA*/\ + MUX_VAL(CP(I2C4_SCL), (IEN | PTU | EN | M0)) /*I2C4_SCL*/\ + MUX_VAL(CP(I2C4_SDA), (IEN | PTU | EN | M0)) /*I2C4_SDA*/\ + MUX_VAL(CP(HDQ_SIO), (IDIS | PTU | EN | M4)) /*GPIO_170*/\ + MUX_VAL(CP(MCSPI1_CLK), (IEN | PTU | EN | M4)) /*GPIO_171*/\ + MUX_VAL(CP(MCSPI1_SIMO), (IEN | PTU | EN | M4)) /*GPIO_172*/\ + MUX_VAL(CP(MCSPI1_SOMI), (IEN | PTD | DIS | M0)) /*McSPI1_SOM*/\ + MUX_VAL(CP(MCSPI1_CS0), (IEN | PTD | EN | M0)) /*McSPI1_CS0*/\ + MUX_VAL(CP(MCSPI1_CS1), (IDIS | PTD | EN | M0)) /*McSPI1_CS1*/\ + MUX_VAL(CP(MCSPI1_CS2), (IDIS | PTD | DIS | M4)) /*GPIO_176*/\ +/* USB EHCI (port 2) */\ + MUX_VAL(CP(MCSPI1_CS3), (IEN | PTU | DIS | M3)) /*HSUSB2_DA2*/\ + MUX_VAL(CP(MCSPI2_CLK), (IEN | PTU | DIS | M3)) /*HSUSB2_DA7*/\ + MUX_VAL(CP(MCSPI2_SIMO), (IEN | PTU | DIS | M3)) /*HSUSB2_DA4*/\ + MUX_VAL(CP(MCSPI2_SOMI), (IEN | PTU | DIS | M3)) /*HSUSB2_DA5*/\ + MUX_VAL(CP(MCSPI2_CS0), (IEN | PTU | DIS | M3)) /*HSUSB2_DA6*/\ + MUX_VAL(CP(MCSPI2_CS1), (IEN | PTU | DIS | M3)) /*HSUSB2_DA3*/\ + MUX_VAL(CP(ETK_D10_ES2), (IDIS | PTU | DIS | M3)) /*HSUSB2_CLK*/\ + MUX_VAL(CP(ETK_D11_ES2), (IDIS | PTU | DIS | M3)) /*HSUSB2_STP*/\ + MUX_VAL(CP(ETK_D12_ES2), (IEN | PTU | DIS | M3)) /*HSUSB2_DIR*/\ + MUX_VAL(CP(ETK_D13_ES2), (IEN | PTU | DIS | M3)) /*HSUSB2_NXT*/\ + MUX_VAL(CP(ETK_D14_ES2), (IEN | PTU | DIS | M3)) /*HSUSB2_DA0*/\ + MUX_VAL(CP(ETK_D15_ES2), (IEN | PTU | DIS | M3)) /*HSUSB2_DA1*/\ +/* Control and debug */\ + MUX_VAL(CP(SYS_32K), (IEN | PTD | DIS | M0)) /*SYS_32K*/\ + MUX_VAL(CP(SYS_CLKREQ), (IEN | PTD | DIS | M0)) /*SYS_CLKREQ*/\ + MUX_VAL(CP(SYS_NIRQ), (IEN | PTU | EN | M0)) /*SYS_nIRQ*/\ + MUX_VAL(CP(SYS_BOOT0), (IEN | PTD | DIS | M4)) /*GPIO_2*/\ + MUX_VAL(CP(SYS_BOOT1), (IEN | PTD | DIS | M4)) /*GPIO_3*/\ + MUX_VAL(CP(SYS_BOOT2), (IEN | PTD | DIS | M4)) /*MMC1_WP*/\ + MUX_VAL(CP(SYS_BOOT3), (IEN | PTD | DIS | M4)) /*GPIO_5*/\ + MUX_VAL(CP(SYS_BOOT4), (IEN | PTD | DIS | M4)) /*GPIO_6*/\ + MUX_VAL(CP(SYS_BOOT5), (IEN | PTD | DIS | M4)) /*GPIO_7*/\ + MUX_VAL(CP(SYS_BOOT6), (IDIS | PTD | DIS | M4)) /*GPIO_8*/\ + MUX_VAL(CP(SYS_OFF_MODE), (IEN | PTD | DIS | M0)) /*SYS_OFF_MD*/\ + MUX_VAL(CP(SYS_CLKOUT1), (IEN | PTD | DIS | M0)) /*SYS_CLKOUT*/\ + MUX_VAL(CP(SYS_CLKOUT2), (IEN | PTU | EN | M4)) /*GPIO_186*/\ + MUX_VAL(CP(ETK_CLK_ES2), (IDIS | PTU | EN | M3)) /*HSUSB1_STP*/\ + MUX_VAL(CP(ETK_CTL_ES2), (IDIS | PTU | DIS | M3)) /*HSUSB1_CLK*/\ + MUX_VAL(CP(ETK_D0_ES2), (IEN | PTU | DIS | M3)) /*HSUSB1_DA0*/\ + MUX_VAL(CP(ETK_D1_ES2), (IEN | PTU | DIS | M3)) /*HSUSB1_DA1*/\ + MUX_VAL(CP(ETK_D2_ES2), (IEN | PTU | DIS | M3)) /*HSUSB1_DA2*/\ + MUX_VAL(CP(ETK_D3_ES2), (IEN | PTU | DIS | M3)) /*HSUSB1_DA7*/\ + MUX_VAL(CP(ETK_D4_ES2), (IEN | PTU | DIS | M3)) /*HSUSB1_DA4*/\ + MUX_VAL(CP(ETK_D5_ES2), (IEN | PTU | DIS | M3)) /*HSUSB1_DA5*/\ + MUX_VAL(CP(ETK_D6_ES2), (IEN | PTU | DIS | M3)) /*HSUSB1_DA6*/\ + MUX_VAL(CP(ETK_D7_ES2), (IEN | PTU | DIS | M3)) /*HSUSB1_DA3*/\ + MUX_VAL(CP(ETK_D8_ES2), (IEN | PTU | DIS | M3)) /*HSUSB1_DIR*/\ + MUX_VAL(CP(ETK_D9_ES2), (IEN | PTU | DIS | M3)) /*HSUSB1_NXT*/\ + MUX_VAL(CP(D2D_MCAD1), (IEN | PTD | EN | M0)) /*d2d_mcad1*/\ + MUX_VAL(CP(D2D_MCAD2), (IEN | PTD | EN | M0)) /*d2d_mcad2*/\ + MUX_VAL(CP(D2D_MCAD3), (IEN | PTD | EN | M0)) /*d2d_mcad3*/\ + MUX_VAL(CP(D2D_MCAD4), (IEN | PTD | EN | M0)) /*d2d_mcad4*/\ + MUX_VAL(CP(D2D_MCAD5), (IEN | PTD | EN | M0)) /*d2d_mcad5*/\ + MUX_VAL(CP(D2D_MCAD6), (IEN | PTD | EN | M0)) /*d2d_mcad6*/\ + MUX_VAL(CP(D2D_MCAD7), (IEN | PTD | EN | M0)) /*d2d_mcad7*/\ + MUX_VAL(CP(D2D_MCAD8), (IEN | PTD | EN | M0)) /*d2d_mcad8*/\ + MUX_VAL(CP(D2D_MCAD9), (IEN | PTD | EN | M0)) /*d2d_mcad9*/\ + MUX_VAL(CP(D2D_MCAD10), (IEN | PTD | EN | M0)) /*d2d_mcad10*/\ + MUX_VAL(CP(D2D_MCAD11), (IEN | PTD | EN | M0)) /*d2d_mcad11*/\ + MUX_VAL(CP(D2D_MCAD12), (IEN | PTD | EN | M0)) /*d2d_mcad12*/\ + MUX_VAL(CP(D2D_MCAD13), (IEN | PTD | EN | M0)) /*d2d_mcad13*/\ + MUX_VAL(CP(D2D_MCAD14), (IEN | PTD | EN | M0)) /*d2d_mcad14*/\ + MUX_VAL(CP(D2D_MCAD15), (IEN | PTD | EN | M0)) /*d2d_mcad15*/\ + MUX_VAL(CP(D2D_MCAD16), (IEN | PTD | EN | M0)) /*d2d_mcad16*/\ + MUX_VAL(CP(D2D_MCAD17), (IEN | PTD | EN | M0)) /*d2d_mcad17*/\ + MUX_VAL(CP(D2D_MCAD18), (IEN | PTD | EN | M0)) /*d2d_mcad18*/\ + MUX_VAL(CP(D2D_MCAD19), (IEN | PTD | EN | M0)) /*d2d_mcad19*/\ + MUX_VAL(CP(D2D_MCAD20), (IEN | PTD | EN | M0)) /*d2d_mcad20*/\ + MUX_VAL(CP(D2D_MCAD21), (IEN | PTD | EN | M0)) /*d2d_mcad21*/\ + MUX_VAL(CP(D2D_MCAD22), (IEN | PTD | EN | M0)) /*d2d_mcad22*/\ + MUX_VAL(CP(D2D_MCAD23), (IEN | PTD | EN | M0)) /*d2d_mcad23*/\ + MUX_VAL(CP(D2D_MCAD24), (IEN | PTD | EN | M0)) /*d2d_mcad24*/\ + MUX_VAL(CP(D2D_MCAD25), (IEN | PTD | EN | M0)) /*d2d_mcad25*/\ + MUX_VAL(CP(D2D_MCAD26), (IEN | PTD | EN | M0)) /*d2d_mcad26*/\ + MUX_VAL(CP(D2D_MCAD27), (IEN | PTD | EN | M0)) /*d2d_mcad27*/\ + MUX_VAL(CP(D2D_MCAD28), (IEN | PTD | EN | M0)) /*d2d_mcad28*/\ + MUX_VAL(CP(D2D_MCAD29), (IEN | PTD | EN | M0)) /*d2d_mcad29*/\ + MUX_VAL(CP(D2D_MCAD30), (IEN | PTD | EN | M0)) /*d2d_mcad30*/\ + MUX_VAL(CP(D2D_MCAD31), (IEN | PTD | EN | M0)) /*d2d_mcad31*/\ + MUX_VAL(CP(D2D_MCAD32), (IEN | PTD | EN | M0)) /*d2d_mcad32*/\ + MUX_VAL(CP(D2D_MCAD33), (IEN | PTD | EN | M0)) /*d2d_mcad33*/\ + MUX_VAL(CP(D2D_MCAD34), (IEN | PTD | EN | M0)) /*d2d_mcad34*/\ + MUX_VAL(CP(D2D_MCAD35), (IEN | PTD | EN | M0)) /*d2d_mcad35*/\ + MUX_VAL(CP(D2D_MCAD36), (IEN | PTD | EN | M0)) /*d2d_mcad36*/\ + MUX_VAL(CP(D2D_CLK26MI), (IEN | PTD | DIS | M0)) /*d2d_clk26m*/\ + MUX_VAL(CP(D2D_NRESPWRON), (IEN | PTD | EN | M0)) /*d2d_nrespw*/\ + MUX_VAL(CP(D2D_NRESWARM), (IEN | PTU | EN | M0)) /*d2d_nreswa*/\ + MUX_VAL(CP(D2D_ARM9NIRQ), (IEN | PTD | DIS | M0)) /*d2d_arm9ni*/\ + MUX_VAL(CP(D2D_UMA2P6FIQ), (IEN | PTD | DIS | M0)) /*d2d_uma2p6*/\ + MUX_VAL(CP(D2D_SPINT), (IEN | PTD | EN | M0)) /*d2d_spint*/\ + MUX_VAL(CP(D2D_FRINT), (IEN | PTD | EN | M0)) /*d2d_frint*/\ + MUX_VAL(CP(D2D_DMAREQ0), (IEN | PTD | DIS | M0)) /*d2d_dmare0*/\ + MUX_VAL(CP(D2D_DMAREQ1), (IEN | PTD | DIS | M0)) /*d2d_dmare1*/\ + MUX_VAL(CP(D2D_DMAREQ2), (IEN | PTD | DIS | M0)) /*d2d_dmare2*/\ + MUX_VAL(CP(D2D_DMAREQ3), (IEN | PTD | DIS | M0)) /*d2d_dmare3*/\ + MUX_VAL(CP(D2D_N3GTRST), (IEN | PTD | DIS | M0)) /*d2d_n3gtrs*/\ + MUX_VAL(CP(D2D_N3GTDI), (IEN | PTD | DIS | M0)) /*d2d_n3gtdi*/\ + MUX_VAL(CP(D2D_N3GTDO), (IEN | PTD | DIS | M0)) /*d2d_n3gtdo*/\ + MUX_VAL(CP(D2D_N3GTMS), (IEN | PTD | DIS | M0)) /*d2d_n3gtms*/\ + MUX_VAL(CP(D2D_N3GTCK), (IEN | PTD | DIS | M0)) /*d2d_n3gtck*/\ + MUX_VAL(CP(D2D_N3GRTCK), (IEN | PTD | DIS | M0)) /*d2d_n3grtc*/\ + MUX_VAL(CP(D2D_MSTDBY), (IEN | PTU | EN | M0)) /*d2d_mstdby*/\ + MUX_VAL(CP(D2D_SWAKEUP), (IEN | PTD | EN | M0)) /*d2d_swakeu*/\ + MUX_VAL(CP(D2D_IDLEREQ), (IEN | PTD | DIS | M0)) /*d2d_idlere*/\ + MUX_VAL(CP(D2D_IDLEACK), (IEN | PTU | EN | M0)) /*d2d_idleac*/\ + MUX_VAL(CP(D2D_MWRITE), (IEN | PTD | DIS | M0)) /*d2d_mwrite*/\ + MUX_VAL(CP(D2D_SWRITE), (IEN | PTD | DIS | M0)) /*d2d_swrite*/\ + MUX_VAL(CP(D2D_MREAD), (IEN | PTD | DIS | M0)) /*d2d_mread*/\ + MUX_VAL(CP(D2D_SREAD), (IEN | PTD | DIS | M0)) /*d2d_sread*/\ + MUX_VAL(CP(D2D_MBUSFLAG), (IEN | PTD | DIS | M0)) /*d2d_mbusfl*/\ + MUX_VAL(CP(D2D_SBUSFLAG), (IEN | PTD | DIS | M0)) /*d2d_sbusfl*/\ + MUX_VAL(CP(SDRC_CKE0), (IDIS | PTU | EN | M0)) /*sdrc_cke0*/\ + MUX_VAL(CP(SDRC_CKE1), (IDIS | PTU | EN | M0)) /*sdrc_cke1*/ + +#define MUX_RX51_C() \ + MUX_VAL(CP(MCBSP3_DX), (IEN | PTD | DIS | M4)) /*GPIO_140*/\ + MUX_VAL(CP(MCBSP3_DR), (IEN | PTD | DIS | M4)) /*GPIO_142*/\ + MUX_VAL(CP(MCBSP3_CLKX), (IEN | PTD | DIS | M4)) /*GPIO_141*/\ + MUX_VAL(CP(UART2_CTS), (IEN | PTU | EN | M0)) /*UART2_CTS*/\ + MUX_VAL(CP(UART2_RTS), (IDIS | PTD | DIS | M0)) /*UART2_RTS*/\ + MUX_VAL(CP(UART2_TX), (IDIS | PTD | DIS | M0)) /*UART2_TX*/ + +#endif diff --git a/board/nokia/rx51/tag_omap.h b/board/nokia/rx51/tag_omap.h new file mode 100644 index 0000000..60fa26f --- /dev/null +++ b/board/nokia/rx51/tag_omap.h @@ -0,0 +1,311 @@ +/* + * (C) Copyright 2011-2012 + * Pali Rohár pali.rohar@gmail.com + * + * (C) Copyright 2011 + * marcel@mesa.nl, Mesa Consulting B.V. + * + * (C) Copyright 2004-2005 + * Nokia Corporation + * + * 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 as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + + +/* + * Code copied from maemo kernel 2.6.28 file + * arch/arm/plat-omap/include/mach/board.h + * + * Information structures for board-specific data + * + * Copyright (C) 2004 Nokia Corporation + * Written by Juha Yrjölä juha.yrjola@nokia.com + */ + +/* Different peripheral ids */ +#define OMAP_TAG_CLOCK 0x4f01 +#define OMAP_TAG_SERIAL_CONSOLE 0x4f03 +#define OMAP_TAG_USB 0x4f04 +#define OMAP_TAG_LCD 0x4f05 +#define OMAP_TAG_GPIO_SWITCH 0x4f06 +#define OMAP_TAG_UART 0x4f07 +#define OMAP_TAG_FBMEM 0x4f08 +#define OMAP_TAG_STI_CONSOLE 0x4f09 +#define OMAP_TAG_CAMERA_SENSOR 0x4f0a +#define OMAP_TAG_PARTITION 0x4f0b +#define OMAP_TAG_TEA5761 0x4f10 +#define OMAP_TAG_TMP105 0x4f11 + +#define OMAP_TAG_BOOT_REASON 0x4f80 +#define OMAP_TAG_FLASH_PART_STR 0x4f81 +#define OMAP_TAG_VERSION_STR 0x4f82 + +#define OMAP_TAG_NOKIA_BT 0x4e01 +#define OMAP_TAG_WLAN_CX3110X 0x4e02 +#define OMAP_TAG_CBUS 0x4e03 +#define OMAP_TAG_EM_ASIC_BB5 0x4e04 + + +struct omap_clock_config { + /* 0 for 12 MHz, 1 for 13 MHz and 2 for 19.2 MHz */ + u8 system_clock_type; +}; + +struct omap_serial_console_config { + u8 console_uart; + u32 console_speed; +}; + +struct omap_sti_console_config { + unsigned enable:1; + u8 channel; +}; + +struct omap_usb_config { + /* Configure drivers according to the connectors on your board: + * - "A" connector (rectagular) + * ... for host/OHCI use, set "register_host". + * - "B" connector (squarish) or "Mini-B" + * ... for device/gadget use, set "register_dev". + * - "Mini-AB" connector (very similar to Mini-B) + * ... for OTG use as device OR host, initialize "otg" + */ + unsigned register_host:1; + unsigned register_dev:1; + u8 otg; /* port number, 1-based: usb1 == 2 */ + + u8 hmc_mode; + + /* implicitly true if otg: host supports remote wakeup? */ + u8 rwc; + + /* signaling pins used to talk to transceiver on usbN: + * 0 == usbN unused + * 2 == usb0-only, using internal transceiver + * 3 == 3 wire bidirectional + * 4 == 4 wire bidirectional + * 6 == 6 wire unidirectional (or TLL) + */ + u8 pins[3]; +}; + +struct omap_lcd_config { + char panel_name[16]; + char ctrl_name[16]; + s16 nreset_gpio; + u8 data_lines; +}; + +struct omap_fbmem_config { + u32 start; + u32 size; +}; + +struct omap_gpio_switch_config { + char name[12]; + u16 gpio; + u8 flags:4; + u8 type:4; + unsigned int key_code:24; /* Linux key code */ +}; + +struct omap_uart_config { + /* Bit field of UARTs present; bit 0 --> UART1 */ + unsigned int enabled_uarts; +}; + +struct omap_tea5761_config { + u16 enable_gpio; +}; + +struct omap_partition_config { + char name[16]; + unsigned int size; + unsigned int offset; + /* same as in include/linux/mtd/partitions.h */ + unsigned int mask_flags; +}; + +struct omap_flash_part_str_config { + char part_table[0]; +}; + +struct omap_boot_reason_config { + char reason_str[12]; +}; + +struct omap_version_config { + char component[12]; + char version[12]; +}; + +/* + * Code copied from maemo kernel 2.6.28 file + * arch/arm/plat-omap/include/mach/board-nokia.h + * + * Information structures for Nokia-specific board config data + * + * Copyright (C) 2005 Nokia Corporation + */ + +struct omap_bluetooth_config { + u8 chip_type; + u8 bt_wakeup_gpio; + u8 host_wakeup_gpio; + u8 reset_gpio; + u8 bt_uart; + u8 bd_addr[6]; + u8 bt_sysclk; +}; + +struct omap_wlan_cx3110x_config { + u8 chip_type; + u8 reserverd; + s16 power_gpio; + s16 irq_gpio; + s16 spi_cs_gpio; +}; + +struct omap_cbus_config { + s16 clk_gpio; + s16 dat_gpio; + s16 sel_gpio; +}; + +struct omap_em_asic_bb5_config { + s16 retu_irq_gpio; + s16 tahvo_irq_gpio; +}; + +/* + * omap_tag handling + * + * processing omap tag structures + * + * Copyright (C) 2011 marcel@mesa.nl, Mesa Consulting B.V. + * Copyright (C) 2012 Pali Rohár pali.rohar@gmail.com + */ + +/* TI OMAP specific information */ +#define ATAG_BOARD 0x414f4d50 + +struct tag_omap_header { + u16 tag; + u16 size; +}; + +struct tag_omap { + struct tag_omap_header hdr; + union { + struct omap_clock_config clock; + struct omap_serial_console_config serial_console; + struct omap_sti_console_config sti_console; + struct omap_usb_config usb; + struct omap_lcd_config lcd; + struct omap_fbmem_config fbmem; + struct omap_gpio_switch_config gpio_switch; + struct omap_uart_config uart; + struct omap_tea5761_config tea5761; + struct omap_partition_config partition; + struct omap_flash_part_str_config flash_part_str; + struct omap_boot_reason_config boot_reason; + struct omap_version_config version; + struct omap_bluetooth_config bluetooth; + struct omap_wlan_cx3110x_config wlan_cx3110x; + struct omap_cbus_config cbus; + struct omap_em_asic_bb5_config em_asic_bb5; + } u; +}; + +#define tag_omap_next(t) ((struct tag_omap *)((u8 *)(t) + \ + (t)->hdr.size + sizeof(struct tag_omap_header))) + +#define OMAP_TAG_HEADER_CONFIG(config, type) \ + .hdr.tag = config, \ + .hdr.size = sizeof(struct type) + +#define OMAP_TAG_UART_CONFIG(p1) \ + { \ + OMAP_TAG_HEADER_CONFIG(OMAP_TAG_UART, omap_uart_config), \ + .u.uart.enabled_uarts = p1, \ + } + +#define OMAP_TAG_SERIAL_CONSOLE_CONFIG(p1, p2) \ + { \ + OMAP_TAG_HEADER_CONFIG(OMAP_TAG_SERIAL_CONSOLE, \ + omap_serial_console_config), \ + .u.serial_console.console_uart = p1, \ + .u.serial_console.console_speed = p2, \ + } + +#define OMAP_TAG_LCD_CONFIG(p1, p2, p3, p4) \ + { \ + OMAP_TAG_HEADER_CONFIG(OMAP_TAG_LCD, omap_lcd_config), \ + .u.lcd.panel_name = p1, \ + .u.lcd.ctrl_name = p2, \ + .u.lcd.nreset_gpio = p3, \ + .u.lcd.data_lines = p4, \ + } + +#define OMAP_TAG_GPIO_SWITCH_CONFIG(p1, p2, p3, p4, p5) \ + { \ + OMAP_TAG_HEADER_CONFIG(OMAP_TAG_GPIO_SWITCH, \ + omap_gpio_switch_config), \ + .u.gpio_switch.name = p1, \ + .u.gpio_switch.gpio = p2, \ + .u.gpio_switch.flags = p3, \ + .u.gpio_switch.type = p4, \ + .u.gpio_switch.key_code = p5, \ + } + +#define OMAP_TAG_WLAN_CX3110X_CONFIG(p1, p2, p3, p4, p5) \ + { \ + OMAP_TAG_HEADER_CONFIG(OMAP_TAG_WLAN_CX3110X, \ + omap_wlan_cx3110x_config), \ + .u.wlan_cx3110x.chip_type = p1, \ + .u.wlan_cx3110x.reserverd = p2, \ + .u.wlan_cx3110x.power_gpio = p3, \ + .u.wlan_cx3110x.irq_gpio = p4, \ + .u.wlan_cx3110x.spi_cs_gpio = p5, \ + } + +#define OMAP_TAG_PARTITION_CONFIG(p1, p2, p3, p4) \ + { \ + OMAP_TAG_HEADER_CONFIG(OMAP_TAG_PARTITION, \ + omap_partition_config), \ + .u.partition.name = p1, \ + .u.partition.size = p2, \ + .u.partition.offset = p3, \ + .u.partition.mask_flags = p4, \ + } + +#define OMAP_TAG_BOOT_REASON_CONFIG(p1) \ + { \ + OMAP_TAG_HEADER_CONFIG(OMAP_TAG_BOOT_REASON, \ + omap_boot_reason_config), \ + .u.boot_reason.reason_str = p1, \ + } + +#define OMAP_TAG_VERSION_STR_CONFIG(p1, p2) \ + { \ + OMAP_TAG_HEADER_CONFIG(OMAP_TAG_VERSION_STR, \ + omap_version_config), \ + .u.version.component = p1, \ + .u.version.version = p2, \ + } diff --git a/boards.cfg b/boards.cfg index 4b17289..0647b3e 100644 --- a/boards.cfg +++ b/boards.cfg @@ -264,6 +264,7 @@ devkit8000 arm armv7 devkit8000 timll mcx arm armv7 mcx htkw omap3 tricorder arm armv7 tricorder corscience omap3 twister arm armv7 twister technexion omap3 +nokia_rx51 arm armv7 rx51 nokia omap3 omap4_panda arm armv7 panda ti omap4 omap4_sdp4430 arm armv7 sdp4430 ti omap4 omap5_evm arm armv7 omap5_evm ti omap5 diff --git a/doc/README.nokia_rx51 b/doc/README.nokia_rx51 new file mode 100644 index 0000000..a8fdfcd --- /dev/null +++ b/doc/README.nokia_rx51 @@ -0,0 +1,104 @@ +Board: Nokia RX-51 aka N900 + +This board definition results in a u-boot.bin which can be chainloaded +from NOLO in qemu or on a real N900. It does very little hardware config +because NOLO has already configured the board. Only needed is enabling +internal eMMC memory via twl4030 regulator which is not enabled by NOLO. + +NOLO is expecting a kernel image and will treat any image it finds in +onenand as such. This u-boot is intended to be flashed to the N900 like +a kernel. In order to transparently boot the original kernel, it will be +appended to u-boot.bin at 0x40000. NOLO will load the entire image into +(random) memory and execute u-boot, which saves hw revision, boot reason +and boot mode ATAGs set by NOLO. Then the bootscripts will attempt to load +uImage or boot.scr from a fat, ext2/ext3 or ext4 filesystem in external +SD card or internal eMMC memory. If this fails or keyboard is closed then +the appended kernel image will be booted using some generated and some +stored ATAGs (see boot order). + +There is support for hardware watchdog. Hardware watchdog is started by +NOLO so u-boot must kick watchdog to prevent reboot device (but not very +often, max every 2 seconds). There is also support for framebuffer display +output with ANSI espace codes and the N900 HW keyboard input. USB tty works +but is disabled because it prevents the current Maemo kernel from booting. + +When U-Boot is starting it enable IBE bit in Auxiliary Control Register, +which is needed for Thumb-2 ISA support. It is workaround for errata 430973. + +Default boot order: + + * 0. if keyboard is closed boot automatically attached kernel image + * 1. try boot from external SD card + * 2. try boot from internal eMMC memory + * 3. try boot from attached kernel image + +Boot from SD or eMMC in this order: + + * 1. + * 1.1 find boot.scr on first fat partition + * 1.2 find uImage on first fat parition + * 1.3 same order for 2. - 4. fat partition + * 2. same as 1. but for ext2/3 partition + * 3. same as 1. but for ext4 partition + + +Available additional commands/variables: + + * run sercon - Use serial port for control + * run usbcon - Use usbtty for control + * run vgacon - Use framebuffer and HW keyboard for control (default) + + * run sdboot - Boot from external SD card (see boot order) + * run emmcboot - Boot from internal eMMC memory (see boot order) + * run attachboot - Boot attached kernel image (attached to U-Boot binary) + + * run scriptload - Load boot script ${mmcscriptfile} + * run scriptboot - Run loaded boot script + * run kernload - Load kernel image ${mmckernfile} + * run initrdload - Load initrd image ${mmcinitrdfile} + * run kernboot - Boot loaded kernel image + * run kerninitrdboot - Boot loaded kernel image with loaded initrd image + + * run trymmcscriptboot - Try to load and boot script ${mmcscriptfile} + * run trymmckernboot - Try to load and boot kernel image ${mmckernfile} + * run trymmckerninitrdboot - Try to load and boot kernel image ${mmckernfile} + with initrd image ${mmcinitrdfile} + +Additional variables for loading files from mmc: + + * mmc ${mmcnum} (0 - external, 1 - internal) + * partition number ${mmcpart} (1 - 4) + * parition type ${mmctype} (fat, ext2) + +Additional varuables for booting kernel: + + * setup_omap_atag - Add OMAP table into atags structure (needs maemo kernel) + * setup_console_atag - Enable serial console in OMAP table + * setup_boot_reason_atag - Change boot reason in OMAP table + * setup_boot_mode_atag - Change boot mode in OMAP table + +USB TTY: + + Maemo kernel 2.6.28 will crash if u-boot enable usb tty. So USB TTY is disabled. + For enabling USB TTY just add this line to file include/configs/nokia_rx51.h + + #define CONFIG_USB_TTY + + +ONENAND support: + + ONENAND support is disabled because not working yet and cause linux kernel to + crash or no access to mtd. For enabling ONENAND support add this line at begin + of file include/configs/nokia_rx51.h + + #define ONENAND_SUPPORT + + +UBIFS support: + + UBIFS support is disabled, because U-Boot image is too big and cannot be + flashed with attached zImage to RX-51 kernel nand area. For enabling UBIFS + support first enable ONENAND support and then add this line at begin of file + include/configs/nokia_rx51.h + + #define UBIFS_SUPPORT diff --git a/include/configs/nokia_rx51.h b/include/configs/nokia_rx51.h new file mode 100644 index 0000000..8506604 --- /dev/null +++ b/include/configs/nokia_rx51.h @@ -0,0 +1,452 @@ +/* + * (C) Copyright 2011-2012 + * Pali Rohár pali.rohar@gmail.com + * + * (C) Copyright 2010 + * Alistair Buxton a.j.buxton@gmail.com + * + * Derived from Beagle Board code: + * (C) Copyright 2006-2008 + * Texas Instruments. + * Richard Woodruff r-woodruff2@ti.com + * Syed Mohammed Khasim x0khasim@ti.com + * + * Configuration settings for the Nokia RX-51 aka N900. + * + * 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 as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#ifndef __CONFIG_H +#define __CONFIG_H + +/* + * High Level Configuration Options + */ + +#define CONFIG_OMAP /* in a TI OMAP core */ +#define CONFIG_OMAP34XX /* which is a 34XX */ +#define CONFIG_OMAP3430 /* which is in a 3430 */ +#define CONFIG_OMAP3_RX51 /* working with RX51 */ +#define CONFIG_SYS_L2CACHE_OFF /* pretend there is no L2 CACHE */ + +#define CONFIG_MACH_TYPE MACH_TYPE_NOKIA_RX51 + +/* + * Nokia X-Loader loading secondary image to address 0x80400000 + * NOLO loading boot image to random place, so it doesn't really + * matter what we set this to. We have to copy u-boot to this address + */ +#define CONFIG_SYS_TEXT_BASE 0x80008000 + +#define CONFIG_SDRC /* The chip has SDRC controller */ + +#include <asm/arch/cpu.h> /* get chip and board defs */ +#include <asm/arch/omap3.h> +#include <asm/arch/mem.h> +#include <linux/stringify.h> + +/* + * Display CPU and Board information + */ +#define CONFIG_DISPLAY_CPUINFO +#define CONFIG_DISPLAY_BOARDINFO + +/* Clock Defines */ +#define V_OSCK 26000000 /* Clock output from T2 */ +#define V_SCLK (V_OSCK >> 1) + +#undef CONFIG_USE_IRQ /* no support for IRQs */ +#define CONFIG_MISC_INIT_R +#define CONFIG_SKIP_LOWLEVEL_INIT /* X-Loader set everything up */ + +#define CONFIG_CMDLINE_TAG /* enable passing kernel command line string */ +#define CONFIG_INITRD_TAG /* enable passing initrd */ +#define CONFIG_REVISION_TAG /* enable passing revision tag*/ +#define CONFIG_SETUP_MEMORY_TAGS /* enable memory tag */ + +/* + * Size of malloc() pool + */ +#define CONFIG_ENV_SIZE (128 << 10) +#define CONFIG_UBI_SIZE (512 << 10) +#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + CONFIG_UBI_SIZE + \ + (128 << 10)) + +/* + * Hardware drivers + */ + +/* + * NS16550 Configuration + */ +#define V_NS16550_CLK 48000000 /* 48MHz (APLL96/2) */ + +#define CONFIG_SYS_NS16550 +#define CONFIG_SYS_NS16550_SERIAL +#define CONFIG_SYS_NS16550_REG_SIZE (-4) +#define CONFIG_SYS_NS16550_CLK V_NS16550_CLK + +/* + * select serial console configuration + */ +#define CONFIG_CONS_INDEX 3 +#define CONFIG_SYS_NS16550_COM3 OMAP34XX_UART3 +#define CONFIG_SERIAL3 3 /* UART3 on RX-51 */ + +/* allow to overwrite serial and ethaddr */ +#define CONFIG_ENV_OVERWRITE +#define CONFIG_BAUDRATE 115200 +#define CONFIG_SYS_BAUDRATE_TABLE { 4800, 9600, 19200, 38400, 57600, 115200 } +#define CONFIG_MMC +#define CONFIG_GENERIC_MMC +#define CONFIG_OMAP_HSMMC +#define CONFIG_DOS_PARTITION + +/* USB */ +#define CONFIG_MUSB_UDC +#define CONFIG_MUSB_HDC +#define CONFIG_USB_OMAP3 +#define CONFIG_TWL4030_USB + +/* USB device configuration */ +#define CONFIG_USB_DEVICE +#define CONFIG_USBD_VENDORID 0x0421 +#define CONFIG_USBD_PRODUCTID 0x01c8 +#define CONFIG_USBD_MANUFACTURER "Nokia" +#define CONFIG_USBD_PRODUCT_NAME "N900" + +#define CONFIG_SYS_CONSOLE_IS_IN_ENV +#define CONFIG_SYS_NO_FLASH + +/* commands to include */ +#include <config_cmd_default.h> + +#define CONFIG_CMD_EXT2 /* EXT2 Support */ +#define CONFIG_CMD_EXT4 /* EXT4 Support */ +#define CONFIG_CMD_FAT /* FAT support */ + +#define CONFIG_CMD_I2C /* I2C serial bus support */ +#define CONFIG_CMD_MMC /* MMC support */ +#define CONFIG_CMD_GPIO /* Enable gpio command */ + +#define CONFIG_CMDLINE_EDITING /* add command line history */ +#define CONFIG_AUTO_COMPLETE /* add autocompletion support */ + +#define CONFIG_CMD_CLEAR /* ANSI terminal clear screen command */ + +#ifdef ONENAND_SUPPORT + +#define CONFIG_CMD_ONENAND /* ONENAND support */ +#define CONFIG_CMD_MTDPARTS /* mtd parts support */ + +#ifdef UBIFS_SUPPORT +#define CONFIG_CMD_UBI /* UBI Support */ +#define CONFIG_CMD_UBIFS /* UBIFS Support */ +#endif + +#endif + +/* commands not needed from config_cmd_default.h */ +#undef CONFIG_CMD_FPGA /* FPGA configuration Support */ +#undef CONFIG_CMD_IMI /* iminfo */ +#undef CONFIG_CMD_NET /* bootp, tftpboot, rarpboot */ +#undef CONFIG_CMD_NFS /* NFS support */ +#undef CONFIG_CMD_SAVEENV /* saveenv */ +#undef CONFIG_CMD_SETGETDCR /* DCR support on 4xx */ + +#define CONFIG_OMAP3_SPI +#define CONFIG_HARD_I2C +#define CONFIG_SYS_I2C_SPEED 100000 +#define CONFIG_SYS_I2C_SLAVE 1 +#define CONFIG_DRIVER_OMAP34XX_I2C + +/* + * TWL4030 + */ +#define CONFIG_TWL4030_POWER +#define CONFIG_TWL4030_LED +#define CONFIG_TWL4030_KEYPAD + +#define CONFIG_OMAP_GPIO +#define GPIO_SLIDE 71 + +/* + * Board ONENAND Info. + */ + +#define PART1_NAME "bootloader" +#define PART1_SIZE 128 +#define PART1_MULL 1024 +#define PART1_SUFF "k" +#define PART1_OFFS 0x00000000 +#define PART1_MASK 0x00000003 + +#define PART2_NAME "config" +#define PART2_SIZE 384 +#define PART2_MULL 1024 +#define PART2_SUFF "k" +#define PART2_OFFS 0x00020000 +#define PART2_MASK 0x00000000 + +#define PART3_NAME "log" +#define PART3_SIZE 256 +#define PART3_MULL 1024 +#define PART3_SUFF "k" +#define PART3_OFFS 0x00080000 +#define PART3_MASK 0x00000000 + +#define PART4_NAME "kernel" +#define PART4_SIZE 2 +#define PART4_MULL 1024*1024 +#define PART4_SUFF "m" +#define PART4_OFFS 0x000c0000 +#define PART4_MASK 0x00000000 + +#define PART5_NAME "initfs" +#define PART5_SIZE 2 +#define PART5_MULL 1024*1024 +#define PART5_SUFF "m" +#define PART5_OFFS 0x002c0000 +#define PART5_MASK 0x00000000 + +#define PART6_NAME "rootfs" +#define PART6_SIZE 257280 +#define PART6_MULL 1024 +#define PART6_SUFF "k" +#define PART6_OFFS 0x004c0000 +#define PART6_MASK 0x00000000 + +#ifdef ONENAND_SUPPORT + +#define PISMO1_NAND_SIZE GPMC_SIZE_128M +#define PISMO1_ONEN_SIZE GPMC_SIZE_128M +#define CONFIG_SYS_ONENAND_BASE ONENAND_MAP +#define CONFIG_MTD_DEVICE +#define CONFIG_MTD_PARTITIONS + +#ifdef UBIFS_SUPPORT +#define CONFIG_RBTREE +#define CONFIG_LZO +#endif + +#define MTDIDS_DEFAULT "onenand0=onenand" +#define MTDPARTS_DEFAULT "mtdparts=onenand:" \ + __stringify(PART1_SIZE) PART1_SUFF "(" PART1_NAME ")ro," \ + __stringify(PART2_SIZE) PART2_SUFF "(" PART2_NAME ")," \ + __stringify(PART3_SIZE) PART3_SUFF "(" PART3_NAME ")," \ + __stringify(PART4_SIZE) PART4_SUFF "(" PART4_NAME ")," \ + __stringify(PART5_SIZE) PART5_SUFF "(" PART5_NAME ")," \ + "-(" PART6_NAME ")" + +#endif + +/* Watchdog support */ +#define CONFIG_HW_WATCHDOG + +/* + * Framebuffer + */ +/* Video console */ +#define CONFIG_VIDEO +#define CONFIG_CFB_CONSOLE +#define CONFIG_CFB_CONSOLE_ANSI /* Enable ANSI escape codes in framebuffer */ +#define CONFIG_VIDEO_LOGO +#define VIDEO_FB_16BPP_PIXEL_SWAP +#define VIDEO_FB_16BPP_WORD_SWAP +#define CONFIG_VIDEO_SW_CURSOR +#define CONFIG_SPLASH_SCREEN + +/* functions for cfb_console */ +#define VIDEO_KBD_INIT_FCT rx51_kp_init() +#define VIDEO_TSTC_FCT rx51_kp_tstc +#define VIDEO_GETC_FCT rx51_kp_getc +#ifndef __ASSEMBLY__ +int rx51_kp_init(void); +int rx51_kp_tstc(void); +int rx51_kp_getc(void); +#endif + +#ifndef MTDPARTS_DEFAULT +#define MTDPARTS_DEFAULT +#endif + +/* Environment information */ +#define CONFIG_BOOTDELAY 3 + +#define CONFIG_EXTRA_ENV_SETTINGS \ + "mtdparts=" MTDPARTS_DEFAULT "\0" \ + "usbtty=cdc_acm\0" \ + "stdin=vga\0" \ + "stdout=vga\0" \ + "stderr=vga\0" \ + "setcon=setenv stdin ${con};" \ + "setenv stdout ${con};" \ + "setenv stderr ${con}\0" \ + "sercon=setenv con serial; run setcon\0" \ + "usbcon=setenv con usbtty; run setcon\0" \ + "vgacon=setenv con vga; run setcon\0" \ + "slide=gpio input " __stringify(GPIO_SLIDE) "\0" \ + "switchmmc=mmc dev ${mmcnum}\0" \ + "kernaddr=0x82008000\0" \ + "initrdaddr=0x84008000\0" \ + "scriptaddr=0x86008000\0" \ + "fileload=${mmctype}load mmc ${mmcnum}:${mmcpart} " \ + "${loadaddr} ${mmcfile}\0" \ + "kernload=setenv loadaddr ${kernaddr};" \ + "setenv mmcfile ${mmckernfile};" \ + "run fileload\0" \ + "initrdload=setenv loadaddr ${initrdaddr};" \ + "setenv mmcfile ${mmcinitrdfile};" \ + "run fileload\0" \ + "scriptload=setenv loadaddr ${scriptaddr};" \ + "setenv mmcfile ${mmcscriptfile};" \ + "run fileload\0" \ + "scriptboot=echo Running ${mmcscriptfile} from mmc " \ + "${mmcnum}:${mmcpart} ...; source ${scriptaddr}\0" \ + "kernboot=echo Booting ${mmckernfile} from mmc " \ + "${mmcnum}:${mmcpart} ...; bootm ${kernaddr}\0" \ + "kerninitrdboot=echo Booting ${mmckernfile} ${mmcinitrdfile} from mmc "\ + "${mmcnum}:${mmcpart} ...; bootm ${kernaddr} ${initrdaddr}\0" \ + "attachboot=echo Booting attached kernel image ...;" \ + "setenv setup_omap_atag 1;" \ + "bootm ${attkernaddr};" \ + "setenv setup_omap_atag\0" \ + "trymmcscriptboot=if run switchmmc; then " \ + "if run scriptload; then " \ + "run scriptboot;" \ + "fi;" \ + "fi\0" \ + "trymmckernboot=if run switchmmc; then " \ + "if run kernload; then " \ + "run kernboot;" \ + "fi;" \ + "fi\0" \ + "trymmckerninitrdboot=if run switchmmc; then " \ + "if run initrdload; then " \ + "if run kernload; then " \ + "run kerninitrdboot;" \ + "fi;" \ + "fi; " \ + "fi\0" \ + "trymmcpartboot=setenv mmcscriptfile boot.scr; run trymmcscriptboot;" \ + "setenv mmckernfile uImage; run trymmckernboot\0" \ + "trymmcallpartboot=setenv mmcpart 1; run trymmcpartboot;" \ + "setenv mmcpart 2; run trymmcpartboot;" \ + "setenv mmcpart 3; run trymmcpartboot;" \ + "setenv mmcpart 4; run trymmcpartboot\0" \ + "trymmcboot=if run switchmmc; then " \ + "setenv mmctype fat;" \ + "run trymmcallpartboot;" \ + "setenv mmctype ext2;" \ + "run trymmcallpartboot;" \ + "setenv mmctype ext4;" \ + "run trymmcallpartboot;" \ + "fi\0" \ + "emmcboot=setenv mmcnum 1; run trymmcboot\0" \ + "sdboot=setenv mmcnum 0; run trymmcboot\0" \ + "" + +#define CONFIG_PREBOOT \ + "if run slide; then true; else run attachboot; fi;" \ + "echo Extra commands:;" \ + "echo run sercon - Use serial port for control.;" \ + "echo run usbcon - Use usbtty for control.;" \ + "echo run vgacon - Use framebuffer/keyboard.;" \ + "echo run sdboot - Boot from SD card slot.;" \ + "echo run emmcboot - Boot internal eMMC memory.;" \ + "echo run attachboot - Boot attached kernel image.;" \ + "echo" + +#define CONFIG_BOOTCOMMAND \ + "run sdboot;" \ + "run emmcboot;" \ + "run attachboot;" \ + "echo" + +/* + * Miscellaneous configurable options + */ +#define CONFIG_SYS_LONGHELP /* undef to save memory */ +#define CONFIG_SYS_HUSH_PARSER /* use "hush" command parser */ +#define CONFIG_SYS_PROMPT_HUSH_PS2 "> " +#define CONFIG_SYS_PROMPT "Nokia RX-51 # " +#define CONFIG_SYS_CBSIZE 256 /* Console I/O Buffer Size */ +/* Print Buffer Size */ +#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \ + sizeof(CONFIG_SYS_PROMPT) + 16) +#define CONFIG_SYS_MAXARGS 16 /* max number of command args */ +/* Boot Argument Buffer Size */ +#define CONFIG_SYS_BARGSIZE (CONFIG_SYS_CBSIZE) + +#define CONFIG_SYS_MEMTEST_START (OMAP34XX_SDRC_CS0) +#define CONFIG_SYS_MEMTEST_END (OMAP34XX_SDRC_CS0 + 0x01F00000)/*31MB*/ + +/* default load address */ +#define CONFIG_SYS_LOAD_ADDR (OMAP34XX_SDRC_CS0) + +/* + * OMAP3 has 12 GP timers, they can be driven by the system clock + * (12/13/16.8/19.2/38.4MHz) or by 32KHz clock. We use 13MHz (V_SCLK). + * This rate is divided by a local divisor. + */ +#define CONFIG_SYS_TIMERBASE (OMAP34XX_GPT2) +#define CONFIG_SYS_PTV 2 /* Divisor: 2^(PTV+1) => 8 */ +#define CONFIG_SYS_HZ 1000 + +/* + * Stack sizes + * + * The stack sizes are set up in start.S using the settings below + */ +#define CONFIG_STACKSIZE (128 << 10) /* regular stack 128 KiB */ + +/* + * Physical Memory Map + */ +#define CONFIG_NR_DRAM_BANKS 2 +#define PHYS_SDRAM_1 OMAP34XX_SDRC_CS0 + +/* + * FLASH and environment organization + */ + +#define CONFIG_ENV_IS_NOWHERE + +#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM_1 +#define CONFIG_SYS_INIT_RAM_ADDR 0x4020f800 +#define CONFIG_SYS_INIT_RAM_SIZE 0x800 +#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_INIT_RAM_ADDR + \ + CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE) + +/* + * Attached kernel image + */ + +#define SDRAM_SIZE 0x10000000 /* 256 MB */ +#define SDRAM_END (CONFIG_SYS_SDRAM_BASE + SDRAM_SIZE) + +#define IMAGE_MAXSIZE 0x1FF800 /* 2 MB - 2 kB */ +#define KERNEL_OFFSET 0x40000 /* 256 kB */ +#define KERNEL_MAXSIZE (IMAGE_MAXSIZE-KERNEL_OFFSET) +#define KERNEL_ADDRESS (SDRAM_END-KERNEL_MAXSIZE) + +/* Reserve protected RAM for attached kernel */ +#define CONFIG_PRAM ((KERNEL_MAXSIZE >> 10)+1) + +#endif /* __CONFIG_H */

On Mon, Oct 29, 2012 at 06:54:01PM +0100, Pali Roh??r wrote:
Based on previous work by: Alistair Buxton a.j.buxton@gmail.com
Signed-off-by: Pali Roh??r pali.rohar@gmail.com Cc: ???????????? ???????????????? freemangordon@abv.bg
This, along with the latest versions of the rest of the series are now applied to u-boot-ti/master, thanks!
participants (12)
-
Albert ARIBAUD
-
Anatolij Gustschin
-
Graeme Russ
-
Igor Grinberg
-
Marek Vasut
-
Marek Vasut
-
Mike Frysinger
-
Pali Rohár
-
Sergey Lapin
-
Tom Rini
-
Tom Rini
-
Wolfgang Denk