Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 216903
b: refs/heads/master
c: 954bed0
h: refs/heads/master
i:
  216901: d3129da
  216899: 6dad9c7
  216895: 49c998f
v: v3
  • Loading branch information
Robert Nelson authored and Tony Lindgren committed Sep 24, 2010
1 parent 1543856 commit dd60f9e
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0df891bb9c36c57d09c8b7cf28904e3672d93f9e
refs/heads/master: 954bed046fe57724851879a9db813eecb1d15f55
88 changes: 88 additions & 0 deletions trunk/arch/arm/mach-omap2/board-omap3beagle.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,93 @@

#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[] = {
/* All the partition sizes are listed in terms of NAND block size */
{
Expand Down Expand Up @@ -464,6 +551,7 @@ static struct omap_musb_board_data musb_board_data = {
static void __init omap3_beagle_init(void)
{
omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
omap3_beagle_init_rev();
omap3_beagle_i2c_init();
platform_add_devices(omap3_beagle_devices,
ARRAY_SIZE(omap3_beagle_devices));
Expand Down

0 comments on commit dd60f9e

Please sign in to comment.