diff --git a/qiboot/include/qi.h b/qiboot/include/qi.h index 3429e9b..1db3248 100644 --- a/qiboot/include/qi.h +++ b/qiboot/include/qi.h @@ -74,6 +74,7 @@ struct board_api { int (*is_this_board)(void); void (*port_init)(void); void (*putc)(char); + void (*close)(void); struct kernel_source kernel_source[8]; }; diff --git a/qiboot/src/gta02/gta02.c b/qiboot/src/gta02/gta02.c index dd586d1..5b569fe 100644 --- a/qiboot/src/gta02/gta02.c +++ b/qiboot/src/gta02/gta02.c @@ -324,6 +324,21 @@ static void putc_gta02(char c) serial_putc_s3c24xx(GTA02_DEBUG_UART, c); } +static void close_gta02(void) +{ + /* clear any pending timeouts by reading interrupts */ + + i2c_read_sync(&bb_s3c24xx, PCF50633_I2C_ADS, PCF50633_REG_INT1); + i2c_read_sync(&bb_s3c24xx, PCF50633_I2C_ADS, PCF50633_REG_INT2); + i2c_read_sync(&bb_s3c24xx, PCF50633_I2C_ADS, PCF50633_REG_INT3); + i2c_read_sync(&bb_s3c24xx, PCF50633_I2C_ADS, PCF50633_REG_INT4); + i2c_read_sync(&bb_s3c24xx, PCF50633_I2C_ADS, PCF50633_REG_INT5); + + /* set I2C GPIO back to peripheral unit */ + + (bb_s3c24xx.close)(); +} + /* * our API for bootloader on this machine */ @@ -338,6 +353,7 @@ const struct board_api board_api_gta02 = { .is_this_board = is_this_board_gta02, .port_init = port_init_gta02, .putc = putc_gta02, + .close = close_gta02, /* these are the ways we could boot GTA02 in order to try */ .kernel_source = { [0] = { diff --git a/qiboot/src/phase2.c b/qiboot/src/phase2.c index c3f4e44..8284541 100644 --- a/qiboot/src/phase2.c +++ b/qiboot/src/phase2.c @@ -252,6 +252,12 @@ void bootloader_second_phase(void) params->hdr.tag = ATAG_NONE; params->hdr.size = 0; + /* give board implementation a chance to shut down + * anything it may have going on, leave GPIO set for Linux + */ + if (this_board->close) + (this_board->close)(); + puts ("Starting --->\n\n"); /*