aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/board-omap3beagle.c
diff options
context:
space:
mode:
authorRobert Nelson <robertcnelson@gmail.com>2010-09-23 21:22:47 -0400
committerTony Lindgren <tony@atomide.com>2010-09-23 21:22:47 -0400
commit954bed046fe57724851879a9db813eecb1d15f55 (patch)
tree70ae747531e3af8cddb12045563dfc28958dfc16 /arch/arm/mach-omap2/board-omap3beagle.c
parent0df891bb9c36c57d09c8b7cf28904e3672d93f9e (diff)
omap: Beagle: revision detection
Due to the omap3530 ES3.0 Silicon being used on both the B5/B6 and C1/2/3 Beagle we can't use the cpu_is_omap34xx() routines to differentiate the Beagle Boards. However gpio pins 171,172,173 where setup for this prupose, so lets use them. Changes: for older U-Boot's, use omap_mux_init_gpio() keep Beagle Rev in board-omap3beagle.c gpio_free on gpio request failure Tested on Beagle Revisions: B5, C2, C4, and xMA Signed-off-by: Robert Nelson <robertcnelson@gmail.com> Acked-by: Jarkko Nikula <jhnikula@gmail.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap2/board-omap3beagle.c')
-rw-r--r--arch/arm/mach-omap2/board-omap3beagle.c88
1 files changed, 88 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index 87969c7df652..1aebb3f4f20a 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -50,6 +50,93 @@
50 50
51#define NAND_BLOCK_SIZE SZ_128K 51#define NAND_BLOCK_SIZE SZ_128K
52 52
53/*
54 * OMAP3 Beagle revision
55 * Run time detection of Beagle revision is done by reading GPIO.
56 * GPIO ID -
57 * AXBX = GPIO173, GPIO172, GPIO171: 1 1 1
58 * C1_3 = GPIO173, GPIO172, GPIO171: 1 1 0
59 * C4 = GPIO173, GPIO172, GPIO171: 1 0 1
60 * XM = GPIO173, GPIO172, GPIO171: 0 0 0
61 */
62enum {
63 OMAP3BEAGLE_BOARD_UNKN = 0,
64 OMAP3BEAGLE_BOARD_AXBX,
65 OMAP3BEAGLE_BOARD_C1_3,
66 OMAP3BEAGLE_BOARD_C4,
67 OMAP3BEAGLE_BOARD_XM,
68};
69
70static u8 omap3_beagle_version;
71
72static u8 omap3_beagle_get_rev(void)
73{
74 return omap3_beagle_version;
75}
76
77static void __init omap3_beagle_init_rev(void)
78{
79 int ret;
80 u16 beagle_rev = 0;
81
82 omap_mux_init_gpio(171, OMAP_PIN_INPUT_PULLUP);
83 omap_mux_init_gpio(172, OMAP_PIN_INPUT_PULLUP);
84 omap_mux_init_gpio(173, OMAP_PIN_INPUT_PULLUP);
85
86 ret = gpio_request(171, "rev_id_0");
87 if (ret < 0)
88 goto fail0;
89
90 ret = gpio_request(172, "rev_id_1");
91 if (ret < 0)
92 goto fail1;
93
94 ret = gpio_request(173, "rev_id_2");
95 if (ret < 0)
96 goto fail2;
97
98 gpio_direction_input(171);
99 gpio_direction_input(172);
100 gpio_direction_input(173);
101
102 beagle_rev = gpio_get_value(171) | (gpio_get_value(172) << 1)
103 | (gpio_get_value(173) << 2);
104
105 switch (beagle_rev) {
106 case 7:
107 printk(KERN_INFO "OMAP3 Beagle Rev: Ax/Bx\n");
108 omap3_beagle_version = OMAP3BEAGLE_BOARD_AXBX;
109 break;
110 case 6:
111 printk(KERN_INFO "OMAP3 Beagle Rev: C1/C2/C3\n");
112 omap3_beagle_version = OMAP3BEAGLE_BOARD_C1_3;
113 break;
114 case 5:
115 printk(KERN_INFO "OMAP3 Beagle Rev: C4\n");
116 omap3_beagle_version = OMAP3BEAGLE_BOARD_C4;
117 break;
118 case 0:
119 printk(KERN_INFO "OMAP3 Beagle Rev: xM\n");
120 omap3_beagle_version = OMAP3BEAGLE_BOARD_XM;
121 break;
122 default:
123 printk(KERN_INFO "OMAP3 Beagle Rev: unknown %hd\n", beagle_rev);
124 omap3_beagle_version = OMAP3BEAGLE_BOARD_UNKN;
125 }
126
127 return;
128
129fail2:
130 gpio_free(172);
131fail1:
132 gpio_free(171);
133fail0:
134 printk(KERN_ERR "Unable to get revision detection GPIO pins\n");
135 omap3_beagle_version = OMAP3BEAGLE_BOARD_UNKN;
136
137 return;
138}
139
53static struct mtd_partition omap3beagle_nand_partitions[] = { 140static struct mtd_partition omap3beagle_nand_partitions[] = {
54 /* All the partition sizes are listed in terms of NAND block size */ 141 /* All the partition sizes are listed in terms of NAND block size */
55 { 142 {
@@ -464,6 +551,7 @@ static struct omap_musb_board_data musb_board_data = {
464static void __init omap3_beagle_init(void) 551static void __init omap3_beagle_init(void)
465{ 552{
466 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); 553 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
554 omap3_beagle_init_rev();
467 omap3_beagle_i2c_init(); 555 omap3_beagle_i2c_init();
468 platform_add_devices(omap3_beagle_devices, 556 platform_add_devices(omap3_beagle_devices,
469 ARRAY_SIZE(omap3_beagle_devices)); 557 ARRAY_SIZE(omap3_beagle_devices));