? .pc ? DIFF ? out ? patches ? haretconsole/dis.pyc ? haretconsole/foo.txt ? haretconsole/haretlog-20070826_001748.log ? haretconsole/haretlog-20070826_094043.log ? haretconsole/haretlog-20070826_094611.log ? haretconsole/haretlog-20070826_094628.log ? haretconsole/haretlog-20070826_095106.log ? haretconsole/memalias.pyc ? haretconsole/regs_omap.pyc ? haretconsole/regs_pxa.pyc ? haretconsole/regs_s3c.pyc Index: Makefile =================================================================== RCS file: /cvs/haret/Makefile,v retrieving revision 1.76 diff -u -r1.76 Makefile --- Makefile 23 Aug 2007 13:10:51 -0000 1.76 +++ Makefile 30 Aug 2007 17:54:57 -0000 @@ -38,7 +38,7 @@ ################ cegcc settings -BASE ?= /opt/mingw32ce +BASE ?= /home/ph5/bin/mingw32ce export BASE RC = $(BASE)/bin/arm-wince-mingw32ce-windres Index: haretconsole/dis.py =================================================================== RCS file: /cvs/haret/haretconsole/dis.py,v retrieving revision 1.6 diff -u -r1.6 dis.py --- haretconsole/dis.py 19 Aug 2007 18:27:43 -0000 1.6 +++ haretconsole/dis.py 30 Aug 2007 17:54:57 -0000 @@ -15,7 +15,7 @@ import memalias -OBJDUMP='arm-linux-objdump' +OBJDUMP='/home/ph5/src/oe/build/angstrom/cross/bin/arm-angstrom-linux-gnueabi-objdump' OBJDUMPARGS='-D -b binary -m arm' CLOCKRATE=416000000.0/64 Index: haretconsole/memalias.py =================================================================== RCS file: /cvs/haret/haretconsole/memalias.py,v retrieving revision 1.12 diff -u -r1.12 memalias.py --- haretconsole/memalias.py 18 Aug 2007 20:49:55 -0000 1.12 +++ haretconsole/memalias.py 30 Aug 2007 17:54:57 -0000 @@ -26,6 +26,12 @@ return tuple([("%d,%d" % (i, i+1), "%s%d" % (name, i/2 + start)) for i in range(0, 32, 2)]) +# Helper - create description for registers that are composed of an +# incrementing list of four bit fields. +def regFourBits(name, start=0): + return tuple([("%d,%d,%d,%d" % (i, i+1, i+2, i+3), "%s%d" % (name, i/4 + start)) + for i in range(0, 32, 4)]) + import regs_pxa import regs_s3c import regs_omap Index: haretconsole/regs_omap.py =================================================================== RCS file: /cvs/haret/haretconsole/regs_omap.py,v retrieving revision 1.3 diff -u -r1.3 regs_omap.py --- haretconsole/regs_omap.py 25 Aug 2007 16:34:07 -0000 1.3 +++ haretconsole/regs_omap.py 30 Aug 2007 17:54:57 -0000 @@ -5,8 +5,7 @@ # This file may be distributed under the terms of the GNU GPL license. import memalias -regOneBits = memalias.regOneBits - +from memalias import regOneBits, regFourBits ###################################################################### # omap850 @@ -57,5 +56,23 @@ 0xfffbd810: ("GPIO4-IM", regOneBits("IM", 96)), 0xfffbe010: ("GPIO5-IM", regOneBits("IM", 128)), 0xfffbe810: ("GPIO6-IM", regOneBits("IM", 160)), + + 0xfffe1010: ("OMAP730_MODE1", regOneBits("M1")), + 0xfffe1014: ("OMAP730_MODE2", regOneBits("M2")), + + 0xfffe1070: ("OMAP730_IO_CONF0", regFourBits("C")), + 0xfffe1074: ("OMAP730_IO_CONF1", regFourBits("C")), + 0xfffe1078: ("OMAP730_IO_CONF2", regFourBits("C")), + 0xfffe107c: ("OMAP730_IO_CONF3", regFourBits("C")), + 0xfffe1080: ("OMAP730_IO_CONF4", regFourBits("C")), + 0xfffe1084: ("OMAP730_IO_CONF5", regFourBits("C")), + 0xfffe1088: ("OMAP730_IO_CONF6", regFourBits("C")), + 0xfffe108c: ("OMAP730_IO_CONF7", regFourBits("C")), + 0xfffe1090: ("OMAP730_IO_CONF8", regFourBits("C")), + 0xfffe1094: ("OMAP730_IO_CONF9", regFourBits("C")), + 0xfffe1098: ("OMAP730_IO_CONF10", regFourBits("C")), + 0xfffe109c: ("OMAP730_IO_CONF11", regFourBits("C")), + 0xfffe10a0: ("OMAP730_IO_CONF12", regFourBits("C")), + 0xfffe10a4: ("OMAP730_IO_CONF13", regFourBits("C")), } memalias.RegsList['ARCH:OMAP850'] = Regs_omap850 Index: include/arch-omap.h =================================================================== RCS file: /cvs/haret/include/arch-omap.h,v retrieving revision 1.4 diff -u -r1.4 arch-omap.h --- include/arch-omap.h 23 Aug 2007 13:10:51 -0000 1.4 +++ include/arch-omap.h 30 Aug 2007 17:54:57 -0000 @@ -6,4 +6,9 @@ MachineOMAP850(); int detect(); void init(); + virtual int preHardwareShutdown(); + virtual void hardwareShutdown(); + + uint16 *dma; + uint32 *id; }; Index: src/mach/arch-omap.cpp =================================================================== RCS file: /cvs/haret/src/mach/arch-omap.cpp,v retrieving revision 1.8 diff -u -r1.8 arch-omap.cpp --- src/mach/arch-omap.cpp 25 Aug 2007 16:34:07 -0000 1.8 +++ src/mach/arch-omap.cpp 30 Aug 2007 17:54:57 -0000 @@ -1,3 +1,4 @@ +#include "memory.h" // memPhysMap #include "script.h" // runMemScript #include "arch-omap.h" @@ -7,11 +8,35 @@ archname = "OMAP850"; } +#define OMAP32_ID 0xfffed400 +#define OMAP_DMA_BASE 0xfffed800 + +#define OMAP_DMA_CSDP_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x00) +#define OMAP_DMA_CCR_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x02) +#define OMAP_DMA_CICR_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x04) +#define OMAP_DMA_CSR_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x06) +#define OMAP_DMA_CEN_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x10) +#define OMAP_DMA_CFN_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x12) +#define OMAP_DMA_CSFI_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x14) +#define OMAP_DMA_CSEI_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x16) +#define OMAP_DMA_CSAC_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x18) +#define OMAP_DMA_CDAC_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x1a) +#define OMAP_DMA_CDEI_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x1c) +#define OMAP_DMA_CDFI_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x1e) +#define OMAP_DMA_CLNK_CTRL_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x28) + +#define __REG16(x) (dma[(x-OMAP_DMA_BASE)>>1]) + +#define OMAP_DMA_CCR_EN (1 << 7) + int MachineOMAP850::detect() { - // TODO - need to implement detection system. - return 0; + id = (uint32 *)memPhysMap(OMAP32_ID); + if (! id) + return 0; + return ((id[0] == 0x03320500) && + (id[1] == 0x1b62c02f)); } void @@ -65,3 +90,39 @@ "addlist gpios P2V(0xfffbe010)\n" "addlist gpios P2V(0xfffbe810)\n"); } + +int +MachineOMAP850::preHardwareShutdown() +{ + /* Map now everything we'll need later */ + dma = (uint16 *)memPhysMap(OMAP_DMA_BASE); + if (! dma) + return -1; + return 0; +} + +static void +omapResetDMA(volatile uint16 *dma, int chancount) +{ + uint16 status; + for (int i = 0; i < chancount; i++) { + /* Disable all DMA interrupts for the channel. */ + OMAP_DMA_CICR_REG(i) = 0; + + /* Set the STOP_LNK bit */ + OMAP_DMA_CLNK_CTRL_REG(i) |= 1 << 14; + + /* Make sure the DMA transfer is stopped. */ + OMAP_DMA_CCR_REG(i) = 0; + OMAP_DMA_CCR_REG(i) &= ~OMAP_DMA_CCR_EN; + + /* Clear pending interrupts */ + status = OMAP_DMA_CSR_REG(i); + } +} + +void +MachineOMAP850::hardwareShutdown() +{ + omapResetDMA(dma, 17); +}