[PATCH 2/8] qi-add-post-serial-init-api.patch
Andy Green
andy at openmoko.com
Tue Feb 3 19:12:22 CET 2009
It can be useful to have a device API that can print device-specific things
after serial is initialized.
Signed-off-by: Andy Green <andy at openmoko.com>
---
include/qi.h | 1 +
src/cpu/s3c2442/gta02.c | 10 ++++++++++
src/phase2.c | 5 +++++
3 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/include/qi.h b/include/qi.h
index be25626..8d46ac0 100644
--- a/include/qi.h
+++ b/include/qi.h
@@ -101,6 +101,7 @@ struct board_api {
int (*is_this_board)(void);
void (*early_port_init)(void);
void (*port_init)(void);
+ void (*post_serial_init)(void); /* print device-specific things */
void (*putc)(char);
void (*close)(void);
u8 (*get_ui_keys)(void);
diff --git a/src/cpu/s3c2442/gta02.c b/src/cpu/s3c2442/gta02.c
index 5ad5316..3fd93e0 100644
--- a/src/cpu/s3c2442/gta02.c
+++ b/src/cpu/s3c2442/gta02.c
@@ -447,6 +447,15 @@ static void set_ui_indication_gta02(enum ui_indication ui_indication)
}
+void post_serial_init_gta02(void)
+{
+ if (battery_condition_reasonable)
+ puts("Battery condition reasonable\n");
+ else
+ puts("BATTERY CONDITION LOW\n");
+}
+
+
/*
* our API for bootloader on this machine
*/
@@ -460,6 +469,7 @@ const struct board_api board_api_gta02 = {
.get_board_variant = get_board_variant_gta02,
.is_this_board = is_this_board_gta02,
.port_init = port_init_gta02,
+ .post_serial_init = post_serial_init_gta02,
.putc = putc_gta02,
.close = close_gta02,
.get_ui_keys = get_ui_keys_gta02,
diff --git a/src/phase2.c b/src/phase2.c
index de20cd3..1fe96b8 100644
--- a/src/phase2.c
+++ b/src/phase2.c
@@ -450,6 +450,11 @@ static void try_this_kernel(void)
void bootloader_second_phase(void)
{
+ /* give device a chance to print device-specific things */
+
+ if (this_board->post_serial_init)
+ (this_board->post_serial_init)();
+
/* we try the possible kernels for this board in order */
for (this_kernel = this_board->kernel_source; this_kernel->name;
More information about the openmoko-kernel
mailing list