vcu: user interface detection improved
- detect ui once (remember status) - normalize boot message format - hide i2c errors in omap24xx driver if not ui is connected BugzID: 53086 BugzID: 53087 BugzID: 53088 Signed-off-by: Patrick Zysset <patrick.zysset@netmodule.com>
This commit is contained in:
parent
1923f7f14d
commit
3a9388907a
|
|
@ -844,10 +844,7 @@ int board_late_init(void)
|
|||
if (read_eeprom() < 0) {
|
||||
puts("Could not get board ID.\n");
|
||||
}
|
||||
int rc = -1;
|
||||
int bus;
|
||||
int ret;
|
||||
uint8_t val;
|
||||
|
||||
get_hw_version();
|
||||
get_pmic_version();
|
||||
set_root_partition();
|
||||
|
|
@ -863,18 +860,11 @@ int board_late_init(void)
|
|||
/* UI configuration and detection */
|
||||
REQUEST_AND_SET_GPIO(GPIO_RST_UI_N);
|
||||
|
||||
|
||||
|
||||
ret = ui_claim_i2c_bus(&bus);
|
||||
if (ret == 0)
|
||||
rc = ui_i2c_get_reg(0x00, &val);
|
||||
if (rc==0 && ret == 0 )
|
||||
printf("UI interface detected\n");
|
||||
if ( detect_ui() )
|
||||
printf("UI: ready\n");
|
||||
else
|
||||
printf("UI interface NOT detected\n");
|
||||
printf("UI: n/a\n");
|
||||
|
||||
if (ret == 0)
|
||||
ui_release_i2c_bus(bus);
|
||||
|
||||
/* FIXME: Problem switch reset lines of switch and PHY
|
||||
* Clocks for PHY are only present once switch is configured
|
||||
|
|
@ -1054,18 +1044,10 @@ static void ft_hw_version(void *blob)
|
|||
}
|
||||
static void ft_led(void *blob)
|
||||
{
|
||||
int rc = -1;
|
||||
int bus;
|
||||
int ret;
|
||||
uint8_t val;
|
||||
|
||||
int node_offset;
|
||||
|
||||
ret = ui_claim_i2c_bus(&bus);
|
||||
if (ret == 0){
|
||||
rc = ui_i2c_get_reg(0x00, &val);
|
||||
ui_release_i2c_bus(bus);
|
||||
}
|
||||
if (rc==0 && ret == 0){
|
||||
if ( detect_ui() ){
|
||||
printf ("ft access to change the led status to okay \n");
|
||||
node_offset = fdt_path_offset(blob, "/leds/led@4/");
|
||||
if (node_offset != -1) {
|
||||
|
|
|
|||
|
|
@ -108,5 +108,25 @@ int ui_i2c_set_reg(uint32_t reg, u8 val)
|
|||
return ret;
|
||||
}
|
||||
|
||||
bool detect_ui(void)
|
||||
{
|
||||
int bus;
|
||||
int claim;
|
||||
uint8_t val;
|
||||
static int ui_detected = -1; /* -1: unitialized, 0: UI not available, 1: UI detected */
|
||||
|
||||
if (ui_detected < 0) {
|
||||
claim = ui_claim_i2c_bus(&bus);
|
||||
if (claim == 0) {
|
||||
if ( 0 == ui_i2c_get_reg(0x00, &val))
|
||||
ui_detected = 1;
|
||||
else
|
||||
ui_detected = 0;
|
||||
ui_release_i2c_bus(bus);
|
||||
}
|
||||
}
|
||||
|
||||
return (ui_detected == 1);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ extern int ui_release_i2c_bus(int bus);
|
|||
|
||||
extern int ui_i2c_get_reg(uint32_t reg, u8* val);
|
||||
extern int ui_i2c_set_reg(uint32_t reg, u8 val);
|
||||
|
||||
extern bool detect_ui(void);
|
||||
|
||||
|
||||
#endif /* UI_H */
|
||||
|
|
|
|||
|
|
@ -420,8 +420,8 @@ static int omap24_i2c_read(struct i2c_adapter *adap, uchar chip, uint addr,
|
|||
}
|
||||
if (status == 0 || (status & I2C_STAT_NACK)) {
|
||||
i2c_error = 1;
|
||||
printf("i2c_read: error waiting for addr ACK (status=0x%x)\n",
|
||||
status);
|
||||
/*printf("i2c_read: error waiting for addr ACK (status=0x%x)\n",
|
||||
status);*/
|
||||
goto rd_exit;
|
||||
}
|
||||
if (alen) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue