aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAjay Kumar Gupta <ajay.gupta@ti.com>2009-11-22 13:11:27 -0500
committerTony Lindgren <tony@atomide.com>2009-11-22 13:24:33 -0500
commitdb408023b85644e1bee80d4004aff1ff188032e9 (patch)
treebed99e2c03d4b137082e58b76fb0528fe75cff8a /arch
parent50a1f7bfea7ba9330f984ecb7d35aeb93d326cc3 (diff)
omap3evm: Add board revision function
Added function to differentiate between the OMAP3EVM revisions. The chip-id of the ethernet PHY is being used for this purpose. Rev A to D : 0x01150000 Rev >= E : 0x92200000 Signed-off-by: Vaibhav Hiremath <hvaibhav@ti.com> Signed-off-by: Ajay Kumar Gupta <ajay.gupta@ti.com> Signed-off-by: Sanjeev Premi <premi@ti.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-omap2/board-omap3evm.c35
-rw-r--r--arch/arm/plat-omap/include/plat/board.h18
2 files changed, 53 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
index 1edf06adbe3c..149d45ca89a7 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -46,9 +46,42 @@
46 46
47#define OMAP3EVM_ETHR_START 0x2c000000 47#define OMAP3EVM_ETHR_START 0x2c000000
48#define OMAP3EVM_ETHR_SIZE 1024 48#define OMAP3EVM_ETHR_SIZE 1024
49#define OMAP3EVM_ETHR_ID_REV 0x50
49#define OMAP3EVM_ETHR_GPIO_IRQ 176 50#define OMAP3EVM_ETHR_GPIO_IRQ 176
50#define OMAP3EVM_SMC911X_CS 5 51#define OMAP3EVM_SMC911X_CS 5
51 52
53static u8 omap3_evm_version;
54
55u8 get_omap3_evm_rev(void)
56{
57 return omap3_evm_version;
58}
59EXPORT_SYMBOL(get_omap3_evm_rev);
60
61static void __init omap3_evm_get_revision(void)
62{
63 void __iomem *ioaddr;
64 unsigned int smsc_id;
65
66 /* Ethernet PHY ID is stored at ID_REV register */
67 ioaddr = ioremap_nocache(OMAP3EVM_ETHR_START, SZ_1K);
68 if (!ioaddr)
69 return;
70 smsc_id = readl(ioaddr + OMAP3EVM_ETHR_ID_REV) & 0xFFFF0000;
71 iounmap(ioaddr);
72
73 switch (smsc_id) {
74 /*SMSC9115 chipset*/
75 case 0x01150000:
76 omap3_evm_version = OMAP3EVM_BOARD_GEN_1;
77 break;
78 /*SMSC 9220 chipset*/
79 case 0x92200000:
80 default:
81 omap3_evm_version = OMAP3EVM_BOARD_GEN_2;
82 }
83}
84
52static struct resource omap3evm_smc911x_resources[] = { 85static struct resource omap3evm_smc911x_resources[] = {
53 [0] = { 86 [0] = {
54 .start = OMAP3EVM_ETHR_START, 87 .start = OMAP3EVM_ETHR_START,
@@ -321,6 +354,8 @@ static struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
321 354
322static void __init omap3_evm_init(void) 355static void __init omap3_evm_init(void)
323{ 356{
357 omap3_evm_get_revision();
358
324 omap3_evm_i2c_init(); 359 omap3_evm_i2c_init();
325 360
326 platform_add_devices(omap3_evm_devices, ARRAY_SIZE(omap3_evm_devices)); 361 platform_add_devices(omap3_evm_devices, ARRAY_SIZE(omap3_evm_devices));
diff --git a/arch/arm/plat-omap/include/plat/board.h b/arch/arm/plat-omap/include/plat/board.h
index c4fc69f09796..abb17b604f82 100644
--- a/arch/arm/plat-omap/include/plat/board.h
+++ b/arch/arm/plat-omap/include/plat/board.h
@@ -14,6 +14,18 @@
14 14
15#include <plat/gpio-switch.h> 15#include <plat/gpio-switch.h>
16 16
17/*
18 * OMAP35x EVM revision
19 * Run time detection of EVM revision is done by reading Ethernet
20 * PHY ID -
21 * GEN_1 = 0x01150000
22 * GEN_2 = 0x92200000
23 */
24enum {
25 OMAP3EVM_BOARD_GEN_1 = 0, /* EVM Rev between A - D */
26 OMAP3EVM_BOARD_GEN_2, /* EVM Rev >= Rev E */
27};
28
17/* Different peripheral ids */ 29/* Different peripheral ids */
18#define OMAP_TAG_CLOCK 0x4f01 30#define OMAP_TAG_CLOCK 0x4f01
19#define OMAP_TAG_LCD 0x4f05 31#define OMAP_TAG_LCD 0x4f05
@@ -157,4 +169,10 @@ extern int omap_board_config_size;
157/* for TI reference platforms sharing the same debug card */ 169/* for TI reference platforms sharing the same debug card */
158extern int debug_card_init(u32 addr, unsigned gpio); 170extern int debug_card_init(u32 addr, unsigned gpio);
159 171
172/* OMAP3EVM revision */
173#if defined(CONFIG_MACH_OMAP3EVM)
174u8 get_omap3_evm_rev(void);
175#else
176#define get_omap3_evm_rev() (-EINVAL)
177#endif
160#endif 178#endif