summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaurus Cuelenaere <mcuelenaere@gmail.com>2008-08-15 14:39:39 +0000
committerMaurus Cuelenaere <mcuelenaere@gmail.com>2008-08-15 14:39:39 +0000
commit57c0b6a4740d7a900dff7ff0230da1c7942a46b0 (patch)
tree9c32cb988e43886d3456e71044404cd7661edffb
parentbc712c9782adb5922a00cf85c71a081b0bbb4f6d (diff)
downloadrockbox-57c0b6a4740d7a900dff7ff0230da1c7942a46b0.tar.gz
rockbox-57c0b6a4740d7a900dff7ff0230da1c7942a46b0.zip
Onda VX747:
* kill TABs in jz4740.h * clean up LCD * make CONFIG_ORIENTATION work in both ways git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18286 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/export/jz4740.h6253
-rw-r--r--firmware/target/mips/ingenic_jz47xx/lcd-jz4740.c16
-rw-r--r--firmware/target/mips/ingenic_jz47xx/onda_vx747/lcd-onda_vx747.c18
-rw-r--r--firmware/target/mips/ingenic_jz47xx/onda_vx747/sadc-onda_vx747.c21
4 files changed, 3178 insertions, 3130 deletions
diff --git a/firmware/export/jz4740.h b/firmware/export/jz4740.h
index b17d774b0d..a025b94116 100644
--- a/firmware/export/jz4740.h
+++ b/firmware/export/jz4740.h
@@ -6,9 +6,9 @@
6 6
7#ifndef __ASSEMBLY__ 7#ifndef __ASSEMBLY__
8 8
9#define REG8(addr) (*(volatile unsigned char *)(addr)) 9#define REG8(addr) (*(volatile unsigned char *)(addr))
10#define REG16(addr) (*(volatile unsigned short *)(addr)) 10#define REG16(addr) (*(volatile unsigned short *)(addr))
11#define REG32(addr) (*(volatile unsigned int *)(addr)) 11#define REG32(addr) (*(volatile unsigned int *)(addr))
12 12
13#endif /* !ASSEMBLY */ 13#endif /* !ASSEMBLY */
14 14
@@ -17,569 +17,569 @@
17// 17//
18 18
19/* NOR Boot config */ 19/* NOR Boot config */
20#define JZ4740_NORBOOT_8BIT 0x00000000 /* 8-bit data bus flash */ 20#define JZ4740_NORBOOT_8BIT 0x00000000 /* 8-bit data bus flash */
21#define JZ4740_NORBOOT_16BIT 0x10101010 /* 16-bit data bus flash */ 21#define JZ4740_NORBOOT_16BIT 0x10101010 /* 16-bit data bus flash */
22#define JZ4740_NORBOOT_32BIT 0x20202020 /* 32-bit data bus flash */ 22#define JZ4740_NORBOOT_32BIT 0x20202020 /* 32-bit data bus flash */
23 23
24/* NAND Boot config */ 24/* NAND Boot config */
25#define JZ4740_NANDBOOT_B8R3 0xffffffff /* 8-bit bus & 3 row cycles */ 25#define JZ4740_NANDBOOT_B8R3 0xffffffff /* 8-bit bus & 3 row cycles */
26#define JZ4740_NANDBOOT_B8R2 0xf0f0f0f0 /* 8-bit bus & 2 row cycles */ 26#define JZ4740_NANDBOOT_B8R2 0xf0f0f0f0 /* 8-bit bus & 2 row cycles */
27#define JZ4740_NANDBOOT_B16R3 0x0f0f0f0f /* 16-bit bus & 3 row cycles */ 27#define JZ4740_NANDBOOT_B16R3 0x0f0f0f0f /* 16-bit bus & 3 row cycles */
28#define JZ4740_NANDBOOT_B16R2 0x00000000 /* 16-bit bus & 2 row cycles */ 28#define JZ4740_NANDBOOT_B16R2 0x00000000 /* 16-bit bus & 2 row cycles */
29 29
30 30
31//---------------------------------------------------------------------- 31//----------------------------------------------------------------------
32// Register Definitions 32// Register Definitions
33// 33//
34#define CPM_BASE 0xB0000000 34#define CPM_BASE 0xB0000000
35#define INTC_BASE 0xB0001000 35#define INTC_BASE 0xB0001000
36#define TCU_BASE 0xB0002000 36#define TCU_BASE 0xB0002000
37#define WDT_BASE 0xB0002000 37#define WDT_BASE 0xB0002000
38#define RTC_BASE 0xB0003000 38#define RTC_BASE 0xB0003000
39#define GPIO_BASE 0xB0010000 39#define GPIO_BASE 0xB0010000
40#define AIC_BASE 0xB0020000 40#define AIC_BASE 0xB0020000
41#define ICDC_BASE 0xB0020000 41#define ICDC_BASE 0xB0020000
42#define MSC_BASE 0xB0021000 42#define MSC_BASE 0xB0021000
43#define UART0_BASE 0xB0030000 43#define UART0_BASE 0xB0030000
44#define I2C_BASE 0xB0042000 44#define I2C_BASE 0xB0042000
45#define SSI_BASE 0xB0043000 45#define SSI_BASE 0xB0043000
46#define SADC_BASE 0xB0070000 46#define SADC_BASE 0xB0070000
47#define EMC_BASE 0xB3010000 47#define EMC_BASE 0xB3010000
48#define DMAC_BASE 0xB3020000 48#define DMAC_BASE 0xB3020000
49#define UHC_BASE 0xB3030000 49#define UHC_BASE 0xB3030000
50#define UDC_BASE 0xB3040000 50#define UDC_BASE 0xB3040000
51#define LCD_BASE 0xB3050000 51#define LCD_BASE 0xB3050000
52#define SLCD_BASE 0xB3050000 52#define SLCD_BASE 0xB3050000
53#define CIM_BASE 0xB3060000 53#define CIM_BASE 0xB3060000
54#define ETH_BASE 0xB3100000 54#define ETH_BASE 0xB3100000
55 55
56 56
57/************************************************************************* 57/*************************************************************************
58 * INTC (Interrupt Controller) 58 * INTC (Interrupt Controller)
59 *************************************************************************/ 59 *************************************************************************/
60#define INTC_ISR (INTC_BASE + 0x00) 60#define INTC_ISR (INTC_BASE + 0x00)
61#define INTC_IMR (INTC_BASE + 0x04) 61#define INTC_IMR (INTC_BASE + 0x04)
62#define INTC_IMSR (INTC_BASE + 0x08) 62#define INTC_IMSR (INTC_BASE + 0x08)
63#define INTC_IMCR (INTC_BASE + 0x0c) 63#define INTC_IMCR (INTC_BASE + 0x0c)
64#define INTC_IPR (INTC_BASE + 0x10) 64#define INTC_IPR (INTC_BASE + 0x10)
65 65
66#define REG_INTC_ISR REG32(INTC_ISR) 66#define REG_INTC_ISR REG32(INTC_ISR)
67#define REG_INTC_IMR REG32(INTC_IMR) 67#define REG_INTC_IMR REG32(INTC_IMR)
68#define REG_INTC_IMSR REG32(INTC_IMSR) 68#define REG_INTC_IMSR REG32(INTC_IMSR)
69#define REG_INTC_IMCR REG32(INTC_IMCR) 69#define REG_INTC_IMCR REG32(INTC_IMCR)
70#define REG_INTC_IPR REG32(INTC_IPR) 70#define REG_INTC_IPR REG32(INTC_IPR)
71 71
72// 1st-level interrupts 72// 1st-level interrupts
73#define IRQ_I2C 1 73#define IRQ_I2C 1
74#define IRQ_EMC 2 74#define IRQ_EMC 2
75#define IRQ_UHC 3 75#define IRQ_UHC 3
76#define IRQ_UART0 9 76#define IRQ_UART0 9
77#define IRQ_SADC 12 77#define IRQ_SADC 12
78#define IRQ_MSC 14 78#define IRQ_MSC 14
79#define IRQ_RTC 15 79#define IRQ_RTC 15
80#define IRQ_SSI 16 80#define IRQ_SSI 16
81#define IRQ_CIM 17 81#define IRQ_CIM 17
82#define IRQ_AIC 18 82#define IRQ_AIC 18
83#define IRQ_ETH 19 83#define IRQ_ETH 19
84#define IRQ_DMAC 20 84#define IRQ_DMAC 20
85#define IRQ_TCU2 21 85#define IRQ_TCU2 21
86#define IRQ_TCU1 22 86#define IRQ_TCU1 22
87#define IRQ_TCU0 23 87#define IRQ_TCU0 23
88#define IRQ_UDC 24 88#define IRQ_UDC 24
89#define IRQ_GPIO3 25 89#define IRQ_GPIO3 25
90#define IRQ_GPIO2 26 90#define IRQ_GPIO2 26
91#define IRQ_GPIO1 27 91#define IRQ_GPIO1 27
92#define IRQ_GPIO0 28 92#define IRQ_GPIO0 28
93#define IRQ_IPU 29 93#define IRQ_IPU 29
94#define IRQ_LCD 30 94#define IRQ_LCD 30
95 95
96// 2nd-level interrupts 96// 2nd-level interrupts
97#define IRQ_DMA_0 32 /* 32 to 37 for DMAC channel 0 to 5 */ 97#define IRQ_DMA_0 32 /* 32 to 37 for DMAC channel 0 to 5 */
98#define IRQ_GPIO_0 48 /* 48 to 175 for GPIO pin 0 to 127 */ 98#define IRQ_GPIO_0 48 /* 48 to 175 for GPIO pin 0 to 127 */
99 99
100 100
101/************************************************************************* 101/*************************************************************************
102 * RTC 102 * RTC
103 *************************************************************************/ 103 *************************************************************************/
104#define RTC_RCR (RTC_BASE + 0x00) /* RTC Control Register */ 104#define RTC_RCR (RTC_BASE + 0x00) /* RTC Control Register */
105#define RTC_RSR (RTC_BASE + 0x04) /* RTC Second Register */ 105#define RTC_RSR (RTC_BASE + 0x04) /* RTC Second Register */
106#define RTC_RSAR (RTC_BASE + 0x08) /* RTC Second Alarm Register */ 106#define RTC_RSAR (RTC_BASE + 0x08) /* RTC Second Alarm Register */
107#define RTC_RGR (RTC_BASE + 0x0c) /* RTC Regulator Register */ 107#define RTC_RGR (RTC_BASE + 0x0c) /* RTC Regulator Register */
108 108
109#define RTC_HCR (RTC_BASE + 0x20) /* Hibernate Control Register */ 109#define RTC_HCR (RTC_BASE + 0x20) /* Hibernate Control Register */
110#define RTC_HWFCR (RTC_BASE + 0x24) /* Hibernate Wakeup Filter Counter Reg */ 110#define RTC_HWFCR (RTC_BASE + 0x24) /* Hibernate Wakeup Filter Counter Reg */
111#define RTC_HRCR (RTC_BASE + 0x28) /* Hibernate Reset Counter Register */ 111#define RTC_HRCR (RTC_BASE + 0x28) /* Hibernate Reset Counter Register */
112#define RTC_HWCR (RTC_BASE + 0x2c) /* Hibernate Wakeup Control Register */ 112#define RTC_HWCR (RTC_BASE + 0x2c) /* Hibernate Wakeup Control Register */
113#define RTC_HWRSR (RTC_BASE + 0x30) /* Hibernate Wakeup Status Register */ 113#define RTC_HWRSR (RTC_BASE + 0x30) /* Hibernate Wakeup Status Register */
114#define RTC_HSPR (RTC_BASE + 0x34) /* Hibernate Scratch Pattern Register */ 114#define RTC_HSPR (RTC_BASE + 0x34) /* Hibernate Scratch Pattern Register */
115 115
116#define REG_RTC_RCR REG32(RTC_RCR) 116#define REG_RTC_RCR REG32(RTC_RCR)
117#define REG_RTC_RSR REG32(RTC_RSR) 117#define REG_RTC_RSR REG32(RTC_RSR)
118#define REG_RTC_RSAR REG32(RTC_RSAR) 118#define REG_RTC_RSAR REG32(RTC_RSAR)
119#define REG_RTC_RGR REG32(RTC_RGR) 119#define REG_RTC_RGR REG32(RTC_RGR)
120#define REG_RTC_HCR REG32(RTC_HCR) 120#define REG_RTC_HCR REG32(RTC_HCR)
121#define REG_RTC_HWFCR REG32(RTC_HWFCR) 121#define REG_RTC_HWFCR REG32(RTC_HWFCR)
122#define REG_RTC_HRCR REG32(RTC_HRCR) 122#define REG_RTC_HRCR REG32(RTC_HRCR)
123#define REG_RTC_HWCR REG32(RTC_HWCR) 123#define REG_RTC_HWCR REG32(RTC_HWCR)
124#define REG_RTC_HWRSR REG32(RTC_HWRSR) 124#define REG_RTC_HWRSR REG32(RTC_HWRSR)
125#define REG_RTC_HSPR REG32(RTC_HSPR) 125#define REG_RTC_HSPR REG32(RTC_HSPR)
126 126
127/* RTC Control Register */ 127/* RTC Control Register */
128#define RTC_RCR_WRDY (1 << 7) /* Write Ready Flag */ 128#define RTC_RCR_WRDY (1 << 7) /* Write Ready Flag */
129#define RTC_RCR_HZ (1 << 6) /* 1Hz Flag */ 129#define RTC_RCR_HZ (1 << 6) /* 1Hz Flag */
130#define RTC_RCR_HZIE (1 << 5) /* 1Hz Interrupt Enable */ 130#define RTC_RCR_HZIE (1 << 5) /* 1Hz Interrupt Enable */
131#define RTC_RCR_AF (1 << 4) /* Alarm Flag */ 131#define RTC_RCR_AF (1 << 4) /* Alarm Flag */
132#define RTC_RCR_AF_BIT 4 /* Alarm Flag */ 132#define RTC_RCR_AF_BIT 4 /* Alarm Flag */
133#define RTC_RCR_AIE (1 << 3) /* Alarm Interrupt Enable */ 133#define RTC_RCR_AIE (1 << 3) /* Alarm Interrupt Enable */
134#define RTC_RCR_AE (1 << 2) /* Alarm Enable */ 134#define RTC_RCR_AE (1 << 2) /* Alarm Enable */
135#define RTC_RCR_RTCE (1 << 0) /* RTC Enable */ 135#define RTC_RCR_RTCE (1 << 0) /* RTC Enable */
136 136
137/* RTC Regulator Register */ 137/* RTC Regulator Register */
138#define RTC_RGR_LOCK (1 << 31) /* Lock Bit */ 138#define RTC_RGR_LOCK (1 << 31) /* Lock Bit */
139#define RTC_RGR_ADJC_BIT 16 139#define RTC_RGR_ADJC_BIT 16
140#define RTC_RGR_ADJC_MASK (0x3ff << RTC_RGR_ADJC_BIT) 140#define RTC_RGR_ADJC_MASK (0x3ff << RTC_RGR_ADJC_BIT)
141#define RTC_RGR_NC1HZ_BIT 0 141#define RTC_RGR_NC1HZ_BIT 0
142#define RTC_RGR_NC1HZ_MASK (0xffff << RTC_RGR_NC1HZ_BIT) 142#define RTC_RGR_NC1HZ_MASK (0xffff << RTC_RGR_NC1HZ_BIT)
143 143
144/* Hibernate Control Register */ 144/* Hibernate Control Register */
145#define RTC_HCR_PD (1 << 0) /* Power Down */ 145#define RTC_HCR_PD (1 << 0) /* Power Down */
146 146
147/* Hibernate Wakeup Filter Counter Register */ 147/* Hibernate Wakeup Filter Counter Register */
148#define RTC_HWFCR_BIT 5 148#define RTC_HWFCR_BIT 5
149#define RTC_HWFCR_MASK (0x7ff << RTC_HWFCR_BIT) 149#define RTC_HWFCR_MASK (0x7ff << RTC_HWFCR_BIT)
150 150
151/* Hibernate Reset Counter Register */ 151/* Hibernate Reset Counter Register */
152#define RTC_HRCR_BIT 5 152#define RTC_HRCR_BIT 5
153#define RTC_HRCR_MASK (0x7f << RTC_HRCR_BIT) 153#define RTC_HRCR_MASK (0x7f << RTC_HRCR_BIT)
154 154
155/* Hibernate Wakeup Control Register */ 155/* Hibernate Wakeup Control Register */
156#define RTC_HWCR_EALM (1 << 0) /* RTC alarm wakeup enable */ 156#define RTC_HWCR_EALM (1 << 0) /* RTC alarm wakeup enable */
157 157
158/* Hibernate Wakeup Status Register */ 158/* Hibernate Wakeup Status Register */
159#define RTC_HWRSR_HR (1 << 5) /* Hibernate reset */ 159#define RTC_HWRSR_HR (1 << 5) /* Hibernate reset */
160#define RTC_HWRSR_PPR (1 << 4) /* PPR reset */ 160#define RTC_HWRSR_PPR (1 << 4) /* PPR reset */
161#define RTC_HWRSR_PIN (1 << 1) /* Wakeup pin status bit */ 161#define RTC_HWRSR_PIN (1 << 1) /* Wakeup pin status bit */
162#define RTC_HWRSR_ALM (1 << 0) /* RTC alarm status bit */ 162#define RTC_HWRSR_ALM (1 << 0) /* RTC alarm status bit */
163 163
164 164
165/************************************************************************* 165/*************************************************************************
166 * CPM (Clock reset and Power control Management) 166 * CPM (Clock reset and Power control Management)
167 *************************************************************************/ 167 *************************************************************************/
168#define CPM_CPCCR (CPM_BASE+0x00) 168#define CPM_CPCCR (CPM_BASE+0x00)
169#define CPM_CPPCR (CPM_BASE+0x10) 169#define CPM_CPPCR (CPM_BASE+0x10)
170#define CPM_I2SCDR (CPM_BASE+0x60) 170#define CPM_I2SCDR (CPM_BASE+0x60)
171#define CPM_LPCDR (CPM_BASE+0x64) 171#define CPM_LPCDR (CPM_BASE+0x64)
172#define CPM_MSCCDR (CPM_BASE+0x68) 172#define CPM_MSCCDR (CPM_BASE+0x68)
173#define CPM_UHCCDR (CPM_BASE+0x6C) 173#define CPM_UHCCDR (CPM_BASE+0x6C)
174 174
175#define CPM_LCR (CPM_BASE+0x04) 175#define CPM_LCR (CPM_BASE+0x04)
176#define CPM_CLKGR (CPM_BASE+0x20) 176#define CPM_CLKGR (CPM_BASE+0x20)
177#define CPM_SCR (CPM_BASE+0x24) 177#define CPM_SCR (CPM_BASE+0x24)
178 178
179#define CPM_HCR (CPM_BASE+0x30) 179#define CPM_HCR (CPM_BASE+0x30)
180#define CPM_HWFCR (CPM_BASE+0x34) 180#define CPM_HWFCR (CPM_BASE+0x34)
181#define CPM_HRCR (CPM_BASE+0x38) 181#define CPM_HRCR (CPM_BASE+0x38)
182#define CPM_HWCR (CPM_BASE+0x3c) 182#define CPM_HWCR (CPM_BASE+0x3c)
183#define CPM_HWSR (CPM_BASE+0x40) 183#define CPM_HWSR (CPM_BASE+0x40)
184#define CPM_HSPR (CPM_BASE+0x44) 184#define CPM_HSPR (CPM_BASE+0x44)
185 185
186#define CPM_RSR (CPM_BASE+0x08) 186#define CPM_RSR (CPM_BASE+0x08)
187 187
188 188
189#define REG_CPM_CPCCR REG32(CPM_CPCCR) 189#define REG_CPM_CPCCR REG32(CPM_CPCCR)
190#define REG_CPM_CPPCR REG32(CPM_CPPCR) 190#define REG_CPM_CPPCR REG32(CPM_CPPCR)
191#define REG_CPM_I2SCDR REG32(CPM_I2SCDR) 191#define REG_CPM_I2SCDR REG32(CPM_I2SCDR)
192#define REG_CPM_LPCDR REG32(CPM_LPCDR) 192#define REG_CPM_LPCDR REG32(CPM_LPCDR)
193#define REG_CPM_MSCCDR REG32(CPM_MSCCDR) 193#define REG_CPM_MSCCDR REG32(CPM_MSCCDR)
194#define REG_CPM_UHCCDR REG32(CPM_UHCCDR) 194#define REG_CPM_UHCCDR REG32(CPM_UHCCDR)
195 195
196#define REG_CPM_LCR REG32(CPM_LCR) 196#define REG_CPM_LCR REG32(CPM_LCR)
197#define REG_CPM_CLKGR REG32(CPM_CLKGR) 197#define REG_CPM_CLKGR REG32(CPM_CLKGR)
198#define REG_CPM_SCR REG32(CPM_SCR) 198#define REG_CPM_SCR REG32(CPM_SCR)
199#define REG_CPM_HCR REG32(CPM_HCR) 199#define REG_CPM_HCR REG32(CPM_HCR)
200#define REG_CPM_HWFCR REG32(CPM_HWFCR) 200#define REG_CPM_HWFCR REG32(CPM_HWFCR)
201#define REG_CPM_HRCR REG32(CPM_HRCR) 201#define REG_CPM_HRCR REG32(CPM_HRCR)
202#define REG_CPM_HWCR REG32(CPM_HWCR) 202#define REG_CPM_HWCR REG32(CPM_HWCR)
203#define REG_CPM_HWSR REG32(CPM_HWSR) 203#define REG_CPM_HWSR REG32(CPM_HWSR)
204#define REG_CPM_HSPR REG32(CPM_HSPR) 204#define REG_CPM_HSPR REG32(CPM_HSPR)
205 205
206#define REG_CPM_RSR REG32(CPM_RSR) 206#define REG_CPM_RSR REG32(CPM_RSR)
207 207
208 208
209/* Clock Control Register */ 209/* Clock Control Register */
210#define CPM_CPCCR_I2CS (1 << 31) 210#define CPM_CPCCR_I2CS (1 << 31)
211#define CPM_CPCCR_CLKOEN (1 << 30) 211#define CPM_CPCCR_CLKOEN (1 << 30)
212#define CPM_CPCCR_UCS (1 << 29) 212#define CPM_CPCCR_UCS (1 << 29)
213#define CPM_CPCCR_UDIV_BIT 23 213#define CPM_CPCCR_UDIV_BIT 23
214#define CPM_CPCCR_UDIV_MASK (0x3f << CPM_CPCCR_UDIV_BIT) 214#define CPM_CPCCR_UDIV_MASK (0x3f << CPM_CPCCR_UDIV_BIT)
215#define CPM_CPCCR_CE (1 << 22) 215#define CPM_CPCCR_CE (1 << 22)
216#define CPM_CPCCR_PCS (1 << 21) 216#define CPM_CPCCR_PCS (1 << 21)
217#define CPM_CPCCR_LDIV_BIT 16 217#define CPM_CPCCR_LDIV_BIT 16
218#define CPM_CPCCR_LDIV_MASK (0x1f << CPM_CPCCR_LDIV_BIT) 218#define CPM_CPCCR_LDIV_MASK (0x1f << CPM_CPCCR_LDIV_BIT)
219#define CPM_CPCCR_MDIV_BIT 12 219#define CPM_CPCCR_MDIV_BIT 12
220#define CPM_CPCCR_MDIV_MASK (0x0f << CPM_CPCCR_MDIV_BIT) 220#define CPM_CPCCR_MDIV_MASK (0x0f << CPM_CPCCR_MDIV_BIT)
221#define CPM_CPCCR_PDIV_BIT 8 221#define CPM_CPCCR_PDIV_BIT 8
222#define CPM_CPCCR_PDIV_MASK (0x0f << CPM_CPCCR_PDIV_BIT) 222#define CPM_CPCCR_PDIV_MASK (0x0f << CPM_CPCCR_PDIV_BIT)
223#define CPM_CPCCR_HDIV_BIT 4 223#define CPM_CPCCR_HDIV_BIT 4
224#define CPM_CPCCR_HDIV_MASK (0x0f << CPM_CPCCR_HDIV_BIT) 224#define CPM_CPCCR_HDIV_MASK (0x0f << CPM_CPCCR_HDIV_BIT)
225#define CPM_CPCCR_CDIV_BIT 0 225#define CPM_CPCCR_CDIV_BIT 0
226#define CPM_CPCCR_CDIV_MASK (0x0f << CPM_CPCCR_CDIV_BIT) 226#define CPM_CPCCR_CDIV_MASK (0x0f << CPM_CPCCR_CDIV_BIT)
227 227
228/* I2S Clock Divider Register */ 228/* I2S Clock Divider Register */
229#define CPM_I2SCDR_I2SDIV_BIT 0 229#define CPM_I2SCDR_I2SDIV_BIT 0
230#define CPM_I2SCDR_I2SDIV_MASK (0x1ff << CPM_I2SCDR_I2SDIV_BIT) 230#define CPM_I2SCDR_I2SDIV_MASK (0x1ff << CPM_I2SCDR_I2SDIV_BIT)
231 231
232/* LCD Pixel Clock Divider Register */ 232/* LCD Pixel Clock Divider Register */
233#define CPM_LPCDR_PIXDIV_BIT 0 233#define CPM_LPCDR_PIXDIV_BIT 0
234#define CPM_LPCDR_PIXDIV_MASK (0x1ff << CPM_LPCDR_PIXDIV_BIT) 234#define CPM_LPCDR_PIXDIV_MASK (0x1ff << CPM_LPCDR_PIXDIV_BIT)
235 235
236/* MSC Clock Divider Register */ 236/* MSC Clock Divider Register */
237#define CPM_MSCCDR_MSCDIV_BIT 0 237#define CPM_MSCCDR_MSCDIV_BIT 0
238#define CPM_MSCCDR_MSCDIV_MASK (0x1f << CPM_MSCCDR_MSCDIV_BIT) 238#define CPM_MSCCDR_MSCDIV_MASK (0x1f << CPM_MSCCDR_MSCDIV_BIT)
239 239
240/* PLL Control Register */ 240/* PLL Control Register */
241#define CPM_CPPCR_PLLM_BIT 23 241#define CPM_CPPCR_PLLM_BIT 23
242#define CPM_CPPCR_PLLM_MASK (0x1ff << CPM_CPPCR_PLLM_BIT) 242#define CPM_CPPCR_PLLM_MASK (0x1ff << CPM_CPPCR_PLLM_BIT)
243#define CPM_CPPCR_PLLN_BIT 18 243#define CPM_CPPCR_PLLN_BIT 18
244#define CPM_CPPCR_PLLN_MASK (0x1f << CPM_CPPCR_PLLN_BIT) 244#define CPM_CPPCR_PLLN_MASK (0x1f << CPM_CPPCR_PLLN_BIT)
245#define CPM_CPPCR_PLLOD_BIT 16 245#define CPM_CPPCR_PLLOD_BIT 16
246#define CPM_CPPCR_PLLOD_MASK (0x03 << CPM_CPPCR_PLLOD_BIT) 246#define CPM_CPPCR_PLLOD_MASK (0x03 << CPM_CPPCR_PLLOD_BIT)
247#define CPM_CPPCR_PLLS (1 << 10) 247#define CPM_CPPCR_PLLS (1 << 10)
248#define CPM_CPPCR_PLLBP (1 << 9) 248#define CPM_CPPCR_PLLBP (1 << 9)
249#define CPM_CPPCR_PLLEN (1 << 8) 249#define CPM_CPPCR_PLLEN (1 << 8)
250#define CPM_CPPCR_PLLST_BIT 0 250#define CPM_CPPCR_PLLST_BIT 0
251#define CPM_CPPCR_PLLST_MASK (0xff << CPM_CPPCR_PLLST_BIT) 251#define CPM_CPPCR_PLLST_MASK (0xff << CPM_CPPCR_PLLST_BIT)
252 252
253/* Low Power Control Register */ 253/* Low Power Control Register */
254#define CPM_LCR_DOZE_DUTY_BIT 3 254#define CPM_LCR_DOZE_DUTY_BIT 3
255#define CPM_LCR_DOZE_DUTY_MASK (0x1f << CPM_LCR_DOZE_DUTY_BIT) 255#define CPM_LCR_DOZE_DUTY_MASK (0x1f << CPM_LCR_DOZE_DUTY_BIT)
256#define CPM_LCR_DOZE_ON (1 << 2) 256#define CPM_LCR_DOZE_ON (1 << 2)
257#define CPM_LCR_LPM_BIT 0 257#define CPM_LCR_LPM_BIT 0
258#define CPM_LCR_LPM_MASK (0x3 << CPM_LCR_LPM_BIT) 258#define CPM_LCR_LPM_MASK (0x3 << CPM_LCR_LPM_BIT)
259 #define CPM_LCR_LPM_IDLE (0x0 << CPM_LCR_LPM_BIT) 259 #define CPM_LCR_LPM_IDLE (0x0 << CPM_LCR_LPM_BIT)
260 #define CPM_LCR_LPM_SLEEP (0x1 << CPM_LCR_LPM_BIT) 260 #define CPM_LCR_LPM_SLEEP (0x1 << CPM_LCR_LPM_BIT)
261 261
262/* Clock Gate Register */ 262/* Clock Gate Register */
263#define CPM_CLKGR_UART1 (1 << 15) 263#define CPM_CLKGR_UART1 (1 << 15)
264#define CPM_CLKGR_UHC (1 << 14) 264#define CPM_CLKGR_UHC (1 << 14)
265#define CPM_CLKGR_IPU (1 << 13) 265#define CPM_CLKGR_IPU (1 << 13)
266#define CPM_CLKGR_DMAC (1 << 12) 266#define CPM_CLKGR_DMAC (1 << 12)
267#define CPM_CLKGR_UDC (1 << 11) 267#define CPM_CLKGR_UDC (1 << 11)
268#define CPM_CLKGR_LCD (1 << 10) 268#define CPM_CLKGR_LCD (1 << 10)
269#define CPM_CLKGR_CIM (1 << 9) 269#define CPM_CLKGR_CIM (1 << 9)
270#define CPM_CLKGR_SADC (1 << 8) 270#define CPM_CLKGR_SADC (1 << 8)
271#define CPM_CLKGR_MSC (1 << 7) 271#define CPM_CLKGR_MSC (1 << 7)
272#define CPM_CLKGR_AIC1 (1 << 6) 272#define CPM_CLKGR_AIC1 (1 << 6)
273#define CPM_CLKGR_AIC2 (1 << 5) 273#define CPM_CLKGR_AIC2 (1 << 5)
274#define CPM_CLKGR_SSI (1 << 4) 274#define CPM_CLKGR_SSI (1 << 4)
275#define CPM_CLKGR_I2C (1 << 3) 275#define CPM_CLKGR_I2C (1 << 3)
276#define CPM_CLKGR_RTC (1 << 2) 276#define CPM_CLKGR_RTC (1 << 2)
277#define CPM_CLKGR_TCU (1 << 1) 277#define CPM_CLKGR_TCU (1 << 1)
278#define CPM_CLKGR_UART0 (1 << 0) 278#define CPM_CLKGR_UART0 (1 << 0)
279 279
280/* Sleep Control Register */ 280/* Sleep Control Register */
281#define CPM_SCR_O1ST_BIT 8 281#define CPM_SCR_O1ST_BIT 8
282#define CPM_SCR_O1ST_MASK (0xff << CPM_SCR_O1ST_BIT) 282#define CPM_SCR_O1ST_MASK (0xff << CPM_SCR_O1ST_BIT)
283#define CPM_SCR_USBPHY_ENABLE (1 << 6) 283#define CPM_SCR_USBPHY_ENABLE (1 << 6)
284#define CPM_SCR_OSC_ENABLE (1 << 4) 284#define CPM_SCR_OSC_ENABLE (1 << 4)
285 285
286/* Hibernate Control Register */ 286/* Hibernate Control Register */
287#define CPM_HCR_PD (1 << 0) 287#define CPM_HCR_PD (1 << 0)
288 288
289/* Wakeup Filter Counter Register in Hibernate Mode */ 289/* Wakeup Filter Counter Register in Hibernate Mode */
290#define CPM_HWFCR_TIME_BIT 0 290#define CPM_HWFCR_TIME_BIT 0
291#define CPM_HWFCR_TIME_MASK (0x3ff << CPM_HWFCR_TIME_BIT) 291#define CPM_HWFCR_TIME_MASK (0x3ff << CPM_HWFCR_TIME_BIT)
292 292
293/* Reset Counter Register in Hibernate Mode */ 293/* Reset Counter Register in Hibernate Mode */
294#define CPM_HRCR_TIME_BIT 0 294#define CPM_HRCR_TIME_BIT 0
295#define CPM_HRCR_TIME_MASK (0x7f << CPM_HRCR_TIME_BIT) 295#define CPM_HRCR_TIME_MASK (0x7f << CPM_HRCR_TIME_BIT)
296 296
297/* Wakeup Control Register in Hibernate Mode */ 297/* Wakeup Control Register in Hibernate Mode */
298#define CPM_HWCR_WLE_LOW (0 << 2) 298#define CPM_HWCR_WLE_LOW (0 << 2)
299#define CPM_HWCR_WLE_HIGH (1 << 2) 299#define CPM_HWCR_WLE_HIGH (1 << 2)
300#define CPM_HWCR_PIN_WAKEUP (1 << 1) 300#define CPM_HWCR_PIN_WAKEUP (1 << 1)
301#define CPM_HWCR_RTC_WAKEUP (1 << 0) 301#define CPM_HWCR_RTC_WAKEUP (1 << 0)
302 302
303/* Wakeup Status Register in Hibernate Mode */ 303/* Wakeup Status Register in Hibernate Mode */
304#define CPM_HWSR_WSR_PIN (1 << 1) 304#define CPM_HWSR_WSR_PIN (1 << 1)
305#define CPM_HWSR_WSR_RTC (1 << 0) 305#define CPM_HWSR_WSR_RTC (1 << 0)
306 306
307/* Reset Status Register */ 307/* Reset Status Register */
308#define CPM_RSR_HR (1 << 2) 308#define CPM_RSR_HR (1 << 2)
309#define CPM_RSR_WR (1 << 1) 309#define CPM_RSR_WR (1 << 1)
310#define CPM_RSR_PR (1 << 0) 310#define CPM_RSR_PR (1 << 0)
311 311
312 312
313/************************************************************************* 313/*************************************************************************
314 * TCU (Timer Counter Unit) 314 * TCU (Timer Counter Unit)
315 *************************************************************************/ 315 *************************************************************************/
316#define TCU_TSR (TCU_BASE + 0x1C) /* Timer Stop Register */ 316#define TCU_TSR (TCU_BASE + 0x1C) /* Timer Stop Register */
317#define TCU_TSSR (TCU_BASE + 0x2C) /* Timer Stop Set Register */ 317#define TCU_TSSR (TCU_BASE + 0x2C) /* Timer Stop Set Register */
318#define TCU_TSCR (TCU_BASE + 0x3C) /* Timer Stop Clear Register */ 318#define TCU_TSCR (TCU_BASE + 0x3C) /* Timer Stop Clear Register */
319#define TCU_TER (TCU_BASE + 0x10) /* Timer Counter Enable Register */ 319#define TCU_TER (TCU_BASE + 0x10) /* Timer Counter Enable Register */
320#define TCU_TESR (TCU_BASE + 0x14) /* Timer Counter Enable Set Register */ 320#define TCU_TESR (TCU_BASE + 0x14) /* Timer Counter Enable Set Register */
321#define TCU_TECR (TCU_BASE + 0x18) /* Timer Counter Enable Clear Register */ 321#define TCU_TECR (TCU_BASE + 0x18) /* Timer Counter Enable Clear Register */
322#define TCU_TFR (TCU_BASE + 0x20) /* Timer Flag Register */ 322#define TCU_TFR (TCU_BASE + 0x20) /* Timer Flag Register */
323#define TCU_TFSR (TCU_BASE + 0x24) /* Timer Flag Set Register */ 323#define TCU_TFSR (TCU_BASE + 0x24) /* Timer Flag Set Register */
324#define TCU_TFCR (TCU_BASE + 0x28) /* Timer Flag Clear Register */ 324#define TCU_TFCR (TCU_BASE + 0x28) /* Timer Flag Clear Register */
325#define TCU_TMR (TCU_BASE + 0x30) /* Timer Mask Register */ 325#define TCU_TMR (TCU_BASE + 0x30) /* Timer Mask Register */
326#define TCU_TMSR (TCU_BASE + 0x34) /* Timer Mask Set Register */ 326#define TCU_TMSR (TCU_BASE + 0x34) /* Timer Mask Set Register */
327#define TCU_TMCR (TCU_BASE + 0x38) /* Timer Mask Clear Register */ 327#define TCU_TMCR (TCU_BASE + 0x38) /* Timer Mask Clear Register */
328#define TCU_TDFR0 (TCU_BASE + 0x40) /* Timer Data Full Register */ 328#define TCU_TDFR0 (TCU_BASE + 0x40) /* Timer Data Full Register */
329#define TCU_TDHR0 (TCU_BASE + 0x44) /* Timer Data Half Register */ 329#define TCU_TDHR0 (TCU_BASE + 0x44) /* Timer Data Half Register */
330#define TCU_TCNT0 (TCU_BASE + 0x48) /* Timer Counter Register */ 330#define TCU_TCNT0 (TCU_BASE + 0x48) /* Timer Counter Register */
331#define TCU_TCSR0 (TCU_BASE + 0x4C) /* Timer Control Register */ 331#define TCU_TCSR0 (TCU_BASE + 0x4C) /* Timer Control Register */
332#define TCU_TDFR1 (TCU_BASE + 0x50) 332#define TCU_TDFR1 (TCU_BASE + 0x50)
333#define TCU_TDHR1 (TCU_BASE + 0x54) 333#define TCU_TDHR1 (TCU_BASE + 0x54)
334#define TCU_TCNT1 (TCU_BASE + 0x58) 334#define TCU_TCNT1 (TCU_BASE + 0x58)
335#define TCU_TCSR1 (TCU_BASE + 0x5C) 335#define TCU_TCSR1 (TCU_BASE + 0x5C)
336#define TCU_TDFR2 (TCU_BASE + 0x60) 336#define TCU_TDFR2 (TCU_BASE + 0x60)
337#define TCU_TDHR2 (TCU_BASE + 0x64) 337#define TCU_TDHR2 (TCU_BASE + 0x64)
338#define TCU_TCNT2 (TCU_BASE + 0x68) 338#define TCU_TCNT2 (TCU_BASE + 0x68)
339#define TCU_TCSR2 (TCU_BASE + 0x6C) 339#define TCU_TCSR2 (TCU_BASE + 0x6C)
340#define TCU_TDFR3 (TCU_BASE + 0x70) 340#define TCU_TDFR3 (TCU_BASE + 0x70)
341#define TCU_TDHR3 (TCU_BASE + 0x74) 341#define TCU_TDHR3 (TCU_BASE + 0x74)
342#define TCU_TCNT3 (TCU_BASE + 0x78) 342#define TCU_TCNT3 (TCU_BASE + 0x78)
343#define TCU_TCSR3 (TCU_BASE + 0x7C) 343#define TCU_TCSR3 (TCU_BASE + 0x7C)
344#define TCU_TDFR4 (TCU_BASE + 0x80) 344#define TCU_TDFR4 (TCU_BASE + 0x80)
345#define TCU_TDHR4 (TCU_BASE + 0x84) 345#define TCU_TDHR4 (TCU_BASE + 0x84)
346#define TCU_TCNT4 (TCU_BASE + 0x88) 346#define TCU_TCNT4 (TCU_BASE + 0x88)
347#define TCU_TCSR4 (TCU_BASE + 0x8C) 347#define TCU_TCSR4 (TCU_BASE + 0x8C)
348#define TCU_TDFR5 (TCU_BASE + 0x90) 348#define TCU_TDFR5 (TCU_BASE + 0x90)
349#define TCU_TDHR5 (TCU_BASE + 0x94) 349#define TCU_TDHR5 (TCU_BASE + 0x94)
350#define TCU_TCNT5 (TCU_BASE + 0x98) 350#define TCU_TCNT5 (TCU_BASE + 0x98)
351#define TCU_TCSR5 (TCU_BASE + 0x9C) 351#define TCU_TCSR5 (TCU_BASE + 0x9C)
352 352
353#define REG_TCU_TSR REG32(TCU_TSR) 353#define REG_TCU_TSR REG32(TCU_TSR)
354#define REG_TCU_TSSR REG32(TCU_TSSR) 354#define REG_TCU_TSSR REG32(TCU_TSSR)
355#define REG_TCU_TSCR REG32(TCU_TSCR) 355#define REG_TCU_TSCR REG32(TCU_TSCR)
356#define REG_TCU_TER REG8(TCU_TER) 356#define REG_TCU_TER REG8(TCU_TER)
357#define REG_TCU_TESR REG8(TCU_TESR) 357#define REG_TCU_TESR REG8(TCU_TESR)
358#define REG_TCU_TECR REG8(TCU_TECR) 358#define REG_TCU_TECR REG8(TCU_TECR)
359#define REG_TCU_TFR REG32(TCU_TFR) 359#define REG_TCU_TFR REG32(TCU_TFR)
360#define REG_TCU_TFSR REG32(TCU_TFSR) 360#define REG_TCU_TFSR REG32(TCU_TFSR)
361#define REG_TCU_TFCR REG32(TCU_TFCR) 361#define REG_TCU_TFCR REG32(TCU_TFCR)
362#define REG_TCU_TMR REG32(TCU_TMR) 362#define REG_TCU_TMR REG32(TCU_TMR)
363#define REG_TCU_TMSR REG32(TCU_TMSR) 363#define REG_TCU_TMSR REG32(TCU_TMSR)
364#define REG_TCU_TMCR REG32(TCU_TMCR) 364#define REG_TCU_TMCR REG32(TCU_TMCR)
365#define REG_TCU_TDFR0 REG16(TCU_TDFR0) 365#define REG_TCU_TDFR0 REG16(TCU_TDFR0)
366#define REG_TCU_TDHR0 REG16(TCU_TDHR0) 366#define REG_TCU_TDHR0 REG16(TCU_TDHR0)
367#define REG_TCU_TCNT0 REG16(TCU_TCNT0) 367#define REG_TCU_TCNT0 REG16(TCU_TCNT0)
368#define REG_TCU_TCSR0 REG16(TCU_TCSR0) 368#define REG_TCU_TCSR0 REG16(TCU_TCSR0)
369#define REG_TCU_TDFR1 REG16(TCU_TDFR1) 369#define REG_TCU_TDFR1 REG16(TCU_TDFR1)
370#define REG_TCU_TDHR1 REG16(TCU_TDHR1) 370#define REG_TCU_TDHR1 REG16(TCU_TDHR1)
371#define REG_TCU_TCNT1 REG16(TCU_TCNT1) 371#define REG_TCU_TCNT1 REG16(TCU_TCNT1)
372#define REG_TCU_TCSR1 REG16(TCU_TCSR1) 372#define REG_TCU_TCSR1 REG16(TCU_TCSR1)
373#define REG_TCU_TDFR2 REG16(TCU_TDFR2) 373#define REG_TCU_TDFR2 REG16(TCU_TDFR2)
374#define REG_TCU_TDHR2 REG16(TCU_TDHR2) 374#define REG_TCU_TDHR2 REG16(TCU_TDHR2)
375#define REG_TCU_TCNT2 REG16(TCU_TCNT2) 375#define REG_TCU_TCNT2 REG16(TCU_TCNT2)
376#define REG_TCU_TCSR2 REG16(TCU_TCSR2) 376#define REG_TCU_TCSR2 REG16(TCU_TCSR2)
377#define REG_TCU_TDFR3 REG16(TCU_TDFR3) 377#define REG_TCU_TDFR3 REG16(TCU_TDFR3)
378#define REG_TCU_TDHR3 REG16(TCU_TDHR3) 378#define REG_TCU_TDHR3 REG16(TCU_TDHR3)
379#define REG_TCU_TCNT3 REG16(TCU_TCNT3) 379#define REG_TCU_TCNT3 REG16(TCU_TCNT3)
380#define REG_TCU_TCSR3 REG16(TCU_TCSR3) 380#define REG_TCU_TCSR3 REG16(TCU_TCSR3)
381#define REG_TCU_TDFR4 REG16(TCU_TDFR4) 381#define REG_TCU_TDFR4 REG16(TCU_TDFR4)
382#define REG_TCU_TDHR4 REG16(TCU_TDHR4) 382#define REG_TCU_TDHR4 REG16(TCU_TDHR4)
383#define REG_TCU_TCNT4 REG16(TCU_TCNT4) 383#define REG_TCU_TCNT4 REG16(TCU_TCNT4)
384#define REG_TCU_TCSR4 REG16(TCU_TCSR4) 384#define REG_TCU_TCSR4 REG16(TCU_TCSR4)
385 385
386// n = 0,1,2,3,4,5 386// n = 0,1,2,3,4,5
387#define TCU_TDFR(n) (TCU_BASE + (0x40 + (n)*0x10)) /* Timer Data Full Reg */ 387#define TCU_TDFR(n) (TCU_BASE + (0x40 + (n)*0x10)) /* Timer Data Full Reg */
388#define TCU_TDHR(n) (TCU_BASE + (0x44 + (n)*0x10)) /* Timer Data Half Reg */ 388#define TCU_TDHR(n) (TCU_BASE + (0x44 + (n)*0x10)) /* Timer Data Half Reg */
389#define TCU_TCNT(n) (TCU_BASE + (0x48 + (n)*0x10)) /* Timer Counter Reg */ 389#define TCU_TCNT(n) (TCU_BASE + (0x48 + (n)*0x10)) /* Timer Counter Reg */
390#define TCU_TCSR(n) (TCU_BASE + (0x4C + (n)*0x10)) /* Timer Control Reg */ 390#define TCU_TCSR(n) (TCU_BASE + (0x4C + (n)*0x10)) /* Timer Control Reg */
391 391
392#define REG_TCU_TDFR(n) REG16(TCU_TDFR((n))) 392#define REG_TCU_TDFR(n) REG16(TCU_TDFR((n)))
393#define REG_TCU_TDHR(n) REG16(TCU_TDHR((n))) 393#define REG_TCU_TDHR(n) REG16(TCU_TDHR((n)))
394#define REG_TCU_TCNT(n) REG16(TCU_TCNT((n))) 394#define REG_TCU_TCNT(n) REG16(TCU_TCNT((n)))
395#define REG_TCU_TCSR(n) REG16(TCU_TCSR((n))) 395#define REG_TCU_TCSR(n) REG16(TCU_TCSR((n)))
396 396
397// Register definitions 397// Register definitions
398#define TCU_TCSR_PWM_SD (1 << 9) 398#define TCU_TCSR_PWM_SD (1 << 9)
399#define TCU_TCSR_PWM_INITL_HIGH (1 << 8) 399#define TCU_TCSR_PWM_INITL_HIGH (1 << 8)
400#define TCU_TCSR_PWM_EN (1 << 7) 400#define TCU_TCSR_PWM_EN (1 << 7)
401#define TCU_TCSR_PRESCALE_BIT 3 401#define TCU_TCSR_PRESCALE_BIT 3
402#define TCU_TCSR_PRESCALE_MASK (0x7 << TCU_TCSR_PRESCALE_BIT) 402#define TCU_TCSR_PRESCALE_MASK (0x7 << TCU_TCSR_PRESCALE_BIT)
403 #define TCU_TCSR_PRESCALE1 (0x0 << TCU_TCSR_PRESCALE_BIT) 403 #define TCU_TCSR_PRESCALE1 (0x0 << TCU_TCSR_PRESCALE_BIT)
404 #define TCU_TCSR_PRESCALE4 (0x1 << TCU_TCSR_PRESCALE_BIT) 404 #define TCU_TCSR_PRESCALE4 (0x1 << TCU_TCSR_PRESCALE_BIT)
405 #define TCU_TCSR_PRESCALE16 (0x2 << TCU_TCSR_PRESCALE_BIT) 405 #define TCU_TCSR_PRESCALE16 (0x2 << TCU_TCSR_PRESCALE_BIT)
406 #define TCU_TCSR_PRESCALE64 (0x3 << TCU_TCSR_PRESCALE_BIT) 406 #define TCU_TCSR_PRESCALE64 (0x3 << TCU_TCSR_PRESCALE_BIT)
407 #define TCU_TCSR_PRESCALE256 (0x4 << TCU_TCSR_PRESCALE_BIT) 407 #define TCU_TCSR_PRESCALE256 (0x4 << TCU_TCSR_PRESCALE_BIT)
408 #define TCU_TCSR_PRESCALE1024 (0x5 << TCU_TCSR_PRESCALE_BIT) 408 #define TCU_TCSR_PRESCALE1024 (0x5 << TCU_TCSR_PRESCALE_BIT)
409#define TCU_TCSR_EXT_EN (1 << 2) 409#define TCU_TCSR_EXT_EN (1 << 2)
410#define TCU_TCSR_RTC_EN (1 << 1) 410#define TCU_TCSR_RTC_EN (1 << 1)
411#define TCU_TCSR_PCK_EN (1 << 0) 411#define TCU_TCSR_PCK_EN (1 << 0)
412 412
413#define TCU_TER_TCEN5 (1 << 5) 413#define TCU_TER_TCEN5 (1 << 5)
414#define TCU_TER_TCEN4 (1 << 4) 414#define TCU_TER_TCEN4 (1 << 4)
415#define TCU_TER_TCEN3 (1 << 3) 415#define TCU_TER_TCEN3 (1 << 3)
416#define TCU_TER_TCEN2 (1 << 2) 416#define TCU_TER_TCEN2 (1 << 2)
417#define TCU_TER_TCEN1 (1 << 1) 417#define TCU_TER_TCEN1 (1 << 1)
418#define TCU_TER_TCEN0 (1 << 0) 418#define TCU_TER_TCEN0 (1 << 0)
419 419
420#define TCU_TESR_TCST5 (1 << 5) 420#define TCU_TESR_TCST5 (1 << 5)
421#define TCU_TESR_TCST4 (1 << 4) 421#define TCU_TESR_TCST4 (1 << 4)
422#define TCU_TESR_TCST3 (1 << 3) 422#define TCU_TESR_TCST3 (1 << 3)
423#define TCU_TESR_TCST2 (1 << 2) 423#define TCU_TESR_TCST2 (1 << 2)
424#define TCU_TESR_TCST1 (1 << 1) 424#define TCU_TESR_TCST1 (1 << 1)
425#define TCU_TESR_TCST0 (1 << 0) 425#define TCU_TESR_TCST0 (1 << 0)
426 426
427#define TCU_TECR_TCCL5 (1 << 5) 427#define TCU_TECR_TCCL5 (1 << 5)
428#define TCU_TECR_TCCL4 (1 << 4) 428#define TCU_TECR_TCCL4 (1 << 4)
429#define TCU_TECR_TCCL3 (1 << 3) 429#define TCU_TECR_TCCL3 (1 << 3)
430#define TCU_TECR_TCCL2 (1 << 2) 430#define TCU_TECR_TCCL2 (1 << 2)
431#define TCU_TECR_TCCL1 (1 << 1) 431#define TCU_TECR_TCCL1 (1 << 1)
432#define TCU_TECR_TCCL0 (1 << 0) 432#define TCU_TECR_TCCL0 (1 << 0)
433 433
434#define TCU_TFR_HFLAG5 (1 << 21) 434#define TCU_TFR_HFLAG5 (1 << 21)
435#define TCU_TFR_HFLAG4 (1 << 20) 435#define TCU_TFR_HFLAG4 (1 << 20)
436#define TCU_TFR_HFLAG3 (1 << 19) 436#define TCU_TFR_HFLAG3 (1 << 19)
437#define TCU_TFR_HFLAG2 (1 << 18) 437#define TCU_TFR_HFLAG2 (1 << 18)
438#define TCU_TFR_HFLAG1 (1 << 17) 438#define TCU_TFR_HFLAG1 (1 << 17)
439#define TCU_TFR_HFLAG0 (1 << 16) 439#define TCU_TFR_HFLAG0 (1 << 16)
440#define TCU_TFR_FFLAG5 (1 << 5) 440#define TCU_TFR_FFLAG5 (1 << 5)
441#define TCU_TFR_FFLAG4 (1 << 4) 441#define TCU_TFR_FFLAG4 (1 << 4)
442#define TCU_TFR_FFLAG3 (1 << 3) 442#define TCU_TFR_FFLAG3 (1 << 3)
443#define TCU_TFR_FFLAG2 (1 << 2) 443#define TCU_TFR_FFLAG2 (1 << 2)
444#define TCU_TFR_FFLAG1 (1 << 1) 444#define TCU_TFR_FFLAG1 (1 << 1)
445#define TCU_TFR_FFLAG0 (1 << 0) 445#define TCU_TFR_FFLAG0 (1 << 0)
446 446
447#define TCU_TFSR_HFLAG5 (1 << 21) 447#define TCU_TFSR_HFLAG5 (1 << 21)
448#define TCU_TFSR_HFLAG4 (1 << 20) 448#define TCU_TFSR_HFLAG4 (1 << 20)
449#define TCU_TFSR_HFLAG3 (1 << 19) 449#define TCU_TFSR_HFLAG3 (1 << 19)
450#define TCU_TFSR_HFLAG2 (1 << 18) 450#define TCU_TFSR_HFLAG2 (1 << 18)
451#define TCU_TFSR_HFLAG1 (1 << 17) 451#define TCU_TFSR_HFLAG1 (1 << 17)
452#define TCU_TFSR_HFLAG0 (1 << 16) 452#define TCU_TFSR_HFLAG0 (1 << 16)
453#define TCU_TFSR_FFLAG5 (1 << 5) 453#define TCU_TFSR_FFLAG5 (1 << 5)
454#define TCU_TFSR_FFLAG4 (1 << 4) 454#define TCU_TFSR_FFLAG4 (1 << 4)
455#define TCU_TFSR_FFLAG3 (1 << 3) 455#define TCU_TFSR_FFLAG3 (1 << 3)
456#define TCU_TFSR_FFLAG2 (1 << 2) 456#define TCU_TFSR_FFLAG2 (1 << 2)
457#define TCU_TFSR_FFLAG1 (1 << 1) 457#define TCU_TFSR_FFLAG1 (1 << 1)
458#define TCU_TFSR_FFLAG0 (1 << 0) 458#define TCU_TFSR_FFLAG0 (1 << 0)
459 459
460#define TCU_TFCR_HFLAG5 (1 << 21) 460#define TCU_TFCR_HFLAG5 (1 << 21)
461#define TCU_TFCR_HFLAG4 (1 << 20) 461#define TCU_TFCR_HFLAG4 (1 << 20)
462#define TCU_TFCR_HFLAG3 (1 << 19) 462#define TCU_TFCR_HFLAG3 (1 << 19)
463#define TCU_TFCR_HFLAG2 (1 << 18) 463#define TCU_TFCR_HFLAG2 (1 << 18)
464#define TCU_TFCR_HFLAG1 (1 << 17) 464#define TCU_TFCR_HFLAG1 (1 << 17)
465#define TCU_TFCR_HFLAG0 (1 << 16) 465#define TCU_TFCR_HFLAG0 (1 << 16)
466#define TCU_TFCR_FFLAG5 (1 << 5) 466#define TCU_TFCR_FFLAG5 (1 << 5)
467#define TCU_TFCR_FFLAG4 (1 << 4) 467#define TCU_TFCR_FFLAG4 (1 << 4)
468#define TCU_TFCR_FFLAG3 (1 << 3) 468#define TCU_TFCR_FFLAG3 (1 << 3)
469#define TCU_TFCR_FFLAG2 (1 << 2) 469#define TCU_TFCR_FFLAG2 (1 << 2)
470#define TCU_TFCR_FFLAG1 (1 << 1) 470#define TCU_TFCR_FFLAG1 (1 << 1)
471#define TCU_TFCR_FFLAG0 (1 << 0) 471#define TCU_TFCR_FFLAG0 (1 << 0)
472 472
473#define TCU_TMR_HMASK5 (1 << 21) 473#define TCU_TMR_HMASK5 (1 << 21)
474#define TCU_TMR_HMASK4 (1 << 20) 474#define TCU_TMR_HMASK4 (1 << 20)
475#define TCU_TMR_HMASK3 (1 << 19) 475#define TCU_TMR_HMASK3 (1 << 19)
476#define TCU_TMR_HMASK2 (1 << 18) 476#define TCU_TMR_HMASK2 (1 << 18)
477#define TCU_TMR_HMASK1 (1 << 17) 477#define TCU_TMR_HMASK1 (1 << 17)
478#define TCU_TMR_HMASK0 (1 << 16) 478#define TCU_TMR_HMASK0 (1 << 16)
479#define TCU_TMR_FMASK5 (1 << 5) 479#define TCU_TMR_FMASK5 (1 << 5)
480#define TCU_TMR_FMASK4 (1 << 4) 480#define TCU_TMR_FMASK4 (1 << 4)
481#define TCU_TMR_FMASK3 (1 << 3) 481#define TCU_TMR_FMASK3 (1 << 3)
482#define TCU_TMR_FMASK2 (1 << 2) 482#define TCU_TMR_FMASK2 (1 << 2)
483#define TCU_TMR_FMASK1 (1 << 1) 483#define TCU_TMR_FMASK1 (1 << 1)
484#define TCU_TMR_FMASK0 (1 << 0) 484#define TCU_TMR_FMASK0 (1 << 0)
485 485
486#define TCU_TMSR_HMST5 (1 << 21) 486#define TCU_TMSR_HMST5 (1 << 21)
487#define TCU_TMSR_HMST4 (1 << 20) 487#define TCU_TMSR_HMST4 (1 << 20)
488#define TCU_TMSR_HMST3 (1 << 19) 488#define TCU_TMSR_HMST3 (1 << 19)
489#define TCU_TMSR_HMST2 (1 << 18) 489#define TCU_TMSR_HMST2 (1 << 18)
490#define TCU_TMSR_HMST1 (1 << 17) 490#define TCU_TMSR_HMST1 (1 << 17)
491#define TCU_TMSR_HMST0 (1 << 16) 491#define TCU_TMSR_HMST0 (1 << 16)
492#define TCU_TMSR_FMST5 (1 << 5) 492#define TCU_TMSR_FMST5 (1 << 5)
493#define TCU_TMSR_FMST4 (1 << 4) 493#define TCU_TMSR_FMST4 (1 << 4)
494#define TCU_TMSR_FMST3 (1 << 3) 494#define TCU_TMSR_FMST3 (1 << 3)
495#define TCU_TMSR_FMST2 (1 << 2) 495#define TCU_TMSR_FMST2 (1 << 2)
496#define TCU_TMSR_FMST1 (1 << 1) 496#define TCU_TMSR_FMST1 (1 << 1)
497#define TCU_TMSR_FMST0 (1 << 0) 497#define TCU_TMSR_FMST0 (1 << 0)
498 498
499#define TCU_TMCR_HMCL5 (1 << 21) 499#define TCU_TMCR_HMCL5 (1 << 21)
500#define TCU_TMCR_HMCL4 (1 << 20) 500#define TCU_TMCR_HMCL4 (1 << 20)
501#define TCU_TMCR_HMCL3 (1 << 19) 501#define TCU_TMCR_HMCL3 (1 << 19)
502#define TCU_TMCR_HMCL2 (1 << 18) 502#define TCU_TMCR_HMCL2 (1 << 18)
503#define TCU_TMCR_HMCL1 (1 << 17) 503#define TCU_TMCR_HMCL1 (1 << 17)
504#define TCU_TMCR_HMCL0 (1 << 16) 504#define TCU_TMCR_HMCL0 (1 << 16)
505#define TCU_TMCR_FMCL5 (1 << 5) 505#define TCU_TMCR_FMCL5 (1 << 5)
506#define TCU_TMCR_FMCL4 (1 << 4) 506#define TCU_TMCR_FMCL4 (1 << 4)
507#define TCU_TMCR_FMCL3 (1 << 3) 507#define TCU_TMCR_FMCL3 (1 << 3)
508#define TCU_TMCR_FMCL2 (1 << 2) 508#define TCU_TMCR_FMCL2 (1 << 2)
509#define TCU_TMCR_FMCL1 (1 << 1) 509#define TCU_TMCR_FMCL1 (1 << 1)
510#define TCU_TMCR_FMCL0 (1 << 0) 510#define TCU_TMCR_FMCL0 (1 << 0)
511 511
512#define TCU_TSR_WDTS (1 << 16) 512#define TCU_TSR_WDTS (1 << 16)
513#define TCU_TSR_STOP5 (1 << 5) 513#define TCU_TSR_STOP5 (1 << 5)
514#define TCU_TSR_STOP4 (1 << 4) 514#define TCU_TSR_STOP4 (1 << 4)
515#define TCU_TSR_STOP3 (1 << 3) 515#define TCU_TSR_STOP3 (1 << 3)
516#define TCU_TSR_STOP2 (1 << 2) 516#define TCU_TSR_STOP2 (1 << 2)
517#define TCU_TSR_STOP1 (1 << 1) 517#define TCU_TSR_STOP1 (1 << 1)
518#define TCU_TSR_STOP0 (1 << 0) 518#define TCU_TSR_STOP0 (1 << 0)
519 519
520#define TCU_TSSR_WDTSS (1 << 16) 520#define TCU_TSSR_WDTSS (1 << 16)
521#define TCU_TSSR_STPS5 (1 << 5) 521#define TCU_TSSR_STPS5 (1 << 5)
522#define TCU_TSSR_STPS4 (1 << 4) 522#define TCU_TSSR_STPS4 (1 << 4)
523#define TCU_TSSR_STPS3 (1 << 3) 523#define TCU_TSSR_STPS3 (1 << 3)
524#define TCU_TSSR_STPS2 (1 << 2) 524#define TCU_TSSR_STPS2 (1 << 2)
525#define TCU_TSSR_STPS1 (1 << 1) 525#define TCU_TSSR_STPS1 (1 << 1)
526#define TCU_TSSR_STPS0 (1 << 0) 526#define TCU_TSSR_STPS0 (1 << 0)
527 527
528#define TCU_TSSR_WDTSC (1 << 16) 528#define TCU_TSSR_WDTSC (1 << 16)
529#define TCU_TSSR_STPC5 (1 << 5) 529#define TCU_TSSR_STPC5 (1 << 5)
530#define TCU_TSSR_STPC4 (1 << 4) 530#define TCU_TSSR_STPC4 (1 << 4)
531#define TCU_TSSR_STPC3 (1 << 3) 531#define TCU_TSSR_STPC3 (1 << 3)
532#define TCU_TSSR_STPC2 (1 << 2) 532#define TCU_TSSR_STPC2 (1 << 2)
533#define TCU_TSSR_STPC1 (1 << 1) 533#define TCU_TSSR_STPC1 (1 << 1)
534#define TCU_TSSR_STPC0 (1 << 0) 534#define TCU_TSSR_STPC0 (1 << 0)
535 535
536 536
537/************************************************************************* 537/*************************************************************************
538 * WDT (WatchDog Timer) 538 * WDT (WatchDog Timer)
539 *************************************************************************/ 539 *************************************************************************/
540#define WDT_TDR (WDT_BASE + 0x00) 540#define WDT_TDR (WDT_BASE + 0x00)
541#define WDT_TCER (WDT_BASE + 0x04) 541#define WDT_TCER (WDT_BASE + 0x04)
542#define WDT_TCNT (WDT_BASE + 0x08) 542#define WDT_TCNT (WDT_BASE + 0x08)
543#define WDT_TCSR (WDT_BASE + 0x0C) 543#define WDT_TCSR (WDT_BASE + 0x0C)
544 544
545#define REG_WDT_TDR REG16(WDT_TDR) 545#define REG_WDT_TDR REG16(WDT_TDR)
546#define REG_WDT_TCER REG8(WDT_TCER) 546#define REG_WDT_TCER REG8(WDT_TCER)
547#define REG_WDT_TCNT REG16(WDT_TCNT) 547#define REG_WDT_TCNT REG16(WDT_TCNT)
548#define REG_WDT_TCSR REG16(WDT_TCSR) 548#define REG_WDT_TCSR REG16(WDT_TCSR)
549 549
550// Register definition 550// Register definition
551#define WDT_TCSR_PRESCALE_BIT 3 551#define WDT_TCSR_PRESCALE_BIT 3
552#define WDT_TCSR_PRESCALE_MASK (0x7 << WDT_TCSR_PRESCALE_BIT) 552#define WDT_TCSR_PRESCALE_MASK (0x7 << WDT_TCSR_PRESCALE_BIT)
553 #define WDT_TCSR_PRESCALE1 (0x0 << WDT_TCSR_PRESCALE_BIT) 553 #define WDT_TCSR_PRESCALE1 (0x0 << WDT_TCSR_PRESCALE_BIT)
554 #define WDT_TCSR_PRESCALE4 (0x1 << WDT_TCSR_PRESCALE_BIT) 554 #define WDT_TCSR_PRESCALE4 (0x1 << WDT_TCSR_PRESCALE_BIT)
555 #define WDT_TCSR_PRESCALE16 (0x2 << WDT_TCSR_PRESCALE_BIT) 555 #define WDT_TCSR_PRESCALE16 (0x2 << WDT_TCSR_PRESCALE_BIT)
556 #define WDT_TCSR_PRESCALE64 (0x3 << WDT_TCSR_PRESCALE_BIT) 556 #define WDT_TCSR_PRESCALE64 (0x3 << WDT_TCSR_PRESCALE_BIT)
557 #define WDT_TCSR_PRESCALE256 (0x4 << WDT_TCSR_PRESCALE_BIT) 557 #define WDT_TCSR_PRESCALE256 (0x4 << WDT_TCSR_PRESCALE_BIT)
558 #define WDT_TCSR_PRESCALE1024 (0x5 << WDT_TCSR_PRESCALE_BIT) 558 #define WDT_TCSR_PRESCALE1024 (0x5 << WDT_TCSR_PRESCALE_BIT)
559#define WDT_TCSR_EXT_EN (1 << 2) 559#define WDT_TCSR_EXT_EN (1 << 2)
560#define WDT_TCSR_RTC_EN (1 << 1) 560#define WDT_TCSR_RTC_EN (1 << 1)
561#define WDT_TCSR_PCK_EN (1 << 0) 561#define WDT_TCSR_PCK_EN (1 << 0)
562 562
563#define WDT_TCER_TCEN (1 << 0) 563#define WDT_TCER_TCEN (1 << 0)
564 564
565 565
566/************************************************************************* 566/*************************************************************************
567 * DMAC (DMA Controller) 567 * DMAC (DMA Controller)
568 *************************************************************************/ 568 *************************************************************************/
569 569
570#define MAX_DMA_NUM 6 /* max 6 channels */ 570#define MAX_DMA_NUM 6 /* max 6 channels */
571 571
572#define DMAC_DSAR(n) (DMAC_BASE + (0x00 + (n) * 0x20)) /* DMA source address */ 572#define DMAC_DSAR(n) (DMAC_BASE + (0x00 + (n) * 0x20)) /* DMA source address */
573#define DMAC_DTAR(n) (DMAC_BASE + (0x04 + (n) * 0x20)) /* DMA target address */ 573#define DMAC_DTAR(n) (DMAC_BASE + (0x04 + (n) * 0x20)) /* DMA target address */
574#define DMAC_DTCR(n) (DMAC_BASE + (0x08 + (n) * 0x20)) /* DMA transfer count */ 574#define DMAC_DTCR(n) (DMAC_BASE + (0x08 + (n) * 0x20)) /* DMA transfer count */
575#define DMAC_DRSR(n) (DMAC_BASE + (0x0c + (n) * 0x20)) /* DMA request source */ 575#define DMAC_DRSR(n) (DMAC_BASE + (0x0c + (n) * 0x20)) /* DMA request source */
576#define DMAC_DCCSR(n) (DMAC_BASE + (0x10 + (n) * 0x20)) /* DMA control/status */ 576#define DMAC_DCCSR(n) (DMAC_BASE + (0x10 + (n) * 0x20)) /* DMA control/status */
577#define DMAC_DCMD(n) (DMAC_BASE + (0x14 + (n) * 0x20)) /* DMA command */ 577#define DMAC_DCMD(n) (DMAC_BASE + (0x14 + (n) * 0x20)) /* DMA command */
578#define DMAC_DDA(n) (DMAC_BASE + (0x18 + (n) * 0x20)) /* DMA descriptor address */ 578#define DMAC_DDA(n) (DMAC_BASE + (0x18 + (n) * 0x20)) /* DMA descriptor address */
579#define DMAC_DMACR (DMAC_BASE + 0x0300) /* DMA control register */ 579#define DMAC_DMACR (DMAC_BASE + 0x0300) /* DMA control register */
580#define DMAC_DMAIPR (DMAC_BASE + 0x0304) /* DMA interrupt pending */ 580#define DMAC_DMAIPR (DMAC_BASE + 0x0304) /* DMA interrupt pending */
581#define DMAC_DMADBR (DMAC_BASE + 0x0308) /* DMA doorbell */ 581#define DMAC_DMADBR (DMAC_BASE + 0x0308) /* DMA doorbell */
582#define DMAC_DMADBSR (DMAC_BASE + 0x030C) /* DMA doorbell set */ 582#define DMAC_DMADBSR (DMAC_BASE + 0x030C) /* DMA doorbell set */
583 583
584// channel 0 584// channel 0
585#define DMAC_DSAR0 DMAC_DSAR(0) 585#define DMAC_DSAR0 DMAC_DSAR(0)
@@ -587,8 +587,8 @@
587#define DMAC_DTCR0 DMAC_DTCR(0) 587#define DMAC_DTCR0 DMAC_DTCR(0)
588#define DMAC_DRSR0 DMAC_DRSR(0) 588#define DMAC_DRSR0 DMAC_DRSR(0)
589#define DMAC_DCCSR0 DMAC_DCCSR(0) 589#define DMAC_DCCSR0 DMAC_DCCSR(0)
590#define DMAC_DCMD0 DMAC_DCMD(0) 590#define DMAC_DCMD0 DMAC_DCMD(0)
591#define DMAC_DDA0 DMAC_DDA(0) 591#define DMAC_DDA0 DMAC_DDA(0)
592 592
593// channel 1 593// channel 1
594#define DMAC_DSAR1 DMAC_DSAR(1) 594#define DMAC_DSAR1 DMAC_DSAR(1)
@@ -596,8 +596,8 @@
596#define DMAC_DTCR1 DMAC_DTCR(1) 596#define DMAC_DTCR1 DMAC_DTCR(1)
597#define DMAC_DRSR1 DMAC_DRSR(1) 597#define DMAC_DRSR1 DMAC_DRSR(1)
598#define DMAC_DCCSR1 DMAC_DCCSR(1) 598#define DMAC_DCCSR1 DMAC_DCCSR(1)
599#define DMAC_DCMD1 DMAC_DCMD(1) 599#define DMAC_DCMD1 DMAC_DCMD(1)
600#define DMAC_DDA1 DMAC_DDA(1) 600#define DMAC_DDA1 DMAC_DDA(1)
601 601
602// channel 2 602// channel 2
603#define DMAC_DSAR2 DMAC_DSAR(2) 603#define DMAC_DSAR2 DMAC_DSAR(2)
@@ -605,8 +605,8 @@
605#define DMAC_DTCR2 DMAC_DTCR(2) 605#define DMAC_DTCR2 DMAC_DTCR(2)
606#define DMAC_DRSR2 DMAC_DRSR(2) 606#define DMAC_DRSR2 DMAC_DRSR(2)
607#define DMAC_DCCSR2 DMAC_DCCSR(2) 607#define DMAC_DCCSR2 DMAC_DCCSR(2)
608#define DMAC_DCMD2 DMAC_DCMD(2) 608#define DMAC_DCMD2 DMAC_DCMD(2)
609#define DMAC_DDA2 DMAC_DDA(2) 609#define DMAC_DDA2 DMAC_DDA(2)
610 610
611// channel 3 611// channel 3
612#define DMAC_DSAR3 DMAC_DSAR(3) 612#define DMAC_DSAR3 DMAC_DSAR(3)
@@ -614,8 +614,8 @@
614#define DMAC_DTCR3 DMAC_DTCR(3) 614#define DMAC_DTCR3 DMAC_DTCR(3)
615#define DMAC_DRSR3 DMAC_DRSR(3) 615#define DMAC_DRSR3 DMAC_DRSR(3)
616#define DMAC_DCCSR3 DMAC_DCCSR(3) 616#define DMAC_DCCSR3 DMAC_DCCSR(3)
617#define DMAC_DCMD3 DMAC_DCMD(3) 617#define DMAC_DCMD3 DMAC_DCMD(3)
618#define DMAC_DDA3 DMAC_DDA(3) 618#define DMAC_DDA3 DMAC_DDA(3)
619 619
620// channel 4 620// channel 4
621#define DMAC_DSAR4 DMAC_DSAR(4) 621#define DMAC_DSAR4 DMAC_DSAR(4)
@@ -623,8 +623,8 @@
623#define DMAC_DTCR4 DMAC_DTCR(4) 623#define DMAC_DTCR4 DMAC_DTCR(4)
624#define DMAC_DRSR4 DMAC_DRSR(4) 624#define DMAC_DRSR4 DMAC_DRSR(4)
625#define DMAC_DCCSR4 DMAC_DCCSR(4) 625#define DMAC_DCCSR4 DMAC_DCCSR(4)
626#define DMAC_DCMD4 DMAC_DCMD(4) 626#define DMAC_DCMD4 DMAC_DCMD(4)
627#define DMAC_DDA4 DMAC_DDA(4) 627#define DMAC_DDA4 DMAC_DDA(4)
628 628
629// channel 5 629// channel 5
630#define DMAC_DSAR5 DMAC_DSAR(5) 630#define DMAC_DSAR5 DMAC_DSAR(5)
@@ -632,1179 +632,1179 @@
632#define DMAC_DTCR5 DMAC_DTCR(5) 632#define DMAC_DTCR5 DMAC_DTCR(5)
633#define DMAC_DRSR5 DMAC_DRSR(5) 633#define DMAC_DRSR5 DMAC_DRSR(5)
634#define DMAC_DCCSR5 DMAC_DCCSR(5) 634#define DMAC_DCCSR5 DMAC_DCCSR(5)
635#define DMAC_DCMD5 DMAC_DCMD(5) 635#define DMAC_DCMD5 DMAC_DCMD(5)
636#define DMAC_DDA5 DMAC_DDA(5) 636#define DMAC_DDA5 DMAC_DDA(5)
637 637
638#define REG_DMAC_DSAR(n) REG32(DMAC_DSAR((n))) 638#define REG_DMAC_DSAR(n) REG32(DMAC_DSAR((n)))
639#define REG_DMAC_DTAR(n) REG32(DMAC_DTAR((n))) 639#define REG_DMAC_DTAR(n) REG32(DMAC_DTAR((n)))
640#define REG_DMAC_DTCR(n) REG32(DMAC_DTCR((n))) 640#define REG_DMAC_DTCR(n) REG32(DMAC_DTCR((n)))
641#define REG_DMAC_DRSR(n) REG32(DMAC_DRSR((n))) 641#define REG_DMAC_DRSR(n) REG32(DMAC_DRSR((n)))
642#define REG_DMAC_DCCSR(n) REG32(DMAC_DCCSR((n))) 642#define REG_DMAC_DCCSR(n) REG32(DMAC_DCCSR((n)))
643#define REG_DMAC_DCMD(n) REG32(DMAC_DCMD((n))) 643#define REG_DMAC_DCMD(n) REG32(DMAC_DCMD((n)))
644#define REG_DMAC_DDA(n) REG32(DMAC_DDA((n))) 644#define REG_DMAC_DDA(n) REG32(DMAC_DDA((n)))
645#define REG_DMAC_DMACR REG32(DMAC_DMACR) 645#define REG_DMAC_DMACR REG32(DMAC_DMACR)
646#define REG_DMAC_DMAIPR REG32(DMAC_DMAIPR) 646#define REG_DMAC_DMAIPR REG32(DMAC_DMAIPR)
647#define REG_DMAC_DMADBR REG32(DMAC_DMADBR) 647#define REG_DMAC_DMADBR REG32(DMAC_DMADBR)
648#define REG_DMAC_DMADBSR REG32(DMAC_DMADBSR) 648#define REG_DMAC_DMADBSR REG32(DMAC_DMADBSR)
649 649
650// DMA request source register 650// DMA request source register
651#define DMAC_DRSR_RS_BIT 0 651#define DMAC_DRSR_RS_BIT 0
652#define DMAC_DRSR_RS_MASK (0x1f << DMAC_DRSR_RS_BIT) 652#define DMAC_DRSR_RS_MASK (0x1f << DMAC_DRSR_RS_BIT)
653 #define DMAC_DRSR_RS_AUTO (8 << DMAC_DRSR_RS_BIT) 653 #define DMAC_DRSR_RS_AUTO (8 << DMAC_DRSR_RS_BIT)
654 #define DMAC_DRSR_RS_UART0OUT (20 << DMAC_DRSR_RS_BIT) 654 #define DMAC_DRSR_RS_UART0OUT (20 << DMAC_DRSR_RS_BIT)
655 #define DMAC_DRSR_RS_UART0IN (21 << DMAC_DRSR_RS_BIT) 655 #define DMAC_DRSR_RS_UART0IN (21 << DMAC_DRSR_RS_BIT)
656 #define DMAC_DRSR_RS_SSIOUT (22 << DMAC_DRSR_RS_BIT) 656 #define DMAC_DRSR_RS_SSIOUT (22 << DMAC_DRSR_RS_BIT)
657 #define DMAC_DRSR_RS_SSIIN (23 << DMAC_DRSR_RS_BIT) 657 #define DMAC_DRSR_RS_SSIIN (23 << DMAC_DRSR_RS_BIT)
658 #define DMAC_DRSR_RS_AICOUT (24 << DMAC_DRSR_RS_BIT) 658 #define DMAC_DRSR_RS_AICOUT (24 << DMAC_DRSR_RS_BIT)
659 #define DMAC_DRSR_RS_AICIN (25 << DMAC_DRSR_RS_BIT) 659 #define DMAC_DRSR_RS_AICIN (25 << DMAC_DRSR_RS_BIT)
660 #define DMAC_DRSR_RS_MSCOUT (26 << DMAC_DRSR_RS_BIT) 660 #define DMAC_DRSR_RS_MSCOUT (26 << DMAC_DRSR_RS_BIT)
661 #define DMAC_DRSR_RS_MSCIN (27 << DMAC_DRSR_RS_BIT) 661 #define DMAC_DRSR_RS_MSCIN (27 << DMAC_DRSR_RS_BIT)
662 #define DMAC_DRSR_RS_TCU (28 << DMAC_DRSR_RS_BIT) 662 #define DMAC_DRSR_RS_TCU (28 << DMAC_DRSR_RS_BIT)
663 #define DMAC_DRSR_RS_SADC (29 << DMAC_DRSR_RS_BIT) 663 #define DMAC_DRSR_RS_SADC (29 << DMAC_DRSR_RS_BIT)
664 #define DMAC_DRSR_RS_SLCD (30 << DMAC_DRSR_RS_BIT) 664 #define DMAC_DRSR_RS_SLCD (30 << DMAC_DRSR_RS_BIT)
665 665
666// DMA channel control/status register 666// DMA channel control/status register
667#define DMAC_DCCSR_NDES (1 << 31) /* descriptor (0) or not (1) ? */ 667#define DMAC_DCCSR_NDES (1 << 31) /* descriptor (0) or not (1) ? */
668#define DMAC_DCCSR_CDOA_BIT 16 /* copy of DMA offset address */ 668#define DMAC_DCCSR_CDOA_BIT 16 /* copy of DMA offset address */
669#define DMAC_DCCSR_CDOA_MASK (0xff << DMAC_DCCSR_CDOA_BIT) 669#define DMAC_DCCSR_CDOA_MASK (0xff << DMAC_DCCSR_CDOA_BIT)
670#define DMAC_DCCSR_INV (1 << 6) /* descriptor invalid */ 670#define DMAC_DCCSR_INV (1 << 6) /* descriptor invalid */
671#define DMAC_DCCSR_AR (1 << 4) /* address error */ 671#define DMAC_DCCSR_AR (1 << 4) /* address error */
672#define DMAC_DCCSR_TT (1 << 3) /* transfer terminated */ 672#define DMAC_DCCSR_TT (1 << 3) /* transfer terminated */
673#define DMAC_DCCSR_HLT (1 << 2) /* DMA halted */ 673#define DMAC_DCCSR_HLT (1 << 2) /* DMA halted */
674#define DMAC_DCCSR_CT (1 << 1) /* count terminated */ 674#define DMAC_DCCSR_CT (1 << 1) /* count terminated */
675#define DMAC_DCCSR_EN (1 << 0) /* channel enable bit */ 675#define DMAC_DCCSR_EN (1 << 0) /* channel enable bit */
676 676
677// DMA channel command register 677// DMA channel command register
678#define DMAC_DCMD_SAI (1 << 23) /* source address increment */ 678#define DMAC_DCMD_SAI (1 << 23) /* source address increment */
679#define DMAC_DCMD_DAI (1 << 22) /* dest address increment */ 679#define DMAC_DCMD_DAI (1 << 22) /* dest address increment */
680#define DMAC_DCMD_RDIL_BIT 16 /* request detection interval length */ 680#define DMAC_DCMD_RDIL_BIT 16 /* request detection interval length */
681#define DMAC_DCMD_RDIL_MASK (0x0f << DMAC_DCMD_RDIL_BIT) 681#define DMAC_DCMD_RDIL_MASK (0x0f << DMAC_DCMD_RDIL_BIT)
682 #define DMAC_DCMD_RDIL_IGN (0 << DMAC_DCMD_RDIL_BIT) 682 #define DMAC_DCMD_RDIL_IGN (0 << DMAC_DCMD_RDIL_BIT)
683 #define DMAC_DCMD_RDIL_2 (1 << DMAC_DCMD_RDIL_BIT) 683 #define DMAC_DCMD_RDIL_2 (1 << DMAC_DCMD_RDIL_BIT)
684 #define DMAC_DCMD_RDIL_4 (2 << DMAC_DCMD_RDIL_BIT) 684 #define DMAC_DCMD_RDIL_4 (2 << DMAC_DCMD_RDIL_BIT)
685 #define DMAC_DCMD_RDIL_8 (3 << DMAC_DCMD_RDIL_BIT) 685 #define DMAC_DCMD_RDIL_8 (3 << DMAC_DCMD_RDIL_BIT)
686 #define DMAC_DCMD_RDIL_12 (4 << DMAC_DCMD_RDIL_BIT) 686 #define DMAC_DCMD_RDIL_12 (4 << DMAC_DCMD_RDIL_BIT)
687 #define DMAC_DCMD_RDIL_16 (5 << DMAC_DCMD_RDIL_BIT) 687 #define DMAC_DCMD_RDIL_16 (5 << DMAC_DCMD_RDIL_BIT)
688 #define DMAC_DCMD_RDIL_20 (6 << DMAC_DCMD_RDIL_BIT) 688 #define DMAC_DCMD_RDIL_20 (6 << DMAC_DCMD_RDIL_BIT)
689 #define DMAC_DCMD_RDIL_24 (7 << DMAC_DCMD_RDIL_BIT) 689 #define DMAC_DCMD_RDIL_24 (7 << DMAC_DCMD_RDIL_BIT)
690 #define DMAC_DCMD_RDIL_28 (8 << DMAC_DCMD_RDIL_BIT) 690 #define DMAC_DCMD_RDIL_28 (8 << DMAC_DCMD_RDIL_BIT)
691 #define DMAC_DCMD_RDIL_32 (9 << DMAC_DCMD_RDIL_BIT) 691 #define DMAC_DCMD_RDIL_32 (9 << DMAC_DCMD_RDIL_BIT)
692 #define DMAC_DCMD_RDIL_48 (10 << DMAC_DCMD_RDIL_BIT) 692 #define DMAC_DCMD_RDIL_48 (10 << DMAC_DCMD_RDIL_BIT)
693 #define DMAC_DCMD_RDIL_60 (11 << DMAC_DCMD_RDIL_BIT) 693 #define DMAC_DCMD_RDIL_60 (11 << DMAC_DCMD_RDIL_BIT)
694 #define DMAC_DCMD_RDIL_64 (12 << DMAC_DCMD_RDIL_BIT) 694 #define DMAC_DCMD_RDIL_64 (12 << DMAC_DCMD_RDIL_BIT)
695 #define DMAC_DCMD_RDIL_124 (13 << DMAC_DCMD_RDIL_BIT) 695 #define DMAC_DCMD_RDIL_124 (13 << DMAC_DCMD_RDIL_BIT)
696 #define DMAC_DCMD_RDIL_128 (14 << DMAC_DCMD_RDIL_BIT) 696 #define DMAC_DCMD_RDIL_128 (14 << DMAC_DCMD_RDIL_BIT)
697 #define DMAC_DCMD_RDIL_200 (15 << DMAC_DCMD_RDIL_BIT) 697 #define DMAC_DCMD_RDIL_200 (15 << DMAC_DCMD_RDIL_BIT)
698#define DMAC_DCMD_SWDH_BIT 14 /* source port width */ 698#define DMAC_DCMD_SWDH_BIT 14 /* source port width */
699#define DMAC_DCMD_SWDH_MASK (0x03 << DMAC_DCMD_SWDH_BIT) 699#define DMAC_DCMD_SWDH_MASK (0x03 << DMAC_DCMD_SWDH_BIT)
700 #define DMAC_DCMD_SWDH_32 (0 << DMAC_DCMD_SWDH_BIT) 700 #define DMAC_DCMD_SWDH_32 (0 << DMAC_DCMD_SWDH_BIT)
701 #define DMAC_DCMD_SWDH_8 (1 << DMAC_DCMD_SWDH_BIT) 701 #define DMAC_DCMD_SWDH_8 (1 << DMAC_DCMD_SWDH_BIT)
702 #define DMAC_DCMD_SWDH_16 (2 << DMAC_DCMD_SWDH_BIT) 702 #define DMAC_DCMD_SWDH_16 (2 << DMAC_DCMD_SWDH_BIT)
703#define DMAC_DCMD_DWDH_BIT 12 /* dest port width */ 703#define DMAC_DCMD_DWDH_BIT 12 /* dest port width */
704#define DMAC_DCMD_DWDH_MASK (0x03 << DMAC_DCMD_DWDH_BIT) 704#define DMAC_DCMD_DWDH_MASK (0x03 << DMAC_DCMD_DWDH_BIT)
705 #define DMAC_DCMD_DWDH_32 (0 << DMAC_DCMD_DWDH_BIT) 705 #define DMAC_DCMD_DWDH_32 (0 << DMAC_DCMD_DWDH_BIT)
706 #define DMAC_DCMD_DWDH_8 (1 << DMAC_DCMD_DWDH_BIT) 706 #define DMAC_DCMD_DWDH_8 (1 << DMAC_DCMD_DWDH_BIT)
707 #define DMAC_DCMD_DWDH_16 (2 << DMAC_DCMD_DWDH_BIT) 707 #define DMAC_DCMD_DWDH_16 (2 << DMAC_DCMD_DWDH_BIT)
708#define DMAC_DCMD_DS_BIT 8 /* transfer data size of a data unit */ 708#define DMAC_DCMD_DS_BIT 8 /* transfer data size of a data unit */
709#define DMAC_DCMD_DS_MASK (0x07 << DMAC_DCMD_DS_BIT) 709#define DMAC_DCMD_DS_MASK (0x07 << DMAC_DCMD_DS_BIT)
710 #define DMAC_DCMD_DS_32BIT (0 << DMAC_DCMD_DS_BIT) 710 #define DMAC_DCMD_DS_32BIT (0 << DMAC_DCMD_DS_BIT)
711 #define DMAC_DCMD_DS_8BIT (1 << DMAC_DCMD_DS_BIT) 711 #define DMAC_DCMD_DS_8BIT (1 << DMAC_DCMD_DS_BIT)
712 #define DMAC_DCMD_DS_16BIT (2 << DMAC_DCMD_DS_BIT) 712 #define DMAC_DCMD_DS_16BIT (2 << DMAC_DCMD_DS_BIT)
713 #define DMAC_DCMD_DS_16BYTE (3 << DMAC_DCMD_DS_BIT) 713 #define DMAC_DCMD_DS_16BYTE (3 << DMAC_DCMD_DS_BIT)
714 #define DMAC_DCMD_DS_32BYTE (4 << DMAC_DCMD_DS_BIT) 714 #define DMAC_DCMD_DS_32BYTE (4 << DMAC_DCMD_DS_BIT)
715#define DMAC_DCMD_TM (1 << 7) /* transfer mode: 0-single 1-block */ 715#define DMAC_DCMD_TM (1 << 7) /* transfer mode: 0-single 1-block */
716#define DMAC_DCMD_DES_V (1 << 4) /* descriptor valid flag */ 716#define DMAC_DCMD_DES_V (1 << 4) /* descriptor valid flag */
717#define DMAC_DCMD_DES_VM (1 << 3) /* descriptor valid mask: 1:support V-bit */ 717#define DMAC_DCMD_DES_VM (1 << 3) /* descriptor valid mask: 1:support V-bit */
718#define DMAC_DCMD_DES_VIE (1 << 2) /* DMA valid error interrupt enable */ 718#define DMAC_DCMD_DES_VIE (1 << 2) /* DMA valid error interrupt enable */
719#define DMAC_DCMD_TIE (1 << 1) /* DMA transfer interrupt enable */ 719#define DMAC_DCMD_TIE (1 << 1) /* DMA transfer interrupt enable */
720#define DMAC_DCMD_LINK (1 << 0) /* descriptor link enable */ 720#define DMAC_DCMD_LINK (1 << 0) /* descriptor link enable */
721 721
722// DMA descriptor address register 722// DMA descriptor address register
723#define DMAC_DDA_BASE_BIT 12 /* descriptor base address */ 723#define DMAC_DDA_BASE_BIT 12 /* descriptor base address */
724#define DMAC_DDA_BASE_MASK (0x0fffff << DMAC_DDA_BASE_BIT) 724#define DMAC_DDA_BASE_MASK (0x0fffff << DMAC_DDA_BASE_BIT)
725#define DMAC_DDA_OFFSET_BIT 4 /* descriptor offset address */ 725#define DMAC_DDA_OFFSET_BIT 4 /* descriptor offset address */
726#define DMAC_DDA_OFFSET_MASK (0x0ff << DMAC_DDA_OFFSET_BIT) 726#define DMAC_DDA_OFFSET_MASK (0x0ff << DMAC_DDA_OFFSET_BIT)
727 727
728// DMA control register 728// DMA control register
729#define DMAC_DMACR_PR_BIT 8 /* channel priority mode */ 729#define DMAC_DMACR_PR_BIT 8 /* channel priority mode */
730#define DMAC_DMACR_PR_MASK (0x03 << DMAC_DMACR_PR_BIT) 730#define DMAC_DMACR_PR_MASK (0x03 << DMAC_DMACR_PR_BIT)
731 #define DMAC_DMACR_PR_012345 (0 << DMAC_DMACR_PR_BIT) 731 #define DMAC_DMACR_PR_012345 (0 << DMAC_DMACR_PR_BIT)
732 #define DMAC_DMACR_PR_023145 (1 << DMAC_DMACR_PR_BIT) 732 #define DMAC_DMACR_PR_023145 (1 << DMAC_DMACR_PR_BIT)
733 #define DMAC_DMACR_PR_201345 (2 << DMAC_DMACR_PR_BIT) 733 #define DMAC_DMACR_PR_201345 (2 << DMAC_DMACR_PR_BIT)
734 #define DMAC_DMACR_PR_RR (3 << DMAC_DMACR_PR_BIT) /* round robin */ 734 #define DMAC_DMACR_PR_RR (3 << DMAC_DMACR_PR_BIT) /* round robin */
735#define DMAC_DMACR_HLT (1 << 3) /* DMA halt flag */ 735#define DMAC_DMACR_HLT (1 << 3) /* DMA halt flag */
736#define DMAC_DMACR_AR (1 << 2) /* address error flag */ 736#define DMAC_DMACR_AR (1 << 2) /* address error flag */
737#define DMAC_DMACR_DMAE (1 << 0) /* DMA enable bit */ 737#define DMAC_DMACR_DMAE (1 << 0) /* DMA enable bit */
738 738
739// DMA doorbell register 739// DMA doorbell register
740#define DMAC_DMADBR_DB5 (1 << 5) /* doorbell for channel 5 */ 740#define DMAC_DMADBR_DB5 (1 << 5) /* doorbell for channel 5 */
741#define DMAC_DMADBR_DB4 (1 << 5) /* doorbell for channel 4 */ 741#define DMAC_DMADBR_DB4 (1 << 5) /* doorbell for channel 4 */
742#define DMAC_DMADBR_DB3 (1 << 5) /* doorbell for channel 3 */ 742#define DMAC_DMADBR_DB3 (1 << 5) /* doorbell for channel 3 */
743#define DMAC_DMADBR_DB2 (1 << 5) /* doorbell for channel 2 */ 743#define DMAC_DMADBR_DB2 (1 << 5) /* doorbell for channel 2 */
744#define DMAC_DMADBR_DB1 (1 << 5) /* doorbell for channel 1 */ 744#define DMAC_DMADBR_DB1 (1 << 5) /* doorbell for channel 1 */
745#define DMAC_DMADBR_DB0 (1 << 5) /* doorbell for channel 0 */ 745#define DMAC_DMADBR_DB0 (1 << 5) /* doorbell for channel 0 */
746 746
747// DMA doorbell set register 747// DMA doorbell set register
748#define DMAC_DMADBSR_DBS5 (1 << 5) /* enable doorbell for channel 5 */ 748#define DMAC_DMADBSR_DBS5 (1 << 5) /* enable doorbell for channel 5 */
749#define DMAC_DMADBSR_DBS4 (1 << 5) /* enable doorbell for channel 4 */ 749#define DMAC_DMADBSR_DBS4 (1 << 5) /* enable doorbell for channel 4 */
750#define DMAC_DMADBSR_DBS3 (1 << 5) /* enable doorbell for channel 3 */ 750#define DMAC_DMADBSR_DBS3 (1 << 5) /* enable doorbell for channel 3 */
751#define DMAC_DMADBSR_DBS2 (1 << 5) /* enable doorbell for channel 2 */ 751#define DMAC_DMADBSR_DBS2 (1 << 5) /* enable doorbell for channel 2 */
752#define DMAC_DMADBSR_DBS1 (1 << 5) /* enable doorbell for channel 1 */ 752#define DMAC_DMADBSR_DBS1 (1 << 5) /* enable doorbell for channel 1 */
753#define DMAC_DMADBSR_DBS0 (1 << 5) /* enable doorbell for channel 0 */ 753#define DMAC_DMADBSR_DBS0 (1 << 5) /* enable doorbell for channel 0 */
754 754
755// DMA interrupt pending register 755// DMA interrupt pending register
756#define DMAC_DMAIPR_CIRQ5 (1 << 5) /* irq pending status for channel 5 */ 756#define DMAC_DMAIPR_CIRQ5 (1 << 5) /* irq pending status for channel 5 */
757#define DMAC_DMAIPR_CIRQ4 (1 << 4) /* irq pending status for channel 4 */ 757#define DMAC_DMAIPR_CIRQ4 (1 << 4) /* irq pending status for channel 4 */
758#define DMAC_DMAIPR_CIRQ3 (1 << 3) /* irq pending status for channel 3 */ 758#define DMAC_DMAIPR_CIRQ3 (1 << 3) /* irq pending status for channel 3 */
759#define DMAC_DMAIPR_CIRQ2 (1 << 2) /* irq pending status for channel 2 */ 759#define DMAC_DMAIPR_CIRQ2 (1 << 2) /* irq pending status for channel 2 */
760#define DMAC_DMAIPR_CIRQ1 (1 << 1) /* irq pending status for channel 1 */ 760#define DMAC_DMAIPR_CIRQ1 (1 << 1) /* irq pending status for channel 1 */
761#define DMAC_DMAIPR_CIRQ0 (1 << 0) /* irq pending status for channel 0 */ 761#define DMAC_DMAIPR_CIRQ0 (1 << 0) /* irq pending status for channel 0 */
762 762
763 763
764/************************************************************************* 764/*************************************************************************
765 * GPIO (General-Purpose I/O Ports) 765 * GPIO (General-Purpose I/O Ports)
766 *************************************************************************/ 766 *************************************************************************/
767#define MAX_GPIO_NUM 128 767#define MAX_GPIO_NUM 128
768 768
769//n = 0,1,2,3 769//n = 0,1,2,3
770#define GPIO_PXPIN(n) (GPIO_BASE + (0x00 + (n)*0x100)) /* PIN Level Register */ 770#define GPIO_PXPIN(n) (GPIO_BASE + (0x00 + (n)*0x100)) /* PIN Level Register */
771#define GPIO_PXDAT(n) (GPIO_BASE + (0x10 + (n)*0x100)) /* Port Data Register */ 771#define GPIO_PXDAT(n) (GPIO_BASE + (0x10 + (n)*0x100)) /* Port Data Register */
772#define GPIO_PXDATS(n) (GPIO_BASE + (0x14 + (n)*0x100)) /* Port Data Set Register */ 772#define GPIO_PXDATS(n) (GPIO_BASE + (0x14 + (n)*0x100)) /* Port Data Set Register */
773#define GPIO_PXDATC(n) (GPIO_BASE + (0x18 + (n)*0x100)) /* Port Data Clear Register */ 773#define GPIO_PXDATC(n) (GPIO_BASE + (0x18 + (n)*0x100)) /* Port Data Clear Register */
774#define GPIO_PXIM(n) (GPIO_BASE + (0x20 + (n)*0x100)) /* Interrupt Mask Register */ 774#define GPIO_PXIM(n) (GPIO_BASE + (0x20 + (n)*0x100)) /* Interrupt Mask Register */
775#define GPIO_PXIMS(n) (GPIO_BASE + (0x24 + (n)*0x100)) /* Interrupt Mask Set Reg */ 775#define GPIO_PXIMS(n) (GPIO_BASE + (0x24 + (n)*0x100)) /* Interrupt Mask Set Reg */
776#define GPIO_PXIMC(n) (GPIO_BASE + (0x28 + (n)*0x100)) /* Interrupt Mask Clear Reg */ 776#define GPIO_PXIMC(n) (GPIO_BASE + (0x28 + (n)*0x100)) /* Interrupt Mask Clear Reg */
777#define GPIO_PXPE(n) (GPIO_BASE + (0x30 + (n)*0x100)) /* Pull Enable Register */ 777#define GPIO_PXPE(n) (GPIO_BASE + (0x30 + (n)*0x100)) /* Pull Enable Register */
778#define GPIO_PXPES(n) (GPIO_BASE + (0x34 + (n)*0x100)) /* Pull Enable Set Reg. */ 778#define GPIO_PXPES(n) (GPIO_BASE + (0x34 + (n)*0x100)) /* Pull Enable Set Reg. */
779#define GPIO_PXPEC(n) (GPIO_BASE + (0x38 + (n)*0x100)) /* Pull Enable Clear Reg. */ 779#define GPIO_PXPEC(n) (GPIO_BASE + (0x38 + (n)*0x100)) /* Pull Enable Clear Reg. */
780#define GPIO_PXFUN(n) (GPIO_BASE + (0x40 + (n)*0x100)) /* Function Register */ 780#define GPIO_PXFUN(n) (GPIO_BASE + (0x40 + (n)*0x100)) /* Function Register */
781#define GPIO_PXFUNS(n) (GPIO_BASE + (0x44 + (n)*0x100)) /* Function Set Register */ 781#define GPIO_PXFUNS(n) (GPIO_BASE + (0x44 + (n)*0x100)) /* Function Set Register */
782#define GPIO_PXFUNC(n) (GPIO_BASE + (0x48 + (n)*0x100)) /* Function Clear Register */ 782#define GPIO_PXFUNC(n) (GPIO_BASE + (0x48 + (n)*0x100)) /* Function Clear Register */
783#define GPIO_PXSEL(n) (GPIO_BASE + (0x50 + (n)*0x100)) /* Select Register */ 783#define GPIO_PXSEL(n) (GPIO_BASE + (0x50 + (n)*0x100)) /* Select Register */
784#define GPIO_PXSELS(n) (GPIO_BASE + (0x54 + (n)*0x100)) /* Select Set Register */ 784#define GPIO_PXSELS(n) (GPIO_BASE + (0x54 + (n)*0x100)) /* Select Set Register */
785#define GPIO_PXSELC(n) (GPIO_BASE + (0x58 + (n)*0x100)) /* Select Clear Register */ 785#define GPIO_PXSELC(n) (GPIO_BASE + (0x58 + (n)*0x100)) /* Select Clear Register */
786#define GPIO_PXDIR(n) (GPIO_BASE + (0x60 + (n)*0x100)) /* Direction Register */ 786#define GPIO_PXDIR(n) (GPIO_BASE + (0x60 + (n)*0x100)) /* Direction Register */
787#define GPIO_PXDIRS(n) (GPIO_BASE + (0x64 + (n)*0x100)) /* Direction Set Register */ 787#define GPIO_PXDIRS(n) (GPIO_BASE + (0x64 + (n)*0x100)) /* Direction Set Register */
788#define GPIO_PXDIRC(n) (GPIO_BASE + (0x68 + (n)*0x100)) /* Direction Clear Register */ 788#define GPIO_PXDIRC(n) (GPIO_BASE + (0x68 + (n)*0x100)) /* Direction Clear Register */
789#define GPIO_PXTRG(n) (GPIO_BASE + (0x70 + (n)*0x100)) /* Trigger Register */ 789#define GPIO_PXTRG(n) (GPIO_BASE + (0x70 + (n)*0x100)) /* Trigger Register */
790#define GPIO_PXTRGS(n) (GPIO_BASE + (0x74 + (n)*0x100)) /* Trigger Set Register */ 790#define GPIO_PXTRGS(n) (GPIO_BASE + (0x74 + (n)*0x100)) /* Trigger Set Register */
791#define GPIO_PXTRGC(n) (GPIO_BASE + (0x78 + (n)*0x100)) /* Trigger Set Register */ 791#define GPIO_PXTRGC(n) (GPIO_BASE + (0x78 + (n)*0x100)) /* Trigger Set Register */
792#define GPIO_PXFLG(n) (GPIO_BASE + (0x80 + (n)*0x100)) /* Port Flag Register */ 792#define GPIO_PXFLG(n) (GPIO_BASE + (0x80 + (n)*0x100)) /* Port Flag Register */
793#define GPIO_PXFLGC(n) (GPIO_BASE + (0x14 + (n)*0x100)) /* Port Flag clear Register */ 793#define GPIO_PXFLGC(n) (GPIO_BASE + (0x14 + (n)*0x100)) /* Port Flag clear Register */
794 794
795#define REG_GPIO_PXPIN(n) REG32(GPIO_PXPIN((n))) /* PIN level */ 795#define REG_GPIO_PXPIN(n) REG32(GPIO_PXPIN((n))) /* PIN level */
796#define REG_GPIO_PXDAT(n) REG32(GPIO_PXDAT((n))) /* 1: interrupt pending */ 796#define REG_GPIO_PXDAT(n) REG32(GPIO_PXDAT((n))) /* 1: interrupt pending */
797#define REG_GPIO_PXDATS(n) REG32(GPIO_PXDATS((n))) 797#define REG_GPIO_PXDATS(n) REG32(GPIO_PXDATS((n)))
798#define REG_GPIO_PXDATC(n) REG32(GPIO_PXDATC((n))) 798#define REG_GPIO_PXDATC(n) REG32(GPIO_PXDATC((n)))
799#define REG_GPIO_PXIM(n) REG32(GPIO_PXIM((n))) /* 1: mask pin interrupt */ 799#define REG_GPIO_PXIM(n) REG32(GPIO_PXIM((n))) /* 1: mask pin interrupt */
800#define REG_GPIO_PXIMS(n) REG32(GPIO_PXIMS((n))) 800#define REG_GPIO_PXIMS(n) REG32(GPIO_PXIMS((n)))
801#define REG_GPIO_PXIMC(n) REG32(GPIO_PXIMC((n))) 801#define REG_GPIO_PXIMC(n) REG32(GPIO_PXIMC((n)))
802#define REG_GPIO_PXPE(n) REG32(GPIO_PXPE((n))) /* 1: disable pull up/down */ 802#define REG_GPIO_PXPE(n) REG32(GPIO_PXPE((n))) /* 1: disable pull up/down */
803#define REG_GPIO_PXPES(n) REG32(GPIO_PXPES((n))) 803#define REG_GPIO_PXPES(n) REG32(GPIO_PXPES((n)))
804#define REG_GPIO_PXPEC(n) REG32(GPIO_PXPEC((n))) 804#define REG_GPIO_PXPEC(n) REG32(GPIO_PXPEC((n)))
805#define REG_GPIO_PXFUN(n) REG32(GPIO_PXFUN((n))) /* 0:GPIO or intr, 1:FUNC */ 805#define REG_GPIO_PXFUN(n) REG32(GPIO_PXFUN((n))) /* 0:GPIO or intr, 1:FUNC */
806#define REG_GPIO_PXFUNS(n) REG32(GPIO_PXFUNS((n))) 806#define REG_GPIO_PXFUNS(n) REG32(GPIO_PXFUNS((n)))
807#define REG_GPIO_PXFUNC(n) REG32(GPIO_PXFUNC((n))) 807#define REG_GPIO_PXFUNC(n) REG32(GPIO_PXFUNC((n)))
808#define REG_GPIO_PXSEL(n) REG32(GPIO_PXSEL((n))) /* 0:GPIO/Fun0,1:intr/fun1*/ 808#define REG_GPIO_PXSEL(n) REG32(GPIO_PXSEL((n))) /* 0:GPIO/Fun0,1:intr/fun1*/
809#define REG_GPIO_PXSELS(n) REG32(GPIO_PXSELS((n))) 809#define REG_GPIO_PXSELS(n) REG32(GPIO_PXSELS((n)))
810#define REG_GPIO_PXSELC(n) REG32(GPIO_PXSELC((n))) 810#define REG_GPIO_PXSELC(n) REG32(GPIO_PXSELC((n)))
811#define REG_GPIO_PXDIR(n) REG32(GPIO_PXDIR((n))) /* 0:input/low-level-trig/falling-edge-trig, 1:output/high-level-trig/rising-edge-trig */ 811#define REG_GPIO_PXDIR(n) REG32(GPIO_PXDIR((n))) /* 0:input/low-level-trig/falling-edge-trig, 1:output/high-level-trig/rising-edge-trig */
812#define REG_GPIO_PXDIRS(n) REG32(GPIO_PXDIRS((n))) 812#define REG_GPIO_PXDIRS(n) REG32(GPIO_PXDIRS((n)))
813#define REG_GPIO_PXDIRC(n) REG32(GPIO_PXDIRC((n))) 813#define REG_GPIO_PXDIRC(n) REG32(GPIO_PXDIRC((n)))
814#define REG_GPIO_PXTRG(n) REG32(GPIO_PXTRG((n))) /* 0:level-trigger, 1:edge-trigger */ 814#define REG_GPIO_PXTRG(n) REG32(GPIO_PXTRG((n))) /* 0:level-trigger, 1:edge-trigger */
815#define REG_GPIO_PXTRGS(n) REG32(GPIO_PXTRGS((n))) 815#define REG_GPIO_PXTRGS(n) REG32(GPIO_PXTRGS((n)))
816#define REG_GPIO_PXTRGC(n) REG32(GPIO_PXTRGC((n))) 816#define REG_GPIO_PXTRGC(n) REG32(GPIO_PXTRGC((n)))
817#define REG_GPIO_PXFLG(n) REG32(GPIO_PXFLG((n))) /* interrupt flag */ 817#define REG_GPIO_PXFLG(n) REG32(GPIO_PXFLG((n))) /* interrupt flag */
818#define REG_GPIO_PXFLGC(n) REG32(GPIO_PXFLGC((n))) /* interrupt flag */ 818#define REG_GPIO_PXFLGC(n) REG32(GPIO_PXFLGC((n))) /* interrupt flag */
819 819
820 820
821/************************************************************************* 821/*************************************************************************
822 * UART 822 * UART
823 *************************************************************************/ 823 *************************************************************************/
824 824
825#define IRDA_BASE UART0_BASE 825#define IRDA_BASE UART0_BASE
826#define UART_BASE UART0_BASE 826#define UART_BASE UART0_BASE
827#define UART_OFF 0x1000 827#define UART_OFF 0x1000
828 828
829/* Register Offset */ 829/* Register Offset */
830#define OFF_RDR (0x00) /* R 8b H'xx */ 830#define OFF_RDR (0x00) /* R 8b H'xx */
831#define OFF_TDR (0x00) /* W 8b H'xx */ 831#define OFF_TDR (0x00) /* W 8b H'xx */
832#define OFF_DLLR (0x00) /* RW 8b H'00 */ 832#define OFF_DLLR (0x00) /* RW 8b H'00 */
833#define OFF_DLHR (0x04) /* RW 8b H'00 */ 833#define OFF_DLHR (0x04) /* RW 8b H'00 */
834#define OFF_IER (0x04) /* RW 8b H'00 */ 834#define OFF_IER (0x04) /* RW 8b H'00 */
835#define OFF_ISR (0x08) /* R 8b H'01 */ 835#define OFF_ISR (0x08) /* R 8b H'01 */
836#define OFF_FCR (0x08) /* W 8b H'00 */ 836#define OFF_FCR (0x08) /* W 8b H'00 */
837#define OFF_LCR (0x0C) /* RW 8b H'00 */ 837#define OFF_LCR (0x0C) /* RW 8b H'00 */
838#define OFF_MCR (0x10) /* RW 8b H'00 */ 838#define OFF_MCR (0x10) /* RW 8b H'00 */
839#define OFF_LSR (0x14) /* R 8b H'00 */ 839#define OFF_LSR (0x14) /* R 8b H'00 */
840#define OFF_MSR (0x18) /* R 8b H'00 */ 840#define OFF_MSR (0x18) /* R 8b H'00 */
841#define OFF_SPR (0x1C) /* RW 8b H'00 */ 841#define OFF_SPR (0x1C) /* RW 8b H'00 */
842#define OFF_SIRCR (0x20) /* RW 8b H'00, UART0 */ 842#define OFF_SIRCR (0x20) /* RW 8b H'00, UART0 */
843#define OFF_UMR (0x24) /* RW 8b H'00, UART M Register */ 843#define OFF_UMR (0x24) /* RW 8b H'00, UART M Register */
844#define OFF_UACR (0x28) /* RW 8b H'00, UART Add Cycle Register */ 844#define OFF_UACR (0x28) /* RW 8b H'00, UART Add Cycle Register */
845 845
846/* Register Address */ 846/* Register Address */
847#define UART0_RDR (UART0_BASE + OFF_RDR) 847#define UART0_RDR (UART0_BASE + OFF_RDR)
848#define UART0_TDR (UART0_BASE + OFF_TDR) 848#define UART0_TDR (UART0_BASE + OFF_TDR)
849#define UART0_DLLR (UART0_BASE + OFF_DLLR) 849#define UART0_DLLR (UART0_BASE + OFF_DLLR)
850#define UART0_DLHR (UART0_BASE + OFF_DLHR) 850#define UART0_DLHR (UART0_BASE + OFF_DLHR)
851#define UART0_IER (UART0_BASE + OFF_IER) 851#define UART0_IER (UART0_BASE + OFF_IER)
852#define UART0_ISR (UART0_BASE + OFF_ISR) 852#define UART0_ISR (UART0_BASE + OFF_ISR)
853#define UART0_FCR (UART0_BASE + OFF_FCR) 853#define UART0_FCR (UART0_BASE + OFF_FCR)
854#define UART0_LCR (UART0_BASE + OFF_LCR) 854#define UART0_LCR (UART0_BASE + OFF_LCR)
855#define UART0_MCR (UART0_BASE + OFF_MCR) 855#define UART0_MCR (UART0_BASE + OFF_MCR)
856#define UART0_LSR (UART0_BASE + OFF_LSR) 856#define UART0_LSR (UART0_BASE + OFF_LSR)
857#define UART0_MSR (UART0_BASE + OFF_MSR) 857#define UART0_MSR (UART0_BASE + OFF_MSR)
858#define UART0_SPR (UART0_BASE + OFF_SPR) 858#define UART0_SPR (UART0_BASE + OFF_SPR)
859#define UART0_SIRCR (UART0_BASE + OFF_SIRCR) 859#define UART0_SIRCR (UART0_BASE + OFF_SIRCR)
860#define UART0_UMR (UART0_BASE + OFF_UMR) 860#define UART0_UMR (UART0_BASE + OFF_UMR)
861#define UART0_UACR (UART0_BASE + OFF_UACR) 861#define UART0_UACR (UART0_BASE + OFF_UACR)
862 862
863/* 863/*
864 * Define macros for UART_IER 864 * Define macros for UART_IER
865 * UART Interrupt Enable Register 865 * UART Interrupt Enable Register
866 */ 866 */
867#define UART_IER_RIE (1 << 0) /* 0: receive fifo "full" interrupt disable */ 867#define UART_IER_RIE (1 << 0) /* 0: receive fifo "full" interrupt disable */
868#define UART_IER_TIE (1 << 1) /* 0: transmit fifo "empty" interrupt disable */ 868#define UART_IER_TIE (1 << 1) /* 0: transmit fifo "empty" interrupt disable */
869#define UART_IER_RLIE (1 << 2) /* 0: receive line status interrupt disable */ 869#define UART_IER_RLIE (1 << 2) /* 0: receive line status interrupt disable */
870#define UART_IER_MIE (1 << 3) /* 0: modem status interrupt disable */ 870#define UART_IER_MIE (1 << 3) /* 0: modem status interrupt disable */
871#define UART_IER_RTIE (1 << 4) /* 0: receive timeout interrupt disable */ 871#define UART_IER_RTIE (1 << 4) /* 0: receive timeout interrupt disable */
872 872
873/* 873/*
874 * Define macros for UART_ISR 874 * Define macros for UART_ISR
875 * UART Interrupt Status Register 875 * UART Interrupt Status Register
876 */ 876 */
877#define UART_ISR_IP (1 << 0) /* 0: interrupt is pending 1: no interrupt */ 877#define UART_ISR_IP (1 << 0) /* 0: interrupt is pending 1: no interrupt */
878#define UART_ISR_IID (7 << 1) /* Source of Interrupt */ 878#define UART_ISR_IID (7 << 1) /* Source of Interrupt */
879#define UART_ISR_IID_MSI (0 << 1) /* Modem status interrupt */ 879#define UART_ISR_IID_MSI (0 << 1) /* Modem status interrupt */
880#define UART_ISR_IID_THRI (1 << 1) /* Transmitter holding register empty */ 880#define UART_ISR_IID_THRI (1 << 1) /* Transmitter holding register empty */
881#define UART_ISR_IID_RDI (2 << 1) /* Receiver data interrupt */ 881#define UART_ISR_IID_RDI (2 << 1) /* Receiver data interrupt */
882#define UART_ISR_IID_RLSI (3 << 1) /* Receiver line status interrupt */ 882#define UART_ISR_IID_RLSI (3 << 1) /* Receiver line status interrupt */
883#define UART_ISR_FFMS (3 << 6) /* FIFO mode select, set when UART_FCR.FE is set to 1 */ 883#define UART_ISR_FFMS (3 << 6) /* FIFO mode select, set when UART_FCR.FE is set to 1 */
884#define UART_ISR_FFMS_NO_FIFO (0 << 6) 884#define UART_ISR_FFMS_NO_FIFO (0 << 6)
885#define UART_ISR_FFMS_FIFO_MODE (3 << 6) 885#define UART_ISR_FFMS_FIFO_MODE (3 << 6)
886 886
887/* 887/*
888 * Define macros for UART_FCR 888 * Define macros for UART_FCR
889 * UART FIFO Control Register 889 * UART FIFO Control Register
890 */ 890 */
891#define UART_FCR_FE (1 << 0) /* 0: non-FIFO mode 1: FIFO mode */ 891#define UART_FCR_FE (1 << 0) /* 0: non-FIFO mode 1: FIFO mode */
892#define UART_FCR_RFLS (1 << 1) /* write 1 to flush receive FIFO */ 892#define UART_FCR_RFLS (1 << 1) /* write 1 to flush receive FIFO */
893#define UART_FCR_TFLS (1 << 2) /* write 1 to flush transmit FIFO */ 893#define UART_FCR_TFLS (1 << 2) /* write 1 to flush transmit FIFO */
894#define UART_FCR_DMS (1 << 3) /* 0: disable DMA mode */ 894#define UART_FCR_DMS (1 << 3) /* 0: disable DMA mode */
895#define UART_FCR_UUE (1 << 4) /* 0: disable UART */ 895#define UART_FCR_UUE (1 << 4) /* 0: disable UART */
896#define UART_FCR_RTRG (3 << 6) /* Receive FIFO Data Trigger */ 896#define UART_FCR_RTRG (3 << 6) /* Receive FIFO Data Trigger */
897#define UART_FCR_RTRG_1 (0 << 6) 897#define UART_FCR_RTRG_1 (0 << 6)
898#define UART_FCR_RTRG_4 (1 << 6) 898#define UART_FCR_RTRG_4 (1 << 6)
899#define UART_FCR_RTRG_8 (2 << 6) 899#define UART_FCR_RTRG_8 (2 << 6)
900#define UART_FCR_RTRG_15 (3 << 6) 900#define UART_FCR_RTRG_15 (3 << 6)
901 901
902/* 902/*
903 * Define macros for UART_LCR 903 * Define macros for UART_LCR
904 * UART Line Control Register 904 * UART Line Control Register
905 */ 905 */
906#define UART_LCR_WLEN (3 << 0) /* word length */ 906#define UART_LCR_WLEN (3 << 0) /* word length */
907#define UART_LCR_WLEN_5 (0 << 0) 907#define UART_LCR_WLEN_5 (0 << 0)
908#define UART_LCR_WLEN_6 (1 << 0) 908#define UART_LCR_WLEN_6 (1 << 0)
909#define UART_LCR_WLEN_7 (2 << 0) 909#define UART_LCR_WLEN_7 (2 << 0)
910#define UART_LCR_WLEN_8 (3 << 0) 910#define UART_LCR_WLEN_8 (3 << 0)
911#define UART_LCR_STOP (1 << 2) /* 0: 1 stop bit when word length is 5,6,7,8 911#define UART_LCR_STOP (1 << 2) /* 0: 1 stop bit when word length is 5,6,7,8
912 1: 1.5 stop bits when 5; 2 stop bits when 6,7,8 */ 912 1: 1.5 stop bits when 5; 2 stop bits when 6,7,8 */
913#define UART_LCR_STOP_1 (0 << 2) /* 0: 1 stop bit when word length is 5,6,7,8 913#define UART_LCR_STOP_1 (0 << 2) /* 0: 1 stop bit when word length is 5,6,7,8
914 1: 1.5 stop bits when 5; 2 stop bits when 6,7,8 */ 914 1: 1.5 stop bits when 5; 2 stop bits when 6,7,8 */
915#define UART_LCR_STOP_2 (1 << 2) /* 0: 1 stop bit when word length is 5,6,7,8 915#define UART_LCR_STOP_2 (1 << 2) /* 0: 1 stop bit when word length is 5,6,7,8
916 1: 1.5 stop bits when 5; 2 stop bits when 6,7,8 */ 916 1: 1.5 stop bits when 5; 2 stop bits when 6,7,8 */
917 917
918#define UART_LCR_PE (1 << 3) /* 0: parity disable */ 918#define UART_LCR_PE (1 << 3) /* 0: parity disable */
919#define UART_LCR_PROE (1 << 4) /* 0: even parity 1: odd parity */ 919#define UART_LCR_PROE (1 << 4) /* 0: even parity 1: odd parity */
920#define UART_LCR_SPAR (1 << 5) /* 0: sticky parity disable */ 920#define UART_LCR_SPAR (1 << 5) /* 0: sticky parity disable */
921#define UART_LCR_SBRK (1 << 6) /* write 0 normal, write 1 send break */ 921#define UART_LCR_SBRK (1 << 6) /* write 0 normal, write 1 send break */
922#define UART_LCR_DLAB (1 << 7) /* 0: access UART_RDR/TDR/IER 1: access UART_DLLR/DLHR */ 922#define UART_LCR_DLAB (1 << 7) /* 0: access UART_RDR/TDR/IER 1: access UART_DLLR/DLHR */
923 923
924/* 924/*
925 * Define macros for UART_LSR 925 * Define macros for UART_LSR
926 * UART Line Status Register 926 * UART Line Status Register
927 */ 927 */
928#define UART_LSR_DR (1 << 0) /* 0: receive FIFO is empty 1: receive data is ready */ 928#define UART_LSR_DR (1 << 0) /* 0: receive FIFO is empty 1: receive data is ready */
929#define UART_LSR_ORER (1 << 1) /* 0: no overrun error */ 929#define UART_LSR_ORER (1 << 1) /* 0: no overrun error */
930#define UART_LSR_PER (1 << 2) /* 0: no parity error */ 930#define UART_LSR_PER (1 << 2) /* 0: no parity error */
931#define UART_LSR_FER (1 << 3) /* 0; no framing error */ 931#define UART_LSR_FER (1 << 3) /* 0; no framing error */
932#define UART_LSR_BRK (1 << 4) /* 0: no break detected 1: receive a break signal */ 932#define UART_LSR_BRK (1 << 4) /* 0: no break detected 1: receive a break signal */
933#define UART_LSR_TDRQ (1 << 5) /* 1: transmit FIFO half "empty" */ 933#define UART_LSR_TDRQ (1 << 5) /* 1: transmit FIFO half "empty" */
934#define UART_LSR_TEMT (1 << 6) /* 1: transmit FIFO and shift registers empty */ 934#define UART_LSR_TEMT (1 << 6) /* 1: transmit FIFO and shift registers empty */
935#define UART_LSR_RFER (1 << 7) /* 0: no receive error 1: receive error in FIFO mode */ 935#define UART_LSR_RFER (1 << 7) /* 0: no receive error 1: receive error in FIFO mode */
936 936
937/* 937/*
938 * Define macros for UART_MCR 938 * Define macros for UART_MCR
939 * UART Modem Control Register 939 * UART Modem Control Register
940 */ 940 */
941#define UART_MCR_DTR (1 << 0) /* 0: DTR_ ouput high */ 941#define UART_MCR_DTR (1 << 0) /* 0: DTR_ ouput high */
942#define UART_MCR_RTS (1 << 1) /* 0: RTS_ output high */ 942#define UART_MCR_RTS (1 << 1) /* 0: RTS_ output high */
943#define UART_MCR_OUT1 (1 << 2) /* 0: UART_MSR.RI is set to 0 and RI_ input high */ 943#define UART_MCR_OUT1 (1 << 2) /* 0: UART_MSR.RI is set to 0 and RI_ input high */
944#define UART_MCR_OUT2 (1 << 3) /* 0: UART_MSR.DCD is set to 0 and DCD_ input high */ 944#define UART_MCR_OUT2 (1 << 3) /* 0: UART_MSR.DCD is set to 0 and DCD_ input high */
945#define UART_MCR_LOOP (1 << 4) /* 0: normal 1: loopback mode */ 945#define UART_MCR_LOOP (1 << 4) /* 0: normal 1: loopback mode */
946#define UART_MCR_MCE (1 << 7) /* 0: modem function is disable */ 946#define UART_MCR_MCE (1 << 7) /* 0: modem function is disable */
947 947
948/* 948/*
949 * Define macros for UART_MSR 949 * Define macros for UART_MSR
950 * UART Modem Status Register 950 * UART Modem Status Register
951 */ 951 */
952#define UART_MSR_DCTS (1 << 0) /* 0: no change on CTS_ pin since last read of UART_MSR */ 952#define UART_MSR_DCTS (1 << 0) /* 0: no change on CTS_ pin since last read of UART_MSR */
953#define UART_MSR_DDSR (1 << 1) /* 0: no change on DSR_ pin since last read of UART_MSR */ 953#define UART_MSR_DDSR (1 << 1) /* 0: no change on DSR_ pin since last read of UART_MSR */
954#define UART_MSR_DRI (1 << 2) /* 0: no change on RI_ pin since last read of UART_MSR */ 954#define UART_MSR_DRI (1 << 2) /* 0: no change on RI_ pin since last read of UART_MSR */
955#define UART_MSR_DDCD (1 << 3) /* 0: no change on DCD_ pin since last read of UART_MSR */ 955#define UART_MSR_DDCD (1 << 3) /* 0: no change on DCD_ pin since last read of UART_MSR */
956#define UART_MSR_CTS (1 << 4) /* 0: CTS_ pin is high */ 956#define UART_MSR_CTS (1 << 4) /* 0: CTS_ pin is high */
957#define UART_MSR_DSR (1 << 5) /* 0: DSR_ pin is high */ 957#define UART_MSR_DSR (1 << 5) /* 0: DSR_ pin is high */
958#define UART_MSR_RI (1 << 6) /* 0: RI_ pin is high */ 958#define UART_MSR_RI (1 << 6) /* 0: RI_ pin is high */
959#define UART_MSR_DCD (1 << 7) /* 0: DCD_ pin is high */ 959#define UART_MSR_DCD (1 << 7) /* 0: DCD_ pin is high */
960 960
961/* 961/*
962 * Define macros for SIRCR 962 * Define macros for SIRCR
963 * Slow IrDA Control Register 963 * Slow IrDA Control Register
964 */ 964 */
965#define SIRCR_TSIRE (1 << 0) /* 0: transmitter is in UART mode 1: IrDA mode */ 965#define SIRCR_TSIRE (1 << 0) /* 0: transmitter is in UART mode 1: IrDA mode */
966#define SIRCR_RSIRE (1 << 1) /* 0: receiver is in UART mode 1: IrDA mode */ 966#define SIRCR_RSIRE (1 << 1) /* 0: receiver is in UART mode 1: IrDA mode */
967#define SIRCR_TPWS (1 << 2) /* 0: transmit 0 pulse width is 3/16 of bit length 967#define SIRCR_TPWS (1 << 2) /* 0: transmit 0 pulse width is 3/16 of bit length
968 1: 0 pulse width is 1.6us for 115.2Kbps */ 968 1: 0 pulse width is 1.6us for 115.2Kbps */
969#define SIRCR_TXPL (1 << 3) /* 0: encoder generates a positive pulse for 0 */ 969#define SIRCR_TXPL (1 << 3) /* 0: encoder generates a positive pulse for 0 */
970#define SIRCR_RXPL (1 << 4) /* 0: decoder interprets positive pulse as 0 */ 970#define SIRCR_RXPL (1 << 4) /* 0: decoder interprets positive pulse as 0 */
971 971
972 972
973/************************************************************************* 973/*************************************************************************
974 * AIC (AC97/I2S Controller) 974 * AIC (AC97/I2S Controller)
975 *************************************************************************/ 975 *************************************************************************/
976#define AIC_FR (AIC_BASE + 0x000) 976#define AIC_FR (AIC_BASE + 0x000)
977#define AIC_CR (AIC_BASE + 0x004) 977#define AIC_CR (AIC_BASE + 0x004)
978#define AIC_ACCR1 (AIC_BASE + 0x008) 978#define AIC_ACCR1 (AIC_BASE + 0x008)
979#define AIC_ACCR2 (AIC_BASE + 0x00C) 979#define AIC_ACCR2 (AIC_BASE + 0x00C)
980#define AIC_I2SCR (AIC_BASE + 0x010) 980#define AIC_I2SCR (AIC_BASE + 0x010)
981#define AIC_SR (AIC_BASE + 0x014) 981#define AIC_SR (AIC_BASE + 0x014)
982#define AIC_ACSR (AIC_BASE + 0x018) 982#define AIC_ACSR (AIC_BASE + 0x018)
983#define AIC_I2SSR (AIC_BASE + 0x01C) 983#define AIC_I2SSR (AIC_BASE + 0x01C)
984#define AIC_ACCAR (AIC_BASE + 0x020) 984#define AIC_ACCAR (AIC_BASE + 0x020)
985#define AIC_ACCDR (AIC_BASE + 0x024) 985#define AIC_ACCDR (AIC_BASE + 0x024)
986#define AIC_ACSAR (AIC_BASE + 0x028) 986#define AIC_ACSAR (AIC_BASE + 0x028)
987#define AIC_ACSDR (AIC_BASE + 0x02C) 987#define AIC_ACSDR (AIC_BASE + 0x02C)
988#define AIC_I2SDIV (AIC_BASE + 0x030) 988#define AIC_I2SDIV (AIC_BASE + 0x030)
989#define AIC_DR (AIC_BASE + 0x034) 989#define AIC_DR (AIC_BASE + 0x034)
990 990
991#define REG_AIC_FR REG32(AIC_FR) 991#define REG_AIC_FR REG32(AIC_FR)
992#define REG_AIC_CR REG32(AIC_CR) 992#define REG_AIC_CR REG32(AIC_CR)
993#define REG_AIC_ACCR1 REG32(AIC_ACCR1) 993#define REG_AIC_ACCR1 REG32(AIC_ACCR1)
994#define REG_AIC_ACCR2 REG32(AIC_ACCR2) 994#define REG_AIC_ACCR2 REG32(AIC_ACCR2)
995#define REG_AIC_I2SCR REG32(AIC_I2SCR) 995#define REG_AIC_I2SCR REG32(AIC_I2SCR)
996#define REG_AIC_SR REG32(AIC_SR) 996#define REG_AIC_SR REG32(AIC_SR)
997#define REG_AIC_ACSR REG32(AIC_ACSR) 997#define REG_AIC_ACSR REG32(AIC_ACSR)
998#define REG_AIC_I2SSR REG32(AIC_I2SSR) 998#define REG_AIC_I2SSR REG32(AIC_I2SSR)
999#define REG_AIC_ACCAR REG32(AIC_ACCAR) 999#define REG_AIC_ACCAR REG32(AIC_ACCAR)
1000#define REG_AIC_ACCDR REG32(AIC_ACCDR) 1000#define REG_AIC_ACCDR REG32(AIC_ACCDR)
1001#define REG_AIC_ACSAR REG32(AIC_ACSAR) 1001#define REG_AIC_ACSAR REG32(AIC_ACSAR)
1002#define REG_AIC_ACSDR REG32(AIC_ACSDR) 1002#define REG_AIC_ACSDR REG32(AIC_ACSDR)
1003#define REG_AIC_I2SDIV REG32(AIC_I2SDIV) 1003#define REG_AIC_I2SDIV REG32(AIC_I2SDIV)
1004#define REG_AIC_DR REG32(AIC_DR) 1004#define REG_AIC_DR REG32(AIC_DR)
1005 1005
1006/* AIC Controller Configuration Register (AIC_FR) */ 1006/* AIC Controller Configuration Register (AIC_FR) */
1007 1007
1008#define AIC_FR_RFTH_BIT 12 /* Receive FIFO Threshold */ 1008#define AIC_FR_RFTH_BIT 12 /* Receive FIFO Threshold */
1009#define AIC_FR_RFTH_MASK (0xf << AIC_FR_RFTH_BIT) 1009#define AIC_FR_RFTH_MASK (0xf << AIC_FR_RFTH_BIT)
1010#define AIC_FR_TFTH_BIT 8 /* Transmit FIFO Threshold */ 1010#define AIC_FR_TFTH_BIT 8 /* Transmit FIFO Threshold */
1011#define AIC_FR_TFTH_MASK (0xf << AIC_FR_TFTH_BIT) 1011#define AIC_FR_TFTH_MASK (0xf << AIC_FR_TFTH_BIT)
1012#define AIC_FR_ICDC (1 << 5) /* External(0) or Internal CODEC(1) */ 1012#define AIC_FR_ICDC (1 << 5) /* External(0) or Internal CODEC(1) */
1013#define AIC_FR_AUSEL (1 << 4) /* AC97(0) or I2S/MSB-justified(1) */ 1013#define AIC_FR_AUSEL (1 << 4) /* AC97(0) or I2S/MSB-justified(1) */
1014#define AIC_FR_RST (1 << 3) /* AIC registers reset */ 1014#define AIC_FR_RST (1 << 3) /* AIC registers reset */
1015#define AIC_FR_BCKD (1 << 2) /* I2S BIT_CLK direction, 0:input,1:output */ 1015#define AIC_FR_BCKD (1 << 2) /* I2S BIT_CLK direction, 0:input,1:output */
1016#define AIC_FR_SYNCD (1 << 1) /* I2S SYNC direction, 0:input,1:output */ 1016#define AIC_FR_SYNCD (1 << 1) /* I2S SYNC direction, 0:input,1:output */
1017#define AIC_FR_ENB (1 << 0) /* AIC enable bit */ 1017#define AIC_FR_ENB (1 << 0) /* AIC enable bit */
1018 1018
1019/* AIC Controller Common Control Register (AIC_CR) */ 1019/* AIC Controller Common Control Register (AIC_CR) */
1020 1020
1021#define AIC_CR_OSS_BIT 19 /* Output Sample Size from memory (AIC V2 only) */ 1021#define AIC_CR_OSS_BIT 19 /* Output Sample Size from memory (AIC V2 only) */
1022#define AIC_CR_OSS_MASK (0x7 << AIC_CR_OSS_BIT) 1022#define AIC_CR_OSS_MASK (0x7 << AIC_CR_OSS_BIT)
1023 #define AIC_CR_OSS_8BIT (0x0 << AIC_CR_OSS_BIT) 1023 #define AIC_CR_OSS_8BIT (0x0 << AIC_CR_OSS_BIT)
1024 #define AIC_CR_OSS_16BIT (0x1 << AIC_CR_OSS_BIT) 1024 #define AIC_CR_OSS_16BIT (0x1 << AIC_CR_OSS_BIT)
1025 #define AIC_CR_OSS_18BIT (0x2 << AIC_CR_OSS_BIT) 1025 #define AIC_CR_OSS_18BIT (0x2 << AIC_CR_OSS_BIT)
1026 #define AIC_CR_OSS_20BIT (0x3 << AIC_CR_OSS_BIT) 1026 #define AIC_CR_OSS_20BIT (0x3 << AIC_CR_OSS_BIT)
1027 #define AIC_CR_OSS_24BIT (0x4 << AIC_CR_OSS_BIT) 1027 #define AIC_CR_OSS_24BIT (0x4 << AIC_CR_OSS_BIT)
1028#define AIC_CR_ISS_BIT 16 /* Input Sample Size from memory (AIC V2 only) */ 1028#define AIC_CR_ISS_BIT 16 /* Input Sample Size from memory (AIC V2 only) */
1029#define AIC_CR_ISS_MASK (0x7 << AIC_CR_ISS_BIT) 1029#define AIC_CR_ISS_MASK (0x7 << AIC_CR_ISS_BIT)
1030 #define AIC_CR_ISS_8BIT (0x0 << AIC_CR_ISS_BIT) 1030 #define AIC_CR_ISS_8BIT (0x0 << AIC_CR_ISS_BIT)
1031 #define AIC_CR_ISS_16BIT (0x1 << AIC_CR_ISS_BIT) 1031 #define AIC_CR_ISS_16BIT (0x1 << AIC_CR_ISS_BIT)
1032 #define AIC_CR_ISS_18BIT (0x2 << AIC_CR_ISS_BIT) 1032 #define AIC_CR_ISS_18BIT (0x2 << AIC_CR_ISS_BIT)
1033 #define AIC_CR_ISS_20BIT (0x3 << AIC_CR_ISS_BIT) 1033 #define AIC_CR_ISS_20BIT (0x3 << AIC_CR_ISS_BIT)
1034 #define AIC_CR_ISS_24BIT (0x4 << AIC_CR_ISS_BIT) 1034 #define AIC_CR_ISS_24BIT (0x4 << AIC_CR_ISS_BIT)
1035#define AIC_CR_RDMS (1 << 15) /* Receive DMA enable */ 1035#define AIC_CR_RDMS (1 << 15) /* Receive DMA enable */
1036#define AIC_CR_TDMS (1 << 14) /* Transmit DMA enable */ 1036#define AIC_CR_TDMS (1 << 14) /* Transmit DMA enable */
1037#define AIC_CR_M2S (1 << 11) /* Mono to Stereo enable */ 1037#define AIC_CR_M2S (1 << 11) /* Mono to Stereo enable */
1038#define AIC_CR_ENDSW (1 << 10) /* Endian switch enable */ 1038#define AIC_CR_ENDSW (1 << 10) /* Endian switch enable */
1039#define AIC_CR_AVSTSU (1 << 9) /* Signed <-> Unsigned toggle enable */ 1039#define AIC_CR_AVSTSU (1 << 9) /* Signed <-> Unsigned toggle enable */
1040#define AIC_CR_FLUSH (1 << 8) /* Flush FIFO */ 1040#define AIC_CR_FLUSH (1 << 8) /* Flush FIFO */
1041#define AIC_CR_EROR (1 << 6) /* Enable ROR interrupt */ 1041#define AIC_CR_EROR (1 << 6) /* Enable ROR interrupt */
1042#define AIC_CR_ETUR (1 << 5) /* Enable TUR interrupt */ 1042#define AIC_CR_ETUR (1 << 5) /* Enable TUR interrupt */
1043#define AIC_CR_ERFS (1 << 4) /* Enable RFS interrupt */ 1043#define AIC_CR_ERFS (1 << 4) /* Enable RFS interrupt */
1044#define AIC_CR_ETFS (1 << 3) /* Enable TFS interrupt */ 1044#define AIC_CR_ETFS (1 << 3) /* Enable TFS interrupt */
1045#define AIC_CR_ENLBF (1 << 2) /* Enable Loopback Function */ 1045#define AIC_CR_ENLBF (1 << 2) /* Enable Loopback Function */
1046#define AIC_CR_ERPL (1 << 1) /* Enable Playback Function */ 1046#define AIC_CR_ERPL (1 << 1) /* Enable Playback Function */
1047#define AIC_CR_EREC (1 << 0) /* Enable Record Function */ 1047#define AIC_CR_EREC (1 << 0) /* Enable Record Function */
1048 1048
1049/* AIC Controller AC-link Control Register 1 (AIC_ACCR1) */ 1049/* AIC Controller AC-link Control Register 1 (AIC_ACCR1) */
1050 1050
1051#define AIC_ACCR1_RS_BIT 16 /* Receive Valid Slots */ 1051#define AIC_ACCR1_RS_BIT 16 /* Receive Valid Slots */
1052#define AIC_ACCR1_RS_MASK (0x3ff << AIC_ACCR1_RS_BIT) 1052#define AIC_ACCR1_RS_MASK (0x3ff << AIC_ACCR1_RS_BIT)
1053 #define AIC_ACCR1_RS_SLOT12 (1 << 25) /* Slot 12 valid bit */ 1053 #define AIC_ACCR1_RS_SLOT12 (1 << 25) /* Slot 12 valid bit */
1054 #define AIC_ACCR1_RS_SLOT11 (1 << 24) /* Slot 11 valid bit */ 1054 #define AIC_ACCR1_RS_SLOT11 (1 << 24) /* Slot 11 valid bit */
1055 #define AIC_ACCR1_RS_SLOT10 (1 << 23) /* Slot 10 valid bit */ 1055 #define AIC_ACCR1_RS_SLOT10 (1 << 23) /* Slot 10 valid bit */
1056 #define AIC_ACCR1_RS_SLOT9 (1 << 22) /* Slot 9 valid bit, LFE */ 1056 #define AIC_ACCR1_RS_SLOT9 (1 << 22) /* Slot 9 valid bit, LFE */
1057 #define AIC_ACCR1_RS_SLOT8 (1 << 21) /* Slot 8 valid bit, Surround Right */ 1057 #define AIC_ACCR1_RS_SLOT8 (1 << 21) /* Slot 8 valid bit, Surround Right */
1058 #define AIC_ACCR1_RS_SLOT7 (1 << 20) /* Slot 7 valid bit, Surround Left */ 1058 #define AIC_ACCR1_RS_SLOT7 (1 << 20) /* Slot 7 valid bit, Surround Left */
1059 #define AIC_ACCR1_RS_SLOT6 (1 << 19) /* Slot 6 valid bit, PCM Center */ 1059 #define AIC_ACCR1_RS_SLOT6 (1 << 19) /* Slot 6 valid bit, PCM Center */
1060 #define AIC_ACCR1_RS_SLOT5 (1 << 18) /* Slot 5 valid bit */ 1060 #define AIC_ACCR1_RS_SLOT5 (1 << 18) /* Slot 5 valid bit */
1061 #define AIC_ACCR1_RS_SLOT4 (1 << 17) /* Slot 4 valid bit, PCM Right */ 1061 #define AIC_ACCR1_RS_SLOT4 (1 << 17) /* Slot 4 valid bit, PCM Right */
1062 #define AIC_ACCR1_RS_SLOT3 (1 << 16) /* Slot 3 valid bit, PCM Left */ 1062 #define AIC_ACCR1_RS_SLOT3 (1 << 16) /* Slot 3 valid bit, PCM Left */
1063#define AIC_ACCR1_XS_BIT 0 /* Transmit Valid Slots */ 1063#define AIC_ACCR1_XS_BIT 0 /* Transmit Valid Slots */
1064#define AIC_ACCR1_XS_MASK (0x3ff << AIC_ACCR1_XS_BIT) 1064#define AIC_ACCR1_XS_MASK (0x3ff << AIC_ACCR1_XS_BIT)
1065 #define AIC_ACCR1_XS_SLOT12 (1 << 9) /* Slot 12 valid bit */ 1065 #define AIC_ACCR1_XS_SLOT12 (1 << 9) /* Slot 12 valid bit */
1066 #define AIC_ACCR1_XS_SLOT11 (1 << 8) /* Slot 11 valid bit */ 1066 #define AIC_ACCR1_XS_SLOT11 (1 << 8) /* Slot 11 valid bit */
1067 #define AIC_ACCR1_XS_SLOT10 (1 << 7) /* Slot 10 valid bit */ 1067 #define AIC_ACCR1_XS_SLOT10 (1 << 7) /* Slot 10 valid bit */
1068 #define AIC_ACCR1_XS_SLOT9 (1 << 6) /* Slot 9 valid bit, LFE */ 1068 #define AIC_ACCR1_XS_SLOT9 (1 << 6) /* Slot 9 valid bit, LFE */
1069 #define AIC_ACCR1_XS_SLOT8 (1 << 5) /* Slot 8 valid bit, Surround Right */ 1069 #define AIC_ACCR1_XS_SLOT8 (1 << 5) /* Slot 8 valid bit, Surround Right */
1070 #define AIC_ACCR1_XS_SLOT7 (1 << 4) /* Slot 7 valid bit, Surround Left */ 1070 #define AIC_ACCR1_XS_SLOT7 (1 << 4) /* Slot 7 valid bit, Surround Left */
1071 #define AIC_ACCR1_XS_SLOT6 (1 << 3) /* Slot 6 valid bit, PCM Center */ 1071 #define AIC_ACCR1_XS_SLOT6 (1 << 3) /* Slot 6 valid bit, PCM Center */
1072 #define AIC_ACCR1_XS_SLOT5 (1 << 2) /* Slot 5 valid bit */ 1072 #define AIC_ACCR1_XS_SLOT5 (1 << 2) /* Slot 5 valid bit */
1073 #define AIC_ACCR1_XS_SLOT4 (1 << 1) /* Slot 4 valid bit, PCM Right */ 1073 #define AIC_ACCR1_XS_SLOT4 (1 << 1) /* Slot 4 valid bit, PCM Right */
1074 #define AIC_ACCR1_XS_SLOT3 (1 << 0) /* Slot 3 valid bit, PCM Left */ 1074 #define AIC_ACCR1_XS_SLOT3 (1 << 0) /* Slot 3 valid bit, PCM Left */
1075 1075
1076/* AIC Controller AC-link Control Register 2 (AIC_ACCR2) */ 1076/* AIC Controller AC-link Control Register 2 (AIC_ACCR2) */
1077 1077
1078#define AIC_ACCR2_ERSTO (1 << 18) /* Enable RSTO interrupt */ 1078#define AIC_ACCR2_ERSTO (1 << 18) /* Enable RSTO interrupt */
1079#define AIC_ACCR2_ESADR (1 << 17) /* Enable SADR interrupt */ 1079#define AIC_ACCR2_ESADR (1 << 17) /* Enable SADR interrupt */
1080#define AIC_ACCR2_ECADT (1 << 16) /* Enable CADT interrupt */ 1080#define AIC_ACCR2_ECADT (1 << 16) /* Enable CADT interrupt */
1081#define AIC_ACCR2_OASS_BIT 8 /* Output Sample Size for AC-link */ 1081#define AIC_ACCR2_OASS_BIT 8 /* Output Sample Size for AC-link */
1082#define AIC_ACCR2_OASS_MASK (0x3 << AIC_ACCR2_OASS_BIT) 1082#define AIC_ACCR2_OASS_MASK (0x3 << AIC_ACCR2_OASS_BIT)
1083 #define AIC_ACCR2_OASS_20BIT (0 << AIC_ACCR2_OASS_BIT) /* Output Audio Sample Size is 20-bit */ 1083 #define AIC_ACCR2_OASS_20BIT (0 << AIC_ACCR2_OASS_BIT) /* Output Audio Sample Size is 20-bit */
1084 #define AIC_ACCR2_OASS_18BIT (1 << AIC_ACCR2_OASS_BIT) /* Output Audio Sample Size is 18-bit */ 1084 #define AIC_ACCR2_OASS_18BIT (1 << AIC_ACCR2_OASS_BIT) /* Output Audio Sample Size is 18-bit */
1085 #define AIC_ACCR2_OASS_16BIT (2 << AIC_ACCR2_OASS_BIT) /* Output Audio Sample Size is 16-bit */ 1085 #define AIC_ACCR2_OASS_16BIT (2 << AIC_ACCR2_OASS_BIT) /* Output Audio Sample Size is 16-bit */
1086 #define AIC_ACCR2_OASS_8BIT (3 << AIC_ACCR2_OASS_BIT) /* Output Audio Sample Size is 8-bit */ 1086 #define AIC_ACCR2_OASS_8BIT (3 << AIC_ACCR2_OASS_BIT) /* Output Audio Sample Size is 8-bit */
1087#define AIC_ACCR2_IASS_BIT 6 /* Output Sample Size for AC-link */ 1087#define AIC_ACCR2_IASS_BIT 6 /* Output Sample Size for AC-link */
1088#define AIC_ACCR2_IASS_MASK (0x3 << AIC_ACCR2_IASS_BIT) 1088#define AIC_ACCR2_IASS_MASK (0x3 << AIC_ACCR2_IASS_BIT)
1089 #define AIC_ACCR2_IASS_20BIT (0 << AIC_ACCR2_IASS_BIT) /* Input Audio Sample Size is 20-bit */ 1089 #define AIC_ACCR2_IASS_20BIT (0 << AIC_ACCR2_IASS_BIT) /* Input Audio Sample Size is 20-bit */
1090 #define AIC_ACCR2_IASS_18BIT (1 << AIC_ACCR2_IASS_BIT) /* Input Audio Sample Size is 18-bit */ 1090 #define AIC_ACCR2_IASS_18BIT (1 << AIC_ACCR2_IASS_BIT) /* Input Audio Sample Size is 18-bit */
1091 #define AIC_ACCR2_IASS_16BIT (2 << AIC_ACCR2_IASS_BIT) /* Input Audio Sample Size is 16-bit */ 1091 #define AIC_ACCR2_IASS_16BIT (2 << AIC_ACCR2_IASS_BIT) /* Input Audio Sample Size is 16-bit */
1092 #define AIC_ACCR2_IASS_8BIT (3 << AIC_ACCR2_IASS_BIT) /* Input Audio Sample Size is 8-bit */ 1092 #define AIC_ACCR2_IASS_8BIT (3 << AIC_ACCR2_IASS_BIT) /* Input Audio Sample Size is 8-bit */
1093#define AIC_ACCR2_SO (1 << 3) /* SDATA_OUT output value */ 1093#define AIC_ACCR2_SO (1 << 3) /* SDATA_OUT output value */
1094#define AIC_ACCR2_SR (1 << 2) /* RESET# pin level */ 1094#define AIC_ACCR2_SR (1 << 2) /* RESET# pin level */
1095#define AIC_ACCR2_SS (1 << 1) /* SYNC pin level */ 1095#define AIC_ACCR2_SS (1 << 1) /* SYNC pin level */
1096#define AIC_ACCR2_SA (1 << 0) /* SYNC and SDATA_OUT alternation */ 1096#define AIC_ACCR2_SA (1 << 0) /* SYNC and SDATA_OUT alternation */
1097 1097
1098/* AIC Controller I2S/MSB-justified Control Register (AIC_I2SCR) */ 1098/* AIC Controller I2S/MSB-justified Control Register (AIC_I2SCR) */
1099 1099
1100#define AIC_I2SCR_STPBK (1 << 12) /* Stop BIT_CLK for I2S/MSB-justified */ 1100#define AIC_I2SCR_STPBK (1 << 12) /* Stop BIT_CLK for I2S/MSB-justified */
1101#define AIC_I2SCR_WL_BIT 1 /* Input/Output Sample Size for I2S/MSB-justified */ 1101#define AIC_I2SCR_WL_BIT 1 /* Input/Output Sample Size for I2S/MSB-justified */
1102#define AIC_I2SCR_WL_MASK (0x7 << AIC_I2SCR_WL_BIT) 1102#define AIC_I2SCR_WL_MASK (0x7 << AIC_I2SCR_WL_BIT)
1103 #define AIC_I2SCR_WL_24BIT (0 << AIC_I2SCR_WL_BIT) /* Word Length is 24 bit */ 1103 #define AIC_I2SCR_WL_24BIT (0 << AIC_I2SCR_WL_BIT) /* Word Length is 24 bit */
1104 #define AIC_I2SCR_WL_20BIT (1 << AIC_I2SCR_WL_BIT) /* Word Length is 20 bit */ 1104 #define AIC_I2SCR_WL_20BIT (1 << AIC_I2SCR_WL_BIT) /* Word Length is 20 bit */
1105 #define AIC_I2SCR_WL_18BIT (2 << AIC_I2SCR_WL_BIT) /* Word Length is 18 bit */ 1105 #define AIC_I2SCR_WL_18BIT (2 << AIC_I2SCR_WL_BIT) /* Word Length is 18 bit */
1106 #define AIC_I2SCR_WL_16BIT (3 << AIC_I2SCR_WL_BIT) /* Word Length is 16 bit */ 1106 #define AIC_I2SCR_WL_16BIT (3 << AIC_I2SCR_WL_BIT) /* Word Length is 16 bit */
1107 #define AIC_I2SCR_WL_8BIT (4 << AIC_I2SCR_WL_BIT) /* Word Length is 8 bit */ 1107 #define AIC_I2SCR_WL_8BIT (4 << AIC_I2SCR_WL_BIT) /* Word Length is 8 bit */
1108#define AIC_I2SCR_AMSL (1 << 0) /* 0:I2S, 1:MSB-justified */ 1108#define AIC_I2SCR_AMSL (1 << 0) /* 0:I2S, 1:MSB-justified */
1109 1109
1110/* AIC Controller FIFO Status Register (AIC_SR) */ 1110/* AIC Controller FIFO Status Register (AIC_SR) */
1111 1111
1112#define AIC_SR_RFL_BIT 24 /* Receive FIFO Level */ 1112#define AIC_SR_RFL_BIT 24 /* Receive FIFO Level */
1113#define AIC_SR_RFL_MASK (0x3f << AIC_SR_RFL_BIT) 1113#define AIC_SR_RFL_MASK (0x3f << AIC_SR_RFL_BIT)
1114#define AIC_SR_TFL_BIT 8 /* Transmit FIFO level */ 1114#define AIC_SR_TFL_BIT 8 /* Transmit FIFO level */
1115#define AIC_SR_TFL_MASK (0x3f << AIC_SR_TFL_BIT) 1115#define AIC_SR_TFL_MASK (0x3f << AIC_SR_TFL_BIT)
1116#define AIC_SR_ROR (1 << 6) /* Receive FIFO Overrun */ 1116#define AIC_SR_ROR (1 << 6) /* Receive FIFO Overrun */
1117#define AIC_SR_TUR (1 << 5) /* Transmit FIFO Underrun */ 1117#define AIC_SR_TUR (1 << 5) /* Transmit FIFO Underrun */
1118#define AIC_SR_RFS (1 << 4) /* Receive FIFO Service Request */ 1118#define AIC_SR_RFS (1 << 4) /* Receive FIFO Service Request */
1119#define AIC_SR_TFS (1 << 3) /* Transmit FIFO Service Request */ 1119#define AIC_SR_TFS (1 << 3) /* Transmit FIFO Service Request */
1120 1120
1121/* AIC Controller AC-link Status Register (AIC_ACSR) */ 1121/* AIC Controller AC-link Status Register (AIC_ACSR) */
1122 1122
1123#define AIC_ACSR_SLTERR (1 << 21) /* Slot Error Flag */ 1123#define AIC_ACSR_SLTERR (1 << 21) /* Slot Error Flag */
1124#define AIC_ACSR_CRDY (1 << 20) /* External CODEC Ready Flag */ 1124#define AIC_ACSR_CRDY (1 << 20) /* External CODEC Ready Flag */
1125#define AIC_ACSR_CLPM (1 << 19) /* External CODEC low power mode flag */ 1125#define AIC_ACSR_CLPM (1 << 19) /* External CODEC low power mode flag */
1126#define AIC_ACSR_RSTO (1 << 18) /* External CODEC regs read status timeout */ 1126#define AIC_ACSR_RSTO (1 << 18) /* External CODEC regs read status timeout */
1127#define AIC_ACSR_SADR (1 << 17) /* External CODEC regs status addr and data received */ 1127#define AIC_ACSR_SADR (1 << 17) /* External CODEC regs status addr and data received */
1128#define AIC_ACSR_CADT (1 << 16) /* Command Address and Data Transmitted */ 1128#define AIC_ACSR_CADT (1 << 16) /* Command Address and Data Transmitted */
1129 1129
1130/* AIC Controller I2S/MSB-justified Status Register (AIC_I2SSR) */ 1130/* AIC Controller I2S/MSB-justified Status Register (AIC_I2SSR) */
1131 1131
1132#define AIC_I2SSR_BSY (1 << 2) /* AIC Busy in I2S/MSB-justified format */ 1132#define AIC_I2SSR_BSY (1 << 2) /* AIC Busy in I2S/MSB-justified format */
1133 1133
1134/* AIC Controller AC97 codec Command Address Register (AIC_ACCAR) */ 1134/* AIC Controller AC97 codec Command Address Register (AIC_ACCAR) */
1135 1135
1136#define AIC_ACCAR_CAR_BIT 0 1136#define AIC_ACCAR_CAR_BIT 0
1137#define AIC_ACCAR_CAR_MASK (0xfffff << AIC_ACCAR_CAR_BIT) 1137#define AIC_ACCAR_CAR_MASK (0xfffff << AIC_ACCAR_CAR_BIT)
1138 1138
1139/* AIC Controller AC97 codec Command Data Register (AIC_ACCDR) */ 1139/* AIC Controller AC97 codec Command Data Register (AIC_ACCDR) */
1140 1140
1141#define AIC_ACCDR_CDR_BIT 0 1141#define AIC_ACCDR_CDR_BIT 0
1142#define AIC_ACCDR_CDR_MASK (0xfffff << AIC_ACCDR_CDR_BIT) 1142#define AIC_ACCDR_CDR_MASK (0xfffff << AIC_ACCDR_CDR_BIT)
1143 1143
1144/* AIC Controller AC97 codec Status Address Register (AIC_ACSAR) */ 1144/* AIC Controller AC97 codec Status Address Register (AIC_ACSAR) */
1145 1145
1146#define AIC_ACSAR_SAR_BIT 0 1146#define AIC_ACSAR_SAR_BIT 0
1147#define AIC_ACSAR_SAR_MASK (0xfffff << AIC_ACSAR_SAR_BIT) 1147#define AIC_ACSAR_SAR_MASK (0xfffff << AIC_ACSAR_SAR_BIT)
1148 1148
1149/* AIC Controller AC97 codec Status Data Register (AIC_ACSDR) */ 1149/* AIC Controller AC97 codec Status Data Register (AIC_ACSDR) */
1150 1150
1151#define AIC_ACSDR_SDR_BIT 0 1151#define AIC_ACSDR_SDR_BIT 0
1152#define AIC_ACSDR_SDR_MASK (0xfffff << AIC_ACSDR_SDR_BIT) 1152#define AIC_ACSDR_SDR_MASK (0xfffff << AIC_ACSDR_SDR_BIT)
1153 1153
1154/* AIC Controller I2S/MSB-justified Clock Divider Register (AIC_I2SDIV) */ 1154/* AIC Controller I2S/MSB-justified Clock Divider Register (AIC_I2SDIV) */
1155 1155
1156#define AIC_I2SDIV_DIV_BIT 0 1156#define AIC_I2SDIV_DIV_BIT 0
1157#define AIC_I2SDIV_DIV_MASK (0x7f << AIC_I2SDIV_DIV_BIT) 1157#define AIC_I2SDIV_DIV_MASK (0x7f << AIC_I2SDIV_DIV_BIT)
1158 #define AIC_I2SDIV_BITCLK_3072KHZ (0x0C << AIC_I2SDIV_DIV_BIT) /* BIT_CLK of 3.072MHz */ 1158 #define AIC_I2SDIV_BITCLK_3072KHZ (0x0C << AIC_I2SDIV_DIV_BIT) /* BIT_CLK of 3.072MHz */
1159 #define AIC_I2SDIV_BITCLK_2836KHZ (0x0D << AIC_I2SDIV_DIV_BIT) /* BIT_CLK of 2.836MHz */ 1159 #define AIC_I2SDIV_BITCLK_2836KHZ (0x0D << AIC_I2SDIV_DIV_BIT) /* BIT_CLK of 2.836MHz */
1160 #define AIC_I2SDIV_BITCLK_1418KHZ (0x1A << AIC_I2SDIV_DIV_BIT) /* BIT_CLK of 1.418MHz */ 1160 #define AIC_I2SDIV_BITCLK_1418KHZ (0x1A << AIC_I2SDIV_DIV_BIT) /* BIT_CLK of 1.418MHz */
1161 #define AIC_I2SDIV_BITCLK_1024KHZ (0x24 << AIC_I2SDIV_DIV_BIT) /* BIT_CLK of 1.024MHz */ 1161 #define AIC_I2SDIV_BITCLK_1024KHZ (0x24 << AIC_I2SDIV_DIV_BIT) /* BIT_CLK of 1.024MHz */
1162 #define AIC_I2SDIV_BITCLK_7089KHZ (0x34 << AIC_I2SDIV_DIV_BIT) /* BIT_CLK of 708.92KHz */ 1162 #define AIC_I2SDIV_BITCLK_7089KHZ (0x34 << AIC_I2SDIV_DIV_BIT) /* BIT_CLK of 708.92KHz */
1163 #define AIC_I2SDIV_BITCLK_512KHZ (0x48 << AIC_I2SDIV_DIV_BIT) /* BIT_CLK of 512.00KHz */ 1163 #define AIC_I2SDIV_BITCLK_512KHZ (0x48 << AIC_I2SDIV_DIV_BIT) /* BIT_CLK of 512.00KHz */
1164 1164
1165 1165
1166/************************************************************************* 1166/*************************************************************************
1167 * ICDC (Internal CODEC) 1167 * ICDC (Internal CODEC)
1168 *************************************************************************/ 1168 *************************************************************************/
1169#define ICDC_CR (ICDC_BASE + 0x0400) /* ICDC Control Register */ 1169#define ICDC_CR (ICDC_BASE + 0x0400) /* ICDC Control Register */
1170#define ICDC_APWAIT (ICDC_BASE + 0x0404) /* Anti-Pop WAIT Stage Timing Control Register */ 1170#define ICDC_APWAIT (ICDC_BASE + 0x0404) /* Anti-Pop WAIT Stage Timing Control Register */
1171#define ICDC_APPRE (ICDC_BASE + 0x0408) /* Anti-Pop HPEN-PRE Stage Timing Control Register */ 1171#define ICDC_APPRE (ICDC_BASE + 0x0408) /* Anti-Pop HPEN-PRE Stage Timing Control Register */
1172#define ICDC_APHPEN (ICDC_BASE + 0x040C) /* Anti-Pop HPEN Stage Timing Control Register */ 1172#define ICDC_APHPEN (ICDC_BASE + 0x040C) /* Anti-Pop HPEN Stage Timing Control Register */
1173#define ICDC_APSR (ICDC_BASE + 0x0410) /* Anti-Pop Status Register */ 1173#define ICDC_APSR (ICDC_BASE + 0x0410) /* Anti-Pop Status Register */
1174#define ICDC_CDCCR1 (ICDC_BASE + 0x0080) 1174#define ICDC_CDCCR1 (ICDC_BASE + 0x0080)
1175#define ICDC_CDCCR2 (ICDC_BASE + 0x0084) 1175#define ICDC_CDCCR2 (ICDC_BASE + 0x0084)
1176 1176
1177#define REG_ICDC_CR REG32(ICDC_CR) 1177#define REG_ICDC_CR REG32(ICDC_CR)
1178#define REG_ICDC_APWAIT REG32(ICDC_APWAIT) 1178#define REG_ICDC_APWAIT REG32(ICDC_APWAIT)
1179#define REG_ICDC_APPRE REG32(ICDC_APPRE) 1179#define REG_ICDC_APPRE REG32(ICDC_APPRE)
1180#define REG_ICDC_APHPEN REG32(ICDC_APHPEN) 1180#define REG_ICDC_APHPEN REG32(ICDC_APHPEN)
1181#define REG_ICDC_APSR REG32(ICDC_APSR) 1181#define REG_ICDC_APSR REG32(ICDC_APSR)
1182#define REG_ICDC_CDCCR1 REG32(ICDC_CDCCR1) 1182#define REG_ICDC_CDCCR1 REG32(ICDC_CDCCR1)
1183#define REG_ICDC_CDCCR2 REG32(ICDC_CDCCR2) 1183#define REG_ICDC_CDCCR2 REG32(ICDC_CDCCR2)
1184 1184
1185/* ICDC Control Register */ 1185/* ICDC Control Register */
1186#define ICDC_CR_LINVOL_BIT 24 /* LINE Input Volume Gain: GAIN=LINVOL*1.5-34.5 */ 1186#define ICDC_CR_LINVOL_BIT 24 /* LINE Input Volume Gain: GAIN=LINVOL*1.5-34.5 */
1187#define ICDC_CR_LINVOL_MASK (0x1f << ICDC_CR_LINVOL_BIT) 1187#define ICDC_CR_LINVOL_MASK (0x1f << ICDC_CR_LINVOL_BIT)
1188#define ICDC_CR_ASRATE_BIT 20 /* Audio Sample Rate */ 1188#define ICDC_CR_ASRATE_BIT 20 /* Audio Sample Rate */
1189#define ICDC_CR_ASRATE_MASK (0x0f << ICDC_CR_ASRATE_BIT) 1189#define ICDC_CR_ASRATE_MASK (0x0f << ICDC_CR_ASRATE_BIT)
1190 #define ICDC_CR_ASRATE_8000 (0x0 << ICDC_CR_ASRATE_BIT) 1190 #define ICDC_CR_ASRATE_8000 (0x0 << ICDC_CR_ASRATE_BIT)
1191 #define ICDC_CR_ASRATE_11025 (0x1 << ICDC_CR_ASRATE_BIT) 1191 #define ICDC_CR_ASRATE_11025 (0x1 << ICDC_CR_ASRATE_BIT)
1192 #define ICDC_CR_ASRATE_12000 (0x2 << ICDC_CR_ASRATE_BIT) 1192 #define ICDC_CR_ASRATE_12000 (0x2 << ICDC_CR_ASRATE_BIT)
1193 #define ICDC_CR_ASRATE_16000 (0x3 << ICDC_CR_ASRATE_BIT) 1193 #define ICDC_CR_ASRATE_16000 (0x3 << ICDC_CR_ASRATE_BIT)
1194 #define ICDC_CR_ASRATE_22050 (0x4 << ICDC_CR_ASRATE_BIT) 1194 #define ICDC_CR_ASRATE_22050 (0x4 << ICDC_CR_ASRATE_BIT)
1195 #define ICDC_CR_ASRATE_24000 (0x5 << ICDC_CR_ASRATE_BIT) 1195 #define ICDC_CR_ASRATE_24000 (0x5 << ICDC_CR_ASRATE_BIT)
1196 #define ICDC_CR_ASRATE_32000 (0x6 << ICDC_CR_ASRATE_BIT) 1196 #define ICDC_CR_ASRATE_32000 (0x6 << ICDC_CR_ASRATE_BIT)
1197 #define ICDC_CR_ASRATE_44100 (0x7 << ICDC_CR_ASRATE_BIT) 1197 #define ICDC_CR_ASRATE_44100 (0x7 << ICDC_CR_ASRATE_BIT)
1198 #define ICDC_CR_ASRATE_48000 (0x8 << ICDC_CR_ASRATE_BIT) 1198 #define ICDC_CR_ASRATE_48000 (0x8 << ICDC_CR_ASRATE_BIT)
1199#define ICDC_CR_MICBG_BIT 18 /* MIC Boost Gain */ 1199#define ICDC_CR_MICBG_BIT 18 /* MIC Boost Gain */
1200#define ICDC_CR_MICBG_MASK (0x3 << ICDC_CR_MICBG_BIT) 1200#define ICDC_CR_MICBG_MASK (0x3 << ICDC_CR_MICBG_BIT)
1201 #define ICDC_CR_MICBG_0DB (0x0 << ICDC_CR_MICBG_BIT) 1201 #define ICDC_CR_MICBG_0DB (0x0 << ICDC_CR_MICBG_BIT)
1202 #define ICDC_CR_MICBG_6DB (0x1 << ICDC_CR_MICBG_BIT) 1202 #define ICDC_CR_MICBG_6DB (0x1 << ICDC_CR_MICBG_BIT)
1203 #define ICDC_CR_MICBG_12DB (0x2 << ICDC_CR_MICBG_BIT) 1203 #define ICDC_CR_MICBG_12DB (0x2 << ICDC_CR_MICBG_BIT)
1204 #define ICDC_CR_MICBG_20DB (0x3 << ICDC_CR_MICBG_BIT) 1204 #define ICDC_CR_MICBG_20DB (0x3 << ICDC_CR_MICBG_BIT)
1205#define ICDC_CR_HPVOL_BIT 16 /* Headphone Volume Gain */ 1205#define ICDC_CR_HPVOL_BIT 16 /* Headphone Volume Gain */
1206#define ICDC_CR_HPVOL_MASK (0x3 << ICDC_CR_HPVOL_BIT) 1206#define ICDC_CR_HPVOL_MASK (0x3 << ICDC_CR_HPVOL_BIT)
1207 #define ICDC_CR_HPVOL_0DB (0x0 << ICDC_CR_HPVOL_BIT) 1207 #define ICDC_CR_HPVOL_0DB (0x0 << ICDC_CR_HPVOL_BIT)
1208 #define ICDC_CR_HPVOL_2DB (0x1 << ICDC_CR_HPVOL_BIT) 1208 #define ICDC_CR_HPVOL_2DB (0x1 << ICDC_CR_HPVOL_BIT)
1209 #define ICDC_CR_HPVOL_4DB (0x2 << ICDC_CR_HPVOL_BIT) 1209 #define ICDC_CR_HPVOL_4DB (0x2 << ICDC_CR_HPVOL_BIT)
1210 #define ICDC_CR_HPVOL_6DB (0x3 << ICDC_CR_HPVOL_BIT) 1210 #define ICDC_CR_HPVOL_6DB (0x3 << ICDC_CR_HPVOL_BIT)
1211#define ICDC_CR_ELINEIN (1 << 13) /* Enable LINE Input */ 1211#define ICDC_CR_ELINEIN (1 << 13) /* Enable LINE Input */
1212#define ICDC_CR_EMIC (1 << 12) /* Enable MIC Input */ 1212#define ICDC_CR_EMIC (1 << 12) /* Enable MIC Input */
1213#define ICDC_CR_SW1ON (1 << 11) /* Switch 1 in CODEC is on */ 1213#define ICDC_CR_SW1ON (1 << 11) /* Switch 1 in CODEC is on */
1214#define ICDC_CR_EADC (1 << 10) /* Enable ADC */ 1214#define ICDC_CR_EADC (1 << 10) /* Enable ADC */
1215#define ICDC_CR_SW2ON (1 << 9) /* Switch 2 in CODEC is on */ 1215#define ICDC_CR_SW2ON (1 << 9) /* Switch 2 in CODEC is on */
1216#define ICDC_CR_EDAC (1 << 8) /* Enable DAC */ 1216#define ICDC_CR_EDAC (1 << 8) /* Enable DAC */
1217#define ICDC_CR_HPMUTE (1 << 5) /* Headphone Mute */ 1217#define ICDC_CR_HPMUTE (1 << 5) /* Headphone Mute */
1218#define ICDC_CR_HPTON (1 << 4) /* Headphone Amplifier Trun On */ 1218#define ICDC_CR_HPTON (1 << 4) /* Headphone Amplifier Trun On */
1219#define ICDC_CR_HPTOFF (1 << 3) /* Headphone Amplifier Trun Off */ 1219#define ICDC_CR_HPTOFF (1 << 3) /* Headphone Amplifier Trun Off */
1220#define ICDC_CR_TAAP (1 << 2) /* Turn Around of the Anti-Pop Procedure */ 1220#define ICDC_CR_TAAP (1 << 2) /* Turn Around of the Anti-Pop Procedure */
1221#define ICDC_CR_EAP (1 << 1) /* Enable Anti-Pop Procedure */ 1221#define ICDC_CR_EAP (1 << 1) /* Enable Anti-Pop Procedure */
1222#define ICDC_CR_SUSPD (1 << 0) /* CODEC Suspend */ 1222#define ICDC_CR_SUSPD (1 << 0) /* CODEC Suspend */
1223 1223
1224/* Anti-Pop WAIT Stage Timing Control Register */ 1224/* Anti-Pop WAIT Stage Timing Control Register */
1225#define ICDC_APWAIT_WAITSN_BIT 0 1225#define ICDC_APWAIT_WAITSN_BIT 0
1226#define ICDC_APWAIT_WAITSN_MASK (0x7ff << ICDC_APWAIT_WAITSN_BIT) 1226#define ICDC_APWAIT_WAITSN_MASK (0x7ff << ICDC_APWAIT_WAITSN_BIT)
1227 1227
1228/* Anti-Pop HPEN-PRE Stage Timing Control Register */ 1228/* Anti-Pop HPEN-PRE Stage Timing Control Register */
1229#define ICDC_APPRE_PRESN_BIT 0 1229#define ICDC_APPRE_PRESN_BIT 0
1230#define ICDC_APPRE_PRESN_MASK (0x1ff << ICDC_APPRE_PRESN_BIT) 1230#define ICDC_APPRE_PRESN_MASK (0x1ff << ICDC_APPRE_PRESN_BIT)
1231 1231
1232/* Anti-Pop HPEN Stage Timing Control Register */ 1232/* Anti-Pop HPEN Stage Timing Control Register */
1233#define ICDC_APHPEN_HPENSN_BIT 0 1233#define ICDC_APHPEN_HPENSN_BIT 0
1234#define ICDC_APHPEN_HPENSN_MASK (0x3fff << ICDC_APHPEN_HPENSN_BIT) 1234#define ICDC_APHPEN_HPENSN_MASK (0x3fff << ICDC_APHPEN_HPENSN_BIT)
1235 1235
1236/* Anti-Pop Status Register */ 1236/* Anti-Pop Status Register */
1237#define ICDC_SR_HPST_BIT 14 /* Headphone Amplifier State */ 1237#define ICDC_SR_HPST_BIT 14 /* Headphone Amplifier State */
1238#define ICDC_SR_HPST_MASK (0x7 << ICDC_SR_HPST_BIT) 1238#define ICDC_SR_HPST_MASK (0x7 << ICDC_SR_HPST_BIT)
1239#define ICDC_SR_HPST_HP_OFF (0x0 << ICDC_SR_HPST_BIT) /* HP amplifier is off */ 1239#define ICDC_SR_HPST_HP_OFF (0x0 << ICDC_SR_HPST_BIT) /* HP amplifier is off */
1240#define ICDC_SR_HPST_TON_WAIT (0x1 << ICDC_SR_HPST_BIT) /* wait state in turn-on */ 1240#define ICDC_SR_HPST_TON_WAIT (0x1 << ICDC_SR_HPST_BIT) /* wait state in turn-on */
1241 #define ICDC_SR_HPST_TON_PRE (0x2 << ICDC_SR_HPST_BIT) /* pre-enable state in turn-on */ 1241 #define ICDC_SR_HPST_TON_PRE (0x2 << ICDC_SR_HPST_BIT) /* pre-enable state in turn-on */
1242#define ICDC_SR_HPST_TON_HPEN (0x3 << ICDC_SR_HPST_BIT) /* HP enable state in turn-on */ 1242#define ICDC_SR_HPST_TON_HPEN (0x3 << ICDC_SR_HPST_BIT) /* HP enable state in turn-on */
1243 #define ICDC_SR_HPST_TOFF_HPEN (0x4 << ICDC_SR_HPST_BIT) /* HP enable state in turn-off */ 1243 #define ICDC_SR_HPST_TOFF_HPEN (0x4 << ICDC_SR_HPST_BIT) /* HP enable state in turn-off */
1244 #define ICDC_SR_HPST_TOFF_PRE (0x5 << ICDC_SR_HPST_BIT) /* pre-enable state in turn-off */ 1244 #define ICDC_SR_HPST_TOFF_PRE (0x5 << ICDC_SR_HPST_BIT) /* pre-enable state in turn-off */
1245 #define ICDC_SR_HPST_TOFF_WAIT (0x6 << ICDC_SR_HPST_BIT) /* wait state in turn-off */ 1245 #define ICDC_SR_HPST_TOFF_WAIT (0x6 << ICDC_SR_HPST_BIT) /* wait state in turn-off */
1246 #define ICDC_SR_HPST_HP_ON (0x7 << ICDC_SR_HPST_BIT) /* HP amplifier is on */ 1246 #define ICDC_SR_HPST_HP_ON (0x7 << ICDC_SR_HPST_BIT) /* HP amplifier is on */
1247#define ICDC_SR_SNCNT_BIT 0 /* Sample Number Counter */ 1247#define ICDC_SR_SNCNT_BIT 0 /* Sample Number Counter */
1248#define ICDC_SR_SNCNT_MASK (0x3fff << ICDC_SR_SNCNT_BIT) 1248#define ICDC_SR_SNCNT_MASK (0x3fff << ICDC_SR_SNCNT_BIT)
1249 1249
1250 1250
1251/************************************************************************* 1251/*************************************************************************
1252 * I2C 1252 * I2C
1253 *************************************************************************/ 1253 *************************************************************************/
1254#define I2C_DR (I2C_BASE + 0x000) 1254#define I2C_DR (I2C_BASE + 0x000)
1255#define I2C_CR (I2C_BASE + 0x004) 1255#define I2C_CR (I2C_BASE + 0x004)
1256#define I2C_SR (I2C_BASE + 0x008) 1256#define I2C_SR (I2C_BASE + 0x008)
1257#define I2C_GR (I2C_BASE + 0x00C) 1257#define I2C_GR (I2C_BASE + 0x00C)
1258 1258
1259#define REG_I2C_DR REG8(I2C_DR) 1259#define REG_I2C_DR REG8(I2C_DR)
1260#define REG_I2C_CR REG8(I2C_CR) 1260#define REG_I2C_CR REG8(I2C_CR)
1261#define REG_I2C_SR REG8(I2C_SR) 1261#define REG_I2C_SR REG8(I2C_SR)
1262#define REG_I2C_GR REG16(I2C_GR) 1262#define REG_I2C_GR REG16(I2C_GR)
1263 1263
1264/* I2C Control Register (I2C_CR) */ 1264/* I2C Control Register (I2C_CR) */
1265 1265
1266#define I2C_CR_IEN (1 << 4) 1266#define I2C_CR_IEN (1 << 4)
1267#define I2C_CR_STA (1 << 3) 1267#define I2C_CR_STA (1 << 3)
1268#define I2C_CR_STO (1 << 2) 1268#define I2C_CR_STO (1 << 2)
1269#define I2C_CR_AC (1 << 1) 1269#define I2C_CR_AC (1 << 1)
1270#define I2C_CR_I2CE (1 << 0) 1270#define I2C_CR_I2CE (1 << 0)
1271 1271
1272/* I2C Status Register (I2C_SR) */ 1272/* I2C Status Register (I2C_SR) */
1273 1273
1274#define I2C_SR_STX (1 << 4) 1274#define I2C_SR_STX (1 << 4)
1275#define I2C_SR_BUSY (1 << 3) 1275#define I2C_SR_BUSY (1 << 3)
1276#define I2C_SR_TEND (1 << 2) 1276#define I2C_SR_TEND (1 << 2)
1277#define I2C_SR_DRF (1 << 1) 1277#define I2C_SR_DRF (1 << 1)
1278#define I2C_SR_ACKF (1 << 0) 1278#define I2C_SR_ACKF (1 << 0)
1279 1279
1280 1280
1281/************************************************************************* 1281/*************************************************************************
1282 * SSI 1282 * SSI
1283 *************************************************************************/ 1283 *************************************************************************/
1284#define SSI_DR (SSI_BASE + 0x000) 1284#define SSI_DR (SSI_BASE + 0x000)
1285#define SSI_CR0 (SSI_BASE + 0x004) 1285#define SSI_CR0 (SSI_BASE + 0x004)
1286#define SSI_CR1 (SSI_BASE + 0x008) 1286#define SSI_CR1 (SSI_BASE + 0x008)
1287#define SSI_SR (SSI_BASE + 0x00C) 1287#define SSI_SR (SSI_BASE + 0x00C)
1288#define SSI_ITR (SSI_BASE + 0x010) 1288#define SSI_ITR (SSI_BASE + 0x010)
1289#define SSI_ICR (SSI_BASE + 0x014) 1289#define SSI_ICR (SSI_BASE + 0x014)
1290#define SSI_GR (SSI_BASE + 0x018) 1290#define SSI_GR (SSI_BASE + 0x018)
1291 1291
1292#define REG_SSI_DR REG32(SSI_DR) 1292#define REG_SSI_DR REG32(SSI_DR)
1293#define REG_SSI_CR0 REG16(SSI_CR0) 1293#define REG_SSI_CR0 REG16(SSI_CR0)
1294#define REG_SSI_CR1 REG32(SSI_CR1) 1294#define REG_SSI_CR1 REG32(SSI_CR1)
1295#define REG_SSI_SR REG32(SSI_SR) 1295#define REG_SSI_SR REG32(SSI_SR)
1296#define REG_SSI_ITR REG16(SSI_ITR) 1296#define REG_SSI_ITR REG16(SSI_ITR)
1297#define REG_SSI_ICR REG8(SSI_ICR) 1297#define REG_SSI_ICR REG8(SSI_ICR)
1298#define REG_SSI_GR REG16(SSI_GR) 1298#define REG_SSI_GR REG16(SSI_GR)
1299 1299
1300/* SSI Data Register (SSI_DR) */ 1300/* SSI Data Register (SSI_DR) */
1301 1301
1302#define SSI_DR_GPC_BIT 0 1302#define SSI_DR_GPC_BIT 0
1303#define SSI_DR_GPC_MASK (0x1ff << SSI_DR_GPC_BIT) 1303#define SSI_DR_GPC_MASK (0x1ff << SSI_DR_GPC_BIT)
1304 1304
1305/* SSI Control Register 0 (SSI_CR0) */ 1305/* SSI Control Register 0 (SSI_CR0) */
1306 1306
1307#define SSI_CR0_SSIE (1 << 15) 1307#define SSI_CR0_SSIE (1 << 15)
1308#define SSI_CR0_TIE (1 << 14) 1308#define SSI_CR0_TIE (1 << 14)
1309#define SSI_CR0_RIE (1 << 13) 1309#define SSI_CR0_RIE (1 << 13)
1310#define SSI_CR0_TEIE (1 << 12) 1310#define SSI_CR0_TEIE (1 << 12)
1311#define SSI_CR0_REIE (1 << 11) 1311#define SSI_CR0_REIE (1 << 11)
1312#define SSI_CR0_LOOP (1 << 10) 1312#define SSI_CR0_LOOP (1 << 10)
1313#define SSI_CR0_RFINE (1 << 9) 1313#define SSI_CR0_RFINE (1 << 9)
1314#define SSI_CR0_RFINC (1 << 8) 1314#define SSI_CR0_RFINC (1 << 8)
1315#define SSI_CR0_FSEL (1 << 6) 1315#define SSI_CR0_FSEL (1 << 6)
1316#define SSI_CR0_TFLUSH (1 << 2) 1316#define SSI_CR0_TFLUSH (1 << 2)
1317#define SSI_CR0_RFLUSH (1 << 1) 1317#define SSI_CR0_RFLUSH (1 << 1)
1318#define SSI_CR0_DISREV (1 << 0) 1318#define SSI_CR0_DISREV (1 << 0)
1319 1319
1320/* SSI Control Register 1 (SSI_CR1) */ 1320/* SSI Control Register 1 (SSI_CR1) */
1321 1321
1322#define SSI_CR1_FRMHL_BIT 30 1322#define SSI_CR1_FRMHL_BIT 30
1323#define SSI_CR1_FRMHL_MASK (0x3 << SSI_CR1_FRMHL_BIT) 1323#define SSI_CR1_FRMHL_MASK (0x3 << SSI_CR1_FRMHL_BIT)
1324 #define SSI_CR1_FRMHL_CELOW_CE2LOW (0 << SSI_CR1_FRMHL_BIT) /* SSI_CE_ is low valid and SSI_CE2_ is low valid */ 1324 #define SSI_CR1_FRMHL_CELOW_CE2LOW (0 << SSI_CR1_FRMHL_BIT) /* SSI_CE_ is low valid and SSI_CE2_ is low valid */
1325 #define SSI_CR1_FRMHL_CEHIGH_CE2LOW (1 << SSI_CR1_FRMHL_BIT) /* SSI_CE_ is high valid and SSI_CE2_ is low valid */ 1325 #define SSI_CR1_FRMHL_CEHIGH_CE2LOW (1 << SSI_CR1_FRMHL_BIT) /* SSI_CE_ is high valid and SSI_CE2_ is low valid */
1326 #define SSI_CR1_FRMHL_CELOW_CE2HIGH (2 << SSI_CR1_FRMHL_BIT) /* SSI_CE_ is low valid and SSI_CE2_ is high valid */ 1326 #define SSI_CR1_FRMHL_CELOW_CE2HIGH (2 << SSI_CR1_FRMHL_BIT) /* SSI_CE_ is low valid and SSI_CE2_ is high valid */
1327 #define SSI_CR1_FRMHL_CEHIGH_CE2HIGH (3 << SSI_CR1_FRMHL_BIT) /* SSI_CE_ is high valid and SSI_CE2_ is high valid */ 1327 #define SSI_CR1_FRMHL_CEHIGH_CE2HIGH (3 << SSI_CR1_FRMHL_BIT) /* SSI_CE_ is high valid and SSI_CE2_ is high valid */
1328#define SSI_CR1_TFVCK_BIT 28 1328#define SSI_CR1_TFVCK_BIT 28
1329#define SSI_CR1_TFVCK_MASK (0x3 << SSI_CR1_TFVCK_BIT) 1329#define SSI_CR1_TFVCK_MASK (0x3 << SSI_CR1_TFVCK_BIT)
1330 #define SSI_CR1_TFVCK_0 (0 << SSI_CR1_TFVCK_BIT) 1330 #define SSI_CR1_TFVCK_0 (0 << SSI_CR1_TFVCK_BIT)
1331 #define SSI_CR1_TFVCK_1 (1 << SSI_CR1_TFVCK_BIT) 1331 #define SSI_CR1_TFVCK_1 (1 << SSI_CR1_TFVCK_BIT)
1332 #define SSI_CR1_TFVCK_2 (2 << SSI_CR1_TFVCK_BIT) 1332 #define SSI_CR1_TFVCK_2 (2 << SSI_CR1_TFVCK_BIT)
1333 #define SSI_CR1_TFVCK_3 (3 << SSI_CR1_TFVCK_BIT) 1333 #define SSI_CR1_TFVCK_3 (3 << SSI_CR1_TFVCK_BIT)
1334#define SSI_CR1_TCKFI_BIT 26 1334#define SSI_CR1_TCKFI_BIT 26
1335#define SSI_CR1_TCKFI_MASK (0x3 << SSI_CR1_TCKFI_BIT) 1335#define SSI_CR1_TCKFI_MASK (0x3 << SSI_CR1_TCKFI_BIT)
1336 #define SSI_CR1_TCKFI_0 (0 << SSI_CR1_TCKFI_BIT) 1336 #define SSI_CR1_TCKFI_0 (0 << SSI_CR1_TCKFI_BIT)
1337 #define SSI_CR1_TCKFI_1 (1 << SSI_CR1_TCKFI_BIT) 1337 #define SSI_CR1_TCKFI_1 (1 << SSI_CR1_TCKFI_BIT)
1338 #define SSI_CR1_TCKFI_2 (2 << SSI_CR1_TCKFI_BIT) 1338 #define SSI_CR1_TCKFI_2 (2 << SSI_CR1_TCKFI_BIT)
1339 #define SSI_CR1_TCKFI_3 (3 << SSI_CR1_TCKFI_BIT) 1339 #define SSI_CR1_TCKFI_3 (3 << SSI_CR1_TCKFI_BIT)
1340#define SSI_CR1_LFST (1 << 25) 1340#define SSI_CR1_LFST (1 << 25)
1341#define SSI_CR1_ITFRM (1 << 24) 1341#define SSI_CR1_ITFRM (1 << 24)
1342#define SSI_CR1_UNFIN (1 << 23) 1342#define SSI_CR1_UNFIN (1 << 23)
1343#define SSI_CR1_MULTS (1 << 22) 1343#define SSI_CR1_MULTS (1 << 22)
1344#define SSI_CR1_FMAT_BIT 20 1344#define SSI_CR1_FMAT_BIT 20
1345#define SSI_CR1_FMAT_MASK (0x3 << SSI_CR1_FMAT_BIT) 1345#define SSI_CR1_FMAT_MASK (0x3 << SSI_CR1_FMAT_BIT)
1346 #define SSI_CR1_FMAT_SPI (0 << SSI_CR1_FMAT_BIT) /* Motorola¡¯s SPI format */ 1346 #define SSI_CR1_FMAT_SPI (0 << SSI_CR1_FMAT_BIT) /* Motorola¡¯s SPI format */
1347 #define SSI_CR1_FMAT_SSP (1 << SSI_CR1_FMAT_BIT) /* TI's SSP format */ 1347 #define SSI_CR1_FMAT_SSP (1 << SSI_CR1_FMAT_BIT) /* TI's SSP format */
1348 #define SSI_CR1_FMAT_MW1 (2 << SSI_CR1_FMAT_BIT) /* National Microwire 1 format */ 1348 #define SSI_CR1_FMAT_MW1 (2 << SSI_CR1_FMAT_BIT) /* National Microwire 1 format */
1349 #define SSI_CR1_FMAT_MW2 (3 << SSI_CR1_FMAT_BIT) /* National Microwire 2 format */ 1349 #define SSI_CR1_FMAT_MW2 (3 << SSI_CR1_FMAT_BIT) /* National Microwire 2 format */
1350#define SSI_CR1_TTRG_BIT 16 1350#define SSI_CR1_TTRG_BIT 16
1351#define SSI_CR1_TTRG_MASK (0xf << SSI_CR1_TTRG_BIT) 1351#define SSI_CR1_TTRG_MASK (0xf << SSI_CR1_TTRG_BIT)
1352 #define SSI_CR1_TTRG_1 (0 << SSI_CR1_TTRG_BIT) 1352 #define SSI_CR1_TTRG_1 (0 << SSI_CR1_TTRG_BIT)
1353 #define SSI_CR1_TTRG_8 (1 << SSI_CR1_TTRG_BIT) 1353 #define SSI_CR1_TTRG_8 (1 << SSI_CR1_TTRG_BIT)
1354 #define SSI_CR1_TTRG_16 (2 << SSI_CR1_TTRG_BIT) 1354 #define SSI_CR1_TTRG_16 (2 << SSI_CR1_TTRG_BIT)
1355 #define SSI_CR1_TTRG_24 (3 << SSI_CR1_TTRG_BIT) 1355 #define SSI_CR1_TTRG_24 (3 << SSI_CR1_TTRG_BIT)
1356 #define SSI_CR1_TTRG_32 (4 << SSI_CR1_TTRG_BIT) 1356 #define SSI_CR1_TTRG_32 (4 << SSI_CR1_TTRG_BIT)
1357 #define SSI_CR1_TTRG_40 (5 << SSI_CR1_TTRG_BIT) 1357 #define SSI_CR1_TTRG_40 (5 << SSI_CR1_TTRG_BIT)
1358 #define SSI_CR1_TTRG_48 (6 << SSI_CR1_TTRG_BIT) 1358 #define SSI_CR1_TTRG_48 (6 << SSI_CR1_TTRG_BIT)
1359 #define SSI_CR1_TTRG_56 (7 << SSI_CR1_TTRG_BIT) 1359 #define SSI_CR1_TTRG_56 (7 << SSI_CR1_TTRG_BIT)
1360 #define SSI_CR1_TTRG_64 (8 << SSI_CR1_TTRG_BIT) 1360 #define SSI_CR1_TTRG_64 (8 << SSI_CR1_TTRG_BIT)
1361 #define SSI_CR1_TTRG_72 (9 << SSI_CR1_TTRG_BIT) 1361 #define SSI_CR1_TTRG_72 (9 << SSI_CR1_TTRG_BIT)
1362 #define SSI_CR1_TTRG_80 (10<< SSI_CR1_TTRG_BIT) 1362 #define SSI_CR1_TTRG_80 (10<< SSI_CR1_TTRG_BIT)
1363 #define SSI_CR1_TTRG_88 (11<< SSI_CR1_TTRG_BIT) 1363 #define SSI_CR1_TTRG_88 (11<< SSI_CR1_TTRG_BIT)
1364 #define SSI_CR1_TTRG_96 (12<< SSI_CR1_TTRG_BIT) 1364 #define SSI_CR1_TTRG_96 (12<< SSI_CR1_TTRG_BIT)
1365 #define SSI_CR1_TTRG_104 (13<< SSI_CR1_TTRG_BIT) 1365 #define SSI_CR1_TTRG_104 (13<< SSI_CR1_TTRG_BIT)
1366 #define SSI_CR1_TTRG_112 (14<< SSI_CR1_TTRG_BIT) 1366 #define SSI_CR1_TTRG_112 (14<< SSI_CR1_TTRG_BIT)
1367 #define SSI_CR1_TTRG_120 (15<< SSI_CR1_TTRG_BIT) 1367 #define SSI_CR1_TTRG_120 (15<< SSI_CR1_TTRG_BIT)
1368#define SSI_CR1_MCOM_BIT 12 1368#define SSI_CR1_MCOM_BIT 12
1369#define SSI_CR1_MCOM_MASK (0xf << SSI_CR1_MCOM_BIT) 1369#define SSI_CR1_MCOM_MASK (0xf << SSI_CR1_MCOM_BIT)
1370 #define SSI_CR1_MCOM_1BIT (0x0 << SSI_CR1_MCOM_BIT) /* 1-bit command selected */ 1370 #define SSI_CR1_MCOM_1BIT (0x0 << SSI_CR1_MCOM_BIT) /* 1-bit command selected */
1371 #define SSI_CR1_MCOM_2BIT (0x1 << SSI_CR1_MCOM_BIT) /* 2-bit command selected */ 1371 #define SSI_CR1_MCOM_2BIT (0x1 << SSI_CR1_MCOM_BIT) /* 2-bit command selected */
1372 #define SSI_CR1_MCOM_3BIT (0x2 << SSI_CR1_MCOM_BIT) /* 3-bit command selected */ 1372 #define SSI_CR1_MCOM_3BIT (0x2 << SSI_CR1_MCOM_BIT) /* 3-bit command selected */
1373 #define SSI_CR1_MCOM_4BIT (0x3 << SSI_CR1_MCOM_BIT) /* 4-bit command selected */ 1373 #define SSI_CR1_MCOM_4BIT (0x3 << SSI_CR1_MCOM_BIT) /* 4-bit command selected */
1374 #define SSI_CR1_MCOM_5BIT (0x4 << SSI_CR1_MCOM_BIT) /* 5-bit command selected */ 1374 #define SSI_CR1_MCOM_5BIT (0x4 << SSI_CR1_MCOM_BIT) /* 5-bit command selected */
1375 #define SSI_CR1_MCOM_6BIT (0x5 << SSI_CR1_MCOM_BIT) /* 6-bit command selected */ 1375 #define SSI_CR1_MCOM_6BIT (0x5 << SSI_CR1_MCOM_BIT) /* 6-bit command selected */
1376 #define SSI_CR1_MCOM_7BIT (0x6 << SSI_CR1_MCOM_BIT) /* 7-bit command selected */ 1376 #define SSI_CR1_MCOM_7BIT (0x6 << SSI_CR1_MCOM_BIT) /* 7-bit command selected */
1377 #define SSI_CR1_MCOM_8BIT (0x7 << SSI_CR1_MCOM_BIT) /* 8-bit command selected */ 1377 #define SSI_CR1_MCOM_8BIT (0x7 << SSI_CR1_MCOM_BIT) /* 8-bit command selected */
1378 #define SSI_CR1_MCOM_9BIT (0x8 << SSI_CR1_MCOM_BIT) /* 9-bit command selected */ 1378 #define SSI_CR1_MCOM_9BIT (0x8 << SSI_CR1_MCOM_BIT) /* 9-bit command selected */
1379 #define SSI_CR1_MCOM_10BIT (0x9 << SSI_CR1_MCOM_BIT) /* 10-bit command selected */ 1379 #define SSI_CR1_MCOM_10BIT (0x9 << SSI_CR1_MCOM_BIT) /* 10-bit command selected */
1380 #define SSI_CR1_MCOM_11BIT (0xA << SSI_CR1_MCOM_BIT) /* 11-bit command selected */ 1380 #define SSI_CR1_MCOM_11BIT (0xA << SSI_CR1_MCOM_BIT) /* 11-bit command selected */
1381 #define SSI_CR1_MCOM_12BIT (0xB << SSI_CR1_MCOM_BIT) /* 12-bit command selected */ 1381 #define SSI_CR1_MCOM_12BIT (0xB << SSI_CR1_MCOM_BIT) /* 12-bit command selected */
1382 #define SSI_CR1_MCOM_13BIT (0xC << SSI_CR1_MCOM_BIT) /* 13-bit command selected */ 1382 #define SSI_CR1_MCOM_13BIT (0xC << SSI_CR1_MCOM_BIT) /* 13-bit command selected */
1383 #define SSI_CR1_MCOM_14BIT (0xD << SSI_CR1_MCOM_BIT) /* 14-bit command selected */ 1383 #define SSI_CR1_MCOM_14BIT (0xD << SSI_CR1_MCOM_BIT) /* 14-bit command selected */
1384 #define SSI_CR1_MCOM_15BIT (0xE << SSI_CR1_MCOM_BIT) /* 15-bit command selected */ 1384 #define SSI_CR1_MCOM_15BIT (0xE << SSI_CR1_MCOM_BIT) /* 15-bit command selected */
1385 #define SSI_CR1_MCOM_16BIT (0xF << SSI_CR1_MCOM_BIT) /* 16-bit command selected */ 1385 #define SSI_CR1_MCOM_16BIT (0xF << SSI_CR1_MCOM_BIT) /* 16-bit command selected */
1386#define SSI_CR1_RTRG_BIT 8 1386#define SSI_CR1_RTRG_BIT 8
1387#define SSI_CR1_RTRG_MASK (0xf << SSI_CR1_RTRG_BIT) 1387#define SSI_CR1_RTRG_MASK (0xf << SSI_CR1_RTRG_BIT)
1388 #define SSI_CR1_RTRG_1 (0 << SSI_CR1_RTRG_BIT) 1388 #define SSI_CR1_RTRG_1 (0 << SSI_CR1_RTRG_BIT)
1389 #define SSI_CR1_RTRG_8 (1 << SSI_CR1_RTRG_BIT) 1389 #define SSI_CR1_RTRG_8 (1 << SSI_CR1_RTRG_BIT)
1390 #define SSI_CR1_RTRG_16 (2 << SSI_CR1_RTRG_BIT) 1390 #define SSI_CR1_RTRG_16 (2 << SSI_CR1_RTRG_BIT)
1391 #define SSI_CR1_RTRG_24 (3 << SSI_CR1_RTRG_BIT) 1391 #define SSI_CR1_RTRG_24 (3 << SSI_CR1_RTRG_BIT)
1392 #define SSI_CR1_RTRG_32 (4 << SSI_CR1_RTRG_BIT) 1392 #define SSI_CR1_RTRG_32 (4 << SSI_CR1_RTRG_BIT)
1393 #define SSI_CR1_RTRG_40 (5 << SSI_CR1_RTRG_BIT) 1393 #define SSI_CR1_RTRG_40 (5 << SSI_CR1_RTRG_BIT)
1394 #define SSI_CR1_RTRG_48 (6 << SSI_CR1_RTRG_BIT) 1394 #define SSI_CR1_RTRG_48 (6 << SSI_CR1_RTRG_BIT)
1395 #define SSI_CR1_RTRG_56 (7 << SSI_CR1_RTRG_BIT) 1395 #define SSI_CR1_RTRG_56 (7 << SSI_CR1_RTRG_BIT)
1396 #define SSI_CR1_RTRG_64 (8 << SSI_CR1_RTRG_BIT) 1396 #define SSI_CR1_RTRG_64 (8 << SSI_CR1_RTRG_BIT)
1397 #define SSI_CR1_RTRG_72 (9 << SSI_CR1_RTRG_BIT) 1397 #define SSI_CR1_RTRG_72 (9 << SSI_CR1_RTRG_BIT)
1398 #define SSI_CR1_RTRG_80 (10<< SSI_CR1_RTRG_BIT) 1398 #define SSI_CR1_RTRG_80 (10<< SSI_CR1_RTRG_BIT)
1399 #define SSI_CR1_RTRG_88 (11<< SSI_CR1_RTRG_BIT) 1399 #define SSI_CR1_RTRG_88 (11<< SSI_CR1_RTRG_BIT)
1400 #define SSI_CR1_RTRG_96 (12<< SSI_CR1_RTRG_BIT) 1400 #define SSI_CR1_RTRG_96 (12<< SSI_CR1_RTRG_BIT)
1401 #define SSI_CR1_RTRG_104 (13<< SSI_CR1_RTRG_BIT) 1401 #define SSI_CR1_RTRG_104 (13<< SSI_CR1_RTRG_BIT)
1402 #define SSI_CR1_RTRG_112 (14<< SSI_CR1_RTRG_BIT) 1402 #define SSI_CR1_RTRG_112 (14<< SSI_CR1_RTRG_BIT)
1403 #define SSI_CR1_RTRG_120 (15<< SSI_CR1_RTRG_BIT) 1403 #define SSI_CR1_RTRG_120 (15<< SSI_CR1_RTRG_BIT)
1404#define SSI_CR1_FLEN_BIT 4 1404#define SSI_CR1_FLEN_BIT 4
1405#define SSI_CR1_FLEN_MASK (0xf << SSI_CR1_FLEN_BIT) 1405#define SSI_CR1_FLEN_MASK (0xf << SSI_CR1_FLEN_BIT)
1406 #define SSI_CR1_FLEN_2BIT (0x0 << SSI_CR1_FLEN_BIT) 1406 #define SSI_CR1_FLEN_2BIT (0x0 << SSI_CR1_FLEN_BIT)
1407 #define SSI_CR1_FLEN_3BIT (0x1 << SSI_CR1_FLEN_BIT) 1407 #define SSI_CR1_FLEN_3BIT (0x1 << SSI_CR1_FLEN_BIT)
1408 #define SSI_CR1_FLEN_4BIT (0x2 << SSI_CR1_FLEN_BIT) 1408 #define SSI_CR1_FLEN_4BIT (0x2 << SSI_CR1_FLEN_BIT)
1409 #define SSI_CR1_FLEN_5BIT (0x3 << SSI_CR1_FLEN_BIT) 1409 #define SSI_CR1_FLEN_5BIT (0x3 << SSI_CR1_FLEN_BIT)
1410 #define SSI_CR1_FLEN_6BIT (0x4 << SSI_CR1_FLEN_BIT) 1410 #define SSI_CR1_FLEN_6BIT (0x4 << SSI_CR1_FLEN_BIT)
1411 #define SSI_CR1_FLEN_7BIT (0x5 << SSI_CR1_FLEN_BIT) 1411 #define SSI_CR1_FLEN_7BIT (0x5 << SSI_CR1_FLEN_BIT)
1412 #define SSI_CR1_FLEN_8BIT (0x6 << SSI_CR1_FLEN_BIT) 1412 #define SSI_CR1_FLEN_8BIT (0x6 << SSI_CR1_FLEN_BIT)
1413 #define SSI_CR1_FLEN_9BIT (0x7 << SSI_CR1_FLEN_BIT) 1413 #define SSI_CR1_FLEN_9BIT (0x7 << SSI_CR1_FLEN_BIT)
1414 #define SSI_CR1_FLEN_10BIT (0x8 << SSI_CR1_FLEN_BIT) 1414 #define SSI_CR1_FLEN_10BIT (0x8 << SSI_CR1_FLEN_BIT)
1415 #define SSI_CR1_FLEN_11BIT (0x9 << SSI_CR1_FLEN_BIT) 1415 #define SSI_CR1_FLEN_11BIT (0x9 << SSI_CR1_FLEN_BIT)
1416 #define SSI_CR1_FLEN_12BIT (0xA << SSI_CR1_FLEN_BIT) 1416 #define SSI_CR1_FLEN_12BIT (0xA << SSI_CR1_FLEN_BIT)
1417 #define SSI_CR1_FLEN_13BIT (0xB << SSI_CR1_FLEN_BIT) 1417 #define SSI_CR1_FLEN_13BIT (0xB << SSI_CR1_FLEN_BIT)
1418 #define SSI_CR1_FLEN_14BIT (0xC << SSI_CR1_FLEN_BIT) 1418 #define SSI_CR1_FLEN_14BIT (0xC << SSI_CR1_FLEN_BIT)
1419 #define SSI_CR1_FLEN_15BIT (0xD << SSI_CR1_FLEN_BIT) 1419 #define SSI_CR1_FLEN_15BIT (0xD << SSI_CR1_FLEN_BIT)
1420 #define SSI_CR1_FLEN_16BIT (0xE << SSI_CR1_FLEN_BIT) 1420 #define SSI_CR1_FLEN_16BIT (0xE << SSI_CR1_FLEN_BIT)
1421 #define SSI_CR1_FLEN_17BIT (0xF << SSI_CR1_FLEN_BIT) 1421 #define SSI_CR1_FLEN_17BIT (0xF << SSI_CR1_FLEN_BIT)
1422#define SSI_CR1_PHA (1 << 1) 1422#define SSI_CR1_PHA (1 << 1)
1423#define SSI_CR1_POL (1 << 0) 1423#define SSI_CR1_POL (1 << 0)
1424 1424
1425/* SSI Status Register (SSI_SR) */ 1425/* SSI Status Register (SSI_SR) */
1426 1426
1427#define SSI_SR_TFIFONUM_BIT 16 1427#define SSI_SR_TFIFONUM_BIT 16
1428#define SSI_SR_TFIFONUM_MASK (0xff << SSI_SR_TFIFONUM_BIT) 1428#define SSI_SR_TFIFONUM_MASK (0xff << SSI_SR_TFIFONUM_BIT)
1429#define SSI_SR_RFIFONUM_BIT 8 1429#define SSI_SR_RFIFONUM_BIT 8
1430#define SSI_SR_RFIFONUM_MASK (0xff << SSI_SR_RFIFONUM_BIT) 1430#define SSI_SR_RFIFONUM_MASK (0xff << SSI_SR_RFIFONUM_BIT)
1431#define SSI_SR_END (1 << 7) 1431#define SSI_SR_END (1 << 7)
1432#define SSI_SR_BUSY (1 << 6) 1432#define SSI_SR_BUSY (1 << 6)
1433#define SSI_SR_TFF (1 << 5) 1433#define SSI_SR_TFF (1 << 5)
1434#define SSI_SR_RFE (1 << 4) 1434#define SSI_SR_RFE (1 << 4)
1435#define SSI_SR_TFHE (1 << 3) 1435#define SSI_SR_TFHE (1 << 3)
1436#define SSI_SR_RFHF (1 << 2) 1436#define SSI_SR_RFHF (1 << 2)
1437#define SSI_SR_UNDR (1 << 1) 1437#define SSI_SR_UNDR (1 << 1)
1438#define SSI_SR_OVER (1 << 0) 1438#define SSI_SR_OVER (1 << 0)
1439 1439
1440/* SSI Interval Time Control Register (SSI_ITR) */ 1440/* SSI Interval Time Control Register (SSI_ITR) */
1441 1441
1442#define SSI_ITR_CNTCLK (1 << 15) 1442#define SSI_ITR_CNTCLK (1 << 15)
1443#define SSI_ITR_IVLTM_BIT 0 1443#define SSI_ITR_IVLTM_BIT 0
1444#define SSI_ITR_IVLTM_MASK (0x7fff << SSI_ITR_IVLTM_BIT) 1444#define SSI_ITR_IVLTM_MASK (0x7fff << SSI_ITR_IVLTM_BIT)
1445 1445
1446 1446
1447/************************************************************************* 1447/*************************************************************************
1448 * MSC 1448 * MSC
1449 *************************************************************************/ 1449 *************************************************************************/
1450#define MSC_STRPCL (MSC_BASE + 0x000) 1450#define MSC_STRPCL (MSC_BASE + 0x000)
1451#define MSC_STAT (MSC_BASE + 0x004) 1451#define MSC_STAT (MSC_BASE + 0x004)
1452#define MSC_CLKRT (MSC_BASE + 0x008) 1452#define MSC_CLKRT (MSC_BASE + 0x008)
1453#define MSC_CMDAT (MSC_BASE + 0x00C) 1453#define MSC_CMDAT (MSC_BASE + 0x00C)
1454#define MSC_RESTO (MSC_BASE + 0x010) 1454#define MSC_RESTO (MSC_BASE + 0x010)
1455#define MSC_RDTO (MSC_BASE + 0x014) 1455#define MSC_RDTO (MSC_BASE + 0x014)
1456#define MSC_BLKLEN (MSC_BASE + 0x018) 1456#define MSC_BLKLEN (MSC_BASE + 0x018)
1457#define MSC_NOB (MSC_BASE + 0x01C) 1457#define MSC_NOB (MSC_BASE + 0x01C)
1458#define MSC_SNOB (MSC_BASE + 0x020) 1458#define MSC_SNOB (MSC_BASE + 0x020)
1459#define MSC_IMASK (MSC_BASE + 0x024) 1459#define MSC_IMASK (MSC_BASE + 0x024)
1460#define MSC_IREG (MSC_BASE + 0x028) 1460#define MSC_IREG (MSC_BASE + 0x028)
1461#define MSC_CMD (MSC_BASE + 0x02C) 1461#define MSC_CMD (MSC_BASE + 0x02C)
1462#define MSC_ARG (MSC_BASE + 0x030) 1462#define MSC_ARG (MSC_BASE + 0x030)
1463#define MSC_RES (MSC_BASE + 0x034) 1463#define MSC_RES (MSC_BASE + 0x034)
1464#define MSC_RXFIFO (MSC_BASE + 0x038) 1464#define MSC_RXFIFO (MSC_BASE + 0x038)
1465#define MSC_TXFIFO (MSC_BASE + 0x03C) 1465#define MSC_TXFIFO (MSC_BASE + 0x03C)
1466 1466
1467#define REG_MSC_STRPCL REG16(MSC_STRPCL) 1467#define REG_MSC_STRPCL REG16(MSC_STRPCL)
1468#define REG_MSC_STAT REG32(MSC_STAT) 1468#define REG_MSC_STAT REG32(MSC_STAT)
1469#define REG_MSC_CLKRT REG16(MSC_CLKRT) 1469#define REG_MSC_CLKRT REG16(MSC_CLKRT)
1470#define REG_MSC_CMDAT REG32(MSC_CMDAT) 1470#define REG_MSC_CMDAT REG32(MSC_CMDAT)
1471#define REG_MSC_RESTO REG16(MSC_RESTO) 1471#define REG_MSC_RESTO REG16(MSC_RESTO)
1472#define REG_MSC_RDTO REG16(MSC_RDTO) 1472#define REG_MSC_RDTO REG16(MSC_RDTO)
1473#define REG_MSC_BLKLEN REG16(MSC_BLKLEN) 1473#define REG_MSC_BLKLEN REG16(MSC_BLKLEN)
1474#define REG_MSC_NOB REG16(MSC_NOB) 1474#define REG_MSC_NOB REG16(MSC_NOB)
1475#define REG_MSC_SNOB REG16(MSC_SNOB) 1475#define REG_MSC_SNOB REG16(MSC_SNOB)
1476#define REG_MSC_IMASK REG16(MSC_IMASK) 1476#define REG_MSC_IMASK REG16(MSC_IMASK)
1477#define REG_MSC_IREG REG16(MSC_IREG) 1477#define REG_MSC_IREG REG16(MSC_IREG)
1478#define REG_MSC_CMD REG8(MSC_CMD) 1478#define REG_MSC_CMD REG8(MSC_CMD)
1479#define REG_MSC_ARG REG32(MSC_ARG) 1479#define REG_MSC_ARG REG32(MSC_ARG)
1480#define REG_MSC_RES REG16(MSC_RES) 1480#define REG_MSC_RES REG16(MSC_RES)
1481#define REG_MSC_RXFIFO REG32(MSC_RXFIFO) 1481#define REG_MSC_RXFIFO REG32(MSC_RXFIFO)
1482#define REG_MSC_TXFIFO REG32(MSC_TXFIFO) 1482#define REG_MSC_TXFIFO REG32(MSC_TXFIFO)
1483 1483
1484/* MSC Clock and Control Register (MSC_STRPCL) */ 1484/* MSC Clock and Control Register (MSC_STRPCL) */
1485 1485
1486#define MSC_STRPCL_EXIT_MULTIPLE (1 << 7) 1486#define MSC_STRPCL_EXIT_MULTIPLE (1 << 7)
1487#define MSC_STRPCL_EXIT_TRANSFER (1 << 6) 1487#define MSC_STRPCL_EXIT_TRANSFER (1 << 6)
1488#define MSC_STRPCL_START_READWAIT (1 << 5) 1488#define MSC_STRPCL_START_READWAIT (1 << 5)
1489#define MSC_STRPCL_STOP_READWAIT (1 << 4) 1489#define MSC_STRPCL_STOP_READWAIT (1 << 4)
1490#define MSC_STRPCL_RESET (1 << 3) 1490#define MSC_STRPCL_RESET (1 << 3)
1491#define MSC_STRPCL_START_OP (1 << 2) 1491#define MSC_STRPCL_START_OP (1 << 2)
1492#define MSC_STRPCL_CLOCK_CONTROL_BIT 0 1492#define MSC_STRPCL_CLOCK_CONTROL_BIT 0
1493#define MSC_STRPCL_CLOCK_CONTROL_MASK (0x3 << MSC_STRPCL_CLOCK_CONTROL_BIT) 1493#define MSC_STRPCL_CLOCK_CONTROL_MASK (0x3 << MSC_STRPCL_CLOCK_CONTROL_BIT)
1494 #define MSC_STRPCL_CLOCK_CONTROL_STOP (0x1 << MSC_STRPCL_CLOCK_CONTROL_BIT) /* Stop MMC/SD clock */ 1494 #define MSC_STRPCL_CLOCK_CONTROL_STOP (0x1 << MSC_STRPCL_CLOCK_CONTROL_BIT) /* Stop MMC/SD clock */
1495 #define MSC_STRPCL_CLOCK_CONTROL_START (0x2 << MSC_STRPCL_CLOCK_CONTROL_BIT) /* Start MMC/SD clock */ 1495 #define MSC_STRPCL_CLOCK_CONTROL_START (0x2 << MSC_STRPCL_CLOCK_CONTROL_BIT) /* Start MMC/SD clock */
1496 1496
1497/* MSC Status Register (MSC_STAT) */ 1497/* MSC Status Register (MSC_STAT) */
1498 1498
1499#define MSC_STAT_IS_RESETTING (1 << 15) 1499#define MSC_STAT_IS_RESETTING (1 << 15)
1500#define MSC_STAT_SDIO_INT_ACTIVE (1 << 14) 1500#define MSC_STAT_SDIO_INT_ACTIVE (1 << 14)
1501#define MSC_STAT_PRG_DONE (1 << 13) 1501#define MSC_STAT_PRG_DONE (1 << 13)
1502#define MSC_STAT_DATA_TRAN_DONE (1 << 12) 1502#define MSC_STAT_DATA_TRAN_DONE (1 << 12)
1503#define MSC_STAT_END_CMD_RES (1 << 11) 1503#define MSC_STAT_END_CMD_RES (1 << 11)
1504#define MSC_STAT_DATA_FIFO_AFULL (1 << 10) 1504#define MSC_STAT_DATA_FIFO_AFULL (1 << 10)
1505#define MSC_STAT_IS_READWAIT (1 << 9) 1505#define MSC_STAT_IS_READWAIT (1 << 9)
1506#define MSC_STAT_CLK_EN (1 << 8) 1506#define MSC_STAT_CLK_EN (1 << 8)
1507#define MSC_STAT_DATA_FIFO_FULL (1 << 7) 1507#define MSC_STAT_DATA_FIFO_FULL (1 << 7)
1508#define MSC_STAT_DATA_FIFO_EMPTY (1 << 6) 1508#define MSC_STAT_DATA_FIFO_EMPTY (1 << 6)
1509#define MSC_STAT_CRC_RES_ERR (1 << 5) 1509#define MSC_STAT_CRC_RES_ERR (1 << 5)
1510#define MSC_STAT_CRC_READ_ERROR (1 << 4) 1510#define MSC_STAT_CRC_READ_ERROR (1 << 4)
1511#define MSC_STAT_CRC_WRITE_ERROR_BIT 2 1511#define MSC_STAT_CRC_WRITE_ERROR_BIT 2
1512#define MSC_STAT_CRC_WRITE_ERROR_MASK (0x3 << MSC_STAT_CRC_WRITE_ERROR_BIT) 1512#define MSC_STAT_CRC_WRITE_ERROR_MASK (0x3 << MSC_STAT_CRC_WRITE_ERROR_BIT)
1513 #define MSC_STAT_CRC_WRITE_ERROR_NO (0 << MSC_STAT_CRC_WRITE_ERROR_BIT) /* No error on transmission of data */ 1513 #define MSC_STAT_CRC_WRITE_ERROR_NO (0 << MSC_STAT_CRC_WRITE_ERROR_BIT) /* No error on transmission of data */
1514 #define MSC_STAT_CRC_WRITE_ERROR (1 << MSC_STAT_CRC_WRITE_ERROR_BIT) /* Card observed erroneous transmission of data */ 1514 #define MSC_STAT_CRC_WRITE_ERROR (1 << MSC_STAT_CRC_WRITE_ERROR_BIT) /* Card observed erroneous transmission of data */
1515 #define MSC_STAT_CRC_WRITE_ERROR_NOSTS (2 << MSC_STAT_CRC_WRITE_ERROR_BIT) /* No CRC status is sent back */ 1515 #define MSC_STAT_CRC_WRITE_ERROR_NOSTS (2 << MSC_STAT_CRC_WRITE_ERROR_BIT) /* No CRC status is sent back */
1516#define MSC_STAT_TIME_OUT_RES (1 << 1) 1516#define MSC_STAT_TIME_OUT_RES (1 << 1)
1517#define MSC_STAT_TIME_OUT_READ (1 << 0) 1517#define MSC_STAT_TIME_OUT_READ (1 << 0)
1518 1518
1519/* MSC Bus Clock Control Register (MSC_CLKRT) */ 1519/* MSC Bus Clock Control Register (MSC_CLKRT) */
1520 1520
1521#define MSC_CLKRT_CLK_RATE_BIT 0 1521#define MSC_CLKRT_CLK_RATE_BIT 0
1522#define MSC_CLKRT_CLK_RATE_MASK (0x7 << MSC_CLKRT_CLK_RATE_BIT) 1522#define MSC_CLKRT_CLK_RATE_MASK (0x7 << MSC_CLKRT_CLK_RATE_BIT)
1523 #define MSC_CLKRT_CLK_RATE_DIV_1 (0x0 << MSC_CLKRT_CLK_RATE_BIT) /* CLK_SRC */ 1523 #define MSC_CLKRT_CLK_RATE_DIV_1 (0x0 << MSC_CLKRT_CLK_RATE_BIT) /* CLK_SRC */
1524 #define MSC_CLKRT_CLK_RATE_DIV_2 (0x1 << MSC_CLKRT_CLK_RATE_BIT) /* 1/2 of CLK_SRC */ 1524 #define MSC_CLKRT_CLK_RATE_DIV_2 (0x1 << MSC_CLKRT_CLK_RATE_BIT) /* 1/2 of CLK_SRC */
1525 #define MSC_CLKRT_CLK_RATE_DIV_4 (0x2 << MSC_CLKRT_CLK_RATE_BIT) /* 1/4 of CLK_SRC */ 1525 #define MSC_CLKRT_CLK_RATE_DIV_4 (0x2 << MSC_CLKRT_CLK_RATE_BIT) /* 1/4 of CLK_SRC */
1526 #define MSC_CLKRT_CLK_RATE_DIV_8 (0x3 << MSC_CLKRT_CLK_RATE_BIT) /* 1/8 of CLK_SRC */ 1526 #define MSC_CLKRT_CLK_RATE_DIV_8 (0x3 << MSC_CLKRT_CLK_RATE_BIT) /* 1/8 of CLK_SRC */
1527 #define MSC_CLKRT_CLK_RATE_DIV_16 (0x4 << MSC_CLKRT_CLK_RATE_BIT) /* 1/16 of CLK_SRC */ 1527 #define MSC_CLKRT_CLK_RATE_DIV_16 (0x4 << MSC_CLKRT_CLK_RATE_BIT) /* 1/16 of CLK_SRC */
1528 #define MSC_CLKRT_CLK_RATE_DIV_32 (0x5 << MSC_CLKRT_CLK_RATE_BIT) /* 1/32 of CLK_SRC */ 1528 #define MSC_CLKRT_CLK_RATE_DIV_32 (0x5 << MSC_CLKRT_CLK_RATE_BIT) /* 1/32 of CLK_SRC */
1529 #define MSC_CLKRT_CLK_RATE_DIV_64 (0x6 << MSC_CLKRT_CLK_RATE_BIT) /* 1/64 of CLK_SRC */ 1529 #define MSC_CLKRT_CLK_RATE_DIV_64 (0x6 << MSC_CLKRT_CLK_RATE_BIT) /* 1/64 of CLK_SRC */
1530 #define MSC_CLKRT_CLK_RATE_DIV_128 (0x7 << MSC_CLKRT_CLK_RATE_BIT) /* 1/128 of CLK_SRC */ 1530 #define MSC_CLKRT_CLK_RATE_DIV_128 (0x7 << MSC_CLKRT_CLK_RATE_BIT) /* 1/128 of CLK_SRC */
1531 1531
1532/* MSC Command Sequence Control Register (MSC_CMDAT) */ 1532/* MSC Command Sequence Control Register (MSC_CMDAT) */
1533 1533
1534#define MSC_CMDAT_IO_ABORT (1 << 11) 1534#define MSC_CMDAT_IO_ABORT (1 << 11)
1535#define MSC_CMDAT_BUS_WIDTH_BIT 9 1535#define MSC_CMDAT_BUS_WIDTH_BIT 9
1536#define MSC_CMDAT_BUS_WIDTH_MASK (0x3 << MSC_CMDAT_BUS_WIDTH_BIT) 1536#define MSC_CMDAT_BUS_WIDTH_MASK (0x3 << MSC_CMDAT_BUS_WIDTH_BIT)
1537 #define MSC_CMDAT_BUS_WIDTH_1BIT (0x0 << MSC_CMDAT_BUS_WIDTH_BIT) /* 1-bit data bus */ 1537 #define MSC_CMDAT_BUS_WIDTH_1BIT (0x0 << MSC_CMDAT_BUS_WIDTH_BIT) /* 1-bit data bus */
1538 #define MSC_CMDAT_BUS_WIDTH_4BIT (0x2 << MSC_CMDAT_BUS_WIDTH_BIT) /* 4-bit data bus */ 1538 #define MSC_CMDAT_BUS_WIDTH_4BIT (0x2 << MSC_CMDAT_BUS_WIDTH_BIT) /* 4-bit data bus */
1539 #define CMDAT_BUS_WIDTH1 (0x0 << MSC_CMDAT_BUS_WIDTH_BIT) 1539 #define CMDAT_BUS_WIDTH1 (0x0 << MSC_CMDAT_BUS_WIDTH_BIT)
1540 #define CMDAT_BUS_WIDTH4 (0x2 << MSC_CMDAT_BUS_WIDTH_BIT) 1540 #define CMDAT_BUS_WIDTH4 (0x2 << MSC_CMDAT_BUS_WIDTH_BIT)
1541#define MSC_CMDAT_DMA_EN (1 << 8) 1541#define MSC_CMDAT_DMA_EN (1 << 8)
1542#define MSC_CMDAT_INIT (1 << 7) 1542#define MSC_CMDAT_INIT (1 << 7)
1543#define MSC_CMDAT_BUSY (1 << 6) 1543#define MSC_CMDAT_BUSY (1 << 6)
1544#define MSC_CMDAT_STREAM_BLOCK (1 << 5) 1544#define MSC_CMDAT_STREAM_BLOCK (1 << 5)
1545#define MSC_CMDAT_WRITE (1 << 4) 1545#define MSC_CMDAT_WRITE (1 << 4)
1546#define MSC_CMDAT_READ (0 << 4) 1546#define MSC_CMDAT_READ (0 << 4)
1547#define MSC_CMDAT_DATA_EN (1 << 3) 1547#define MSC_CMDAT_DATA_EN (1 << 3)
1548#define MSC_CMDAT_RESPONSE_BIT 0 1548#define MSC_CMDAT_RESPONSE_BIT 0
1549#define MSC_CMDAT_RESPONSE_MASK (0x7 << MSC_CMDAT_RESPONSE_BIT) 1549#define MSC_CMDAT_RESPONSE_MASK (0x7 << MSC_CMDAT_RESPONSE_BIT)
1550 #define MSC_CMDAT_RESPONSE_NONE (0x0 << MSC_CMDAT_RESPONSE_BIT) /* No response */ 1550 #define MSC_CMDAT_RESPONSE_NONE (0x0 << MSC_CMDAT_RESPONSE_BIT) /* No response */
1551 #define MSC_CMDAT_RESPONSE_R1 (0x1 << MSC_CMDAT_RESPONSE_BIT) /* Format R1 and R1b */ 1551 #define MSC_CMDAT_RESPONSE_R1 (0x1 << MSC_CMDAT_RESPONSE_BIT) /* Format R1 and R1b */
1552 #define MSC_CMDAT_RESPONSE_R2 (0x2 << MSC_CMDAT_RESPONSE_BIT) /* Format R2 */ 1552 #define MSC_CMDAT_RESPONSE_R2 (0x2 << MSC_CMDAT_RESPONSE_BIT) /* Format R2 */
1553 #define MSC_CMDAT_RESPONSE_R3 (0x3 << MSC_CMDAT_RESPONSE_BIT) /* Format R3 */ 1553 #define MSC_CMDAT_RESPONSE_R3 (0x3 << MSC_CMDAT_RESPONSE_BIT) /* Format R3 */
1554 #define MSC_CMDAT_RESPONSE_R4 (0x4 << MSC_CMDAT_RESPONSE_BIT) /* Format R4 */ 1554 #define MSC_CMDAT_RESPONSE_R4 (0x4 << MSC_CMDAT_RESPONSE_BIT) /* Format R4 */
1555 #define MSC_CMDAT_RESPONSE_R5 (0x5 << MSC_CMDAT_RESPONSE_BIT) /* Format R5 */ 1555 #define MSC_CMDAT_RESPONSE_R5 (0x5 << MSC_CMDAT_RESPONSE_BIT) /* Format R5 */
1556 #define MSC_CMDAT_RESPONSE_R6 (0x6 << MSC_CMDAT_RESPONSE_BIT) /* Format R6 */ 1556 #define MSC_CMDAT_RESPONSE_R6 (0x6 << MSC_CMDAT_RESPONSE_BIT) /* Format R6 */
1557 1557
1558#define CMDAT_DMA_EN (1 << 8) 1558#define CMDAT_DMA_EN (1 << 8)
1559#define CMDAT_INIT (1 << 7) 1559#define CMDAT_INIT (1 << 7)
1560#define CMDAT_BUSY (1 << 6) 1560#define CMDAT_BUSY (1 << 6)
1561#define CMDAT_STREAM (1 << 5) 1561#define CMDAT_STREAM (1 << 5)
1562#define CMDAT_WRITE (1 << 4) 1562#define CMDAT_WRITE (1 << 4)
1563#define CMDAT_DATA_EN (1 << 3) 1563#define CMDAT_DATA_EN (1 << 3)
1564 1564
1565/* MSC Interrupts Mask Register (MSC_IMASK) */ 1565/* MSC Interrupts Mask Register (MSC_IMASK) */
1566 1566
1567#define MSC_IMASK_SDIO (1 << 7) 1567#define MSC_IMASK_SDIO (1 << 7)
1568#define MSC_IMASK_TXFIFO_WR_REQ (1 << 6) 1568#define MSC_IMASK_TXFIFO_WR_REQ (1 << 6)
1569#define MSC_IMASK_RXFIFO_RD_REQ (1 << 5) 1569#define MSC_IMASK_RXFIFO_RD_REQ (1 << 5)
1570#define MSC_IMASK_END_CMD_RES (1 << 2) 1570#define MSC_IMASK_END_CMD_RES (1 << 2)
1571#define MSC_IMASK_PRG_DONE (1 << 1) 1571#define MSC_IMASK_PRG_DONE (1 << 1)
1572#define MSC_IMASK_DATA_TRAN_DONE (1 << 0) 1572#define MSC_IMASK_DATA_TRAN_DONE (1 << 0)
1573 1573
1574 1574
1575/* MSC Interrupts Status Register (MSC_IREG) */ 1575/* MSC Interrupts Status Register (MSC_IREG) */
1576 1576
1577#define MSC_IREG_SDIO (1 << 7) 1577#define MSC_IREG_SDIO (1 << 7)
1578#define MSC_IREG_TXFIFO_WR_REQ (1 << 6) 1578#define MSC_IREG_TXFIFO_WR_REQ (1 << 6)
1579#define MSC_IREG_RXFIFO_RD_REQ (1 << 5) 1579#define MSC_IREG_RXFIFO_RD_REQ (1 << 5)
1580#define MSC_IREG_END_CMD_RES (1 << 2) 1580#define MSC_IREG_END_CMD_RES (1 << 2)
1581#define MSC_IREG_PRG_DONE (1 << 1) 1581#define MSC_IREG_PRG_DONE (1 << 1)
1582#define MSC_IREG_DATA_TRAN_DONE (1 << 0) 1582#define MSC_IREG_DATA_TRAN_DONE (1 << 0)
1583 1583
1584 1584
1585/************************************************************************* 1585/*************************************************************************
1586 * EMC (External Memory Controller) 1586 * EMC (External Memory Controller)
1587 *************************************************************************/ 1587 *************************************************************************/
1588#define EMC_BCR (EMC_BASE + 0x0) /* BCR */ 1588#define EMC_BCR (EMC_BASE + 0x0) /* BCR */
1589 1589
1590#define EMC_SMCR0 (EMC_BASE + 0x10) /* Static Memory Control Register 0 */ 1590#define EMC_SMCR0 (EMC_BASE + 0x10) /* Static Memory Control Register 0 */
1591#define EMC_SMCR1 (EMC_BASE + 0x14) /* Static Memory Control Register 1 */ 1591#define EMC_SMCR1 (EMC_BASE + 0x14) /* Static Memory Control Register 1 */
1592#define EMC_SMCR2 (EMC_BASE + 0x18) /* Static Memory Control Register 2 */ 1592#define EMC_SMCR2 (EMC_BASE + 0x18) /* Static Memory Control Register 2 */
1593#define EMC_SMCR3 (EMC_BASE + 0x1c) /* Static Memory Control Register 3 */ 1593#define EMC_SMCR3 (EMC_BASE + 0x1c) /* Static Memory Control Register 3 */
1594#define EMC_SMCR4 (EMC_BASE + 0x20) /* Static Memory Control Register 4 */ 1594#define EMC_SMCR4 (EMC_BASE + 0x20) /* Static Memory Control Register 4 */
1595#define EMC_SACR0 (EMC_BASE + 0x30) /* Static Memory Bank 0 Addr Config Reg */ 1595#define EMC_SACR0 (EMC_BASE + 0x30) /* Static Memory Bank 0 Addr Config Reg */
1596#define EMC_SACR1 (EMC_BASE + 0x34) /* Static Memory Bank 1 Addr Config Reg */ 1596#define EMC_SACR1 (EMC_BASE + 0x34) /* Static Memory Bank 1 Addr Config Reg */
1597#define EMC_SACR2 (EMC_BASE + 0x38) /* Static Memory Bank 2 Addr Config Reg */ 1597#define EMC_SACR2 (EMC_BASE + 0x38) /* Static Memory Bank 2 Addr Config Reg */
1598#define EMC_SACR3 (EMC_BASE + 0x3c) /* Static Memory Bank 3 Addr Config Reg */ 1598#define EMC_SACR3 (EMC_BASE + 0x3c) /* Static Memory Bank 3 Addr Config Reg */
1599#define EMC_SACR4 (EMC_BASE + 0x40) /* Static Memory Bank 4 Addr Config Reg */ 1599#define EMC_SACR4 (EMC_BASE + 0x40) /* Static Memory Bank 4 Addr Config Reg */
1600 1600
1601#define EMC_NFCSR (EMC_BASE + 0x050) /* NAND Flash Control/Status Register */ 1601#define EMC_NFCSR (EMC_BASE + 0x050) /* NAND Flash Control/Status Register */
1602#define EMC_NFECR (EMC_BASE + 0x100) /* NAND Flash ECC Control Register */ 1602#define EMC_NFECR (EMC_BASE + 0x100) /* NAND Flash ECC Control Register */
1603#define EMC_NFECC (EMC_BASE + 0x104) /* NAND Flash ECC Data Register */ 1603#define EMC_NFECC (EMC_BASE + 0x104) /* NAND Flash ECC Data Register */
1604#define EMC_NFPAR0 (EMC_BASE + 0x108) /* NAND Flash RS Parity 0 Register */ 1604#define EMC_NFPAR0 (EMC_BASE + 0x108) /* NAND Flash RS Parity 0 Register */
1605#define EMC_NFPAR1 (EMC_BASE + 0x10c) /* NAND Flash RS Parity 1 Register */ 1605#define EMC_NFPAR1 (EMC_BASE + 0x10c) /* NAND Flash RS Parity 1 Register */
1606#define EMC_NFPAR2 (EMC_BASE + 0x110) /* NAND Flash RS Parity 2 Register */ 1606#define EMC_NFPAR2 (EMC_BASE + 0x110) /* NAND Flash RS Parity 2 Register */
1607#define EMC_NFINTS (EMC_BASE + 0x114) /* NAND Flash Interrupt Status Register */ 1607#define EMC_NFINTS (EMC_BASE + 0x114) /* NAND Flash Interrupt Status Register */
1608#define EMC_NFINTE (EMC_BASE + 0x118) /* NAND Flash Interrupt Enable Register */ 1608#define EMC_NFINTE (EMC_BASE + 0x118) /* NAND Flash Interrupt Enable Register */
1609#define EMC_NFERR0 (EMC_BASE + 0x11c) /* NAND Flash RS Error Report 0 Register */ 1609#define EMC_NFERR0 (EMC_BASE + 0x11c) /* NAND Flash RS Error Report 0 Register */
1610#define EMC_NFERR1 (EMC_BASE + 0x120) /* NAND Flash RS Error Report 1 Register */ 1610#define EMC_NFERR1 (EMC_BASE + 0x120) /* NAND Flash RS Error Report 1 Register */
1611#define EMC_NFERR2 (EMC_BASE + 0x124) /* NAND Flash RS Error Report 2 Register */ 1611#define EMC_NFERR2 (EMC_BASE + 0x124) /* NAND Flash RS Error Report 2 Register */
1612#define EMC_NFERR3 (EMC_BASE + 0x128) /* NAND Flash RS Error Report 3 Register */ 1612#define EMC_NFERR3 (EMC_BASE + 0x128) /* NAND Flash RS Error Report 3 Register */
1613 1613
1614#define EMC_DMCR (EMC_BASE + 0x80) /* DRAM Control Register */ 1614#define EMC_DMCR (EMC_BASE + 0x80) /* DRAM Control Register */
1615#define EMC_RTCSR (EMC_BASE + 0x84) /* Refresh Time Control/Status Register */ 1615#define EMC_RTCSR (EMC_BASE + 0x84) /* Refresh Time Control/Status Register */
1616#define EMC_RTCNT (EMC_BASE + 0x88) /* Refresh Timer Counter */ 1616#define EMC_RTCNT (EMC_BASE + 0x88) /* Refresh Timer Counter */
1617#define EMC_RTCOR (EMC_BASE + 0x8c) /* Refresh Time Constant Register */ 1617#define EMC_RTCOR (EMC_BASE + 0x8c) /* Refresh Time Constant Register */
1618#define EMC_DMAR0 (EMC_BASE + 0x90) /* SDRAM Bank 0 Addr Config Register */ 1618#define EMC_DMAR0 (EMC_BASE + 0x90) /* SDRAM Bank 0 Addr Config Register */
1619#define EMC_SDMR0 (EMC_BASE + 0xa000) /* Mode Register of SDRAM bank 0 */ 1619#define EMC_SDMR0 (EMC_BASE + 0xa000) /* Mode Register of SDRAM bank 0 */
1620 1620
1621#define REG_EMC_BCR REG32(EMC_BCR) 1621#define REG_EMC_BCR REG32(EMC_BCR)
1622 1622
1623#define REG_EMC_SMCR0 REG32(EMC_SMCR0) 1623#define REG_EMC_SMCR0 REG32(EMC_SMCR0)
1624#define REG_EMC_SMCR1 REG32(EMC_SMCR1) 1624#define REG_EMC_SMCR1 REG32(EMC_SMCR1)
1625#define REG_EMC_SMCR2 REG32(EMC_SMCR2) 1625#define REG_EMC_SMCR2 REG32(EMC_SMCR2)
1626#define REG_EMC_SMCR3 REG32(EMC_SMCR3) 1626#define REG_EMC_SMCR3 REG32(EMC_SMCR3)
1627#define REG_EMC_SMCR4 REG32(EMC_SMCR4) 1627#define REG_EMC_SMCR4 REG32(EMC_SMCR4)
1628#define REG_EMC_SACR0 REG32(EMC_SACR0) 1628#define REG_EMC_SACR0 REG32(EMC_SACR0)
1629#define REG_EMC_SACR1 REG32(EMC_SACR1) 1629#define REG_EMC_SACR1 REG32(EMC_SACR1)
1630#define REG_EMC_SACR2 REG32(EMC_SACR2) 1630#define REG_EMC_SACR2 REG32(EMC_SACR2)
1631#define REG_EMC_SACR3 REG32(EMC_SACR3) 1631#define REG_EMC_SACR3 REG32(EMC_SACR3)
1632#define REG_EMC_SACR4 REG32(EMC_SACR4) 1632#define REG_EMC_SACR4 REG32(EMC_SACR4)
1633 1633
1634#define REG_EMC_NFCSR REG32(EMC_NFCSR) 1634#define REG_EMC_NFCSR REG32(EMC_NFCSR)
1635#define REG_EMC_NFECR REG32(EMC_NFECR) 1635#define REG_EMC_NFECR REG32(EMC_NFECR)
1636#define REG_EMC_NFECC REG32(EMC_NFECC) 1636#define REG_EMC_NFECC REG32(EMC_NFECC)
1637#define REG_EMC_NFPAR0 REG32(EMC_NFPAR0) 1637#define REG_EMC_NFPAR0 REG32(EMC_NFPAR0)
1638#define REG_EMC_NFPAR1 REG32(EMC_NFPAR1) 1638#define REG_EMC_NFPAR1 REG32(EMC_NFPAR1)
1639#define REG_EMC_NFPAR2 REG32(EMC_NFPAR2) 1639#define REG_EMC_NFPAR2 REG32(EMC_NFPAR2)
1640#define REG_EMC_NFINTS REG32(EMC_NFINTS) 1640#define REG_EMC_NFINTS REG32(EMC_NFINTS)
1641#define REG_EMC_NFINTE REG32(EMC_NFINTE) 1641#define REG_EMC_NFINTE REG32(EMC_NFINTE)
1642#define REG_EMC_NFERR0 REG32(EMC_NFERR0) 1642#define REG_EMC_NFERR0 REG32(EMC_NFERR0)
1643#define REG_EMC_NFERR1 REG32(EMC_NFERR1) 1643#define REG_EMC_NFERR1 REG32(EMC_NFERR1)
1644#define REG_EMC_NFERR2 REG32(EMC_NFERR2) 1644#define REG_EMC_NFERR2 REG32(EMC_NFERR2)
1645#define REG_EMC_NFERR3 REG32(EMC_NFERR3) 1645#define REG_EMC_NFERR3 REG32(EMC_NFERR3)
1646 1646
1647#define REG_EMC_DMCR REG32(EMC_DMCR) 1647#define REG_EMC_DMCR REG32(EMC_DMCR)
1648#define REG_EMC_RTCSR REG16(EMC_RTCSR) 1648#define REG_EMC_RTCSR REG16(EMC_RTCSR)
1649#define REG_EMC_RTCNT REG16(EMC_RTCNT) 1649#define REG_EMC_RTCNT REG16(EMC_RTCNT)
1650#define REG_EMC_RTCOR REG16(EMC_RTCOR) 1650#define REG_EMC_RTCOR REG16(EMC_RTCOR)
1651#define REG_EMC_DMAR0 REG32(EMC_DMAR0) 1651#define REG_EMC_DMAR0 REG32(EMC_DMAR0)
1652 1652
1653/* Static Memory Control Register */ 1653/* Static Memory Control Register */
1654#define EMC_SMCR_STRV_BIT 24 1654#define EMC_SMCR_STRV_BIT 24
1655#define EMC_SMCR_STRV_MASK (0x0f << EMC_SMCR_STRV_BIT) 1655#define EMC_SMCR_STRV_MASK (0x0f << EMC_SMCR_STRV_BIT)
1656#define EMC_SMCR_TAW_BIT 20 1656#define EMC_SMCR_TAW_BIT 20
1657#define EMC_SMCR_TAW_MASK (0x0f << EMC_SMCR_TAW_BIT) 1657#define EMC_SMCR_TAW_MASK (0x0f << EMC_SMCR_TAW_BIT)
1658#define EMC_SMCR_TBP_BIT 16 1658#define EMC_SMCR_TBP_BIT 16
1659#define EMC_SMCR_TBP_MASK (0x0f << EMC_SMCR_TBP_BIT) 1659#define EMC_SMCR_TBP_MASK (0x0f << EMC_SMCR_TBP_BIT)
1660#define EMC_SMCR_TAH_BIT 12 1660#define EMC_SMCR_TAH_BIT 12
1661#define EMC_SMCR_TAH_MASK (0x07 << EMC_SMCR_TAH_BIT) 1661#define EMC_SMCR_TAH_MASK (0x07 << EMC_SMCR_TAH_BIT)
1662#define EMC_SMCR_TAS_BIT 8 1662#define EMC_SMCR_TAS_BIT 8
1663#define EMC_SMCR_TAS_MASK (0x07 << EMC_SMCR_TAS_BIT) 1663#define EMC_SMCR_TAS_MASK (0x07 << EMC_SMCR_TAS_BIT)
1664#define EMC_SMCR_BW_BIT 6 1664#define EMC_SMCR_BW_BIT 6
1665#define EMC_SMCR_BW_MASK (0x03 << EMC_SMCR_BW_BIT) /* Bus Width? */ 1665#define EMC_SMCR_BW_MASK (0x03 << EMC_SMCR_BW_BIT) /* Bus Width? */
1666 #define EMC_SMCR_BW_8BIT (0 << EMC_SMCR_BW_BIT) 1666 #define EMC_SMCR_BW_8BIT (0 << EMC_SMCR_BW_BIT)
1667 #define EMC_SMCR_BW_16BIT (1 << EMC_SMCR_BW_BIT) 1667 #define EMC_SMCR_BW_16BIT (1 << EMC_SMCR_BW_BIT)
1668 #define EMC_SMCR_BW_32BIT (2 << EMC_SMCR_BW_BIT) 1668 #define EMC_SMCR_BW_32BIT (2 << EMC_SMCR_BW_BIT)
1669#define EMC_SMCR_BCM (1 << 3) 1669#define EMC_SMCR_BCM (1 << 3)
1670#define EMC_SMCR_BL_BIT 1 1670#define EMC_SMCR_BL_BIT 1
1671#define EMC_SMCR_BL_MASK (0x03 << EMC_SMCR_BL_BIT) /* Bus Latency? */ 1671#define EMC_SMCR_BL_MASK (0x03 << EMC_SMCR_BL_BIT) /* Bus Latency? */
1672 #define EMC_SMCR_BL_4 (0 << EMC_SMCR_BL_BIT) 1672 #define EMC_SMCR_BL_4 (0 << EMC_SMCR_BL_BIT)
1673 #define EMC_SMCR_BL_8 (1 << EMC_SMCR_BL_BIT) 1673 #define EMC_SMCR_BL_8 (1 << EMC_SMCR_BL_BIT)
1674 #define EMC_SMCR_BL_16 (2 << EMC_SMCR_BL_BIT) 1674 #define EMC_SMCR_BL_16 (2 << EMC_SMCR_BL_BIT)
1675 #define EMC_SMCR_BL_32 (3 << EMC_SMCR_BL_BIT) 1675 #define EMC_SMCR_BL_32 (3 << EMC_SMCR_BL_BIT)
1676#define EMC_SMCR_SMT (1 << 0) 1676#define EMC_SMCR_SMT (1 << 0)
1677 1677
1678/* Static Memory Bank Addr Config Reg */ 1678/* Static Memory Bank Addr Config Reg */
1679#define EMC_SACR_BASE_BIT 8 1679#define EMC_SACR_BASE_BIT 8
1680#define EMC_SACR_BASE_MASK (0xff << EMC_SACR_BASE_BIT) 1680#define EMC_SACR_BASE_MASK (0xff << EMC_SACR_BASE_BIT)
1681#define EMC_SACR_MASK_BIT 0 1681#define EMC_SACR_MASK_BIT 0
1682#define EMC_SACR_MASK_MASK (0xff << EMC_SACR_MASK_BIT) 1682#define EMC_SACR_MASK_MASK (0xff << EMC_SACR_MASK_BIT)
1683 1683
1684/* NAND Flash Control/Status Register */ 1684/* NAND Flash Control/Status Register */
1685#define EMC_NFCSR_NFCE4 (1 << 7) /* NAND Flash Enable */ 1685#define EMC_NFCSR_NFCE4 (1 << 7) /* NAND Flash Enable */
1686#define EMC_NFCSR_NFE4 (1 << 6) /* NAND Flash FCE# Assertion Enable */ 1686#define EMC_NFCSR_NFE4 (1 << 6) /* NAND Flash FCE# Assertion Enable */
1687#define EMC_NFCSR_NFCE3 (1 << 5) 1687#define EMC_NFCSR_NFCE3 (1 << 5)
1688#define EMC_NFCSR_NFE3 (1 << 4) 1688#define EMC_NFCSR_NFE3 (1 << 4)
1689#define EMC_NFCSR_NFCE2 (1 << 3) 1689#define EMC_NFCSR_NFCE2 (1 << 3)
1690#define EMC_NFCSR_NFE2 (1 << 2) 1690#define EMC_NFCSR_NFE2 (1 << 2)
1691#define EMC_NFCSR_NFCE1 (1 << 1) 1691#define EMC_NFCSR_NFCE1 (1 << 1)
1692#define EMC_NFCSR_NFE1 (1 << 0) 1692#define EMC_NFCSR_NFE1 (1 << 0)
1693 1693
1694/* NAND Flash ECC Control Register */ 1694/* NAND Flash ECC Control Register */
1695#define EMC_NFECR_PRDY (1 << 4) /* Parity Ready */ 1695#define EMC_NFECR_PRDY (1 << 4) /* Parity Ready */
1696#define EMC_NFECR_RS_DECODING (0 << 3) /* RS is in decoding phase */ 1696#define EMC_NFECR_RS_DECODING (0 << 3) /* RS is in decoding phase */
1697#define EMC_NFECR_RS_ENCODING (1 << 3) /* RS is in encoding phase */ 1697#define EMC_NFECR_RS_ENCODING (1 << 3) /* RS is in encoding phase */
1698#define EMC_NFECR_HAMMING (0 << 2) /* Select HAMMING Correction Algorithm */ 1698#define EMC_NFECR_HAMMING (0 << 2) /* Select HAMMING Correction Algorithm */
1699#define EMC_NFECR_RS (1 << 2) /* Select RS Correction Algorithm */ 1699#define EMC_NFECR_RS (1 << 2) /* Select RS Correction Algorithm */
1700#define EMC_NFECR_ERST (1 << 1) /* ECC Reset */ 1700#define EMC_NFECR_ERST (1 << 1) /* ECC Reset */
1701#define EMC_NFECR_ECCE (1 << 0) /* ECC Enable */ 1701#define EMC_NFECR_ECCE (1 << 0) /* ECC Enable */
1702 1702
1703/* NAND Flash ECC Data Register */ 1703/* NAND Flash ECC Data Register */
1704#define EMC_NFECC_ECC2_BIT 16 1704#define EMC_NFECC_ECC2_BIT 16
1705#define EMC_NFECC_ECC2_MASK (0xff << EMC_NFECC_ECC2_BIT) 1705#define EMC_NFECC_ECC2_MASK (0xff << EMC_NFECC_ECC2_BIT)
1706#define EMC_NFECC_ECC1_BIT 8 1706#define EMC_NFECC_ECC1_BIT 8
1707#define EMC_NFECC_ECC1_MASK (0xff << EMC_NFECC_ECC1_BIT) 1707#define EMC_NFECC_ECC1_MASK (0xff << EMC_NFECC_ECC1_BIT)
1708#define EMC_NFECC_ECC0_BIT 0 1708#define EMC_NFECC_ECC0_BIT 0
1709#define EMC_NFECC_ECC0_MASK (0xff << EMC_NFECC_ECC0_BIT) 1709#define EMC_NFECC_ECC0_MASK (0xff << EMC_NFECC_ECC0_BIT)
1710 1710
1711/* NAND Flash Interrupt Status Register */ 1711/* NAND Flash Interrupt Status Register */
1712#define EMC_NFINTS_ERRCNT_BIT 29 /* Error Count */ 1712#define EMC_NFINTS_ERRCNT_BIT 29 /* Error Count */
1713#define EMC_NFINTS_ERRCNT_MASK (0x7 << EMC_NFINTS_ERRCNT_BIT) 1713#define EMC_NFINTS_ERRCNT_MASK (0x7 << EMC_NFINTS_ERRCNT_BIT)
1714#define EMC_NFINTS_PADF (1 << 4) /* Padding Finished */ 1714#define EMC_NFINTS_PADF (1 << 4) /* Padding Finished */
1715#define EMC_NFINTS_DECF (1 << 3) /* Decoding Finished */ 1715#define EMC_NFINTS_DECF (1 << 3) /* Decoding Finished */
1716#define EMC_NFINTS_ENCF (1 << 2) /* Encoding Finished */ 1716#define EMC_NFINTS_ENCF (1 << 2) /* Encoding Finished */
1717#define EMC_NFINTS_UNCOR (1 << 1) /* Uncorrectable Error Occurred */ 1717#define EMC_NFINTS_UNCOR (1 << 1) /* Uncorrectable Error Occurred */
1718#define EMC_NFINTS_ERR (1 << 0) /* Error Occurred */ 1718#define EMC_NFINTS_ERR (1 << 0) /* Error Occurred */
1719 1719
1720/* NAND Flash Interrupt Enable Register */ 1720/* NAND Flash Interrupt Enable Register */
1721#define EMC_NFINTE_PADFE (1 << 4) /* Padding Finished Interrupt Enable */ 1721#define EMC_NFINTE_PADFE (1 << 4) /* Padding Finished Interrupt Enable */
1722#define EMC_NFINTE_DECFE (1 << 3) /* Decoding Finished Interrupt Enable */ 1722#define EMC_NFINTE_DECFE (1 << 3) /* Decoding Finished Interrupt Enable */
1723#define EMC_NFINTE_ENCFE (1 << 2) /* Encoding Finished Interrupt Enable */ 1723#define EMC_NFINTE_ENCFE (1 << 2) /* Encoding Finished Interrupt Enable */
1724#define EMC_NFINTE_UNCORE (1 << 1) /* Uncorrectable Error Occurred Intr Enable */ 1724#define EMC_NFINTE_UNCORE (1 << 1) /* Uncorrectable Error Occurred Intr Enable */
1725#define EMC_NFINTE_ERRE (1 << 0) /* Error Occurred Interrupt */ 1725#define EMC_NFINTE_ERRE (1 << 0) /* Error Occurred Interrupt */
1726 1726
1727/* NAND Flash RS Error Report Register */ 1727/* NAND Flash RS Error Report Register */
1728#define EMC_NFERR_INDEX_BIT 16 /* Error Symbol Index */ 1728#define EMC_NFERR_INDEX_BIT 16 /* Error Symbol Index */
1729#define EMC_NFERR_INDEX_MASK (0x1ff << EMC_NFERR_INDEX_BIT) 1729#define EMC_NFERR_INDEX_MASK (0x1ff << EMC_NFERR_INDEX_BIT)
1730#define EMC_NFERR_MASK_BIT 0 /* Error Symbol Value */ 1730#define EMC_NFERR_MASK_BIT 0 /* Error Symbol Value */
1731#define EMC_NFERR_MASK_MASK (0x1ff << EMC_NFERR_MASK_BIT) 1731#define EMC_NFERR_MASK_MASK (0x1ff << EMC_NFERR_MASK_BIT)
1732 1732
1733 1733
1734/* DRAM Control Register */ 1734/* DRAM Control Register */
1735#define EMC_DMCR_BW_BIT 31 1735#define EMC_DMCR_BW_BIT 31
1736#define EMC_DMCR_BW (1 << EMC_DMCR_BW_BIT) 1736#define EMC_DMCR_BW (1 << EMC_DMCR_BW_BIT)
1737#define EMC_DMCR_CA_BIT 26 1737#define EMC_DMCR_CA_BIT 26
1738#define EMC_DMCR_CA_MASK (0x07 << EMC_DMCR_CA_BIT) 1738#define EMC_DMCR_CA_MASK (0x07 << EMC_DMCR_CA_BIT)
1739 #define EMC_DMCR_CA_8 (0 << EMC_DMCR_CA_BIT) 1739 #define EMC_DMCR_CA_8 (0 << EMC_DMCR_CA_BIT)
1740 #define EMC_DMCR_CA_9 (1 << EMC_DMCR_CA_BIT) 1740 #define EMC_DMCR_CA_9 (1 << EMC_DMCR_CA_BIT)
1741 #define EMC_DMCR_CA_10 (2 << EMC_DMCR_CA_BIT) 1741 #define EMC_DMCR_CA_10 (2 << EMC_DMCR_CA_BIT)
1742 #define EMC_DMCR_CA_11 (3 << EMC_DMCR_CA_BIT) 1742 #define EMC_DMCR_CA_11 (3 << EMC_DMCR_CA_BIT)
1743 #define EMC_DMCR_CA_12 (4 << EMC_DMCR_CA_BIT) 1743 #define EMC_DMCR_CA_12 (4 << EMC_DMCR_CA_BIT)
1744#define EMC_DMCR_RMODE (1 << 25) 1744#define EMC_DMCR_RMODE (1 << 25)
1745#define EMC_DMCR_RFSH (1 << 24) 1745#define EMC_DMCR_RFSH (1 << 24)
1746#define EMC_DMCR_MRSET (1 << 23) 1746#define EMC_DMCR_MRSET (1 << 23)
1747#define EMC_DMCR_RA_BIT 20 1747#define EMC_DMCR_RA_BIT 20
1748#define EMC_DMCR_RA_MASK (0x03 << EMC_DMCR_RA_BIT) 1748#define EMC_DMCR_RA_MASK (0x03 << EMC_DMCR_RA_BIT)
1749 #define EMC_DMCR_RA_11 (0 << EMC_DMCR_RA_BIT) 1749 #define EMC_DMCR_RA_11 (0 << EMC_DMCR_RA_BIT)
1750 #define EMC_DMCR_RA_12 (1 << EMC_DMCR_RA_BIT) 1750 #define EMC_DMCR_RA_12 (1 << EMC_DMCR_RA_BIT)
1751 #define EMC_DMCR_RA_13 (2 << EMC_DMCR_RA_BIT) 1751 #define EMC_DMCR_RA_13 (2 << EMC_DMCR_RA_BIT)
1752#define EMC_DMCR_BA_BIT 19 1752#define EMC_DMCR_BA_BIT 19
1753#define EMC_DMCR_BA (1 << EMC_DMCR_BA_BIT) 1753#define EMC_DMCR_BA (1 << EMC_DMCR_BA_BIT)
1754#define EMC_DMCR_PDM (1 << 18) 1754#define EMC_DMCR_PDM (1 << 18)
1755#define EMC_DMCR_EPIN (1 << 17) 1755#define EMC_DMCR_EPIN (1 << 17)
1756#define EMC_DMCR_TRAS_BIT 13 1756#define EMC_DMCR_TRAS_BIT 13
1757#define EMC_DMCR_TRAS_MASK (0x07 << EMC_DMCR_TRAS_BIT) 1757#define EMC_DMCR_TRAS_MASK (0x07 << EMC_DMCR_TRAS_BIT)
1758#define EMC_DMCR_RCD_BIT 11 1758#define EMC_DMCR_RCD_BIT 11
1759#define EMC_DMCR_RCD_MASK (0x03 << EMC_DMCR_RCD_BIT) 1759#define EMC_DMCR_RCD_MASK (0x03 << EMC_DMCR_RCD_BIT)
1760#define EMC_DMCR_TPC_BIT 8 1760#define EMC_DMCR_TPC_BIT 8
1761#define EMC_DMCR_TPC_MASK (0x07 << EMC_DMCR_TPC_BIT) 1761#define EMC_DMCR_TPC_MASK (0x07 << EMC_DMCR_TPC_BIT)
1762#define EMC_DMCR_TRWL_BIT 5 1762#define EMC_DMCR_TRWL_BIT 5
1763#define EMC_DMCR_TRWL_MASK (0x03 << EMC_DMCR_TRWL_BIT) 1763#define EMC_DMCR_TRWL_MASK (0x03 << EMC_DMCR_TRWL_BIT)
1764#define EMC_DMCR_TRC_BIT 2 1764#define EMC_DMCR_TRC_BIT 2
1765#define EMC_DMCR_TRC_MASK (0x07 << EMC_DMCR_TRC_BIT) 1765#define EMC_DMCR_TRC_MASK (0x07 << EMC_DMCR_TRC_BIT)
1766#define EMC_DMCR_TCL_BIT 0 1766#define EMC_DMCR_TCL_BIT 0
1767#define EMC_DMCR_TCL_MASK (0x03 << EMC_DMCR_TCL_BIT) 1767#define EMC_DMCR_TCL_MASK (0x03 << EMC_DMCR_TCL_BIT)
1768 1768
1769/* Refresh Time Control/Status Register */ 1769/* Refresh Time Control/Status Register */
1770#define EMC_RTCSR_CMF (1 << 7) 1770#define EMC_RTCSR_CMF (1 << 7)
1771#define EMC_RTCSR_CKS_BIT 0 1771#define EMC_RTCSR_CKS_BIT 0
1772#define EMC_RTCSR_CKS_MASK (0x07 << EMC_RTCSR_CKS_BIT) 1772#define EMC_RTCSR_CKS_MASK (0x07 << EMC_RTCSR_CKS_BIT)
1773 #define EMC_RTCSR_CKS_DISABLE (0 << EMC_RTCSR_CKS_BIT) 1773 #define EMC_RTCSR_CKS_DISABLE (0 << EMC_RTCSR_CKS_BIT)
1774 #define EMC_RTCSR_CKS_4 (1 << EMC_RTCSR_CKS_BIT) 1774 #define EMC_RTCSR_CKS_4 (1 << EMC_RTCSR_CKS_BIT)
1775 #define EMC_RTCSR_CKS_16 (2 << EMC_RTCSR_CKS_BIT) 1775 #define EMC_RTCSR_CKS_16 (2 << EMC_RTCSR_CKS_BIT)
1776 #define EMC_RTCSR_CKS_64 (3 << EMC_RTCSR_CKS_BIT) 1776 #define EMC_RTCSR_CKS_64 (3 << EMC_RTCSR_CKS_BIT)
1777 #define EMC_RTCSR_CKS_256 (4 << EMC_RTCSR_CKS_BIT) 1777 #define EMC_RTCSR_CKS_256 (4 << EMC_RTCSR_CKS_BIT)
1778 #define EMC_RTCSR_CKS_1024 (5 << EMC_RTCSR_CKS_BIT) 1778 #define EMC_RTCSR_CKS_1024 (5 << EMC_RTCSR_CKS_BIT)
1779 #define EMC_RTCSR_CKS_2048 (6 << EMC_RTCSR_CKS_BIT) 1779 #define EMC_RTCSR_CKS_2048 (6 << EMC_RTCSR_CKS_BIT)
1780 #define EMC_RTCSR_CKS_4096 (7 << EMC_RTCSR_CKS_BIT) 1780 #define EMC_RTCSR_CKS_4096 (7 << EMC_RTCSR_CKS_BIT)
1781 1781
1782/* SDRAM Bank Address Configuration Register */ 1782/* SDRAM Bank Address Configuration Register */
1783#define EMC_DMAR_BASE_BIT 8 1783#define EMC_DMAR_BASE_BIT 8
1784#define EMC_DMAR_BASE_MASK (0xff << EMC_DMAR_BASE_BIT) 1784#define EMC_DMAR_BASE_MASK (0xff << EMC_DMAR_BASE_BIT)
1785#define EMC_DMAR_MASK_BIT 0 1785#define EMC_DMAR_MASK_BIT 0
1786#define EMC_DMAR_MASK_MASK (0xff << EMC_DMAR_MASK_BIT) 1786#define EMC_DMAR_MASK_MASK (0xff << EMC_DMAR_MASK_BIT)
1787 1787
1788/* Mode Register of SDRAM bank 0 */ 1788/* Mode Register of SDRAM bank 0 */
1789#define EMC_SDMR_BM (1 << 9) /* Write Burst Mode */ 1789#define EMC_SDMR_BM (1 << 9) /* Write Burst Mode */
1790#define EMC_SDMR_OM_BIT 7 /* Operating Mode */ 1790#define EMC_SDMR_OM_BIT 7 /* Operating Mode */
1791#define EMC_SDMR_OM_MASK (3 << EMC_SDMR_OM_BIT) 1791#define EMC_SDMR_OM_MASK (3 << EMC_SDMR_OM_BIT)
1792 #define EMC_SDMR_OM_NORMAL (0 << EMC_SDMR_OM_BIT) 1792 #define EMC_SDMR_OM_NORMAL (0 << EMC_SDMR_OM_BIT)
1793#define EMC_SDMR_CAS_BIT 4 /* CAS Latency */ 1793#define EMC_SDMR_CAS_BIT 4 /* CAS Latency */
1794#define EMC_SDMR_CAS_MASK (7 << EMC_SDMR_CAS_BIT) 1794#define EMC_SDMR_CAS_MASK (7 << EMC_SDMR_CAS_BIT)
1795 #define EMC_SDMR_CAS_1 (1 << EMC_SDMR_CAS_BIT) 1795 #define EMC_SDMR_CAS_1 (1 << EMC_SDMR_CAS_BIT)
1796 #define EMC_SDMR_CAS_2 (2 << EMC_SDMR_CAS_BIT) 1796 #define EMC_SDMR_CAS_2 (2 << EMC_SDMR_CAS_BIT)
1797 #define EMC_SDMR_CAS_3 (3 << EMC_SDMR_CAS_BIT) 1797 #define EMC_SDMR_CAS_3 (3 << EMC_SDMR_CAS_BIT)
1798#define EMC_SDMR_BT_BIT 3 /* Burst Type */ 1798#define EMC_SDMR_BT_BIT 3 /* Burst Type */
1799#define EMC_SDMR_BT_MASK (1 << EMC_SDMR_BT_BIT) 1799#define EMC_SDMR_BT_MASK (1 << EMC_SDMR_BT_BIT)
1800 #define EMC_SDMR_BT_SEQ (0 << EMC_SDMR_BT_BIT) /* Sequential */ 1800 #define EMC_SDMR_BT_SEQ (0 << EMC_SDMR_BT_BIT) /* Sequential */
1801 #define EMC_SDMR_BT_INT (1 << EMC_SDMR_BT_BIT) /* Interleave */ 1801 #define EMC_SDMR_BT_INT (1 << EMC_SDMR_BT_BIT) /* Interleave */
1802#define EMC_SDMR_BL_BIT 0 /* Burst Length */ 1802#define EMC_SDMR_BL_BIT 0 /* Burst Length */
1803#define EMC_SDMR_BL_MASK (7 << EMC_SDMR_BL_BIT) 1803#define EMC_SDMR_BL_MASK (7 << EMC_SDMR_BL_BIT)
1804 #define EMC_SDMR_BL_1 (0 << EMC_SDMR_BL_BIT) 1804 #define EMC_SDMR_BL_1 (0 << EMC_SDMR_BL_BIT)
1805 #define EMC_SDMR_BL_2 (1 << EMC_SDMR_BL_BIT) 1805 #define EMC_SDMR_BL_2 (1 << EMC_SDMR_BL_BIT)
1806 #define EMC_SDMR_BL_4 (2 << EMC_SDMR_BL_BIT) 1806 #define EMC_SDMR_BL_4 (2 << EMC_SDMR_BL_BIT)
1807 #define EMC_SDMR_BL_8 (3 << EMC_SDMR_BL_BIT) 1807 #define EMC_SDMR_BL_8 (3 << EMC_SDMR_BL_BIT)
1808 1808
1809#define EMC_SDMR_CAS2_16BIT \ 1809#define EMC_SDMR_CAS2_16BIT \
1810 (EMC_SDMR_CAS_2 | EMC_SDMR_BT_SEQ | EMC_SDMR_BL_2) 1810 (EMC_SDMR_CAS_2 | EMC_SDMR_BT_SEQ | EMC_SDMR_BL_2)
@@ -1819,463 +1819,463 @@
1819/************************************************************************* 1819/*************************************************************************
1820 * CIM 1820 * CIM
1821 *************************************************************************/ 1821 *************************************************************************/
1822#define CIM_CFG (CIM_BASE + 0x0000) 1822#define CIM_CFG (CIM_BASE + 0x0000)
1823#define CIM_CTRL (CIM_BASE + 0x0004) 1823#define CIM_CTRL (CIM_BASE + 0x0004)
1824#define CIM_STATE (CIM_BASE + 0x0008) 1824#define CIM_STATE (CIM_BASE + 0x0008)
1825#define CIM_IID (CIM_BASE + 0x000C) 1825#define CIM_IID (CIM_BASE + 0x000C)
1826#define CIM_RXFIFO (CIM_BASE + 0x0010) 1826#define CIM_RXFIFO (CIM_BASE + 0x0010)
1827#define CIM_DA (CIM_BASE + 0x0020) 1827#define CIM_DA (CIM_BASE + 0x0020)
1828#define CIM_FA (CIM_BASE + 0x0024) 1828#define CIM_FA (CIM_BASE + 0x0024)
1829#define CIM_FID (CIM_BASE + 0x0028) 1829#define CIM_FID (CIM_BASE + 0x0028)
1830#define CIM_CMD (CIM_BASE + 0x002C) 1830#define CIM_CMD (CIM_BASE + 0x002C)
1831 1831
1832#define REG_CIM_CFG REG32(CIM_CFG) 1832#define REG_CIM_CFG REG32(CIM_CFG)
1833#define REG_CIM_CTRL REG32(CIM_CTRL) 1833#define REG_CIM_CTRL REG32(CIM_CTRL)
1834#define REG_CIM_STATE REG32(CIM_STATE) 1834#define REG_CIM_STATE REG32(CIM_STATE)
1835#define REG_CIM_IID REG32(CIM_IID) 1835#define REG_CIM_IID REG32(CIM_IID)
1836#define REG_CIM_RXFIFO REG32(CIM_RXFIFO) 1836#define REG_CIM_RXFIFO REG32(CIM_RXFIFO)
1837#define REG_CIM_DA REG32(CIM_DA) 1837#define REG_CIM_DA REG32(CIM_DA)
1838#define REG_CIM_FA REG32(CIM_FA) 1838#define REG_CIM_FA REG32(CIM_FA)
1839#define REG_CIM_FID REG32(CIM_FID) 1839#define REG_CIM_FID REG32(CIM_FID)
1840#define REG_CIM_CMD REG32(CIM_CMD) 1840#define REG_CIM_CMD REG32(CIM_CMD)
1841 1841
1842/* CIM Configuration Register (CIM_CFG) */ 1842/* CIM Configuration Register (CIM_CFG) */
1843 1843
1844#define CIM_CFG_INV_DAT (1 << 15) 1844#define CIM_CFG_INV_DAT (1 << 15)
1845#define CIM_CFG_VSP (1 << 14) 1845#define CIM_CFG_VSP (1 << 14)
1846#define CIM_CFG_HSP (1 << 13) 1846#define CIM_CFG_HSP (1 << 13)
1847#define CIM_CFG_PCP (1 << 12) 1847#define CIM_CFG_PCP (1 << 12)
1848#define CIM_CFG_DUMMY_ZERO (1 << 9) 1848#define CIM_CFG_DUMMY_ZERO (1 << 9)
1849#define CIM_CFG_EXT_VSYNC (1 << 8) 1849#define CIM_CFG_EXT_VSYNC (1 << 8)
1850#define CIM_CFG_PACK_BIT 4 1850#define CIM_CFG_PACK_BIT 4
1851#define CIM_CFG_PACK_MASK (0x7 << CIM_CFG_PACK_BIT) 1851#define CIM_CFG_PACK_MASK (0x7 << CIM_CFG_PACK_BIT)
1852 #define CIM_CFG_PACK_0 (0 << CIM_CFG_PACK_BIT) 1852 #define CIM_CFG_PACK_0 (0 << CIM_CFG_PACK_BIT)
1853 #define CIM_CFG_PACK_1 (1 << CIM_CFG_PACK_BIT) 1853 #define CIM_CFG_PACK_1 (1 << CIM_CFG_PACK_BIT)
1854 #define CIM_CFG_PACK_2 (2 << CIM_CFG_PACK_BIT) 1854 #define CIM_CFG_PACK_2 (2 << CIM_CFG_PACK_BIT)
1855 #define CIM_CFG_PACK_3 (3 << CIM_CFG_PACK_BIT) 1855 #define CIM_CFG_PACK_3 (3 << CIM_CFG_PACK_BIT)
1856 #define CIM_CFG_PACK_4 (4 << CIM_CFG_PACK_BIT) 1856 #define CIM_CFG_PACK_4 (4 << CIM_CFG_PACK_BIT)
1857 #define CIM_CFG_PACK_5 (5 << CIM_CFG_PACK_BIT) 1857 #define CIM_CFG_PACK_5 (5 << CIM_CFG_PACK_BIT)
1858 #define CIM_CFG_PACK_6 (6 << CIM_CFG_PACK_BIT) 1858 #define CIM_CFG_PACK_6 (6 << CIM_CFG_PACK_BIT)
1859 #define CIM_CFG_PACK_7 (7 << CIM_CFG_PACK_BIT) 1859 #define CIM_CFG_PACK_7 (7 << CIM_CFG_PACK_BIT)
1860#define CIM_CFG_DSM_BIT 0 1860#define CIM_CFG_DSM_BIT 0
1861#define CIM_CFG_DSM_MASK (0x3 << CIM_CFG_DSM_BIT) 1861#define CIM_CFG_DSM_MASK (0x3 << CIM_CFG_DSM_BIT)
1862 #define CIM_CFG_DSM_CPM (0 << CIM_CFG_DSM_BIT) /* CCIR656 Progressive Mode */ 1862 #define CIM_CFG_DSM_CPM (0 << CIM_CFG_DSM_BIT) /* CCIR656 Progressive Mode */
1863 #define CIM_CFG_DSM_CIM (1 << CIM_CFG_DSM_BIT) /* CCIR656 Interlace Mode */ 1863 #define CIM_CFG_DSM_CIM (1 << CIM_CFG_DSM_BIT) /* CCIR656 Interlace Mode */
1864 #define CIM_CFG_DSM_GCM (2 << CIM_CFG_DSM_BIT) /* Gated Clock Mode */ 1864 #define CIM_CFG_DSM_GCM (2 << CIM_CFG_DSM_BIT) /* Gated Clock Mode */
1865 #define CIM_CFG_DSM_NGCM (3 << CIM_CFG_DSM_BIT) /* Non-Gated Clock Mode */ 1865 #define CIM_CFG_DSM_NGCM (3 << CIM_CFG_DSM_BIT) /* Non-Gated Clock Mode */
1866 1866
1867/* CIM Control Register (CIM_CTRL) */ 1867/* CIM Control Register (CIM_CTRL) */
1868 1868
1869#define CIM_CTRL_MCLKDIV_BIT 24 1869#define CIM_CTRL_MCLKDIV_BIT 24
1870#define CIM_CTRL_MCLKDIV_MASK (0xff << CIM_CTRL_MCLKDIV_BIT) 1870#define CIM_CTRL_MCLKDIV_MASK (0xff << CIM_CTRL_MCLKDIV_BIT)
1871#define CIM_CTRL_FRC_BIT 16 1871#define CIM_CTRL_FRC_BIT 16
1872#define CIM_CTRL_FRC_MASK (0xf << CIM_CTRL_FRC_BIT) 1872#define CIM_CTRL_FRC_MASK (0xf << CIM_CTRL_FRC_BIT)
1873 #define CIM_CTRL_FRC_1 (0x0 << CIM_CTRL_FRC_BIT) /* Sample every frame */ 1873 #define CIM_CTRL_FRC_1 (0x0 << CIM_CTRL_FRC_BIT) /* Sample every frame */
1874 #define CIM_CTRL_FRC_2 (0x1 << CIM_CTRL_FRC_BIT) /* Sample 1/2 frame */ 1874 #define CIM_CTRL_FRC_2 (0x1 << CIM_CTRL_FRC_BIT) /* Sample 1/2 frame */
1875 #define CIM_CTRL_FRC_3 (0x2 << CIM_CTRL_FRC_BIT) /* Sample 1/3 frame */ 1875 #define CIM_CTRL_FRC_3 (0x2 << CIM_CTRL_FRC_BIT) /* Sample 1/3 frame */
1876 #define CIM_CTRL_FRC_4 (0x3 << CIM_CTRL_FRC_BIT) /* Sample 1/4 frame */ 1876 #define CIM_CTRL_FRC_4 (0x3 << CIM_CTRL_FRC_BIT) /* Sample 1/4 frame */
1877 #define CIM_CTRL_FRC_5 (0x4 << CIM_CTRL_FRC_BIT) /* Sample 1/5 frame */ 1877 #define CIM_CTRL_FRC_5 (0x4 << CIM_CTRL_FRC_BIT) /* Sample 1/5 frame */
1878 #define CIM_CTRL_FRC_6 (0x5 << CIM_CTRL_FRC_BIT) /* Sample 1/6 frame */ 1878 #define CIM_CTRL_FRC_6 (0x5 << CIM_CTRL_FRC_BIT) /* Sample 1/6 frame */
1879 #define CIM_CTRL_FRC_7 (0x6 << CIM_CTRL_FRC_BIT) /* Sample 1/7 frame */ 1879 #define CIM_CTRL_FRC_7 (0x6 << CIM_CTRL_FRC_BIT) /* Sample 1/7 frame */
1880 #define CIM_CTRL_FRC_8 (0x7 << CIM_CTRL_FRC_BIT) /* Sample 1/8 frame */ 1880 #define CIM_CTRL_FRC_8 (0x7 << CIM_CTRL_FRC_BIT) /* Sample 1/8 frame */
1881 #define CIM_CTRL_FRC_9 (0x8 << CIM_CTRL_FRC_BIT) /* Sample 1/9 frame */ 1881 #define CIM_CTRL_FRC_9 (0x8 << CIM_CTRL_FRC_BIT) /* Sample 1/9 frame */
1882 #define CIM_CTRL_FRC_10 (0x9 << CIM_CTRL_FRC_BIT) /* Sample 1/10 frame */ 1882 #define CIM_CTRL_FRC_10 (0x9 << CIM_CTRL_FRC_BIT) /* Sample 1/10 frame */
1883 #define CIM_CTRL_FRC_11 (0xA << CIM_CTRL_FRC_BIT) /* Sample 1/11 frame */ 1883 #define CIM_CTRL_FRC_11 (0xA << CIM_CTRL_FRC_BIT) /* Sample 1/11 frame */
1884 #define CIM_CTRL_FRC_12 (0xB << CIM_CTRL_FRC_BIT) /* Sample 1/12 frame */ 1884 #define CIM_CTRL_FRC_12 (0xB << CIM_CTRL_FRC_BIT) /* Sample 1/12 frame */
1885 #define CIM_CTRL_FRC_13 (0xC << CIM_CTRL_FRC_BIT) /* Sample 1/13 frame */ 1885 #define CIM_CTRL_FRC_13 (0xC << CIM_CTRL_FRC_BIT) /* Sample 1/13 frame */
1886 #define CIM_CTRL_FRC_14 (0xD << CIM_CTRL_FRC_BIT) /* Sample 1/14 frame */ 1886 #define CIM_CTRL_FRC_14 (0xD << CIM_CTRL_FRC_BIT) /* Sample 1/14 frame */
1887 #define CIM_CTRL_FRC_15 (0xE << CIM_CTRL_FRC_BIT) /* Sample 1/15 frame */ 1887 #define CIM_CTRL_FRC_15 (0xE << CIM_CTRL_FRC_BIT) /* Sample 1/15 frame */
1888 #define CIM_CTRL_FRC_16 (0xF << CIM_CTRL_FRC_BIT) /* Sample 1/16 frame */ 1888 #define CIM_CTRL_FRC_16 (0xF << CIM_CTRL_FRC_BIT) /* Sample 1/16 frame */
1889#define CIM_CTRL_VDDM (1 << 13) 1889#define CIM_CTRL_VDDM (1 << 13)
1890#define CIM_CTRL_DMA_SOFM (1 << 12) 1890#define CIM_CTRL_DMA_SOFM (1 << 12)
1891#define CIM_CTRL_DMA_EOFM (1 << 11) 1891#define CIM_CTRL_DMA_EOFM (1 << 11)
1892#define CIM_CTRL_DMA_STOPM (1 << 10) 1892#define CIM_CTRL_DMA_STOPM (1 << 10)
1893#define CIM_CTRL_RXF_TRIGM (1 << 9) 1893#define CIM_CTRL_RXF_TRIGM (1 << 9)
1894#define CIM_CTRL_RXF_OFM (1 << 8) 1894#define CIM_CTRL_RXF_OFM (1 << 8)
1895#define CIM_CTRL_RXF_TRIG_BIT 4 1895#define CIM_CTRL_RXF_TRIG_BIT 4
1896#define CIM_CTRL_RXF_TRIG_MASK (0x7 << CIM_CTRL_RXF_TRIG_BIT) 1896#define CIM_CTRL_RXF_TRIG_MASK (0x7 << CIM_CTRL_RXF_TRIG_BIT)
1897 #define CIM_CTRL_RXF_TRIG_4 (0 << CIM_CTRL_RXF_TRIG_BIT) /* RXFIFO Trigger Value is 4 */ 1897 #define CIM_CTRL_RXF_TRIG_4 (0 << CIM_CTRL_RXF_TRIG_BIT) /* RXFIFO Trigger Value is 4 */
1898 #define CIM_CTRL_RXF_TRIG_8 (1 << CIM_CTRL_RXF_TRIG_BIT) /* RXFIFO Trigger Value is 8 */ 1898 #define CIM_CTRL_RXF_TRIG_8 (1 << CIM_CTRL_RXF_TRIG_BIT) /* RXFIFO Trigger Value is 8 */
1899 #define CIM_CTRL_RXF_TRIG_12 (2 << CIM_CTRL_RXF_TRIG_BIT) /* RXFIFO Trigger Value is 12 */ 1899 #define CIM_CTRL_RXF_TRIG_12 (2 << CIM_CTRL_RXF_TRIG_BIT) /* RXFIFO Trigger Value is 12 */
1900 #define CIM_CTRL_RXF_TRIG_16 (3 << CIM_CTRL_RXF_TRIG_BIT) /* RXFIFO Trigger Value is 16 */ 1900 #define CIM_CTRL_RXF_TRIG_16 (3 << CIM_CTRL_RXF_TRIG_BIT) /* RXFIFO Trigger Value is 16 */
1901 #define CIM_CTRL_RXF_TRIG_20 (4 << CIM_CTRL_RXF_TRIG_BIT) /* RXFIFO Trigger Value is 20 */ 1901 #define CIM_CTRL_RXF_TRIG_20 (4 << CIM_CTRL_RXF_TRIG_BIT) /* RXFIFO Trigger Value is 20 */
1902 #define CIM_CTRL_RXF_TRIG_24 (5 << CIM_CTRL_RXF_TRIG_BIT) /* RXFIFO Trigger Value is 24 */ 1902 #define CIM_CTRL_RXF_TRIG_24 (5 << CIM_CTRL_RXF_TRIG_BIT) /* RXFIFO Trigger Value is 24 */
1903 #define CIM_CTRL_RXF_TRIG_28 (6 << CIM_CTRL_RXF_TRIG_BIT) /* RXFIFO Trigger Value is 28 */ 1903 #define CIM_CTRL_RXF_TRIG_28 (6 << CIM_CTRL_RXF_TRIG_BIT) /* RXFIFO Trigger Value is 28 */
1904 #define CIM_CTRL_RXF_TRIG_32 (7 << CIM_CTRL_RXF_TRIG_BIT) /* RXFIFO Trigger Value is 32 */ 1904 #define CIM_CTRL_RXF_TRIG_32 (7 << CIM_CTRL_RXF_TRIG_BIT) /* RXFIFO Trigger Value is 32 */
1905#define CIM_CTRL_DMA_EN (1 << 2) 1905#define CIM_CTRL_DMA_EN (1 << 2)
1906#define CIM_CTRL_RXF_RST (1 << 1) 1906#define CIM_CTRL_RXF_RST (1 << 1)
1907#define CIM_CTRL_ENA (1 << 0) 1907#define CIM_CTRL_ENA (1 << 0)
1908 1908
1909/* CIM State Register (CIM_STATE) */ 1909/* CIM State Register (CIM_STATE) */
1910 1910
1911#define CIM_STATE_DMA_SOF (1 << 6) 1911#define CIM_STATE_DMA_SOF (1 << 6)
1912#define CIM_STATE_DMA_EOF (1 << 5) 1912#define CIM_STATE_DMA_EOF (1 << 5)
1913#define CIM_STATE_DMA_STOP (1 << 4) 1913#define CIM_STATE_DMA_STOP (1 << 4)
1914#define CIM_STATE_RXF_OF (1 << 3) 1914#define CIM_STATE_RXF_OF (1 << 3)
1915#define CIM_STATE_RXF_TRIG (1 << 2) 1915#define CIM_STATE_RXF_TRIG (1 << 2)
1916#define CIM_STATE_RXF_EMPTY (1 << 1) 1916#define CIM_STATE_RXF_EMPTY (1 << 1)
1917#define CIM_STATE_VDD (1 << 0) 1917#define CIM_STATE_VDD (1 << 0)
1918 1918
1919/* CIM DMA Command Register (CIM_CMD) */ 1919/* CIM DMA Command Register (CIM_CMD) */
1920 1920
1921#define CIM_CMD_SOFINT (1 << 31) 1921#define CIM_CMD_SOFINT (1 << 31)
1922#define CIM_CMD_EOFINT (1 << 30) 1922#define CIM_CMD_EOFINT (1 << 30)
1923#define CIM_CMD_STOP (1 << 28) 1923#define CIM_CMD_STOP (1 << 28)
1924#define CIM_CMD_LEN_BIT 0 1924#define CIM_CMD_LEN_BIT 0
1925#define CIM_CMD_LEN_MASK (0xffffff << CIM_CMD_LEN_BIT) 1925#define CIM_CMD_LEN_MASK (0xffffff << CIM_CMD_LEN_BIT)
1926 1926
1927 1927
1928/************************************************************************* 1928/*************************************************************************
1929 * SADC (Smart A/D Controller) 1929 * SADC (Smart A/D Controller)
1930 *************************************************************************/ 1930 *************************************************************************/
1931 1931
1932#define SADC_ENA (SADC_BASE + 0x00) /* ADC Enable Register */ 1932#define SADC_ENA (SADC_BASE + 0x00) /* ADC Enable Register */
1933#define SADC_CFG (SADC_BASE + 0x04) /* ADC Configure Register */ 1933#define SADC_CFG (SADC_BASE + 0x04) /* ADC Configure Register */
1934#define SADC_CTRL (SADC_BASE + 0x08) /* ADC Control Register */ 1934#define SADC_CTRL (SADC_BASE + 0x08) /* ADC Control Register */
1935#define SADC_STATE (SADC_BASE + 0x0C) /* ADC Status Register*/ 1935#define SADC_STATE (SADC_BASE + 0x0C) /* ADC Status Register*/
1936#define SADC_SAMETIME (SADC_BASE + 0x10) /* ADC Same Point Time Register */ 1936#define SADC_SAMETIME (SADC_BASE + 0x10) /* ADC Same Point Time Register */
1937#define SADC_WAITTIME (SADC_BASE + 0x14) /* ADC Wait Time Register */ 1937#define SADC_WAITTIME (SADC_BASE + 0x14) /* ADC Wait Time Register */
1938#define SADC_TSDAT (SADC_BASE + 0x18) /* ADC Touch Screen Data Register */ 1938#define SADC_TSDAT (SADC_BASE + 0x18) /* ADC Touch Screen Data Register */
1939#define SADC_BATDAT (SADC_BASE + 0x1C) /* ADC PBAT Data Register */ 1939#define SADC_BATDAT (SADC_BASE + 0x1C) /* ADC PBAT Data Register */
1940#define SADC_SADDAT (SADC_BASE + 0x20) /* ADC SADCIN Data Register */ 1940#define SADC_SADDAT (SADC_BASE + 0x20) /* ADC SADCIN Data Register */
1941 1941
1942#define REG_SADC_ENA REG8(SADC_ENA) 1942#define REG_SADC_ENA REG8(SADC_ENA)
1943#define REG_SADC_CFG REG32(SADC_CFG) 1943#define REG_SADC_CFG REG32(SADC_CFG)
1944#define REG_SADC_CTRL REG8(SADC_CTRL) 1944#define REG_SADC_CTRL REG8(SADC_CTRL)
1945#define REG_SADC_STATE REG8(SADC_STATE) 1945#define REG_SADC_STATE REG8(SADC_STATE)
1946#define REG_SADC_SAMETIME REG16(SADC_SAMETIME) 1946#define REG_SADC_SAMETIME REG16(SADC_SAMETIME)
1947#define REG_SADC_WAITTIME REG16(SADC_WAITTIME) 1947#define REG_SADC_WAITTIME REG16(SADC_WAITTIME)
1948#define REG_SADC_TSDAT REG32(SADC_TSDAT) 1948#define REG_SADC_TSDAT REG32(SADC_TSDAT)
1949#define REG_SADC_BATDAT REG16(SADC_BATDAT) 1949#define REG_SADC_BATDAT REG16(SADC_BATDAT)
1950#define REG_SADC_SADDAT REG16(SADC_SADDAT) 1950#define REG_SADC_SADDAT REG16(SADC_SADDAT)
1951 1951
1952/* ADC Enable Register */ 1952/* ADC Enable Register */
1953#define SADC_ENA_ADEN (1 << 7) /* Touch Screen Enable */ 1953#define SADC_ENA_ADEN (1 << 7) /* Touch Screen Enable */
1954#define SADC_ENA_TSEN (1 << 2) /* Touch Screen Enable */ 1954#define SADC_ENA_TSEN (1 << 2) /* Touch Screen Enable */
1955#define SADC_ENA_PBATEN (1 << 1) /* PBAT Enable */ 1955#define SADC_ENA_PBATEN (1 << 1) /* PBAT Enable */
1956#define SADC_ENA_SADCINEN (1 << 0) /* SADCIN Enable */ 1956#define SADC_ENA_SADCINEN (1 << 0) /* SADCIN Enable */
1957 1957
1958/* ADC Configure Register */ 1958/* ADC Configure Register */
1959#define SADC_CFG_CLKOUT_NUM_BIT 16 1959#define SADC_CFG_CLKOUT_NUM_BIT 16
1960#define SADC_CFG_CLKOUT_NUM_MASK (0x7 << SADC_CFG_CLKOUT_NUM_BIT) 1960#define SADC_CFG_CLKOUT_NUM_MASK (0x7 << SADC_CFG_CLKOUT_NUM_BIT)
1961#define SADC_CFG_TS_DMA (1 << 15) /* Touch Screen DMA Enable */ 1961#define SADC_CFG_TS_DMA (1 << 15) /* Touch Screen DMA Enable */
1962#define SADC_CFG_XYZ_BIT 13 /* XYZ selection */ 1962#define SADC_CFG_XYZ_BIT 13 /* XYZ selection */
1963#define SADC_CFG_XYZ_MASK (0x3 << SADC_CFG_XYZ_BIT) 1963#define SADC_CFG_XYZ_MASK (0x3 << SADC_CFG_XYZ_BIT)
1964 #define SADC_CFG_XY (0 << SADC_CFG_XYZ_BIT) 1964 #define SADC_CFG_XY (0 << SADC_CFG_XYZ_BIT)
1965 #define SADC_CFG_XYZ (1 << SADC_CFG_XYZ_BIT) 1965 #define SADC_CFG_XYZ (1 << SADC_CFG_XYZ_BIT)
1966 #define SADC_CFG_XYZ1Z2 (2 << SADC_CFG_XYZ_BIT) 1966 #define SADC_CFG_XYZ1Z2 (2 << SADC_CFG_XYZ_BIT)
1967#define SADC_CFG_SNUM_BIT 10 /* Sample Number */ 1967#define SADC_CFG_SNUM_BIT 10 /* Sample Number */
1968#define SADC_CFG_SNUM_MASK (0x7 << SADC_CFG_SNUM_BIT) 1968#define SADC_CFG_SNUM_MASK (0x7 << SADC_CFG_SNUM_BIT)
1969 #define SADC_CFG_SNUM_1 (0x0 << SADC_CFG_SNUM_BIT) 1969 #define SADC_CFG_SNUM_1 (0x0 << SADC_CFG_SNUM_BIT)
1970 #define SADC_CFG_SNUM_2 (0x1 << SADC_CFG_SNUM_BIT) 1970 #define SADC_CFG_SNUM_2 (0x1 << SADC_CFG_SNUM_BIT)
1971 #define SADC_CFG_SNUM_3 (0x2 << SADC_CFG_SNUM_BIT) 1971 #define SADC_CFG_SNUM_3 (0x2 << SADC_CFG_SNUM_BIT)
1972 #define SADC_CFG_SNUM_4 (0x3 << SADC_CFG_SNUM_BIT) 1972 #define SADC_CFG_SNUM_4 (0x3 << SADC_CFG_SNUM_BIT)
1973 #define SADC_CFG_SNUM_5 (0x4 << SADC_CFG_SNUM_BIT) 1973 #define SADC_CFG_SNUM_5 (0x4 << SADC_CFG_SNUM_BIT)
1974 #define SADC_CFG_SNUM_6 (0x5 << SADC_CFG_SNUM_BIT) 1974 #define SADC_CFG_SNUM_6 (0x5 << SADC_CFG_SNUM_BIT)
1975 #define SADC_CFG_SNUM_8 (0x6 << SADC_CFG_SNUM_BIT) 1975 #define SADC_CFG_SNUM_8 (0x6 << SADC_CFG_SNUM_BIT)
1976 #define SADC_CFG_SNUM_9 (0x7 << SADC_CFG_SNUM_BIT) 1976 #define SADC_CFG_SNUM_9 (0x7 << SADC_CFG_SNUM_BIT)
1977#define SADC_CFG_CLKDIV_BIT 5 /* AD Converter frequency clock divider */ 1977#define SADC_CFG_CLKDIV_BIT 5 /* AD Converter frequency clock divider */
1978#define SADC_CFG_CLKDIV_MASK (0x1f << SADC_CFG_CLKDIV_BIT) 1978#define SADC_CFG_CLKDIV_MASK (0x1f << SADC_CFG_CLKDIV_BIT)
1979#define SADC_CFG_PBAT_HIGH (0 << 4) /* PBAT >= 2.5V */ 1979#define SADC_CFG_PBAT_HIGH (0 << 4) /* PBAT >= 2.5V */
1980#define SADC_CFG_PBAT_LOW (1 << 4) /* PBAT < 2.5V */ 1980#define SADC_CFG_PBAT_LOW (1 << 4) /* PBAT < 2.5V */
1981#define SADC_CFG_CMD_BIT 0 /* ADC Command */ 1981#define SADC_CFG_CMD_BIT 0 /* ADC Command */
1982#define SADC_CFG_CMD_MASK (0xf << SADC_CFG_CMD_BIT) 1982#define SADC_CFG_CMD_MASK (0xf << SADC_CFG_CMD_BIT)
1983 #define SADC_CFG_CMD_X_SE (0x0 << SADC_CFG_CMD_BIT) /* X Single-End */ 1983 #define SADC_CFG_CMD_X_SE (0x0 << SADC_CFG_CMD_BIT) /* X Single-End */
1984 #define SADC_CFG_CMD_Y_SE (0x1 << SADC_CFG_CMD_BIT) /* Y Single-End */ 1984 #define SADC_CFG_CMD_Y_SE (0x1 << SADC_CFG_CMD_BIT) /* Y Single-End */
1985 #define SADC_CFG_CMD_X_DIFF (0x2 << SADC_CFG_CMD_BIT) /* X Differential */ 1985 #define SADC_CFG_CMD_X_DIFF (0x2 << SADC_CFG_CMD_BIT) /* X Differential */
1986 #define SADC_CFG_CMD_Y_DIFF (0x3 << SADC_CFG_CMD_BIT) /* Y Differential */ 1986 #define SADC_CFG_CMD_Y_DIFF (0x3 << SADC_CFG_CMD_BIT) /* Y Differential */
1987 #define SADC_CFG_CMD_Z1_DIFF (0x4 << SADC_CFG_CMD_BIT) /* Z1 Differential */ 1987 #define SADC_CFG_CMD_Z1_DIFF (0x4 << SADC_CFG_CMD_BIT) /* Z1 Differential */
1988 #define SADC_CFG_CMD_Z2_DIFF (0x5 << SADC_CFG_CMD_BIT) /* Z2 Differential */ 1988 #define SADC_CFG_CMD_Z2_DIFF (0x5 << SADC_CFG_CMD_BIT) /* Z2 Differential */
1989 #define SADC_CFG_CMD_Z3_DIFF (0x6 << SADC_CFG_CMD_BIT) /* Z3 Differential */ 1989 #define SADC_CFG_CMD_Z3_DIFF (0x6 << SADC_CFG_CMD_BIT) /* Z3 Differential */
1990 #define SADC_CFG_CMD_Z4_DIFF (0x7 << SADC_CFG_CMD_BIT) /* Z4 Differential */ 1990 #define SADC_CFG_CMD_Z4_DIFF (0x7 << SADC_CFG_CMD_BIT) /* Z4 Differential */
1991 #define SADC_CFG_CMD_TP_SE (0x8 << SADC_CFG_CMD_BIT) /* Touch Pressure */ 1991 #define SADC_CFG_CMD_TP_SE (0x8 << SADC_CFG_CMD_BIT) /* Touch Pressure */
1992 #define SADC_CFG_CMD_PBATH_SE (0x9 << SADC_CFG_CMD_BIT) /* PBAT >= 2.5V */ 1992 #define SADC_CFG_CMD_PBATH_SE (0x9 << SADC_CFG_CMD_BIT) /* PBAT >= 2.5V */
1993 #define SADC_CFG_CMD_PBATL_SE (0xa << SADC_CFG_CMD_BIT) /* PBAT < 2.5V */ 1993 #define SADC_CFG_CMD_PBATL_SE (0xa << SADC_CFG_CMD_BIT) /* PBAT < 2.5V */
1994 #define SADC_CFG_CMD_SADCIN_SE (0xb << SADC_CFG_CMD_BIT) /* Measure SADCIN */ 1994 #define SADC_CFG_CMD_SADCIN_SE (0xb << SADC_CFG_CMD_BIT) /* Measure SADCIN */
1995 #define SADC_CFG_CMD_INT_PEN (0xc << SADC_CFG_CMD_BIT) /* INT_PEN Enable */ 1995 #define SADC_CFG_CMD_INT_PEN (0xc << SADC_CFG_CMD_BIT) /* INT_PEN Enable */
1996 1996
1997/* ADC Control Register */ 1997/* ADC Control Register */
1998#define SADC_CTRL_PENDM (1 << 4) /* Pen Down Interrupt Mask */ 1998#define SADC_CTRL_PENDM (1 << 4) /* Pen Down Interrupt Mask */
1999#define SADC_CTRL_PENUM (1 << 3) /* Pen Up Interrupt Mask */ 1999#define SADC_CTRL_PENUM (1 << 3) /* Pen Up Interrupt Mask */
2000#define SADC_CTRL_TSRDYM (1 << 2) /* Touch Screen Data Ready Interrupt Mask */ 2000#define SADC_CTRL_TSRDYM (1 << 2) /* Touch Screen Data Ready Interrupt Mask */
2001#define SADC_CTRL_PBATRDYM (1 << 1) /* PBAT Data Ready Interrupt Mask */ 2001#define SADC_CTRL_PBATRDYM (1 << 1) /* PBAT Data Ready Interrupt Mask */
2002#define SADC_CTRL_SRDYM (1 << 0) /* SADCIN Data Ready Interrupt Mask */ 2002#define SADC_CTRL_SRDYM (1 << 0) /* SADCIN Data Ready Interrupt Mask */
2003 2003
2004/* ADC Status Register */ 2004/* ADC Status Register */
2005#define SADC_STATE_TSBUSY (1 << 7) /* TS A/D is working */ 2005#define SADC_STATE_TSBUSY (1 << 7) /* TS A/D is working */
2006#define SADC_STATE_PBATBUSY (1 << 6) /* PBAT A/D is working */ 2006#define SADC_STATE_PBATBUSY (1 << 6) /* PBAT A/D is working */
2007#define SADC_STATE_SBUSY (1 << 5) /* SADCIN A/D is working */ 2007#define SADC_STATE_SBUSY (1 << 5) /* SADCIN A/D is working */
2008#define SADC_STATE_PEND (1 << 4) /* Pen Down Interrupt Flag */ 2008#define SADC_STATE_PEND (1 << 4) /* Pen Down Interrupt Flag */
2009#define SADC_STATE_PENU (1 << 3) /* Pen Up Interrupt Flag */ 2009#define SADC_STATE_PENU (1 << 3) /* Pen Up Interrupt Flag */
2010#define SADC_STATE_TSRDY (1 << 2) /* Touch Screen Data Ready Interrupt Flag */ 2010#define SADC_STATE_TSRDY (1 << 2) /* Touch Screen Data Ready Interrupt Flag */
2011#define SADC_STATE_PBATRDY (1 << 1) /* PBAT Data Ready Interrupt Flag */ 2011#define SADC_STATE_PBATRDY (1 << 1) /* PBAT Data Ready Interrupt Flag */
2012#define SADC_STATE_SRDY (1 << 0) /* SADCIN Data Ready Interrupt Flag */ 2012#define SADC_STATE_SRDY (1 << 0) /* SADCIN Data Ready Interrupt Flag */
2013 2013
2014/* ADC Touch Screen Data Register */ 2014/* ADC Touch Screen Data Register */
2015#define SADC_TSDAT_DATA0_BIT 0 2015#define SADC_TSDAT_DATA0_BIT 0
2016#define SADC_TSDAT_DATA0_MASK (0xfff << SADC_TSDAT_DATA0_BIT) 2016#define SADC_TSDAT_DATA0_MASK (0xfff << SADC_TSDAT_DATA0_BIT)
2017#define SADC_TSDAT_TYPE0 (1 << 15) 2017#define SADC_TSDAT_TYPE0 (1 << 15)
2018#define SADC_TSDAT_DATA1_BIT 16 2018#define SADC_TSDAT_DATA1_BIT 16
2019#define SADC_TSDAT_DATA1_MASK (0xfff << SADC_TSDAT_DATA1_BIT) 2019#define SADC_TSDAT_DATA1_MASK (0xfff << SADC_TSDAT_DATA1_BIT)
2020#define SADC_TSDAT_TYPE1 (1 << 31) 2020#define SADC_TSDAT_TYPE1 (1 << 31)
2021 2021
2022 2022
2023/************************************************************************* 2023/*************************************************************************
2024 * SLCD (Smart LCD Controller) 2024 * SLCD (Smart LCD Controller)
2025 *************************************************************************/ 2025 *************************************************************************/
2026 2026
2027#define SLCD_CFG (SLCD_BASE + 0xA0) /* SLCD Configure Register */ 2027#define SLCD_CFG (SLCD_BASE + 0xA0) /* SLCD Configure Register */
2028#define SLCD_CTRL (SLCD_BASE + 0xA4) /* SLCD Control Register */ 2028#define SLCD_CTRL (SLCD_BASE + 0xA4) /* SLCD Control Register */
2029#define SLCD_STATE (SLCD_BASE + 0xA8) /* SLCD Status Register */ 2029#define SLCD_STATE (SLCD_BASE + 0xA8) /* SLCD Status Register */
2030#define SLCD_DATA (SLCD_BASE + 0xAC) /* SLCD Data Register */ 2030#define SLCD_DATA (SLCD_BASE + 0xAC) /* SLCD Data Register */
2031#define SLCD_FIFO (SLCD_BASE + 0xB0) /* SLCD FIFO Register */ 2031#define SLCD_FIFO (SLCD_BASE + 0xB0) /* SLCD FIFO Register */
2032 2032
2033#define REG_SLCD_CFG REG32(SLCD_CFG) 2033#define REG_SLCD_CFG REG32(SLCD_CFG)
2034#define REG_SLCD_CTRL REG8(SLCD_CTRL) 2034#define REG_SLCD_CTRL REG8(SLCD_CTRL)
2035#define REG_SLCD_STATE REG8(SLCD_STATE) 2035#define REG_SLCD_STATE REG8(SLCD_STATE)
2036#define REG_SLCD_DATA REG32(SLCD_DATA) 2036#define REG_SLCD_DATA REG32(SLCD_DATA)
2037#define REG_SLCD_FIFO REG32(SLCD_FIFO) 2037#define REG_SLCD_FIFO REG32(SLCD_FIFO)
2038 2038
2039/* SLCD Configure Register */ 2039/* SLCD Configure Register */
2040#define SLCD_CFG_BURST_BIT 14 2040#define SLCD_CFG_BURST_BIT 14
2041#define SLCD_CFG_BURST_MASK (0x3 << SLCD_CFG_BURST_BIT) 2041#define SLCD_CFG_BURST_MASK (0x3 << SLCD_CFG_BURST_BIT)
2042 #define SLCD_CFG_BURST_4_WORD (0 << SLCD_CFG_BURST_BIT) 2042 #define SLCD_CFG_BURST_4_WORD (0 << SLCD_CFG_BURST_BIT)
2043 #define SLCD_CFG_BURST_8_WORD (1 << SLCD_CFG_BURST_BIT) 2043 #define SLCD_CFG_BURST_8_WORD (1 << SLCD_CFG_BURST_BIT)
2044#define SLCD_CFG_DWIDTH_BIT 10 2044#define SLCD_CFG_DWIDTH_BIT 10
2045#define SLCD_CFG_DWIDTH_MASK (0x7 << SLCD_CFG_DWIDTH_BIT) 2045#define SLCD_CFG_DWIDTH_MASK (0x7 << SLCD_CFG_DWIDTH_BIT)
2046 #define SLCD_CFG_DWIDTH_18 (0 << SLCD_CFG_DWIDTH_BIT) 2046 #define SLCD_CFG_DWIDTH_18 (0 << SLCD_CFG_DWIDTH_BIT)
2047 #define SLCD_CFG_DWIDTH_16 (1 << SLCD_CFG_DWIDTH_BIT) 2047 #define SLCD_CFG_DWIDTH_16 (1 << SLCD_CFG_DWIDTH_BIT)
2048 #define SLCD_CFG_DWIDTH_8_x3 (2 << SLCD_CFG_DWIDTH_BIT) 2048 #define SLCD_CFG_DWIDTH_8_x3 (2 << SLCD_CFG_DWIDTH_BIT)
2049 #define SLCD_CFG_DWIDTH_8_x2 (3 << SLCD_CFG_DWIDTH_BIT) 2049 #define SLCD_CFG_DWIDTH_8_x2 (3 << SLCD_CFG_DWIDTH_BIT)
2050 #define SLCD_CFG_DWIDTH_8_x1 (4 << SLCD_CFG_DWIDTH_BIT) 2050 #define SLCD_CFG_DWIDTH_8_x1 (4 << SLCD_CFG_DWIDTH_BIT)
2051 #define SLCD_CFG_DWIDTH_9_x2 (7 << SLCD_CFG_DWIDTH_BIT) 2051 #define SLCD_CFG_DWIDTH_9_x2 (7 << SLCD_CFG_DWIDTH_BIT)
2052#define SLCD_CFG_CWIDTH_BIT 8 2052#define SLCD_CFG_CWIDTH_BIT 8
2053#define SLCD_CFG_CWIDTH_MASK (0x3 << SLCD_CFG_CWIDTH_BIT) 2053#define SLCD_CFG_CWIDTH_MASK (0x3 << SLCD_CFG_CWIDTH_BIT)
2054 #define SLCD_CFG_CWIDTH_16BIT (0 << SLCD_CFG_CWIDTH_BIT) 2054 #define SLCD_CFG_CWIDTH_16BIT (0 << SLCD_CFG_CWIDTH_BIT)
2055 #define SLCD_CFG_CWIDTH_8BIT (1 << SLCD_CFG_CWIDTH_BIT) 2055 #define SLCD_CFG_CWIDTH_8BIT (1 << SLCD_CFG_CWIDTH_BIT)
2056 #define SLCD_CFG_CWIDTH_18BIT (2 << SLCD_CFG_CWIDTH_BIT) 2056 #define SLCD_CFG_CWIDTH_18BIT (2 << SLCD_CFG_CWIDTH_BIT)
2057#define SLCD_CFG_CS_ACTIVE_LOW (0 << 4) 2057#define SLCD_CFG_CS_ACTIVE_LOW (0 << 4)
2058#define SLCD_CFG_CS_ACTIVE_HIGH (1 << 4) 2058#define SLCD_CFG_CS_ACTIVE_HIGH (1 << 4)
2059#define SLCD_CFG_RS_CMD_LOW (0 << 3) 2059#define SLCD_CFG_RS_CMD_LOW (0 << 3)
2060#define SLCD_CFG_RS_CMD_HIGH (1 << 3) 2060#define SLCD_CFG_RS_CMD_HIGH (1 << 3)
2061#define SLCD_CFG_CLK_ACTIVE_FALLING (0 << 1) 2061#define SLCD_CFG_CLK_ACTIVE_FALLING (0 << 1)
2062#define SLCD_CFG_CLK_ACTIVE_RISING (1 << 1) 2062#define SLCD_CFG_CLK_ACTIVE_RISING (1 << 1)
2063#define SLCD_CFG_TYPE_PARALLEL (0 << 0) 2063#define SLCD_CFG_TYPE_PARALLEL (0 << 0)
2064#define SLCD_CFG_TYPE_SERIAL (1 << 0) 2064#define SLCD_CFG_TYPE_SERIAL (1 << 0)
2065 2065
2066/* SLCD Control Register */ 2066/* SLCD Control Register */
2067#define SLCD_CTRL_DMA_EN (1 << 0) 2067#define SLCD_CTRL_DMA_EN (1 << 0)
2068 2068
2069/* SLCD Status Register */ 2069/* SLCD Status Register */
2070#define SLCD_STATE_BUSY (1 << 0) 2070#define SLCD_STATE_BUSY (1 << 0)
2071 2071
2072/* SLCD Data Register */ 2072/* SLCD Data Register */
2073#define SLCD_DATA_RS_DATA (0 << 31) 2073#define SLCD_DATA_RS_DATA (0 << 31)
2074#define SLCD_DATA_RS_COMMAND (1 << 31) 2074#define SLCD_DATA_RS_COMMAND (1 << 31)
2075 2075
2076/* SLCD FIFO Register */ 2076/* SLCD FIFO Register */
2077#define SLCD_FIFO_RS_DATA (0 << 31) 2077#define SLCD_FIFO_RS_DATA (0 << 31)
2078#define SLCD_FIFO_RS_COMMAND (1 << 31) 2078#define SLCD_FIFO_RS_COMMAND (1 << 31)
2079 2079
2080 2080
2081/************************************************************************* 2081/*************************************************************************
2082 * LCD (LCD Controller) 2082 * LCD (LCD Controller)
2083 *************************************************************************/ 2083 *************************************************************************/
2084#define LCD_CFG (LCD_BASE + 0x00) /* LCD Configure Register */ 2084#define LCD_CFG (LCD_BASE + 0x00) /* LCD Configure Register */
2085#define LCD_VSYNC (LCD_BASE + 0x04) /* Vertical Synchronize Register */ 2085#define LCD_VSYNC (LCD_BASE + 0x04) /* Vertical Synchronize Register */
2086#define LCD_HSYNC (LCD_BASE + 0x08) /* Horizontal Synchronize Register */ 2086#define LCD_HSYNC (LCD_BASE + 0x08) /* Horizontal Synchronize Register */
2087#define LCD_VAT (LCD_BASE + 0x0c) /* Virtual Area Setting Register */ 2087#define LCD_VAT (LCD_BASE + 0x0c) /* Virtual Area Setting Register */
2088#define LCD_DAH (LCD_BASE + 0x10) /* Display Area Horizontal Start/End Point */ 2088#define LCD_DAH (LCD_BASE + 0x10) /* Display Area Horizontal Start/End Point */
2089#define LCD_DAV (LCD_BASE + 0x14) /* Display Area Vertical Start/End Point */ 2089#define LCD_DAV (LCD_BASE + 0x14) /* Display Area Vertical Start/End Point */
2090#define LCD_PS (LCD_BASE + 0x18) /* PS Signal Setting */ 2090#define LCD_PS (LCD_BASE + 0x18) /* PS Signal Setting */
2091#define LCD_CLS (LCD_BASE + 0x1c) /* CLS Signal Setting */ 2091#define LCD_CLS (LCD_BASE + 0x1c) /* CLS Signal Setting */
2092#define LCD_SPL (LCD_BASE + 0x20) /* SPL Signal Setting */ 2092#define LCD_SPL (LCD_BASE + 0x20) /* SPL Signal Setting */
2093#define LCD_REV (LCD_BASE + 0x24) /* REV Signal Setting */ 2093#define LCD_REV (LCD_BASE + 0x24) /* REV Signal Setting */
2094#define LCD_CTRL (LCD_BASE + 0x30) /* LCD Control Register */ 2094#define LCD_CTRL (LCD_BASE + 0x30) /* LCD Control Register */
2095#define LCD_STATE (LCD_BASE + 0x34) /* LCD Status Register */ 2095#define LCD_STATE (LCD_BASE + 0x34) /* LCD Status Register */
2096#define LCD_IID (LCD_BASE + 0x38) /* Interrupt ID Register */ 2096#define LCD_IID (LCD_BASE + 0x38) /* Interrupt ID Register */
2097#define LCD_DA0 (LCD_BASE + 0x40) /* Descriptor Address Register 0 */ 2097#define LCD_DA0 (LCD_BASE + 0x40) /* Descriptor Address Register 0 */
2098#define LCD_SA0 (LCD_BASE + 0x44) /* Source Address Register 0 */ 2098#define LCD_SA0 (LCD_BASE + 0x44) /* Source Address Register 0 */
2099#define LCD_FID0 (LCD_BASE + 0x48) /* Frame ID Register 0 */ 2099#define LCD_FID0 (LCD_BASE + 0x48) /* Frame ID Register 0 */
2100#define LCD_CMD0 (LCD_BASE + 0x4c) /* DMA Command Register 0 */ 2100#define LCD_CMD0 (LCD_BASE + 0x4c) /* DMA Command Register 0 */
2101#define LCD_DA1 (LCD_BASE + 0x50) /* Descriptor Address Register 1 */ 2101#define LCD_DA1 (LCD_BASE + 0x50) /* Descriptor Address Register 1 */
2102#define LCD_SA1 (LCD_BASE + 0x54) /* Source Address Register 1 */ 2102#define LCD_SA1 (LCD_BASE + 0x54) /* Source Address Register 1 */
2103#define LCD_FID1 (LCD_BASE + 0x58) /* Frame ID Register 1 */ 2103#define LCD_FID1 (LCD_BASE + 0x58) /* Frame ID Register 1 */
2104#define LCD_CMD1 (LCD_BASE + 0x5c) /* DMA Command Register 1 */ 2104#define LCD_CMD1 (LCD_BASE + 0x5c) /* DMA Command Register 1 */
2105 2105
2106#define REG_LCD_CFG REG32(LCD_CFG) 2106#define REG_LCD_CFG REG32(LCD_CFG)
2107#define REG_LCD_VSYNC REG32(LCD_VSYNC) 2107#define REG_LCD_VSYNC REG32(LCD_VSYNC)
2108#define REG_LCD_HSYNC REG32(LCD_HSYNC) 2108#define REG_LCD_HSYNC REG32(LCD_HSYNC)
2109#define REG_LCD_VAT REG32(LCD_VAT) 2109#define REG_LCD_VAT REG32(LCD_VAT)
2110#define REG_LCD_DAH REG32(LCD_DAH) 2110#define REG_LCD_DAH REG32(LCD_DAH)
2111#define REG_LCD_DAV REG32(LCD_DAV) 2111#define REG_LCD_DAV REG32(LCD_DAV)
2112#define REG_LCD_PS REG32(LCD_PS) 2112#define REG_LCD_PS REG32(LCD_PS)
2113#define REG_LCD_CLS REG32(LCD_CLS) 2113#define REG_LCD_CLS REG32(LCD_CLS)
2114#define REG_LCD_SPL REG32(LCD_SPL) 2114#define REG_LCD_SPL REG32(LCD_SPL)
2115#define REG_LCD_REV REG32(LCD_REV) 2115#define REG_LCD_REV REG32(LCD_REV)
2116#define REG_LCD_CTRL REG32(LCD_CTRL) 2116#define REG_LCD_CTRL REG32(LCD_CTRL)
2117#define REG_LCD_STATE REG32(LCD_STATE) 2117#define REG_LCD_STATE REG32(LCD_STATE)
2118#define REG_LCD_IID REG32(LCD_IID) 2118#define REG_LCD_IID REG32(LCD_IID)
2119#define REG_LCD_DA0 REG32(LCD_DA0) 2119#define REG_LCD_DA0 REG32(LCD_DA0)
2120#define REG_LCD_SA0 REG32(LCD_SA0) 2120#define REG_LCD_SA0 REG32(LCD_SA0)
2121#define REG_LCD_FID0 REG32(LCD_FID0) 2121#define REG_LCD_FID0 REG32(LCD_FID0)
2122#define REG_LCD_CMD0 REG32(LCD_CMD0) 2122#define REG_LCD_CMD0 REG32(LCD_CMD0)
2123#define REG_LCD_DA1 REG32(LCD_DA1) 2123#define REG_LCD_DA1 REG32(LCD_DA1)
2124#define REG_LCD_SA1 REG32(LCD_SA1) 2124#define REG_LCD_SA1 REG32(LCD_SA1)
2125#define REG_LCD_FID1 REG32(LCD_FID1) 2125#define REG_LCD_FID1 REG32(LCD_FID1)
2126#define REG_LCD_CMD1 REG32(LCD_CMD1) 2126#define REG_LCD_CMD1 REG32(LCD_CMD1)
2127 2127
2128/* LCD Configure Register */ 2128/* LCD Configure Register */
2129#define LCD_CFG_LCDPIN_BIT 31 /* LCD pins selection */ 2129#define LCD_CFG_LCDPIN_BIT 31 /* LCD pins selection */
2130#define LCD_CFG_LCDPIN_MASK (0x1 << LCD_CFG_LCDPIN_BIT) 2130#define LCD_CFG_LCDPIN_MASK (0x1 << LCD_CFG_LCDPIN_BIT)
2131 #define LCD_CFG_LCDPIN_LCD (0x0 << LCD_CFG_LCDPIN_BIT) 2131 #define LCD_CFG_LCDPIN_LCD (0x0 << LCD_CFG_LCDPIN_BIT)
2132 #define LCD_CFG_LCDPIN_SLCD (0x1 << LCD_CFG_LCDPIN_BIT) 2132 #define LCD_CFG_LCDPIN_SLCD (0x1 << LCD_CFG_LCDPIN_BIT)
2133#define LCD_CFG_PSM (1 << 23) /* PS signal mode */ 2133#define LCD_CFG_PSM (1 << 23) /* PS signal mode */
2134#define LCD_CFG_CLSM (1 << 22) /* CLS signal mode */ 2134#define LCD_CFG_CLSM (1 << 22) /* CLS signal mode */
2135#define LCD_CFG_SPLM (1 << 21) /* SPL signal mode */ 2135#define LCD_CFG_SPLM (1 << 21) /* SPL signal mode */
2136#define LCD_CFG_REVM (1 << 20) /* REV signal mode */ 2136#define LCD_CFG_REVM (1 << 20) /* REV signal mode */
2137#define LCD_CFG_HSYNM (1 << 19) /* HSYNC signal mode */ 2137#define LCD_CFG_HSYNM (1 << 19) /* HSYNC signal mode */
2138#define LCD_CFG_PCLKM (1 << 18) /* PCLK signal mode */ 2138#define LCD_CFG_PCLKM (1 << 18) /* PCLK signal mode */
2139#define LCD_CFG_INVDAT (1 << 17) /* Inverse output data */ 2139#define LCD_CFG_INVDAT (1 << 17) /* Inverse output data */
2140#define LCD_CFG_SYNDIR_IN (1 << 16) /* VSYNC&HSYNC direction */ 2140#define LCD_CFG_SYNDIR_IN (1 << 16) /* VSYNC&HSYNC direction */
2141#define LCD_CFG_PSP (1 << 15) /* PS pin reset state */ 2141#define LCD_CFG_PSP (1 << 15) /* PS pin reset state */
2142#define LCD_CFG_CLSP (1 << 14) /* CLS pin reset state */ 2142#define LCD_CFG_CLSP (1 << 14) /* CLS pin reset state */
2143#define LCD_CFG_SPLP (1 << 13) /* SPL pin reset state */ 2143#define LCD_CFG_SPLP (1 << 13) /* SPL pin reset state */
2144#define LCD_CFG_REVP (1 << 12) /* REV pin reset state */ 2144#define LCD_CFG_REVP (1 << 12) /* REV pin reset state */
2145#define LCD_CFG_HSP (1 << 11) /* HSYNC pority:0-active high,1-active low */ 2145#define LCD_CFG_HSP (1 << 11) /* HSYNC pority:0-active high,1-active low */
2146#define LCD_CFG_PCP (1 << 10) /* PCLK pority:0-rising,1-falling */ 2146#define LCD_CFG_PCP (1 << 10) /* PCLK pority:0-rising,1-falling */
2147#define LCD_CFG_DEP (1 << 9) /* DE pority:0-active high,1-active low */ 2147#define LCD_CFG_DEP (1 << 9) /* DE pority:0-active high,1-active low */
2148#define LCD_CFG_VSP (1 << 8) /* VSYNC pority:0-rising,1-falling */ 2148#define LCD_CFG_VSP (1 << 8) /* VSYNC pority:0-rising,1-falling */
2149#define LCD_CFG_PDW_BIT 4 /* STN pins utilization */ 2149#define LCD_CFG_PDW_BIT 4 /* STN pins utilization */
2150#define LCD_CFG_PDW_MASK (0x3 << LCD_DEV_PDW_BIT) 2150#define LCD_CFG_PDW_MASK (0x3 << LCD_DEV_PDW_BIT)
2151#define LCD_CFG_PDW_1 (0 << LCD_CFG_PDW_BIT) /* LCD_D[0] */ 2151#define LCD_CFG_PDW_1 (0 << LCD_CFG_PDW_BIT) /* LCD_D[0] */
2152 #define LCD_CFG_PDW_2 (1 << LCD_CFG_PDW_BIT) /* LCD_D[0:1] */ 2152 #define LCD_CFG_PDW_2 (1 << LCD_CFG_PDW_BIT) /* LCD_D[0:1] */
2153 #define LCD_CFG_PDW_4 (2 << LCD_CFG_PDW_BIT) /* LCD_D[0:3]/LCD_D[8:11] */ 2153 #define LCD_CFG_PDW_4 (2 << LCD_CFG_PDW_BIT) /* LCD_D[0:3]/LCD_D[8:11] */
2154 #define LCD_CFG_PDW_8 (3 << LCD_CFG_PDW_BIT) /* LCD_D[0:7]/LCD_D[8:15] */ 2154 #define LCD_CFG_PDW_8 (3 << LCD_CFG_PDW_BIT) /* LCD_D[0:7]/LCD_D[8:15] */
2155#define LCD_CFG_MODE_BIT 0 /* Display Device Mode Select */ 2155#define LCD_CFG_MODE_BIT 0 /* Display Device Mode Select */
2156#define LCD_CFG_MODE_MASK (0x0f << LCD_CFG_MODE_BIT) 2156#define LCD_CFG_MODE_MASK (0x0f << LCD_CFG_MODE_BIT)
2157 #define LCD_CFG_MODE_GENERIC_TFT (0 << LCD_CFG_MODE_BIT) /* 16,18 bit TFT */ 2157 #define LCD_CFG_MODE_GENERIC_TFT (0 << LCD_CFG_MODE_BIT) /* 16,18 bit TFT */
2158 #define LCD_CFG_MODE_SPECIAL_TFT_1 (1 << LCD_CFG_MODE_BIT) 2158 #define LCD_CFG_MODE_SPECIAL_TFT_1 (1 << LCD_CFG_MODE_BIT)
2159 #define LCD_CFG_MODE_SPECIAL_TFT_2 (2 << LCD_CFG_MODE_BIT) 2159 #define LCD_CFG_MODE_SPECIAL_TFT_2 (2 << LCD_CFG_MODE_BIT)
2160 #define LCD_CFG_MODE_SPECIAL_TFT_3 (3 << LCD_CFG_MODE_BIT) 2160 #define LCD_CFG_MODE_SPECIAL_TFT_3 (3 << LCD_CFG_MODE_BIT)
2161 #define LCD_CFG_MODE_NONINTER_CCIR656 (4 << LCD_CFG_MODE_BIT) 2161 #define LCD_CFG_MODE_NONINTER_CCIR656 (4 << LCD_CFG_MODE_BIT)
2162 #define LCD_CFG_MODE_INTER_CCIR656 (5 << LCD_CFG_MODE_BIT) 2162 #define LCD_CFG_MODE_INTER_CCIR656 (5 << LCD_CFG_MODE_BIT)
2163 #define LCD_CFG_MODE_SINGLE_CSTN (8 << LCD_CFG_MODE_BIT) 2163 #define LCD_CFG_MODE_SINGLE_CSTN (8 << LCD_CFG_MODE_BIT)
2164 #define LCD_CFG_MODE_SINGLE_MSTN (9 << LCD_CFG_MODE_BIT) 2164 #define LCD_CFG_MODE_SINGLE_MSTN (9 << LCD_CFG_MODE_BIT)
2165 #define LCD_CFG_MODE_DUAL_CSTN (10 << LCD_CFG_MODE_BIT) 2165 #define LCD_CFG_MODE_DUAL_CSTN (10 << LCD_CFG_MODE_BIT)
2166 #define LCD_CFG_MODE_DUAL_MSTN (11 << LCD_CFG_MODE_BIT) 2166 #define LCD_CFG_MODE_DUAL_MSTN (11 << LCD_CFG_MODE_BIT)
2167 #define LCD_CFG_MODE_SERIAL_TFT (12 << LCD_CFG_MODE_BIT) 2167 #define LCD_CFG_MODE_SERIAL_TFT (12 << LCD_CFG_MODE_BIT)
2168 #define LCD_CFG_MODE_GENERIC_18BIT_TFT (13 << LCD_CFG_MODE_BIT) 2168 #define LCD_CFG_MODE_GENERIC_18BIT_TFT (13 << LCD_CFG_MODE_BIT)
2169 /* JZ47XX defines */ 2169 /* JZ47XX defines */
2170 #define LCD_CFG_MODE_SHARP_HR (1 << LCD_CFG_MODE_BIT) 2170 #define LCD_CFG_MODE_SHARP_HR (1 << LCD_CFG_MODE_BIT)
2171 #define LCD_CFG_MODE_CASIO_TFT (2 << LCD_CFG_MODE_BIT) 2171 #define LCD_CFG_MODE_CASIO_TFT (2 << LCD_CFG_MODE_BIT)
2172 #define LCD_CFG_MODE_SAMSUNG_ALPHA (3 << LCD_CFG_MODE_BIT) 2172 #define LCD_CFG_MODE_SAMSUNG_ALPHA (3 << LCD_CFG_MODE_BIT)
2173 2173
2174 2174
2175 2175
2176/* Vertical Synchronize Register */ 2176/* Vertical Synchronize Register */
2177#define LCD_VSYNC_VPS_BIT 16 /* VSYNC pulse start in line clock, fixed to 0 */ 2177#define LCD_VSYNC_VPS_BIT 16 /* VSYNC pulse start in line clock, fixed to 0 */
2178#define LCD_VSYNC_VPS_MASK (0xffff << LCD_VSYNC_VPS_BIT) 2178#define LCD_VSYNC_VPS_MASK (0xffff << LCD_VSYNC_VPS_BIT)
2179#define LCD_VSYNC_VPE_BIT 0 /* VSYNC pulse end in line clock */ 2179#define LCD_VSYNC_VPE_BIT 0 /* VSYNC pulse end in line clock */
2180#define LCD_VSYNC_VPE_MASK (0xffff << LCD_VSYNC_VPS_BIT) 2180#define LCD_VSYNC_VPE_MASK (0xffff << LCD_VSYNC_VPS_BIT)
2181 2181
2182/* Horizontal Synchronize Register */ 2182/* Horizontal Synchronize Register */
2183#define LCD_HSYNC_HPS_BIT 16 /* HSYNC pulse start position in dot clock */ 2183#define LCD_HSYNC_HPS_BIT 16 /* HSYNC pulse start position in dot clock */
2184#define LCD_HSYNC_HPS_MASK (0xffff << LCD_HSYNC_HPS_BIT) 2184#define LCD_HSYNC_HPS_MASK (0xffff << LCD_HSYNC_HPS_BIT)
2185#define LCD_HSYNC_HPE_BIT 0 /* HSYNC pulse end position in dot clock */ 2185#define LCD_HSYNC_HPE_BIT 0 /* HSYNC pulse end position in dot clock */
2186#define LCD_HSYNC_HPE_MASK (0xffff << LCD_HSYNC_HPE_BIT) 2186#define LCD_HSYNC_HPE_MASK (0xffff << LCD_HSYNC_HPE_BIT)
2187 2187
2188/* Virtual Area Setting Register */ 2188/* Virtual Area Setting Register */
2189#define LCD_VAT_HT_BIT 16 /* Horizontal Total size in dot clock */ 2189#define LCD_VAT_HT_BIT 16 /* Horizontal Total size in dot clock */
2190#define LCD_VAT_HT_MASK (0xffff << LCD_VAT_HT_BIT) 2190#define LCD_VAT_HT_MASK (0xffff << LCD_VAT_HT_BIT)
2191#define LCD_VAT_VT_BIT 0 /* Vertical Total size in dot clock */ 2191#define LCD_VAT_VT_BIT 0 /* Vertical Total size in dot clock */
2192#define LCD_VAT_VT_MASK (0xffff << LCD_VAT_VT_BIT) 2192#define LCD_VAT_VT_MASK (0xffff << LCD_VAT_VT_BIT)
2193 2193
2194/* Display Area Horizontal Start/End Point Register */ 2194/* Display Area Horizontal Start/End Point Register */
2195#define LCD_DAH_HDS_BIT 16 /* Horizontal display area start in dot clock */ 2195#define LCD_DAH_HDS_BIT 16 /* Horizontal display area start in dot clock */
2196#define LCD_DAH_HDS_MASK (0xffff << LCD_DAH_HDS_BIT) 2196#define LCD_DAH_HDS_MASK (0xffff << LCD_DAH_HDS_BIT)
2197#define LCD_DAH_HDE_BIT 0 /* Horizontal display area end in dot clock */ 2197#define LCD_DAH_HDE_BIT 0 /* Horizontal display area end in dot clock */
2198#define LCD_DAH_HDE_MASK (0xffff << LCD_DAH_HDE_BIT) 2198#define LCD_DAH_HDE_MASK (0xffff << LCD_DAH_HDE_BIT)
2199 2199
2200/* Display Area Vertical Start/End Point Register */ 2200/* Display Area Vertical Start/End Point Register */
2201#define LCD_DAV_VDS_BIT 16 /* Vertical display area start in line clock */ 2201#define LCD_DAV_VDS_BIT 16 /* Vertical display area start in line clock */
2202#define LCD_DAV_VDS_MASK (0xffff << LCD_DAV_VDS_BIT) 2202#define LCD_DAV_VDS_MASK (0xffff << LCD_DAV_VDS_BIT)
2203#define LCD_DAV_VDE_BIT 0 /* Vertical display area end in line clock */ 2203#define LCD_DAV_VDE_BIT 0 /* Vertical display area end in line clock */
2204#define LCD_DAV_VDE_MASK (0xffff << LCD_DAV_VDE_BIT) 2204#define LCD_DAV_VDE_MASK (0xffff << LCD_DAV_VDE_BIT)
2205 2205
2206/* PS Signal Setting */ 2206/* PS Signal Setting */
2207#define LCD_PS_PSS_BIT 16 /* PS signal start position in dot clock */ 2207#define LCD_PS_PSS_BIT 16 /* PS signal start position in dot clock */
2208#define LCD_PS_PSS_MASK (0xffff << LCD_PS_PSS_BIT) 2208#define LCD_PS_PSS_MASK (0xffff << LCD_PS_PSS_BIT)
2209#define LCD_PS_PSE_BIT 0 /* PS signal end position in dot clock */ 2209#define LCD_PS_PSE_BIT 0 /* PS signal end position in dot clock */
2210#define LCD_PS_PSE_MASK (0xffff << LCD_PS_PSE_BIT) 2210#define LCD_PS_PSE_MASK (0xffff << LCD_PS_PSE_BIT)
2211 2211
2212/* CLS Signal Setting */ 2212/* CLS Signal Setting */
2213#define LCD_CLS_CLSS_BIT 16 /* CLS signal start position in dot clock */ 2213#define LCD_CLS_CLSS_BIT 16 /* CLS signal start position in dot clock */
2214#define LCD_CLS_CLSS_MASK (0xffff << LCD_CLS_CLSS_BIT) 2214#define LCD_CLS_CLSS_MASK (0xffff << LCD_CLS_CLSS_BIT)
2215#define LCD_CLS_CLSE_BIT 0 /* CLS signal end position in dot clock */ 2215#define LCD_CLS_CLSE_BIT 0 /* CLS signal end position in dot clock */
2216#define LCD_CLS_CLSE_MASK (0xffff << LCD_CLS_CLSE_BIT) 2216#define LCD_CLS_CLSE_MASK (0xffff << LCD_CLS_CLSE_BIT)
2217 2217
2218/* SPL Signal Setting */ 2218/* SPL Signal Setting */
2219#define LCD_SPL_SPLS_BIT 16 /* SPL signal start position in dot clock */ 2219#define LCD_SPL_SPLS_BIT 16 /* SPL signal start position in dot clock */
2220#define LCD_SPL_SPLS_MASK (0xffff << LCD_SPL_SPLS_BIT) 2220#define LCD_SPL_SPLS_MASK (0xffff << LCD_SPL_SPLS_BIT)
2221#define LCD_SPL_SPLE_BIT 0 /* SPL signal end position in dot clock */ 2221#define LCD_SPL_SPLE_BIT 0 /* SPL signal end position in dot clock */
2222#define LCD_SPL_SPLE_MASK (0xffff << LCD_SPL_SPLE_BIT) 2222#define LCD_SPL_SPLE_MASK (0xffff << LCD_SPL_SPLE_BIT)
2223 2223
2224/* REV Signal Setting */ 2224/* REV Signal Setting */
2225#define LCD_REV_REVS_BIT 16 /* REV signal start position in dot clock */ 2225#define LCD_REV_REVS_BIT 16 /* REV signal start position in dot clock */
2226#define LCD_REV_REVS_MASK (0xffff << LCD_REV_REVS_BIT) 2226#define LCD_REV_REVS_MASK (0xffff << LCD_REV_REVS_BIT)
2227 2227
2228/* LCD Control Register */ 2228/* LCD Control Register */
2229#define LCD_CTRL_BST_BIT 28 /* Burst Length Selection */ 2229#define LCD_CTRL_BST_BIT 28 /* Burst Length Selection */
2230#define LCD_CTRL_BST_MASK (0x03 << LCD_CTRL_BST_BIT) 2230#define LCD_CTRL_BST_MASK (0x03 << LCD_CTRL_BST_BIT)
2231 #define LCD_CTRL_BST_4 (0 << LCD_CTRL_BST_BIT) /* 4-word */ 2231 #define LCD_CTRL_BST_4 (0 << LCD_CTRL_BST_BIT) /* 4-word */
2232 #define LCD_CTRL_BST_8 (1 << LCD_CTRL_BST_BIT) /* 8-word */ 2232 #define LCD_CTRL_BST_8 (1 << LCD_CTRL_BST_BIT) /* 8-word */
2233 #define LCD_CTRL_BST_16 (2 << LCD_CTRL_BST_BIT) /* 16-word */ 2233 #define LCD_CTRL_BST_16 (2 << LCD_CTRL_BST_BIT) /* 16-word */
2234#define LCD_CTRL_RGB565 (0 << 27) /* RGB565 mode */ 2234#define LCD_CTRL_RGB565 (0 << 27) /* RGB565 mode */
2235#define LCD_CTRL_RGB555 (1 << 27) /* RGB555 mode */ 2235#define LCD_CTRL_RGB555 (1 << 27) /* RGB555 mode */
2236#define LCD_CTRL_OFUP (1 << 26) /* Output FIFO underrun protection enable */ 2236#define LCD_CTRL_OFUP (1 << 26) /* Output FIFO underrun protection enable */
2237#define LCD_CTRL_FRC_BIT 24 /* STN FRC Algorithm Selection */ 2237#define LCD_CTRL_FRC_BIT 24 /* STN FRC Algorithm Selection */
2238#define LCD_CTRL_FRC_MASK (0x03 << LCD_CTRL_FRC_BIT) 2238#define LCD_CTRL_FRC_MASK (0x03 << LCD_CTRL_FRC_BIT)
2239 #define LCD_CTRL_FRC_16 (0 << LCD_CTRL_FRC_BIT) /* 16 grayscale */ 2239 #define LCD_CTRL_FRC_16 (0 << LCD_CTRL_FRC_BIT) /* 16 grayscale */
2240 #define LCD_CTRL_FRC_4 (1 << LCD_CTRL_FRC_BIT) /* 4 grayscale */ 2240 #define LCD_CTRL_FRC_4 (1 << LCD_CTRL_FRC_BIT) /* 4 grayscale */
2241 #define LCD_CTRL_FRC_2 (2 << LCD_CTRL_FRC_BIT) /* 2 grayscale */ 2241 #define LCD_CTRL_FRC_2 (2 << LCD_CTRL_FRC_BIT) /* 2 grayscale */
2242#define LCD_CTRL_PDD_BIT 16 /* Load Palette Delay Counter */ 2242#define LCD_CTRL_PDD_BIT 16 /* Load Palette Delay Counter */
2243#define LCD_CTRL_PDD_MASK (0xff << LCD_CTRL_PDD_BIT) 2243#define LCD_CTRL_PDD_MASK (0xff << LCD_CTRL_PDD_BIT)
2244#define LCD_CTRL_EOFM (1 << 13) /* EOF interrupt mask */ 2244#define LCD_CTRL_EOFM (1 << 13) /* EOF interrupt mask */
2245#define LCD_CTRL_SOFM (1 << 12) /* SOF interrupt mask */ 2245#define LCD_CTRL_SOFM (1 << 12) /* SOF interrupt mask */
2246#define LCD_CTRL_OFUM (1 << 11) /* Output FIFO underrun interrupt mask */ 2246#define LCD_CTRL_OFUM (1 << 11) /* Output FIFO underrun interrupt mask */
2247#define LCD_CTRL_IFUM0 (1 << 10) /* Input FIFO 0 underrun interrupt mask */ 2247#define LCD_CTRL_IFUM0 (1 << 10) /* Input FIFO 0 underrun interrupt mask */
2248#define LCD_CTRL_IFUM1 (1 << 9) /* Input FIFO 1 underrun interrupt mask */ 2248#define LCD_CTRL_IFUM1 (1 << 9) /* Input FIFO 1 underrun interrupt mask */
2249#define LCD_CTRL_LDDM (1 << 8) /* LCD disable done interrupt mask */ 2249#define LCD_CTRL_LDDM (1 << 8) /* LCD disable done interrupt mask */
2250#define LCD_CTRL_QDM (1 << 7) /* LCD quick disable done interrupt mask */ 2250#define LCD_CTRL_QDM (1 << 7) /* LCD quick disable done interrupt mask */
2251#define LCD_CTRL_BEDN (1 << 6) /* Endian selection */ 2251#define LCD_CTRL_BEDN (1 << 6) /* Endian selection */
2252#define LCD_CTRL_PEDN (1 << 5) /* Endian in byte:0-msb first, 1-lsb first */ 2252#define LCD_CTRL_PEDN (1 << 5) /* Endian in byte:0-msb first, 1-lsb first */
2253#define LCD_CTRL_DIS (1 << 4) /* Disable indicate bit */ 2253#define LCD_CTRL_DIS (1 << 4) /* Disable indicate bit */
2254#define LCD_CTRL_ENA (1 << 3) /* LCD enable bit */ 2254#define LCD_CTRL_ENA (1 << 3) /* LCD enable bit */
2255#define LCD_CTRL_BPP_BIT 0 /* Bits Per Pixel */ 2255#define LCD_CTRL_BPP_BIT 0 /* Bits Per Pixel */
2256#define LCD_CTRL_BPP_MASK (0x07 << LCD_CTRL_BPP_BIT) 2256#define LCD_CTRL_BPP_MASK (0x07 << LCD_CTRL_BPP_BIT)
2257 #define LCD_CTRL_BPP_1 (0 << LCD_CTRL_BPP_BIT) /* 1 bpp */ 2257 #define LCD_CTRL_BPP_1 (0 << LCD_CTRL_BPP_BIT) /* 1 bpp */
2258 #define LCD_CTRL_BPP_2 (1 << LCD_CTRL_BPP_BIT) /* 2 bpp */ 2258 #define LCD_CTRL_BPP_2 (1 << LCD_CTRL_BPP_BIT) /* 2 bpp */
2259 #define LCD_CTRL_BPP_4 (2 << LCD_CTRL_BPP_BIT) /* 4 bpp */ 2259 #define LCD_CTRL_BPP_4 (2 << LCD_CTRL_BPP_BIT) /* 4 bpp */
2260 #define LCD_CTRL_BPP_8 (3 << LCD_CTRL_BPP_BIT) /* 8 bpp */ 2260 #define LCD_CTRL_BPP_8 (3 << LCD_CTRL_BPP_BIT) /* 8 bpp */
2261 #define LCD_CTRL_BPP_16 (4 << LCD_CTRL_BPP_BIT) /* 15/16 bpp */ 2261 #define LCD_CTRL_BPP_16 (4 << LCD_CTRL_BPP_BIT) /* 15/16 bpp */
2262 #define LCD_CTRL_BPP_18_24 (5 << LCD_CTRL_BPP_BIT) /* 18/24/32 bpp */ 2262 #define LCD_CTRL_BPP_18_24 (5 << LCD_CTRL_BPP_BIT) /* 18/24/32 bpp */
2263 2263
2264/* LCD Status Register */ 2264/* LCD Status Register */
2265#define LCD_STATE_QD (1 << 7) /* Quick Disable Done */ 2265#define LCD_STATE_QD (1 << 7) /* Quick Disable Done */
2266#define LCD_STATE_EOF (1 << 5) /* EOF Flag */ 2266#define LCD_STATE_EOF (1 << 5) /* EOF Flag */
2267#define LCD_STATE_SOF (1 << 4) /* SOF Flag */ 2267#define LCD_STATE_SOF (1 << 4) /* SOF Flag */
2268#define LCD_STATE_OFU (1 << 3) /* Output FIFO Underrun */ 2268#define LCD_STATE_OFU (1 << 3) /* Output FIFO Underrun */
2269#define LCD_STATE_IFU0 (1 << 2) /* Input FIFO 0 Underrun */ 2269#define LCD_STATE_IFU0 (1 << 2) /* Input FIFO 0 Underrun */
2270#define LCD_STATE_IFU1 (1 << 1) /* Input FIFO 1 Underrun */ 2270#define LCD_STATE_IFU1 (1 << 1) /* Input FIFO 1 Underrun */
2271#define LCD_STATE_LDD (1 << 0) /* LCD Disabled */ 2271#define LCD_STATE_LDD (1 << 0) /* LCD Disabled */
2272 2272
2273/* DMA Command Register */ 2273/* DMA Command Register */
2274#define LCD_CMD_SOFINT (1 << 31) 2274#define LCD_CMD_SOFINT (1 << 31)
2275#define LCD_CMD_EOFINT (1 << 30) 2275#define LCD_CMD_EOFINT (1 << 30)
2276#define LCD_CMD_PAL (1 << 28) 2276#define LCD_CMD_PAL (1 << 28)
2277#define LCD_CMD_LEN_BIT 0 2277#define LCD_CMD_LEN_BIT 0
2278#define LCD_CMD_LEN_MASK (0xffffff << LCD_CMD_LEN_BIT) 2278#define LCD_CMD_LEN_MASK (0xffffff << LCD_CMD_LEN_BIT)
2279 2279
2280 2280
2281/************************************************************************* 2281/*************************************************************************
@@ -2283,113 +2283,146 @@
2283 *************************************************************************/ 2283 *************************************************************************/
2284#define USB_BASE UDC_BASE 2284#define USB_BASE UDC_BASE
2285 2285
2286#define USB_REG_FADDR (USB_BASE + 0x00) /* Function Address 8-bit */ 2286#define USB_REG_FADDR (USB_BASE + 0x00) /* Function Address 8-bit */
2287#define USB_REG_POWER (USB_BASE + 0x01) /* Power Managemetn 8-bit */ 2287#define USB_REG_POWER (USB_BASE + 0x01) /* Power Managemetn 8-bit */
2288#define USB_REG_INTRIN (USB_BASE + 0x02) /* Interrupt IN 16-bit */ 2288#define USB_REG_INTRIN (USB_BASE + 0x02) /* Interrupt IN 16-bit */
2289#define USB_REG_INTROUT (USB_BASE + 0x04) /* Interrupt OUT 16-bit */ 2289#define USB_REG_INTROUT (USB_BASE + 0x04) /* Interrupt OUT 16-bit */
2290#define USB_REG_INTRINE (USB_BASE + 0x06) /* Intr IN enable 16-bit */ 2290#define USB_REG_INTRINE (USB_BASE + 0x06) /* Intr IN enable 16-bit */
2291#define USB_REG_INTROUTE (USB_BASE + 0x08) /* Intr OUT enable 16-bit */ 2291#define USB_REG_INTROUTE (USB_BASE + 0x08) /* Intr OUT enable 16-bit */
2292#define USB_REG_INTRUSB (USB_BASE + 0x0a) /* Interrupt USB 8-bit */ 2292#define USB_REG_INTRUSB (USB_BASE + 0x0a) /* Interrupt USB 8-bit */
2293#define USB_REG_INTRUSBE (USB_BASE + 0x0b) /* Interrupt USB Enable 8-bit */ 2293#define USB_REG_INTRUSBE (USB_BASE + 0x0b) /* Interrupt USB Enable 8-bit */
2294#define USB_REG_FRAME (USB_BASE + 0x0c) /* Frame number 16-bit */ 2294#define USB_REG_FRAME (USB_BASE + 0x0c) /* Frame number 16-bit */
2295#define USB_REG_INDEX (USB_BASE + 0x0e) /* Index register 8-bit */ 2295#define USB_REG_INDEX (USB_BASE + 0x0e) /* Index register 8-bit */
2296#define USB_REG_TESTMODE (USB_BASE + 0x0f) /* USB test mode 8-bit */ 2296#define USB_REG_TESTMODE (USB_BASE + 0x0f) /* USB test mode 8-bit */
2297 2297
2298#define USB_REG_CSR0 (USB_BASE + 0x12) /* EP0 CSR 8-bit */ 2298#define USB_REG_CSR0 (USB_BASE + 0x12) /* EP0 CSR 8-bit */
2299#define USB_REG_INMAXP (USB_BASE + 0x10) /* EP1-2 IN Max Pkt Size 16-bit */ 2299#define USB_REG_INMAXP (USB_BASE + 0x10) /* EP1-2 IN Max Pkt Size 16-bit */
2300#define USB_REG_INCSR (USB_BASE + 0x12) /* EP1-2 IN CSR LSB 8/16bit */ 2300#define USB_REG_INCSR (USB_BASE + 0x12) /* EP1-2 IN CSR LSB 8/16bit */
2301#define USB_REG_INCSRH (USB_BASE + 0x13) /* EP1-2 IN CSR MSB 8-bit */ 2301#define USB_REG_INCSRH (USB_BASE + 0x13) /* EP1-2 IN CSR MSB 8-bit */
2302#define USB_REG_OUTMAXP (USB_BASE + 0x14) /* EP1 OUT Max Pkt Size 16-bit */ 2302#define USB_REG_OUTMAXP (USB_BASE + 0x14) /* EP1 OUT Max Pkt Size 16-bit */
2303#define USB_REG_OUTCSR (USB_BASE + 0x16) /* EP1 OUT CSR LSB 8/16bit */ 2303#define USB_REG_OUTCSR (USB_BASE + 0x16) /* EP1 OUT CSR LSB 8/16bit */
2304#define USB_REG_OUTCSRH (USB_BASE + 0x17) /* EP1 OUT CSR MSB 8-bit */ 2304#define USB_REG_OUTCSRH (USB_BASE + 0x17) /* EP1 OUT CSR MSB 8-bit */
2305#define USB_REG_OUTCOUNT (USB_BASE + 0x18) /* bytes in EP0/1 OUT FIFO 16-bit */ 2305#define USB_REG_OUTCOUNT (USB_BASE + 0x18) /* bytes in EP0/1 OUT FIFO 16-bit */
2306 2306
2307#define USB_FIFO_EP0 (USB_BASE + 0x20) 2307#define USB_FIFO_EP0 (USB_BASE + 0x20)
2308#define USB_FIFO_EP1 (USB_BASE + 0x24) 2308#define USB_FIFO_EP1 (USB_BASE + 0x24)
2309#define USB_FIFO_EP2 (USB_BASE + 0x28) 2309#define USB_FIFO_EP2 (USB_BASE + 0x28)
2310 2310
2311#define USB_REG_EPINFO (USB_BASE + 0x78) /* Endpoint information */ 2311#define USB_REG_EPINFO (USB_BASE + 0x78) /* Endpoint information */
2312#define USB_REG_RAMINFO (USB_BASE + 0x79) /* RAM information */ 2312#define USB_REG_RAMINFO (USB_BASE + 0x79) /* RAM information */
2313 2313
2314#define USB_REG_INTR (USB_BASE + 0x200) /* DMA pending interrupts */ 2314#define USB_REG_INTR (USB_BASE + 0x200) /* DMA pending interrupts 8-bit */
2315#define USB_REG_CNTL1 (USB_BASE + 0x204) /* DMA channel 1 control */ 2315#define USB_REG_CNTL1 (USB_BASE + 0x204) /* DMA channel 1 control 32-bit */
2316#define USB_REG_ADDR1 (USB_BASE + 0x208) /* DMA channel 1 AHB memory addr */ 2316#define USB_REG_ADDR1 (USB_BASE + 0x208) /* DMA channel 1 AHB memory addr 32-bit */
2317#define USB_REG_COUNT1 (USB_BASE + 0x20c) /* DMA channel 1 byte count */ 2317#define USB_REG_COUNT1 (USB_BASE + 0x20c) /* DMA channel 1 byte count 32-bit */
2318#define USB_REG_CNTL2 (USB_BASE + 0x214) /* DMA channel 2 control */ 2318#define USB_REG_CNTL2 (USB_BASE + 0x214) /* DMA channel 2 control 32-bit */
2319#define USB_REG_ADDR2 (USB_BASE + 0x218) /* DMA channel 2 AHB memory addr */ 2319#define USB_REG_ADDR2 (USB_BASE + 0x218) /* DMA channel 2 AHB memory addr 32-bit */
2320#define USB_REG_COUNT2 (USB_BASE + 0x21c) /* DMA channel 2 byte count */ 2320#define USB_REG_COUNT2 (USB_BASE + 0x21c) /* DMA channel 2 byte count 32-bit */
2321
2322#define REG_USB_REG_FADDR REG8(USB_REG_FADDR)
2323#define REG_USB_REG_POWER REG8(USB_REG_POWER)
2324#define REG_USB_REG_INTRIN REG16(USB_REG_INTRIN)
2325#define REG_USB_REG_INTROUT REG16(USB_REG_INTROUT)
2326#define REG_USB_REG_INTRINE REG16(USB_REG_INTRINE)
2327#define REG_USB_REG_INTROUTE REG16(USB_REG_INTROUTE)
2328#define REG_USB_REG_INTRUSB REG8(USB_REG_INTRUSB)
2329#define REG_USB_REG_INTRUSBE REG8(USB_REG_INTRUSBE)
2330#define REG_USB_REG_FRAME REG16(USB_REG_FRAME)
2331#define REG_USB_REG_INDEX REG8(USB_REG_INDEX)
2332#define REG_USB_REG_TESTMODE REG8(USB_REG_TESTMODE)
2333
2334#define REG_USB_REG_CSR0 REG8(USB_REG_CSR0)
2335#define REG_USB_REG_INMAXP REG16(USB_REG_INMAXP)
2336#define REG_USB_REG_INCSR REG16(USB_REG_INCSR)
2337#define REG_USB_REG_INCSRH REG8(USB_REG_INCSRH)
2338#define REG_USB_REG_OUTMAXP REG16(USB_REG_OUTMAXP)
2339#define REG_USB_REG_OUTCSR REG16(USB_REG_OUTCSR)
2340#define REG_USB_REG_OUTCSRH REG8(USB_REG_OUTCSRH)
2341#define REG_USB_REG_OUTCOUNT REG16(USB_REG_OUTCOUNT)
2342
2343#define REG_USB_FIFO_EP0 REG32(USB_FIFO_EP0)
2344#define REG_USB_FIFO_EP1 REG32(USB_FIFO_EP1)
2345#define REG_USB_FIFO_EP2 REG32(USB_FIFO_EP2)
2346
2347#define REG_USB_REG_INTR REG8(USB_REG_INTR)
2348#define REG_USB_REG_CNTL1 REG32(USB_REG_CNTL1)
2349#define REG_USB_REG_ADDR1 REG32(USB_REG_ADDR1)
2350#define REG_USB_REG_COUNT1 REG32(USB_REG_COUNT1)
2351#define REG_USB_REG_CNTL2 REG32(USB_REG_CNTL2)
2352#define REG_USB_REG_ADDR2 REG32(USB_REG_ADDR2)
2353#define REG_USB_REG_COUNT2 REG32(USB_REG_COUNT2)
2321 2354
2322 2355
2323/* Power register bit masks */ 2356/* Power register bit masks */
2324#define USB_POWER_SUSPENDM 0x01 2357#define USB_POWER_SUSPENDM 0x01
2325#define USB_POWER_RESUME 0x04 2358#define USB_POWER_RESUME 0x04
2326#define USB_POWER_HSMODE 0x10 2359#define USB_POWER_HSMODE 0x10
2327#define USB_POWER_HSENAB 0x20 2360#define USB_POWER_HSENAB 0x20
2328#define USB_POWER_SOFTCONN 0x40 2361#define USB_POWER_SOFTCONN 0x40
2329 2362
2330/* Interrupt register bit masks */ 2363/* Interrupt register bit masks */
2331#define USB_INTR_SUSPEND 0x01 2364#define USB_INTR_SUSPEND 0x01
2332#define USB_INTR_RESUME 0x02 2365#define USB_INTR_RESUME 0x02
2333#define USB_INTR_RESET 0x04 2366#define USB_INTR_RESET 0x04
2334 2367
2335#define USB_INTR_EP0 0x0001 2368#define USB_INTR_EP0 0x0001
2336#define USB_INTR_INEP1 0x0002 2369#define USB_INTR_INEP1 0x0002
2337#define USB_INTR_INEP2 0x0004 2370#define USB_INTR_INEP2 0x0004
2338#define USB_INTR_OUTEP1 0x0002 2371#define USB_INTR_OUTEP1 0x0002
2339 2372
2340/* CSR0 bit masks */ 2373/* CSR0 bit masks */
2341#define USB_CSR0_OUTPKTRDY 0x01 2374#define USB_CSR0_OUTPKTRDY 0x01
2342#define USB_CSR0_INPKTRDY 0x02 2375#define USB_CSR0_INPKTRDY 0x02
2343#define USB_CSR0_SENTSTALL 0x04 2376#define USB_CSR0_SENTSTALL 0x04
2344#define USB_CSR0_DATAEND 0x08 2377#define USB_CSR0_DATAEND 0x08
2345#define USB_CSR0_SETUPEND 0x10 2378#define USB_CSR0_SETUPEND 0x10
2346#define USB_CSR0_SENDSTALL 0x20 2379#define USB_CSR0_SENDSTALL 0x20
2347#define USB_CSR0_SVDOUTPKTRDY 0x40 2380#define USB_CSR0_SVDOUTPKTRDY 0x40
2348#define USB_CSR0_SVDSETUPEND 0x80 2381#define USB_CSR0_SVDSETUPEND 0x80
2349 2382
2350/* Endpoint CSR register bits */ 2383/* Endpoint CSR register bits */
2351#define USB_INCSRH_AUTOSET 0x80 2384#define USB_INCSRH_AUTOSET 0x80
2352#define USB_INCSRH_ISO 0x40 2385#define USB_INCSRH_ISO 0x40
2353#define USB_INCSRH_MODE 0x20 2386#define USB_INCSRH_MODE 0x20
2354#define USB_INCSRH_DMAREQENAB 0x10 2387#define USB_INCSRH_DMAREQENAB 0x10
2355#define USB_INCSRH_DMAREQMODE 0x04 2388#define USB_INCSRH_DMAREQMODE 0x04
2356#define USB_INCSR_CDT 0x40 2389#define USB_INCSR_CDT 0x40
2357#define USB_INCSR_SENTSTALL 0x20 2390#define USB_INCSR_SENTSTALL 0x20
2358#define USB_INCSR_SENDSTALL 0x10 2391#define USB_INCSR_SENDSTALL 0x10
2359#define USB_INCSR_FF 0x08 2392#define USB_INCSR_FF 0x08
2360#define USB_INCSR_UNDERRUN 0x04 2393#define USB_INCSR_UNDERRUN 0x04
2361#define USB_INCSR_FFNOTEMPT 0x02 2394#define USB_INCSR_FFNOTEMPT 0x02
2362#define USB_INCSR_INPKTRDY 0x01 2395#define USB_INCSR_INPKTRDY 0x01
2363#define USB_OUTCSRH_AUTOCLR 0x80 2396#define USB_OUTCSRH_AUTOCLR 0x80
2364#define USB_OUTCSRH_ISO 0x40 2397#define USB_OUTCSRH_ISO 0x40
2365#define USB_OUTCSRH_DMAREQENAB 0x20 2398#define USB_OUTCSRH_DMAREQENAB 0x20
2366#define USB_OUTCSRH_DNYT 0x10 2399#define USB_OUTCSRH_DNYT 0x10
2367#define USB_OUTCSRH_DMAREQMODE 0x08 2400#define USB_OUTCSRH_DMAREQMODE 0x08
2368#define USB_OUTCSR_CDT 0x80 2401#define USB_OUTCSR_CDT 0x80
2369#define USB_OUTCSR_SENTSTALL 0x40 2402#define USB_OUTCSR_SENTSTALL 0x40
2370#define USB_OUTCSR_SENDSTALL 0x20 2403#define USB_OUTCSR_SENDSTALL 0x20
2371#define USB_OUTCSR_FF 0x10 2404#define USB_OUTCSR_FF 0x10
2372#define USB_OUTCSR_DATAERR 0x08 2405#define USB_OUTCSR_DATAERR 0x08
2373#define USB_OUTCSR_OVERRUN 0x04 2406#define USB_OUTCSR_OVERRUN 0x04
2374#define USB_OUTCSR_FFFULL 0x02 2407#define USB_OUTCSR_FFFULL 0x02
2375#define USB_OUTCSR_OUTPKTRDY 0x01 2408#define USB_OUTCSR_OUTPKTRDY 0x01
2376 2409
2377/* Testmode register bits */ 2410/* Testmode register bits */
2378#define USB_TEST_SE0NAK 0x01 2411#define USB_TEST_SE0NAK 0x01
2379#define USB_TEST_J 0x02 2412#define USB_TEST_J 0x02
2380#define USB_TEST_K 0x04 2413#define USB_TEST_K 0x04
2381#define USB_TEST_PACKET 0x08 2414#define USB_TEST_PACKET 0x08
2382 2415
2383/* DMA control bits */ 2416/* DMA control bits */
2384#define USB_CNTL_ENA 0x01 2417#define USB_CNTL_ENA 0x01
2385#define USB_CNTL_DIR_IN 0x02 2418#define USB_CNTL_DIR_IN 0x02
2386#define USB_CNTL_MODE_1 0x04 2419#define USB_CNTL_MODE_1 0x04
2387#define USB_CNTL_INTR_EN 0x08 2420#define USB_CNTL_INTR_EN 0x08
2388#define USB_CNTL_EP(n) ((n) << 4) 2421#define USB_CNTL_EP(n) ((n) << 4)
2389#define USB_CNTL_BURST_0 (0 << 9) 2422#define USB_CNTL_BURST_0 (0 << 9)
2390#define USB_CNTL_BURST_4 (1 << 9) 2423#define USB_CNTL_BURST_4 (1 << 9)
2391#define USB_CNTL_BURST_8 (2 << 9) 2424#define USB_CNTL_BURST_8 (2 << 9)
2392#define USB_CNTL_BURST_16 (3 << 9) 2425#define USB_CNTL_BURST_16 (3 << 9)
2393 2426
2394 2427
2395//---------------------------------------------------------------------- 2428//----------------------------------------------------------------------
@@ -2408,152 +2441,152 @@
2408// 2441//
2409// PORT 0: 2442// PORT 0:
2410// 2443//
2411// PIN/BIT N FUNC0 FUNC1 2444// PIN/BIT N FUNC0 FUNC1
2412// 0 D0 - 2445// 0 D0 -
2413// 1 D1 - 2446// 1 D1 -
2414// 2 D2 - 2447// 2 D2 -
2415// 3 D3 - 2448// 3 D3 -
2416// 4 D4 - 2449// 4 D4 -
2417// 5 D5 - 2450// 5 D5 -
2418// 6 D6 - 2451// 6 D6 -
2419// 7 D7 - 2452// 7 D7 -
2420// 8 D8 - 2453// 8 D8 -
2421// 9 D9 - 2454// 9 D9 -
2422// 10 D10 - 2455// 10 D10 -
2423// 11 D11 - 2456// 11 D11 -
2424// 12 D12 - 2457// 12 D12 -
2425// 13 D13 - 2458// 13 D13 -
2426// 14 D14 - 2459// 14 D14 -
2427// 15 D15 - 2460// 15 D15 -
2428// 16 D16 - 2461// 16 D16 -
2429// 17 D17 - 2462// 17 D17 -
2430// 18 D18 - 2463// 18 D18 -
2431// 19 D19 - 2464// 19 D19 -
2432// 20 D20 - 2465// 20 D20 -
2433// 21 D21 - 2466// 21 D21 -
2434// 22 D22 - 2467// 22 D22 -
2435// 23 D23 - 2468// 23 D23 -
2436// 24 D24 - 2469// 24 D24 -
2437// 25 D25 - 2470// 25 D25 -
2438// 26 D26 - 2471// 26 D26 -
2439// 27 D27 - 2472// 27 D27 -
2440// 28 D28 - 2473// 28 D28 -
2441// 29 D29 - 2474// 29 D29 -
2442// 30 D30 - 2475// 30 D30 -
2443// 31 D31 - 2476// 31 D31 -
2444// 2477//
2445//------------------------------------------------------ 2478//------------------------------------------------------
2446// PORT 1: 2479// PORT 1:
2447// 2480//
2448// PIN/BIT N FUNC0 FUNC1 2481// PIN/BIT N FUNC0 FUNC1
2449// 0 A0 - 2482// 0 A0 -
2450// 1 A1 - 2483// 1 A1 -
2451// 2 A2 - 2484// 2 A2 -
2452// 3 A3 - 2485// 3 A3 -
2453// 4 A4 - 2486// 4 A4 -
2454// 5 A5 - 2487// 5 A5 -
2455// 6 A6 - 2488// 6 A6 -
2456// 7 A7 - 2489// 7 A7 -
2457// 8 A8 - 2490// 8 A8 -
2458// 9 A9 - 2491// 9 A9 -
2459// 10 A10 - 2492// 10 A10 -
2460// 11 A11 - 2493// 11 A11 -
2461// 12 A12 - 2494// 12 A12 -
2462// 13 A13 - 2495// 13 A13 -
2463// 14 A14 - 2496// 14 A14 -
2464// 15 A15/CL - 2497// 15 A15/CL -
2465// 16 A16/AL - 2498// 16 A16/AL -
2466// 17 LCD_CLS A21 2499// 17 LCD_CLS A21
2467// 18 LCD_SPL A22 2500// 18 LCD_SPL A22
2468// 19 DCS# - 2501// 19 DCS# -
2469// 20 RAS# - 2502// 20 RAS# -
2470// 21 CAS# - 2503// 21 CAS# -
2471// 22 RDWE#/BUFD# - 2504// 22 RDWE#/BUFD# -
2472// 23 CKE - 2505// 23 CKE -
2473// 24 CKO - 2506// 24 CKO -
2474// 25 CS1# - 2507// 25 CS1# -
2475// 26 CS2# - 2508// 26 CS2# -
2476// 27 CS3# - 2509// 27 CS3# -
2477// 28 CS4# - 2510// 28 CS4# -
2478// 29 RD# - 2511// 29 RD# -
2479// 30 WR# - 2512// 30 WR# -
2480// 31 WE0# - 2513// 31 WE0# -
2481// 2514//
2482// Note: PIN15&16 are CL&AL when connecting to NAND flash. 2515// Note: PIN15&16 are CL&AL when connecting to NAND flash.
2483//------------------------------------------------------ 2516//------------------------------------------------------
2484// PORT 2: 2517// PORT 2:
2485// 2518//
2486// PIN/BIT N FUNC0 FUNC1 2519// PIN/BIT N FUNC0 FUNC1
2487// 0 LCD_D0 - 2520// 0 LCD_D0 -
2488// 1 LCD_D1 - 2521// 1 LCD_D1 -
2489// 2 LCD_D2 - 2522// 2 LCD_D2 -
2490// 3 LCD_D3 - 2523// 3 LCD_D3 -
2491// 4 LCD_D4 - 2524// 4 LCD_D4 -
2492// 5 LCD_D5 - 2525// 5 LCD_D5 -
2493// 6 LCD_D6 - 2526// 6 LCD_D6 -
2494// 7 LCD_D7 - 2527// 7 LCD_D7 -
2495// 8 LCD_D8 - 2528// 8 LCD_D8 -
2496// 9 LCD_D9 - 2529// 9 LCD_D9 -
2497// 10 LCD_D10 - 2530// 10 LCD_D10 -
2498// 11 LCD_D11 - 2531// 11 LCD_D11 -
2499// 12 LCD_D12 - 2532// 12 LCD_D12 -
2500// 13 LCD_D13 - 2533// 13 LCD_D13 -
2501// 14 LCD_D14 - 2534// 14 LCD_D14 -
2502// 15 LCD_D15 - 2535// 15 LCD_D15 -
2503// 16 LCD_D16 - 2536// 16 LCD_D16 -
2504// 17 LCD_D17 - 2537// 17 LCD_D17 -
2505// 18 LCD_PCLK - 2538// 18 LCD_PCLK -
2506// 19 LCD_HSYNC - 2539// 19 LCD_HSYNC -
2507// 20 LCD_VSYNC - 2540// 20 LCD_VSYNC -
2508// 21 LCD_DE - 2541// 21 LCD_DE -
2509// 22 LCD_PS A19 2542// 22 LCD_PS A19
2510// 23 LCD_REV A20 2543// 23 LCD_REV A20
2511// 24 WE1# - 2544// 24 WE1# -
2512// 25 WE2# - 2545// 25 WE2# -
2513// 26 WE3# - 2546// 26 WE3# -
2514// 27 WAIT# - 2547// 27 WAIT# -
2515// 28 FRE# - 2548// 28 FRE# -
2516// 29 FWE# - 2549// 29 FWE# -
2517// 30(NOTE:FRB#) - - 2550// 30(NOTE:FRB#) - -
2518// 31 - - 2551// 31 - -
2519// 2552//
2520// NOTE(1): PIN30 is used for FRB# when connecting to NAND flash. 2553// NOTE(1): PIN30 is used for FRB# when connecting to NAND flash.
2521//------------------------------------------------------ 2554//------------------------------------------------------
2522// PORT 3: 2555// PORT 3:
2523// 2556//
2524// PIN/BIT N FUNC0 FUNC1 2557// PIN/BIT N FUNC0 FUNC1
2525// 0 CIM_D0 - 2558// 0 CIM_D0 -
2526// 1 CIM_D1 - 2559// 1 CIM_D1 -
2527// 2 CIM_D2 - 2560// 2 CIM_D2 -
2528// 3 CIM_D3 - 2561// 3 CIM_D3 -
2529// 4 CIM_D4 - 2562// 4 CIM_D4 -
2530// 5 CIM_D5 - 2563// 5 CIM_D5 -
2531// 6 CIM_D6 - 2564// 6 CIM_D6 -
2532// 7 CIM_D7 - 2565// 7 CIM_D7 -
2533// 8 MSC_CMD - 2566// 8 MSC_CMD -
2534// 9 MSC_CLK - 2567// 9 MSC_CLK -
2535// 10 MSC_D0 - 2568// 10 MSC_D0 -
2536// 11 MSC_D1 - 2569// 11 MSC_D1 -
2537// 12 MSC_D2 - 2570// 12 MSC_D2 -
2538// 13 MSC_D3 - 2571// 13 MSC_D3 -
2539// 14 CIM_MCLK - 2572// 14 CIM_MCLK -
2540// 15 CIM_PCLK - 2573// 15 CIM_PCLK -
2541// 16 CIM_VSYNC - 2574// 16 CIM_VSYNC -
2542// 17 CIM_HSYNC - 2575// 17 CIM_HSYNC -
2543// 18 SSI_CLK SCLK_RSTN 2576// 18 SSI_CLK SCLK_RSTN
2544// 19 SSI_CE0# BIT_CLK(AIC) 2577// 19 SSI_CE0# BIT_CLK(AIC)
2545// 20 SSI_DT SDATA_OUT(AIC) 2578// 20 SSI_DT SDATA_OUT(AIC)
2546// 21 SSI_DR SDATA_IN(AIC) 2579// 21 SSI_DR SDATA_IN(AIC)
2547// 22 SSI_CE1#&GPC SYNC(AIC) 2580// 22 SSI_CE1#&GPC SYNC(AIC)
2548// 23 PWM0 I2C_SDA 2581// 23 PWM0 I2C_SDA
2549// 24 PWM1 I2C_SCK 2582// 24 PWM1 I2C_SCK
2550// 25 PWM2 UART0_TxD 2583// 25 PWM2 UART0_TxD
2551// 26 PWM3 UART0_RxD 2584// 26 PWM3 UART0_RxD
2552// 27 PWM4 A17 2585// 27 PWM4 A17
2553// 28 PWM5 A18 2586// 28 PWM5 A18
2554// 29 - - 2587// 29 - -
2555// 30 PWM6 UART0_CTS/UART1_RxD 2588// 30 PWM6 UART0_CTS/UART1_RxD
2556// 31 PWM7 UART0_RTS/UART1_TxD 2589// 31 PWM7 UART0_RTS/UART1_TxD
2557// 2590//
2558////////////////////////////////////////////////////////// 2591//////////////////////////////////////////////////////////
2559 2592
@@ -2566,39 +2599,39 @@
2566//------------------------------------------- 2599//-------------------------------------------
2567// Function Pins Mode 2600// Function Pins Mode
2568 2601
2569#define __gpio_as_func0(n) \ 2602#define __gpio_as_func0(n) \
2570do { \ 2603do { \
2571 unsigned int p, o; \ 2604 unsigned int p, o; \
2572 p = (n) / 32; \ 2605 p = (n) / 32; \
2573 o = (n) % 32; \ 2606 o = (n) % 32; \
2574 REG_GPIO_PXFUNS(p) = (1 << o); \ 2607 REG_GPIO_PXFUNS(p) = (1 << o); \
2575 REG_GPIO_PXSELC(p) = (1 << o); \ 2608 REG_GPIO_PXSELC(p) = (1 << o); \
2576} while (0) 2609} while (0)
2577 2610
2578#define __gpio_as_func1(n) \ 2611#define __gpio_as_func1(n) \
2579do { \ 2612do { \
2580 unsigned int p, o; \ 2613 unsigned int p, o; \
2581 p = (n) / 32; \ 2614 p = (n) / 32; \
2582 o = (n) % 32; \ 2615 o = (n) % 32; \
2583 REG_GPIO_PXFUNS(p) = (1 << o); \ 2616 REG_GPIO_PXFUNS(p) = (1 << o); \
2584 REG_GPIO_PXSELS(p) = (1 << o); \ 2617 REG_GPIO_PXSELS(p) = (1 << o); \
2585} while (0) 2618} while (0)
2586 2619
2587/* 2620/*
2588 * D0 ~ D31, A0 ~ A16, DCS#, RAS#, CAS#, CKE#, 2621 * D0 ~ D31, A0 ~ A16, DCS#, RAS#, CAS#, CKE#,
2589 * RDWE#, CKO#, WE0#, WE1#, WE2#, WE3# 2622 * RDWE#, CKO#, WE0#, WE1#, WE2#, WE3#
2590 */ 2623 */
2591#define __gpio_as_sdram_32bit() \ 2624#define __gpio_as_sdram_32bit() \
2592do { \ 2625do { \
2593 REG_GPIO_PXFUNS(0) = 0xffffffff; \ 2626 REG_GPIO_PXFUNS(0) = 0xffffffff; \
2594 REG_GPIO_PXSELC(0) = 0xffffffff; \ 2627 REG_GPIO_PXSELC(0) = 0xffffffff; \
2595 REG_GPIO_PXPES(0) = 0xffffffff; \ 2628 REG_GPIO_PXPES(0) = 0xffffffff; \
2596 REG_GPIO_PXFUNS(1) = 0x81f9ffff; \ 2629 REG_GPIO_PXFUNS(1) = 0x81f9ffff; \
2597 REG_GPIO_PXSELC(1) = 0x81f9ffff; \ 2630 REG_GPIO_PXSELC(1) = 0x81f9ffff; \
2598 REG_GPIO_PXPES(1) = 0x81f9ffff; \ 2631 REG_GPIO_PXPES(1) = 0x81f9ffff; \
2599 REG_GPIO_PXFUNS(2) = 0x07000000; \ 2632 REG_GPIO_PXFUNS(2) = 0x07000000; \
2600 REG_GPIO_PXSELC(2) = 0x07000000; \ 2633 REG_GPIO_PXSELC(2) = 0x07000000; \
2601 REG_GPIO_PXPES(2) = 0x07000000; \ 2634 REG_GPIO_PXPES(2) = 0x07000000; \
2602} while (0) 2635} while (0)
2603 2636
2604//#ifdef JZ4740_PAVO 2637//#ifdef JZ4740_PAVO
@@ -2607,17 +2640,17 @@ do { \
2607 * D0 ~ D15, A0 ~ A16, DCS#, RAS#, CAS#, CKE#, 2640 * D0 ~ D15, A0 ~ A16, DCS#, RAS#, CAS#, CKE#,
2608 * RDWE#, CKO#, WE0#, WE1#, WE2#, WE3# 2641 * RDWE#, CKO#, WE0#, WE1#, WE2#, WE3#
2609 */ 2642 */
2610#define __gpio_as_sdram_16bit() \ 2643#define __gpio_as_sdram_16bit() \
2611do { \ 2644do { \
2612 REG_GPIO_PXFUNS(0) = 0x0000ffff; \ 2645 REG_GPIO_PXFUNS(0) = 0x0000ffff; \
2613 REG_GPIO_PXFUNS(0) = 0x0000ffff; \ 2646 REG_GPIO_PXFUNS(0) = 0x0000ffff; \
2614 REG_GPIO_PXPES(0) = 0x0000ffff; \ 2647 REG_GPIO_PXPES(0) = 0x0000ffff; \
2615 REG_GPIO_PXFUNS(1) = 0x81f9ffff; \ 2648 REG_GPIO_PXFUNS(1) = 0x81f9ffff; \
2616 REG_GPIO_PXSELC(1) = 0x81f9ffff; \ 2649 REG_GPIO_PXSELC(1) = 0x81f9ffff; \
2617 REG_GPIO_PXPES(1) = 0x81f9ffff; \ 2650 REG_GPIO_PXPES(1) = 0x81f9ffff; \
2618 REG_GPIO_PXFUNS(2) = 0x07000000; \ 2651 REG_GPIO_PXFUNS(2) = 0x07000000; \
2619 REG_GPIO_PXSELC(2) = 0x07000000; \ 2652 REG_GPIO_PXSELC(2) = 0x07000000; \
2620 REG_GPIO_PXPES(2) = 0x07000000; \ 2653 REG_GPIO_PXPES(2) = 0x07000000; \
2621} while (0) 2654} while (0)
2622 2655
2623#endif 2656#endif
@@ -2628,17 +2661,17 @@ do { \
2628 * D0 ~ D15, A0 ~ A16, DCS#, RAS#, CAS#, CKE#, 2661 * D0 ~ D15, A0 ~ A16, DCS#, RAS#, CAS#, CKE#,
2629 * RDWE#, CKO#, WE0#, WE1#, WE2#, WE3# 2662 * RDWE#, CKO#, WE0#, WE1#, WE2#, WE3#
2630 */ 2663 */
2631#define __gpio_as_sdram_16bit() \ 2664#define __gpio_as_sdram_16bit() \
2632do { \ 2665do { \
2633 REG_GPIO_PXFUNS(0) = 0x5442bfaa; \ 2666 REG_GPIO_PXFUNS(0) = 0x5442bfaa; \
2634 REG_GPIO_PXSELC(0) = 0x5442bfaa; \ 2667 REG_GPIO_PXSELC(0) = 0x5442bfaa; \
2635 REG_GPIO_PXPES(0) = 0x5442bfaa; \ 2668 REG_GPIO_PXPES(0) = 0x5442bfaa; \
2636 REG_GPIO_PXFUNS(1) = 0x81f9ffff; \ 2669 REG_GPIO_PXFUNS(1) = 0x81f9ffff; \
2637 REG_GPIO_PXSELC(1) = 0x81f9ffff; \ 2670 REG_GPIO_PXSELC(1) = 0x81f9ffff; \
2638 REG_GPIO_PXPES(1) = 0x81f9ffff; \ 2671 REG_GPIO_PXPES(1) = 0x81f9ffff; \
2639 REG_GPIO_PXFUNS(2) = 0x01000000; \ 2672 REG_GPIO_PXFUNS(2) = 0x01000000; \
2640 REG_GPIO_PXSELC(2) = 0x01000000; \ 2673 REG_GPIO_PXSELC(2) = 0x01000000; \
2641 REG_GPIO_PXPES(2) = 0x01000000; \ 2674 REG_GPIO_PXPES(2) = 0x01000000; \
2642} while (0) 2675} while (0)
2643#endif 2676#endif
2644 2677
@@ -2648,471 +2681,471 @@ do { \
2648 * D0 ~ D15, A0 ~ A16, DCS#, RAS#, CAS#, CKE#, 2681 * D0 ~ D15, A0 ~ A16, DCS#, RAS#, CAS#, CKE#,
2649 * RDWE#, CKO#, WE0#, WE1#, WE2#, WE3# 2682 * RDWE#, CKO#, WE0#, WE1#, WE2#, WE3#
2650 */ 2683 */
2651#define __jz4725__gpio_as_sdram_16bit() \ 2684#define __jz4725__gpio_as_sdram_16bit() \
2652do { \ 2685do { \
2653 REG_GPIO_PXFUNS(0) = 0x0000ffff; \ 2686 REG_GPIO_PXFUNS(0) = 0x0000ffff; \
2654 REG_GPIO_PXSELC(0) = 0x0000ffff; \ 2687 REG_GPIO_PXSELC(0) = 0x0000ffff; \
2655 REG_GPIO_PXPES(0) = 0x0000ffff; \ 2688 REG_GPIO_PXPES(0) = 0x0000ffff; \
2656 REG_GPIO_PXFUNS(1) = 0x81f9ffff; \ 2689 REG_GPIO_PXFUNS(1) = 0x81f9ffff; \
2657 REG_GPIO_PXSELC(1) = 0x81f9ffff; \ 2690 REG_GPIO_PXSELC(1) = 0x81f9ffff; \
2658 REG_GPIO_PXPES(1) = 0x81f9ffff; \ 2691 REG_GPIO_PXPES(1) = 0x81f9ffff; \
2659 REG_GPIO_PXFUNS(2) = 0x07000000; \ 2692 REG_GPIO_PXFUNS(2) = 0x07000000; \
2660 REG_GPIO_PXSELC(2) = 0x07000000; \ 2693 REG_GPIO_PXSELC(2) = 0x07000000; \
2661 REG_GPIO_PXPES(2) = 0x07000000; \ 2694 REG_GPIO_PXPES(2) = 0x07000000; \
2662} while (0) 2695} while (0)
2663#endif 2696#endif
2664/* 2697/*
2665 * CS1#, CLE, ALE, FRE#, FWE#, FRB#, RDWE#/BUFD# 2698 * CS1#, CLE, ALE, FRE#, FWE#, FRB#, RDWE#/BUFD#
2666 */ 2699 */
2667#define __gpio_as_nand() \ 2700#define __gpio_as_nand() \
2668do { \ 2701do { \
2669 REG_GPIO_PXFUNS(1) = 0x02018000; \ 2702 REG_GPIO_PXFUNS(1) = 0x02018000; \
2670 REG_GPIO_PXSELC(1) = 0x02018000; \ 2703 REG_GPIO_PXSELC(1) = 0x02018000; \
2671 REG_GPIO_PXPES(1) = 0x02018000; \ 2704 REG_GPIO_PXPES(1) = 0x02018000; \
2672 REG_GPIO_PXFUNS(2) = 0x30000000; \ 2705 REG_GPIO_PXFUNS(2) = 0x30000000; \
2673 REG_GPIO_PXSELC(2) = 0x30000000; \ 2706 REG_GPIO_PXSELC(2) = 0x30000000; \
2674 REG_GPIO_PXPES(2) = 0x30000000; \ 2707 REG_GPIO_PXPES(2) = 0x30000000; \
2675 REG_GPIO_PXFUNC(2) = 0x40000000; \ 2708 REG_GPIO_PXFUNC(2) = 0x40000000; \
2676 REG_GPIO_PXSELC(2) = 0x40000000; \ 2709 REG_GPIO_PXSELC(2) = 0x40000000; \
2677 REG_GPIO_PXDIRC(2) = 0x40000000; \ 2710 REG_GPIO_PXDIRC(2) = 0x40000000; \
2678 REG_GPIO_PXPES(2) = 0x40000000; \ 2711 REG_GPIO_PXPES(2) = 0x40000000; \
2679 REG_GPIO_PXFUNS(1) = 0x00400000; \ 2712 REG_GPIO_PXFUNS(1) = 0x00400000; \
2680 REG_GPIO_PXSELC(1) = 0x00400000; \ 2713 REG_GPIO_PXSELC(1) = 0x00400000; \
2681} while (0) 2714} while (0)
2682 2715
2683/* 2716/*
2684 * CS4#, RD#, WR#, WAIT#, A0 ~ A22, D0 ~ D7 2717 * CS4#, RD#, WR#, WAIT#, A0 ~ A22, D0 ~ D7
2685 */ 2718 */
2686#define __gpio_as_nor_8bit() \ 2719#define __gpio_as_nor_8bit() \
2687do { \ 2720do { \
2688 REG_GPIO_PXFUNS(0) = 0x000000ff; \ 2721 REG_GPIO_PXFUNS(0) = 0x000000ff; \
2689 REG_GPIO_PXSELC(0) = 0x000000ff; \ 2722 REG_GPIO_PXSELC(0) = 0x000000ff; \
2690 REG_GPIO_PXPES(0) = 0x000000ff; \ 2723 REG_GPIO_PXPES(0) = 0x000000ff; \
2691 REG_GPIO_PXFUNS(1) = 0x7041ffff; \ 2724 REG_GPIO_PXFUNS(1) = 0x7041ffff; \
2692 REG_GPIO_PXSELC(1) = 0x7041ffff; \ 2725 REG_GPIO_PXSELC(1) = 0x7041ffff; \
2693 REG_GPIO_PXPES(1) = 0x7041ffff; \ 2726 REG_GPIO_PXPES(1) = 0x7041ffff; \
2694 REG_GPIO_PXFUNS(1) = 0x00060000; \ 2727 REG_GPIO_PXFUNS(1) = 0x00060000; \
2695 REG_GPIO_PXSELS(1) = 0x00060000; \ 2728 REG_GPIO_PXSELS(1) = 0x00060000; \
2696 REG_GPIO_PXPES(1) = 0x00060000; \ 2729 REG_GPIO_PXPES(1) = 0x00060000; \
2697 REG_GPIO_PXFUNS(2) = 0x08000000; \ 2730 REG_GPIO_PXFUNS(2) = 0x08000000; \
2698 REG_GPIO_PXSELC(2) = 0x08000000; \ 2731 REG_GPIO_PXSELC(2) = 0x08000000; \
2699 REG_GPIO_PXPES(2) = 0x08000000; \ 2732 REG_GPIO_PXPES(2) = 0x08000000; \
2700 REG_GPIO_PXFUNS(2) = 0x00c00000; \ 2733 REG_GPIO_PXFUNS(2) = 0x00c00000; \
2701 REG_GPIO_PXSELS(2) = 0x00c00000; \ 2734 REG_GPIO_PXSELS(2) = 0x00c00000; \
2702 REG_GPIO_PXPES(2) = 0x00c00000; \ 2735 REG_GPIO_PXPES(2) = 0x00c00000; \
2703 REG_GPIO_PXFUNS(3) = 0x18000000; \ 2736 REG_GPIO_PXFUNS(3) = 0x18000000; \
2704 REG_GPIO_PXSELS(3) = 0x18000000; \ 2737 REG_GPIO_PXSELS(3) = 0x18000000; \
2705 REG_GPIO_PXPES(3) = 0x18000000; \ 2738 REG_GPIO_PXPES(3) = 0x18000000; \
2706} while (0) 2739} while (0)
2707 2740
2708/* 2741/*
2709 * CS4#, RD#, WR#, WAIT#, A0 ~ A22, D0 ~ D15 2742 * CS4#, RD#, WR#, WAIT#, A0 ~ A22, D0 ~ D15
2710 */ 2743 */
2711#define __gpio_as_nor_16bit() \ 2744#define __gpio_as_nor_16bit() \
2712do { \ 2745do { \
2713 REG_GPIO_PXFUNS(0) = 0x0000ffff; \ 2746 REG_GPIO_PXFUNS(0) = 0x0000ffff; \
2714 REG_GPIO_PXSELC(0) = 0x0000ffff; \ 2747 REG_GPIO_PXSELC(0) = 0x0000ffff; \
2715 REG_GPIO_PXPES(0) = 0x0000ffff; \ 2748 REG_GPIO_PXPES(0) = 0x0000ffff; \
2716 REG_GPIO_PXFUNS(1) = 0x7041ffff; \ 2749 REG_GPIO_PXFUNS(1) = 0x7041ffff; \
2717 REG_GPIO_PXSELC(1) = 0x7041ffff; \ 2750 REG_GPIO_PXSELC(1) = 0x7041ffff; \
2718 REG_GPIO_PXPES(1) = 0x7041ffff; \ 2751 REG_GPIO_PXPES(1) = 0x7041ffff; \
2719 REG_GPIO_PXFUNS(1) = 0x00060000; \ 2752 REG_GPIO_PXFUNS(1) = 0x00060000; \
2720 REG_GPIO_PXSELS(1) = 0x00060000; \ 2753 REG_GPIO_PXSELS(1) = 0x00060000; \
2721 REG_GPIO_PXPES(1) = 0x00060000; \ 2754 REG_GPIO_PXPES(1) = 0x00060000; \
2722 REG_GPIO_PXFUNS(2) = 0x08000000; \ 2755 REG_GPIO_PXFUNS(2) = 0x08000000; \
2723 REG_GPIO_PXSELC(2) = 0x08000000; \ 2756 REG_GPIO_PXSELC(2) = 0x08000000; \
2724 REG_GPIO_PXPES(2) = 0x08000000; \ 2757 REG_GPIO_PXPES(2) = 0x08000000; \
2725 REG_GPIO_PXFUNS(2) = 0x00c00000; \ 2758 REG_GPIO_PXFUNS(2) = 0x00c00000; \
2726 REG_GPIO_PXSELS(2) = 0x00c00000; \ 2759 REG_GPIO_PXSELS(2) = 0x00c00000; \
2727 REG_GPIO_PXPES(2) = 0x00c00000; \ 2760 REG_GPIO_PXPES(2) = 0x00c00000; \
2728 REG_GPIO_PXFUNS(3) = 0x18000000; \ 2761 REG_GPIO_PXFUNS(3) = 0x18000000; \
2729 REG_GPIO_PXSELS(3) = 0x18000000; \ 2762 REG_GPIO_PXSELS(3) = 0x18000000; \
2730 REG_GPIO_PXPES(3) = 0x18000000; \ 2763 REG_GPIO_PXPES(3) = 0x18000000; \
2731} while (0) 2764} while (0)
2732 2765
2733/* 2766/*
2734 * UART0_TxD, UART_RxD0 2767 * UART0_TxD, UART_RxD0
2735 */ 2768 */
2736#define __gpio_as_uart0() \ 2769#define __gpio_as_uart0() \
2737do { \ 2770do { \
2738 REG_GPIO_PXFUNS(3) = 0x06000000; \ 2771 REG_GPIO_PXFUNS(3) = 0x06000000; \
2739 REG_GPIO_PXSELS(3) = 0x06000000; \ 2772 REG_GPIO_PXSELS(3) = 0x06000000; \
2740 REG_GPIO_PXPES(3) = 0x06000000; \ 2773 REG_GPIO_PXPES(3) = 0x06000000; \
2741} while (0) 2774} while (0)
2742 2775
2743/* 2776/*
2744 * UART1_TxD, UART1_RxD1 2777 * UART1_TxD, UART1_RxD1
2745 */ 2778 */
2746#define __gpio_as_uart1() \ 2779#define __gpio_as_uart1() \
2747do { \ 2780do { \
2748 REG_GPIO_PXFUNS(3) = 0xc0000000; \ 2781 REG_GPIO_PXFUNS(3) = 0xc0000000; \
2749 REG_GPIO_PXSELS(3) = 0xc0000000; \ 2782 REG_GPIO_PXSELS(3) = 0xc0000000; \
2750 REG_GPIO_PXPES(3) = 0xc0000000; \ 2783 REG_GPIO_PXPES(3) = 0xc0000000; \
2751} while (0) 2784} while (0)
2752 2785
2753/* 2786/*
2754 * LCD_D0~LCD_D15, LCD_PCLK, LCD_HSYNC, LCD_VSYNC, LCD_DE 2787 * LCD_D0~LCD_D15, LCD_PCLK, LCD_HSYNC, LCD_VSYNC, LCD_DE
2755 */ 2788 */
2756#define __gpio_as_lcd_16bit() \ 2789#define __gpio_as_lcd_16bit() \
2757do { \ 2790do { \
2758 REG_GPIO_PXFUNS(2) = 0x003cffff; \ 2791 REG_GPIO_PXFUNS(2) = 0x003cffff; \
2759 REG_GPIO_PXSELC(2) = 0x003cffff; \ 2792 REG_GPIO_PXSELC(2) = 0x003cffff; \
2760 REG_GPIO_PXPES(2) = 0x003cffff; \ 2793 REG_GPIO_PXPES(2) = 0x003cffff; \
2761} while (0) 2794} while (0)
2762 2795
2763/* 2796/*
2764 * LCD_D0~LCD_D17, LCD_PCLK, LCD_HSYNC, LCD_VSYNC, LCD_DE 2797 * LCD_D0~LCD_D17, LCD_PCLK, LCD_HSYNC, LCD_VSYNC, LCD_DE
2765 */ 2798 */
2766#define __gpio_as_lcd_18bit() \ 2799#define __gpio_as_lcd_18bit() \
2767do { \ 2800do { \
2768 REG_GPIO_PXFUNS(2) = 0x003fffff; \ 2801 REG_GPIO_PXFUNS(2) = 0x003fffff; \
2769 REG_GPIO_PXSELC(2) = 0x003fffff; \ 2802 REG_GPIO_PXSELC(2) = 0x003fffff; \
2770 REG_GPIO_PXPES(2) = 0x003fffff; \ 2803 REG_GPIO_PXPES(2) = 0x003fffff; \
2771} while (0) 2804} while (0)
2772 2805
2773 2806
2774/* LCD_D0~LCD_D7, SLCD_RS, SLCD_CS */ 2807/* LCD_D0~LCD_D7, SLCD_RS, SLCD_CS */
2775#define __gpio_as_slcd_8bit() \ 2808#define __gpio_as_slcd_8bit() \
2776do { \ 2809do { \
2777 REG_GPIO_PXFUNS(2) = 0x001800ff; \ 2810 REG_GPIO_PXFUNS(2) = 0x001800ff; \
2778 REG_GPIO_PXSELC(2) = 0x001800ff; \ 2811 REG_GPIO_PXSELC(2) = 0x001800ff; \
2779} while (0) 2812} while (0)
2780 2813
2781/* LCD_D0~LCD_D7, SLCD_RS, SLCD_CS */ 2814/* LCD_D0~LCD_D7, SLCD_RS, SLCD_CS */
2782#define __gpio_as_slcd_9bit() \ 2815#define __gpio_as_slcd_9bit() \
2783do { \ 2816do { \
2784 REG_GPIO_PXFUNS(2) = 0x001801ff; \ 2817 REG_GPIO_PXFUNS(2) = 0x001801ff; \
2785 REG_GPIO_PXSELC(2) = 0x001801ff; \ 2818 REG_GPIO_PXSELC(2) = 0x001801ff; \
2786} while (0) 2819} while (0)
2787 2820
2788/* LCD_D0~LCD_D15, SLCD_RS, SLCD_CS */ 2821/* LCD_D0~LCD_D15, SLCD_RS, SLCD_CS */
2789#define __gpio_as_slcd_16bit() \ 2822#define __gpio_as_slcd_16bit() \
2790do { \ 2823do { \
2791 REG_GPIO_PXFUNS(2) = 0x0018ffff; \ 2824 REG_GPIO_PXFUNS(2) = 0x0018ffff; \
2792 REG_GPIO_PXSELC(2) = 0x0018ffff; \ 2825 REG_GPIO_PXSELC(2) = 0x0018ffff; \
2793} while (0) 2826} while (0)
2794 2827
2795/* LCD_D0~LCD_D17, SLCD_RS, SLCD_CS */ 2828/* LCD_D0~LCD_D17, SLCD_RS, SLCD_CS */
2796#define __gpio_as_slcd_18bit() \ 2829#define __gpio_as_slcd_18bit() \
2797do { \ 2830do { \
2798 REG_GPIO_PXFUNS(2) = 0x001bffff; \ 2831 REG_GPIO_PXFUNS(2) = 0x001bffff; \
2799 REG_GPIO_PXSELC(2) = 0x001bffff; \ 2832 REG_GPIO_PXSELC(2) = 0x001bffff; \
2800} while (0) 2833} while (0)
2801 2834
2802/* 2835/*
2803 * CIM_D0~CIM_D7, CIM_MCLK, CIM_PCLK, CIM_VSYNC, CIM_HSYNC 2836 * CIM_D0~CIM_D7, CIM_MCLK, CIM_PCLK, CIM_VSYNC, CIM_HSYNC
2804 */ 2837 */
2805#define __gpio_as_cim() \ 2838#define __gpio_as_cim() \
2806do { \ 2839do { \
2807 REG_GPIO_PXFUNS(3) = 0x0003c0ff; \ 2840 REG_GPIO_PXFUNS(3) = 0x0003c0ff; \
2808 REG_GPIO_PXSELC(3) = 0x0003c0ff; \ 2841 REG_GPIO_PXSELC(3) = 0x0003c0ff; \
2809 REG_GPIO_PXPES(3) = 0x0003c0ff; \ 2842 REG_GPIO_PXPES(3) = 0x0003c0ff; \
2810} while (0) 2843} while (0)
2811 2844
2812/* 2845/*
2813 * SDATA_OUT, SDATA_IN, BIT_CLK, SYNC, SCLK_RESET 2846 * SDATA_OUT, SDATA_IN, BIT_CLK, SYNC, SCLK_RESET
2814 */ 2847 */
2815#define __gpio_as_aic() \ 2848#define __gpio_as_aic() \
2816do { \ 2849do { \
2817 REG_GPIO_PXFUNS(3) = 0x007c0000; \ 2850 REG_GPIO_PXFUNS(3) = 0x007c0000; \
2818 REG_GPIO_PXSELS(3) = 0x007c0000; \ 2851 REG_GPIO_PXSELS(3) = 0x007c0000; \
2819 REG_GPIO_PXPES(3) = 0x007c0000; \ 2852 REG_GPIO_PXPES(3) = 0x007c0000; \
2820} while (0) 2853} while (0)
2821 2854
2822/* 2855/*
2823 * MSC_CMD, MSC_CLK, MSC_D0 ~ MSC_D3 2856 * MSC_CMD, MSC_CLK, MSC_D0 ~ MSC_D3
2824 */ 2857 */
2825#define __gpio_as_msc() \ 2858#define __gpio_as_msc() \
2826do { \ 2859do { \
2827 REG_GPIO_PXFUNS(3) = 0x00003f00; \ 2860 REG_GPIO_PXFUNS(3) = 0x00003f00; \
2828 REG_GPIO_PXSELC(3) = 0x00003f00; \ 2861 REG_GPIO_PXSELC(3) = 0x00003f00; \
2829 REG_GPIO_PXPES(3) = 0x00003f00; \ 2862 REG_GPIO_PXPES(3) = 0x00003f00; \
2830} while (0) 2863} while (0)
2831 2864
2832/* 2865/*
2833 * SSI_CS0, SSI_CLK, SSI_DT, SSI_DR 2866 * SSI_CS0, SSI_CLK, SSI_DT, SSI_DR
2834 */ 2867 */
2835#define __gpio_as_ssi() \ 2868#define __gpio_as_ssi() \
2836do { \ 2869do { \
2837 REG_GPIO_PXFUNS(3) = 0x003c0000; \ 2870 REG_GPIO_PXFUNS(3) = 0x003c0000; \
2838 REG_GPIO_PXSELC(3) = 0x003c0000; \ 2871 REG_GPIO_PXSELC(3) = 0x003c0000; \
2839 REG_GPIO_PXPES(3) = 0x003c0000; \ 2872 REG_GPIO_PXPES(3) = 0x003c0000; \
2840} while (0) 2873} while (0)
2841 2874
2842/* 2875/*
2843 * I2C_SCK, I2C_SDA 2876 * I2C_SCK, I2C_SDA
2844 */ 2877 */
2845#define __gpio_as_i2c() \ 2878#define __gpio_as_i2c() \
2846do { \ 2879do { \
2847 REG_GPIO_PXFUNS(3) = 0x01800000; \ 2880 REG_GPIO_PXFUNS(3) = 0x01800000; \
2848 REG_GPIO_PXSELS(3) = 0x01800000; \ 2881 REG_GPIO_PXSELS(3) = 0x01800000; \
2849 REG_GPIO_PXPES(3) = 0x01800000; \ 2882 REG_GPIO_PXPES(3) = 0x01800000; \
2850} while (0) 2883} while (0)
2851 2884
2852/* 2885/*
2853 * PWM0 2886 * PWM0
2854 */ 2887 */
2855#define __gpio_as_pwm0() \ 2888#define __gpio_as_pwm0() \
2856do { \ 2889do { \
2857 REG_GPIO_PXFUNS(3) = 0x00800000; \ 2890 REG_GPIO_PXFUNS(3) = 0x00800000; \
2858 REG_GPIO_PXSELC(3) = 0x00800000; \ 2891 REG_GPIO_PXSELC(3) = 0x00800000; \
2859 REG_GPIO_PXPES(3) = 0x00800000; \ 2892 REG_GPIO_PXPES(3) = 0x00800000; \
2860} while (0) 2893} while (0)
2861 2894
2862/* 2895/*
2863 * PWM1 2896 * PWM1
2864 */ 2897 */
2865#define __gpio_as_pwm1() \ 2898#define __gpio_as_pwm1() \
2866do { \ 2899do { \
2867 REG_GPIO_PXFUNS(3) = 0x01000000; \ 2900 REG_GPIO_PXFUNS(3) = 0x01000000; \
2868 REG_GPIO_PXSELC(3) = 0x01000000; \ 2901 REG_GPIO_PXSELC(3) = 0x01000000; \
2869 REG_GPIO_PXPES(3) = 0x01000000; \ 2902 REG_GPIO_PXPES(3) = 0x01000000; \
2870} while (0) 2903} while (0)
2871 2904
2872/* 2905/*
2873 * PWM2 2906 * PWM2
2874 */ 2907 */
2875#define __gpio_as_pwm2() \ 2908#define __gpio_as_pwm2() \
2876do { \ 2909do { \
2877 REG_GPIO_PXFUNS(3) = 0x02000000; \ 2910 REG_GPIO_PXFUNS(3) = 0x02000000; \
2878 REG_GPIO_PXSELC(3) = 0x02000000; \ 2911 REG_GPIO_PXSELC(3) = 0x02000000; \
2879 REG_GPIO_PXPES(3) = 0x02000000; \ 2912 REG_GPIO_PXPES(3) = 0x02000000; \
2880} while (0) 2913} while (0)
2881 2914
2882/* 2915/*
2883 * PWM3 2916 * PWM3
2884 */ 2917 */
2885#define __gpio_as_pwm3() \ 2918#define __gpio_as_pwm3() \
2886do { \ 2919do { \
2887 REG_GPIO_PXFUNS(3) = 0x04000000; \ 2920 REG_GPIO_PXFUNS(3) = 0x04000000; \
2888 REG_GPIO_PXSELC(3) = 0x04000000; \ 2921 REG_GPIO_PXSELC(3) = 0x04000000; \
2889 REG_GPIO_PXPES(3) = 0x04000000; \ 2922 REG_GPIO_PXPES(3) = 0x04000000; \
2890} while (0) 2923} while (0)
2891 2924
2892/* 2925/*
2893 * PWM4 2926 * PWM4
2894 */ 2927 */
2895#define __gpio_as_pwm4() \ 2928#define __gpio_as_pwm4() \
2896do { \ 2929do { \
2897 REG_GPIO_PXFUNS(3) = 0x08000000; \ 2930 REG_GPIO_PXFUNS(3) = 0x08000000; \
2898 REG_GPIO_PXSELC(3) = 0x08000000; \ 2931 REG_GPIO_PXSELC(3) = 0x08000000; \
2899 REG_GPIO_PXPES(3) = 0x08000000; \ 2932 REG_GPIO_PXPES(3) = 0x08000000; \
2900} while (0) 2933} while (0)
2901 2934
2902/* 2935/*
2903 * PWM5 2936 * PWM5
2904 */ 2937 */
2905#define __gpio_as_pwm5() \ 2938#define __gpio_as_pwm5() \
2906do { \ 2939do { \
2907 REG_GPIO_PXFUNS(3) = 0x10000000; \ 2940 REG_GPIO_PXFUNS(3) = 0x10000000; \
2908 REG_GPIO_PXSELC(3) = 0x10000000; \ 2941 REG_GPIO_PXSELC(3) = 0x10000000; \
2909 REG_GPIO_PXPES(3) = 0x10000000; \ 2942 REG_GPIO_PXPES(3) = 0x10000000; \
2910} while (0) 2943} while (0)
2911 2944
2912/* 2945/*
2913 * PWM6 2946 * PWM6
2914 */ 2947 */
2915#define __gpio_as_pwm6() \ 2948#define __gpio_as_pwm6() \
2916do { \ 2949do { \
2917 REG_GPIO_PXFUNS(3) = 0x40000000; \ 2950 REG_GPIO_PXFUNS(3) = 0x40000000; \
2918 REG_GPIO_PXSELC(3) = 0x40000000; \ 2951 REG_GPIO_PXSELC(3) = 0x40000000; \
2919 REG_GPIO_PXPES(3) = 0x40000000; \ 2952 REG_GPIO_PXPES(3) = 0x40000000; \
2920} while (0) 2953} while (0)
2921 2954
2922/* 2955/*
2923 * PWM7 2956 * PWM7
2924 */ 2957 */
2925#define __gpio_as_pwm7() \ 2958#define __gpio_as_pwm7() \
2926do { \ 2959do { \
2927 REG_GPIO_PXFUNS(3) = 0x80000000; \ 2960 REG_GPIO_PXFUNS(3) = 0x80000000; \
2928 REG_GPIO_PXSELC(3) = 0x80000000; \ 2961 REG_GPIO_PXSELC(3) = 0x80000000; \
2929 REG_GPIO_PXPES(3) = 0x80000000; \ 2962 REG_GPIO_PXPES(3) = 0x80000000; \
2930} while (0) 2963} while (0)
2931 2964
2932/* 2965/*
2933 * n = 0 ~ 7 2966 * n = 0 ~ 7
2934 */ 2967 */
2935#define __gpio_as_pwm(n) __gpio_as_pwm##n() 2968#define __gpio_as_pwm(n) __gpio_as_pwm##n()
2936 2969
2937//------------------------------------------- 2970//-------------------------------------------
2938// GPIO or Interrupt Mode 2971// GPIO or Interrupt Mode
2939 2972
2940#define __gpio_get_port(p) (REG_GPIO_PXPIN(p)) 2973#define __gpio_get_port(p) (REG_GPIO_PXPIN(p))
2941 2974
2942#define __gpio_port_as_output(p, o) \ 2975#define __gpio_port_as_output(p, o) \
2943do { \ 2976do { \
2944 REG_GPIO_PXFUNC(p) = (1 << (o)); \ 2977 REG_GPIO_PXFUNC(p) = (1 << (o)); \
2945 REG_GPIO_PXSELC(p) = (1 << (o)); \ 2978 REG_GPIO_PXSELC(p) = (1 << (o)); \
2946 REG_GPIO_PXDIRS(p) = (1 << (o)); \ 2979 REG_GPIO_PXDIRS(p) = (1 << (o)); \
2947} while (0) 2980} while (0)
2948 2981
2949#define __gpio_port_as_input(p, o) \ 2982#define __gpio_port_as_input(p, o) \
2950do { \ 2983do { \
2951 REG_GPIO_PXFUNC(p) = (1 << (o)); \ 2984 REG_GPIO_PXFUNC(p) = (1 << (o)); \
2952 REG_GPIO_PXSELC(p) = (1 << (o)); \ 2985 REG_GPIO_PXSELC(p) = (1 << (o)); \
2953 REG_GPIO_PXDIRC(p) = (1 << (o)); \ 2986 REG_GPIO_PXDIRC(p) = (1 << (o)); \
2954} while (0) 2987} while (0)
2955 2988
2956#define __gpio_as_output(n) \ 2989#define __gpio_as_output(n) \
2957do { \ 2990do { \
2958 unsigned int p, o; \ 2991 unsigned int p, o; \
2959 p = (n) / 32; \ 2992 p = (n) / 32; \
2960 o = (n) % 32; \ 2993 o = (n) % 32; \
2961 __gpio_port_as_output(p, o); \ 2994 __gpio_port_as_output(p, o); \
2962} while (0) 2995} while (0)
2963 2996
2964#define __gpio_as_input(n) \ 2997#define __gpio_as_input(n) \
2965do { \ 2998do { \
2966 unsigned int p, o; \ 2999 unsigned int p, o; \
2967 p = (n) / 32; \ 3000 p = (n) / 32; \
2968 o = (n) % 32; \ 3001 o = (n) % 32; \
2969 __gpio_port_as_input(p, o); \ 3002 __gpio_port_as_input(p, o); \
2970} while (0) 3003} while (0)
2971 3004
2972#define __gpio_set_pin(n) \ 3005#define __gpio_set_pin(n) \
2973do { \ 3006do { \
2974 unsigned int p, o; \ 3007 unsigned int p, o; \
2975 p = (n) / 32; \ 3008 p = (n) / 32; \
2976 o = (n) % 32; \ 3009 o = (n) % 32; \
2977 REG_GPIO_PXDATS(p) = (1 << o); \ 3010 REG_GPIO_PXDATS(p) = (1 << o); \
2978} while (0) 3011} while (0)
2979 3012
2980#define __gpio_clear_pin(n) \ 3013#define __gpio_clear_pin(n) \
2981do { \ 3014do { \
2982 unsigned int p, o; \ 3015 unsigned int p, o; \
2983 p = (n) / 32; \ 3016 p = (n) / 32; \
2984 o = (n) % 32; \ 3017 o = (n) % 32; \
2985 REG_GPIO_PXDATC(p) = (1 << o); \ 3018 REG_GPIO_PXDATC(p) = (1 << o); \
2986} while (0) 3019} while (0)
2987 3020
2988#define __gpio_get_pin(n) \ 3021#define __gpio_get_pin(n) \
2989({ \ 3022({ \
2990 unsigned int p, o, v; \ 3023 unsigned int p, o, v; \
2991 p = (n) / 32; \ 3024 p = (n) / 32; \
2992 o = (n) % 32; \ 3025 o = (n) % 32; \
2993 if (__gpio_get_port(p) & (1 << o)) \ 3026 if (__gpio_get_port(p) & (1 << o)) \
2994 v = 1; \ 3027 v = 1; \
2995 else \ 3028 else \
2996 v = 0; \ 3029 v = 0; \
2997 v; \ 3030 v; \
2998}) 3031})
2999 3032
3000#define __gpio_as_irq_high_level(n) \ 3033#define __gpio_as_irq_high_level(n) \
3001do { \ 3034do { \
3002 unsigned int p, o; \ 3035 unsigned int p, o; \
3003 p = (n) / 32; \ 3036 p = (n) / 32; \
3004 o = (n) % 32; \ 3037 o = (n) % 32; \
3005 REG_GPIO_PXIMS(p) = (1 << o); \ 3038 REG_GPIO_PXIMS(p) = (1 << o); \
3006 REG_GPIO_PXTRGC(p) = (1 << o); \ 3039 REG_GPIO_PXTRGC(p) = (1 << o); \
3007 REG_GPIO_PXFUNC(p) = (1 << o); \ 3040 REG_GPIO_PXFUNC(p) = (1 << o); \
3008 REG_GPIO_PXSELS(p) = (1 << o); \ 3041 REG_GPIO_PXSELS(p) = (1 << o); \
3009 REG_GPIO_PXDIRS(p) = (1 << o); \ 3042 REG_GPIO_PXDIRS(p) = (1 << o); \
3010 REG_GPIO_PXFLGC(p) = (1 << o); \ 3043 REG_GPIO_PXFLGC(p) = (1 << o); \
3011 REG_GPIO_PXIMC(p) = (1 << o); \ 3044 REG_GPIO_PXIMC(p) = (1 << o); \
3012} while (0) 3045} while (0)
3013 3046
3014#define __gpio_as_irq_low_level(n) \ 3047#define __gpio_as_irq_low_level(n) \
3015do { \ 3048do { \
3016 unsigned int p, o; \ 3049 unsigned int p, o; \
3017 p = (n) / 32; \ 3050 p = (n) / 32; \
3018 o = (n) % 32; \ 3051 o = (n) % 32; \
3019 REG_GPIO_PXIMS(p) = (1 << o); \ 3052 REG_GPIO_PXIMS(p) = (1 << o); \
3020 REG_GPIO_PXTRGC(p) = (1 << o); \ 3053 REG_GPIO_PXTRGC(p) = (1 << o); \
3021 REG_GPIO_PXFUNC(p) = (1 << o); \ 3054 REG_GPIO_PXFUNC(p) = (1 << o); \
3022 REG_GPIO_PXSELS(p) = (1 << o); \ 3055 REG_GPIO_PXSELS(p) = (1 << o); \
3023 REG_GPIO_PXDIRC(p) = (1 << o); \ 3056 REG_GPIO_PXDIRC(p) = (1 << o); \
3024 REG_GPIO_PXFLGC(p) = (1 << o); \ 3057 REG_GPIO_PXFLGC(p) = (1 << o); \
3025 REG_GPIO_PXIMC(p) = (1 << o); \ 3058 REG_GPIO_PXIMC(p) = (1 << o); \
3026} while (0) 3059} while (0)
3027 3060
3028#define __gpio_as_irq_rise_edge(n) \ 3061#define __gpio_as_irq_rise_edge(n) \
3029do { \ 3062do { \
3030 unsigned int p, o; \ 3063 unsigned int p, o; \
3031 p = (n) / 32; \ 3064 p = (n) / 32; \
3032 o = (n) % 32; \ 3065 o = (n) % 32; \
3033 REG_GPIO_PXIMS(p) = (1 << o); \ 3066 REG_GPIO_PXIMS(p) = (1 << o); \
3034 REG_GPIO_PXTRGS(p) = (1 << o); \ 3067 REG_GPIO_PXTRGS(p) = (1 << o); \
3035 REG_GPIO_PXFUNC(p) = (1 << o); \ 3068 REG_GPIO_PXFUNC(p) = (1 << o); \
3036 REG_GPIO_PXSELS(p) = (1 << o); \ 3069 REG_GPIO_PXSELS(p) = (1 << o); \
3037 REG_GPIO_PXDIRS(p) = (1 << o); \ 3070 REG_GPIO_PXDIRS(p) = (1 << o); \
3038 REG_GPIO_PXFLGC(p) = (1 << o); \ 3071 REG_GPIO_PXFLGC(p) = (1 << o); \
3039 REG_GPIO_PXIMC(p) = (1 << o); \ 3072 REG_GPIO_PXIMC(p) = (1 << o); \
3040} while (0) 3073} while (0)
3041 3074
3042#define __gpio_as_irq_fall_edge(n) \ 3075#define __gpio_as_irq_fall_edge(n) \
3043do { \ 3076do { \
3044 unsigned int p, o; \ 3077 unsigned int p, o; \
3045 p = (n) / 32; \ 3078 p = (n) / 32; \
3046 o = (n) % 32; \ 3079 o = (n) % 32; \
3047 REG_GPIO_PXIMS(p) = (1 << o); \ 3080 REG_GPIO_PXIMS(p) = (1 << o); \
3048 REG_GPIO_PXTRGS(p) = (1 << o); \ 3081 REG_GPIO_PXTRGS(p) = (1 << o); \
3049 REG_GPIO_PXFUNC(p) = (1 << o); \ 3082 REG_GPIO_PXFUNC(p) = (1 << o); \
3050 REG_GPIO_PXSELS(p) = (1 << o); \ 3083 REG_GPIO_PXSELS(p) = (1 << o); \
3051 REG_GPIO_PXDIRC(p) = (1 << o); \ 3084 REG_GPIO_PXDIRC(p) = (1 << o); \
3052 REG_GPIO_PXFLGC(p) = (1 << o); \ 3085 REG_GPIO_PXFLGC(p) = (1 << o); \
3053 REG_GPIO_PXIMC(p) = (1 << o); \ 3086 REG_GPIO_PXIMC(p) = (1 << o); \
3054} while (0) 3087} while (0)
3055 3088
3056#define __gpio_mask_irq(n) \ 3089#define __gpio_mask_irq(n) \
3057do { \ 3090do { \
3058 unsigned int p, o; \ 3091 unsigned int p, o; \
3059 p = (n) / 32; \ 3092 p = (n) / 32; \
3060 o = (n) % 32; \ 3093 o = (n) % 32; \
3061 REG_GPIO_PXIMS(p) = (1 << o); \ 3094 REG_GPIO_PXIMS(p) = (1 << o); \
3062} while (0) 3095} while (0)
3063 3096
3064#define __gpio_unmask_irq(n) \ 3097#define __gpio_unmask_irq(n) \
3065do { \ 3098do { \
3066 unsigned int p, o; \ 3099 unsigned int p, o; \
3067 p = (n) / 32; \ 3100 p = (n) / 32; \
3068 o = (n) % 32; \ 3101 o = (n) % 32; \
3069 REG_GPIO_PXIMC(p) = (1 << o); \ 3102 REG_GPIO_PXIMC(p) = (1 << o); \
3070} while (0) 3103} while (0)
3071 3104
3072#define __gpio_ack_irq(n) \ 3105#define __gpio_ack_irq(n) \
3073do { \ 3106do { \
3074 unsigned int p, o; \ 3107 unsigned int p, o; \
3075 p = (n) / 32; \ 3108 p = (n) / 32; \
3076 o = (n) % 32; \ 3109 o = (n) % 32; \
3077 REG_GPIO_PXFLGC(p) = (1 << o); \ 3110 REG_GPIO_PXFLGC(p) = (1 << o); \
3078} while (0) 3111} while (0)
3079 3112
3080#define __gpio_get_irq() \ 3113#define __gpio_get_irq() \
3081({ \ 3114({ \
3082 unsigned int p, i, tmp, v = 0; \ 3115 unsigned int p, i, tmp, v = 0; \
3083 for (p = 3; p >= 0; p--) { \ 3116 for (p = 3; p >= 0; p--) { \
3084 tmp = REG_GPIO_PXFLG(p); \ 3117 tmp = REG_GPIO_PXFLG(p); \
3085 for (i = 0; i < 32; i++) \ 3118 for (i = 0; i < 32; i++) \
3086 if (tmp & (1 << i)) \ 3119 if (tmp & (1 << i)) \
3087 v = (32*p + i); \ 3120 v = (32*p + i); \
3088 } \ 3121 } \
3089 v; \ 3122 v; \
3090}) 3123})
3091 3124
3092#define __gpio_group_irq(n) \ 3125#define __gpio_group_irq(n) \
3093({ \ 3126({ \
3094 register int tmp, i; \ 3127 register int tmp, i; \
3095 tmp = REG_GPIO_PXFLG((n)); \ 3128 tmp = REG_GPIO_PXFLG((n)); \
3096 for (i=31;i>=0;i--) \ 3129 for (i=31;i>=0;i--) \
3097 if (tmp & (1 << i)) \ 3130 if (tmp & (1 << i)) \
3098 break; \ 3131 break; \
3099 i; \ 3132 i; \
3100}) 3133})
3101 3134
3102#define __gpio_enable_pull(n) \ 3135#define __gpio_enable_pull(n) \
3103do { \ 3136do { \
3104 unsigned int p, o; \ 3137 unsigned int p, o; \
3105 p = (n) / 32; \ 3138 p = (n) / 32; \
3106 o = (n) % 32; \ 3139 o = (n) % 32; \
3107 REG_GPIO_PXPEC(p) = (1 << o); \ 3140 REG_GPIO_PXPEC(p) = (1 << o); \
3108} while (0) 3141} while (0)
3109 3142
3110#define __gpio_disable_pull(n) \ 3143#define __gpio_disable_pull(n) \
3111do { \ 3144do { \
3112 unsigned int p, o; \ 3145 unsigned int p, o; \
3113 p = (n) / 32; \ 3146 p = (n) / 32; \
3114 o = (n) % 32; \ 3147 o = (n) % 32; \
3115 REG_GPIO_PXPES(p) = (1 << o); \ 3148 REG_GPIO_PXPES(p) = (1 << o); \
3116} while (0) 3149} while (0)
3117 3150
3118 3151
@@ -3120,232 +3153,232 @@ do { \
3120 * CPM 3153 * CPM
3121 ***************************************************************************/ 3154 ***************************************************************************/
3122#define __cpm_get_pllm() \ 3155#define __cpm_get_pllm() \
3123 ((REG_CPM_CPPCR & CPM_CPPCR_PLLM_MASK) >> CPM_CPPCR_PLLM_BIT) 3156 ((REG_CPM_CPPCR & CPM_CPPCR_PLLM_MASK) >> CPM_CPPCR_PLLM_BIT)
3124#define __cpm_get_plln() \ 3157#define __cpm_get_plln() \
3125 ((REG_CPM_CPPCR & CPM_CPPCR_PLLN_MASK) >> CPM_CPPCR_PLLN_BIT) 3158 ((REG_CPM_CPPCR & CPM_CPPCR_PLLN_MASK) >> CPM_CPPCR_PLLN_BIT)
3126#define __cpm_get_pllod() \ 3159#define __cpm_get_pllod() \
3127 ((REG_CPM_CPPCR & CPM_CPPCR_PLLOD_MASK) >> CPM_CPPCR_PLLOD_BIT) 3160 ((REG_CPM_CPPCR & CPM_CPPCR_PLLOD_MASK) >> CPM_CPPCR_PLLOD_BIT)
3128 3161
3129#define __cpm_get_cdiv() \ 3162#define __cpm_get_cdiv() \
3130 ((REG_CPM_CPCCR & CPM_CPCCR_CDIV_MASK) >> CPM_CPCCR_CDIV_BIT) 3163 ((REG_CPM_CPCCR & CPM_CPCCR_CDIV_MASK) >> CPM_CPCCR_CDIV_BIT)
3131#define __cpm_get_hdiv() \ 3164#define __cpm_get_hdiv() \
3132 ((REG_CPM_CPCCR & CPM_CPCCR_HDIV_MASK) >> CPM_CPCCR_HDIV_BIT) 3165 ((REG_CPM_CPCCR & CPM_CPCCR_HDIV_MASK) >> CPM_CPCCR_HDIV_BIT)
3133#define __cpm_get_pdiv() \ 3166#define __cpm_get_pdiv() \
3134 ((REG_CPM_CPCCR & CPM_CPCCR_PDIV_MASK) >> CPM_CPCCR_PDIV_BIT) 3167 ((REG_CPM_CPCCR & CPM_CPCCR_PDIV_MASK) >> CPM_CPCCR_PDIV_BIT)
3135#define __cpm_get_mdiv() \ 3168#define __cpm_get_mdiv() \
3136 ((REG_CPM_CPCCR & CPM_CPCCR_MDIV_MASK) >> CPM_CPCCR_MDIV_BIT) 3169 ((REG_CPM_CPCCR & CPM_CPCCR_MDIV_MASK) >> CPM_CPCCR_MDIV_BIT)
3137#define __cpm_get_ldiv() \ 3170#define __cpm_get_ldiv() \
3138 ((REG_CPM_CPCCR & CPM_CPCCR_LDIV_MASK) >> CPM_CPCCR_LDIV_BIT) 3171 ((REG_CPM_CPCCR & CPM_CPCCR_LDIV_MASK) >> CPM_CPCCR_LDIV_BIT)
3139#define __cpm_get_udiv() \ 3172#define __cpm_get_udiv() \
3140 ((REG_CPM_CPCCR & CPM_CPCCR_UDIV_MASK) >> CPM_CPCCR_UDIV_BIT) 3173 ((REG_CPM_CPCCR & CPM_CPCCR_UDIV_MASK) >> CPM_CPCCR_UDIV_BIT)
3141#define __cpm_get_i2sdiv() \ 3174#define __cpm_get_i2sdiv() \
3142 ((REG_CPM_I2SCDR & CPM_I2SCDR_I2SDIV_MASK) >> CPM_I2SCDR_I2SDIV_BIT) 3175 ((REG_CPM_I2SCDR & CPM_I2SCDR_I2SDIV_MASK) >> CPM_I2SCDR_I2SDIV_BIT)
3143#define __cpm_get_pixdiv() \ 3176#define __cpm_get_pixdiv() \
3144 ((REG_CPM_LPCDR & CPM_LPCDR_PIXDIV_MASK) >> CPM_LPCDR_PIXDIV_BIT) 3177 ((REG_CPM_LPCDR & CPM_LPCDR_PIXDIV_MASK) >> CPM_LPCDR_PIXDIV_BIT)
3145#define __cpm_get_mscdiv() \ 3178#define __cpm_get_mscdiv() \
3146 ((REG_CPM_MSCCDR & CPM_MSCCDR_MSCDIV_MASK) >> CPM_MSCCDR_MSCDIV_BIT) 3179 ((REG_CPM_MSCCDR & CPM_MSCCDR_MSCDIV_MASK) >> CPM_MSCCDR_MSCDIV_BIT)
3147 3180
3148#define __cpm_set_cdiv(v) \ 3181#define __cpm_set_cdiv(v) \
3149 (REG_CPM_CPCCR = (REG_CPM_CPCCR & ~CPM_CPCCR_CDIV_MASK) | ((v) << (CPM_CPCCR_CDIV_BIT))) 3182 (REG_CPM_CPCCR = (REG_CPM_CPCCR & ~CPM_CPCCR_CDIV_MASK) | ((v) << (CPM_CPCCR_CDIV_BIT)))
3150#define __cpm_set_hdiv(v) \ 3183#define __cpm_set_hdiv(v) \
3151 (REG_CPM_CPCCR = (REG_CPM_CPCCR & ~CPM_CPCCR_HDIV_MASK) | ((v) << (CPM_CPCCR_HDIV_BIT))) 3184 (REG_CPM_CPCCR = (REG_CPM_CPCCR & ~CPM_CPCCR_HDIV_MASK) | ((v) << (CPM_CPCCR_HDIV_BIT)))
3152#define __cpm_set_pdiv(v) \ 3185#define __cpm_set_pdiv(v) \
3153 (REG_CPM_CPCCR = (REG_CPM_CPCCR & ~CPM_CPCCR_PDIV_MASK) | ((v) << (CPM_CPCCR_PDIV_BIT))) 3186 (REG_CPM_CPCCR = (REG_CPM_CPCCR & ~CPM_CPCCR_PDIV_MASK) | ((v) << (CPM_CPCCR_PDIV_BIT)))
3154#define __cpm_set_mdiv(v) \ 3187#define __cpm_set_mdiv(v) \
3155 (REG_CPM_CPCCR = (REG_CPM_CPCCR & ~CPM_CPCCR_MDIV_MASK) | ((v) << (CPM_CPCCR_MDIV_BIT))) 3188 (REG_CPM_CPCCR = (REG_CPM_CPCCR & ~CPM_CPCCR_MDIV_MASK) | ((v) << (CPM_CPCCR_MDIV_BIT)))
3156#define __cpm_set_ldiv(v) \ 3189#define __cpm_set_ldiv(v) \
3157 (REG_CPM_CPCCR = (REG_CPM_CPCCR & ~CPM_CPCCR_LDIV_MASK) | ((v) << (CPM_CPCCR_LDIV_BIT))) 3190 (REG_CPM_CPCCR = (REG_CPM_CPCCR & ~CPM_CPCCR_LDIV_MASK) | ((v) << (CPM_CPCCR_LDIV_BIT)))
3158#define __cpm_set_udiv(v) \ 3191#define __cpm_set_udiv(v) \
3159 (REG_CPM_CPCCR = (REG_CPM_CPCCR & ~CPM_CPCCR_UDIV_MASK) | ((v) << (CPM_CPCCR_UDIV_BIT))) 3192 (REG_CPM_CPCCR = (REG_CPM_CPCCR & ~CPM_CPCCR_UDIV_MASK) | ((v) << (CPM_CPCCR_UDIV_BIT)))
3160#define __cpm_set_i2sdiv(v) \ 3193#define __cpm_set_i2sdiv(v) \
3161 (REG_CPM_I2SCDR = (REG_CPM_I2SCDR & ~CPM_I2SCDR_I2SDIV_MASK) | ((v) << (CPM_I2SCDR_I2SDIV_BIT))) 3194 (REG_CPM_I2SCDR = (REG_CPM_I2SCDR & ~CPM_I2SCDR_I2SDIV_MASK) | ((v) << (CPM_I2SCDR_I2SDIV_BIT)))
3162#define __cpm_set_pixdiv(v) \ 3195#define __cpm_set_pixdiv(v) \
3163 (REG_CPM_LPCDR = (REG_CPM_LPCDR & ~CPM_LPCDR_PIXDIV_MASK) | ((v) << (CPM_LPCDR_PIXDIV_BIT))) 3196 (REG_CPM_LPCDR = (REG_CPM_LPCDR & ~CPM_LPCDR_PIXDIV_MASK) | ((v) << (CPM_LPCDR_PIXDIV_BIT)))
3164#define __cpm_set_mscdiv(v) \ 3197#define __cpm_set_mscdiv(v) \
3165 (REG_CPM_MSCCDR = (REG_CPM_MSCCDR & ~CPM_MSCCDR_MSCDIV_MASK) | ((v) << (CPM_MSCCDR_MSCDIV_BIT))) 3198 (REG_CPM_MSCCDR = (REG_CPM_MSCCDR & ~CPM_MSCCDR_MSCDIV_MASK) | ((v) << (CPM_MSCCDR_MSCDIV_BIT)))
3166 3199
3167#define __cpm_select_i2sclk_exclk() (REG_CPM_CPCCR &= ~CPM_CPCCR_I2CS) 3200#define __cpm_select_i2sclk_exclk() (REG_CPM_CPCCR &= ~CPM_CPCCR_I2CS)
3168#define __cpm_select_i2sclk_pll() (REG_CPM_CPCCR |= CPM_CPCCR_I2CS) 3201#define __cpm_select_i2sclk_pll() (REG_CPM_CPCCR |= CPM_CPCCR_I2CS)
3169#define __cpm_enable_cko() (REG_CPM_CPCCR |= CPM_CPCCR_CLKOEN) 3202#define __cpm_enable_cko() (REG_CPM_CPCCR |= CPM_CPCCR_CLKOEN)
3170#define __cpm_select_usbclk_exclk() (REG_CPM_CPCCR &= ~CPM_CPCCR_UCS) 3203#define __cpm_select_usbclk_exclk() (REG_CPM_CPCCR &= ~CPM_CPCCR_UCS)
3171#define __cpm_select_usbclk_pll() (REG_CPM_CPCCR |= CPM_CPCCR_UCS) 3204#define __cpm_select_usbclk_pll() (REG_CPM_CPCCR |= CPM_CPCCR_UCS)
3172#define __cpm_enable_pll_change() (REG_CPM_CPCCR |= CPM_CPCCR_CE) 3205#define __cpm_enable_pll_change() (REG_CPM_CPCCR |= CPM_CPCCR_CE)
3173#define __cpm_pllout_direct() (REG_CPM_CPCCR |= CPM_CPCCR_PCS) 3206#define __cpm_pllout_direct() (REG_CPM_CPCCR |= CPM_CPCCR_PCS)
3174#define __cpm_pllout_div2() (REG_CPM_CPCCR &= ~CPM_CPCCR_PCS) 3207#define __cpm_pllout_div2() (REG_CPM_CPCCR &= ~CPM_CPCCR_PCS)
3175 3208
3176#define __cpm_pll_is_on() (REG_CPM_CPPCR & CPM_CPPCR_PLLS) 3209#define __cpm_pll_is_on() (REG_CPM_CPPCR & CPM_CPPCR_PLLS)
3177#define __cpm_pll_bypass() (REG_CPM_CPPCR |= CPM_CPPCR_PLLBP) 3210#define __cpm_pll_bypass() (REG_CPM_CPPCR |= CPM_CPPCR_PLLBP)
3178#define __cpm_pll_enable() (REG_CPM_CPPCR |= CPM_CPPCR_PLLEN) 3211#define __cpm_pll_enable() (REG_CPM_CPPCR |= CPM_CPPCR_PLLEN)
3179 3212
3180#define __cpm_get_cclk_doze_duty() \ 3213#define __cpm_get_cclk_doze_duty() \
3181 ((REG_CPM_LCR & CPM_LCR_DOZE_DUTY_MASK) >> CPM_LCR_DOZE_DUTY_BIT) 3214 ((REG_CPM_LCR & CPM_LCR_DOZE_DUTY_MASK) >> CPM_LCR_DOZE_DUTY_BIT)
3182#define __cpm_set_cclk_doze_duty(v) \ 3215#define __cpm_set_cclk_doze_duty(v) \
3183 (REG_CPM_LCR = (REG_CPM_LCR & ~CPM_LCR_DOZE_DUTY_MASK) | ((v) << (CPM_LCR_DOZE_DUTY_BIT))) 3216 (REG_CPM_LCR = (REG_CPM_LCR & ~CPM_LCR_DOZE_DUTY_MASK) | ((v) << (CPM_LCR_DOZE_DUTY_BIT)))
3184 3217
3185#define __cpm_doze_mode() (REG_CPM_LCR |= CPM_LCR_DOZE_ON) 3218#define __cpm_doze_mode() (REG_CPM_LCR |= CPM_LCR_DOZE_ON)
3186#define __cpm_idle_mode() \ 3219#define __cpm_idle_mode() \
3187 (REG_CPM_LCR = (REG_CPM_LCR & ~CPM_LCR_LPM_MASK) | CPM_LCR_LPM_IDLE) 3220 (REG_CPM_LCR = (REG_CPM_LCR & ~CPM_LCR_LPM_MASK) | CPM_LCR_LPM_IDLE)
3188#define __cpm_sleep_mode() \ 3221#define __cpm_sleep_mode() \
3189 (REG_CPM_LCR = (REG_CPM_LCR & ~CPM_LCR_LPM_MASK) | CPM_LCR_LPM_SLEEP) 3222 (REG_CPM_LCR = (REG_CPM_LCR & ~CPM_LCR_LPM_MASK) | CPM_LCR_LPM_SLEEP)
3190 3223
3191#define __cpm_stop_all() (REG_CPM_CLKGR = 0x7fff) 3224#define __cpm_stop_all() (REG_CPM_CLKGR = 0x7fff)
3192#define __cpm_stop_uart1() (REG_CPM_CLKGR |= CPM_CLKGR_UART1) 3225#define __cpm_stop_uart1() (REG_CPM_CLKGR |= CPM_CLKGR_UART1)
3193#define __cpm_stop_uhc() (REG_CPM_CLKGR |= CPM_CLKGR_UHC) 3226#define __cpm_stop_uhc() (REG_CPM_CLKGR |= CPM_CLKGR_UHC)
3194#define __cpm_stop_ipu() (REG_CPM_CLKGR |= CPM_CLKGR_IPU) 3227#define __cpm_stop_ipu() (REG_CPM_CLKGR |= CPM_CLKGR_IPU)
3195#define __cpm_stop_dmac() (REG_CPM_CLKGR |= CPM_CLKGR_DMAC) 3228#define __cpm_stop_dmac() (REG_CPM_CLKGR |= CPM_CLKGR_DMAC)
3196#define __cpm_stop_udc() (REG_CPM_CLKGR |= CPM_CLKGR_UDC) 3229#define __cpm_stop_udc() (REG_CPM_CLKGR |= CPM_CLKGR_UDC)
3197#define __cpm_stop_lcd() (REG_CPM_CLKGR |= CPM_CLKGR_LCD) 3230#define __cpm_stop_lcd() (REG_CPM_CLKGR |= CPM_CLKGR_LCD)
3198#define __cpm_stop_cim() (REG_CPM_CLKGR |= CPM_CLKGR_CIM) 3231#define __cpm_stop_cim() (REG_CPM_CLKGR |= CPM_CLKGR_CIM)
3199#define __cpm_stop_sadc() (REG_CPM_CLKGR |= CPM_CLKGR_SADC) 3232#define __cpm_stop_sadc() (REG_CPM_CLKGR |= CPM_CLKGR_SADC)
3200#define __cpm_stop_msc() (REG_CPM_CLKGR |= CPM_CLKGR_MSC) 3233#define __cpm_stop_msc() (REG_CPM_CLKGR |= CPM_CLKGR_MSC)
3201#define __cpm_stop_aic1() (REG_CPM_CLKGR |= CPM_CLKGR_AIC1) 3234#define __cpm_stop_aic1() (REG_CPM_CLKGR |= CPM_CLKGR_AIC1)
3202#define __cpm_stop_aic2() (REG_CPM_CLKGR |= CPM_CLKGR_AIC2) 3235#define __cpm_stop_aic2() (REG_CPM_CLKGR |= CPM_CLKGR_AIC2)
3203#define __cpm_stop_ssi() (REG_CPM_CLKGR |= CPM_CLKGR_SSI) 3236#define __cpm_stop_ssi() (REG_CPM_CLKGR |= CPM_CLKGR_SSI)
3204#define __cpm_stop_i2c() (REG_CPM_CLKGR |= CPM_CLKGR_I2C) 3237#define __cpm_stop_i2c() (REG_CPM_CLKGR |= CPM_CLKGR_I2C)
3205#define __cpm_stop_rtc() (REG_CPM_CLKGR |= CPM_CLKGR_RTC) 3238#define __cpm_stop_rtc() (REG_CPM_CLKGR |= CPM_CLKGR_RTC)
3206#define __cpm_stop_tcu() (REG_CPM_CLKGR |= CPM_CLKGR_TCU) 3239#define __cpm_stop_tcu() (REG_CPM_CLKGR |= CPM_CLKGR_TCU)
3207#define __cpm_stop_uart0() (REG_CPM_CLKGR |= CPM_CLKGR_UART0) 3240#define __cpm_stop_uart0() (REG_CPM_CLKGR |= CPM_CLKGR_UART0)
3208 3241
3209#define __cpm_start_all() (REG_CPM_CLKGR = 0x0) 3242#define __cpm_start_all() (REG_CPM_CLKGR = 0x0)
3210#define __cpm_start_uart1() (REG_CPM_CLKGR &= ~CPM_CLKGR_UART1) 3243#define __cpm_start_uart1() (REG_CPM_CLKGR &= ~CPM_CLKGR_UART1)
3211#define __cpm_start_uhc() (REG_CPM_CLKGR &= ~CPM_CLKGR_UHC) 3244#define __cpm_start_uhc() (REG_CPM_CLKGR &= ~CPM_CLKGR_UHC)
3212#define __cpm_start_ipu() (REG_CPM_CLKGR &= ~CPM_CLKGR_IPU) 3245#define __cpm_start_ipu() (REG_CPM_CLKGR &= ~CPM_CLKGR_IPU)
3213#define __cpm_start_dmac() (REG_CPM_CLKGR &= ~CPM_CLKGR_DMAC) 3246#define __cpm_start_dmac() (REG_CPM_CLKGR &= ~CPM_CLKGR_DMAC)
3214#define __cpm_start_udc() (REG_CPM_CLKGR &= ~CPM_CLKGR_UDC) 3247#define __cpm_start_udc() (REG_CPM_CLKGR &= ~CPM_CLKGR_UDC)
3215#define __cpm_start_lcd() (REG_CPM_CLKGR &= ~CPM_CLKGR_LCD) 3248#define __cpm_start_lcd() (REG_CPM_CLKGR &= ~CPM_CLKGR_LCD)
3216#define __cpm_start_cim() (REG_CPM_CLKGR &= ~CPM_CLKGR_CIM) 3249#define __cpm_start_cim() (REG_CPM_CLKGR &= ~CPM_CLKGR_CIM)
3217#define __cpm_start_sadc() (REG_CPM_CLKGR &= ~CPM_CLKGR_SADC) 3250#define __cpm_start_sadc() (REG_CPM_CLKGR &= ~CPM_CLKGR_SADC)
3218#define __cpm_start_msc() (REG_CPM_CLKGR &= ~CPM_CLKGR_MSC) 3251#define __cpm_start_msc() (REG_CPM_CLKGR &= ~CPM_CLKGR_MSC)
3219#define __cpm_start_aic1() (REG_CPM_CLKGR &= ~CPM_CLKGR_AIC1) 3252#define __cpm_start_aic1() (REG_CPM_CLKGR &= ~CPM_CLKGR_AIC1)
3220#define __cpm_start_aic2() (REG_CPM_CLKGR &= ~CPM_CLKGR_AIC2) 3253#define __cpm_start_aic2() (REG_CPM_CLKGR &= ~CPM_CLKGR_AIC2)
3221#define __cpm_start_ssi() (REG_CPM_CLKGR &= ~CPM_CLKGR_SSI) 3254#define __cpm_start_ssi() (REG_CPM_CLKGR &= ~CPM_CLKGR_SSI)
3222#define __cpm_start_i2c() (REG_CPM_CLKGR &= ~CPM_CLKGR_I2C) 3255#define __cpm_start_i2c() (REG_CPM_CLKGR &= ~CPM_CLKGR_I2C)
3223#define __cpm_start_rtc() (REG_CPM_CLKGR &= ~CPM_CLKGR_RTC) 3256#define __cpm_start_rtc() (REG_CPM_CLKGR &= ~CPM_CLKGR_RTC)
3224#define __cpm_start_tcu() (REG_CPM_CLKGR &= ~CPM_CLKGR_TCU) 3257#define __cpm_start_tcu() (REG_CPM_CLKGR &= ~CPM_CLKGR_TCU)
3225#define __cpm_start_uart0() (REG_CPM_CLKGR &= ~CPM_CLKGR_UART0) 3258#define __cpm_start_uart0() (REG_CPM_CLKGR &= ~CPM_CLKGR_UART0)
3226 3259
3227#define __cpm_get_o1st() \ 3260#define __cpm_get_o1st() \
3228 ((REG_CPM_SCR & CPM_SCR_O1ST_MASK) >> CPM_SCR_O1ST_BIT) 3261 ((REG_CPM_SCR & CPM_SCR_O1ST_MASK) >> CPM_SCR_O1ST_BIT)
3229#define __cpm_set_o1st(v) \ 3262#define __cpm_set_o1st(v) \
3230 (REG_CPM_SCR = (REG_CPM_SCR & ~CPM_SCR_O1ST_MASK) | ((v) << (CPM_SCR_O1ST_BIT))) 3263 (REG_CPM_SCR = (REG_CPM_SCR & ~CPM_SCR_O1ST_MASK) | ((v) << (CPM_SCR_O1ST_BIT)))
3231#define __cpm_suspend_usbphy() (REG_CPM_SCR |= CPM_SCR_USBPHY_SUSPEND) 3264#define __cpm_suspend_usbphy() (REG_CPM_SCR |= CPM_SCR_USBPHY_SUSPEND)
3232#define __cpm_enable_osc_in_sleep() (REG_CPM_SCR |= CPM_SCR_OSC_ENABLE) 3265#define __cpm_enable_osc_in_sleep() (REG_CPM_SCR |= CPM_SCR_OSC_ENABLE)
3233 3266
3234 3267
3235#ifdef CFG_EXTAL 3268#ifdef CFG_EXTAL
3236#define JZ_EXTAL CFG_EXTAL 3269#define JZ_EXTAL CFG_EXTAL
3237#else 3270#else
3238#define JZ_EXTAL 3686400 3271#define JZ_EXTAL 3686400
3239#endif 3272#endif
3240#define JZ_EXTAL2 32768 /* RTC clock */ 3273#define JZ_EXTAL2 32768 /* RTC clock */
3241 3274
3242/* PLL output frequency */ 3275/* PLL output frequency */
3243static __inline__ unsigned int __cpm_get_pllout(void) 3276static __inline__ unsigned int __cpm_get_pllout(void)
3244{ 3277{
3245 unsigned long m, n, no, pllout; 3278 unsigned long m, n, no, pllout;
3246 unsigned long cppcr = REG_CPM_CPPCR; 3279 unsigned long cppcr = REG_CPM_CPPCR;
3247 unsigned long od[4] = {1, 2, 2, 4}; 3280 unsigned long od[4] = {1, 2, 2, 4};
3248 if ((cppcr & CPM_CPPCR_PLLEN) && !(cppcr & CPM_CPPCR_PLLBP)) { 3281 if ((cppcr & CPM_CPPCR_PLLEN) && !(cppcr & CPM_CPPCR_PLLBP)) {
3249 m = __cpm_get_pllm() + 2; 3282 m = __cpm_get_pllm() + 2;
3250 n = __cpm_get_plln() + 2; 3283 n = __cpm_get_plln() + 2;
3251 no = od[__cpm_get_pllod()]; 3284 no = od[__cpm_get_pllod()];
3252 pllout = ((JZ_EXTAL) / (n * no)) * m; 3285 pllout = ((JZ_EXTAL) / (n * no)) * m;
3253 } else 3286 } else
3254 pllout = JZ_EXTAL; 3287 pllout = JZ_EXTAL;
3255 return pllout; 3288 return pllout;
3256} 3289}
3257 3290
3258/* PLL output frequency for MSC/I2S/LCD/USB */ 3291/* PLL output frequency for MSC/I2S/LCD/USB */
3259static __inline__ unsigned int __cpm_get_pllout2(void) 3292static __inline__ unsigned int __cpm_get_pllout2(void)
3260{ 3293{
3261 if (REG_CPM_CPCCR & CPM_CPCCR_PCS) 3294 if (REG_CPM_CPCCR & CPM_CPCCR_PCS)
3262 return __cpm_get_pllout(); 3295 return __cpm_get_pllout();
3263 else 3296 else
3264 return __cpm_get_pllout()/2; 3297 return __cpm_get_pllout()/2;
3265} 3298}
3266 3299
3267/* CPU core clock */ 3300/* CPU core clock */
3268static __inline__ unsigned int __cpm_get_cclk(void) 3301static __inline__ unsigned int __cpm_get_cclk(void)
3269{ 3302{
3270 int div[] = {1, 2, 3, 4, 6, 8, 12, 16, 24, 32}; 3303 int div[] = {1, 2, 3, 4, 6, 8, 12, 16, 24, 32};
3271 3304
3272 return __cpm_get_pllout() / div[__cpm_get_cdiv()]; 3305 return __cpm_get_pllout() / div[__cpm_get_cdiv()];
3273} 3306}
3274 3307
3275/* AHB system bus clock */ 3308/* AHB system bus clock */
3276static __inline__ unsigned int __cpm_get_hclk(void) 3309static __inline__ unsigned int __cpm_get_hclk(void)
3277{ 3310{
3278 int div[] = {1, 2, 3, 4, 6, 8, 12, 16, 24, 32}; 3311 int div[] = {1, 2, 3, 4, 6, 8, 12, 16, 24, 32};
3279 3312
3280 return __cpm_get_pllout() / div[__cpm_get_hdiv()]; 3313 return __cpm_get_pllout() / div[__cpm_get_hdiv()];
3281} 3314}
3282 3315
3283/* Memory bus clock */ 3316/* Memory bus clock */
3284static __inline__ unsigned int __cpm_get_mclk(void) 3317static __inline__ unsigned int __cpm_get_mclk(void)
3285{ 3318{
3286 int div[] = {1, 2, 3, 4, 6, 8, 12, 16, 24, 32}; 3319 int div[] = {1, 2, 3, 4, 6, 8, 12, 16, 24, 32};
3287 3320
3288 return __cpm_get_pllout() / div[__cpm_get_mdiv()]; 3321 return __cpm_get_pllout() / div[__cpm_get_mdiv()];
3289} 3322}
3290 3323
3291/* APB peripheral bus clock */ 3324/* APB peripheral bus clock */
3292static __inline__ unsigned int __cpm_get_pclk(void) 3325static __inline__ unsigned int __cpm_get_pclk(void)
3293{ 3326{
3294 int div[] = {1, 2, 3, 4, 6, 8, 12, 16, 24, 32}; 3327 int div[] = {1, 2, 3, 4, 6, 8, 12, 16, 24, 32};
3295 3328
3296 return __cpm_get_pllout() / div[__cpm_get_pdiv()]; 3329 return __cpm_get_pllout() / div[__cpm_get_pdiv()];
3297} 3330}
3298 3331
3299/* LCDC module clock */ 3332/* LCDC module clock */
3300static __inline__ unsigned int __cpm_get_lcdclk(void) 3333static __inline__ unsigned int __cpm_get_lcdclk(void)
3301{ 3334{
3302 return __cpm_get_pllout2() / (__cpm_get_ldiv() + 1); 3335 return __cpm_get_pllout2() / (__cpm_get_ldiv() + 1);
3303} 3336}
3304 3337
3305/* LCD pixel clock */ 3338/* LCD pixel clock */
3306static __inline__ unsigned int __cpm_get_pixclk(void) 3339static __inline__ unsigned int __cpm_get_pixclk(void)
3307{ 3340{
3308 return __cpm_get_pllout2() / (__cpm_get_pixdiv() + 1); 3341 return __cpm_get_pllout2() / (__cpm_get_pixdiv() + 1);
3309} 3342}
3310 3343
3311/* I2S clock */ 3344/* I2S clock */
3312static __inline__ unsigned int __cpm_get_i2sclk(void) 3345static __inline__ unsigned int __cpm_get_i2sclk(void)
3313{ 3346{
3314 if (REG_CPM_CPCCR & CPM_CPCCR_I2CS) { 3347 if (REG_CPM_CPCCR & CPM_CPCCR_I2CS) {
3315 return __cpm_get_pllout2() / (__cpm_get_i2sdiv() + 1); 3348 return __cpm_get_pllout2() / (__cpm_get_i2sdiv() + 1);
3316 } 3349 }
3317 else { 3350 else {
3318 return JZ_EXTAL; 3351 return JZ_EXTAL;
3319 } 3352 }
3320} 3353}
3321 3354
3322/* USB clock */ 3355/* USB clock */
3323static __inline__ unsigned int __cpm_get_usbclk(void) 3356static __inline__ unsigned int __cpm_get_usbclk(void)
3324{ 3357{
3325 if (REG_CPM_CPCCR & CPM_CPCCR_UCS) { 3358 if (REG_CPM_CPCCR & CPM_CPCCR_UCS) {
3326 return __cpm_get_pllout2() / (__cpm_get_udiv() + 1); 3359 return __cpm_get_pllout2() / (__cpm_get_udiv() + 1);
3327 } 3360 }
3328 else { 3361 else {
3329 return JZ_EXTAL; 3362 return JZ_EXTAL;
3330 } 3363 }
3331} 3364}
3332 3365
3333/* MSC clock */ 3366/* MSC clock */
3334static __inline__ unsigned int __cpm_get_mscclk(void) 3367static __inline__ unsigned int __cpm_get_mscclk(void)
3335{ 3368{
3336 return __cpm_get_pllout2() / (__cpm_get_mscdiv() + 1); 3369 return __cpm_get_pllout2() / (__cpm_get_mscdiv() + 1);
3337} 3370}
3338 3371
3339/* EXTAL clock for UART,I2C,SSI,TCU,USB-PHY */ 3372/* EXTAL clock for UART,I2C,SSI,TCU,USB-PHY */
3340static __inline__ unsigned int __cpm_get_extalclk(void) 3373static __inline__ unsigned int __cpm_get_extalclk(void)
3341{ 3374{
3342 return JZ_EXTAL; 3375 return JZ_EXTAL;
3343} 3376}
3344 3377
3345/* RTC clock for CPM,INTC,RTC,TCU,WDT */ 3378/* RTC clock for CPM,INTC,RTC,TCU,WDT */
3346static __inline__ unsigned int __cpm_get_rtcclk(void) 3379static __inline__ unsigned int __cpm_get_rtcclk(void)
3347{ 3380{
3348 return JZ_EXTAL2; 3381 return JZ_EXTAL2;
3349} 3382}
3350 3383
3351/* 3384/*
@@ -3353,17 +3386,17 @@ static __inline__ unsigned int __cpm_get_rtcclk(void)
3353 */ 3386 */
3354static inline void __cpm_select_msc_clk(int sd) 3387static inline void __cpm_select_msc_clk(int sd)
3355{ 3388{
3356 unsigned int pllout2 = __cpm_get_pllout2(); 3389 unsigned int pllout2 = __cpm_get_pllout2();
3357 unsigned int div = 0; 3390 unsigned int div = 0;
3358 3391
3359 if (sd) { 3392 if (sd) {
3360 div = pllout2 / 24000000; 3393 div = pllout2 / 24000000;
3361 } 3394 }
3362 else { 3395 else {
3363 div = pllout2 / 16000000; 3396 div = pllout2 / 16000000;
3364 } 3397 }
3365 3398
3366 REG_CPM_MSCCDR = div - 1; 3399 REG_CPM_MSCCDR = div - 1;
3367} 3400}
3368 3401
3369/* 3402/*
@@ -3371,16 +3404,16 @@ static inline void __cpm_select_msc_clk(int sd)
3371 */ 3404 */
3372static inline void __cpm_select_msc_hs_clk(int sd) 3405static inline void __cpm_select_msc_hs_clk(int sd)
3373{ 3406{
3374 unsigned int pllout2 = __cpm_get_pllout2(); 3407 unsigned int pllout2 = __cpm_get_pllout2();
3375 unsigned int div = 0; 3408 unsigned int div = 0;
3376 3409
3377 if (sd) { 3410 if (sd) {
3378 div = pllout2 / 48000000; 3411 div = pllout2 / 48000000;
3379 } 3412 }
3380 else { 3413 else {
3381 div = pllout2 / 16000000; 3414 div = pllout2 / 16000000;
3382 } 3415 }
3383 REG_CPM_MSCCDR = div - 1; 3416 REG_CPM_MSCCDR = div - 1;
3384} 3417}
3385 3418
3386/*************************************************************************** 3419/***************************************************************************
@@ -3388,131 +3421,131 @@ static inline void __cpm_select_msc_hs_clk(int sd)
3388 ***************************************************************************/ 3421 ***************************************************************************/
3389// where 'n' is the TCU channel 3422// where 'n' is the TCU channel
3390#define __tcu_select_extalclk(n) \ 3423#define __tcu_select_extalclk(n) \
3391 (REG_TCU_TCSR((n)) = (REG_TCU_TCSR((n)) & ~(TCU_TCSR_EXT_EN | TCU_TCSR_RTC_EN | TCU_TCSR_PCK_EN)) | TCU_TCSR_EXT_EN) 3424 (REG_TCU_TCSR((n)) = (REG_TCU_TCSR((n)) & ~(TCU_TCSR_EXT_EN | TCU_TCSR_RTC_EN | TCU_TCSR_PCK_EN)) | TCU_TCSR_EXT_EN)
3392#define __tcu_select_rtcclk(n) \ 3425#define __tcu_select_rtcclk(n) \
3393 (REG_TCU_TCSR((n)) = (REG_TCU_TCSR((n)) & ~(TCU_TCSR_EXT_EN | TCU_TCSR_RTC_EN | TCU_TCSR_PCK_EN)) | TCU_TCSR_RTC_EN) 3426 (REG_TCU_TCSR((n)) = (REG_TCU_TCSR((n)) & ~(TCU_TCSR_EXT_EN | TCU_TCSR_RTC_EN | TCU_TCSR_PCK_EN)) | TCU_TCSR_RTC_EN)
3394#define __tcu_select_pclk(n) \ 3427#define __tcu_select_pclk(n) \
3395 (REG_TCU_TCSR((n)) = (REG_TCU_TCSR((n)) & ~(TCU_TCSR_EXT_EN | TCU_TCSR_RTC_EN | TCU_TCSR_PCK_EN)) | TCU_TCSR_PCK_EN) 3428 (REG_TCU_TCSR((n)) = (REG_TCU_TCSR((n)) & ~(TCU_TCSR_EXT_EN | TCU_TCSR_RTC_EN | TCU_TCSR_PCK_EN)) | TCU_TCSR_PCK_EN)
3396 3429
3397#define __tcu_select_clk_div1(n) \ 3430#define __tcu_select_clk_div1(n) \
3398 (REG_TCU_TCSR((n)) = (REG_TCU_TCSR((n)) & ~TCU_TCSR_PRESCALE_MASK) | TCU_TCSR_PRESCALE1) 3431 (REG_TCU_TCSR((n)) = (REG_TCU_TCSR((n)) & ~TCU_TCSR_PRESCALE_MASK) | TCU_TCSR_PRESCALE1)
3399#define __tcu_select_clk_div4(n) \ 3432#define __tcu_select_clk_div4(n) \
3400 (REG_TCU_TCSR((n)) = (REG_TCU_TCSR((n)) & ~TCU_TCSR_PRESCALE_MASK) | TCU_TCSR_PRESCALE4) 3433 (REG_TCU_TCSR((n)) = (REG_TCU_TCSR((n)) & ~TCU_TCSR_PRESCALE_MASK) | TCU_TCSR_PRESCALE4)
3401#define __tcu_select_clk_div16(n) \ 3434#define __tcu_select_clk_div16(n) \
3402 (REG_TCU_TCSR((n)) = (REG_TCU_TCSR((n)) & ~TCU_TCSR_PRESCALE_MASK) | TCU_TCSR_PRESCALE16) 3435 (REG_TCU_TCSR((n)) = (REG_TCU_TCSR((n)) & ~TCU_TCSR_PRESCALE_MASK) | TCU_TCSR_PRESCALE16)
3403#define __tcu_select_clk_div64(n) \ 3436#define __tcu_select_clk_div64(n) \
3404 (REG_TCU_TCSR((n)) = (REG_TCU_TCSR((n)) & ~TCU_TCSR_PRESCALE_MASK) | TCU_TCSR_PRESCALE64) 3437 (REG_TCU_TCSR((n)) = (REG_TCU_TCSR((n)) & ~TCU_TCSR_PRESCALE_MASK) | TCU_TCSR_PRESCALE64)
3405#define __tcu_select_clk_div256(n) \ 3438#define __tcu_select_clk_div256(n) \
3406 (REG_TCU_TCSR((n)) = (REG_TCU_TCSR((n)) & ~TCU_TCSR_PRESCALE_MASK) | TCU_TCSR_PRESCALE256) 3439 (REG_TCU_TCSR((n)) = (REG_TCU_TCSR((n)) & ~TCU_TCSR_PRESCALE_MASK) | TCU_TCSR_PRESCALE256)
3407#define __tcu_select_clk_div1024(n) \ 3440#define __tcu_select_clk_div1024(n) \
3408 (REG_TCU_TCSR((n)) = (REG_TCU_TCSR((n)) & ~TCU_TCSR_PRESCALE_MASK) | TCU_TCSR_PRESCALE1024) 3441 (REG_TCU_TCSR((n)) = (REG_TCU_TCSR((n)) & ~TCU_TCSR_PRESCALE_MASK) | TCU_TCSR_PRESCALE1024)
3409 3442
3410#define __tcu_enable_pwm_output(n) ( REG_TCU_TCSR((n)) |= TCU_TCSR_PWM_EN ) 3443#define __tcu_enable_pwm_output(n) ( REG_TCU_TCSR((n)) |= TCU_TCSR_PWM_EN )
3411#define __tcu_disable_pwm_output(n) ( REG_TCU_TCSR((n)) &= ~TCU_TCSR_PWM_EN ) 3444#define __tcu_disable_pwm_output(n) ( REG_TCU_TCSR((n)) &= ~TCU_TCSR_PWM_EN )
3412 3445
3413#define __tcu_init_pwm_output_high(n) ( REG_TCU_TCSR((n)) |= TCU_TCSR_PWM_INITL_HIGH ) 3446#define __tcu_init_pwm_output_high(n) ( REG_TCU_TCSR((n)) |= TCU_TCSR_PWM_INITL_HIGH )
3414#define __tcu_init_pwm_output_low(n) ( REG_TCU_TCSR((n)) &= ~TCU_TCSR_PWM_INITL_HIGH ) 3447#define __tcu_init_pwm_output_low(n) ( REG_TCU_TCSR((n)) &= ~TCU_TCSR_PWM_INITL_HIGH )
3415 3448
3416#define __tcu_set_pwm_output_shutdown_graceful(n) ( REG_TCU_TCSR((n)) &= ~TCU_TCSR_PWM_SD ) 3449#define __tcu_set_pwm_output_shutdown_graceful(n) ( REG_TCU_TCSR((n)) &= ~TCU_TCSR_PWM_SD )
3417#define __tcu_set_pwm_output_shutdown_abrupt(n) ( REG_TCU_TCSR((n)) |= TCU_TCSR_PWM_SD ) 3450#define __tcu_set_pwm_output_shutdown_abrupt(n) ( REG_TCU_TCSR((n)) |= TCU_TCSR_PWM_SD )
3418 3451
3419#define __tcu_start_counter(n) ( REG_TCU_TESR |= (1 << (n)) ) 3452#define __tcu_start_counter(n) ( REG_TCU_TESR |= (1 << (n)) )
3420#define __tcu_stop_counter(n) ( REG_TCU_TECR |= (1 << (n)) ) 3453#define __tcu_stop_counter(n) ( REG_TCU_TECR |= (1 << (n)) )
3421 3454
3422#define __tcu_half_match_flag(n) ( REG_TCU_TFR & (1 << ((n) + 16)) ) 3455#define __tcu_half_match_flag(n) ( REG_TCU_TFR & (1 << ((n) + 16)) )
3423#define __tcu_full_match_flag(n) ( REG_TCU_TFR & (1 << (n)) ) 3456#define __tcu_full_match_flag(n) ( REG_TCU_TFR & (1 << (n)) )
3424#define __tcu_set_half_match_flag(n) ( REG_TCU_TFSR = (1 << ((n) + 16)) ) 3457#define __tcu_set_half_match_flag(n) ( REG_TCU_TFSR = (1 << ((n) + 16)) )
3425#define __tcu_set_full_match_flag(n) ( REG_TCU_TFSR = (1 << (n)) ) 3458#define __tcu_set_full_match_flag(n) ( REG_TCU_TFSR = (1 << (n)) )
3426#define __tcu_clear_half_match_flag(n) ( REG_TCU_TFCR = (1 << ((n) + 16)) ) 3459#define __tcu_clear_half_match_flag(n) ( REG_TCU_TFCR = (1 << ((n) + 16)) )
3427#define __tcu_clear_full_match_flag(n) ( REG_TCU_TFCR = (1 << (n)) ) 3460#define __tcu_clear_full_match_flag(n) ( REG_TCU_TFCR = (1 << (n)) )
3428#define __tcu_mask_half_match_irq(n) ( REG_TCU_TMSR = (1 << ((n) + 16)) ) 3461#define __tcu_mask_half_match_irq(n) ( REG_TCU_TMSR = (1 << ((n) + 16)) )
3429#define __tcu_mask_full_match_irq(n) ( REG_TCU_TMSR = (1 << (n)) ) 3462#define __tcu_mask_full_match_irq(n) ( REG_TCU_TMSR = (1 << (n)) )
3430#define __tcu_unmask_half_match_irq(n) ( REG_TCU_TMCR = (1 << ((n) + 16)) ) 3463#define __tcu_unmask_half_match_irq(n) ( REG_TCU_TMCR = (1 << ((n) + 16)) )
3431#define __tcu_unmask_full_match_irq(n) ( REG_TCU_TMCR = (1 << (n)) ) 3464#define __tcu_unmask_full_match_irq(n) ( REG_TCU_TMCR = (1 << (n)) )
3432 3465
3433#define __tcu_wdt_clock_stopped() ( REG_TCU_TSR & TCU_TSSR_WDTSC ) 3466#define __tcu_wdt_clock_stopped() ( REG_TCU_TSR & TCU_TSSR_WDTSC )
3434#define __tcu_timer_clock_stopped(n) ( REG_TCU_TSR & (1 << (n)) ) 3467#define __tcu_timer_clock_stopped(n) ( REG_TCU_TSR & (1 << (n)) )
3435 3468
3436#define __tcu_start_wdt_clock() ( REG_TCU_TSCR = TCU_TSSR_WDTSC ) 3469#define __tcu_start_wdt_clock() ( REG_TCU_TSCR = TCU_TSSR_WDTSC )
3437#define __tcu_start_timer_clock(n) ( REG_TCU_TSCR = (1 << (n)) ) 3470#define __tcu_start_timer_clock(n) ( REG_TCU_TSCR = (1 << (n)) )
3438 3471
3439#define __tcu_stop_wdt_clock() ( REG_TCU_TSSR = TCU_TSSR_WDTSC ) 3472#define __tcu_stop_wdt_clock() ( REG_TCU_TSSR = TCU_TSSR_WDTSC )
3440#define __tcu_stop_timer_clock(n) ( REG_TCU_TSSR = (1 << (n)) ) 3473#define __tcu_stop_timer_clock(n) ( REG_TCU_TSSR = (1 << (n)) )
3441 3474
3442#define __tcu_get_count(n) ( REG_TCU_TCNT((n)) ) 3475#define __tcu_get_count(n) ( REG_TCU_TCNT((n)) )
3443#define __tcu_set_count(n,v) ( REG_TCU_TCNT((n)) = (v) ) 3476#define __tcu_set_count(n,v) ( REG_TCU_TCNT((n)) = (v) )
3444#define __tcu_set_full_data(n,v) ( REG_TCU_TDFR((n)) = (v) ) 3477#define __tcu_set_full_data(n,v) ( REG_TCU_TDFR((n)) = (v) )
3445#define __tcu_set_half_data(n,v) ( REG_TCU_TDHR((n)) = (v) ) 3478#define __tcu_set_half_data(n,v) ( REG_TCU_TDHR((n)) = (v) )
3446 3479
3447 3480
3448/*************************************************************************** 3481/***************************************************************************
3449 * WDT 3482 * WDT
3450 ***************************************************************************/ 3483 ***************************************************************************/
3451#define __wdt_start() ( REG_WDT_TCER |= WDT_TCER_TCEN ) 3484#define __wdt_start() ( REG_WDT_TCER |= WDT_TCER_TCEN )
3452#define __wdt_stop() ( REG_WDT_TCER &= ~WDT_TCER_TCEN ) 3485#define __wdt_stop() ( REG_WDT_TCER &= ~WDT_TCER_TCEN )
3453#define __wdt_set_count(v) ( REG_WDT_TCNT = (v) ) 3486#define __wdt_set_count(v) ( REG_WDT_TCNT = (v) )
3454#define __wdt_set_data(v) ( REG_WDT_TDR = (v) ) 3487#define __wdt_set_data(v) ( REG_WDT_TDR = (v) )
3455 3488
3456#define __wdt_select_extalclk() \ 3489#define __wdt_select_extalclk() \
3457 (REG_WDT_TCSR = (REG_WDT_TCSR & ~(WDT_TCSR_EXT_EN | WDT_TCSR_RTC_EN | WDT_TCSR_PCK_EN)) | WDT_TCSR_EXT_EN) 3490 (REG_WDT_TCSR = (REG_WDT_TCSR & ~(WDT_TCSR_EXT_EN | WDT_TCSR_RTC_EN | WDT_TCSR_PCK_EN)) | WDT_TCSR_EXT_EN)
3458#define __wdt_select_rtcclk() \ 3491#define __wdt_select_rtcclk() \
3459 (REG_WDT_TCSR = (REG_WDT_TCSR & ~(WDT_TCSR_EXT_EN | WDT_TCSR_RTC_EN | WDT_TCSR_PCK_EN)) | WDT_TCSR_RTC_EN) 3492 (REG_WDT_TCSR = (REG_WDT_TCSR & ~(WDT_TCSR_EXT_EN | WDT_TCSR_RTC_EN | WDT_TCSR_PCK_EN)) | WDT_TCSR_RTC_EN)
3460#define __wdt_select_pclk() \ 3493#define __wdt_select_pclk() \
3461 (REG_WDT_TCSR = (REG_WDT_TCSR & ~(WDT_TCSR_EXT_EN | WDT_TCSR_RTC_EN | WDT_TCSR_PCK_EN)) | WDT_TCSR_PCK_EN) 3494 (REG_WDT_TCSR = (REG_WDT_TCSR & ~(WDT_TCSR_EXT_EN | WDT_TCSR_RTC_EN | WDT_TCSR_PCK_EN)) | WDT_TCSR_PCK_EN)
3462 3495
3463#define __wdt_select_clk_div1() \ 3496#define __wdt_select_clk_div1() \
3464 (REG_WDT_TCSR = (REG_WDT_TCSR & ~WDT_TCSR_PRESCALE_MASK) | WDT_TCSR_PRESCALE1) 3497 (REG_WDT_TCSR = (REG_WDT_TCSR & ~WDT_TCSR_PRESCALE_MASK) | WDT_TCSR_PRESCALE1)
3465#define __wdt_select_clk_div4() \ 3498#define __wdt_select_clk_div4() \
3466 (REG_WDT_TCSR = (REG_WDT_TCSR & ~WDT_TCSR_PRESCALE_MASK) | WDT_TCSR_PRESCALE4) 3499 (REG_WDT_TCSR = (REG_WDT_TCSR & ~WDT_TCSR_PRESCALE_MASK) | WDT_TCSR_PRESCALE4)
3467#define __wdt_select_clk_div16() \ 3500#define __wdt_select_clk_div16() \
3468 (REG_WDT_TCSR = (REG_WDT_TCSR & ~WDT_TCSR_PRESCALE_MASK) | WDT_TCSR_PRESCALE16) 3501 (REG_WDT_TCSR = (REG_WDT_TCSR & ~WDT_TCSR_PRESCALE_MASK) | WDT_TCSR_PRESCALE16)
3469#define __wdt_select_clk_div64() \ 3502#define __wdt_select_clk_div64() \
3470 (REG_WDT_TCSR = (REG_WDT_TCSR & ~WDT_TCSR_PRESCALE_MASK) | WDT_TCSR_PRESCALE64) 3503 (REG_WDT_TCSR = (REG_WDT_TCSR & ~WDT_TCSR_PRESCALE_MASK) | WDT_TCSR_PRESCALE64)
3471#define __wdt_select_clk_div256() \ 3504#define __wdt_select_clk_div256() \
3472 (REG_WDT_TCSR = (REG_WDT_TCSR & ~WDT_TCSR_PRESCALE_MASK) | WDT_TCSR_PRESCALE256) 3505 (REG_WDT_TCSR = (REG_WDT_TCSR & ~WDT_TCSR_PRESCALE_MASK) | WDT_TCSR_PRESCALE256)
3473#define __wdt_select_clk_div1024() \ 3506#define __wdt_select_clk_div1024() \
3474 (REG_WDT_TCSR = (REG_WDT_TCSR & ~WDT_TCSR_PRESCALE_MASK) | WDT_TCSR_PRESCALE1024) 3507 (REG_WDT_TCSR = (REG_WDT_TCSR & ~WDT_TCSR_PRESCALE_MASK) | WDT_TCSR_PRESCALE1024)
3475 3508
3476 3509
3477/*************************************************************************** 3510/***************************************************************************
3478 * UART 3511 * UART
3479 ***************************************************************************/ 3512 ***************************************************************************/
3480 3513
3481#define __uart_enable() ( REG8(UART0_FCR) |= UARTFCR_UUE | UARTFCR_FE ) 3514#define __uart_enable() ( REG8(UART0_FCR) |= UARTFCR_UUE | UARTFCR_FE )
3482#define __uart_disable() ( REG8(UART0_FCR) = ~UARTFCR_UUE ) 3515#define __uart_disable() ( REG8(UART0_FCR) = ~UARTFCR_UUE )
3483 3516
3484#define __uart_enable_transmit_irq() ( REG8(UART0_IER) |= UARTIER_TIE ) 3517#define __uart_enable_transmit_irq() ( REG8(UART0_IER) |= UARTIER_TIE )
3485#define __uart_disable_transmit_irq() ( REG8(UART0_IER) &= ~UARTIER_TIE ) 3518#define __uart_disable_transmit_irq() ( REG8(UART0_IER) &= ~UARTIER_TIE )
3486 3519
3487#define __uart_enable_receive_irq() \ 3520#define __uart_enable_receive_irq() \
3488 ( REG8(UART0_IER) |= UARTIER_RIE | UARTIER_RLIE | UARTIER_RTIE ) 3521 ( REG8(UART0_IER) |= UARTIER_RIE | UARTIER_RLIE | UARTIER_RTIE )
3489#define __uart_disable_receive_irq() \ 3522#define __uart_disable_receive_irq() \
3490 ( REG8(UART0_IER) &= ~(UARTIER_RIE | UARTIER_RLIE | UARTIER_RTIE) ) 3523 ( REG8(UART0_IER) &= ~(UARTIER_RIE | UARTIER_RLIE | UARTIER_RTIE) )
3491 3524
3492#define __uart_enable_loopback() ( REG8(UART0_MCR) |= UARTMCR_LOOP ) 3525#define __uart_enable_loopback() ( REG8(UART0_MCR) |= UARTMCR_LOOP )
3493#define __uart_disable_loopback() ( REG8(UART0_MCR) &= ~UARTMCR_LOOP ) 3526#define __uart_disable_loopback() ( REG8(UART0_MCR) &= ~UARTMCR_LOOP )
3494 3527
3495#define __uart_set_8n1() ( REG8(UART0_LCR) = UARTLCR_WLEN_8 ) 3528#define __uart_set_8n1() ( REG8(UART0_LCR) = UARTLCR_WLEN_8 )
3496 3529
3497#define __uart_set_baud(devclk, baud) \ 3530#define __uart_set_baud(devclk, baud) \
3498 do { \ 3531 do { \
3499 REG8(UART0_LCR) |= UARTLCR_DLAB; \ 3532 REG8(UART0_LCR) |= UARTLCR_DLAB; \
3500 REG8(UART0_DLLR) = (devclk / 16 / baud) & 0xff; \ 3533 REG8(UART0_DLLR) = (devclk / 16 / baud) & 0xff; \
3501 REG8(UART0_DLHR) = ((devclk / 16 / baud) >> 8) & 0xff; \ 3534 REG8(UART0_DLHR) = ((devclk / 16 / baud) >> 8) & 0xff; \
3502 REG8(UART0_LCR) &= ~UARTLCR_DLAB; \ 3535 REG8(UART0_LCR) &= ~UARTLCR_DLAB; \
3503 } while (0) 3536 } while (0)
3504 3537
3505#define __uart_parity_error() ( (REG8(UART0_LSR) & UARTLSR_PER) != 0 ) 3538#define __uart_parity_error() ( (REG8(UART0_LSR) & UARTLSR_PER) != 0 )
3506#define __uart_clear_errors() \ 3539#define __uart_clear_errors() \
3507 ( REG8(UART0_LSR) &= ~(UARTLSR_ORER | UARTLSR_BRK | UARTLSR_FER | UARTLSR_PER | UARTLSR_RFER) ) 3540 ( REG8(UART0_LSR) &= ~(UARTLSR_ORER | UARTLSR_BRK | UARTLSR_FER | UARTLSR_PER | UARTLSR_RFER) )
3508 3541
3509#define __uart_transmit_fifo_empty() ( (REG8(UART0_LSR) & UARTLSR_TDRQ) != 0 ) 3542#define __uart_transmit_fifo_empty() ( (REG8(UART0_LSR) & UARTLSR_TDRQ) != 0 )
3510#define __uart_transmit_end() ( (REG8(UART0_LSR) & UARTLSR_TEMT) != 0 ) 3543#define __uart_transmit_end() ( (REG8(UART0_LSR) & UARTLSR_TEMT) != 0 )
3511#define __uart_transmit_char(ch) ( REG8(UART0_TDR) = (ch) ) 3544#define __uart_transmit_char(ch) ( REG8(UART0_TDR) = (ch) )
3512#define __uart_receive_fifo_full() ( (REG8(UART0_LSR) & UARTLSR_DR) != 0 ) 3545#define __uart_receive_fifo_full() ( (REG8(UART0_LSR) & UARTLSR_DR) != 0 )
3513#define __uart_receive_ready() ( (REG8(UART0_LSR) & UARTLSR_DR) != 0 ) 3546#define __uart_receive_ready() ( (REG8(UART0_LSR) & UARTLSR_DR) != 0 )
3514#define __uart_receive_char() REG8(UART0_RDR) 3547#define __uart_receive_char() REG8(UART0_RDR)
3515#define __uart_disable_irda() ( REG8(UART0_SIRCR) &= ~(SIRCR_TSIRE | SIRCR_RSIRE) ) 3548#define __uart_disable_irda() ( REG8(UART0_SIRCR) &= ~(SIRCR_TSIRE | SIRCR_RSIRE) )
3516#define __uart_enable_irda() \ 3549#define __uart_enable_irda() \
3517 /* Tx high pulse as 0, Rx low pulse as 0 */ \ 3550 /* Tx high pulse as 0, Rx low pulse as 0 */ \
3518 ( REG8(UART0_SIRCR) = SIRCR_TSIRE | SIRCR_RSIRE | SIRCR_RXPL | SIRCR_TPWS ) 3551 ( REG8(UART0_SIRCR) = SIRCR_TSIRE | SIRCR_RSIRE | SIRCR_RXPL | SIRCR_TPWS )
@@ -3530,10 +3563,10 @@ static inline void __cpm_select_msc_hs_clk(int sd)
3530 ( REG_DMAC_DMACR &= ~DMAC_DMACR_DMAE ) 3563 ( REG_DMAC_DMACR &= ~DMAC_DMACR_DMAE )
3531 3564
3532/* p=0,1,2,3 */ 3565/* p=0,1,2,3 */
3533#define __dmac_set_priority(p) \ 3566#define __dmac_set_priority(p) \
3534do { \ 3567do { \
3535 REG_DMAC_DMACR &= ~DMAC_DMACR_PR_MASK; \ 3568 REG_DMAC_DMACR &= ~DMAC_DMACR_PR_MASK; \
3536 REG_DMAC_DMACR |= ((p) << DMAC_DMACR_PR_BIT); \ 3569 REG_DMAC_DMACR |= ((p) << DMAC_DMACR_PR_BIT); \
3537} while (0) 3570} while (0)
3538 3571
3539#define __dmac_test_halt_error() ( REG_DMAC_DMACR & DMAC_DMACR_HLT ) 3572#define __dmac_test_halt_error() ( REG_DMAC_DMACR & DMAC_DMACR_HLT )
@@ -3583,55 +3616,55 @@ do { \
3583#define __dmac_channel_set_block_mode(n) \ 3616#define __dmac_channel_set_block_mode(n) \
3584 ( REG_DMAC_DCMD((n)) |= DMAC_DCMD_TM ) 3617 ( REG_DMAC_DCMD((n)) |= DMAC_DCMD_TM )
3585 3618
3586#define __dmac_channel_set_transfer_unit_32bit(n) \ 3619#define __dmac_channel_set_transfer_unit_32bit(n) \
3587do { \ 3620do { \
3588 REG_DMAC_DCMD((n)) &= ~DMAC_DCMD_DS_MASK; \ 3621 REG_DMAC_DCMD((n)) &= ~DMAC_DCMD_DS_MASK; \
3589 REG_DMAC_DCMD((n)) |= DMAC_DCMD_DS_32BIT; \ 3622 REG_DMAC_DCMD((n)) |= DMAC_DCMD_DS_32BIT; \
3590} while (0) 3623} while (0)
3591 3624
3592#define __dmac_channel_set_transfer_unit_16bit(n) \ 3625#define __dmac_channel_set_transfer_unit_16bit(n) \
3593do { \ 3626do { \
3594 REG_DMAC_DCMD((n)) &= ~DMAC_DCMD_DS_MASK; \ 3627 REG_DMAC_DCMD((n)) &= ~DMAC_DCMD_DS_MASK; \
3595 REG_DMAC_DCMD((n)) |= DMAC_DCMD_DS_16BIT; \ 3628 REG_DMAC_DCMD((n)) |= DMAC_DCMD_DS_16BIT; \
3596} while (0) 3629} while (0)
3597 3630
3598#define __dmac_channel_set_transfer_unit_8bit(n) \ 3631#define __dmac_channel_set_transfer_unit_8bit(n) \
3599do { \ 3632do { \
3600 REG_DMAC_DCMD((n)) &= ~DMAC_DCMD_DS_MASK; \ 3633 REG_DMAC_DCMD((n)) &= ~DMAC_DCMD_DS_MASK; \
3601 REG_DMAC_DCMD((n)) |= DMAC_DCMD_DS_8BIT; \ 3634 REG_DMAC_DCMD((n)) |= DMAC_DCMD_DS_8BIT; \
3602} while (0) 3635} while (0)
3603 3636
3604#define __dmac_channel_set_transfer_unit_16byte(n) \ 3637#define __dmac_channel_set_transfer_unit_16byte(n) \
3605do { \ 3638do { \
3606 REG_DMAC_DCMD((n)) &= ~DMAC_DCMD_DS_MASK; \ 3639 REG_DMAC_DCMD((n)) &= ~DMAC_DCMD_DS_MASK; \
3607 REG_DMAC_DCMD((n)) |= DMAC_DCMD_DS_16BYTE; \ 3640 REG_DMAC_DCMD((n)) |= DMAC_DCMD_DS_16BYTE; \
3608} while (0) 3641} while (0)
3609 3642
3610#define __dmac_channel_set_transfer_unit_32byte(n) \ 3643#define __dmac_channel_set_transfer_unit_32byte(n) \
3611do { \ 3644do { \
3612 REG_DMAC_DCMD((n)) &= ~DMAC_DCMD_DS_MASK; \ 3645 REG_DMAC_DCMD((n)) &= ~DMAC_DCMD_DS_MASK; \
3613 REG_DMAC_DCMD((n)) |= DMAC_DCMD_DS_32BYTE; \ 3646 REG_DMAC_DCMD((n)) |= DMAC_DCMD_DS_32BYTE; \
3614} while (0) 3647} while (0)
3615 3648
3616/* w=8,16,32 */ 3649/* w=8,16,32 */
3617#define __dmac_channel_set_dest_port_width(n,w) \ 3650#define __dmac_channel_set_dest_port_width(n,w) \
3618do { \ 3651do { \
3619 REG_DMAC_DCMD((n)) &= ~DMAC_DCMD_DWDH_MASK; \ 3652 REG_DMAC_DCMD((n)) &= ~DMAC_DCMD_DWDH_MASK; \
3620 REG_DMAC_DCMD((n)) |= DMAC_DCMD_DWDH_##w; \ 3653 REG_DMAC_DCMD((n)) |= DMAC_DCMD_DWDH_##w; \
3621} while (0) 3654} while (0)
3622 3655
3623/* w=8,16,32 */ 3656/* w=8,16,32 */
3624#define __dmac_channel_set_src_port_width(n,w) \ 3657#define __dmac_channel_set_src_port_width(n,w) \
3625do { \ 3658do { \
3626 REG_DMAC_DCMD((n)) &= ~DMAC_DCMD_SWDH_MASK; \ 3659 REG_DMAC_DCMD((n)) &= ~DMAC_DCMD_SWDH_MASK; \
3627 REG_DMAC_DCMD((n)) |= DMAC_DCMD_SWDH_##w; \ 3660 REG_DMAC_DCMD((n)) |= DMAC_DCMD_SWDH_##w; \
3628} while (0) 3661} while (0)
3629 3662
3630/* v=0-15 */ 3663/* v=0-15 */
3631#define __dmac_channel_set_rdil(n,v) \ 3664#define __dmac_channel_set_rdil(n,v) \
3632do { \ 3665do { \
3633 REG_DMAC_DCMD((n)) &= ~DMAC_DCMD_RDIL_MASK; \ 3666 REG_DMAC_DCMD((n)) &= ~DMAC_DCMD_RDIL_MASK; \
3634 REG_DMAC_DCMD((n)) |= ((v) << DMAC_DCMD_RDIL_BIT); \ 3667 REG_DMAC_DCMD((n)) |= ((v) << DMAC_DCMD_RDIL_BIT); \
3635} while (0) 3668} while (0)
3636 3669
3637#define __dmac_channel_dest_addr_fixed(n) \ 3670#define __dmac_channel_dest_addr_fixed(n) \
@@ -3652,11 +3685,11 @@ do { \
3652 3685
3653static __inline__ int __dmac_get_irq(void) 3686static __inline__ int __dmac_get_irq(void)
3654{ 3687{
3655 int i; 3688 int i;
3656 for (i = 0; i < MAX_DMA_NUM; i++) 3689 for (i = 0; i < MAX_DMA_NUM; i++)
3657 if (__dmac_channel_irq_detected(i)) 3690 if (__dmac_channel_irq_detected(i))
3658 return i; 3691 return i;
3659 return -1; 3692 return -1;
3660} 3693}
3661 3694
3662 3695
@@ -3664,14 +3697,14 @@ static __inline__ int __dmac_get_irq(void)
3664 * AIC (AC'97 & I2S Controller) 3697 * AIC (AC'97 & I2S Controller)
3665 ***************************************************************************/ 3698 ***************************************************************************/
3666 3699
3667#define __aic_enable() ( REG_AIC_FR |= AIC_FR_ENB ) 3700#define __aic_enable() ( REG_AIC_FR |= AIC_FR_ENB )
3668#define __aic_disable() ( REG_AIC_FR &= ~AIC_FR_ENB ) 3701#define __aic_disable() ( REG_AIC_FR &= ~AIC_FR_ENB )
3669 3702
3670#define __aic_select_ac97() ( REG_AIC_FR &= ~AIC_FR_AUSEL ) 3703#define __aic_select_ac97() ( REG_AIC_FR &= ~AIC_FR_AUSEL )
3671#define __aic_select_i2s() ( REG_AIC_FR |= AIC_FR_AUSEL ) 3704#define __aic_select_i2s() ( REG_AIC_FR |= AIC_FR_AUSEL )
3672 3705
3673#define __i2s_as_master() ( REG_AIC_FR |= AIC_FR_BCKD | AIC_FR_SYNCD ) 3706#define __i2s_as_master() ( REG_AIC_FR |= AIC_FR_BCKD | AIC_FR_SYNCD )
3674#define __i2s_as_slave() ( REG_AIC_FR &= ~(AIC_FR_BCKD | AIC_FR_SYNCD) ) 3707#define __i2s_as_slave() ( REG_AIC_FR &= ~(AIC_FR_BCKD | AIC_FR_SYNCD) )
3675#define __aic_reset_status() ( REG_AIC_FR & AIC_FR_RST ) 3708#define __aic_reset_status() ( REG_AIC_FR & AIC_FR_RST )
3676 3709
3677#define __aic_reset() \ 3710#define __aic_reset() \
@@ -3680,27 +3713,27 @@ do { \
3680} while(0) 3713} while(0)
3681 3714
3682 3715
3683#define __aic_set_transmit_trigger(n) \ 3716#define __aic_set_transmit_trigger(n) \
3684do { \ 3717do { \
3685 REG_AIC_FR &= ~AIC_FR_TFTH_MASK; \ 3718 REG_AIC_FR &= ~AIC_FR_TFTH_MASK; \
3686 REG_AIC_FR |= ((n) << AIC_FR_TFTH_BIT); \ 3719 REG_AIC_FR |= ((n) << AIC_FR_TFTH_BIT); \
3687} while(0) 3720} while(0)
3688 3721
3689#define __aic_set_receive_trigger(n) \ 3722#define __aic_set_receive_trigger(n) \
3690do { \ 3723do { \
3691 REG_AIC_FR &= ~AIC_FR_RFTH_MASK; \ 3724 REG_AIC_FR &= ~AIC_FR_RFTH_MASK; \
3692 REG_AIC_FR |= ((n) << AIC_FR_RFTH_BIT); \ 3725 REG_AIC_FR |= ((n) << AIC_FR_RFTH_BIT); \
3693} while(0) 3726} while(0)
3694 3727
3695#define __aic_enable_record() ( REG_AIC_CR |= AIC_CR_EREC ) 3728#define __aic_enable_record() ( REG_AIC_CR |= AIC_CR_EREC )
3696#define __aic_disable_record() ( REG_AIC_CR &= ~AIC_CR_EREC ) 3729#define __aic_disable_record() ( REG_AIC_CR &= ~AIC_CR_EREC )
3697#define __aic_enable_replay() ( REG_AIC_CR |= AIC_CR_ERPL ) 3730#define __aic_enable_replay() ( REG_AIC_CR |= AIC_CR_ERPL )
3698#define __aic_disable_replay() ( REG_AIC_CR &= ~AIC_CR_ERPL ) 3731#define __aic_disable_replay() ( REG_AIC_CR &= ~AIC_CR_ERPL )
3699#define __aic_enable_loopback() ( REG_AIC_CR |= AIC_CR_ENLBF ) 3732#define __aic_enable_loopback() ( REG_AIC_CR |= AIC_CR_ENLBF )
3700#define __aic_disable_loopback() ( REG_AIC_CR &= ~AIC_CR_ENLBF ) 3733#define __aic_disable_loopback() ( REG_AIC_CR &= ~AIC_CR_ENLBF )
3701 3734
3702#define __aic_flush_fifo() ( REG_AIC_CR |= AIC_CR_FLUSH ) 3735#define __aic_flush_fifo() ( REG_AIC_CR |= AIC_CR_FLUSH )
3703#define __aic_unflush_fifo() ( REG_AIC_CR &= ~AIC_CR_FLUSH ) 3736#define __aic_unflush_fifo() ( REG_AIC_CR &= ~AIC_CR_FLUSH )
3704 3737
3705#define __aic_enable_transmit_intr() \ 3738#define __aic_enable_transmit_intr() \
3706 ( REG_AIC_CR |= (AIC_CR_ETFS | AIC_CR_ETUR) ) 3739 ( REG_AIC_CR |= (AIC_CR_ETFS | AIC_CR_ETUR) )
@@ -3723,59 +3756,59 @@ do { \
3723#define __aic_enable_unsignadj() ( REG_AIC_CR |= AIC_CR_AVSTSU ) 3756#define __aic_enable_unsignadj() ( REG_AIC_CR |= AIC_CR_AVSTSU )
3724#define __aic_disable_unsignadj() ( REG_AIC_CR &= ~AIC_CR_AVSTSU ) 3757#define __aic_disable_unsignadj() ( REG_AIC_CR &= ~AIC_CR_AVSTSU )
3725 3758
3726#define AC97_PCM_XS_L_FRONT AIC_ACCR1_XS_SLOT3 3759#define AC97_PCM_XS_L_FRONT AIC_ACCR1_XS_SLOT3
3727#define AC97_PCM_XS_R_FRONT AIC_ACCR1_XS_SLOT4 3760#define AC97_PCM_XS_R_FRONT AIC_ACCR1_XS_SLOT4
3728#define AC97_PCM_XS_CENTER AIC_ACCR1_XS_SLOT6 3761#define AC97_PCM_XS_CENTER AIC_ACCR1_XS_SLOT6
3729#define AC97_PCM_XS_L_SURR AIC_ACCR1_XS_SLOT7 3762#define AC97_PCM_XS_L_SURR AIC_ACCR1_XS_SLOT7
3730#define AC97_PCM_XS_R_SURR AIC_ACCR1_XS_SLOT8 3763#define AC97_PCM_XS_R_SURR AIC_ACCR1_XS_SLOT8
3731#define AC97_PCM_XS_LFE AIC_ACCR1_XS_SLOT9 3764#define AC97_PCM_XS_LFE AIC_ACCR1_XS_SLOT9
3732 3765
3733#define AC97_PCM_RS_L_FRONT AIC_ACCR1_RS_SLOT3 3766#define AC97_PCM_RS_L_FRONT AIC_ACCR1_RS_SLOT3
3734#define AC97_PCM_RS_R_FRONT AIC_ACCR1_RS_SLOT4 3767#define AC97_PCM_RS_R_FRONT AIC_ACCR1_RS_SLOT4
3735#define AC97_PCM_RS_CENTER AIC_ACCR1_RS_SLOT6 3768#define AC97_PCM_RS_CENTER AIC_ACCR1_RS_SLOT6
3736#define AC97_PCM_RS_L_SURR AIC_ACCR1_RS_SLOT7 3769#define AC97_PCM_RS_L_SURR AIC_ACCR1_RS_SLOT7
3737#define AC97_PCM_RS_R_SURR AIC_ACCR1_RS_SLOT8 3770#define AC97_PCM_RS_R_SURR AIC_ACCR1_RS_SLOT8
3738#define AC97_PCM_RS_LFE AIC_ACCR1_RS_SLOT9 3771#define AC97_PCM_RS_LFE AIC_ACCR1_RS_SLOT9
3739 3772
3740#define __ac97_set_xs_none() ( REG_AIC_ACCR1 &= ~AIC_ACCR1_XS_MASK ) 3773#define __ac97_set_xs_none() ( REG_AIC_ACCR1 &= ~AIC_ACCR1_XS_MASK )
3741#define __ac97_set_xs_mono() \ 3774#define __ac97_set_xs_mono() \
3742do { \ 3775do { \
3743 REG_AIC_ACCR1 &= ~AIC_ACCR1_XS_MASK; \ 3776 REG_AIC_ACCR1 &= ~AIC_ACCR1_XS_MASK; \
3744 REG_AIC_ACCR1 |= AC97_PCM_XS_R_FRONT; \ 3777 REG_AIC_ACCR1 |= AC97_PCM_XS_R_FRONT; \
3745} while(0) 3778} while(0)
3746#define __ac97_set_xs_stereo() \ 3779#define __ac97_set_xs_stereo() \
3747do { \ 3780do { \
3748 REG_AIC_ACCR1 &= ~AIC_ACCR1_XS_MASK; \ 3781 REG_AIC_ACCR1 &= ~AIC_ACCR1_XS_MASK; \
3749 REG_AIC_ACCR1 |= AC97_PCM_XS_L_FRONT | AC97_PCM_XS_R_FRONT; \ 3782 REG_AIC_ACCR1 |= AC97_PCM_XS_L_FRONT | AC97_PCM_XS_R_FRONT; \
3750} while(0) 3783} while(0)
3751 3784
3752/* In fact, only stereo is support now. */ 3785/* In fact, only stereo is support now. */
3753#define __ac97_set_rs_none() ( REG_AIC_ACCR1 &= ~AIC_ACCR1_RS_MASK ) 3786#define __ac97_set_rs_none() ( REG_AIC_ACCR1 &= ~AIC_ACCR1_RS_MASK )
3754#define __ac97_set_rs_mono() \ 3787#define __ac97_set_rs_mono() \
3755do { \ 3788do { \
3756 REG_AIC_ACCR1 &= ~AIC_ACCR1_RS_MASK; \ 3789 REG_AIC_ACCR1 &= ~AIC_ACCR1_RS_MASK; \
3757 REG_AIC_ACCR1 |= AC97_PCM_RS_R_FRONT; \ 3790 REG_AIC_ACCR1 |= AC97_PCM_RS_R_FRONT; \
3758} while(0) 3791} while(0)
3759#define __ac97_set_rs_stereo() \ 3792#define __ac97_set_rs_stereo() \
3760do { \ 3793do { \
3761 REG_AIC_ACCR1 &= ~AIC_ACCR1_RS_MASK; \ 3794 REG_AIC_ACCR1 &= ~AIC_ACCR1_RS_MASK; \
3762 REG_AIC_ACCR1 |= AC97_PCM_RS_L_FRONT | AC97_PCM_RS_R_FRONT; \ 3795 REG_AIC_ACCR1 |= AC97_PCM_RS_L_FRONT | AC97_PCM_RS_R_FRONT; \
3763} while(0) 3796} while(0)
3764 3797
3765#define __ac97_warm_reset_codec() \ 3798#define __ac97_warm_reset_codec() \
3766 do { \ 3799 do { \
3767 REG_AIC_ACCR2 |= AIC_ACCR2_SA; \ 3800 REG_AIC_ACCR2 |= AIC_ACCR2_SA; \
3768 REG_AIC_ACCR2 |= AIC_ACCR2_SS; \ 3801 REG_AIC_ACCR2 |= AIC_ACCR2_SS; \
3769 udelay(2); \ 3802 udelay(2); \
3770 REG_AIC_ACCR2 &= ~AIC_ACCR2_SS; \ 3803 REG_AIC_ACCR2 &= ~AIC_ACCR2_SS; \
3771 REG_AIC_ACCR2 &= ~AIC_ACCR2_SA; \ 3804 REG_AIC_ACCR2 &= ~AIC_ACCR2_SA; \
3772 } while (0) 3805 } while (0)
3773 3806
3774#define __ac97_cold_reset_codec() \ 3807#define __ac97_cold_reset_codec() \
3775 do { \ 3808 do { \
3776 REG_AIC_ACCR2 |= AIC_ACCR2_SR; \ 3809 REG_AIC_ACCR2 |= AIC_ACCR2_SR; \
3777 udelay(2); \ 3810 udelay(2); \
3778 REG_AIC_ACCR2 &= ~AIC_ACCR2_SR; \ 3811 REG_AIC_ACCR2 &= ~AIC_ACCR2_SR; \
3779 } while (0) 3812 } while (0)
3780 3813
3781/* n=8,16,18,20 */ 3814/* n=8,16,18,20 */
@@ -3821,26 +3854,26 @@ do { \
3821 3854
3822#define __i2s_is_busy() ( REG_AIC_I2SSR & AIC_I2SSR_BSY ) 3855#define __i2s_is_busy() ( REG_AIC_I2SSR & AIC_I2SSR_BSY )
3823 3856
3824#define CODEC_READ_CMD (1 << 19) 3857#define CODEC_READ_CMD (1 << 19)
3825#define CODEC_WRITE_CMD (0 << 19) 3858#define CODEC_WRITE_CMD (0 << 19)
3826#define CODEC_REG_INDEX_BIT 12 3859#define CODEC_REG_INDEX_BIT 12
3827#define CODEC_REG_INDEX_MASK (0x7f << CODEC_REG_INDEX_BIT) /* 18:12 */ 3860#define CODEC_REG_INDEX_MASK (0x7f << CODEC_REG_INDEX_BIT) /* 18:12 */
3828#define CODEC_REG_DATA_BIT 4 3861#define CODEC_REG_DATA_BIT 4
3829#define CODEC_REG_DATA_MASK (0x0ffff << 4) /* 19:4 */ 3862#define CODEC_REG_DATA_MASK (0x0ffff << 4) /* 19:4 */
3830 3863
3831#define __ac97_out_rcmd_addr(reg) \ 3864#define __ac97_out_rcmd_addr(reg) \
3832do { \ 3865do { \
3833 REG_AIC_ACCAR = CODEC_READ_CMD | ((reg) << CODEC_REG_INDEX_BIT); \ 3866 REG_AIC_ACCAR = CODEC_READ_CMD | ((reg) << CODEC_REG_INDEX_BIT); \
3834} while (0) 3867} while (0)
3835 3868
3836#define __ac97_out_wcmd_addr(reg) \ 3869#define __ac97_out_wcmd_addr(reg) \
3837do { \ 3870do { \
3838 REG_AIC_ACCAR = CODEC_WRITE_CMD | ((reg) << CODEC_REG_INDEX_BIT); \ 3871 REG_AIC_ACCAR = CODEC_WRITE_CMD | ((reg) << CODEC_REG_INDEX_BIT); \
3839} while (0) 3872} while (0)
3840 3873
3841#define __ac97_out_data(value) \ 3874#define __ac97_out_data(value) \
3842do { \ 3875do { \
3843 REG_AIC_ACCDR = ((value) << CODEC_REG_DATA_BIT); \ 3876 REG_AIC_ACCDR = ((value) << CODEC_REG_DATA_BIT); \
3844} while (0) 3877} while (0)
3845 3878
3846#define __ac97_in_data() \ 3879#define __ac97_in_data() \
@@ -3858,96 +3891,96 @@ do { \
3858#define __aic_internal_codec() ( REG_AIC_FR |= AIC_FR_ICDC ) 3891#define __aic_internal_codec() ( REG_AIC_FR |= AIC_FR_ICDC )
3859#define __aic_external_codec() ( REG_AIC_FR &= ~AIC_FR_ICDC ) 3892#define __aic_external_codec() ( REG_AIC_FR &= ~AIC_FR_ICDC )
3860 3893
3861#define AIC_FR_LSMP (1 << 6) 3894#define AIC_FR_LSMP (1 << 6)
3862#define __aic_play_lastsample() ( REG_AIC_FR |= AIC_FR_LSMP ) 3895#define __aic_play_lastsample() ( REG_AIC_FR |= AIC_FR_LSMP )
3863// 3896//
3864// Define next ops for AC97 compatible 3897// Define next ops for AC97 compatible
3865// 3898//
3866 3899
3867#define AC97_ACSR AIC_ACSR 3900#define AC97_ACSR AIC_ACSR
3868 3901
3869#define __ac97_enable() __aic_enable(); __aic_select_ac97() 3902#define __ac97_enable() __aic_enable(); __aic_select_ac97()
3870#define __ac97_disable() __aic_disable() 3903#define __ac97_disable() __aic_disable()
3871#define __ac97_reset() __aic_reset() 3904#define __ac97_reset() __aic_reset()
3872 3905
3873#define __ac97_set_transmit_trigger(n) __aic_set_transmit_trigger(n) 3906#define __ac97_set_transmit_trigger(n) __aic_set_transmit_trigger(n)
3874#define __ac97_set_receive_trigger(n) __aic_set_receive_trigger(n) 3907#define __ac97_set_receive_trigger(n) __aic_set_receive_trigger(n)
3875 3908
3876#define __ac97_enable_record() __aic_enable_record() 3909#define __ac97_enable_record() __aic_enable_record()
3877#define __ac97_disable_record() __aic_disable_record() 3910#define __ac97_disable_record() __aic_disable_record()
3878#define __ac97_enable_replay() __aic_enable_replay() 3911#define __ac97_enable_replay() __aic_enable_replay()
3879#define __ac97_disable_replay() __aic_disable_replay() 3912#define __ac97_disable_replay() __aic_disable_replay()
3880#define __ac97_enable_loopback() __aic_enable_loopback() 3913#define __ac97_enable_loopback() __aic_enable_loopback()
3881#define __ac97_disable_loopback() __aic_disable_loopback() 3914#define __ac97_disable_loopback() __aic_disable_loopback()
3882 3915
3883#define __ac97_enable_transmit_dma() __aic_enable_transmit_dma() 3916#define __ac97_enable_transmit_dma() __aic_enable_transmit_dma()
3884#define __ac97_disable_transmit_dma() __aic_disable_transmit_dma() 3917#define __ac97_disable_transmit_dma() __aic_disable_transmit_dma()
3885#define __ac97_enable_receive_dma() __aic_enable_receive_dma() 3918#define __ac97_enable_receive_dma() __aic_enable_receive_dma()
3886#define __ac97_disable_receive_dma() __aic_disable_receive_dma() 3919#define __ac97_disable_receive_dma() __aic_disable_receive_dma()
3887 3920
3888#define __ac97_transmit_request() __aic_transmit_request() 3921#define __ac97_transmit_request() __aic_transmit_request()
3889#define __ac97_receive_request() __aic_receive_request() 3922#define __ac97_receive_request() __aic_receive_request()
3890#define __ac97_transmit_underrun() __aic_transmit_underrun() 3923#define __ac97_transmit_underrun() __aic_transmit_underrun()
3891#define __ac97_receive_overrun() __aic_receive_overrun() 3924#define __ac97_receive_overrun() __aic_receive_overrun()
3892 3925
3893#define __ac97_clear_errors() __aic_clear_errors() 3926#define __ac97_clear_errors() __aic_clear_errors()
3894 3927
3895#define __ac97_get_transmit_resident() __aic_get_transmit_resident() 3928#define __ac97_get_transmit_resident() __aic_get_transmit_resident()
3896#define __ac97_get_receive_count() __aic_get_receive_count() 3929#define __ac97_get_receive_count() __aic_get_receive_count()
3897 3930
3898#define __ac97_enable_transmit_intr() __aic_enable_transmit_intr() 3931#define __ac97_enable_transmit_intr() __aic_enable_transmit_intr()
3899#define __ac97_disable_transmit_intr() __aic_disable_transmit_intr() 3932#define __ac97_disable_transmit_intr() __aic_disable_transmit_intr()
3900#define __ac97_enable_receive_intr() __aic_enable_receive_intr() 3933#define __ac97_enable_receive_intr() __aic_enable_receive_intr()
3901#define __ac97_disable_receive_intr() __aic_disable_receive_intr() 3934#define __ac97_disable_receive_intr() __aic_disable_receive_intr()
3902 3935
3903#define __ac97_write_tfifo(v) __aic_write_tfifo(v) 3936#define __ac97_write_tfifo(v) __aic_write_tfifo(v)
3904#define __ac97_read_rfifo() __aic_read_rfifo() 3937#define __ac97_read_rfifo() __aic_read_rfifo()
3905 3938
3906// 3939//
3907// Define next ops for I2S compatible 3940// Define next ops for I2S compatible
3908// 3941//
3909 3942
3910#define I2S_ACSR AIC_I2SSR 3943#define I2S_ACSR AIC_I2SSR
3911 3944
3912#define __i2s_enable() __aic_enable(); __aic_select_i2s() 3945#define __i2s_enable() __aic_enable(); __aic_select_i2s()
3913#define __i2s_disable() __aic_disable() 3946#define __i2s_disable() __aic_disable()
3914#define __i2s_reset() __aic_reset() 3947#define __i2s_reset() __aic_reset()
3915 3948
3916#define __i2s_set_transmit_trigger(n) __aic_set_transmit_trigger(n) 3949#define __i2s_set_transmit_trigger(n) __aic_set_transmit_trigger(n)
3917#define __i2s_set_receive_trigger(n) __aic_set_receive_trigger(n) 3950#define __i2s_set_receive_trigger(n) __aic_set_receive_trigger(n)
3918 3951
3919#define __i2s_enable_record() __aic_enable_record() 3952#define __i2s_enable_record() __aic_enable_record()
3920#define __i2s_disable_record() __aic_disable_record() 3953#define __i2s_disable_record() __aic_disable_record()
3921#define __i2s_enable_replay() __aic_enable_replay() 3954#define __i2s_enable_replay() __aic_enable_replay()
3922#define __i2s_disable_replay() __aic_disable_replay() 3955#define __i2s_disable_replay() __aic_disable_replay()
3923#define __i2s_enable_loopback() __aic_enable_loopback() 3956#define __i2s_enable_loopback() __aic_enable_loopback()
3924#define __i2s_disable_loopback() __aic_disable_loopback() 3957#define __i2s_disable_loopback() __aic_disable_loopback()
3925 3958
3926#define __i2s_enable_transmit_dma() __aic_enable_transmit_dma() 3959#define __i2s_enable_transmit_dma() __aic_enable_transmit_dma()
3927#define __i2s_disable_transmit_dma() __aic_disable_transmit_dma() 3960#define __i2s_disable_transmit_dma() __aic_disable_transmit_dma()
3928#define __i2s_enable_receive_dma() __aic_enable_receive_dma() 3961#define __i2s_enable_receive_dma() __aic_enable_receive_dma()
3929#define __i2s_disable_receive_dma() __aic_disable_receive_dma() 3962#define __i2s_disable_receive_dma() __aic_disable_receive_dma()
3930 3963
3931#define __i2s_transmit_request() __aic_transmit_request() 3964#define __i2s_transmit_request() __aic_transmit_request()
3932#define __i2s_receive_request() __aic_receive_request() 3965#define __i2s_receive_request() __aic_receive_request()
3933#define __i2s_transmit_underrun() __aic_transmit_underrun() 3966#define __i2s_transmit_underrun() __aic_transmit_underrun()
3934#define __i2s_receive_overrun() __aic_receive_overrun() 3967#define __i2s_receive_overrun() __aic_receive_overrun()
3935 3968
3936#define __i2s_clear_errors() __aic_clear_errors() 3969#define __i2s_clear_errors() __aic_clear_errors()
3937 3970
3938#define __i2s_get_transmit_resident() __aic_get_transmit_resident() 3971#define __i2s_get_transmit_resident() __aic_get_transmit_resident()
3939#define __i2s_get_receive_count() __aic_get_receive_count() 3972#define __i2s_get_receive_count() __aic_get_receive_count()
3940 3973
3941#define __i2s_enable_transmit_intr() __aic_enable_transmit_intr() 3974#define __i2s_enable_transmit_intr() __aic_enable_transmit_intr()
3942#define __i2s_disable_transmit_intr() __aic_disable_transmit_intr() 3975#define __i2s_disable_transmit_intr() __aic_disable_transmit_intr()
3943#define __i2s_enable_receive_intr() __aic_enable_receive_intr() 3976#define __i2s_enable_receive_intr() __aic_enable_receive_intr()
3944#define __i2s_disable_receive_intr() __aic_disable_receive_intr() 3977#define __i2s_disable_receive_intr() __aic_disable_receive_intr()
3945 3978
3946#define __i2s_write_tfifo(v) __aic_write_tfifo(v) 3979#define __i2s_write_tfifo(v) __aic_write_tfifo(v)
3947#define __i2s_read_rfifo() __aic_read_rfifo() 3980#define __i2s_read_rfifo() __aic_read_rfifo()
3948 3981
3949#define __i2s_reset_codec() \ 3982#define __i2s_reset_codec() \
3950 do { \ 3983 do { \
3951 } while (0) 3984 } while (0)
3952 3985
3953 3986
@@ -3960,36 +3993,36 @@ do { \
3960/*************************************************************************** 3993/***************************************************************************
3961 * INTC 3994 * INTC
3962 ***************************************************************************/ 3995 ***************************************************************************/
3963#define __intc_unmask_irq(n) ( REG_INTC_IMCR = (1 << (n)) ) 3996#define __intc_unmask_irq(n) ( REG_INTC_IMCR = (1 << (n)) )
3964#define __intc_mask_irq(n) ( REG_INTC_IMSR = (1 << (n)) ) 3997#define __intc_mask_irq(n) ( REG_INTC_IMSR = (1 << (n)) )
3965#define __intc_ack_irq(n) ( REG_INTC_IPR = (1 << (n)) ) 3998#define __intc_ack_irq(n) ( REG_INTC_IPR = (1 << (n)) )
3966 3999
3967 4000
3968/*************************************************************************** 4001/***************************************************************************
3969 * I2C 4002 * I2C
3970 ***************************************************************************/ 4003 ***************************************************************************/
3971 4004
3972#define __i2c_enable() ( REG_I2C_CR |= I2C_CR_I2CE ) 4005#define __i2c_enable() ( REG_I2C_CR |= I2C_CR_I2CE )
3973#define __i2c_disable() ( REG_I2C_CR &= ~I2C_CR_I2CE ) 4006#define __i2c_disable() ( REG_I2C_CR &= ~I2C_CR_I2CE )
3974 4007
3975#define __i2c_send_start() ( REG_I2C_CR |= I2C_CR_STA ) 4008#define __i2c_send_start() ( REG_I2C_CR |= I2C_CR_STA )
3976#define __i2c_send_stop() ( REG_I2C_CR |= I2C_CR_STO ) 4009#define __i2c_send_stop() ( REG_I2C_CR |= I2C_CR_STO )
3977#define __i2c_send_ack() ( REG_I2C_CR &= ~I2C_CR_AC ) 4010#define __i2c_send_ack() ( REG_I2C_CR &= ~I2C_CR_AC )
3978#define __i2c_send_nack() ( REG_I2C_CR |= I2C_CR_AC ) 4011#define __i2c_send_nack() ( REG_I2C_CR |= I2C_CR_AC )
3979 4012
3980#define __i2c_set_drf() ( REG_I2C_SR |= I2C_SR_DRF ) 4013#define __i2c_set_drf() ( REG_I2C_SR |= I2C_SR_DRF )
3981#define __i2c_clear_drf() ( REG_I2C_SR &= ~I2C_SR_DRF ) 4014#define __i2c_clear_drf() ( REG_I2C_SR &= ~I2C_SR_DRF )
3982#define __i2c_check_drf() ( REG_I2C_SR & I2C_SR_DRF ) 4015#define __i2c_check_drf() ( REG_I2C_SR & I2C_SR_DRF )
3983 4016
3984#define __i2c_received_ack() ( !(REG_I2C_SR & I2C_SR_ACKF) ) 4017#define __i2c_received_ack() ( !(REG_I2C_SR & I2C_SR_ACKF) )
3985#define __i2c_is_busy() ( REG_I2C_SR & I2C_SR_BUSY ) 4018#define __i2c_is_busy() ( REG_I2C_SR & I2C_SR_BUSY )
3986#define __i2c_transmit_ended() ( REG_I2C_SR & I2C_SR_TEND ) 4019#define __i2c_transmit_ended() ( REG_I2C_SR & I2C_SR_TEND )
3987 4020
3988#define __i2c_set_clk(dev_clk, i2c_clk) \ 4021#define __i2c_set_clk(dev_clk, i2c_clk) \
3989 ( REG_I2C_GR = (dev_clk) / (16*(i2c_clk)) - 1 ) 4022 ( REG_I2C_GR = (dev_clk) / (16*(i2c_clk)) - 1 )
3990 4023
3991#define __i2c_read() ( REG_I2C_DR ) 4024#define __i2c_read() ( REG_I2C_DR )
3992#define __i2c_write(val) ( REG_I2C_DR = (val) ) 4025#define __i2c_write(val) ( REG_I2C_DR = (val) )
3993 4026
3994 4027
3995/*************************************************************************** 4028/***************************************************************************
@@ -3999,43 +4032,43 @@ do { \
3999#define __msc_start_op() \ 4032#define __msc_start_op() \
4000 ( REG_MSC_STRPCL = MSC_STRPCL_START_OP | MSC_STRPCL_CLOCK_CONTROL_START ) 4033 ( REG_MSC_STRPCL = MSC_STRPCL_START_OP | MSC_STRPCL_CLOCK_CONTROL_START )
4001 4034
4002#define __msc_set_resto(to) ( REG_MSC_RESTO = to ) 4035#define __msc_set_resto(to) ( REG_MSC_RESTO = to )
4003#define __msc_set_rdto(to) ( REG_MSC_RDTO = to ) 4036#define __msc_set_rdto(to) ( REG_MSC_RDTO = to )
4004#define __msc_set_cmd(cmd) ( REG_MSC_CMD = cmd ) 4037#define __msc_set_cmd(cmd) ( REG_MSC_CMD = cmd )
4005#define __msc_set_arg(arg) ( REG_MSC_ARG = arg ) 4038#define __msc_set_arg(arg) ( REG_MSC_ARG = arg )
4006#define __msc_set_nob(nob) ( REG_MSC_NOB = nob ) 4039#define __msc_set_nob(nob) ( REG_MSC_NOB = nob )
4007#define __msc_get_nob() ( REG_MSC_NOB ) 4040#define __msc_get_nob() ( REG_MSC_NOB )
4008#define __msc_set_blklen(len) ( REG_MSC_BLKLEN = len ) 4041#define __msc_set_blklen(len) ( REG_MSC_BLKLEN = len )
4009#define __msc_set_cmdat(cmdat) ( REG_MSC_CMDAT = cmdat ) 4042#define __msc_set_cmdat(cmdat) ( REG_MSC_CMDAT = cmdat )
4010#define __msc_set_cmdat_ioabort() ( REG_MSC_CMDAT |= MSC_CMDAT_IO_ABORT ) 4043#define __msc_set_cmdat_ioabort() ( REG_MSC_CMDAT |= MSC_CMDAT_IO_ABORT )
4011#define __msc_clear_cmdat_ioabort() ( REG_MSC_CMDAT &= ~MSC_CMDAT_IO_ABORT ) 4044#define __msc_clear_cmdat_ioabort() ( REG_MSC_CMDAT &= ~MSC_CMDAT_IO_ABORT )
4012 4045
4013#define __msc_set_cmdat_bus_width1() \ 4046#define __msc_set_cmdat_bus_width1() \
4014do { \ 4047do { \
4015 REG_MSC_CMDAT &= ~MSC_CMDAT_BUS_WIDTH_MASK; \ 4048 REG_MSC_CMDAT &= ~MSC_CMDAT_BUS_WIDTH_MASK; \
4016 REG_MSC_CMDAT |= MSC_CMDAT_BUS_WIDTH_1BIT; \ 4049 REG_MSC_CMDAT |= MSC_CMDAT_BUS_WIDTH_1BIT; \
4017} while(0) 4050} while(0)
4018 4051
4019#define __msc_set_cmdat_bus_width4() \ 4052#define __msc_set_cmdat_bus_width4() \
4020do { \ 4053do { \
4021 REG_MSC_CMDAT &= ~MSC_CMDAT_BUS_WIDTH_MASK; \ 4054 REG_MSC_CMDAT &= ~MSC_CMDAT_BUS_WIDTH_MASK; \
4022 REG_MSC_CMDAT |= MSC_CMDAT_BUS_WIDTH_4BIT; \ 4055 REG_MSC_CMDAT |= MSC_CMDAT_BUS_WIDTH_4BIT; \
4023} while(0) 4056} while(0)
4024 4057
4025#define __msc_set_cmdat_dma_en() ( REG_MSC_CMDAT |= MSC_CMDAT_DMA_EN ) 4058#define __msc_set_cmdat_dma_en() ( REG_MSC_CMDAT |= MSC_CMDAT_DMA_EN )
4026#define __msc_set_cmdat_init() ( REG_MSC_CMDAT |= MSC_CMDAT_INIT ) 4059#define __msc_set_cmdat_init() ( REG_MSC_CMDAT |= MSC_CMDAT_INIT )
4027#define __msc_set_cmdat_busy() ( REG_MSC_CMDAT |= MSC_CMDAT_BUSY ) 4060#define __msc_set_cmdat_busy() ( REG_MSC_CMDAT |= MSC_CMDAT_BUSY )
4028#define __msc_set_cmdat_stream() ( REG_MSC_CMDAT |= MSC_CMDAT_STREAM_BLOCK ) 4061#define __msc_set_cmdat_stream() ( REG_MSC_CMDAT |= MSC_CMDAT_STREAM_BLOCK )
4029#define __msc_set_cmdat_block() ( REG_MSC_CMDAT &= ~MSC_CMDAT_STREAM_BLOCK ) 4062#define __msc_set_cmdat_block() ( REG_MSC_CMDAT &= ~MSC_CMDAT_STREAM_BLOCK )
4030#define __msc_set_cmdat_read() ( REG_MSC_CMDAT &= ~MSC_CMDAT_WRITE_READ ) 4063#define __msc_set_cmdat_read() ( REG_MSC_CMDAT &= ~MSC_CMDAT_WRITE_READ )
4031#define __msc_set_cmdat_write() ( REG_MSC_CMDAT |= MSC_CMDAT_WRITE_READ ) 4064#define __msc_set_cmdat_write() ( REG_MSC_CMDAT |= MSC_CMDAT_WRITE_READ )
4032#define __msc_set_cmdat_data_en() ( REG_MSC_CMDAT |= MSC_CMDAT_DATA_EN ) 4065#define __msc_set_cmdat_data_en() ( REG_MSC_CMDAT |= MSC_CMDAT_DATA_EN )
4033 4066
4034/* r is MSC_CMDAT_RESPONSE_FORMAT_Rx or MSC_CMDAT_RESPONSE_FORMAT_NONE */ 4067/* r is MSC_CMDAT_RESPONSE_FORMAT_Rx or MSC_CMDAT_RESPONSE_FORMAT_NONE */
4035#define __msc_set_cmdat_res_format(r) \ 4068#define __msc_set_cmdat_res_format(r) \
4036do { \ 4069do { \
4037 REG_MSC_CMDAT &= ~MSC_CMDAT_RESPONSE_FORMAT_MASK; \ 4070 REG_MSC_CMDAT &= ~MSC_CMDAT_RESPONSE_FORMAT_MASK; \
4038 REG_MSC_CMDAT |= (r); \ 4071 REG_MSC_CMDAT |= (r); \
4039} while(0) 4072} while(0)
4040 4073
4041#define __msc_clear_cmdat() \ 4074#define __msc_clear_cmdat() \
@@ -4043,98 +4076,98 @@ do { \
4043 MSC_CMDAT_BUSY | MSC_CMDAT_STREAM_BLOCK | MSC_CMDAT_WRITE_READ | \ 4076 MSC_CMDAT_BUSY | MSC_CMDAT_STREAM_BLOCK | MSC_CMDAT_WRITE_READ | \
4044 MSC_CMDAT_DATA_EN | MSC_CMDAT_RESPONSE_FORMAT_MASK ) 4077 MSC_CMDAT_DATA_EN | MSC_CMDAT_RESPONSE_FORMAT_MASK )
4045 4078
4046#define __msc_get_imask() ( REG_MSC_IMASK ) 4079#define __msc_get_imask() ( REG_MSC_IMASK )
4047#define __msc_mask_all_intrs() ( REG_MSC_IMASK = 0xff ) 4080#define __msc_mask_all_intrs() ( REG_MSC_IMASK = 0xff )
4048#define __msc_unmask_all_intrs() ( REG_MSC_IMASK = 0x00 ) 4081#define __msc_unmask_all_intrs() ( REG_MSC_IMASK = 0x00 )
4049#define __msc_mask_rd() ( REG_MSC_IMASK |= MSC_IMASK_RXFIFO_RD_REQ ) 4082#define __msc_mask_rd() ( REG_MSC_IMASK |= MSC_IMASK_RXFIFO_RD_REQ )
4050#define __msc_unmask_rd() ( REG_MSC_IMASK &= ~MSC_IMASK_RXFIFO_RD_REQ ) 4083#define __msc_unmask_rd() ( REG_MSC_IMASK &= ~MSC_IMASK_RXFIFO_RD_REQ )
4051#define __msc_mask_wr() ( REG_MSC_IMASK |= MSC_IMASK_TXFIFO_WR_REQ ) 4084#define __msc_mask_wr() ( REG_MSC_IMASK |= MSC_IMASK_TXFIFO_WR_REQ )
4052#define __msc_unmask_wr() ( REG_MSC_IMASK &= ~MSC_IMASK_TXFIFO_WR_REQ ) 4085#define __msc_unmask_wr() ( REG_MSC_IMASK &= ~MSC_IMASK_TXFIFO_WR_REQ )
4053#define __msc_mask_endcmdres() ( REG_MSC_IMASK |= MSC_IMASK_END_CMD_RES ) 4086#define __msc_mask_endcmdres() ( REG_MSC_IMASK |= MSC_IMASK_END_CMD_RES )
4054#define __msc_unmask_endcmdres() ( REG_MSC_IMASK &= ~MSC_IMASK_END_CMD_RES ) 4087#define __msc_unmask_endcmdres() ( REG_MSC_IMASK &= ~MSC_IMASK_END_CMD_RES )
4055#define __msc_mask_datatrandone() ( REG_MSC_IMASK |= MSC_IMASK_DATA_TRAN_DONE ) 4088#define __msc_mask_datatrandone() ( REG_MSC_IMASK |= MSC_IMASK_DATA_TRAN_DONE )
4056#define __msc_unmask_datatrandone() ( REG_MSC_IMASK &= ~MSC_IMASK_DATA_TRAN_DONE ) 4089#define __msc_unmask_datatrandone() ( REG_MSC_IMASK &= ~MSC_IMASK_DATA_TRAN_DONE )
4057#define __msc_mask_prgdone() ( REG_MSC_IMASK |= MSC_IMASK_PRG_DONE ) 4090#define __msc_mask_prgdone() ( REG_MSC_IMASK |= MSC_IMASK_PRG_DONE )
4058#define __msc_unmask_prgdone() ( REG_MSC_IMASK &= ~MSC_IMASK_PRG_DONE ) 4091#define __msc_unmask_prgdone() ( REG_MSC_IMASK &= ~MSC_IMASK_PRG_DONE )
4059 4092
4060/* n=0,1,2,3,4,5,6,7 */ 4093/* n=0,1,2,3,4,5,6,7 */
4061#define __msc_set_clkrt(n) \ 4094#define __msc_set_clkrt(n) \
4062do { \ 4095do { \
4063 REG_MSC_CLKRT = n; \ 4096 REG_MSC_CLKRT = n; \
4064} while(0) 4097} while(0)
4065 4098
4066#define __msc_get_ireg() ( REG_MSC_IREG ) 4099#define __msc_get_ireg() ( REG_MSC_IREG )
4067#define __msc_ireg_rd() ( REG_MSC_IREG & MSC_IREG_RXFIFO_RD_REQ ) 4100#define __msc_ireg_rd() ( REG_MSC_IREG & MSC_IREG_RXFIFO_RD_REQ )
4068#define __msc_ireg_wr() ( REG_MSC_IREG & MSC_IREG_TXFIFO_WR_REQ ) 4101#define __msc_ireg_wr() ( REG_MSC_IREG & MSC_IREG_TXFIFO_WR_REQ )
4069#define __msc_ireg_end_cmd_res() ( REG_MSC_IREG & MSC_IREG_END_CMD_RES ) 4102#define __msc_ireg_end_cmd_res() ( REG_MSC_IREG & MSC_IREG_END_CMD_RES )
4070#define __msc_ireg_data_tran_done() ( REG_MSC_IREG & MSC_IREG_DATA_TRAN_DONE ) 4103#define __msc_ireg_data_tran_done() ( REG_MSC_IREG & MSC_IREG_DATA_TRAN_DONE )
4071#define __msc_ireg_prg_done() ( REG_MSC_IREG & MSC_IREG_PRG_DONE ) 4104#define __msc_ireg_prg_done() ( REG_MSC_IREG & MSC_IREG_PRG_DONE )
4072#define __msc_ireg_clear_end_cmd_res() ( REG_MSC_IREG = MSC_IREG_END_CMD_RES ) 4105#define __msc_ireg_clear_end_cmd_res() ( REG_MSC_IREG = MSC_IREG_END_CMD_RES )
4073#define __msc_ireg_clear_data_tran_done() ( REG_MSC_IREG = MSC_IREG_DATA_TRAN_DONE ) 4106#define __msc_ireg_clear_data_tran_done() ( REG_MSC_IREG = MSC_IREG_DATA_TRAN_DONE )
4074#define __msc_ireg_clear_prg_done() ( REG_MSC_IREG = MSC_IREG_PRG_DONE ) 4107#define __msc_ireg_clear_prg_done() ( REG_MSC_IREG = MSC_IREG_PRG_DONE )
4075 4108
4076#define __msc_get_stat() ( REG_MSC_STAT ) 4109#define __msc_get_stat() ( REG_MSC_STAT )
4077#define __msc_stat_not_end_cmd_res() ( (REG_MSC_STAT & MSC_STAT_END_CMD_RES) == 0) 4110#define __msc_stat_not_end_cmd_res() ( (REG_MSC_STAT & MSC_STAT_END_CMD_RES) == 0)
4078#define __msc_stat_crc_err() \ 4111#define __msc_stat_crc_err() \
4079 ( REG_MSC_STAT & (MSC_STAT_CRC_RES_ERR | MSC_STAT_CRC_READ_ERROR | MSC_STAT_CRC_WRITE_ERROR_YES) ) 4112 ( REG_MSC_STAT & (MSC_STAT_CRC_RES_ERR | MSC_STAT_CRC_READ_ERROR | MSC_STAT_CRC_WRITE_ERROR_YES) )
4080#define __msc_stat_res_crc_err() ( REG_MSC_STAT & MSC_STAT_CRC_RES_ERR ) 4113#define __msc_stat_res_crc_err() ( REG_MSC_STAT & MSC_STAT_CRC_RES_ERR )
4081#define __msc_stat_rd_crc_err() ( REG_MSC_STAT & MSC_STAT_CRC_READ_ERROR ) 4114#define __msc_stat_rd_crc_err() ( REG_MSC_STAT & MSC_STAT_CRC_READ_ERROR )
4082#define __msc_stat_wr_crc_err() ( REG_MSC_STAT & MSC_STAT_CRC_WRITE_ERROR_YES ) 4115#define __msc_stat_wr_crc_err() ( REG_MSC_STAT & MSC_STAT_CRC_WRITE_ERROR_YES )
4083#define __msc_stat_resto_err() ( REG_MSC_STAT & MSC_STAT_TIME_OUT_RES ) 4116#define __msc_stat_resto_err() ( REG_MSC_STAT & MSC_STAT_TIME_OUT_RES )
4084#define __msc_stat_rdto_err() ( REG_MSC_STAT & MSC_STAT_TIME_OUT_READ ) 4117#define __msc_stat_rdto_err() ( REG_MSC_STAT & MSC_STAT_TIME_OUT_READ )
4085 4118
4086#define __msc_rd_resfifo() ( REG_MSC_RES ) 4119#define __msc_rd_resfifo() ( REG_MSC_RES )
4087#define __msc_rd_rxfifo() ( REG_MSC_RXFIFO ) 4120#define __msc_rd_rxfifo() ( REG_MSC_RXFIFO )
4088#define __msc_wr_txfifo(v) ( REG_MSC_TXFIFO = v ) 4121#define __msc_wr_txfifo(v) ( REG_MSC_TXFIFO = v )
4089 4122
4090#define __msc_reset() \ 4123#define __msc_reset() \
4091do { \ 4124do { \
4092 REG_MSC_STRPCL = MSC_STRPCL_RESET; \ 4125 REG_MSC_STRPCL = MSC_STRPCL_RESET; \
4093 while (REG_MSC_STAT & MSC_STAT_IS_RESETTING); \ 4126 while (REG_MSC_STAT & MSC_STAT_IS_RESETTING); \
4094} while (0) 4127} while (0)
4095 4128
4096#define __msc_start_clk() \ 4129#define __msc_start_clk() \
4097do { \ 4130do { \
4098 REG_MSC_STRPCL = MSC_STRPCL_CLOCK_CONTROL_START; \ 4131 REG_MSC_STRPCL = MSC_STRPCL_CLOCK_CONTROL_START; \
4099} while (0) 4132} while (0)
4100 4133
4101#define __msc_stop_clk() \ 4134#define __msc_stop_clk() \
4102do { \ 4135do { \
4103 REG_MSC_STRPCL = MSC_STRPCL_CLOCK_CONTROL_STOP; \ 4136 REG_MSC_STRPCL = MSC_STRPCL_CLOCK_CONTROL_STOP; \
4104} while (0) 4137} while (0)
4105 4138
4106#define MMC_CLK 19169200 4139#define MMC_CLK 19169200
4107#define SD_CLK 24576000 4140#define SD_CLK 24576000
4108 4141
4109/* msc_clk should little than pclk and little than clk retrieve from card */ 4142/* msc_clk should little than pclk and little than clk retrieve from card */
4110#define __msc_calc_clk_divisor(type,dev_clk,msc_clk,lv) \ 4143#define __msc_calc_clk_divisor(type,dev_clk,msc_clk,lv) \
4111do { \ 4144do { \
4112 unsigned int rate, pclk, i; \ 4145 unsigned int rate, pclk, i; \
4113 pclk = dev_clk; \ 4146 pclk = dev_clk; \
4114 rate = type?SD_CLK:MMC_CLK; \ 4147 rate = type?SD_CLK:MMC_CLK; \
4115 if (msc_clk && msc_clk < pclk) \ 4148 if (msc_clk && msc_clk < pclk) \
4116 pclk = msc_clk; \ 4149 pclk = msc_clk; \
4117 i = 0; \ 4150 i = 0; \
4118 while (pclk < rate) \ 4151 while (pclk < rate) \
4119 { \ 4152 { \
4120 i ++; \ 4153 i ++; \
4121 rate >>= 1; \ 4154 rate >>= 1; \
4122 } \ 4155 } \
4123 lv = i; \ 4156 lv = i; \
4124} while(0) 4157} while(0)
4125 4158
4126/* divide rate to little than or equal to 400kHz */ 4159/* divide rate to little than or equal to 400kHz */
4127#define __msc_calc_slow_clk_divisor(type, lv) \ 4160#define __msc_calc_slow_clk_divisor(type, lv) \
4128do { \ 4161do { \
4129 unsigned int rate, i; \ 4162 unsigned int rate, i; \
4130 rate = (type?SD_CLK:MMC_CLK)/1000/400; \ 4163 rate = (type?SD_CLK:MMC_CLK)/1000/400; \
4131 i = 0; \ 4164 i = 0; \
4132 while (rate > 0) \ 4165 while (rate > 0) \
4133 { \ 4166 { \
4134 rate >>= 1; \ 4167 rate >>= 1; \
4135 i ++; \ 4168 i ++; \
4136 } \ 4169 } \
4137 lv = i; \ 4170 lv = i; \
4138} while(0) 4171} while(0)
4139 4172
4140 4173
@@ -4148,25 +4181,25 @@ do { \
4148 4181
4149#define __ssi_normal_mode() ( REG_SSI_ITR &= ~SSI_ITR_IVLTM_MASK ) 4182#define __ssi_normal_mode() ( REG_SSI_ITR &= ~SSI_ITR_IVLTM_MASK )
4150 4183
4151#define __ssi_select_ce2() \ 4184#define __ssi_select_ce2() \
4152do { \ 4185do { \
4153 REG_SSI_CR0 |= SSI_CR0_FSEL; \ 4186 REG_SSI_CR0 |= SSI_CR0_FSEL; \
4154 REG_SSI_CR1 &= ~SSI_CR1_MULTS; \ 4187 REG_SSI_CR1 &= ~SSI_CR1_MULTS; \
4155} while (0) 4188} while (0)
4156 4189
4157#define __ssi_select_gpc() \ 4190#define __ssi_select_gpc() \
4158do { \ 4191do { \
4159 REG_SSI_CR0 &= ~SSI_CR0_FSEL; \ 4192 REG_SSI_CR0 &= ~SSI_CR0_FSEL; \
4160 REG_SSI_CR1 |= SSI_CR1_MULTS; \ 4193 REG_SSI_CR1 |= SSI_CR1_MULTS; \
4161} while (0) 4194} while (0)
4162 4195
4163#define __ssi_enable_tx_intr() \ 4196#define __ssi_enable_tx_intr() \
4164 ( REG_SSI_CR0 |= SSI_CR0_TIE | SSI_CR0_TEIE ) 4197 ( REG_SSI_CR0 |= SSI_CR0_TIE | SSI_CR0_TEIE )
4165 4198
4166#define __ssi_disable_tx_intr() \ 4199#define __ssi_disable_tx_intr() \
4167 ( REG_SSI_CR0 &= ~(SSI_CR0_TIE | SSI_CR0_TEIE) ) 4200 ( REG_SSI_CR0 &= ~(SSI_CR0_TIE | SSI_CR0_TEIE) )
4168 4201
4169#define __ssi_enable_rx_intr() \ 4202#define __ssi_enable_rx_intr() \
4170 ( REG_SSI_CR0 |= SSI_CR0_RIE | SSI_CR0_REIE ) 4203 ( REG_SSI_CR0 |= SSI_CR0_RIE | SSI_CR0_REIE )
4171 4204
4172#define __ssi_disable_rx_intr() \ 4205#define __ssi_disable_rx_intr() \
@@ -4178,7 +4211,7 @@ do { \
4178#define __ssi_enable_receive() ( REG_SSI_CR0 &= ~SSI_CR0_DISREV ) 4211#define __ssi_enable_receive() ( REG_SSI_CR0 &= ~SSI_CR0_DISREV )
4179#define __ssi_disable_receive() ( REG_SSI_CR0 |= SSI_CR0_DISREV ) 4212#define __ssi_disable_receive() ( REG_SSI_CR0 |= SSI_CR0_DISREV )
4180 4213
4181#define __ssi_finish_receive() \ 4214#define __ssi_finish_receive() \
4182 ( REG_SSI_CR0 |= (SSI_CR0_RFINE | SSI_CR0_RFINC) ) 4215 ( REG_SSI_CR0 |= (SSI_CR0_RFINE | SSI_CR0_RFINC) )
4183 4216
4184#define __ssi_disable_recvfinish() \ 4217#define __ssi_disable_recvfinish() \
@@ -4192,29 +4225,29 @@ do { \
4192 4225
4193#define __ssi_finish_transmit() ( REG_SSI_CR1 &= ~SSI_CR1_UNFIN ) 4226#define __ssi_finish_transmit() ( REG_SSI_CR1 &= ~SSI_CR1_UNFIN )
4194 4227
4195#define __ssi_spi_format() \ 4228#define __ssi_spi_format() \
4196do { \ 4229do { \
4197 REG_SSI_CR1 &= ~SSI_CR1_FMAT_MASK; \ 4230 REG_SSI_CR1 &= ~SSI_CR1_FMAT_MASK; \
4198 REG_SSI_CR1 |= SSI_CR1_FMAT_SPI; \ 4231 REG_SSI_CR1 |= SSI_CR1_FMAT_SPI; \
4199 REG_SSI_CR1 &= ~(SSI_CR1_TFVCK_MASK|SSI_CR1_TCKFI_MASK);\ 4232 REG_SSI_CR1 &= ~(SSI_CR1_TFVCK_MASK|SSI_CR1_TCKFI_MASK);\
4200 REG_SSI_CR1 |= (SSI_CR1_TFVCK_1 | SSI_CR1_TCKFI_1); \ 4233 REG_SSI_CR1 |= (SSI_CR1_TFVCK_1 | SSI_CR1_TCKFI_1); \
4201} while (0) 4234} while (0)
4202 4235
4203/* TI's SSP format, must clear SSI_CR1.UNFIN */ 4236/* TI's SSP format, must clear SSI_CR1.UNFIN */
4204#define __ssi_ssp_format() \ 4237#define __ssi_ssp_format() \
4205do { \ 4238do { \
4206 REG_SSI_CR1 &= ~(SSI_CR1_FMAT_MASK | SSI_CR1_UNFIN); \ 4239 REG_SSI_CR1 &= ~(SSI_CR1_FMAT_MASK | SSI_CR1_UNFIN); \
4207 REG_SSI_CR1 |= SSI_CR1_FMAT_SSP; \ 4240 REG_SSI_CR1 |= SSI_CR1_FMAT_SSP; \
4208} while (0) 4241} while (0)
4209 4242
4210/* National's Microwire format, must clear SSI_CR0.RFINE, and set max delay */ 4243/* National's Microwire format, must clear SSI_CR0.RFINE, and set max delay */
4211#define __ssi_microwire_format() \ 4244#define __ssi_microwire_format() \
4212do { \ 4245do { \
4213 REG_SSI_CR1 &= ~SSI_CR1_FMAT_MASK; \ 4246 REG_SSI_CR1 &= ~SSI_CR1_FMAT_MASK; \
4214 REG_SSI_CR1 |= SSI_CR1_FMAT_MW1; \ 4247 REG_SSI_CR1 |= SSI_CR1_FMAT_MW1; \
4215 REG_SSI_CR1 &= ~(SSI_CR1_TFVCK_MASK|SSI_CR1_TCKFI_MASK);\ 4248 REG_SSI_CR1 &= ~(SSI_CR1_TFVCK_MASK|SSI_CR1_TCKFI_MASK);\
4216 REG_SSI_CR1 |= (SSI_CR1_TFVCK_3 | SSI_CR1_TCKFI_3); \ 4249 REG_SSI_CR1 |= (SSI_CR1_TFVCK_3 | SSI_CR1_TCKFI_3); \
4217 REG_SSI_CR0 &= ~SSI_CR0_RFINE; \ 4250 REG_SSI_CR0 &= ~SSI_CR0_RFINE; \
4218} while (0) 4251} while (0)
4219 4252
4220/* CE# level (FRMHL), CE# in interval time (ITFRM), 4253/* CE# level (FRMHL), CE# in interval time (ITFRM),
@@ -4222,16 +4255,16 @@ do { \
4222 interval time (SSIITR), interval characters/frame (SSIICR) */ 4255 interval time (SSIITR), interval characters/frame (SSIICR) */
4223 4256
4224 /* frmhl,endian,mcom,flen,pha,pol MASK */ 4257 /* frmhl,endian,mcom,flen,pha,pol MASK */
4225#define SSICR1_MISC_MASK \ 4258#define SSICR1_MISC_MASK \
4226 ( SSI_CR1_FRMHL_MASK | SSI_CR1_LFST | SSI_CR1_MCOM_MASK \ 4259 ( SSI_CR1_FRMHL_MASK | SSI_CR1_LFST | SSI_CR1_MCOM_MASK \
4227 | SSI_CR1_FLEN_MASK | SSI_CR1_PHA | SSI_CR1_POL ) \ 4260 | SSI_CR1_FLEN_MASK | SSI_CR1_PHA | SSI_CR1_POL ) \
4228 4261
4229#define __ssi_spi_set_misc(frmhl,endian,flen,mcom,pha,pol) \ 4262#define __ssi_spi_set_misc(frmhl,endian,flen,mcom,pha,pol) \
4230do { \ 4263do { \
4231 REG_SSI_CR1 &= ~SSICR1_MISC_MASK; \ 4264 REG_SSI_CR1 &= ~SSICR1_MISC_MASK; \
4232 REG_SSI_CR1 |= ((frmhl) << 30) | ((endian) << 25) | \ 4265 REG_SSI_CR1 |= ((frmhl) << 30) | ((endian) << 25) | \
4233 (((mcom) - 1) << 12) | (((flen) - 2) << 4) | \ 4266 (((mcom) - 1) << 12) | (((flen) - 2) << 4) | \
4234 ((pha) << 1) | (pol); \ 4267 ((pha) << 1) | (pol); \
4235} while(0) 4268} while(0)
4236 4269
4237/* Transfer with MSB or LSB first */ 4270/* Transfer with MSB or LSB first */
@@ -4254,17 +4287,17 @@ do { \
4254 ( REG_SSI_CR1 = ((REG_SSI_CR1 & ~SSI_CR1_POL) | (n&0x1)) ) 4287 ( REG_SSI_CR1 = ((REG_SSI_CR1 & ~SSI_CR1_POL) | (n&0x1)) )
4255 4288
4256/* n = ix8 */ 4289/* n = ix8 */
4257#define __ssi_set_tx_trigger(n) \ 4290#define __ssi_set_tx_trigger(n) \
4258do { \ 4291do { \
4259 REG_SSI_CR1 &= ~SSI_CR1_TTRG_MASK; \ 4292 REG_SSI_CR1 &= ~SSI_CR1_TTRG_MASK; \
4260 REG_SSI_CR1 |= SSI_CR1_TTRG_##n; \ 4293 REG_SSI_CR1 |= SSI_CR1_TTRG_##n; \
4261} while (0) 4294} while (0)
4262 4295
4263/* n = ix8 */ 4296/* n = ix8 */
4264#define __ssi_set_rx_trigger(n) \ 4297#define __ssi_set_rx_trigger(n) \
4265do { \ 4298do { \
4266 REG_SSI_CR1 &= ~SSI_CR1_RTRG_MASK; \ 4299 REG_SSI_CR1 &= ~SSI_CR1_RTRG_MASK; \
4267 REG_SSI_CR1 |= SSI_CR1_RTRG_##n; \ 4300 REG_SSI_CR1 |= SSI_CR1_RTRG_##n; \
4268} while (0) 4301} while (0)
4269 4302
4270#define __ssi_get_txfifo_count() \ 4303#define __ssi_get_txfifo_count() \
@@ -4276,12 +4309,12 @@ do { \
4276#define __ssi_clear_errors() \ 4309#define __ssi_clear_errors() \
4277 ( REG_SSI_SR &= ~(SSI_SR_UNDR | SSI_SR_OVER) ) 4310 ( REG_SSI_SR &= ~(SSI_SR_UNDR | SSI_SR_OVER) )
4278 4311
4279#define __ssi_transfer_end() ( REG_SSI_SR & SSI_SR_END ) 4312#define __ssi_transfer_end() ( REG_SSI_SR & SSI_SR_END )
4280#define __ssi_is_busy() ( REG_SSI_SR & SSI_SR_BUSY ) 4313#define __ssi_is_busy() ( REG_SSI_SR & SSI_SR_BUSY )
4281 4314
4282#define __ssi_txfifo_full() ( REG_SSI_SR & SSI_SR_TFF ) 4315#define __ssi_txfifo_full() ( REG_SSI_SR & SSI_SR_TFF )
4283#define __ssi_rxfifo_empty() ( REG_SSI_SR & SSI_SR_RFE ) 4316#define __ssi_rxfifo_empty() ( REG_SSI_SR & SSI_SR_RFE )
4284#define __ssi_rxfifo_noempty() ( REG_SSI_SR & SSI_SR_RFHF ) 4317#define __ssi_rxfifo_noempty() ( REG_SSI_SR & SSI_SR_RFHF )
4285 4318
4286#define __ssi_set_clk(dev_clk, ssi_clk) \ 4319#define __ssi_set_clk(dev_clk, ssi_clk) \
4287 ( REG_SSI_GR = (dev_clk) / (2*(ssi_clk)) - 1 ) 4320 ( REG_SSI_GR = (dev_clk) / (2*(ssi_clk)) - 1 )
@@ -4294,67 +4327,67 @@ do { \
4294 * CIM 4327 * CIM
4295 ***************************************************************************/ 4328 ***************************************************************************/
4296 4329
4297#define __cim_enable() ( REG_CIM_CTRL |= CIM_CTRL_ENA ) 4330#define __cim_enable() ( REG_CIM_CTRL |= CIM_CTRL_ENA )
4298#define __cim_disable() ( REG_CIM_CTRL &= ~CIM_CTRL_ENA ) 4331#define __cim_disable() ( REG_CIM_CTRL &= ~CIM_CTRL_ENA )
4299 4332
4300#define __cim_input_data_inverse() ( REG_CIM_CFG |= CIM_CFG_INV_DAT ) 4333#define __cim_input_data_inverse() ( REG_CIM_CFG |= CIM_CFG_INV_DAT )
4301#define __cim_input_data_normal() ( REG_CIM_CFG &= ~CIM_CFG_INV_DAT ) 4334#define __cim_input_data_normal() ( REG_CIM_CFG &= ~CIM_CFG_INV_DAT )
4302 4335
4303#define __cim_vsync_active_low() ( REG_CIM_CFG |= CIM_CFG_VSP ) 4336#define __cim_vsync_active_low() ( REG_CIM_CFG |= CIM_CFG_VSP )
4304#define __cim_vsync_active_high() ( REG_CIM_CFG &= ~CIM_CFG_VSP ) 4337#define __cim_vsync_active_high() ( REG_CIM_CFG &= ~CIM_CFG_VSP )
4305 4338
4306#define __cim_hsync_active_low() ( REG_CIM_CFG |= CIM_CFG_HSP ) 4339#define __cim_hsync_active_low() ( REG_CIM_CFG |= CIM_CFG_HSP )
4307#define __cim_hsync_active_high() ( REG_CIM_CFG &= ~CIM_CFG_HSP ) 4340#define __cim_hsync_active_high() ( REG_CIM_CFG &= ~CIM_CFG_HSP )
4308 4341
4309#define __cim_sample_data_at_pclk_falling_edge() \ 4342#define __cim_sample_data_at_pclk_falling_edge() \
4310 ( REG_CIM_CFG |= CIM_CFG_PCP ) 4343 ( REG_CIM_CFG |= CIM_CFG_PCP )
4311#define __cim_sample_data_at_pclk_rising_edge() \ 4344#define __cim_sample_data_at_pclk_rising_edge() \
4312 ( REG_CIM_CFG &= ~CIM_CFG_PCP ) 4345 ( REG_CIM_CFG &= ~CIM_CFG_PCP )
4313 4346
4314#define __cim_enable_dummy_zero() ( REG_CIM_CFG |= CIM_CFG_DUMMY_ZERO ) 4347#define __cim_enable_dummy_zero() ( REG_CIM_CFG |= CIM_CFG_DUMMY_ZERO )
4315#define __cim_disable_dummy_zero() ( REG_CIM_CFG &= ~CIM_CFG_DUMMY_ZERO ) 4348#define __cim_disable_dummy_zero() ( REG_CIM_CFG &= ~CIM_CFG_DUMMY_ZERO )
4316 4349
4317#define __cim_select_external_vsync() ( REG_CIM_CFG |= CIM_CFG_EXT_VSYNC ) 4350#define __cim_select_external_vsync() ( REG_CIM_CFG |= CIM_CFG_EXT_VSYNC )
4318#define __cim_select_internal_vsync() ( REG_CIM_CFG &= ~CIM_CFG_EXT_VSYNC ) 4351#define __cim_select_internal_vsync() ( REG_CIM_CFG &= ~CIM_CFG_EXT_VSYNC )
4319 4352
4320/* n=0-7 */ 4353/* n=0-7 */
4321#define __cim_set_data_packing_mode(n) \ 4354#define __cim_set_data_packing_mode(n) \
4322do { \ 4355do { \
4323 REG_CIM_CFG &= ~CIM_CFG_PACK_MASK; \ 4356 REG_CIM_CFG &= ~CIM_CFG_PACK_MASK; \
4324 REG_CIM_CFG |= (CIM_CFG_PACK_##n); \ 4357 REG_CIM_CFG |= (CIM_CFG_PACK_##n); \
4325} while (0) 4358} while (0)
4326 4359
4327#define __cim_enable_ccir656_progressive_mode() \ 4360#define __cim_enable_ccir656_progressive_mode() \
4328do { \ 4361do { \
4329 REG_CIM_CFG &= ~CIM_CFG_DSM_MASK; \ 4362 REG_CIM_CFG &= ~CIM_CFG_DSM_MASK; \
4330 REG_CIM_CFG |= CIM_CFG_DSM_CPM; \ 4363 REG_CIM_CFG |= CIM_CFG_DSM_CPM; \
4331} while (0) 4364} while (0)
4332 4365
4333#define __cim_enable_ccir656_interlace_mode() \ 4366#define __cim_enable_ccir656_interlace_mode() \
4334do { \ 4367do { \
4335 REG_CIM_CFG &= ~CIM_CFG_DSM_MASK; \ 4368 REG_CIM_CFG &= ~CIM_CFG_DSM_MASK; \
4336 REG_CIM_CFG |= CIM_CFG_DSM_CIM; \ 4369 REG_CIM_CFG |= CIM_CFG_DSM_CIM; \
4337} while (0) 4370} while (0)
4338 4371
4339#define __cim_enable_gated_clock_mode() \ 4372#define __cim_enable_gated_clock_mode() \
4340do { \ 4373do { \
4341 REG_CIM_CFG &= ~CIM_CFG_DSM_MASK; \ 4374 REG_CIM_CFG &= ~CIM_CFG_DSM_MASK; \
4342 REG_CIM_CFG |= CIM_CFG_DSM_GCM; \ 4375 REG_CIM_CFG |= CIM_CFG_DSM_GCM; \
4343} while (0) 4376} while (0)
4344 4377
4345#define __cim_enable_nongated_clock_mode() \ 4378#define __cim_enable_nongated_clock_mode() \
4346do { \ 4379do { \
4347 REG_CIM_CFG &= ~CIM_CFG_DSM_MASK; \ 4380 REG_CIM_CFG &= ~CIM_CFG_DSM_MASK; \
4348 REG_CIM_CFG |= CIM_CFG_DSM_NGCM; \ 4381 REG_CIM_CFG |= CIM_CFG_DSM_NGCM; \
4349} while (0) 4382} while (0)
4350 4383
4351/* sclk:system bus clock 4384/* sclk:system bus clock
4352 * mclk: CIM master clock 4385 * mclk: CIM master clock
4353 */ 4386 */
4354#define __cim_set_master_clk(sclk, mclk) \ 4387#define __cim_set_master_clk(sclk, mclk) \
4355do { \ 4388do { \
4356 REG_CIM_CTRL &= ~CIM_CTRL_MCLKDIV_MASK; \ 4389 REG_CIM_CTRL &= ~CIM_CTRL_MCLKDIV_MASK; \
4357 REG_CIM_CTRL |= (((sclk)/(mclk) - 1) << CIM_CTRL_MCLKDIV_BIT); \ 4390 REG_CIM_CTRL |= (((sclk)/(mclk) - 1) << CIM_CTRL_MCLKDIV_BIT); \
4358} while (0) 4391} while (0)
4359 4392
4360#define __cim_enable_sof_intr() \ 4393#define __cim_enable_sof_intr() \
@@ -4383,10 +4416,10 @@ do { \
4383 ( REG_CIM_CTRL &= ~CIM_CTRL_RXF_OFM ) 4416 ( REG_CIM_CTRL &= ~CIM_CTRL_RXF_OFM )
4384 4417
4385/* n=1-16 */ 4418/* n=1-16 */
4386#define __cim_set_frame_rate(n) \ 4419#define __cim_set_frame_rate(n) \
4387do { \ 4420do { \
4388 REG_CIM_CTRL &= ~CIM_CTRL_FRC_MASK; \ 4421 REG_CIM_CTRL &= ~CIM_CTRL_FRC_MASK; \
4389 REG_CIM_CTRL |= CIM_CTRL_FRC_##n; \ 4422 REG_CIM_CTRL |= CIM_CTRL_FRC_##n; \
4390} while (0) 4423} while (0)
4391 4424
4392#define __cim_enable_dma() ( REG_CIM_CTRL |= CIM_CTRL_DMA_EN ) 4425#define __cim_enable_dma() ( REG_CIM_CTRL |= CIM_CTRL_DMA_EN )
@@ -4396,24 +4429,24 @@ do { \
4396#define __cim_unreset_rxfifo() ( REG_CIM_CTRL &= ~CIM_CTRL_RXF_RST ) 4429#define __cim_unreset_rxfifo() ( REG_CIM_CTRL &= ~CIM_CTRL_RXF_RST )
4397 4430
4398/* n=4,8,12,16,20,24,28,32 */ 4431/* n=4,8,12,16,20,24,28,32 */
4399#define __cim_set_rxfifo_trigger(n) \ 4432#define __cim_set_rxfifo_trigger(n) \
4400do { \ 4433do { \
4401 REG_CIM_CTRL &= ~CIM_CTRL_RXF_TRIG_MASK; \ 4434 REG_CIM_CTRL &= ~CIM_CTRL_RXF_TRIG_MASK; \
4402 REG_CIM_CTRL |= CIM_CTRL_RXF_TRIG_##n; \ 4435 REG_CIM_CTRL |= CIM_CTRL_RXF_TRIG_##n; \
4403} while (0) 4436} while (0)
4404 4437
4405#define __cim_clear_state() ( REG_CIM_STATE = 0 ) 4438#define __cim_clear_state() ( REG_CIM_STATE = 0 )
4406 4439
4407#define __cim_disable_done() ( REG_CIM_STATE & CIM_STATE_VDD ) 4440#define __cim_disable_done() ( REG_CIM_STATE & CIM_STATE_VDD )
4408#define __cim_rxfifo_empty() ( REG_CIM_STATE & CIM_STATE_RXF_EMPTY ) 4441#define __cim_rxfifo_empty() ( REG_CIM_STATE & CIM_STATE_RXF_EMPTY )
4409#define __cim_rxfifo_reach_trigger() ( REG_CIM_STATE & CIM_STATE_RXF_TRIG ) 4442#define __cim_rxfifo_reach_trigger() ( REG_CIM_STATE & CIM_STATE_RXF_TRIG )
4410#define __cim_rxfifo_overflow() ( REG_CIM_STATE & CIM_STATE_RXF_OF ) 4443#define __cim_rxfifo_overflow() ( REG_CIM_STATE & CIM_STATE_RXF_OF )
4411#define __cim_clear_rxfifo_overflow() ( REG_CIM_STATE &= ~CIM_STATE_RXF_OF ) 4444#define __cim_clear_rxfifo_overflow() ( REG_CIM_STATE &= ~CIM_STATE_RXF_OF )
4412#define __cim_dma_stop() ( REG_CIM_STATE & CIM_STATE_DMA_STOP ) 4445#define __cim_dma_stop() ( REG_CIM_STATE & CIM_STATE_DMA_STOP )
4413#define __cim_dma_eof() ( REG_CIM_STATE & CIM_STATE_DMA_EOF ) 4446#define __cim_dma_eof() ( REG_CIM_STATE & CIM_STATE_DMA_EOF )
4414#define __cim_dma_sof() ( REG_CIM_STATE & CIM_STATE_DMA_SOF ) 4447#define __cim_dma_sof() ( REG_CIM_STATE & CIM_STATE_DMA_SOF )
4415 4448
4416#define __cim_get_iid() ( REG_CIM_IID ) 4449#define __cim_get_iid() ( REG_CIM_IID )
4417#define __cim_get_image_data() ( REG_CIM_RXFIFO ) 4450#define __cim_get_image_data() ( REG_CIM_RXFIFO )
4418#define __cim_get_dam_cmd() ( REG_CIM_CMD ) 4451#define __cim_get_dam_cmd() ( REG_CIM_CMD )
4419 4452
@@ -4422,211 +4455,211 @@ do { \
4422/*************************************************************************** 4455/***************************************************************************
4423 * LCD 4456 * LCD
4424 ***************************************************************************/ 4457 ***************************************************************************/
4425#define __lcd_as_smart_lcd() ( REG_LCD_CFG |= (1<<LCD_CFG_LCDPIN_BIT) ) 4458#define __lcd_as_smart_lcd() ( REG_LCD_CFG |= (1<<LCD_CFG_LCDPIN_BIT) )
4426#define __lcd_as_general_lcd() ( REG_LCD_CFG &= ~(1<<LCD_CFG_LCDPIN_BIT) ) 4459#define __lcd_as_general_lcd() ( REG_LCD_CFG &= ~(1<<LCD_CFG_LCDPIN_BIT) )
4427 4460
4428#define __lcd_set_dis() ( REG_LCD_CTRL |= LCD_CTRL_DIS ) 4461#define __lcd_set_dis() ( REG_LCD_CTRL |= LCD_CTRL_DIS )
4429#define __lcd_clr_dis() ( REG_LCD_CTRL &= ~LCD_CTRL_DIS ) 4462#define __lcd_clr_dis() ( REG_LCD_CTRL &= ~LCD_CTRL_DIS )
4430 4463
4431#define __lcd_set_ena() ( REG_LCD_CTRL |= LCD_CTRL_ENA ) 4464#define __lcd_set_ena() ( REG_LCD_CTRL |= LCD_CTRL_ENA )
4432#define __lcd_clr_ena() ( REG_LCD_CTRL &= ~LCD_CTRL_ENA ) 4465#define __lcd_clr_ena() ( REG_LCD_CTRL &= ~LCD_CTRL_ENA )
4433 4466
4434/* n=1,2,4,8,16 */ 4467/* n=1,2,4,8,16 */
4435#define __lcd_set_bpp(n) \ 4468#define __lcd_set_bpp(n) \
4436 ( REG_LCD_CTRL = (REG_LCD_CTRL & ~LCD_CTRL_BPP_MASK) | LCD_CTRL_BPP_##n ) 4469 ( REG_LCD_CTRL = (REG_LCD_CTRL & ~LCD_CTRL_BPP_MASK) | LCD_CTRL_BPP_##n )
4437 4470
4438/* n=4,8,16 */ 4471/* n=4,8,16 */
4439#define __lcd_set_burst_length(n) \ 4472#define __lcd_set_burst_length(n) \
4440do { \ 4473do { \
4441 REG_LCD_CTRL &= ~LCD_CTRL_BST_MASK; \ 4474 REG_LCD_CTRL &= ~LCD_CTRL_BST_MASK; \
4442 REG_LCD_CTRL |= LCD_CTRL_BST_n##; \ 4475 REG_LCD_CTRL |= LCD_CTRL_BST_n##; \
4443} while (0) 4476} while (0)
4444 4477
4445#define __lcd_select_rgb565() ( REG_LCD_CTRL &= ~LCD_CTRL_RGB555 ) 4478#define __lcd_select_rgb565() ( REG_LCD_CTRL &= ~LCD_CTRL_RGB555 )
4446#define __lcd_select_rgb555() ( REG_LCD_CTRL |= LCD_CTRL_RGB555 ) 4479#define __lcd_select_rgb555() ( REG_LCD_CTRL |= LCD_CTRL_RGB555 )
4447 4480
4448#define __lcd_set_ofup() ( REG_LCD_CTRL |= LCD_CTRL_OFUP ) 4481#define __lcd_set_ofup() ( REG_LCD_CTRL |= LCD_CTRL_OFUP )
4449#define __lcd_clr_ofup() ( REG_LCD_CTRL &= ~LCD_CTRL_OFUP ) 4482#define __lcd_clr_ofup() ( REG_LCD_CTRL &= ~LCD_CTRL_OFUP )
4450 4483
4451/* n=2,4,16 */ 4484/* n=2,4,16 */
4452#define __lcd_set_stn_frc(n) \ 4485#define __lcd_set_stn_frc(n) \
4453do { \ 4486do { \
4454 REG_LCD_CTRL &= ~LCD_CTRL_FRC_MASK; \ 4487 REG_LCD_CTRL &= ~LCD_CTRL_FRC_MASK; \
4455 REG_LCD_CTRL |= LCD_CTRL_FRC_n##; \ 4488 REG_LCD_CTRL |= LCD_CTRL_FRC_n##; \
4456} while (0) 4489} while (0)
4457 4490
4458 4491
4459#define __lcd_pixel_endian_little() ( REG_LCD_CTRL |= LCD_CTRL_PEDN ) 4492#define __lcd_pixel_endian_little() ( REG_LCD_CTRL |= LCD_CTRL_PEDN )
4460#define __lcd_pixel_endian_big() ( REG_LCD_CTRL &= ~LCD_CTRL_PEDN ) 4493#define __lcd_pixel_endian_big() ( REG_LCD_CTRL &= ~LCD_CTRL_PEDN )
4461 4494
4462#define __lcd_reverse_byte_endian() ( REG_LCD_CTRL |= LCD_CTRL_BEDN ) 4495#define __lcd_reverse_byte_endian() ( REG_LCD_CTRL |= LCD_CTRL_BEDN )
4463#define __lcd_normal_byte_endian() ( REG_LCD_CTRL &= ~LCD_CTRL_BEDN ) 4496#define __lcd_normal_byte_endian() ( REG_LCD_CTRL &= ~LCD_CTRL_BEDN )
4464 4497
4465#define __lcd_enable_eof_intr() ( REG_LCD_CTRL |= LCD_CTRL_EOFM ) 4498#define __lcd_enable_eof_intr() ( REG_LCD_CTRL |= LCD_CTRL_EOFM )
4466#define __lcd_disable_eof_intr() ( REG_LCD_CTRL &= ~LCD_CTRL_EOFM ) 4499#define __lcd_disable_eof_intr() ( REG_LCD_CTRL &= ~LCD_CTRL_EOFM )
4467 4500
4468#define __lcd_enable_sof_intr() ( REG_LCD_CTRL |= LCD_CTRL_SOFM ) 4501#define __lcd_enable_sof_intr() ( REG_LCD_CTRL |= LCD_CTRL_SOFM )
4469#define __lcd_disable_sof_intr() ( REG_LCD_CTRL &= ~LCD_CTRL_SOFM ) 4502#define __lcd_disable_sof_intr() ( REG_LCD_CTRL &= ~LCD_CTRL_SOFM )
4470 4503
4471#define __lcd_enable_ofu_intr() ( REG_LCD_CTRL |= LCD_CTRL_OFUM ) 4504#define __lcd_enable_ofu_intr() ( REG_LCD_CTRL |= LCD_CTRL_OFUM )
4472#define __lcd_disable_ofu_intr() ( REG_LCD_CTRL &= ~LCD_CTRL_OFUM ) 4505#define __lcd_disable_ofu_intr() ( REG_LCD_CTRL &= ~LCD_CTRL_OFUM )
4473 4506
4474#define __lcd_enable_ifu0_intr() ( REG_LCD_CTRL |= LCD_CTRL_IFUM0 ) 4507#define __lcd_enable_ifu0_intr() ( REG_LCD_CTRL |= LCD_CTRL_IFUM0 )
4475#define __lcd_disable_ifu0_intr() ( REG_LCD_CTRL &= ~LCD_CTRL_IFUM0 ) 4508#define __lcd_disable_ifu0_intr() ( REG_LCD_CTRL &= ~LCD_CTRL_IFUM0 )
4476 4509
4477#define __lcd_enable_ifu1_intr() ( REG_LCD_CTRL |= LCD_CTRL_IFUM1 ) 4510#define __lcd_enable_ifu1_intr() ( REG_LCD_CTRL |= LCD_CTRL_IFUM1 )
4478#define __lcd_disable_ifu1_intr() ( REG_LCD_CTRL &= ~LCD_CTRL_IFUM1 ) 4511#define __lcd_disable_ifu1_intr() ( REG_LCD_CTRL &= ~LCD_CTRL_IFUM1 )
4479 4512
4480#define __lcd_enable_ldd_intr() ( REG_LCD_CTRL |= LCD_CTRL_LDDM ) 4513#define __lcd_enable_ldd_intr() ( REG_LCD_CTRL |= LCD_CTRL_LDDM )
4481#define __lcd_disable_ldd_intr() ( REG_LCD_CTRL &= ~LCD_CTRL_LDDM ) 4514#define __lcd_disable_ldd_intr() ( REG_LCD_CTRL &= ~LCD_CTRL_LDDM )
4482 4515
4483#define __lcd_enable_qd_intr() ( REG_LCD_CTRL |= LCD_CTRL_QDM ) 4516#define __lcd_enable_qd_intr() ( REG_LCD_CTRL |= LCD_CTRL_QDM )
4484#define __lcd_disable_qd_intr() ( REG_LCD_CTRL &= ~LCD_CTRL_QDM ) 4517#define __lcd_disable_qd_intr() ( REG_LCD_CTRL &= ~LCD_CTRL_QDM )
4485 4518
4486 4519
4487/* LCD status register indication */ 4520/* LCD status register indication */
4488 4521
4489#define __lcd_quick_disable_done() ( REG_LCD_STATE & LCD_STATE_QD ) 4522#define __lcd_quick_disable_done() ( REG_LCD_STATE & LCD_STATE_QD )
4490#define __lcd_disable_done() ( REG_LCD_STATE & LCD_STATE_LDD ) 4523#define __lcd_disable_done() ( REG_LCD_STATE & LCD_STATE_LDD )
4491#define __lcd_infifo0_underrun() ( REG_LCD_STATE & LCD_STATE_IFU0 ) 4524#define __lcd_infifo0_underrun() ( REG_LCD_STATE & LCD_STATE_IFU0 )
4492#define __lcd_infifo1_underrun() ( REG_LCD_STATE & LCD_STATE_IFU1 ) 4525#define __lcd_infifo1_underrun() ( REG_LCD_STATE & LCD_STATE_IFU1 )
4493#define __lcd_outfifo_underrun() ( REG_LCD_STATE & LCD_STATE_OFU ) 4526#define __lcd_outfifo_underrun() ( REG_LCD_STATE & LCD_STATE_OFU )
4494#define __lcd_start_of_frame() ( REG_LCD_STATE & LCD_STATE_SOF ) 4527#define __lcd_start_of_frame() ( REG_LCD_STATE & LCD_STATE_SOF )
4495#define __lcd_end_of_frame() ( REG_LCD_STATE & LCD_STATE_EOF ) 4528#define __lcd_end_of_frame() ( REG_LCD_STATE & LCD_STATE_EOF )
4496 4529
4497#define __lcd_clr_outfifounderrun() ( REG_LCD_STATE &= ~LCD_STATE_OFU ) 4530#define __lcd_clr_outfifounderrun() ( REG_LCD_STATE &= ~LCD_STATE_OFU )
4498#define __lcd_clr_sof() ( REG_LCD_STATE &= ~LCD_STATE_SOF ) 4531#define __lcd_clr_sof() ( REG_LCD_STATE &= ~LCD_STATE_SOF )
4499#define __lcd_clr_eof() ( REG_LCD_STATE &= ~LCD_STATE_EOF ) 4532#define __lcd_clr_eof() ( REG_LCD_STATE &= ~LCD_STATE_EOF )
4500 4533
4501#define __lcd_panel_white() ( REG_LCD_CFG |= LCD_CFG_WHITE ) 4534#define __lcd_panel_white() ( REG_LCD_CFG |= LCD_CFG_WHITE )
4502#define __lcd_panel_black() ( REG_LCD_CFG &= ~LCD_CFG_WHITE ) 4535#define __lcd_panel_black() ( REG_LCD_CFG &= ~LCD_CFG_WHITE )
4503 4536
4504/* n=1,2,4,8 for single mono-STN 4537/* n=1,2,4,8 for single mono-STN
4505 * n=4,8 for dual mono-STN 4538 * n=4,8 for dual mono-STN
4506 */ 4539 */
4507#define __lcd_set_panel_datawidth(n) \ 4540#define __lcd_set_panel_datawidth(n) \
4508do { \ 4541do { \
4509 REG_LCD_CFG &= ~LCD_CFG_PDW_MASK; \ 4542 REG_LCD_CFG &= ~LCD_CFG_PDW_MASK; \
4510 REG_LCD_CFG |= LCD_CFG_PDW_n##; \ 4543 REG_LCD_CFG |= LCD_CFG_PDW_n##; \
4511} while (0) 4544} while (0)
4512 4545
4513/* m=LCD_CFG_MODE_GENERUIC_TFT_xxx */ 4546/* m=LCD_CFG_MODE_GENERUIC_TFT_xxx */
4514#define __lcd_set_panel_mode(m) \ 4547#define __lcd_set_panel_mode(m) \
4515do { \ 4548do { \
4516 REG_LCD_CFG &= ~LCD_CFG_MODE_MASK; \ 4549 REG_LCD_CFG &= ~LCD_CFG_MODE_MASK; \
4517 REG_LCD_CFG |= (m); \ 4550 REG_LCD_CFG |= (m); \
4518} while(0) 4551} while(0)
4519 4552
4520/* n = 0-255 */ 4553/* n = 0-255 */
4521#define __lcd_disable_ac_bias() ( REG_LCD_IO = 0xff ) 4554#define __lcd_disable_ac_bias() ( REG_LCD_IO = 0xff )
4522#define __lcd_set_ac_bias(n) \ 4555#define __lcd_set_ac_bias(n) \
4523do { \ 4556do { \
4524 REG_LCD_IO &= ~LCD_IO_ACB_MASK; \ 4557 REG_LCD_IO &= ~LCD_IO_ACB_MASK; \
4525 REG_LCD_IO |= ((n) << LCD_IO_ACB_BIT); \ 4558 REG_LCD_IO |= ((n) << LCD_IO_ACB_BIT); \
4526} while(0) 4559} while(0)
4527 4560
4528#define __lcd_io_set_dir() ( REG_LCD_IO |= LCD_IO_DIR ) 4561#define __lcd_io_set_dir() ( REG_LCD_IO |= LCD_IO_DIR )
4529#define __lcd_io_clr_dir() ( REG_LCD_IO &= ~LCD_IO_DIR ) 4562#define __lcd_io_clr_dir() ( REG_LCD_IO &= ~LCD_IO_DIR )
4530 4563
4531#define __lcd_io_set_dep() ( REG_LCD_IO |= LCD_IO_DEP ) 4564#define __lcd_io_set_dep() ( REG_LCD_IO |= LCD_IO_DEP )
4532#define __lcd_io_clr_dep() ( REG_LCD_IO &= ~LCD_IO_DEP ) 4565#define __lcd_io_clr_dep() ( REG_LCD_IO &= ~LCD_IO_DEP )
4533 4566
4534#define __lcd_io_set_vsp() ( REG_LCD_IO |= LCD_IO_VSP ) 4567#define __lcd_io_set_vsp() ( REG_LCD_IO |= LCD_IO_VSP )
4535#define __lcd_io_clr_vsp() ( REG_LCD_IO &= ~LCD_IO_VSP ) 4568#define __lcd_io_clr_vsp() ( REG_LCD_IO &= ~LCD_IO_VSP )
4536 4569
4537#define __lcd_io_set_hsp() ( REG_LCD_IO |= LCD_IO_HSP ) 4570#define __lcd_io_set_hsp() ( REG_LCD_IO |= LCD_IO_HSP )
4538#define __lcd_io_clr_hsp() ( REG_LCD_IO &= ~LCD_IO_HSP ) 4571#define __lcd_io_clr_hsp() ( REG_LCD_IO &= ~LCD_IO_HSP )
4539 4572
4540#define __lcd_io_set_pcp() ( REG_LCD_IO |= LCD_IO_PCP ) 4573#define __lcd_io_set_pcp() ( REG_LCD_IO |= LCD_IO_PCP )
4541#define __lcd_io_clr_pcp() ( REG_LCD_IO &= ~LCD_IO_PCP ) 4574#define __lcd_io_clr_pcp() ( REG_LCD_IO &= ~LCD_IO_PCP )
4542 4575
4543#define __lcd_vsync_get_vps() \ 4576#define __lcd_vsync_get_vps() \
4544 ( (REG_LCD_VSYNC & LCD_VSYNC_VPS_MASK) >> LCD_VSYNC_VPS_BIT ) 4577 ( (REG_LCD_VSYNC & LCD_VSYNC_VPS_MASK) >> LCD_VSYNC_VPS_BIT )
4545 4578
4546#define __lcd_vsync_get_vpe() \ 4579#define __lcd_vsync_get_vpe() \
4547 ( (REG_LCD_VSYNC & LCD_VSYNC_VPE_MASK) >> LCD_VSYNC_VPE_BIT ) 4580 ( (REG_LCD_VSYNC & LCD_VSYNC_VPE_MASK) >> LCD_VSYNC_VPE_BIT )
4548#define __lcd_vsync_set_vpe(n) \ 4581#define __lcd_vsync_set_vpe(n) \
4549do { \ 4582do { \
4550 REG_LCD_VSYNC &= ~LCD_VSYNC_VPE_MASK; \ 4583 REG_LCD_VSYNC &= ~LCD_VSYNC_VPE_MASK; \
4551 REG_LCD_VSYNC |= (n) << LCD_VSYNC_VPE_BIT; \ 4584 REG_LCD_VSYNC |= (n) << LCD_VSYNC_VPE_BIT; \
4552} while (0) 4585} while (0)
4553 4586
4554#define __lcd_hsync_get_hps() \ 4587#define __lcd_hsync_get_hps() \
4555 ( (REG_LCD_HSYNC & LCD_HSYNC_HPS_MASK) >> LCD_HSYNC_HPS_BIT ) 4588 ( (REG_LCD_HSYNC & LCD_HSYNC_HPS_MASK) >> LCD_HSYNC_HPS_BIT )
4556#define __lcd_hsync_set_hps(n) \ 4589#define __lcd_hsync_set_hps(n) \
4557do { \ 4590do { \
4558 REG_LCD_HSYNC &= ~LCD_HSYNC_HPS_MASK; \ 4591 REG_LCD_HSYNC &= ~LCD_HSYNC_HPS_MASK; \
4559 REG_LCD_HSYNC |= (n) << LCD_HSYNC_HPS_BIT; \ 4592 REG_LCD_HSYNC |= (n) << LCD_HSYNC_HPS_BIT; \
4560} while (0) 4593} while (0)
4561 4594
4562#define __lcd_hsync_get_hpe() \ 4595#define __lcd_hsync_get_hpe() \
4563 ( (REG_LCD_HSYNC & LCD_HSYNC_HPE_MASK) >> LCD_VSYNC_HPE_BIT ) 4596 ( (REG_LCD_HSYNC & LCD_HSYNC_HPE_MASK) >> LCD_VSYNC_HPE_BIT )
4564#define __lcd_hsync_set_hpe(n) \ 4597#define __lcd_hsync_set_hpe(n) \
4565do { \ 4598do { \
4566 REG_LCD_HSYNC &= ~LCD_HSYNC_HPE_MASK; \ 4599 REG_LCD_HSYNC &= ~LCD_HSYNC_HPE_MASK; \
4567 REG_LCD_HSYNC |= (n) << LCD_HSYNC_HPE_BIT; \ 4600 REG_LCD_HSYNC |= (n) << LCD_HSYNC_HPE_BIT; \
4568} while (0) 4601} while (0)
4569 4602
4570#define __lcd_vat_get_ht() \ 4603#define __lcd_vat_get_ht() \
4571 ( (REG_LCD_VAT & LCD_VAT_HT_MASK) >> LCD_VAT_HT_BIT ) 4604 ( (REG_LCD_VAT & LCD_VAT_HT_MASK) >> LCD_VAT_HT_BIT )
4572#define __lcd_vat_set_ht(n) \ 4605#define __lcd_vat_set_ht(n) \
4573do { \ 4606do { \
4574 REG_LCD_VAT &= ~LCD_VAT_HT_MASK; \ 4607 REG_LCD_VAT &= ~LCD_VAT_HT_MASK; \
4575 REG_LCD_VAT |= (n) << LCD_VAT_HT_BIT; \ 4608 REG_LCD_VAT |= (n) << LCD_VAT_HT_BIT; \
4576} while (0) 4609} while (0)
4577 4610
4578#define __lcd_vat_get_vt() \ 4611#define __lcd_vat_get_vt() \
4579 ( (REG_LCD_VAT & LCD_VAT_VT_MASK) >> LCD_VAT_VT_BIT ) 4612 ( (REG_LCD_VAT & LCD_VAT_VT_MASK) >> LCD_VAT_VT_BIT )
4580#define __lcd_vat_set_vt(n) \ 4613#define __lcd_vat_set_vt(n) \
4581do { \ 4614do { \
4582 REG_LCD_VAT &= ~LCD_VAT_VT_MASK; \ 4615 REG_LCD_VAT &= ~LCD_VAT_VT_MASK; \
4583 REG_LCD_VAT |= (n) << LCD_VAT_VT_BIT; \ 4616 REG_LCD_VAT |= (n) << LCD_VAT_VT_BIT; \
4584} while (0) 4617} while (0)
4585 4618
4586#define __lcd_dah_get_hds() \ 4619#define __lcd_dah_get_hds() \
4587 ( (REG_LCD_DAH & LCD_DAH_HDS_MASK) >> LCD_DAH_HDS_BIT ) 4620 ( (REG_LCD_DAH & LCD_DAH_HDS_MASK) >> LCD_DAH_HDS_BIT )
4588#define __lcd_dah_set_hds(n) \ 4621#define __lcd_dah_set_hds(n) \
4589do { \ 4622do { \
4590 REG_LCD_DAH &= ~LCD_DAH_HDS_MASK; \ 4623 REG_LCD_DAH &= ~LCD_DAH_HDS_MASK; \
4591 REG_LCD_DAH |= (n) << LCD_DAH_HDS_BIT; \ 4624 REG_LCD_DAH |= (n) << LCD_DAH_HDS_BIT; \
4592} while (0) 4625} while (0)
4593 4626
4594#define __lcd_dah_get_hde() \ 4627#define __lcd_dah_get_hde() \
4595 ( (REG_LCD_DAH & LCD_DAH_HDE_MASK) >> LCD_DAH_HDE_BIT ) 4628 ( (REG_LCD_DAH & LCD_DAH_HDE_MASK) >> LCD_DAH_HDE_BIT )
4596#define __lcd_dah_set_hde(n) \ 4629#define __lcd_dah_set_hde(n) \
4597do { \ 4630do { \
4598 REG_LCD_DAH &= ~LCD_DAH_HDE_MASK; \ 4631 REG_LCD_DAH &= ~LCD_DAH_HDE_MASK; \
4599 REG_LCD_DAH |= (n) << LCD_DAH_HDE_BIT; \ 4632 REG_LCD_DAH |= (n) << LCD_DAH_HDE_BIT; \
4600} while (0) 4633} while (0)
4601 4634
4602#define __lcd_dav_get_vds() \ 4635#define __lcd_dav_get_vds() \
4603 ( (REG_LCD_DAV & LCD_DAV_VDS_MASK) >> LCD_DAV_VDS_BIT ) 4636 ( (REG_LCD_DAV & LCD_DAV_VDS_MASK) >> LCD_DAV_VDS_BIT )
4604#define __lcd_dav_set_vds(n) \ 4637#define __lcd_dav_set_vds(n) \
4605do { \ 4638do { \
4606 REG_LCD_DAV &= ~LCD_DAV_VDS_MASK; \ 4639 REG_LCD_DAV &= ~LCD_DAV_VDS_MASK; \
4607 REG_LCD_DAV |= (n) << LCD_DAV_VDS_BIT; \ 4640 REG_LCD_DAV |= (n) << LCD_DAV_VDS_BIT; \
4608} while (0) 4641} while (0)
4609 4642
4610#define __lcd_dav_get_vde() \ 4643#define __lcd_dav_get_vde() \
4611 ( (REG_LCD_DAV & LCD_DAV_VDE_MASK) >> LCD_DAV_VDE_BIT ) 4644 ( (REG_LCD_DAV & LCD_DAV_VDE_MASK) >> LCD_DAV_VDE_BIT )
4612#define __lcd_dav_set_vde(n) \ 4645#define __lcd_dav_set_vde(n) \
4613do { \ 4646do { \
4614 REG_LCD_DAV &= ~LCD_DAV_VDE_MASK; \ 4647 REG_LCD_DAV &= ~LCD_DAV_VDE_MASK; \
4615 REG_LCD_DAV |= (n) << LCD_DAV_VDE_BIT; \ 4648 REG_LCD_DAV |= (n) << LCD_DAV_VDE_BIT; \
4616} while (0) 4649} while (0)
4617 4650
4618#define __lcd_cmd0_set_sofint() ( REG_LCD_CMD0 |= LCD_CMD_SOFINT ) 4651#define __lcd_cmd0_set_sofint() ( REG_LCD_CMD0 |= LCD_CMD_SOFINT )
4619#define __lcd_cmd0_clr_sofint() ( REG_LCD_CMD0 &= ~LCD_CMD_SOFINT ) 4652#define __lcd_cmd0_clr_sofint() ( REG_LCD_CMD0 &= ~LCD_CMD_SOFINT )
4620#define __lcd_cmd1_set_sofint() ( REG_LCD_CMD1 |= LCD_CMD_SOFINT ) 4653#define __lcd_cmd1_set_sofint() ( REG_LCD_CMD1 |= LCD_CMD_SOFINT )
4621#define __lcd_cmd1_clr_sofint() ( REG_LCD_CMD1 &= ~LCD_CMD_SOFINT ) 4654#define __lcd_cmd1_clr_sofint() ( REG_LCD_CMD1 &= ~LCD_CMD_SOFINT )
4622 4655
4623#define __lcd_cmd0_set_eofint() ( REG_LCD_CMD0 |= LCD_CMD_EOFINT ) 4656#define __lcd_cmd0_set_eofint() ( REG_LCD_CMD0 |= LCD_CMD_EOFINT )
4624#define __lcd_cmd0_clr_eofint() ( REG_LCD_CMD0 &= ~LCD_CMD_EOFINT ) 4657#define __lcd_cmd0_clr_eofint() ( REG_LCD_CMD0 &= ~LCD_CMD_EOFINT )
4625#define __lcd_cmd1_set_eofint() ( REG_LCD_CMD1 |= LCD_CMD_EOFINT ) 4658#define __lcd_cmd1_set_eofint() ( REG_LCD_CMD1 |= LCD_CMD_EOFINT )
4626#define __lcd_cmd1_clr_eofint() ( REG_LCD_CMD1 &= ~LCD_CMD_EOFINT ) 4659#define __lcd_cmd1_clr_eofint() ( REG_LCD_CMD1 &= ~LCD_CMD_EOFINT )
4627 4660
4628#define __lcd_cmd0_set_pal() ( REG_LCD_CMD0 |= LCD_CMD_PAL ) 4661#define __lcd_cmd0_set_pal() ( REG_LCD_CMD0 |= LCD_CMD_PAL )
4629#define __lcd_cmd0_clr_pal() ( REG_LCD_CMD0 &= ~LCD_CMD_PAL ) 4662#define __lcd_cmd0_clr_pal() ( REG_LCD_CMD0 &= ~LCD_CMD_PAL )
4630 4663
4631#define __lcd_cmd0_get_len() \ 4664#define __lcd_cmd0_get_len() \
4632 ( (REG_LCD_CMD0 & LCD_CMD_LEN_MASK) >> LCD_CMD_LEN_BIT ) 4665 ( (REG_LCD_CMD0 & LCD_CMD_LEN_MASK) >> LCD_CMD_LEN_BIT )
@@ -4710,7 +4743,7 @@ do{ \
4710#define __rtc_get_second() \ 4743#define __rtc_get_second() \
4711({ \ 4744({ \
4712 while(!__rtc_write_ready());\ 4745 while(!__rtc_write_ready());\
4713 REG_RTC_RSR; \ 4746 REG_RTC_RSR; \
4714}) 4747})
4715//while(0) 4748//while(0)
4716 4749
@@ -4724,10 +4757,10 @@ do{ \
4724#define __rtc_get_alarm_second() \ 4757#define __rtc_get_alarm_second() \
4725do{ \ 4758do{ \
4726 while(!__rtc_write_ready()); \ 4759 while(!__rtc_write_ready()); \
4727 REG_RTC_RSAR; \ 4760 REG_RTC_RSAR; \
4728}while(0) 4761}while(0)
4729 4762
4730 4763
4731#define __rtc_set_alarm_second(v) \ 4764#define __rtc_set_alarm_second(v) \
4732do{ \ 4765do{ \
4733 while(!__rtc_write_ready()); \ 4766 while(!__rtc_write_ready()); \
@@ -4811,7 +4844,7 @@ do{ \
4811}while(0) 4844}while(0)
4812 4845
4813#define __rtc_status_hib_reset_occur() \ 4846#define __rtc_status_hib_reset_occur() \
4814({ \ 4847({ \
4815 (REG_RTC_HWRSR & RTC_HWRSR_HR); \ 4848 (REG_RTC_HWRSR & RTC_HWRSR_HR); \
4816}) 4849})
4817#define __rtc_status_ppr_reset_occur() \ 4850#define __rtc_status_ppr_reset_occur() \
@@ -4837,8 +4870,8 @@ do{ \
4837 4870
4838#define __rtc_get_scratch_pattern() \ 4871#define __rtc_get_scratch_pattern() \
4839({ while(!__rtc_write_ready()); \ 4872({ while(!__rtc_write_ready()); \
4840 (REG_RTC_HSPR);}) 4873 (REG_RTC_HSPR);})
4841#define __rtc_set_scratch_pattern(n) \ 4874#define __rtc_set_scratch_pattern(n) \
4842do{ \ 4875do{ \
4843 while(!__rtc_write_ready()); \ 4876 while(!__rtc_write_ready()); \
4844 (REG_RTC_HSPR = n ); \ 4877 (REG_RTC_HSPR = n ); \
diff --git a/firmware/target/mips/ingenic_jz47xx/lcd-jz4740.c b/firmware/target/mips/ingenic_jz47xx/lcd-jz4740.c
index f84d3a7deb..ca082781aa 100644
--- a/firmware/target/mips/ingenic_jz47xx/lcd-jz4740.c
+++ b/firmware/target/mips/ingenic_jz47xx/lcd-jz4740.c
@@ -23,6 +23,7 @@
23#include "jz4740.h" 23#include "jz4740.h"
24#include "lcd.h" 24#include "lcd.h"
25#include "lcd-target.h" 25#include "lcd-target.h"
26#include "system-target.h"
26 27
27static volatile bool _lcd_on = false; 28static volatile bool _lcd_on = false;
28static volatile bool lcd_poweroff = false; 29static volatile bool lcd_poweroff = false;
@@ -55,26 +56,19 @@ bool lcd_enabled(void)
55/* Update a fraction of the display. */ 56/* Update a fraction of the display. */
56void lcd_update_rect(int x, int y, int width, int height) 57void lcd_update_rect(int x, int y, int width, int height)
57{ 58{
58 /* STILL HACKY... */ 59 lcd_set_target(x, y, width, height);
59 x=0; y=0; width=400; height=240;
60
61 lcd_set_target(x, y, width-1, height-1);
62 60
63 REG_DMAC_DCCSR(0) = 0; 61 REG_DMAC_DCCSR(0) = 0;
64 REG_DMAC_DRSR(0) = DMAC_DRSR_RS_SLCD; /* source = SLCD */ 62 REG_DMAC_DRSR(0) = DMAC_DRSR_RS_SLCD; /* source = SLCD */
65 REG_DMAC_DSAR(0) = ((unsigned int)&lcd_framebuffer[y][x]) & 0x1FFFFFFF; 63 REG_DMAC_DSAR(0) = ((unsigned int)&lcd_framebuffer[y][x]) & 0x1FFFFFFF;
66#if 0
67 REG_DMAC_DTAR(0) = UNCACHED_ADDRESS(SLCD_FIFO);
68#else
69 REG_DMAC_DTAR(0) = 0x130500B0; /* SLCD_FIFO */ 64 REG_DMAC_DTAR(0) = 0x130500B0; /* SLCD_FIFO */
70#endif 65 REG_DMAC_DTCR(0) = width*height;
71 REG_DMAC_DTCR(0) = (width*height);
72 66
73 REG_DMAC_DCMD(0) = (DMAC_DCMD_SAI | DMAC_DCMD_RDIL_IGN | DMAC_DCMD_SWDH_32 /* (1 << 23) | (0 << 16) | (0 << 14) */ 67 REG_DMAC_DCMD(0) = (DMAC_DCMD_SAI | DMAC_DCMD_RDIL_2 | DMAC_DCMD_SWDH_32 /* (1 << 23) | (0 << 16) | (0 << 14) */
74 | DMAC_DCMD_DWDH_16 | DMAC_DCMD_DS_16BIT); /* | (2 << 12) | (3 << 8) */ 68 | DMAC_DCMD_DWDH_16 | DMAC_DCMD_DS_16BIT); /* | (2 << 12) | (3 << 8) */
75 REG_DMAC_DCCSR(0) = (DMAC_DCCSR_NDES | DMAC_DCCSR_EN); /* (1 << 31) | (1 << 0) */ 69 REG_DMAC_DCCSR(0) = (DMAC_DCCSR_NDES | DMAC_DCCSR_EN); /* (1 << 31) | (1 << 0) */
76 70
77 __dcache_writeback_all(); 71 dma_cache_wback_inv((unsigned long)&lcd_framebuffer[y][x], width*height);
78 72
79 REG_DMAC_DMACR = DMAC_DMACR_DMAE; 73 REG_DMAC_DMACR = DMAC_DMACR_DMAE;
80 74
diff --git a/firmware/target/mips/ingenic_jz47xx/onda_vx747/lcd-onda_vx747.c b/firmware/target/mips/ingenic_jz47xx/onda_vx747/lcd-onda_vx747.c
index 33809bb50f..98fa8e7a20 100644
--- a/firmware/target/mips/ingenic_jz47xx/onda_vx747/lcd-onda_vx747.c
+++ b/firmware/target/mips/ingenic_jz47xx/onda_vx747/lcd-onda_vx747.c
@@ -95,10 +95,17 @@ static void _display_init(void)
95 SLCD_SEND_COMMAND(REG_PWR_CTRL6, 1); 95 SLCD_SEND_COMMAND(REG_PWR_CTRL6, 1);
96 SLCD_SEND_COMMAND(REG_RAM_HADDR_SET, 0); /* set cursor at x_start */ 96 SLCD_SEND_COMMAND(REG_RAM_HADDR_SET, 0); /* set cursor at x_start */
97 SLCD_SEND_COMMAND(REG_RAM_VADDR_SET, 0); /* set cursor at y_start */ 97 SLCD_SEND_COMMAND(REG_RAM_VADDR_SET, 0); /* set cursor at y_start */
98#if CONFIG_ORIENTATION == SCREEN_PORTRAIT
98 SLCD_SEND_COMMAND(REG_RAM_HADDR_START, 0); /* y_start*/ 99 SLCD_SEND_COMMAND(REG_RAM_HADDR_START, 0); /* y_start*/
99 SLCD_SEND_COMMAND(REG_RAM_HADDR_END, 239); /* y_end */ 100 SLCD_SEND_COMMAND(REG_RAM_HADDR_END, 239); /* y_end */
100 SLCD_SEND_COMMAND(REG_RAM_VADDR_START, 0); /* x_start */ 101 SLCD_SEND_COMMAND(REG_RAM_VADDR_START, 0); /* x_start */
101 SLCD_SEND_COMMAND(REG_RAM_VADDR_END, 399); /* x_end */ 102 SLCD_SEND_COMMAND(REG_RAM_VADDR_END, 399); /* x_end */
103#else
104 SLCD_SEND_COMMAND(REG_RAM_HADDR_START, 0); /* y_start*/
105 SLCD_SEND_COMMAND(REG_RAM_HADDR_END, 399); /* y_end */
106 SLCD_SEND_COMMAND(REG_RAM_VADDR_START, 0); /* x_start */
107 SLCD_SEND_COMMAND(REG_RAM_VADDR_END, 239); /* x_end */
108#endif
102 SLCD_SEND_COMMAND(REG_RW_NVM, 0); 109 SLCD_SEND_COMMAND(REG_RW_NVM, 0);
103 SLCD_SEND_COMMAND(REG_VCOM_HVOLTAGE1, 6); 110 SLCD_SEND_COMMAND(REG_VCOM_HVOLTAGE1, 6);
104 SLCD_SEND_COMMAND(REG_VCOM_HVOLTAGE2, 0); 111 SLCD_SEND_COMMAND(REG_VCOM_HVOLTAGE2, 0);
@@ -219,10 +226,17 @@ void lcd_init_controller(void)
219 226
220void lcd_set_target(short x, short y, short width, short height) 227void lcd_set_target(short x, short y, short width, short height)
221{ 228{
229#if CONFIG_ORIENTATION == SCREEN_PORTRAIT
222 SLCD_SEND_COMMAND(REG_RAM_HADDR_START, y); /* y_start */ 230 SLCD_SEND_COMMAND(REG_RAM_HADDR_START, y); /* y_start */
223 SLCD_SEND_COMMAND(REG_RAM_HADDR_END, y+height); /* y_end */ 231 SLCD_SEND_COMMAND(REG_RAM_HADDR_END, y+width-1); /* y_end */
224 SLCD_SEND_COMMAND(REG_RAM_VADDR_START, x); /* x_start */ 232 SLCD_SEND_COMMAND(REG_RAM_VADDR_START, x); /* x_start */
225 SLCD_SEND_COMMAND(REG_RAM_VADDR_END, x+width); /* x_end */ 233 SLCD_SEND_COMMAND(REG_RAM_VADDR_END, x+height-1); /* x_end */
234#else
235 SLCD_SEND_COMMAND(REG_RAM_HADDR_START, y); /* y_start */
236 SLCD_SEND_COMMAND(REG_RAM_HADDR_END, y+height-1); /* y_end */
237 SLCD_SEND_COMMAND(REG_RAM_VADDR_START, x); /* x_start */
238 SLCD_SEND_COMMAND(REG_RAM_VADDR_END, x+width-1); /* x_end */
239#endif
226 SLCD_SEND_COMMAND(REG_RAM_HADDR_SET, x); /* set cursor at x_start */ 240 SLCD_SEND_COMMAND(REG_RAM_HADDR_SET, x); /* set cursor at x_start */
227 SLCD_SEND_COMMAND(REG_RAM_VADDR_SET, y); /* set cursor at y_start */ 241 SLCD_SEND_COMMAND(REG_RAM_VADDR_SET, y); /* set cursor at y_start */
228 SLCD_SET_COMMAND(REG_RW_GRAM); /* write data to GRAM */ 242 SLCD_SET_COMMAND(REG_RW_GRAM); /* write data to GRAM */
diff --git a/firmware/target/mips/ingenic_jz47xx/onda_vx747/sadc-onda_vx747.c b/firmware/target/mips/ingenic_jz47xx/onda_vx747/sadc-onda_vx747.c
index b5c817c367..e937c90bd3 100644
--- a/firmware/target/mips/ingenic_jz47xx/onda_vx747/sadc-onda_vx747.c
+++ b/firmware/target/mips/ingenic_jz47xx/onda_vx747/sadc-onda_vx747.c
@@ -66,10 +66,10 @@ void button_init_device(void)
66 system_enable_irq(IRQ_SADC); 66 system_enable_irq(IRQ_SADC);
67 67
68 REG_SADC_SAMETIME = 350; 68 REG_SADC_SAMETIME = 350;
69 REG_SADC_WAITTIME = 100; /* per 10 HZ */ 69 REG_SADC_WAITTIME = 100;
70 REG_SADC_STATE &= (~REG_SADC_STATE); 70 REG_SADC_STATE &= (~REG_SADC_STATE);
71 REG_SADC_CTRL &= (~(SADC_CTRL_PENDM | SADC_CTRL_PENUM | SADC_CTRL_TSRDYM)); 71 REG_SADC_CTRL &= (~(SADC_CTRL_PENDM | SADC_CTRL_PENUM | SADC_CTRL_TSRDYM));
72 REG_SADC_ENA = (SADC_ENA_TSEN | REG_SADC_ENA); //| SADC_ENA_PBATEN | SADC_ENA_SADCINEN); 72 REG_SADC_ENA = SADC_ENA_TSEN; //| SADC_ENA_PBATEN | SADC_ENA_SADCINEN);
73 73
74 __gpio_port_as_input(3, 29); 74 __gpio_port_as_input(3, 29);
75 __gpio_port_as_input(3, 27); 75 __gpio_port_as_input(3, 27);
@@ -78,21 +78,28 @@ void button_init_device(void)
78 __gpio_port_as_input(3, 0); 78 __gpio_port_as_input(3, 0);
79} 79}
80 80
81//static unsigned short touchdivider[2] = {14.5833*1000, 9*1000};
82static int touch_to_pixels(short x, short y) 81static int touch_to_pixels(short x, short y)
83{ 82{
84 /* X:300 -> 3800 Y:300->3900 */ 83 /* X:300 -> 3800 Y:300->3900 */
85 x -= 300; 84 x -= 300;
86 y -= 300; 85 y -= 300;
87 86
87#if CONFIG_ORIENTATION == SCREEN_PORTRAIT
88 x /= 3200 / LCD_WIDTH; 88 x /= 3200 / LCD_WIDTH;
89 y /= 3600 / LCD_HEIGHT; 89 y /= 3600 / LCD_HEIGHT;
90 //x /= touchdivider[0]; 90
91 //y /= touchdivider[1];
92
93 y = LCD_HEIGHT - y; 91 y = LCD_HEIGHT - y;
94 92
95 return (x << 16) | y; 93 return (x << 16) | y;
94#else
95 x /= 3200 / LCD_HEIGHT;
96 y /= 3600 / LCD_WIDTH;
97
98 y = LCD_WIDTH - y;
99 x = LCD_HEIGHT - x;
100
101 return (y << 16) | x;
102#endif
96} 103}
97 104
98int button_read_device(int *data) 105int button_read_device(int *data)
@@ -144,7 +151,7 @@ void SADC(void)
144 { 151 {
145 /* Pen down IRQ */ 152 /* Pen down IRQ */
146 REG_SADC_CTRL &= (~(SADC_CTRL_PENUM | SADC_CTRL_TSRDYM)); 153 REG_SADC_CTRL &= (~(SADC_CTRL_PENUM | SADC_CTRL_TSRDYM));
147 REG_SADC_CTRL |= (SADC_CTRL_PENDM);// | SADC_CTRL_TSRDYM); 154 REG_SADC_CTRL |= (SADC_CTRL_PENDM);
148 pendown_flag = true; 155 pendown_flag = true;
149 } 156 }
150 if(state & SADC_CTRL_PENUM) 157 if(state & SADC_CTRL_PENUM)