2009-03-24 04:40:03 -05:00
|
|
|
#xscale ixp42x CPU
|
|
|
|
|
2009-09-21 13:48:22 -05:00
|
|
|
if { [info exists CHIPNAME] } {
|
2011-10-29 16:32:17 -05:00
|
|
|
set _CHIPNAME $CHIPNAME
|
2009-09-21 13:48:22 -05:00
|
|
|
} else {
|
2011-10-29 16:32:17 -05:00
|
|
|
set _CHIPNAME ixp42x
|
2009-03-24 04:40:03 -05:00
|
|
|
}
|
|
|
|
|
2009-09-21 13:48:22 -05:00
|
|
|
if { [info exists ENDIAN] } {
|
2011-10-29 16:32:17 -05:00
|
|
|
set _ENDIAN $ENDIAN
|
2009-09-21 13:48:22 -05:00
|
|
|
} else {
|
2009-03-24 04:40:03 -05:00
|
|
|
# this defaults to a bigendian
|
2011-10-29 16:32:17 -05:00
|
|
|
set _ENDIAN big
|
2009-03-24 04:40:03 -05:00
|
|
|
}
|
|
|
|
|
2011-10-29 16:32:17 -05:00
|
|
|
if { [info exists CPUTAPID] } {
|
2009-03-24 04:40:03 -05:00
|
|
|
set _CPUTAPID $CPUTAPID
|
|
|
|
} else {
|
2010-12-19 09:17:46 -06:00
|
|
|
set _CPUTAPID 0x19274013
|
2009-03-24 04:40:03 -05:00
|
|
|
}
|
2010-12-19 09:17:46 -06:00
|
|
|
set _CPUTAPID2 0x19275013
|
|
|
|
set _CPUTAPID3 0x19277013
|
|
|
|
set _CPUTAPID4 0x29274013
|
|
|
|
set _CPUTAPID5 0x29275013
|
|
|
|
set _CPUTAPID6 0x29277013
|
2009-03-24 04:40:03 -05:00
|
|
|
|
2010-12-19 09:17:46 -06:00
|
|
|
jtag newtap $_CHIPNAME cpu -irlen 7 -ircapture 0x1 -irmask 0x7f -expected-id $_CPUTAPID -expected-id $_CPUTAPID2 -expected-id $_CPUTAPID3 -expected-id $_CPUTAPID4 -expected-id $_CPUTAPID5 -expected-id $_CPUTAPID6
|
2009-03-24 04:40:03 -05:00
|
|
|
|
2009-09-04 00:17:03 -05:00
|
|
|
set _TARGETNAME $_CHIPNAME.cpu
|
2014-09-08 15:11:02 -05:00
|
|
|
target create $_TARGETNAME xscale -endian $_ENDIAN -chain-position $_TARGETNAME
|
2009-03-24 04:40:03 -05:00
|
|
|
|
2010-12-19 09:17:46 -06:00
|
|
|
|
|
|
|
# register constants for IXP42x SDRAM controller
|
|
|
|
global IXP425_SDRAM_IR_MODE_SET_CAS2_CMD
|
|
|
|
global IXP425_SDRAM_IR_MODE_SET_CAS3_CMD
|
|
|
|
set IXP425_SDRAM_IR_MODE_SET_CAS2_CMD 0x0000
|
|
|
|
set IXP425_SDRAM_IR_MODE_SET_CAS3_CMD 0x0001
|
|
|
|
|
2011-10-29 16:32:17 -05:00
|
|
|
global IXP42x_SDRAM_CL3
|
|
|
|
global IXP42x_SDRAM_CL2
|
2010-12-19 09:17:46 -06:00
|
|
|
set IXP42x_SDRAM_CL3 0x0008
|
|
|
|
set IXP42x_SDRAM_CL2 0x0000
|
|
|
|
|
2011-10-29 16:32:17 -05:00
|
|
|
global IXP42x_SDRAM_8MB_2Mx32_1BANK
|
|
|
|
global IXP42x_SDRAM_16MB_2Mx32_2BANK
|
|
|
|
global IXP42x_SDRAM_16MB_4Mx16_1BANK
|
|
|
|
global IXP42x_SDRAM_32MB_4Mx16_2BANK
|
|
|
|
global IXP42x_SDRAM_32MB_8Mx16_1BANK
|
|
|
|
global IXP42x_SDRAM_64MB_8Mx16_2BANK
|
|
|
|
global IXP42x_SDRAM_64MB_16Mx16_1BANK
|
|
|
|
global IXP42x_SDRAM_128MB_16Mx16_2BANK
|
|
|
|
global IXP42x_SDRAM_128MB_32Mx16_1BANK
|
|
|
|
global IXP42x_SDRAM_256MB_32Mx16_2BANK
|
2010-12-19 09:17:46 -06:00
|
|
|
|
|
|
|
set IXP42x_SDRAM_8MB_2Mx32_1BANK 0x0030
|
|
|
|
set IXP42x_SDRAM_16MB_2Mx32_2BANK 0x0031
|
|
|
|
set IXP42x_SDRAM_16MB_4Mx16_1BANK 0x0032
|
|
|
|
set IXP42x_SDRAM_32MB_4Mx16_2BANK 0x0033
|
|
|
|
set IXP42x_SDRAM_32MB_8Mx16_1BANK 0x0010
|
|
|
|
set IXP42x_SDRAM_64MB_8Mx16_2BANK 0x0011
|
|
|
|
set IXP42x_SDRAM_64MB_16Mx16_1BANK 0x0012
|
|
|
|
set IXP42x_SDRAM_128MB_16Mx16_2BANK 0x0013
|
|
|
|
set IXP42x_SDRAM_128MB_32Mx16_1BANK 0x0014
|
|
|
|
set IXP42x_SDRAM_256MB_32Mx16_2BANK 0x0015
|
|
|
|
|
|
|
|
|
|
|
|
# helper function to init SDRAM on IXP42x.
|
|
|
|
# SDRAM_CFG: one of IXP42X_SDRAM_xxx
|
2020-04-25 18:07:27 -05:00
|
|
|
# REFRESH: refresh counter reload value (integer)
|
|
|
|
# CASLAT: 2 or 3
|
2010-12-19 09:17:46 -06:00
|
|
|
proc ixp42x_init_sdram { SDRAM_CFG REFRESH CASLAT } {
|
|
|
|
|
|
|
|
switch $CASLAT {
|
2011-10-29 16:32:17 -05:00
|
|
|
2 {
|
|
|
|
set SDRAM_CFG [expr $SDRAM_CFG | $::IXP42x_SDRAM_CL2 ]
|
|
|
|
set CASCMD $::IXP425_SDRAM_IR_MODE_SET_CAS2_CMD
|
2010-12-19 09:17:46 -06:00
|
|
|
}
|
|
|
|
3 {
|
2011-10-29 16:32:17 -05:00
|
|
|
set SDRAM_CFG [expr $SDRAM_CFG | $::IXP42x_SDRAM_CL3 ]
|
|
|
|
set CASCMD $::IXP425_SDRAM_IR_MODE_SET_CAS3_CMD
|
2010-12-19 09:17:46 -06:00
|
|
|
}
|
|
|
|
default { error [format "unsupported cas latency \"%s\" " $CASLAT] }
|
|
|
|
}
|
|
|
|
echo [format "\tIXP42x SDRAM Config: 0x%x, Refresh %d " $SDRAM_CFG $REFRESH]
|
|
|
|
|
|
|
|
mww 0xCC000000 $SDRAM_CFG ;# SDRAM_CFG: 0x2A: 64MBit, CL3
|
|
|
|
mww 0xCC000004 0 ;# disable refresh
|
|
|
|
mww 0xCC000008 3 ;# NOP
|
|
|
|
sleep 100
|
|
|
|
mww 0xCC000004 $REFRESH ;# set refresh counter
|
|
|
|
mww 0xCC000008 2 ;# Precharge All Banks
|
|
|
|
sleep 100
|
|
|
|
mww 0xCC000008 4 ;# Auto Refresh
|
|
|
|
mww 0xCC000008 4 ;# Auto Refresh
|
|
|
|
mww 0xCC000008 4 ;# Auto Refresh
|
|
|
|
mww 0xCC000008 4 ;# Auto Refresh
|
|
|
|
mww 0xCC000008 4 ;# Auto Refresh
|
|
|
|
mww 0xCC000008 4 ;# Auto Refresh
|
|
|
|
mww 0xCC000008 4 ;# Auto Refresh
|
|
|
|
mww 0xCC000008 4 ;# Auto Refresh
|
|
|
|
mww 0xCC000008 $CASCMD ;# Mode Select CL2/CL3
|
|
|
|
}
|
|
|
|
|
|
|
|
proc ixp42x_set_bigendian { } {
|
|
|
|
reg XSCALE_CTRL 0xF8
|
|
|
|
}
|