[glsdk/meta-ti-glsdk.git] / recipes-bsp / u-boot / u-boot / 2011.09 / 0001-beagleboard-probe-DDC-bus-for-expansionboard-EEPROMS.patch
1 From 559eb0f547267df0706d283974916b88d6b9fb7d Mon Sep 17 00:00:00 2001
2 From: Koen Kooi <koen@dominion.thruhere.net>
3 Date: Sun, 9 Oct 2011 15:55:05 +0200
4 Subject: [PATCH] beagleboard: probe DDC bus for expansionboard EEPROMS as well
6 Add beacon support as well, needs to get split into a seperate patch
8 Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
9 ---
10 board/ti/beagle/beagle.c | 59 ++++++++++++++++++++++++++++++++++++++++
11 board/ti/beagle/beagle.h | 7 +++++
12 include/configs/omap3_beagle.h | 7 +++++
13 3 files changed, 73 insertions(+), 0 deletions(-)
15 diff --git a/board/ti/beagle/beagle.c b/board/ti/beagle/beagle.c
16 index 8cdceaf..f4e986c 100644
17 --- a/board/ti/beagle/beagle.c
18 +++ b/board/ti/beagle/beagle.c
19 @@ -57,11 +57,14 @@ extern volatile struct ehci_hcor *hcor;
20 #define TWL4030_I2C_BUS 0
21 #define EXPANSION_EEPROM_I2C_BUS 1
22 #define EXPANSION_EEPROM_I2C_ADDRESS 0x50
23 +#define DVI_EDID_I2C_BUS 2
24 +#define DVI_EDID_I2C_ADDRESS 0x50
26 #define TINCANTOOLS_ZIPPY 0x01000100
27 #define TINCANTOOLS_ZIPPY2 0x02000100
28 #define TINCANTOOLS_TRAINER 0x04000100
29 #define TINCANTOOLS_SHOWDOG 0x03000100
30 +#define TINCANTOOLS_BEACON 0x05000100
31 #define KBADC_BEAGLEFPGA 0x01000600
32 #define LW_BEAGLETOUCH 0x01000700
33 #define BRAINMUX_LCDOG 0x01000800
34 @@ -69,6 +72,7 @@ extern volatile struct ehci_hcor *hcor;
35 #define BBTOYS_WIFI 0x01000B00
36 #define BBTOYS_VGA 0x02000B00
37 #define BBTOYS_LCD 0x03000B00
38 +#define BBTOYS_ULCD 0x04000B00
39 #define BEAGLE_NO_EEPROM 0xffffffff
41 DECLARE_GLOBAL_DATA_PTR;
42 @@ -82,6 +86,16 @@ static struct {
43 char env_setting[64];
44 } expansion_config;
46 +static struct {
47 + unsigned int device_vendor;
48 + unsigned char revision;
49 + unsigned char content;
50 + char fab_revision[8];
51 + char env_var[16];
52 + char env_setting[64];
53 +} edid_config;
54 +
55 +
56 /*
57 * Routine: board_init
58 * Description: Early hardware init.
59 @@ -165,6 +179,33 @@ unsigned int get_expansion_id(void)
60 }
62 /*
63 + * Routine: get_edid
64 + * Description: This function checks for expansion board by checking I2C
65 + * bus 2 for the availability of an EEPROM
66 + * returns the device_vendor field from the EEPROM
67 + * The content can be either real EDID data or expansionboard data.
68 + * Only expansionboar data is currently supported
69 + */
70 +unsigned int get_edid(void)
71 +{
72 + i2c_set_bus_num(DVI_EDID_I2C_BUS);
73 +
74 + /* return BEAGLE_NO_EEPROM if eeprom doesn't respond */
75 + if (i2c_probe(DVI_EDID_I2C_ADDRESS) == 1) {
76 + i2c_set_bus_num(TWL4030_I2C_BUS);
77 + return BEAGLE_NO_EEPROM;
78 + }
79 +
80 + /* read EEPROM data */
81 + i2c_read(DVI_EDID_I2C_ADDRESS, 0, 1, (u8 *)&edid_config,
82 + sizeof(edid_config));
83 +
84 + i2c_set_bus_num(TWL4030_I2C_BUS);
85 +
86 + return edid_config.device_vendor;
87 +}
88 +
89 +/*
90 * Configure DSS to display background color on DVID
91 * Configure VENC to display color bar on S-Video
92 */
93 @@ -290,6 +331,13 @@ int misc_init_r(void)
94 setenv("defaultdisplay", "showdoglcd");
95 setenv("buddy", "showdog");
96 break;
97 + case TINCANTOOLS_BEACON:
98 + printf("Recognized Tincantools Beacon board (rev %d %s)\n",
99 + expansion_config.revision,
100 + expansion_config.fab_revision);
101 + MUX_TINCANTOOLS_BEACON();
102 + setenv("buddy", "beacon");
103 + break;
104 case KBADC_BEAGLEFPGA:
105 printf("Recognized KBADC Beagle FPGA board\n");
106 MUX_KBADC_BEAGLEFPGA();
107 @@ -331,6 +379,17 @@ int misc_init_r(void)
108 if (expansion_config.content == 1)
109 setenv(expansion_config.env_var, expansion_config.env_setting);
111 + switch(get_edid()) {
112 + case BBTOYS_ULCD:
113 + printf("Recognized BeagleBoardToys universal LCD board on DDC bus\n");
114 + setenv("edid", "uLCD");
115 + break;
116 + default:
117 + printf("Unrecognized EEPROM content on DDC bus: %x\n",
118 + edid_config.device_vendor);
119 + setenv("edid", "unknown");
120 + }
121 +
122 twl4030_power_init();
123 switch (get_board_revision()) {
124 case REVISION_XM_A:
125 diff --git a/board/ti/beagle/beagle.h b/board/ti/beagle/beagle.h
126 index 18bfaa8..6a9ad73 100644
127 --- a/board/ti/beagle/beagle.h
128 +++ b/board/ti/beagle/beagle.h
129 @@ -456,6 +456,13 @@ const omap3_sysinfo sysinfo = {
130 MUX_VAL(CP(MCBSP3_CLKX), (IEN | PTU | EN | M4)) /*GPIO_141*/\
131 MUX_VAL(CP(MCBSP1_CLKX), (IEN | PTU | EN | M4)) /*GPIO_162*/
133 +#define MUX_TINCANTOOLS_BEACON() \
134 + MUX_VAL(CP(MMC2_DAT3), (IEN | PTU | EN | M4)) /*GPIO_135*/\
135 + MUX_VAL(CP(MMC2_DAT4), (IEN | PTU | EN | M4)) /*GPIO_136*/\
136 + MUX_VAL(CP(MMC2_DAT5), (IEN | PTU | EN | M4)) /*GPIO_137*/\
137 + MUX_VAL(CP(MMC2_DAT6), (IEN | PTU | EN | M4)) /*GPIO_138*/\
138 + MUX_VAL(CP(MMC2_DAT7), (IEN | PTU | EN | M4)) /*GPIO_139*/\
139 +
140 #define MUX_KBADC_BEAGLEFPGA() \
141 MUX_VAL(CP(MCBSP1_CLKR), (IEN | PTU | DIS | M1)) /*MCSPI4_CLK*/\
142 MUX_VAL(CP(MCBSP1_DX), (IDIS | PTU | DIS | M1)) /*MCSPI4_SIMO*/\
143 diff --git a/include/configs/omap3_beagle.h b/include/configs/omap3_beagle.h
144 index 1369c89..73df658 100644
145 --- a/include/configs/omap3_beagle.h
146 +++ b/include/configs/omap3_beagle.h
147 @@ -219,6 +224,7 @@
148 "console=ttyS2,115200n8\0" \
149 "mpurate=auto\0" \
150 "buddy=none "\
151 + "edid=none "\
152 "optargs=\0" \
153 "camera=none\0" \
154 "vram=12M\0" \
155 @@ -235,6 +241,7 @@
156 "${optargs} " \
157 "mpurate=${mpurate} " \
158 "buddy=${buddy} "\
159 + "edid=${edid} "\
160 "camera=${camera} "\
161 "vram=${vram} " \
162 "omapfb.mode=dvi:${dvimode} " \
163 --
164 1.6.6.1