From fe9c653a0b0a3fa49d269b697c2058a6a55aa42b Mon Sep 17 00:00:00 2001 From: Koen Kooi Date: Sun, 27 Nov 2011 14:53:56 +0100 Subject: [PATCH 3/5] beagleboard: add support for scanning loop-through expansionboards like the uLCD-lite Signed-off-by: Koen Kooi --- board/ti/beagle/beagle.c | 30 ++++++++++++++++++++++++++---- include/configs/omap3_beagle.h | 4 ++++ 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/board/ti/beagle/beagle.c b/board/ti/beagle/beagle.c index 9c2e6d0..5ea50d1 100644 --- a/board/ti/beagle/beagle.c +++ b/board/ti/beagle/beagle.c @@ -74,6 +74,7 @@ extern volatile struct ehci_hcor *hcor; #define BBTOYS_WIFI 0x01000B00 #define BBTOYS_VGA 0x02000B00 #define BBTOYS_LCD 0x03000B00 +#define BBTOYS_ULCD 0x04000B00 #define BEAGLE_NO_EEPROM 0xffffffff DECLARE_GLOBAL_DATA_PTR; @@ -209,18 +210,18 @@ void get_board_mem_timings(u32 *mcfg, u32 *ctrla, u32 *ctrlb, u32 *rfr_ctrl, * bus 1 for the availability of an AT24C01B serial EEPROM. * returns the device_vendor field from the EEPROM */ -unsigned int get_expansion_id(void) +unsigned int get_expansion_id(int eeprom_address) { i2c_set_bus_num(EXPANSION_EEPROM_I2C_BUS); /* return BEAGLE_NO_EEPROM if eeprom doesn't respond */ - if (i2c_probe(EXPANSION_EEPROM_I2C_ADDRESS) == 1) { + if (i2c_probe(eeprom_address) == 1) { i2c_set_bus_num(TWL4030_I2C_BUS); return BEAGLE_NO_EEPROM; } /* read configuration data */ - i2c_read(EXPANSION_EEPROM_I2C_ADDRESS, 0, 1, (u8 *)&expansion_config, + i2c_read(eeprom_address, 0, 1, (u8 *)&expansion_config, sizeof(expansion_config)); i2c_set_bus_num(TWL4030_I2C_BUS); @@ -323,7 +324,7 @@ int misc_init_r(void) TWL4030_PM_RECEIVER_DEV_GRP_P1); } - switch (get_expansion_id()) { + switch (get_expansion_id(EXPANSION_EEPROM_I2C_ADDRESS)) { case TINCANTOOLS_ZIPPY: printf("Recognized Tincantools Zippy board (rev %d %s)\n", expansion_config.revision, @@ -402,6 +403,27 @@ int misc_init_r(void) if (expansion_config.content == 1) setenv(expansion_config.env_var, expansion_config.env_setting); + /* Scan 0x51 as well for loop-thru boards */ + switch (get_expansion_id(EXPANSION_EEPROM_I2C_ADDRESS + 1)) { + case BBTOYS_ULCD: + printf("Recognized BeagleBoardToys uLCD-lite board\n"); + setenv("buddy2", "bbtoys-ulcd"); + setenv("defaultdisplay", "lcd"); + setenv("uenvcmd", "i2c dev 1 ; i2c mw 40 00 00; i2c mw 40 04 80; i2c mw 40 0d 05; i2c mw 40 0d 15"); + break; + case BEAGLE_NO_EEPROM: + printf("No EEPROM on expansion board\n"); + setenv("buddy2", "none"); + break; + default: + printf("Unrecognized expansion board: %x\n", + expansion_config.device_vendor); + setenv("buddy2", "unknown"); + } + + if (expansion_config.content == 1) + setenv(expansion_config.env_var, expansion_config.env_setting); + twl4030_power_init(); switch (get_board_revision()) { case REVISION_XM_A: diff --git a/include/configs/omap3_beagle.h b/include/configs/omap3_beagle.h index d4f33d0..65ab8ee 100644 --- a/include/configs/omap3_beagle.h +++ b/include/configs/omap3_beagle.h @@ -214,6 +214,7 @@ "console=ttyO2,115200n8\0" \ "mpurate=auto\0" \ "buddy=none "\ + "buddy2=none "\ "optargs=\0" \ "camera=none\0" \ "vram=12M\0" \ @@ -230,6 +231,7 @@ "${optargs} " \ "mpurate=${mpurate} " \ "buddy=${buddy} "\ + "buddy2=${buddy2} "\ "camera=${camera} "\ "vram=${vram} " \ "omapfb.mode=dvi:${dvimode} " \ @@ -240,6 +242,7 @@ "${optargs} " \ "mpurate=${mpurate} " \ "buddy=${buddy} "\ + "buddy2=${buddy2} "\ "camera=${camera} "\ "vram=${vram} " \ "omapfb.mode=dvi:${dvimode} " \ @@ -254,6 +257,7 @@ "${optargs} " \ "mpurate=${mpurate} " \ "buddy=${buddy} "\ + "buddy2=${buddy2} "\ "vram=${vram} " \ "omapfb.mode=dvi:${dvimode} " \ "omapdss.def_disp=${defaultdisplay} " \ -- 1.7.2.5