Skip to content
Snippets Groups Projects
Commit a78ded13 authored by Wolfgang Denk's avatar Wolfgang Denk
Browse files

Merge branch 'master' of git://git.denx.de/u-boot-ti

parents f8736c21 6696ac19
No related branches found
No related tags found
No related merge requests found
Showing
with 955 additions and 349 deletions
...@@ -26,7 +26,9 @@ include $(TOPDIR)/config.mk ...@@ -26,7 +26,9 @@ include $(TOPDIR)/config.mk
LIB = $(obj)libomap-common.a LIB = $(obj)libomap-common.a
SOBJS := reset.o SOBJS := reset.o
COBJS := timer.o COBJS := timer.o
COBJS += syslib.o
SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS)) OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
......
...@@ -27,10 +27,12 @@ ...@@ -27,10 +27,12 @@
reset_cpu: reset_cpu:
ldr r1, rstctl @ get addr for global reset ldr r1, rstctl @ get addr for global reset
@ reg @ reg
mov r3, #0x2 @ full reset pll + mpu ldr r3, rstbit @ sw reset bit
str r3, [r1] @ force reset str r3, [r1] @ force reset
mov r0, r0 mov r0, r0
_loop_forever: _loop_forever:
b _loop_forever b _loop_forever
rstctl: rstctl:
.word PRM_RSTCTRL .word PRM_RSTCTRL
rstbit:
.word PRM_RSTCTRL_RESET
...@@ -23,8 +23,6 @@ ...@@ -23,8 +23,6 @@
#include <common.h> #include <common.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/arch/mem.h>
#include <asm/arch/clocks.h>
#include <asm/arch/sys_proto.h> #include <asm/arch/sys_proto.h>
/************************************************************ /************************************************************
......
...@@ -32,7 +32,6 @@ COBJS += board.o ...@@ -32,7 +32,6 @@ COBJS += board.o
COBJS += clock.o COBJS += clock.o
COBJS += gpio.o COBJS += gpio.o
COBJS += mem.o COBJS += mem.o
COBJS += syslib.o
COBJS += sys_info.o COBJS += sys_info.o
COBJS-$(CONFIG_EMIF4) += emif4.o COBJS-$(CONFIG_EMIF4) += emif4.o
......
...@@ -119,41 +119,6 @@ void secureworld_exit() ...@@ -119,41 +119,6 @@ void secureworld_exit()
__asm__ __volatile__("mcr p15, 0, %0, c1, c1, 0":"=r"(i)); __asm__ __volatile__("mcr p15, 0, %0, c1, c1, 0":"=r"(i));
} }
/******************************************************************************
* Routine: setup_auxcr()
* Description: Write to AuxCR desired value using SMI.
* general use.
*****************************************************************************/
void setup_auxcr()
{
unsigned long i;
volatile unsigned int j;
/* Save r0, r12 and restore them after usage */
__asm__ __volatile__("mov %0, r12":"=r"(j));
__asm__ __volatile__("mov %0, r0":"=r"(i));
/*
* GP Device ROM code API usage here
* r12 = AUXCR Write function and r0 value
*/
__asm__ __volatile__("mov r12, #0x3");
__asm__ __volatile__("mrc p15, 0, r0, c1, c0, 1");
/* Enabling ASA */
__asm__ __volatile__("orr r0, r0, #0x10");
/* Enable L1NEON */
__asm__ __volatile__("orr r0, r0, #1 << 5");
/* SMI instruction to call ROM Code API */
__asm__ __volatile__(".word 0xE1600070");
/* Set PLD_FWD bit in L2AUXCR (Cortex-A8 erratum 725233 workaround) */
__asm__ __volatile__("mov r12, #0x2");
__asm__ __volatile__("mrc p15, 1, r0, c9, c0, 2");
__asm__ __volatile__("orr r0, r0, #1 << 27");
/* SMI instruction to call ROM Code API */
__asm__ __volatile__(".word 0xE1600070");
__asm__ __volatile__("mov r0, %0":"=r"(i));
__asm__ __volatile__("mov r12, %0":"=r"(j));
}
/****************************************************************************** /******************************************************************************
* Routine: try_unlock_sram() * Routine: try_unlock_sram()
* Description: If chip is GP/EMU(special) type, unlock the SRAM for * Description: If chip is GP/EMU(special) type, unlock the SRAM for
......
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
.global invalidate_dcache .global invalidate_dcache
.global l2_cache_enable .global l2_cache_enable
.global l2_cache_disable .global l2_cache_disable
.global setup_auxcr
/* /*
* invalidate_dcache() * invalidate_dcache()
...@@ -128,64 +129,56 @@ finished_inval: ...@@ -128,64 +129,56 @@ finished_inval:
ldmfd r13!, {r0 - r5, r7, r9 - r12, pc} ldmfd r13!, {r0 - r5, r7, r9 - r12, pc}
l2_cache_set:
l2_cache_enable: stmfd r13!, {r4 - r6, lr}
stmfd r13!, {r0, r1, r2, lr} mov r5, r0
@ ES2 onwards we can disable/enable L2 ourselves
bl get_cpu_rev bl get_cpu_rev
cmp r0, #CPU_3XX_ES20 mov r4, r0
blt l2_cache_disable_EARLIER_THAN_ES2 bl get_cpu_family
mrc 15, 0, r3, cr1, cr0, 1 @ ES2 onwards we can disable/enable L2 ourselves
orr r3, r3, #2 cmp r0, #CPU_OMAP34XX
mcr 15, 0, r3, cr1, cr0, 1 cmpeq r4, #CPU_3XX_ES10
b l2_cache_enable_END mrc 15, 0, r0, cr1, cr0, 1
l2_cache_enable_EARLIER_THAN_ES2: bic r0, r0, #2
@ Save r0, r12 and restore them after usage orr r0, r0, r5, lsl #1
mov r3, ip mcreq 15, 0, r0, cr1, cr0, 1
str r3, [sp, #4]
mov r3, r0
@
@ GP Device ROM code API usage here @ GP Device ROM code API usage here
@ r12 = AUXCR Write function and r0 value @ r12 = AUXCR Write function and r0 value
@
mov ip, #3 mov ip, #3
mrc 15, 0, r0, cr1, cr0, 1 @ SMCNE instruction to call ROM Code API
orr r0, r0, #2 .word 0x11600070
@ SMI instruction to call ROM Code API ldmfd r13!, {r4 - r6, pc}
.word 0xe1600070
mov r0, r3
mov ip, r3
str r3, [sp, #4]
l2_cache_enable_END:
ldmfd r13!, {r1, r2, r3, pc}
l2_cache_enable:
mov r0, #1
b l2_cache_set
l2_cache_disable: l2_cache_disable:
stmfd r13!, {r0, r1, r2, lr} mov r0, #0
@ ES2 onwards we can disable/enable L2 ourselves b l2_cache_set
bl get_cpu_rev
cmp r0, #CPU_3XX_ES20 /******************************************************************************
blt l2_cache_disable_EARLIER_THAN_ES2 * Routine: setup_auxcr()
mrc 15, 0, r3, cr1, cr0, 1 * Description: Write to AuxCR desired value using SMI.
bic r3, r3, #2 * general use.
mcr 15, 0, r3, cr1, cr0, 1 *****************************************************************************/
b l2_cache_disable_END setup_auxcr:
l2_cache_disable_EARLIER_THAN_ES2: mrc p15, 0, r0, c0, c0, 0 @ read main ID register
@ Save r0, r12 and restore them after usage and r2, r0, #0x00f00000 @ variant
mov r3, ip and r3, r0, #0x0000000f @ revision
str r3, [sp, #4] orr r1, r3, r2, lsr #20-4 @ combine variant and revision
mov r3, r0 mov r12, #0x3
@ mrc p15, 0, r0, c1, c0, 1
@ GP Device ROM code API usage here orr r0, r0, #0x10 @ Enable ASA
@ r12 = AUXCR Write function and r0 value @ Enable L1NEON on pre-r2p1 (erratum 621766 workaround)
@ cmp r1, #0x21
mov ip, #3 orrlt r0, r0, #1 << 5
mrc 15, 0, r0, cr1, cr0, 1 .word 0xE1600070 @ SMC
bic r0, r0, #2 mov r12, #0x2
@ SMI instruction to call ROM Code API mrc p15, 1, r0, c9, c0, 2
.word 0xe1600070 @ Set PLD_FWD bit in L2AUXCR on pre-r2p1 (erratum 725233 workaround)
mov r0, r3 cmp r1, #0x21
mov ip, r3 orrlt r0, r0, #1 << 27
str r3, [sp, #4] .word 0xE1600070 @ SMC
l2_cache_disable_END: bx lr
ldmfd r13!, {r1, r2, r3, pc}
This diff is collapsed.
...@@ -359,3 +359,72 @@ per_dpll_param: ...@@ -359,3 +359,72 @@ per_dpll_param:
get_per_dpll_param: get_per_dpll_param:
adr r0, per_dpll_param adr r0, per_dpll_param
mov pc, lr mov pc, lr
/*
* Tables for 36XX/37XX devices
*
*/
mpu_36x_dpll_param:
/* 12MHz */
.word 50, 0, 0, 1
/* 13MHz */
.word 600, 12, 0, 1
/* 19.2MHz */
.word 125, 3, 0, 1
/* 26MHz */
.word 300, 12, 0, 1
/* 38.4MHz */
.word 125, 7, 0, 1
iva_36x_dpll_param:
/* 12MHz */
.word 130, 2, 0, 1
/* 13MHz */
.word 20, 0, 0, 1
/* 19.2MHz */
.word 325, 11, 0, 1
/* 26MHz */
.word 10, 0, 0, 1
/* 38.4MHz */
.word 325, 23, 0, 1
core_36x_dpll_param:
/* 12MHz */
.word 100, 2, 0, 1
/* 13MHz */
.word 400, 12, 0, 1
/* 19.2MHz */
.word 375, 17, 0, 1
/* 26MHz */
.word 200, 12, 0, 1
/* 38.4MHz */
.word 375, 35, 0, 1
per_36x_dpll_param:
/* SYSCLK M N M2 M3 M4 M5 M6 m2DIV */
.word 12000, 360, 4, 9, 16, 5, 4, 3, 1
.word 13000, 864, 12, 9, 16, 9, 4, 3, 1
.word 19200, 360, 7, 9, 16, 5, 4, 3, 1
.word 26000, 432, 12, 9, 16, 9, 4, 3, 1
.word 38400, 360, 15, 9, 16, 5, 4, 3, 1
.globl get_36x_mpu_dpll_param
get_36x_mpu_dpll_param:
adr r0, mpu_36x_dpll_param
mov pc, lr
.globl get_36x_iva_dpll_param
get_36x_iva_dpll_param:
adr r0, iva_36x_dpll_param
mov pc, lr
.globl get_36x_core_dpll_param
get_36x_core_dpll_param:
adr r0, core_36x_dpll_param
mov pc, lr
.globl get_36x_per_dpll_param
get_36x_per_dpll_param:
adr r0, per_36x_dpll_param
mov pc, lr
...@@ -107,18 +107,12 @@ u32 get_sdr_cs_offset(u32 cs) ...@@ -107,18 +107,12 @@ u32 get_sdr_cs_offset(u32 cs)
/* /*
* do_sdrc_init - * do_sdrc_init -
* - Initialize the SDRAM for use. * - Initialize the SDRAM for use.
* - Sets up SDRC timings for CS0
* - code called once in C-Stack only context for CS0 and a possible 2nd * - code called once in C-Stack only context for CS0 and a possible 2nd
* time depending on memory configuration from stack+global context * time depending on memory configuration from stack+global context
*/ */
void do_sdrc_init(u32 cs, u32 early) void do_sdrc_init(u32 cs, u32 early)
{ {
struct sdrc_actim *sdrc_actim_base; struct sdrc_actim *sdrc_actim_base0, *sdrc_actim_base1;
if (cs)
sdrc_actim_base = (struct sdrc_actim *)SDRC_ACTIM_CTRL1_BASE;
else
sdrc_actim_base = (struct sdrc_actim *)SDRC_ACTIM_CTRL0_BASE;
if (early) { if (early) {
/* reset sdrc controller */ /* reset sdrc controller */
...@@ -138,24 +132,29 @@ void do_sdrc_init(u32 cs, u32 early) ...@@ -138,24 +132,29 @@ void do_sdrc_init(u32 cs, u32 early)
sdelay(0x20000); sdelay(0x20000);
} }
writel(RASWIDTH_13BITS | CASWIDTH_10BITS | ADDRMUXLEGACY |
RAMSIZE_128 | BANKALLOCATION | B32NOT16 | B32NOT16 |
DEEPPD | DDR_SDRAM, &sdrc_base->cs[cs].mcfg);
writel(ARCV | ARE_ARCV_1, &sdrc_base->cs[cs].rfr_ctrl);
writel(V_ACTIMA_165, &sdrc_actim_base->ctrla);
writel(V_ACTIMB_165, &sdrc_actim_base->ctrlb);
writel(CMD_NOP, &sdrc_base->cs[cs].manual);
writel(CMD_PRECHARGE, &sdrc_base->cs[cs].manual);
writel(CMD_AUTOREFRESH, &sdrc_base->cs[cs].manual);
writel(CMD_AUTOREFRESH, &sdrc_base->cs[cs].manual);
/* /*
* CAS latency 3, Write Burst = Read Burst, Serial Mode, * SDRC timings are set up by x-load or config header
* Burst length = 4 * We don't need to redo them here.
* Older x-loads configure only CS0
* configure CS1 to handle this ommission
*/ */
writel(CASL3 | BURSTLENGTH4, &sdrc_base->cs[cs].mr); if (cs) {
sdrc_actim_base0 = (struct sdrc_actim *)SDRC_ACTIM_CTRL0_BASE;
sdrc_actim_base1 = (struct sdrc_actim *)SDRC_ACTIM_CTRL1_BASE;
writel(readl(&sdrc_base->cs[CS0].mcfg),
&sdrc_base->cs[CS1].mcfg);
writel(readl(&sdrc_base->cs[CS0].rfr_ctrl),
&sdrc_base->cs[CS1].rfr_ctrl);
writel(readl(&sdrc_actim_base0->ctrla),
&sdrc_actim_base1->ctrla);
writel(readl(&sdrc_actim_base0->ctrlb),
&sdrc_actim_base1->ctrlb);
}
/*
* Test ram in this bank
* Disable if bad or not present
*/
if (!mem_ok(cs)) if (!mem_ok(cs))
writel(0, &sdrc_base->cs[cs].mcfg); writel(0, &sdrc_base->cs[cs].mcfg);
} }
......
...@@ -38,7 +38,10 @@ static char *rev_s[CPU_3XX_MAX_REV] = { ...@@ -38,7 +38,10 @@ static char *rev_s[CPU_3XX_MAX_REV] = {
"2.0", "2.0",
"2.1", "2.1",
"3.0", "3.0",
"3.1"}; "3.1",
"UNKNOWN",
"UNKNOWN",
"3.1.2"};
/***************************************************************** /*****************************************************************
* dieid_num_r(void) - read and set die ID * dieid_num_r(void) - read and set die ID
...@@ -75,32 +78,81 @@ u32 get_cpu_type(void) ...@@ -75,32 +78,81 @@ u32 get_cpu_type(void)
} }
/****************************************** /******************************************
* get_cpu_rev(void) - extract version info * get_cpu_id(void) - extract cpu id
* returns 0 for ES1.0, cpuid otherwise
******************************************/ ******************************************/
u32 get_cpu_rev(void) u32 get_cpu_id(void)
{ {
u32 cpuid = 0;
struct ctrl_id *id_base; struct ctrl_id *id_base;
u32 cpuid = 0;
/* /*
* On ES1.0 the IDCODE register is not exposed on L4 * On ES1.0 the IDCODE register is not exposed on L4
* so using CPU ID to differentiate between ES1.0 and > ES1.0. * so using CPU ID to differentiate between ES1.0 and > ES1.0.
*/ */
__asm__ __volatile__("mrc p15, 0, %0, c0, c0, 0":"=r"(cpuid)); __asm__ __volatile__("mrc p15, 0, %0, c0, c0, 0":"=r"(cpuid));
if ((cpuid & 0xf) == 0x0) if ((cpuid & 0xf) == 0x0) {
return CPU_3XX_ES10; return 0;
else { } else {
/* Decode the IDs on > ES1.0 */ /* Decode the IDs on > ES1.0 */
id_base = (struct ctrl_id *) OMAP34XX_ID_L4_IO_BASE; id_base = (struct ctrl_id *) OMAP34XX_ID_L4_IO_BASE;
cpuid = (readl(&id_base->idcode) >> CPU_3XX_ID_SHIFT) & 0xf; cpuid = readl(&id_base->idcode);
}
/* Some early ES2.0 seem to report ID 0, fix this */ return cpuid;
if(cpuid == 0) }
cpuid = CPU_3XX_ES20;
return cpuid; /******************************************
* get_cpu_family(void) - extract cpu info
******************************************/
u32 get_cpu_family(void)
{
u16 hawkeye;
u32 cpu_family;
u32 cpuid = get_cpu_id();
if (cpuid == 0)
return CPU_OMAP34XX;
hawkeye = (cpuid >> HAWKEYE_SHIFT) & 0xffff;
switch (hawkeye) {
case HAWKEYE_OMAP34XX:
cpu_family = CPU_OMAP34XX;
break;
case HAWKEYE_AM35XX:
cpu_family = CPU_AM35XX;
break;
case HAWKEYE_OMAP36XX:
cpu_family = CPU_OMAP36XX;
break;
default:
cpu_family = CPU_OMAP34XX;
} }
return cpu_family;
}
/******************************************
* get_cpu_rev(void) - extract version info
******************************************/
u32 get_cpu_rev(void)
{
u32 cpuid = get_cpu_id();
if (cpuid == 0)
return CPU_3XX_ES10;
else
return (cpuid >> CPU_3XX_ID_SHIFT) & 0xf;
}
/*****************************************************************
* get_sku_id(void) - read sku_id to get info on max clock rate
*****************************************************************/
u32 get_sku_id(void)
{
struct ctrl_id *id_base = (struct ctrl_id *)OMAP34XX_ID_L4_IO_BASE;
return readl(&id_base->sku_id) & SKUID_CLK_MASK;
} }
/*************************************************************************** /***************************************************************************
...@@ -213,24 +265,66 @@ u32 get_device_type(void) ...@@ -213,24 +265,66 @@ u32 get_device_type(void)
*/ */
int print_cpuinfo (void) int print_cpuinfo (void)
{ {
char *cpu_s, *sec_s; char *cpu_family_s, *cpu_s, *sec_s, *max_clk;
switch (get_cpu_family()) {
case CPU_OMAP34XX:
cpu_family_s = "OMAP";
switch (get_cpu_type()) {
case OMAP3503:
cpu_s = "3503";
break;
case OMAP3515:
cpu_s = "3515";
break;
case OMAP3525:
cpu_s = "3525";
break;
case OMAP3530:
cpu_s = "3530";
break;
default:
cpu_s = "35XX";
break;
}
if ((get_cpu_rev() >= CPU_3XX_ES31) &&
(get_sku_id() == SKUID_CLK_720MHZ))
max_clk = "720 mHz";
else
max_clk = "600 mHz";
switch (get_cpu_type()) {
case OMAP3503:
cpu_s = "3503";
break; break;
case OMAP3515: case CPU_AM35XX:
cpu_s = "3515"; cpu_family_s = "AM";
switch (get_cpu_type()) {
case AM3505:
cpu_s = "3505";
break;
case AM3517:
cpu_s = "3517";
break;
default:
cpu_s = "35XX";
break;
}
max_clk = "600 Mhz";
break; break;
case OMAP3525: case CPU_OMAP36XX:
cpu_s = "3525"; cpu_family_s = "OMAP";
break; switch (get_cpu_type()) {
case OMAP3530: case OMAP3730:
cpu_s = "3530"; cpu_s = "3630/3730";
break;
default:
cpu_s = "36XX/37XX";
break;
}
max_clk = "1 Ghz";
break; break;
default: default:
cpu_family_s = "OMAP";
cpu_s = "35XX"; cpu_s = "35XX";
break; max_clk = "600 Mhz";
} }
switch (get_device_type()) { switch (get_device_type()) {
...@@ -250,8 +344,9 @@ int print_cpuinfo (void) ...@@ -250,8 +344,9 @@ int print_cpuinfo (void)
sec_s = "?"; sec_s = "?";
} }
printf("OMAP%s-%s ES%s, CPU-OPP2 L3-165MHz\n", printf("%s%s-%s ES%s, CPU-OPP2, L3-165MHz, Max CPU Clock %s\n",
cpu_s, sec_s, rev_s[get_cpu_rev()]); cpu_family_s, cpu_s, sec_s,
rev_s[get_cpu_rev()], max_clk);
return 0; return 0;
} }
......
...@@ -51,12 +51,29 @@ typedef struct { ...@@ -51,12 +51,29 @@ typedef struct {
unsigned int m2; unsigned int m2;
} dpll_param; } dpll_param;
struct dpll_per_36x_param {
unsigned int sys_clk;
unsigned int m;
unsigned int n;
unsigned int m2;
unsigned int m3;
unsigned int m4;
unsigned int m5;
unsigned int m6;
unsigned int m2div;
};
/* Following functions are exported from lowlevel_init.S */ /* Following functions are exported from lowlevel_init.S */
extern dpll_param *get_mpu_dpll_param(void); extern dpll_param *get_mpu_dpll_param(void);
extern dpll_param *get_iva_dpll_param(void); extern dpll_param *get_iva_dpll_param(void);
extern dpll_param *get_core_dpll_param(void); extern dpll_param *get_core_dpll_param(void);
extern dpll_param *get_per_dpll_param(void); extern dpll_param *get_per_dpll_param(void);
extern dpll_param *get_36x_mpu_dpll_param(void);
extern dpll_param *get_36x_iva_dpll_param(void);
extern dpll_param *get_36x_core_dpll_param(void);
extern dpll_param *get_36x_per_dpll_param(void);
extern void *_end_vect, *_start; extern void *_end_vect, *_start;
#endif #endif
...@@ -282,4 +282,31 @@ ...@@ -282,4 +282,31 @@
#define PER_FSEL_38P4 0x07 #define PER_FSEL_38P4 0x07
#define PER_M2_38P4 0x09 #define PER_M2_38P4 0x09
/* 36XX PER DPLL */
#define PER_36XX_M_12 0x1B0
#define PER_36XX_N_12 0x05
#define PER_36XX_FSEL_12 0x07
#define PER_36XX_M2_12 0x09
#define PER_36XX_M_13 0x360
#define PER_36XX_N_13 0x0C
#define PER_36XX_FSEL_13 0x03
#define PER_36XX_M2_13 0x09
#define PER_36XX_M_19P2 0x1C2
#define PER_36XX_N_19P2 0x09
#define PER_36XX_FSEL_19P2 0x07
#define PER_36XX_M2_19P2 0x09
#define PER_36XX_M_26 0x1B0
#define PER_36XX_N_26 0x0C
#define PER_36XX_FSEL_26 0x07
#define PER_36XX_M2_26 0x09
#define PER_36XX_M_38P4 0x1C2
#define PER_36XX_N_38P4 0x13
#define PER_36XX_FSEL_38P4 0x07
#define PER_36XX_M2_38P4 0x09
#endif /* endif _CLOCKS_OMAP3_H_ */ #endif /* endif _CLOCKS_OMAP3_H_ */
...@@ -60,19 +60,14 @@ struct ctrl { ...@@ -60,19 +60,14 @@ struct ctrl {
#endif /* __ASSEMBLY__ */ #endif /* __ASSEMBLY__ */
#endif /* __KERNEL_STRICT_NAMES */ #endif /* __KERNEL_STRICT_NAMES */
/* cpu type */
#define OMAP3503 0x5c00
#define OMAP3515 0x1c00
#define OMAP3525 0x4c00
#define OMAP3530 0x0c00
#ifndef __KERNEL_STRICT_NAMES #ifndef __KERNEL_STRICT_NAMES
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
struct ctrl_id { struct ctrl_id {
u8 res1[0x4]; u8 res1[0x4];
u32 idcode; /* 0x04 */ u32 idcode; /* 0x04 */
u32 prod_id; /* 0x08 */ u32 prod_id; /* 0x08 */
u8 res2[0x0C]; u32 sku_id; /* 0x0c */
u8 res2[0x08];
u32 die_id_0; /* 0x18 */ u32 die_id_0; /* 0x18 */
u32 die_id_1; /* 0x1C */ u32 die_id_1; /* 0x1C */
u32 die_id_2; /* 0x20 */ u32 die_id_2; /* 0x20 */
...@@ -89,6 +84,11 @@ struct ctrl_id { ...@@ -89,6 +84,11 @@ struct ctrl_id {
#define HS_DEVICE 0x2 #define HS_DEVICE 0x2
#define GP_DEVICE 0x3 #define GP_DEVICE 0x3
/* device speed */
#define SKUID_CLK_MASK 0xf
#define SKUID_CLK_600MHZ 0x0
#define SKUID_CLK_720MHZ 0x8
#define GPMC_BASE (OMAP34XX_GPMC_BASE) #define GPMC_BASE (OMAP34XX_GPMC_BASE)
#define GPMC_CONFIG_CS0 0x60 #define GPMC_CONFIG_CS0 0x60
#define GPMC_CONFIG_CS0_BASE (GPMC_BASE + GPMC_CONFIG_CS0) #define GPMC_CONFIG_CS0_BASE (GPMC_BASE + GPMC_CONFIG_CS0)
...@@ -419,6 +419,7 @@ struct prm { ...@@ -419,6 +419,7 @@ struct prm {
}; };
#else /* __ASSEMBLY__ */ #else /* __ASSEMBLY__ */
#define PRM_RSTCTRL 0x48307250 #define PRM_RSTCTRL 0x48307250
#define PRM_RSTCTRL_RESET 0x04
#endif /* __ASSEMBLY__ */ #endif /* __ASSEMBLY__ */
#endif /* __KERNEL_STRICT_NAMES */ #endif /* __KERNEL_STRICT_NAMES */
......
...@@ -176,11 +176,41 @@ struct gpio { ...@@ -176,11 +176,41 @@ struct gpio {
#define CPU_3XX_ES21 2 #define CPU_3XX_ES21 2
#define CPU_3XX_ES30 3 #define CPU_3XX_ES30 3
#define CPU_3XX_ES31 4 #define CPU_3XX_ES31 4
#define CPU_3XX_MAX_REV (CPU_3XX_ES31 + 1) #define CPU_3XX_ES312 7
#define CPU_3XX_MAX_REV 8
#define CPU_3XX_ID_SHIFT 28 #define CPU_3XX_ID_SHIFT 28
#define WIDTH_8BIT 0x0000 #define WIDTH_8BIT 0x0000
#define WIDTH_16BIT 0x1000 /* bit pos for 16 bit in gpmc */ #define WIDTH_16BIT 0x1000 /* bit pos for 16 bit in gpmc */
/*
* Hawkeye values
*/
#define HAWKEYE_OMAP34XX 0xb7ae
#define HAWKEYE_AM35XX 0xb868
#define HAWKEYE_OMAP36XX 0xb891
#define HAWKEYE_SHIFT 12
/*
* Define CPU families
*/
#define CPU_OMAP34XX 0x3400 /* OMAP34xx/OMAP35 devices */
#define CPU_AM35XX 0x3500 /* AM35xx devices */
#define CPU_OMAP36XX 0x3600 /* OMAP36xx devices */
/*
* Control status register values corresponding to cpu variants
*/
#define OMAP3503 0x5c00
#define OMAP3515 0x1c00
#define OMAP3525 0x4c00
#define OMAP3530 0x0c00
#define AM3505 0x5c00
#define AM3517 0x1c00
#define OMAP3730 0x0c00
#endif #endif
...@@ -41,7 +41,9 @@ void enable_gpmc_cs_config(const u32 *gpmc_config, struct gpmc_cs *cs, u32 base, ...@@ -41,7 +41,9 @@ void enable_gpmc_cs_config(const u32 *gpmc_config, struct gpmc_cs *cs, u32 base,
void watchdog_init(void); void watchdog_init(void);
void set_muxconf_regs(void); void set_muxconf_regs(void);
u32 get_cpu_family(void);
u32 get_cpu_rev(void); u32 get_cpu_rev(void);
u32 get_sku_id(void);
u32 get_mem_type(void); u32 get_mem_type(void);
u32 get_sysboot_value(void); u32 get_sysboot_value(void);
u32 is_gpmc_muxed(void); u32 is_gpmc_muxed(void);
......
...@@ -88,6 +88,7 @@ ...@@ -88,6 +88,7 @@
#define PRM_DEVICE_BASE (PRM_BASE + 0x1B00) #define PRM_DEVICE_BASE (PRM_BASE + 0x1B00)
#define PRM_RSTCTRL PRM_DEVICE_BASE #define PRM_RSTCTRL PRM_DEVICE_BASE
#define PRM_RSTCTRL_RESET 0x01
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
......
...@@ -33,6 +33,9 @@ void watchdog_init(void); ...@@ -33,6 +33,9 @@ void watchdog_init(void);
u32 get_device_type(void); u32 get_device_type(void);
void invalidate_dcache(u32); void invalidate_dcache(u32);
void set_muxconf_regs(void); void set_muxconf_regs(void);
void sr32(void *, u32, u32, u32);
u32 wait_on_value(u32, u32, void *, u32);
void sdelay(unsigned long);
extern const struct omap_sysinfo sysinfo; extern const struct omap_sysinfo sysinfo;
......
...@@ -43,6 +43,17 @@ ...@@ -43,6 +43,17 @@
static void setup_net_chip(void); static void setup_net_chip(void);
#endif #endif
/* GPMC definitions for LAN9221 chips on Tobi expansion boards */
static const u32 gpmc_lan_config[] = {
NET_LAN9221_GPMC_CONFIG1,
NET_LAN9221_GPMC_CONFIG2,
NET_LAN9221_GPMC_CONFIG3,
NET_LAN9221_GPMC_CONFIG4,
NET_LAN9221_GPMC_CONFIG5,
NET_LAN9221_GPMC_CONFIG6,
/*CONFIG7- computed as params */
};
/* /*
* Routine: board_init * Routine: board_init
* Description: Early hardware init. * Description: Early hardware init.
...@@ -60,6 +71,70 @@ int board_init(void) ...@@ -60,6 +71,70 @@ int board_init(void)
return 0; return 0;
} }
/*
* Routine: get_board_revision
* Description: Returns the board revision
*/
int get_board_revision(void)
{
int revision;
if (!omap_request_gpio(112) &&
!omap_request_gpio(113) &&
!omap_request_gpio(115)) {
omap_set_gpio_direction(112, 1);
omap_set_gpio_direction(113, 1);
omap_set_gpio_direction(115, 1);
revision = omap_get_gpio_datain(115) << 2 |
omap_get_gpio_datain(113) << 1 |
omap_get_gpio_datain(112);
omap_free_gpio(112);
omap_free_gpio(113);
omap_free_gpio(115);
} else {
printf("Error: unable to acquire board revision GPIOs\n");
revision = -1;
}
return revision;
}
/*
* Routine: get_sdio2_config
* Description: Return information about the wifi module connection
* Returns 0 if the module connects though a level translator
* Returns 1 if the module connects directly
*/
int get_sdio2_config(void)
{
int sdio_direct;
if (!omap_request_gpio(130) && !omap_request_gpio(139)) {
omap_set_gpio_direction(130, 0);
omap_set_gpio_direction(139, 1);
sdio_direct = 1;
omap_set_gpio_dataout(130, 0);
if (omap_get_gpio_datain(139) == 0) {
omap_set_gpio_dataout(130, 1);
if (omap_get_gpio_datain(139) == 1)
sdio_direct = 0;
}
omap_free_gpio(130);
omap_free_gpio(139);
} else {
printf("Error: unable to acquire sdio2 clk GPIOs\n");
sdio_direct = -1;
}
return sdio_direct;
}
/* /*
* Routine: misc_init_r * Routine: misc_init_r
* Description: Configure board specific parts * Description: Configure board specific parts
...@@ -73,6 +148,21 @@ int misc_init_r(void) ...@@ -73,6 +148,21 @@ int misc_init_r(void)
setup_net_chip(); setup_net_chip();
#endif #endif
printf("Board revision: %d\n", get_board_revision());
switch (get_sdio2_config()) {
case 0:
printf("Tranceiver detected on mmc2\n");
MUX_OVERO_SDIO2_TRANSCEIVER();
break;
case 1:
printf("Direct connection on mmc2\n");
MUX_OVERO_SDIO2_DIRECT();
break;
default:
printf("Unable to detect mmc2 connection type\n");
}
dieid_num_r(); dieid_num_r();
return 0; return 0;
...@@ -99,14 +189,13 @@ static void setup_net_chip(void) ...@@ -99,14 +189,13 @@ static void setup_net_chip(void)
{ {
struct ctrl *ctrl_base = (struct ctrl *)OMAP34XX_CTRL_BASE; struct ctrl *ctrl_base = (struct ctrl *)OMAP34XX_CTRL_BASE;
/* Configure GPMC registers */ /* first lan chip */
writel(NET_LAN9221_GPMC_CONFIG1, &gpmc_cfg->cs[5].config1); enable_gpmc_cs_config(gpmc_lan_config, &gpmc_cfg->cs[5], 0x2C000000,
writel(NET_LAN9221_GPMC_CONFIG2, &gpmc_cfg->cs[5].config2); GPMC_SIZE_16M);
writel(NET_LAN9221_GPMC_CONFIG3, &gpmc_cfg->cs[5].config3);
writel(NET_LAN9221_GPMC_CONFIG4, &gpmc_cfg->cs[5].config4); /* second lan chip */
writel(NET_LAN9221_GPMC_CONFIG5, &gpmc_cfg->cs[5].config5); enable_gpmc_cs_config(gpmc_lan_config, &gpmc_cfg->cs[4], 0x2B000000,
writel(NET_LAN9221_GPMC_CONFIG6, &gpmc_cfg->cs[5].config6); GPMC_SIZE_16M);
writel(NET_LAN9221_GPMC_CONFIG7, &gpmc_cfg->cs[5].config7);
/* Enable off mode for NWE in PADCONF_GPMC_NWE register */ /* Enable off mode for NWE in PADCONF_GPMC_NWE register */
writew(readw(&ctrl_base ->gpmc_nwe) | 0x0E00, &ctrl_base->gpmc_nwe); writew(readw(&ctrl_base ->gpmc_nwe) | 0x0E00, &ctrl_base->gpmc_nwe);
......
...@@ -138,7 +138,7 @@ const omap3_sysinfo sysinfo = { ...@@ -138,7 +138,7 @@ const omap3_sysinfo sysinfo = {
MUX_VAL(CP(GPMC_WAIT1), (IEN | PTU | EN | M0)) /*GPMC_WAIT1*/\ MUX_VAL(CP(GPMC_WAIT1), (IEN | PTU | EN | M0)) /*GPMC_WAIT1*/\
MUX_VAL(CP(GPMC_WAIT2), (IEN | PTU | EN | M4)) /*GPIO_64*/\ MUX_VAL(CP(GPMC_WAIT2), (IEN | PTU | EN | M4)) /*GPIO_64*/\
/* - SMSC911X_NRES*/\ /* - SMSC911X_NRES*/\
MUX_VAL(CP(GPMC_WAIT3), (IEN | PTU | EN | M0)) /*GPMC_nCS3*/\ MUX_VAL(CP(GPMC_WAIT3), (IEN | PTU | DIS | M4)) /*GPIO_65*/\
/*DSS*/\ /*DSS*/\
MUX_VAL(CP(DSS_PCLK), (IDIS | PTD | DIS | M0)) /*DSS_PCLK*/\ MUX_VAL(CP(DSS_PCLK), (IDIS | PTD | DIS | M0)) /*DSS_PCLK*/\
MUX_VAL(CP(DSS_HSYNC), (IDIS | PTD | DIS | M0)) /*DSS_HSYNC*/\ MUX_VAL(CP(DSS_HSYNC), (IDIS | PTD | DIS | M0)) /*DSS_HSYNC*/\
...@@ -189,18 +189,18 @@ const omap3_sysinfo sysinfo = { ...@@ -189,18 +189,18 @@ const omap3_sysinfo sysinfo = {
MUX_VAL(CP(CAM_XCLKB), (IDIS | PTD | DIS | M0)) /*CAM_XCLKB*/\ MUX_VAL(CP(CAM_XCLKB), (IDIS | PTD | DIS | M0)) /*CAM_XCLKB*/\
MUX_VAL(CP(CAM_WEN), (IEN | PTD | DIS | M0)) /*CAM_WEN*/\ MUX_VAL(CP(CAM_WEN), (IEN | PTD | DIS | M0)) /*CAM_WEN*/\
MUX_VAL(CP(CAM_STROBE), (IDIS | PTD | DIS | M0)) /*CAM_STROBE*/\ MUX_VAL(CP(CAM_STROBE), (IDIS | PTD | DIS | M0)) /*CAM_STROBE*/\
MUX_VAL(CP(CSI2_DX0), (IEN | PTD | DIS | M0)) /*CSI2_DX0*/\ MUX_VAL(CP(CSI2_DX0), (IEN | PTD | EN | M4)) /*GPIO_112*/\
MUX_VAL(CP(CSI2_DY0), (IEN | PTD | DIS | M0)) /*CSI2_DY0*/\ MUX_VAL(CP(CSI2_DY0), (IEN | PTD | EN | M4)) /*GPIO_113*/\
MUX_VAL(CP(CSI2_DX1), (IEN | PTD | EN | M4)) /*GPIO_114*/\ MUX_VAL(CP(CSI2_DX1), (IEN | PTD | EN | M4)) /*GPIO_114*/\
/* - PEN_DOWN*/\ /* - PEN_DOWN*/\
MUX_VAL(CP(CSI2_DY1), (IEN | PTU | EN | M4)) /*GPIO_115*/\ MUX_VAL(CP(CSI2_DY1), (IEN | PTD | EN | M4)) /*GPIO_115*/\
/*Audio Interface */\ /*Audio Interface */\
MUX_VAL(CP(MCBSP2_FSX), (IEN | PTD | DIS | M0)) /*McBSP2_FSX*/\ MUX_VAL(CP(MCBSP2_FSX), (IEN | PTD | DIS | M0)) /*McBSP2_FSX*/\
MUX_VAL(CP(MCBSP2_CLKX), (IEN | PTD | DIS | M0)) /*McBSP2_CLKX*/\ MUX_VAL(CP(MCBSP2_CLKX), (IEN | PTD | DIS | M0)) /*McBSP2_CLKX*/\
MUX_VAL(CP(MCBSP2_DR), (IEN | PTD | DIS | M0)) /*McBSP2_DR*/\ MUX_VAL(CP(MCBSP2_DR), (IEN | PTD | DIS | M0)) /*McBSP2_DR*/\
MUX_VAL(CP(MCBSP2_DX), (IDIS | PTD | DIS | M0)) /*McBSP2_DX*/\ MUX_VAL(CP(MCBSP2_DX), (IDIS | PTD | DIS | M0)) /*McBSP2_DX*/\
/*Expansion card */\ /*Expansion card */\
MUX_VAL(CP(MMC1_CLK), (IDIS | PTU | EN | M0)) /*MMC1_CLK*/\ MUX_VAL(CP(MMC1_CLK), (IEN | PTU | EN | M0)) /*MMC1_CLK*/\
MUX_VAL(CP(MMC1_CMD), (IEN | PTU | EN | M0)) /*MMC1_CMD*/\ MUX_VAL(CP(MMC1_CMD), (IEN | PTU | EN | M0)) /*MMC1_CMD*/\
MUX_VAL(CP(MMC1_DAT0), (IEN | PTU | EN | M0)) /*MMC1_DAT0*/\ MUX_VAL(CP(MMC1_DAT0), (IEN | PTU | EN | M0)) /*MMC1_DAT0*/\
MUX_VAL(CP(MMC1_DAT1), (IEN | PTU | EN | M0)) /*MMC1_DAT1*/\ MUX_VAL(CP(MMC1_DAT1), (IEN | PTU | EN | M0)) /*MMC1_DAT1*/\
...@@ -211,7 +211,7 @@ const omap3_sysinfo sysinfo = { ...@@ -211,7 +211,7 @@ const omap3_sysinfo sysinfo = {
MUX_VAL(CP(MMC1_DAT6), (IEN | PTU | EN | M0)) /*MMC1_DAT6*/\ MUX_VAL(CP(MMC1_DAT6), (IEN | PTU | EN | M0)) /*MMC1_DAT6*/\
MUX_VAL(CP(MMC1_DAT7), (IEN | PTU | EN | M0)) /*MMC1_DAT7*/\ MUX_VAL(CP(MMC1_DAT7), (IEN | PTU | EN | M0)) /*MMC1_DAT7*/\
/*Wireless LAN */\ /*Wireless LAN */\
MUX_VAL(CP(MMC2_CLK), (IEN | PTU | EN | M0)) /*MMC2_CLK*/\ MUX_VAL(CP(MMC2_CLK), (IEN | PTU | EN | M4)) /*GPIO_130*/\
MUX_VAL(CP(MMC2_CMD), (IEN | PTU | EN | M0)) /*MMC2_CMD*/\ MUX_VAL(CP(MMC2_CMD), (IEN | PTU | EN | M0)) /*MMC2_CMD*/\
MUX_VAL(CP(MMC2_DAT0), (IEN | PTU | EN | M0)) /*MMC2_DAT0*/\ MUX_VAL(CP(MMC2_DAT0), (IEN | PTU | EN | M0)) /*MMC2_DAT0*/\
MUX_VAL(CP(MMC2_DAT1), (IEN | PTU | EN | M0)) /*MMC2_DAT1*/\ MUX_VAL(CP(MMC2_DAT1), (IEN | PTU | EN | M0)) /*MMC2_DAT1*/\
...@@ -220,7 +220,7 @@ const omap3_sysinfo sysinfo = { ...@@ -220,7 +220,7 @@ const omap3_sysinfo sysinfo = {
MUX_VAL(CP(MMC2_DAT4), (IEN | PTU | EN | M1)) /*MMC2_DIR_DAT0*/\ MUX_VAL(CP(MMC2_DAT4), (IEN | PTU | EN | M1)) /*MMC2_DIR_DAT0*/\
MUX_VAL(CP(MMC2_DAT5), (IEN | PTU | EN | M1)) /*MMC2_DIR_DAT1*/\ MUX_VAL(CP(MMC2_DAT5), (IEN | PTU | EN | M1)) /*MMC2_DIR_DAT1*/\
MUX_VAL(CP(MMC2_DAT6), (IEN | PTU | EN | M1)) /*MMC2_DIR_CMD*/\ MUX_VAL(CP(MMC2_DAT6), (IEN | PTU | EN | M1)) /*MMC2_DIR_CMD*/\
MUX_VAL(CP(MMC2_DAT7), (IEN | PTU | EN | M1)) /*MMC2_CLKIN*/\ MUX_VAL(CP(MMC2_DAT7), (IEN | PTU | EN | M4)) /*GPIO_139*/\
/*Bluetooth*/\ /*Bluetooth*/\
MUX_VAL(CP(MCBSP3_DX), (IEN | PTD | DIS | M1)) /*UART2_CTS*/\ MUX_VAL(CP(MCBSP3_DX), (IEN | PTD | DIS | M1)) /*UART2_CTS*/\
MUX_VAL(CP(MCBSP3_DR), (IDIS | PTD | DIS | M1)) /*UART2_RTS*/\ MUX_VAL(CP(MCBSP3_DR), (IDIS | PTD | DIS | M1)) /*UART2_RTS*/\
...@@ -301,7 +301,7 @@ const omap3_sysinfo sysinfo = { ...@@ -301,7 +301,7 @@ const omap3_sysinfo sysinfo = {
MUX_VAL(CP(SYS_OFF_MODE), (IEN | PTD | DIS | M0)) /*SYS_OFF_MODE*/\ MUX_VAL(CP(SYS_OFF_MODE), (IEN | PTD | DIS | M0)) /*SYS_OFF_MODE*/\
MUX_VAL(CP(SYS_CLKOUT1), (IEN | PTD | DIS | M0)) /*SYS_CLKOUT1*/\ MUX_VAL(CP(SYS_CLKOUT1), (IEN | PTD | DIS | M0)) /*SYS_CLKOUT1*/\
MUX_VAL(CP(SYS_CLKOUT2), (IEN | PTU | EN | M4)) /*GPIO_186*/\ MUX_VAL(CP(SYS_CLKOUT2), (IEN | PTU | EN | M4)) /*GPIO_186*/\
MUX_VAL(CP(ETK_CLK_ES2), (IDIS | PTU | EN | M2)) /*MMC3_CLK*/\ MUX_VAL(CP(ETK_CLK_ES2), (IEN | PTU | EN | M2)) /*MMC3_CLK*/\
MUX_VAL(CP(ETK_CTL_ES2), (IEN | PTU | EN | M2)) /*MMC3_CMD*/\ MUX_VAL(CP(ETK_CTL_ES2), (IEN | PTU | EN | M2)) /*MMC3_CMD*/\
MUX_VAL(CP(ETK_D0_ES2), (IEN | PTU | EN | M4)) /*GPIO_14*/\ MUX_VAL(CP(ETK_D0_ES2), (IEN | PTU | EN | M4)) /*GPIO_14*/\
MUX_VAL(CP(ETK_D1_ES2), (IEN | PTD | EN | M4)) /*GPIO_15 - X_GATE*/\ MUX_VAL(CP(ETK_D1_ES2), (IEN | PTD | EN | M4)) /*GPIO_15 - X_GATE*/\
...@@ -387,5 +387,36 @@ const omap3_sysinfo sysinfo = { ...@@ -387,5 +387,36 @@ const omap3_sysinfo sysinfo = {
MUX_VAL(CP(SDRC_CKE0), (IDIS | PTU | EN | M0)) /*sdrc_cke0*/\ MUX_VAL(CP(SDRC_CKE0), (IDIS | PTU | EN | M0)) /*sdrc_cke0*/\
MUX_VAL(CP(SDRC_CKE1), (IDIS | PTU | EN | M0)) /*sdrc_cke1*/ MUX_VAL(CP(SDRC_CKE1), (IDIS | PTU | EN | M0)) /*sdrc_cke1*/
#define MUX_OVERO_SDIO2_DIRECT() \
MUX_VAL(CP(MMC2_CLK), (IEN | PTU | EN | M0)) /*MMC2_CLK*/\
MUX_VAL(CP(MMC2_CMD), (IEN | PTU | EN | M0)) /*MMC2_CMD*/\
MUX_VAL(CP(MMC2_DAT0), (IEN | PTU | EN | M0)) /*MMC2_DAT0*/\
MUX_VAL(CP(MMC2_DAT1), (IEN | PTU | EN | M0)) /*MMC2_DAT1*/\
MUX_VAL(CP(MMC2_DAT2), (IEN | PTU | EN | M0)) /*MMC2_DAT2*/\
MUX_VAL(CP(MMC2_DAT3), (IEN | PTU | EN | M0)) /*MMC2_DAT3*/\
MUX_VAL(CP(MMC2_DAT4), (IEN | PTU | EN | M0)) /*MMC2_DAT4*/\
MUX_VAL(CP(MMC2_DAT5), (IEN | PTU | EN | M0)) /*MMC2_DAT5*/\
MUX_VAL(CP(MMC2_DAT6), (IEN | PTU | EN | M0)) /*MMC2_DAT6*/\
MUX_VAL(CP(MMC2_DAT7), (IEN | PTU | EN | M0)) /*MMC2_DAT7*/\
MUX_VAL(CP(MMC1_DAT4), (IEN | PTD | EN | M4)) /*GPIO_126*/\
MUX_VAL(CP(MMC1_DAT5), (IEN | PTU | EN | M4)) /*GPIO_127*/\
MUX_VAL(CP(MMC1_DAT6), (IEN | PTU | EN | M4)) /*GPIO_128*/\
MUX_VAL(CP(MMC1_DAT7), (IEN | PTU | EN | M4)) /*GPIO_129*/
#define MUX_OVERO_SDIO2_TRANSCEIVER() \
MUX_VAL(CP(MMC2_CLK), (IEN | PTU | EN | M0)) /*MMC2_CLK*/\
MUX_VAL(CP(MMC2_CMD), (IEN | PTU | EN | M0)) /*MMC2_CMD*/\
MUX_VAL(CP(MMC2_DAT0), (IEN | PTU | EN | M0)) /*MMC2_DAT0*/\
MUX_VAL(CP(MMC2_DAT1), (IEN | PTU | EN | M0)) /*MMC2_DAT1*/\
MUX_VAL(CP(MMC2_DAT2), (IEN | PTU | EN | M0)) /*MMC2_DAT2*/\
MUX_VAL(CP(MMC2_DAT3), (IEN | PTU | EN | M0)) /*MMC2_DAT3*/\
MUX_VAL(CP(MMC2_DAT4), (IEN | PTU | EN | M1)) /*MMC2_DIR_DAT0*/\
MUX_VAL(CP(MMC2_DAT5), (IEN | PTU | EN | M1)) /*MMC2_DIR_DAT1*/\
MUX_VAL(CP(MMC2_DAT6), (IEN | PTU | EN | M1)) /*MMC2_DIR_CMD*/\
MUX_VAL(CP(MMC2_DAT7), (IEN | PTU | EN | M1)) /*MMC2_CLKIN*/\
MUX_VAL(CP(MMC1_DAT4), (IEN | PTU | EN | M4)) /*GPIO_126*/\
MUX_VAL(CP(MMC1_DAT5), (IEN | PTU | EN | M4)) /*GPIO_127*/\
MUX_VAL(CP(MMC1_DAT6), (IEN | PTU | EN | M4)) /*GPIO_128*/\
MUX_VAL(CP(MMC1_DAT7), (IEN | PTU | EN | M4)) /*GPIO_129*/
#endif #endif
...@@ -38,8 +38,6 @@ ...@@ -38,8 +38,6 @@
#include <asm/mach-types.h> #include <asm/mach-types.h>
#include "beagle.h" #include "beagle.h"
static int beagle_revision_c;
/* /*
* Routine: board_init * Routine: board_init
* Description: Early hardware init. * Description: Early hardware init.
...@@ -58,43 +56,41 @@ int board_init(void) ...@@ -58,43 +56,41 @@ int board_init(void)
} }
/* /*
* Routine: beagle_get_revision * Routine: get_board_revision
* Description: Return the revision of the BeagleBoard this code is running on. * Description: Detect if we are running on a Beagle revision Ax/Bx,
* If it is a revision Ax/Bx board, this function returns 0, * C1/2/3, C4 or xM. This can be done by reading
* on a revision C board you will get a 1. * the level of GPIO173, GPIO172 and GPIO171. This should
* result in
* GPIO173, GPIO172, GPIO171: 1 1 1 => Ax/Bx
* GPIO173, GPIO172, GPIO171: 1 1 0 => C1/2/3
* GPIO173, GPIO172, GPIO171: 1 0 1 => C4
* GPIO173, GPIO172, GPIO171: 0 0 0 => xM
*/ */
int beagle_get_revision(void) int get_board_revision(void)
{ {
return beagle_revision_c; int revision;
}
/* if (!omap_request_gpio(171) &&
* Routine: beagle_identify !omap_request_gpio(172) &&
* Description: Detect if we are running on a Beagle revision Ax/Bx or !omap_request_gpio(173)) {
* Cx. This can be done by GPIO_171. If this is low, we are
* running on a revision C board.
*/
void beagle_identify(void)
{
beagle_revision_c = 0;
if (!omap_request_gpio(171)) {
unsigned int val;
omap_set_gpio_direction(171, 1); omap_set_gpio_direction(171, 1);
val = omap_get_gpio_datain(171); omap_set_gpio_direction(172, 1);
omap_free_gpio(171); omap_set_gpio_direction(173, 1);
if (val) revision = omap_get_gpio_datain(173) << 2 |
beagle_revision_c = 0; omap_get_gpio_datain(172) << 1 |
else omap_get_gpio_datain(171);
beagle_revision_c = 1;
omap_free_gpio(171);
omap_free_gpio(172);
omap_free_gpio(173);
} else {
printf("Error: unable to acquire board revision GPIOs\n");
revision = -1;
} }
printf("Board revision "); return revision;
if (beagle_revision_c)
printf("C\n");
else
printf("Ax/Bx\n");
} }
/* /*
...@@ -106,6 +102,44 @@ int misc_init_r(void) ...@@ -106,6 +102,44 @@ int misc_init_r(void)
struct gpio *gpio5_base = (struct gpio *)OMAP34XX_GPIO5_BASE; struct gpio *gpio5_base = (struct gpio *)OMAP34XX_GPIO5_BASE;
struct gpio *gpio6_base = (struct gpio *)OMAP34XX_GPIO6_BASE; struct gpio *gpio6_base = (struct gpio *)OMAP34XX_GPIO6_BASE;
switch (get_board_revision()) {
case REVISION_AXBX:
printf("Beagle Rev Ax/Bx\n");
setenv("beaglerev", "AxBx");
setenv("mpurate", "600");
break;
case REVISION_CX:
printf("Beagle Rev C1/C2/C3\n");
setenv("beaglerev", "Cx");
setenv("mpurate", "600");
MUX_BEAGLE_C();
break;
case REVISION_C4:
printf("Beagle Rev C4\n");
setenv("beaglerev", "C4");
setenv("mpurate", "720");
MUX_BEAGLE_C();
/* Set VAUX2 to 1.8V for EHCI PHY */
twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VAUX2_DEDICATED,
TWL4030_PM_RECEIVER_VAUX2_VSEL_18,
TWL4030_PM_RECEIVER_VAUX2_DEV_GRP,
TWL4030_PM_RECEIVER_DEV_GRP_P1);
break;
case REVISION_XM:
printf("Beagle xM Rev A\n");
setenv("beaglerev", "xMA");
setenv("mpurate", "1000");
MUX_BEAGLE_XM();
/* Set VAUX2 to 1.8V for EHCI PHY */
twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VAUX2_DEDICATED,
TWL4030_PM_RECEIVER_VAUX2_VSEL_18,
TWL4030_PM_RECEIVER_VAUX2_DEV_GRP,
TWL4030_PM_RECEIVER_DEV_GRP_P1);
break;
default:
printf("Beagle unknown 0x%02x\n", get_board_revision());
}
twl4030_power_init(); twl4030_power_init();
twl4030_led_init(TWL4030_LED_LEDEN_LEDAON | TWL4030_LED_LEDEN_LEDBON); twl4030_led_init(TWL4030_LED_LEDEN_LEDAON | TWL4030_LED_LEDEN_LEDBON);
...@@ -120,8 +154,6 @@ int misc_init_r(void) ...@@ -120,8 +154,6 @@ int misc_init_r(void)
writel(GPIO31 | GPIO30 | GPIO29 | GPIO28 | GPIO22 | GPIO21 | writel(GPIO31 | GPIO30 | GPIO29 | GPIO28 | GPIO22 | GPIO21 |
GPIO15 | GPIO14 | GPIO13 | GPIO12, &gpio5_base->setdataout); GPIO15 | GPIO14 | GPIO13 | GPIO12, &gpio5_base->setdataout);
beagle_identify();
dieid_num_r(); dieid_num_r();
return 0; return 0;
...@@ -136,8 +168,4 @@ int misc_init_r(void) ...@@ -136,8 +168,4 @@ int misc_init_r(void)
void set_muxconf_regs(void) void set_muxconf_regs(void)
{ {
MUX_BEAGLE(); MUX_BEAGLE();
if (beagle_revision_c) {
MUX_BEAGLE_C();
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment