diff options
Diffstat (limited to 'arch/arm/mach-omap1/board-sx1.c')
-rw-r--r-- | arch/arm/mach-omap1/board-sx1.c | 64 |
1 files changed, 19 insertions, 45 deletions
diff --git a/arch/arm/mach-omap1/board-sx1.c b/arch/arm/mach-omap1/board-sx1.c index 2743d639aa05..1c7f09aedf07 100644 --- a/arch/arm/mach-omap1/board-sx1.c +++ b/arch/arm/mach-omap1/board-sx1.c | |||
@@ -44,7 +44,7 @@ | |||
44 | #include <asm/arch/keypad.h> | 44 | #include <asm/arch/keypad.h> |
45 | 45 | ||
46 | /* Write to I2C device */ | 46 | /* Write to I2C device */ |
47 | int i2c_write_byte(u8 devaddr, u8 regoffset, u8 value) | 47 | int sx1_i2c_write_byte(u8 devaddr, u8 regoffset, u8 value) |
48 | { | 48 | { |
49 | struct i2c_adapter *adap; | 49 | struct i2c_adapter *adap; |
50 | int err; | 50 | int err; |
@@ -67,7 +67,7 @@ int i2c_write_byte(u8 devaddr, u8 regoffset, u8 value) | |||
67 | } | 67 | } |
68 | 68 | ||
69 | /* Read from I2C device */ | 69 | /* Read from I2C device */ |
70 | int i2c_read_byte(u8 devaddr, u8 regoffset, u8 * value) | 70 | int sx1_i2c_read_byte(u8 devaddr, u8 regoffset, u8 *value) |
71 | { | 71 | { |
72 | struct i2c_adapter *adap; | 72 | struct i2c_adapter *adap; |
73 | int err; | 73 | int err; |
@@ -101,66 +101,55 @@ int sx1_setkeylight(u8 keylight) | |||
101 | { | 101 | { |
102 | if (keylight > SOFIA_MAX_LIGHT_VAL) | 102 | if (keylight > SOFIA_MAX_LIGHT_VAL) |
103 | keylight = SOFIA_MAX_LIGHT_VAL; | 103 | keylight = SOFIA_MAX_LIGHT_VAL; |
104 | return i2c_write_byte(SOFIA_I2C_ADDR, SOFIA_KEYLIGHT_REG, keylight); | 104 | return sx1_i2c_write_byte(SOFIA_I2C_ADDR, SOFIA_KEYLIGHT_REG, keylight); |
105 | } | 105 | } |
106 | /* get current keylight intensity */ | 106 | /* get current keylight intensity */ |
107 | int sx1_getkeylight(u8 * keylight) | 107 | int sx1_getkeylight(u8 * keylight) |
108 | { | 108 | { |
109 | return i2c_read_byte(SOFIA_I2C_ADDR, SOFIA_KEYLIGHT_REG, keylight); | 109 | return sx1_i2c_read_byte(SOFIA_I2C_ADDR, SOFIA_KEYLIGHT_REG, keylight); |
110 | } | 110 | } |
111 | /* set LCD backlight intensity */ | 111 | /* set LCD backlight intensity */ |
112 | int sx1_setbacklight(u8 backlight) | 112 | int sx1_setbacklight(u8 backlight) |
113 | { | 113 | { |
114 | if (backlight > SOFIA_MAX_LIGHT_VAL) | 114 | if (backlight > SOFIA_MAX_LIGHT_VAL) |
115 | backlight = SOFIA_MAX_LIGHT_VAL; | 115 | backlight = SOFIA_MAX_LIGHT_VAL; |
116 | return i2c_write_byte(SOFIA_I2C_ADDR, SOFIA_BACKLIGHT_REG, backlight); | 116 | return sx1_i2c_write_byte(SOFIA_I2C_ADDR, SOFIA_BACKLIGHT_REG, |
117 | backlight); | ||
117 | } | 118 | } |
118 | /* get current LCD backlight intensity */ | 119 | /* get current LCD backlight intensity */ |
119 | int sx1_getbacklight (u8 * backlight) | 120 | int sx1_getbacklight (u8 * backlight) |
120 | { | 121 | { |
121 | return i2c_read_byte(SOFIA_I2C_ADDR, SOFIA_BACKLIGHT_REG, backlight); | 122 | return sx1_i2c_read_byte(SOFIA_I2C_ADDR, SOFIA_BACKLIGHT_REG, |
123 | backlight); | ||
122 | } | 124 | } |
123 | /* set LCD backlight power on/off */ | 125 | /* set LCD backlight power on/off */ |
124 | int sx1_setmmipower(u8 onoff) | 126 | int sx1_setmmipower(u8 onoff) |
125 | { | 127 | { |
126 | int err; | 128 | int err; |
127 | u8 dat = 0; | 129 | u8 dat = 0; |
128 | err = i2c_read_byte(SOFIA_I2C_ADDR, SOFIA_POWER1_REG, &dat); | 130 | err = sx1_i2c_read_byte(SOFIA_I2C_ADDR, SOFIA_POWER1_REG, &dat); |
129 | if (err < 0) | 131 | if (err < 0) |
130 | return err; | 132 | return err; |
131 | if (onoff) | 133 | if (onoff) |
132 | dat |= SOFIA_MMILIGHT_POWER; | 134 | dat |= SOFIA_MMILIGHT_POWER; |
133 | else | 135 | else |
134 | dat &= ~SOFIA_MMILIGHT_POWER; | 136 | dat &= ~SOFIA_MMILIGHT_POWER; |
135 | return i2c_write_byte(SOFIA_I2C_ADDR, SOFIA_POWER1_REG, dat); | 137 | return sx1_i2c_write_byte(SOFIA_I2C_ADDR, SOFIA_POWER1_REG, dat); |
136 | } | ||
137 | /* set MMC power on/off */ | ||
138 | int sx1_setmmcpower(u8 onoff) | ||
139 | { | ||
140 | int err; | ||
141 | u8 dat = 0; | ||
142 | err = i2c_read_byte(SOFIA_I2C_ADDR, SOFIA_POWER1_REG, &dat); | ||
143 | if (err < 0) | ||
144 | return err; | ||
145 | if (onoff) | ||
146 | dat |= SOFIA_MMC_POWER; | ||
147 | else | ||
148 | dat &= ~SOFIA_MMC_POWER; | ||
149 | return i2c_write_byte(SOFIA_I2C_ADDR, SOFIA_POWER1_REG, dat); | ||
150 | } | 138 | } |
139 | |||
151 | /* set USB power on/off */ | 140 | /* set USB power on/off */ |
152 | int sx1_setusbpower(u8 onoff) | 141 | int sx1_setusbpower(u8 onoff) |
153 | { | 142 | { |
154 | int err; | 143 | int err; |
155 | u8 dat = 0; | 144 | u8 dat = 0; |
156 | err = i2c_read_byte(SOFIA_I2C_ADDR, SOFIA_POWER1_REG, &dat); | 145 | err = sx1_i2c_read_byte(SOFIA_I2C_ADDR, SOFIA_POWER1_REG, &dat); |
157 | if (err < 0) | 146 | if (err < 0) |
158 | return err; | 147 | return err; |
159 | if (onoff) | 148 | if (onoff) |
160 | dat |= SOFIA_USB_POWER; | 149 | dat |= SOFIA_USB_POWER; |
161 | else | 150 | else |
162 | dat &= ~SOFIA_USB_POWER; | 151 | dat &= ~SOFIA_USB_POWER; |
163 | return i2c_write_byte(SOFIA_I2C_ADDR, SOFIA_POWER1_REG, dat); | 152 | return sx1_i2c_write_byte(SOFIA_I2C_ADDR, SOFIA_POWER1_REG, dat); |
164 | } | 153 | } |
165 | 154 | ||
166 | EXPORT_SYMBOL(sx1_setkeylight); | 155 | EXPORT_SYMBOL(sx1_setkeylight); |
@@ -168,7 +157,6 @@ EXPORT_SYMBOL(sx1_getkeylight); | |||
168 | EXPORT_SYMBOL(sx1_setbacklight); | 157 | EXPORT_SYMBOL(sx1_setbacklight); |
169 | EXPORT_SYMBOL(sx1_getbacklight); | 158 | EXPORT_SYMBOL(sx1_getbacklight); |
170 | EXPORT_SYMBOL(sx1_setmmipower); | 159 | EXPORT_SYMBOL(sx1_setmmipower); |
171 | EXPORT_SYMBOL(sx1_setmmcpower); | ||
172 | EXPORT_SYMBOL(sx1_setusbpower); | 160 | EXPORT_SYMBOL(sx1_setusbpower); |
173 | 161 | ||
174 | /*----------- Keypad -------------------------*/ | 162 | /*----------- Keypad -------------------------*/ |
@@ -280,21 +268,6 @@ static struct omap_mcbsp_reg_cfg mcbsp1_regs = { | |||
280 | /* PCR0 =0f0f */ | 268 | /* PCR0 =0f0f */ |
281 | }; | 269 | }; |
282 | 270 | ||
283 | /* TODO: PCM interface - McBSP2 */ | ||
284 | static struct omap_mcbsp_reg_cfg mcbsp2_regs = { | ||
285 | .spcr2 = FRST | GRST | XRST | XINTM(3), /* SPCR2=F1 */ | ||
286 | .spcr1 = RINTM(3) | RRST, /* SPCR1=30 */ | ||
287 | .rcr2 = 0, /* RCR2 =00 */ | ||
288 | .rcr1 = RFRLEN1(1) | RWDLEN1(OMAP_MCBSP_WORD_16), /* RCR1 = 140 */ | ||
289 | .xcr2 = 0, /* XCR2 = 0 */ | ||
290 | .xcr1 = XFRLEN1(1) | XWDLEN1(OMAP_MCBSP_WORD_16), /* XCR1 = 140 */ | ||
291 | .srgr1 = FWID(15) | CLKGDV(12), /* SRGR1=0f0c */ | ||
292 | .srgr2 = FSGM | FPER(31), /* SRGR2=101f */ | ||
293 | .pcr0 = FSXM | FSRM | CLKXM | CLKRM | FSXP | FSRP | CLKXP | CLKRP, | ||
294 | /* PCR0=0f0f */ | ||
295 | /* mcbsp: slave */ | ||
296 | }; | ||
297 | |||
298 | static struct omap_alsa_codec_config sx1_alsa_config = { | 271 | static struct omap_alsa_codec_config sx1_alsa_config = { |
299 | .name = "SX1 EGold", | 272 | .name = "SX1 EGold", |
300 | .mcbsp_regs_alsa = &mcbsp1_regs, | 273 | .mcbsp_regs_alsa = &mcbsp1_regs, |
@@ -407,11 +380,8 @@ static struct omap_usb_config sx1_usb_config __initdata = { | |||
407 | 380 | ||
408 | static struct omap_mmc_config sx1_mmc_config __initdata = { | 381 | static struct omap_mmc_config sx1_mmc_config __initdata = { |
409 | .mmc [0] = { | 382 | .mmc [0] = { |
410 | .enabled = 1, | 383 | .enabled = 1, |
411 | .wire4 = 0, | 384 | .wire4 = 0, |
412 | .wp_pin = -1, | ||
413 | .power_pin = -1, /* power is in Sofia */ | ||
414 | .switch_pin = OMAP_MPUIO(3), | ||
415 | }, | 385 | }, |
416 | }; | 386 | }; |
417 | 387 | ||
@@ -440,13 +410,15 @@ static struct omap_uart_config sx1_uart_config __initdata = { | |||
440 | .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)), | 410 | .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)), |
441 | }; | 411 | }; |
442 | 412 | ||
443 | static struct omap_board_config_kernel sx1_config[] = { | 413 | static struct omap_board_config_kernel sx1_config[] __initdata = { |
444 | { OMAP_TAG_USB, &sx1_usb_config }, | 414 | { OMAP_TAG_USB, &sx1_usb_config }, |
445 | { OMAP_TAG_MMC, &sx1_mmc_config }, | 415 | { OMAP_TAG_MMC, &sx1_mmc_config }, |
446 | { OMAP_TAG_LCD, &sx1_lcd_config }, | 416 | { OMAP_TAG_LCD, &sx1_lcd_config }, |
447 | { OMAP_TAG_UART, &sx1_uart_config }, | 417 | { OMAP_TAG_UART, &sx1_uart_config }, |
448 | }; | 418 | }; |
419 | |||
449 | /*-----------------------------------------*/ | 420 | /*-----------------------------------------*/ |
421 | |||
450 | static void __init omap_sx1_init(void) | 422 | static void __init omap_sx1_init(void) |
451 | { | 423 | { |
452 | platform_add_devices(sx1_devices, ARRAY_SIZE(sx1_devices)); | 424 | platform_add_devices(sx1_devices, ARRAY_SIZE(sx1_devices)); |
@@ -454,6 +426,8 @@ static void __init omap_sx1_init(void) | |||
454 | omap_board_config = sx1_config; | 426 | omap_board_config = sx1_config; |
455 | omap_board_config_size = ARRAY_SIZE(sx1_config); | 427 | omap_board_config_size = ARRAY_SIZE(sx1_config); |
456 | omap_serial_init(); | 428 | omap_serial_init(); |
429 | omap_register_i2c_bus(1, 100, NULL, 0); | ||
430 | sx1_mmc_init(); | ||
457 | 431 | ||
458 | /* turn on USB power */ | 432 | /* turn on USB power */ |
459 | /* sx1_setusbpower(1); cant do it here because i2c is not ready */ | 433 | /* sx1_setusbpower(1); cant do it here because i2c is not ready */ |