All pastes #676000 Raw Edit

ph5

public text v1 · immutable
#676000 ·published 2007-08-30 18:08 UTC
rendered paste body
This patch adds OMAP850 detection and DMA shutdown to HaRET. include/arch-omap.h    |    5 +++ src/mach/arch-omap.cpp |   65 +++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 68 insertions(+), 2 deletions(-)Index: include/arch-omap.h===================================================================RCS file: /cvs/haret/include/arch-omap.h,vretrieving revision 1.4diff -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,vretrieving revision 1.8diff -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);+}