Commit 98bb8c3e authored by Tony Lindgren's avatar Tony Lindgren

Merge branch 'devel-boards' into omap-for-linus

parents d58cc92b 3da434ac
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <linux/usb/otg.h> #include <linux/usb/otg.h>
#include <linux/spi/spi.h> #include <linux/spi/spi.h>
#include <linux/i2c/twl.h> #include <linux/i2c/twl.h>
#include <linux/gpio_keys.h>
#include <linux/regulator/machine.h> #include <linux/regulator/machine.h>
#include <linux/leds.h> #include <linux/leds.h>
...@@ -40,6 +41,8 @@ ...@@ -40,6 +41,8 @@
#define ETH_KS8851_IRQ 34 #define ETH_KS8851_IRQ 34
#define ETH_KS8851_POWER_ON 48 #define ETH_KS8851_POWER_ON 48
#define ETH_KS8851_QUART 138 #define ETH_KS8851_QUART 138
#define OMAP4_SFH7741_SENSOR_OUTPUT_GPIO 184
#define OMAP4_SFH7741_ENABLE_GPIO 188
static struct gpio_led sdp4430_gpio_leds[] = { static struct gpio_led sdp4430_gpio_leds[] = {
{ {
...@@ -77,11 +80,47 @@ static struct gpio_led sdp4430_gpio_leds[] = { ...@@ -77,11 +80,47 @@ static struct gpio_led sdp4430_gpio_leds[] = {
}; };
static struct gpio_keys_button sdp4430_gpio_keys[] = {
{
.desc = "Proximity Sensor",
.type = EV_SW,
.code = SW_FRONT_PROXIMITY,
.gpio = OMAP4_SFH7741_SENSOR_OUTPUT_GPIO,
.active_low = 0,
}
};
static struct gpio_led_platform_data sdp4430_led_data = { static struct gpio_led_platform_data sdp4430_led_data = {
.leds = sdp4430_gpio_leds, .leds = sdp4430_gpio_leds,
.num_leds = ARRAY_SIZE(sdp4430_gpio_leds), .num_leds = ARRAY_SIZE(sdp4430_gpio_leds),
}; };
static int omap_prox_activate(struct device *dev)
{
gpio_set_value(OMAP4_SFH7741_ENABLE_GPIO , 1);
return 0;
}
static void omap_prox_deactivate(struct device *dev)
{
gpio_set_value(OMAP4_SFH7741_ENABLE_GPIO , 0);
}
static struct gpio_keys_platform_data sdp4430_gpio_keys_data = {
.buttons = sdp4430_gpio_keys,
.nbuttons = ARRAY_SIZE(sdp4430_gpio_keys),
.enable = omap_prox_activate,
.disable = omap_prox_deactivate,
};
static struct platform_device sdp4430_gpio_keys_device = {
.name = "gpio-keys",
.id = -1,
.dev = {
.platform_data = &sdp4430_gpio_keys_data,
},
};
static struct platform_device sdp4430_leds_gpio = { static struct platform_device sdp4430_leds_gpio = {
.name = "leds-gpio", .name = "leds-gpio",
.id = -1, .id = -1,
...@@ -161,6 +200,7 @@ static struct platform_device sdp4430_lcd_device = { ...@@ -161,6 +200,7 @@ static struct platform_device sdp4430_lcd_device = {
static struct platform_device *sdp4430_devices[] __initdata = { static struct platform_device *sdp4430_devices[] __initdata = {
&sdp4430_lcd_device, &sdp4430_lcd_device,
&sdp4430_gpio_keys_device,
&sdp4430_leds_gpio, &sdp4430_leds_gpio,
}; };
...@@ -412,6 +452,11 @@ static struct i2c_board_info __initdata sdp4430_i2c_3_boardinfo[] = { ...@@ -412,6 +452,11 @@ static struct i2c_board_info __initdata sdp4430_i2c_3_boardinfo[] = {
I2C_BOARD_INFO("tmp105", 0x48), I2C_BOARD_INFO("tmp105", 0x48),
}, },
}; };
static struct i2c_board_info __initdata sdp4430_i2c_4_boardinfo[] = {
{
I2C_BOARD_INFO("hmc5843", 0x1e),
},
};
static int __init omap4_i2c_init(void) static int __init omap4_i2c_init(void)
{ {
/* /*
...@@ -423,14 +468,36 @@ static int __init omap4_i2c_init(void) ...@@ -423,14 +468,36 @@ static int __init omap4_i2c_init(void)
omap_register_i2c_bus(2, 400, NULL, 0); omap_register_i2c_bus(2, 400, NULL, 0);
omap_register_i2c_bus(3, 400, sdp4430_i2c_3_boardinfo, omap_register_i2c_bus(3, 400, sdp4430_i2c_3_boardinfo,
ARRAY_SIZE(sdp4430_i2c_3_boardinfo)); ARRAY_SIZE(sdp4430_i2c_3_boardinfo));
omap_register_i2c_bus(4, 400, NULL, 0); omap_register_i2c_bus(4, 400, sdp4430_i2c_4_boardinfo,
ARRAY_SIZE(sdp4430_i2c_4_boardinfo));
return 0; return 0;
} }
static void __init omap_sfh7741prox_init(void)
{
int error;
error = gpio_request(OMAP4_SFH7741_ENABLE_GPIO, "sfh7741");
if (error < 0) {
pr_err("%s:failed to request GPIO %d, error %d\n",
__func__, OMAP4_SFH7741_ENABLE_GPIO, error);
return;
}
error = gpio_direction_output(OMAP4_SFH7741_ENABLE_GPIO , 0);
if (error < 0) {
pr_err("%s: GPIO configuration failed: GPIO %d,error %d\n",
__func__, OMAP4_SFH7741_ENABLE_GPIO, error);
gpio_free(OMAP4_SFH7741_ENABLE_GPIO);
}
}
static void __init omap_4430sdp_init(void) static void __init omap_4430sdp_init(void)
{ {
int status; int status;
omap4_i2c_init(); omap4_i2c_init();
omap_sfh7741prox_init();
platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices)); platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices));
omap_serial_init(); omap_serial_init();
omap4_twl6030_hsmmc_init(mmc); omap4_twl6030_hsmmc_init(mmc);
......
...@@ -51,6 +51,93 @@ ...@@ -51,6 +51,93 @@
#define NAND_BLOCK_SIZE SZ_128K #define NAND_BLOCK_SIZE SZ_128K
/*
* OMAP3 Beagle revision
* Run time detection of Beagle revision is done by reading GPIO.
* GPIO ID -
* AXBX = GPIO173, GPIO172, GPIO171: 1 1 1
* C1_3 = GPIO173, GPIO172, GPIO171: 1 1 0
* C4 = GPIO173, GPIO172, GPIO171: 1 0 1
* XM = GPIO173, GPIO172, GPIO171: 0 0 0
*/
enum {
OMAP3BEAGLE_BOARD_UNKN = 0,
OMAP3BEAGLE_BOARD_AXBX,
OMAP3BEAGLE_BOARD_C1_3,
OMAP3BEAGLE_BOARD_C4,
OMAP3BEAGLE_BOARD_XM,
};
static u8 omap3_beagle_version;
static u8 omap3_beagle_get_rev(void)
{
return omap3_beagle_version;
}
static void __init omap3_beagle_init_rev(void)
{
int ret;
u16 beagle_rev = 0;
omap_mux_init_gpio(171, OMAP_PIN_INPUT_PULLUP);
omap_mux_init_gpio(172, OMAP_PIN_INPUT_PULLUP);
omap_mux_init_gpio(173, OMAP_PIN_INPUT_PULLUP);
ret = gpio_request(171, "rev_id_0");
if (ret < 0)
goto fail0;
ret = gpio_request(172, "rev_id_1");
if (ret < 0)
goto fail1;
ret = gpio_request(173, "rev_id_2");
if (ret < 0)
goto fail2;
gpio_direction_input(171);
gpio_direction_input(172);
gpio_direction_input(173);
beagle_rev = gpio_get_value(171) | (gpio_get_value(172) << 1)
| (gpio_get_value(173) << 2);
switch (beagle_rev) {
case 7:
printk(KERN_INFO "OMAP3 Beagle Rev: Ax/Bx\n");
omap3_beagle_version = OMAP3BEAGLE_BOARD_AXBX;
break;
case 6:
printk(KERN_INFO "OMAP3 Beagle Rev: C1/C2/C3\n");
omap3_beagle_version = OMAP3BEAGLE_BOARD_C1_3;
break;
case 5:
printk(KERN_INFO "OMAP3 Beagle Rev: C4\n");
omap3_beagle_version = OMAP3BEAGLE_BOARD_C4;
break;
case 0:
printk(KERN_INFO "OMAP3 Beagle Rev: xM\n");
omap3_beagle_version = OMAP3BEAGLE_BOARD_XM;
break;
default:
printk(KERN_INFO "OMAP3 Beagle Rev: unknown %hd\n", beagle_rev);
omap3_beagle_version = OMAP3BEAGLE_BOARD_UNKN;
}
return;
fail2:
gpio_free(172);
fail1:
gpio_free(171);
fail0:
printk(KERN_ERR "Unable to get revision detection GPIO pins\n");
omap3_beagle_version = OMAP3BEAGLE_BOARD_UNKN;
return;
}
static struct mtd_partition omap3beagle_nand_partitions[] = { static struct mtd_partition omap3beagle_nand_partitions[] = {
/* All the partition sizes are listed in terms of NAND block size */ /* All the partition sizes are listed in terms of NAND block size */
{ {
...@@ -186,7 +273,10 @@ static struct gpio_led gpio_leds[]; ...@@ -186,7 +273,10 @@ static struct gpio_led gpio_leds[];
static int beagle_twl_gpio_setup(struct device *dev, static int beagle_twl_gpio_setup(struct device *dev,
unsigned gpio, unsigned ngpio) unsigned gpio, unsigned ngpio)
{ {
if (system_rev >= 0x20 && system_rev <= 0x34301000) { if (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_XM) {
mmc[0].gpio_wp = -EINVAL;
} else if ((omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_C1_3) ||
(omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_C4)) {
omap_mux_init_gpio(23, OMAP_PIN_INPUT); omap_mux_init_gpio(23, OMAP_PIN_INPUT);
mmc[0].gpio_wp = 23; mmc[0].gpio_wp = 23;
} else { } else {
...@@ -323,13 +413,19 @@ static struct i2c_board_info __initdata beagle_i2c_boardinfo[] = { ...@@ -323,13 +413,19 @@ static struct i2c_board_info __initdata beagle_i2c_boardinfo[] = {
}, },
}; };
static struct i2c_board_info __initdata beagle_i2c_eeprom[] = {
{
I2C_BOARD_INFO("eeprom", 0x50),
},
};
static int __init omap3_beagle_i2c_init(void) static int __init omap3_beagle_i2c_init(void)
{ {
omap_register_i2c_bus(1, 2600, beagle_i2c_boardinfo, omap_register_i2c_bus(1, 2600, beagle_i2c_boardinfo,
ARRAY_SIZE(beagle_i2c_boardinfo)); ARRAY_SIZE(beagle_i2c_boardinfo));
/* Bus 3 is attached to the DVI port where devices like the pico DLP /* Bus 3 is attached to the DVI port where devices like the pico DLP
* projector don't work reliably with 400kHz */ * projector don't work reliably with 400kHz */
omap_register_i2c_bus(3, 100, NULL, 0); omap_register_i2c_bus(3, 100, beagle_i2c_eeprom, ARRAY_SIZE(beagle_i2c_eeprom));
return 0; return 0;
} }
...@@ -465,6 +561,7 @@ static struct omap_musb_board_data musb_board_data = { ...@@ -465,6 +561,7 @@ static struct omap_musb_board_data musb_board_data = {
static void __init omap3_beagle_init(void) static void __init omap3_beagle_init(void)
{ {
omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
omap3_beagle_init_rev();
omap3_beagle_i2c_init(); omap3_beagle_i2c_init();
platform_add_devices(omap3_beagle_devices, platform_add_devices(omap3_beagle_devices,
ARRAY_SIZE(omap3_beagle_devices)); ARRAY_SIZE(omap3_beagle_devices));
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/leds.h>
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/usb/otg.h> #include <linux/usb/otg.h>
#include <linux/i2c/twl.h> #include <linux/i2c/twl.h>
...@@ -40,6 +41,36 @@ ...@@ -40,6 +41,36 @@
#include "hsmmc.h" #include "hsmmc.h"
static struct gpio_led gpio_leds[] = {
{
.name = "pandaboard::status1",
.default_trigger = "heartbeat",
.gpio = 7,
},
{
.name = "pandaboard::status2",
.default_trigger = "mmc0",
.gpio = 8,
},
};
static struct gpio_led_platform_data gpio_led_info = {
.leds = gpio_leds,
.num_leds = ARRAY_SIZE(gpio_leds),
};
static struct platform_device leds_gpio = {
.name = "leds-gpio",
.id = -1,
.dev = {
.platform_data = &gpio_led_info,
},
};
static struct platform_device *panda_devices[] __initdata = {
&leds_gpio,
};
static void __init omap4_panda_init_irq(void) static void __init omap4_panda_init_irq(void)
{ {
omap2_init_common_hw(NULL, NULL); omap2_init_common_hw(NULL, NULL);
...@@ -275,6 +306,7 @@ static int __init omap4_panda_i2c_init(void) ...@@ -275,6 +306,7 @@ static int __init omap4_panda_i2c_init(void)
static void __init omap4_panda_init(void) static void __init omap4_panda_init(void)
{ {
omap4_panda_i2c_init(); omap4_panda_i2c_init();
platform_add_devices(panda_devices, ARRAY_SIZE(panda_devices));
omap_serial_init(); omap_serial_init();
omap4_twl6030_hsmmc_init(mmc); omap4_twl6030_hsmmc_init(mmc);
/* OMAP4 Panda uses internal transceiver so register nop transceiver */ /* OMAP4 Panda uses internal transceiver so register nop transceiver */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment