aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-05-12 12:03:42 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-05-12 12:03:42 -0400
commit8d97b84935b28ed8944d1be31859a3df7ebe93ae (patch)
treeed0f23dde45812aec86a9ff0c14df3477f9d136c
parent9f1a0735395ba2b2efa5012b5bf7f915299f1a79 (diff)
parentcb0e8b0fba53e1aa6c4786bc465cfc641e8a77e7 (diff)
Merge branch 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus
* 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus: (28 commits) [MIPS] Pb1000: bury the remnants of the PCI code [MIPS] Fix build failure in mips oprofile code [MIPS] fix warning message on SMP kernels [MIPS] markeins: build fix [MIPS] ELF handling - use SELFMAG instead of numeric constant [MIPS] Get rid of __ilog2 [MIPS] Fix __fls for non-MIPS32/MIPS64 cpus [MIPS] XXS1500 code style cleanup [MIPS] MTX-1 code style cleanup [MIPS] Pb1200/DBAu1200 code style cleanup [MIPS] Pb1550 code style cleanup [MIPS] Pb1500 code style cleanup [MIPS] Pb1100 code style cleanup [MIPS] Pb1000 code style cleanup [MIPS] DBAu1xx0 code style cleanup [MIPS] Alchemy PCI code style cleanup [MIPS] Alchemy common code style cleanup [MIPS] Alchemy common headers style cleanup [MIPS] Add empty argument parenthesis to GCC_IMM_ASM [MIPS] msp_hwbutton.c: minor irq handler cleanups ...
-rw-r--r--arch/mips/au1000/common/Makefile7
-rw-r--r--arch/mips/au1000/common/au1xxx_irqmap.c145
-rw-r--r--arch/mips/au1000/common/clocks.c24
-rw-r--r--arch/mips/au1000/common/cputable.c5
-rw-r--r--arch/mips/au1000/common/dbdma.c389
-rw-r--r--arch/mips/au1000/common/dbg_io.c32
-rw-r--r--arch/mips/au1000/common/dma.c56
-rw-r--r--arch/mips/au1000/common/gpio.c6
-rw-r--r--arch/mips/au1000/common/irq.c6
-rw-r--r--arch/mips/au1000/common/pci.c11
-rw-r--r--arch/mips/au1000/common/platform.c11
-rw-r--r--arch/mips/au1000/common/power.c157
-rw-r--r--arch/mips/au1000/common/prom.c21
-rw-r--r--arch/mips/au1000/common/puts.c35
-rw-r--r--arch/mips/au1000/common/reset.c33
-rw-r--r--arch/mips/au1000/common/setup.c60
-rw-r--r--arch/mips/au1000/common/time.c78
-rw-r--r--arch/mips/au1000/db1x00/Makefile8
-rw-r--r--arch/mips/au1000/db1x00/board_setup.c61
-rw-r--r--arch/mips/au1000/db1x00/init.c11
-rw-r--r--arch/mips/au1000/db1x00/irqmap.c22
-rw-r--r--arch/mips/au1000/mtx-1/Makefile3
-rw-r--r--arch/mips/au1000/mtx-1/board_setup.c63
-rw-r--r--arch/mips/au1000/mtx-1/init.c11
-rw-r--r--arch/mips/au1000/mtx-1/irqmap.c18
-rw-r--r--arch/mips/au1000/mtx-1/platform.c3
-rw-r--r--arch/mips/au1000/pb1000/Makefile8
-rw-r--r--arch/mips/au1000/pb1000/board_setup.c117
-rw-r--r--arch/mips/au1000/pb1000/init.c20
-rw-r--r--arch/mips/au1000/pb1100/Makefile6
-rw-r--r--arch/mips/au1000/pb1100/board_setup.c50
-rw-r--r--arch/mips/au1000/pb1100/init.c11
-rw-r--r--arch/mips/au1000/pb1100/irqmap.c10
-rw-r--r--arch/mips/au1000/pb1200/Makefile2
-rw-r--r--arch/mips/au1000/pb1200/board_setup.c139
-rw-r--r--arch/mips/au1000/pb1200/init.c18
-rw-r--r--arch/mips/au1000/pb1200/irqmap.c66
-rw-r--r--arch/mips/au1000/pb1500/Makefile6
-rw-r--r--arch/mips/au1000/pb1500/board_setup.c46
-rw-r--r--arch/mips/au1000/pb1500/init.c20
-rw-r--r--arch/mips/au1000/pb1500/irqmap.c6
-rw-r--r--arch/mips/au1000/pb1550/Makefile7
-rw-r--r--arch/mips/au1000/pb1550/board_setup.c16
-rw-r--r--arch/mips/au1000/pb1550/init.c20
-rw-r--r--arch/mips/au1000/pb1550/irqmap.c6
-rw-r--r--arch/mips/au1000/xxs1500/Makefile3
-rw-r--r--arch/mips/au1000/xxs1500/board_setup.c39
-rw-r--r--arch/mips/au1000/xxs1500/init.c11
-rw-r--r--arch/mips/au1000/xxs1500/irqmap.c2
-rw-r--r--arch/mips/emma2rh/markeins/setup.c7
-rw-r--r--arch/mips/kernel/Makefile2
-rw-r--r--arch/mips/kernel/cpu-bugs64.c2
-rw-r--r--arch/mips/kernel/irixelf.c11
-rw-r--r--arch/mips/kernel/kspd.c5
-rw-r--r--arch/mips/kernel/rtlx.c65
-rw-r--r--arch/mips/kernel/setup.c1
-rw-r--r--arch/mips/kernel/smp.c4
-rw-r--r--arch/mips/kernel/vpe.c29
-rw-r--r--arch/mips/mm/highmem.c1
-rw-r--r--arch/mips/oprofile/op_model_mipsxx.c6
-rw-r--r--arch/mips/pci/fixup-au1000.c7
-rw-r--r--arch/mips/pci/ops-au1000.c115
-rw-r--r--arch/mips/pmc-sierra/msp71xx/msp_hwbutton.c5
-rw-r--r--arch/mips/sgi-ip27/ip27-timer.c4
-rw-r--r--drivers/i2c/busses/i2c-au1550.c2
-rw-r--r--include/asm-mips/bitops.h14
-rw-r--r--include/asm-mips/compiler.h4
-rw-r--r--include/asm-mips/mach-au1x00/au1000.h1644
-rw-r--r--include/asm-mips/mach-au1x00/au1000_dma.h179
-rw-r--r--include/asm-mips/mach-au1x00/au1000_gpio.h18
-rw-r--r--include/asm-mips/mach-au1x00/au1550_spi.h2
-rw-r--r--include/asm-mips/mach-au1x00/au1xxx.h4
-rw-r--r--include/asm-mips/mach-au1x00/au1xxx_dbdma.h155
-rw-r--r--include/asm-mips/mach-au1x00/au1xxx_ide.h251
-rw-r--r--include/asm-mips/mach-au1x00/au1xxx_psc.h131
-rw-r--r--include/asm-mips/mach-db1x00/db1200.h73
-rw-r--r--include/asm-mips/mach-db1x00/db1x00.h83
-rw-r--r--include/asm-mips/mach-pb1x00/pb1000.h189
-rw-r--r--include/asm-mips/mach-pb1x00/pb1100.h96
-rw-r--r--include/asm-mips/mach-pb1x00/pb1200.h93
-rw-r--r--include/asm-mips/mach-pb1x00/pb1500.h38
-rw-r--r--include/asm-mips/mach-pb1x00/pb1550.h51
-rw-r--r--include/asm-mips/rtlx.h4
83 files changed, 2494 insertions, 2706 deletions
diff --git a/arch/mips/au1000/common/Makefile b/arch/mips/au1000/common/Makefile
index 90e2d7a46e8e..dd0e19dacfcf 100644
--- a/arch/mips/au1000/common/Makefile
+++ b/arch/mips/au1000/common/Makefile
@@ -1,9 +1,8 @@
1# 1#
2# Copyright 2000 MontaVista Software Inc. 2# Copyright 2000, 2008 MontaVista Software Inc.
3# Author: MontaVista Software, Inc. 3# Author: MontaVista Software, Inc. <source@mvista.com>
4# ppopov@mvista.com or source@mvista.com
5# 4#
6# Makefile for the Alchemy Au1000 CPU, generic files. 5# Makefile for the Alchemy Au1xx0 CPUs, generic files.
7# 6#
8 7
9obj-y += prom.o irq.o puts.o time.o reset.o \ 8obj-y += prom.o irq.o puts.o time.o reset.o \
diff --git a/arch/mips/au1000/common/au1xxx_irqmap.c b/arch/mips/au1000/common/au1xxx_irqmap.c
index 37a10a01de9d..c7ca1596394c 100644
--- a/arch/mips/au1000/common/au1xxx_irqmap.c
+++ b/arch/mips/au1000/common/au1xxx_irqmap.c
@@ -40,20 +40,20 @@
40struct au1xxx_irqmap __initdata au1xxx_ic0_map[] = { 40struct au1xxx_irqmap __initdata au1xxx_ic0_map[] = {
41 41
42#if defined(CONFIG_SOC_AU1000) 42#if defined(CONFIG_SOC_AU1000)
43 { AU1000_UART0_INT, INTC_INT_HIGH_LEVEL, 0}, 43 { AU1000_UART0_INT, INTC_INT_HIGH_LEVEL, 0 },
44 { AU1000_UART1_INT, INTC_INT_HIGH_LEVEL, 0}, 44 { AU1000_UART1_INT, INTC_INT_HIGH_LEVEL, 0 },
45 { AU1000_UART2_INT, INTC_INT_HIGH_LEVEL, 0}, 45 { AU1000_UART2_INT, INTC_INT_HIGH_LEVEL, 0 },
46 { AU1000_UART3_INT, INTC_INT_HIGH_LEVEL, 0}, 46 { AU1000_UART3_INT, INTC_INT_HIGH_LEVEL, 0 },
47 { AU1000_SSI0_INT, INTC_INT_HIGH_LEVEL, 0}, 47 { AU1000_SSI0_INT, INTC_INT_HIGH_LEVEL, 0 },
48 { AU1000_SSI1_INT, INTC_INT_HIGH_LEVEL, 0}, 48 { AU1000_SSI1_INT, INTC_INT_HIGH_LEVEL, 0 },
49 { AU1000_DMA_INT_BASE, INTC_INT_HIGH_LEVEL, 0}, 49 { AU1000_DMA_INT_BASE, INTC_INT_HIGH_LEVEL, 0 },
50 { AU1000_DMA_INT_BASE+1, INTC_INT_HIGH_LEVEL, 0}, 50 { AU1000_DMA_INT_BASE+1, INTC_INT_HIGH_LEVEL, 0 },
51 { AU1000_DMA_INT_BASE+2, INTC_INT_HIGH_LEVEL, 0}, 51 { AU1000_DMA_INT_BASE+2, INTC_INT_HIGH_LEVEL, 0 },
52 { AU1000_DMA_INT_BASE+3, INTC_INT_HIGH_LEVEL, 0}, 52 { AU1000_DMA_INT_BASE+3, INTC_INT_HIGH_LEVEL, 0 },
53 { AU1000_DMA_INT_BASE+4, INTC_INT_HIGH_LEVEL, 0}, 53 { AU1000_DMA_INT_BASE+4, INTC_INT_HIGH_LEVEL, 0 },
54 { AU1000_DMA_INT_BASE+5, INTC_INT_HIGH_LEVEL, 0}, 54 { AU1000_DMA_INT_BASE+5, INTC_INT_HIGH_LEVEL, 0 },
55 { AU1000_DMA_INT_BASE+6, INTC_INT_HIGH_LEVEL, 0}, 55 { AU1000_DMA_INT_BASE+6, INTC_INT_HIGH_LEVEL, 0 },
56 { AU1000_DMA_INT_BASE+7, INTC_INT_HIGH_LEVEL, 0}, 56 { AU1000_DMA_INT_BASE+7, INTC_INT_HIGH_LEVEL, 0 },
57 { AU1000_TOY_INT, INTC_INT_RISE_EDGE, 0 }, 57 { AU1000_TOY_INT, INTC_INT_RISE_EDGE, 0 },
58 { AU1000_TOY_MATCH0_INT, INTC_INT_RISE_EDGE, 0 }, 58 { AU1000_TOY_MATCH0_INT, INTC_INT_RISE_EDGE, 0 },
59 { AU1000_TOY_MATCH1_INT, INTC_INT_RISE_EDGE, 0 }, 59 { AU1000_TOY_MATCH1_INT, INTC_INT_RISE_EDGE, 0 },
@@ -62,32 +62,32 @@ struct au1xxx_irqmap __initdata au1xxx_ic0_map[] = {
62 { AU1000_RTC_MATCH0_INT, INTC_INT_RISE_EDGE, 0 }, 62 { AU1000_RTC_MATCH0_INT, INTC_INT_RISE_EDGE, 0 },
63 { AU1000_RTC_MATCH1_INT, INTC_INT_RISE_EDGE, 0 }, 63 { AU1000_RTC_MATCH1_INT, INTC_INT_RISE_EDGE, 0 },
64 { AU1000_RTC_MATCH2_INT, INTC_INT_RISE_EDGE, 0 }, 64 { AU1000_RTC_MATCH2_INT, INTC_INT_RISE_EDGE, 0 },
65 { AU1000_IRDA_TX_INT, INTC_INT_HIGH_LEVEL, 0}, 65 { AU1000_IRDA_TX_INT, INTC_INT_HIGH_LEVEL, 0 },
66 { AU1000_IRDA_RX_INT, INTC_INT_HIGH_LEVEL, 0}, 66 { AU1000_IRDA_RX_INT, INTC_INT_HIGH_LEVEL, 0 },
67 { AU1000_USB_DEV_REQ_INT, INTC_INT_HIGH_LEVEL, 0 }, 67 { AU1000_USB_DEV_REQ_INT, INTC_INT_HIGH_LEVEL, 0 },
68 { AU1000_USB_DEV_SUS_INT, INTC_INT_RISE_EDGE, 0 }, 68 { AU1000_USB_DEV_SUS_INT, INTC_INT_RISE_EDGE, 0 },
69 { AU1000_USB_HOST_INT, INTC_INT_LOW_LEVEL, 0 }, 69 { AU1000_USB_HOST_INT, INTC_INT_LOW_LEVEL, 0 },
70 { AU1000_ACSYNC_INT, INTC_INT_RISE_EDGE, 0 }, 70 { AU1000_ACSYNC_INT, INTC_INT_RISE_EDGE, 0 },
71 { AU1000_MAC0_DMA_INT, INTC_INT_HIGH_LEVEL, 0}, 71 { AU1000_MAC0_DMA_INT, INTC_INT_HIGH_LEVEL, 0 },
72 { AU1000_MAC1_DMA_INT, INTC_INT_HIGH_LEVEL, 0}, 72 { AU1000_MAC1_DMA_INT, INTC_INT_HIGH_LEVEL, 0 },
73 { AU1000_AC97C_INT, INTC_INT_RISE_EDGE, 0 }, 73 { AU1000_AC97C_INT, INTC_INT_RISE_EDGE, 0 },
74 74
75#elif defined(CONFIG_SOC_AU1500) 75#elif defined(CONFIG_SOC_AU1500)
76 76
77 { AU1500_UART0_INT, INTC_INT_HIGH_LEVEL, 0}, 77 { AU1500_UART0_INT, INTC_INT_HIGH_LEVEL, 0 },
78 { AU1000_PCI_INTA, INTC_INT_LOW_LEVEL, 0 }, 78 { AU1000_PCI_INTA, INTC_INT_LOW_LEVEL, 0 },
79 { AU1000_PCI_INTB, INTC_INT_LOW_LEVEL, 0 }, 79 { AU1000_PCI_INTB, INTC_INT_LOW_LEVEL, 0 },
80 { AU1500_UART3_INT, INTC_INT_HIGH_LEVEL, 0}, 80 { AU1500_UART3_INT, INTC_INT_HIGH_LEVEL, 0 },
81 { AU1000_PCI_INTC, INTC_INT_LOW_LEVEL, 0 }, 81 { AU1000_PCI_INTC, INTC_INT_LOW_LEVEL, 0 },
82 { AU1000_PCI_INTD, INTC_INT_LOW_LEVEL, 0 }, 82 { AU1000_PCI_INTD, INTC_INT_LOW_LEVEL, 0 },
83 { AU1000_DMA_INT_BASE, INTC_INT_HIGH_LEVEL, 0}, 83 { AU1000_DMA_INT_BASE, INTC_INT_HIGH_LEVEL, 0 },
84 { AU1000_DMA_INT_BASE+1, INTC_INT_HIGH_LEVEL, 0}, 84 { AU1000_DMA_INT_BASE+1, INTC_INT_HIGH_LEVEL, 0 },
85 { AU1000_DMA_INT_BASE+2, INTC_INT_HIGH_LEVEL, 0}, 85 { AU1000_DMA_INT_BASE+2, INTC_INT_HIGH_LEVEL, 0 },
86 { AU1000_DMA_INT_BASE+3, INTC_INT_HIGH_LEVEL, 0}, 86 { AU1000_DMA_INT_BASE+3, INTC_INT_HIGH_LEVEL, 0 },
87 { AU1000_DMA_INT_BASE+4, INTC_INT_HIGH_LEVEL, 0}, 87 { AU1000_DMA_INT_BASE+4, INTC_INT_HIGH_LEVEL, 0 },
88 { AU1000_DMA_INT_BASE+5, INTC_INT_HIGH_LEVEL, 0}, 88 { AU1000_DMA_INT_BASE+5, INTC_INT_HIGH_LEVEL, 0 },
89 { AU1000_DMA_INT_BASE+6, INTC_INT_HIGH_LEVEL, 0}, 89 { AU1000_DMA_INT_BASE+6, INTC_INT_HIGH_LEVEL, 0 },
90 { AU1000_DMA_INT_BASE+7, INTC_INT_HIGH_LEVEL, 0}, 90 { AU1000_DMA_INT_BASE+7, INTC_INT_HIGH_LEVEL, 0 },
91 { AU1000_TOY_INT, INTC_INT_RISE_EDGE, 0 }, 91 { AU1000_TOY_INT, INTC_INT_RISE_EDGE, 0 },
92 { AU1000_TOY_MATCH0_INT, INTC_INT_RISE_EDGE, 0 }, 92 { AU1000_TOY_MATCH0_INT, INTC_INT_RISE_EDGE, 0 },
93 { AU1000_TOY_MATCH1_INT, INTC_INT_RISE_EDGE, 0 }, 93 { AU1000_TOY_MATCH1_INT, INTC_INT_RISE_EDGE, 0 },
@@ -100,26 +100,26 @@ struct au1xxx_irqmap __initdata au1xxx_ic0_map[] = {
100 { AU1000_USB_DEV_SUS_INT, INTC_INT_RISE_EDGE, 0 }, 100 { AU1000_USB_DEV_SUS_INT, INTC_INT_RISE_EDGE, 0 },
101 { AU1000_USB_HOST_INT, INTC_INT_LOW_LEVEL, 0 }, 101 { AU1000_USB_HOST_INT, INTC_INT_LOW_LEVEL, 0 },
102 { AU1000_ACSYNC_INT, INTC_INT_RISE_EDGE, 0 }, 102 { AU1000_ACSYNC_INT, INTC_INT_RISE_EDGE, 0 },
103 { AU1500_MAC0_DMA_INT, INTC_INT_HIGH_LEVEL, 0}, 103 { AU1500_MAC0_DMA_INT, INTC_INT_HIGH_LEVEL, 0 },
104 { AU1500_MAC1_DMA_INT, INTC_INT_HIGH_LEVEL, 0}, 104 { AU1500_MAC1_DMA_INT, INTC_INT_HIGH_LEVEL, 0 },
105 { AU1000_AC97C_INT, INTC_INT_RISE_EDGE, 0 }, 105 { AU1000_AC97C_INT, INTC_INT_RISE_EDGE, 0 },
106 106
107#elif defined(CONFIG_SOC_AU1100) 107#elif defined(CONFIG_SOC_AU1100)
108 108
109 { AU1100_UART0_INT, INTC_INT_HIGH_LEVEL, 0}, 109 { AU1100_UART0_INT, INTC_INT_HIGH_LEVEL, 0 },
110 { AU1100_UART1_INT, INTC_INT_HIGH_LEVEL, 0}, 110 { AU1100_UART1_INT, INTC_INT_HIGH_LEVEL, 0 },
111 { AU1100_SD_INT, INTC_INT_HIGH_LEVEL, 0}, 111 { AU1100_SD_INT, INTC_INT_HIGH_LEVEL, 0 },
112 { AU1100_UART3_INT, INTC_INT_HIGH_LEVEL, 0}, 112 { AU1100_UART3_INT, INTC_INT_HIGH_LEVEL, 0 },
113 { AU1000_SSI0_INT, INTC_INT_HIGH_LEVEL, 0}, 113 { AU1000_SSI0_INT, INTC_INT_HIGH_LEVEL, 0 },
114 { AU1000_SSI1_INT, INTC_INT_HIGH_LEVEL, 0}, 114 { AU1000_SSI1_INT, INTC_INT_HIGH_LEVEL, 0 },
115 { AU1000_DMA_INT_BASE, INTC_INT_HIGH_LEVEL, 0}, 115 { AU1000_DMA_INT_BASE, INTC_INT_HIGH_LEVEL, 0 },
116 { AU1000_DMA_INT_BASE+1, INTC_INT_HIGH_LEVEL, 0}, 116 { AU1000_DMA_INT_BASE+1, INTC_INT_HIGH_LEVEL, 0 },
117 { AU1000_DMA_INT_BASE+2, INTC_INT_HIGH_LEVEL, 0}, 117 { AU1000_DMA_INT_BASE+2, INTC_INT_HIGH_LEVEL, 0 },
118 { AU1000_DMA_INT_BASE+3, INTC_INT_HIGH_LEVEL, 0}, 118 { AU1000_DMA_INT_BASE+3, INTC_INT_HIGH_LEVEL, 0 },
119 { AU1000_DMA_INT_BASE+4, INTC_INT_HIGH_LEVEL, 0}, 119 { AU1000_DMA_INT_BASE+4, INTC_INT_HIGH_LEVEL, 0 },
120 { AU1000_DMA_INT_BASE+5, INTC_INT_HIGH_LEVEL, 0}, 120 { AU1000_DMA_INT_BASE+5, INTC_INT_HIGH_LEVEL, 0 },
121 { AU1000_DMA_INT_BASE+6, INTC_INT_HIGH_LEVEL, 0}, 121 { AU1000_DMA_INT_BASE+6, INTC_INT_HIGH_LEVEL, 0 },
122 { AU1000_DMA_INT_BASE+7, INTC_INT_HIGH_LEVEL, 0}, 122 { AU1000_DMA_INT_BASE+7, INTC_INT_HIGH_LEVEL, 0 },
123 { AU1000_TOY_INT, INTC_INT_RISE_EDGE, 0 }, 123 { AU1000_TOY_INT, INTC_INT_RISE_EDGE, 0 },
124 { AU1000_TOY_MATCH0_INT, INTC_INT_RISE_EDGE, 0 }, 124 { AU1000_TOY_MATCH0_INT, INTC_INT_RISE_EDGE, 0 },
125 { AU1000_TOY_MATCH1_INT, INTC_INT_RISE_EDGE, 0 }, 125 { AU1000_TOY_MATCH1_INT, INTC_INT_RISE_EDGE, 0 },
@@ -128,33 +128,33 @@ struct au1xxx_irqmap __initdata au1xxx_ic0_map[] = {
128 { AU1000_RTC_MATCH0_INT, INTC_INT_RISE_EDGE, 0 }, 128 { AU1000_RTC_MATCH0_INT, INTC_INT_RISE_EDGE, 0 },
129 { AU1000_RTC_MATCH1_INT, INTC_INT_RISE_EDGE, 0 }, 129 { AU1000_RTC_MATCH1_INT, INTC_INT_RISE_EDGE, 0 },
130 { AU1000_RTC_MATCH2_INT, INTC_INT_RISE_EDGE, 0 }, 130 { AU1000_RTC_MATCH2_INT, INTC_INT_RISE_EDGE, 0 },
131 { AU1000_IRDA_TX_INT, INTC_INT_HIGH_LEVEL, 0}, 131 { AU1000_IRDA_TX_INT, INTC_INT_HIGH_LEVEL, 0 },
132 { AU1000_IRDA_RX_INT, INTC_INT_HIGH_LEVEL, 0}, 132 { AU1000_IRDA_RX_INT, INTC_INT_HIGH_LEVEL, 0 },
133 { AU1000_USB_DEV_REQ_INT, INTC_INT_HIGH_LEVEL, 0 }, 133 { AU1000_USB_DEV_REQ_INT, INTC_INT_HIGH_LEVEL, 0 },
134 { AU1000_USB_DEV_SUS_INT, INTC_INT_RISE_EDGE, 0 }, 134 { AU1000_USB_DEV_SUS_INT, INTC_INT_RISE_EDGE, 0 },
135 { AU1000_USB_HOST_INT, INTC_INT_LOW_LEVEL, 0 }, 135 { AU1000_USB_HOST_INT, INTC_INT_LOW_LEVEL, 0 },
136 { AU1000_ACSYNC_INT, INTC_INT_RISE_EDGE, 0 }, 136 { AU1000_ACSYNC_INT, INTC_INT_RISE_EDGE, 0 },
137 { AU1100_MAC0_DMA_INT, INTC_INT_HIGH_LEVEL, 0}, 137 { AU1100_MAC0_DMA_INT, INTC_INT_HIGH_LEVEL, 0 },
138 /*{ AU1000_GPIO215_208_INT, INTC_INT_HIGH_LEVEL, 0},*/ 138 /* { AU1000_GPIO215_208_INT, INTC_INT_HIGH_LEVEL, 0 }, */
139 { AU1100_LCD_INT, INTC_INT_HIGH_LEVEL, 0}, 139 { AU1100_LCD_INT, INTC_INT_HIGH_LEVEL, 0 },
140 { AU1000_AC97C_INT, INTC_INT_RISE_EDGE, 0 }, 140 { AU1000_AC97C_INT, INTC_INT_RISE_EDGE, 0 },
141 141
142#elif defined(CONFIG_SOC_AU1550) 142#elif defined(CONFIG_SOC_AU1550)
143 143
144 { AU1550_UART0_INT, INTC_INT_HIGH_LEVEL, 0}, 144 { AU1550_UART0_INT, INTC_INT_HIGH_LEVEL, 0 },
145 { AU1550_PCI_INTA, INTC_INT_LOW_LEVEL, 0 }, 145 { AU1550_PCI_INTA, INTC_INT_LOW_LEVEL, 0 },
146 { AU1550_PCI_INTB, INTC_INT_LOW_LEVEL, 0 }, 146 { AU1550_PCI_INTB, INTC_INT_LOW_LEVEL, 0 },
147 { AU1550_DDMA_INT, INTC_INT_HIGH_LEVEL, 0}, 147 { AU1550_DDMA_INT, INTC_INT_HIGH_LEVEL, 0 },
148 { AU1550_CRYPTO_INT, INTC_INT_HIGH_LEVEL, 0}, 148 { AU1550_CRYPTO_INT, INTC_INT_HIGH_LEVEL, 0 },
149 { AU1550_PCI_INTC, INTC_INT_LOW_LEVEL, 0 }, 149 { AU1550_PCI_INTC, INTC_INT_LOW_LEVEL, 0 },
150 { AU1550_PCI_INTD, INTC_INT_LOW_LEVEL, 0 }, 150 { AU1550_PCI_INTD, INTC_INT_LOW_LEVEL, 0 },
151 { AU1550_PCI_RST_INT, INTC_INT_LOW_LEVEL, 0 }, 151 { AU1550_PCI_RST_INT, INTC_INT_LOW_LEVEL, 0 },
152 { AU1550_UART1_INT, INTC_INT_HIGH_LEVEL, 0}, 152 { AU1550_UART1_INT, INTC_INT_HIGH_LEVEL, 0 },
153 { AU1550_UART3_INT, INTC_INT_HIGH_LEVEL, 0}, 153 { AU1550_UART3_INT, INTC_INT_HIGH_LEVEL, 0 },
154 { AU1550_PSC0_INT, INTC_INT_HIGH_LEVEL, 0}, 154 { AU1550_PSC0_INT, INTC_INT_HIGH_LEVEL, 0 },
155 { AU1550_PSC1_INT, INTC_INT_HIGH_LEVEL, 0}, 155 { AU1550_PSC1_INT, INTC_INT_HIGH_LEVEL, 0 },
156 { AU1550_PSC2_INT, INTC_INT_HIGH_LEVEL, 0}, 156 { AU1550_PSC2_INT, INTC_INT_HIGH_LEVEL, 0 },
157 { AU1550_PSC3_INT, INTC_INT_HIGH_LEVEL, 0}, 157 { AU1550_PSC3_INT, INTC_INT_HIGH_LEVEL, 0 },
158 { AU1000_TOY_INT, INTC_INT_RISE_EDGE, 0 }, 158 { AU1000_TOY_INT, INTC_INT_RISE_EDGE, 0 },
159 { AU1000_TOY_MATCH0_INT, INTC_INT_RISE_EDGE, 0 }, 159 { AU1000_TOY_MATCH0_INT, INTC_INT_RISE_EDGE, 0 },
160 { AU1000_TOY_MATCH1_INT, INTC_INT_RISE_EDGE, 0 }, 160 { AU1000_TOY_MATCH1_INT, INTC_INT_RISE_EDGE, 0 },
@@ -163,26 +163,26 @@ struct au1xxx_irqmap __initdata au1xxx_ic0_map[] = {
163 { AU1000_RTC_MATCH0_INT, INTC_INT_RISE_EDGE, 0 }, 163 { AU1000_RTC_MATCH0_INT, INTC_INT_RISE_EDGE, 0 },
164 { AU1000_RTC_MATCH1_INT, INTC_INT_RISE_EDGE, 0 }, 164 { AU1000_RTC_MATCH1_INT, INTC_INT_RISE_EDGE, 0 },
165 { AU1000_RTC_MATCH2_INT, INTC_INT_RISE_EDGE, 0 }, 165 { AU1000_RTC_MATCH2_INT, INTC_INT_RISE_EDGE, 0 },
166 { AU1550_NAND_INT, INTC_INT_RISE_EDGE, 0}, 166 { AU1550_NAND_INT, INTC_INT_RISE_EDGE, 0 },
167 { AU1550_USB_DEV_REQ_INT, INTC_INT_HIGH_LEVEL, 0 }, 167 { AU1550_USB_DEV_REQ_INT, INTC_INT_HIGH_LEVEL, 0 },
168 { AU1550_USB_DEV_SUS_INT, INTC_INT_RISE_EDGE, 0 }, 168 { AU1550_USB_DEV_SUS_INT, INTC_INT_RISE_EDGE, 0 },
169 { AU1550_USB_HOST_INT, INTC_INT_LOW_LEVEL, 0 }, 169 { AU1550_USB_HOST_INT, INTC_INT_LOW_LEVEL, 0 },
170 { AU1550_MAC0_DMA_INT, INTC_INT_HIGH_LEVEL, 0}, 170 { AU1550_MAC0_DMA_INT, INTC_INT_HIGH_LEVEL, 0 },
171 { AU1550_MAC1_DMA_INT, INTC_INT_HIGH_LEVEL, 0}, 171 { AU1550_MAC1_DMA_INT, INTC_INT_HIGH_LEVEL, 0 },
172 172
173#elif defined(CONFIG_SOC_AU1200) 173#elif defined(CONFIG_SOC_AU1200)
174 174
175 { AU1200_UART0_INT, INTC_INT_HIGH_LEVEL, 0}, 175 { AU1200_UART0_INT, INTC_INT_HIGH_LEVEL, 0 },
176 { AU1200_SWT_INT, INTC_INT_RISE_EDGE, 0 }, 176 { AU1200_SWT_INT, INTC_INT_RISE_EDGE, 0 },
177 { AU1200_SD_INT, INTC_INT_HIGH_LEVEL, 0}, 177 { AU1200_SD_INT, INTC_INT_HIGH_LEVEL, 0 },
178 { AU1200_DDMA_INT, INTC_INT_HIGH_LEVEL, 0}, 178 { AU1200_DDMA_INT, INTC_INT_HIGH_LEVEL, 0 },
179 { AU1200_MAE_BE_INT, INTC_INT_HIGH_LEVEL, 0 }, 179 { AU1200_MAE_BE_INT, INTC_INT_HIGH_LEVEL, 0 },
180 { AU1200_UART1_INT, INTC_INT_HIGH_LEVEL, 0}, 180 { AU1200_UART1_INT, INTC_INT_HIGH_LEVEL, 0 },
181 { AU1200_MAE_FE_INT, INTC_INT_HIGH_LEVEL, 0 }, 181 { AU1200_MAE_FE_INT, INTC_INT_HIGH_LEVEL, 0 },
182 { AU1200_PSC0_INT, INTC_INT_HIGH_LEVEL, 0}, 182 { AU1200_PSC0_INT, INTC_INT_HIGH_LEVEL, 0 },
183 { AU1200_PSC1_INT, INTC_INT_HIGH_LEVEL, 0}, 183 { AU1200_PSC1_INT, INTC_INT_HIGH_LEVEL, 0 },
184 { AU1200_AES_INT, INTC_INT_HIGH_LEVEL, 0}, 184 { AU1200_AES_INT, INTC_INT_HIGH_LEVEL, 0 },
185 { AU1200_CAMERA_INT, INTC_INT_HIGH_LEVEL, 0}, 185 { AU1200_CAMERA_INT, INTC_INT_HIGH_LEVEL, 0 },
186 { AU1000_TOY_INT, INTC_INT_RISE_EDGE, 0 }, 186 { AU1000_TOY_INT, INTC_INT_RISE_EDGE, 0 },
187 { AU1000_TOY_MATCH0_INT, INTC_INT_RISE_EDGE, 0 }, 187 { AU1000_TOY_MATCH0_INT, INTC_INT_RISE_EDGE, 0 },
188 { AU1000_TOY_MATCH1_INT, INTC_INT_RISE_EDGE, 0 }, 188 { AU1000_TOY_MATCH1_INT, INTC_INT_RISE_EDGE, 0 },
@@ -191,10 +191,10 @@ struct au1xxx_irqmap __initdata au1xxx_ic0_map[] = {
191 { AU1000_RTC_MATCH0_INT, INTC_INT_RISE_EDGE, 0 }, 191 { AU1000_RTC_MATCH0_INT, INTC_INT_RISE_EDGE, 0 },
192 { AU1000_RTC_MATCH1_INT, INTC_INT_RISE_EDGE, 0 }, 192 { AU1000_RTC_MATCH1_INT, INTC_INT_RISE_EDGE, 0 },
193 { AU1000_RTC_MATCH2_INT, INTC_INT_RISE_EDGE, 0 }, 193 { AU1000_RTC_MATCH2_INT, INTC_INT_RISE_EDGE, 0 },
194 { AU1200_NAND_INT, INTC_INT_RISE_EDGE, 0}, 194 { AU1200_NAND_INT, INTC_INT_RISE_EDGE, 0 },
195 { AU1200_USB_INT, INTC_INT_HIGH_LEVEL, 0 }, 195 { AU1200_USB_INT, INTC_INT_HIGH_LEVEL, 0 },
196 { AU1200_LCD_INT, INTC_INT_HIGH_LEVEL, 0}, 196 { AU1200_LCD_INT, INTC_INT_HIGH_LEVEL, 0 },
197 { AU1200_MAE_BOTH_INT, INTC_INT_HIGH_LEVEL, 0}, 197 { AU1200_MAE_BOTH_INT, INTC_INT_HIGH_LEVEL, 0 },
198 198
199#else 199#else
200#error "Error: Unknown Alchemy SOC" 200#error "Error: Unknown Alchemy SOC"
@@ -203,4 +203,3 @@ struct au1xxx_irqmap __initdata au1xxx_ic0_map[] = {
203}; 203};
204 204
205int __initdata au1xxx_ic0_nr_irqs = ARRAY_SIZE(au1xxx_ic0_map); 205int __initdata au1xxx_ic0_nr_irqs = ARRAY_SIZE(au1xxx_ic0_map);
206
diff --git a/arch/mips/au1000/common/clocks.c b/arch/mips/au1000/common/clocks.c
index 3ce6cace0eb0..46f8ee0e2657 100644
--- a/arch/mips/au1000/common/clocks.c
+++ b/arch/mips/au1000/common/clocks.c
@@ -1,10 +1,9 @@
1/* 1/*
2 * BRIEF MODULE DESCRIPTION 2 * BRIEF MODULE DESCRIPTION
3 * Simple Au1000 clocks routines. 3 * Simple Au1xx0 clocks routines.
4 * 4 *
5 * Copyright 2001 MontaVista Software Inc. 5 * Copyright 2001, 2008 MontaVista Software Inc.
6 * Author: MontaVista Software, Inc. 6 * Author: MontaVista Software, Inc. <source@mvista.com>
7 * ppopov@mvista.com or source@mvista.com
8 * 7 *
9 * This program is free software; you can redistribute it and/or modify it 8 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the 9 * under the terms of the GNU General Public License as published by the
@@ -30,8 +29,8 @@
30#include <linux/module.h> 29#include <linux/module.h>
31#include <asm/mach-au1x00/au1000.h> 30#include <asm/mach-au1x00/au1000.h>
32 31
33static unsigned int au1x00_clock; // Hz 32static unsigned int au1x00_clock; /* Hz */
34static unsigned int lcd_clock; // KHz 33static unsigned int lcd_clock; /* KHz */
35static unsigned long uart_baud_base; 34static unsigned long uart_baud_base;
36 35
37/* 36/*
@@ -47,8 +46,6 @@ unsigned int get_au1x00_speed(void)
47 return au1x00_clock; 46 return au1x00_clock;
48} 47}
49 48
50
51
52/* 49/*
53 * The UART baud base is not known at compile time ... if 50 * The UART baud base is not known at compile time ... if
54 * we want to be able to use the same code on different 51 * we want to be able to use the same code on different
@@ -73,24 +70,23 @@ void set_au1x00_uart_baud_base(unsigned long new_baud_base)
73void set_au1x00_lcd_clock(void) 70void set_au1x00_lcd_clock(void)
74{ 71{
75 unsigned int static_cfg0; 72 unsigned int static_cfg0;
76 unsigned int sys_busclk = 73 unsigned int sys_busclk = (get_au1x00_speed() / 1000) /
77 (get_au1x00_speed()/1000) / 74 ((int)(au_readl(SYS_POWERCTRL) & 0x03) + 2);
78 ((int)(au_readl(SYS_POWERCTRL)&0x03) + 2);
79 75
80 static_cfg0 = au_readl(MEM_STCFG0); 76 static_cfg0 = au_readl(MEM_STCFG0);
81 77
82 if (static_cfg0 & (1<<11)) 78 if (static_cfg0 & (1 << 11))
83 lcd_clock = sys_busclk / 5; /* note: BCLK switching fails with D5 */ 79 lcd_clock = sys_busclk / 5; /* note: BCLK switching fails with D5 */
84 else 80 else
85 lcd_clock = sys_busclk / 4; 81 lcd_clock = sys_busclk / 4;
86 82
87 if (lcd_clock > 50000) /* Epson MAX */ 83 if (lcd_clock > 50000) /* Epson MAX */
88 printk("warning: LCD clock too high (%d KHz)\n", lcd_clock); 84 printk(KERN_WARNING "warning: LCD clock too high (%u KHz)\n",
85 lcd_clock);
89} 86}
90 87
91unsigned int get_au1x00_lcd_clock(void) 88unsigned int get_au1x00_lcd_clock(void)
92{ 89{
93 return lcd_clock; 90 return lcd_clock;
94} 91}
95
96EXPORT_SYMBOL(get_au1x00_lcd_clock); 92EXPORT_SYMBOL(get_au1x00_lcd_clock);
diff --git a/arch/mips/au1000/common/cputable.c b/arch/mips/au1000/common/cputable.c
index 8c93a05d7382..ba6430bc2d03 100644
--- a/arch/mips/au1000/common/cputable.c
+++ b/arch/mips/au1000/common/cputable.c
@@ -14,7 +14,7 @@
14 14
15#include <asm/mach-au1x00/au1000.h> 15#include <asm/mach-au1x00/au1000.h>
16 16
17struct cpu_spec* cur_cpu_spec[NR_CPUS]; 17struct cpu_spec *cur_cpu_spec[NR_CPUS];
18 18
19/* With some thought, we can probably use the mask to reduce the 19/* With some thought, we can probably use the mask to reduce the
20 * size of the table. 20 * size of the table.
@@ -39,8 +39,7 @@ struct cpu_spec cpu_specs[] = {
39 { 0x00000000, 0x00000000, "Unknown Au1xxx", 1, 0, 0 } 39 { 0x00000000, 0x00000000, "Unknown Au1xxx", 1, 0, 0 }
40}; 40};
41 41
42void 42void set_cpuspec(void)
43set_cpuspec(void)
44{ 43{
45 struct cpu_spec *sp; 44 struct cpu_spec *sp;
46 u32 prid; 45 u32 prid;
diff --git a/arch/mips/au1000/common/dbdma.c b/arch/mips/au1000/common/dbdma.c
index 53377dfc0640..42d555236de1 100644
--- a/arch/mips/au1000/common/dbdma.c
+++ b/arch/mips/au1000/common/dbdma.c
@@ -53,12 +53,11 @@
53 */ 53 */
54static DEFINE_SPINLOCK(au1xxx_dbdma_spin_lock); 54static DEFINE_SPINLOCK(au1xxx_dbdma_spin_lock);
55 55
56/* I couldn't find a macro that did this...... 56/* I couldn't find a macro that did this... */
57*/
58#define ALIGN_ADDR(x, a) ((((u32)(x)) + (a-1)) & ~(a-1)) 57#define ALIGN_ADDR(x, a) ((((u32)(x)) + (a-1)) & ~(a-1))
59 58
60static dbdma_global_t *dbdma_gptr = (dbdma_global_t *)DDMA_GLOBAL_BASE; 59static dbdma_global_t *dbdma_gptr = (dbdma_global_t *)DDMA_GLOBAL_BASE;
61static int dbdma_initialized=0; 60static int dbdma_initialized;
62static void au1xxx_dbdma_init(void); 61static void au1xxx_dbdma_init(void);
63 62
64static dbdev_tab_t dbdev_tab[] = { 63static dbdev_tab_t dbdev_tab[] = {
@@ -149,7 +148,7 @@ static dbdev_tab_t dbdev_tab[] = {
149 148
150 { DSCR_CMD0_NAND_FLASH, DEV_FLAGS_IN, 0, 0, 0x00000000, 0, 0 }, 149 { DSCR_CMD0_NAND_FLASH, DEV_FLAGS_IN, 0, 0, 0x00000000, 0, 0 },
151 150
152#endif // CONFIG_SOC_AU1200 151#endif /* CONFIG_SOC_AU1200 */
153 152
154 { DSCR_CMD0_THROTTLE, DEV_FLAGS_ANYUSE, 0, 0, 0x00000000, 0, 0 }, 153 { DSCR_CMD0_THROTTLE, DEV_FLAGS_ANYUSE, 0, 0, 0x00000000, 0, 0 },
155 { DSCR_CMD0_ALWAYS, DEV_FLAGS_ANYUSE, 0, 0, 0x00000000, 0, 0 }, 154 { DSCR_CMD0_ALWAYS, DEV_FLAGS_ANYUSE, 0, 0, 0x00000000, 0, 0 },
@@ -177,8 +176,7 @@ static dbdev_tab_t dbdev_tab[] = {
177 176
178static chan_tab_t *chan_tab_ptr[NUM_DBDMA_CHANS]; 177static chan_tab_t *chan_tab_ptr[NUM_DBDMA_CHANS];
179 178
180static dbdev_tab_t * 179static dbdev_tab_t *find_dbdev_id(u32 id)
181find_dbdev_id(u32 id)
182{ 180{
183 int i; 181 int i;
184 dbdev_tab_t *p; 182 dbdev_tab_t *p;
@@ -190,29 +188,27 @@ find_dbdev_id(u32 id)
190 return NULL; 188 return NULL;
191} 189}
192 190
193void * au1xxx_ddma_get_nextptr_virt(au1x_ddma_desc_t *dp) 191void *au1xxx_ddma_get_nextptr_virt(au1x_ddma_desc_t *dp)
194{ 192{
195 return phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr)); 193 return phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr));
196} 194}
197EXPORT_SYMBOL(au1xxx_ddma_get_nextptr_virt); 195EXPORT_SYMBOL(au1xxx_ddma_get_nextptr_virt);
198 196
199u32 197u32 au1xxx_ddma_add_device(dbdev_tab_t *dev)
200au1xxx_ddma_add_device(dbdev_tab_t *dev)
201{ 198{
202 u32 ret = 0; 199 u32 ret = 0;
203 dbdev_tab_t *p=NULL; 200 dbdev_tab_t *p;
204 static u16 new_id=0x1000; 201 static u16 new_id = 0x1000;
205 202
206 p = find_dbdev_id(~0); 203 p = find_dbdev_id(~0);
207 if ( NULL != p ) 204 if (NULL != p) {
208 {
209 memcpy(p, dev, sizeof(dbdev_tab_t)); 205 memcpy(p, dev, sizeof(dbdev_tab_t));
210 p->dev_id = DSCR_DEV2CUSTOM_ID(new_id, dev->dev_id); 206 p->dev_id = DSCR_DEV2CUSTOM_ID(new_id, dev->dev_id);
211 ret = p->dev_id; 207 ret = p->dev_id;
212 new_id++; 208 new_id++;
213#if 0 209#if 0
214 printk("add_device: id:%x flags:%x padd:%x\n", 210 printk(KERN_DEBUG "add_device: id:%x flags:%x padd:%x\n",
215 p->dev_id, p->dev_flags, p->dev_physaddr ); 211 p->dev_id, p->dev_flags, p->dev_physaddr);
216#endif 212#endif
217 } 213 }
218 214
@@ -220,10 +216,8 @@ au1xxx_ddma_add_device(dbdev_tab_t *dev)
220} 216}
221EXPORT_SYMBOL(au1xxx_ddma_add_device); 217EXPORT_SYMBOL(au1xxx_ddma_add_device);
222 218
223/* Allocate a channel and return a non-zero descriptor if successful. 219/* Allocate a channel and return a non-zero descriptor if successful. */
224*/ 220u32 au1xxx_dbdma_chan_alloc(u32 srcid, u32 destid,
225u32
226au1xxx_dbdma_chan_alloc(u32 srcid, u32 destid,
227 void (*callback)(int, void *), void *callparam) 221 void (*callback)(int, void *), void *callparam)
228{ 222{
229 unsigned long flags; 223 unsigned long flags;
@@ -234,7 +228,8 @@ au1xxx_dbdma_chan_alloc(u32 srcid, u32 destid,
234 chan_tab_t *ctp; 228 chan_tab_t *ctp;
235 au1x_dma_chan_t *cp; 229 au1x_dma_chan_t *cp;
236 230
237 /* We do the intialization on the first channel allocation. 231 /*
232 * We do the intialization on the first channel allocation.
238 * We have to wait because of the interrupt handler initialization 233 * We have to wait because of the interrupt handler initialization
239 * which can't be done successfully during board set up. 234 * which can't be done successfully during board set up.
240 */ 235 */
@@ -242,16 +237,17 @@ au1xxx_dbdma_chan_alloc(u32 srcid, u32 destid,
242 au1xxx_dbdma_init(); 237 au1xxx_dbdma_init();
243 dbdma_initialized = 1; 238 dbdma_initialized = 1;
244 239
245 if ((stp = find_dbdev_id(srcid)) == NULL) 240 stp = find_dbdev_id(srcid);
241 if (stp == NULL)
246 return 0; 242 return 0;
247 if ((dtp = find_dbdev_id(destid)) == NULL) 243 dtp = find_dbdev_id(destid);
244 if (dtp == NULL)
248 return 0; 245 return 0;
249 246
250 used = 0; 247 used = 0;
251 rv = 0; 248 rv = 0;
252 249
253 /* Check to see if we can get both channels. 250 /* Check to see if we can get both channels. */
254 */
255 spin_lock_irqsave(&au1xxx_dbdma_spin_lock, flags); 251 spin_lock_irqsave(&au1xxx_dbdma_spin_lock, flags);
256 if (!(stp->dev_flags & DEV_FLAGS_INUSE) || 252 if (!(stp->dev_flags & DEV_FLAGS_INUSE) ||
257 (stp->dev_flags & DEV_FLAGS_ANYUSE)) { 253 (stp->dev_flags & DEV_FLAGS_ANYUSE)) {
@@ -261,35 +257,30 @@ au1xxx_dbdma_chan_alloc(u32 srcid, u32 destid,
261 (dtp->dev_flags & DEV_FLAGS_ANYUSE)) { 257 (dtp->dev_flags & DEV_FLAGS_ANYUSE)) {
262 /* Got destination */ 258 /* Got destination */
263 dtp->dev_flags |= DEV_FLAGS_INUSE; 259 dtp->dev_flags |= DEV_FLAGS_INUSE;
264 } 260 } else {
265 else { 261 /* Can't get dest. Release src. */
266 /* Can't get dest. Release src.
267 */
268 stp->dev_flags &= ~DEV_FLAGS_INUSE; 262 stp->dev_flags &= ~DEV_FLAGS_INUSE;
269 used++; 263 used++;
270 } 264 }
271 } 265 } else
272 else {
273 used++; 266 used++;
274 }
275 spin_unlock_irqrestore(&au1xxx_dbdma_spin_lock, flags); 267 spin_unlock_irqrestore(&au1xxx_dbdma_spin_lock, flags);
276 268
277 if (!used) { 269 if (!used) {
278 /* Let's see if we can allocate a channel for it. 270 /* Let's see if we can allocate a channel for it. */
279 */
280 ctp = NULL; 271 ctp = NULL;
281 chan = 0; 272 chan = 0;
282 spin_lock_irqsave(&au1xxx_dbdma_spin_lock, flags); 273 spin_lock_irqsave(&au1xxx_dbdma_spin_lock, flags);
283 for (i=0; i<NUM_DBDMA_CHANS; i++) { 274 for (i = 0; i < NUM_DBDMA_CHANS; i++)
284 if (chan_tab_ptr[i] == NULL) { 275 if (chan_tab_ptr[i] == NULL) {
285 /* If kmalloc fails, it is caught below same 276 /*
277 * If kmalloc fails, it is caught below same
286 * as a channel not available. 278 * as a channel not available.
287 */ 279 */
288 ctp = kmalloc(sizeof(chan_tab_t), GFP_ATOMIC); 280 ctp = kmalloc(sizeof(chan_tab_t), GFP_ATOMIC);
289 chan_tab_ptr[i] = ctp; 281 chan_tab_ptr[i] = ctp;
290 break; 282 break;
291 } 283 }
292 }
293 spin_unlock_irqrestore(&au1xxx_dbdma_spin_lock, flags); 284 spin_unlock_irqrestore(&au1xxx_dbdma_spin_lock, flags);
294 285
295 if (ctp != NULL) { 286 if (ctp != NULL) {
@@ -304,8 +295,7 @@ au1xxx_dbdma_chan_alloc(u32 srcid, u32 destid,
304 ctp->chan_callback = callback; 295 ctp->chan_callback = callback;
305 ctp->chan_callparam = callparam; 296 ctp->chan_callparam = callparam;
306 297
307 /* Initialize channel configuration. 298 /* Initialize channel configuration. */
308 */
309 i = 0; 299 i = 0;
310 if (stp->dev_intlevel) 300 if (stp->dev_intlevel)
311 i |= DDMA_CFG_SED; 301 i |= DDMA_CFG_SED;
@@ -326,8 +316,7 @@ au1xxx_dbdma_chan_alloc(u32 srcid, u32 destid,
326 * operations. 316 * operations.
327 */ 317 */
328 rv = (u32)(&chan_tab_ptr[chan]); 318 rv = (u32)(&chan_tab_ptr[chan]);
329 } 319 } else {
330 else {
331 /* Release devices */ 320 /* Release devices */
332 stp->dev_flags &= ~DEV_FLAGS_INUSE; 321 stp->dev_flags &= ~DEV_FLAGS_INUSE;
333 dtp->dev_flags &= ~DEV_FLAGS_INUSE; 322 dtp->dev_flags &= ~DEV_FLAGS_INUSE;
@@ -337,11 +326,11 @@ au1xxx_dbdma_chan_alloc(u32 srcid, u32 destid,
337} 326}
338EXPORT_SYMBOL(au1xxx_dbdma_chan_alloc); 327EXPORT_SYMBOL(au1xxx_dbdma_chan_alloc);
339 328
340/* Set the device width if source or destination is a FIFO. 329/*
330 * Set the device width if source or destination is a FIFO.
341 * Should be 8, 16, or 32 bits. 331 * Should be 8, 16, or 32 bits.
342 */ 332 */
343u32 333u32 au1xxx_dbdma_set_devwidth(u32 chanid, int bits)
344au1xxx_dbdma_set_devwidth(u32 chanid, int bits)
345{ 334{
346 u32 rv; 335 u32 rv;
347 chan_tab_t *ctp; 336 chan_tab_t *ctp;
@@ -365,10 +354,8 @@ au1xxx_dbdma_set_devwidth(u32 chanid, int bits)
365} 354}
366EXPORT_SYMBOL(au1xxx_dbdma_set_devwidth); 355EXPORT_SYMBOL(au1xxx_dbdma_set_devwidth);
367 356
368/* Allocate a descriptor ring, initializing as much as possible. 357/* Allocate a descriptor ring, initializing as much as possible. */
369*/ 358u32 au1xxx_dbdma_ring_alloc(u32 chanid, int entries)
370u32
371au1xxx_dbdma_ring_alloc(u32 chanid, int entries)
372{ 359{
373 int i; 360 int i;
374 u32 desc_base, srcid, destid; 361 u32 desc_base, srcid, destid;
@@ -378,43 +365,45 @@ au1xxx_dbdma_ring_alloc(u32 chanid, int entries)
378 dbdev_tab_t *stp, *dtp; 365 dbdev_tab_t *stp, *dtp;
379 au1x_ddma_desc_t *dp; 366 au1x_ddma_desc_t *dp;
380 367
381 /* I guess we could check this to be within the 368 /*
369 * I guess we could check this to be within the
382 * range of the table...... 370 * range of the table......
383 */ 371 */
384 ctp = *((chan_tab_t **)chanid); 372 ctp = *((chan_tab_t **)chanid);
385 stp = ctp->chan_src; 373 stp = ctp->chan_src;
386 dtp = ctp->chan_dest; 374 dtp = ctp->chan_dest;
387 375
388 /* The descriptors must be 32-byte aligned. There is a 376 /*
377 * The descriptors must be 32-byte aligned. There is a
389 * possibility the allocation will give us such an address, 378 * possibility the allocation will give us such an address,
390 * and if we try that first we are likely to not waste larger 379 * and if we try that first we are likely to not waste larger
391 * slabs of memory. 380 * slabs of memory.
392 */ 381 */
393 desc_base = (u32)kmalloc(entries * sizeof(au1x_ddma_desc_t), 382 desc_base = (u32)kmalloc(entries * sizeof(au1x_ddma_desc_t),
394 GFP_KERNEL|GFP_DMA); 383 GFP_KERNEL|GFP_DMA);
395 if (desc_base == 0) 384 if (desc_base == 0)
396 return 0; 385 return 0;
397 386
398 if (desc_base & 0x1f) { 387 if (desc_base & 0x1f) {
399 /* Lost....do it again, allocate extra, and round 388 /*
389 * Lost....do it again, allocate extra, and round
400 * the address base. 390 * the address base.
401 */ 391 */
402 kfree((const void *)desc_base); 392 kfree((const void *)desc_base);
403 i = entries * sizeof(au1x_ddma_desc_t); 393 i = entries * sizeof(au1x_ddma_desc_t);
404 i += (sizeof(au1x_ddma_desc_t) - 1); 394 i += (sizeof(au1x_ddma_desc_t) - 1);
405 if ((desc_base = (u32)kmalloc(i, GFP_KERNEL|GFP_DMA)) == 0) 395 desc_base = (u32)kmalloc(i, GFP_KERNEL|GFP_DMA);
396 if (desc_base == 0)
406 return 0; 397 return 0;
407 398
408 desc_base = ALIGN_ADDR(desc_base, sizeof(au1x_ddma_desc_t)); 399 desc_base = ALIGN_ADDR(desc_base, sizeof(au1x_ddma_desc_t));
409 } 400 }
410 dp = (au1x_ddma_desc_t *)desc_base; 401 dp = (au1x_ddma_desc_t *)desc_base;
411 402
412 /* Keep track of the base descriptor. 403 /* Keep track of the base descriptor. */
413 */
414 ctp->chan_desc_base = dp; 404 ctp->chan_desc_base = dp;
415 405
416 /* Initialize the rings with as much information as we know. 406 /* Initialize the rings with as much information as we know. */
417 */
418 srcid = stp->dev_id; 407 srcid = stp->dev_id;
419 destid = dtp->dev_id; 408 destid = dtp->dev_id;
420 409
@@ -426,11 +415,12 @@ au1xxx_dbdma_ring_alloc(u32 chanid, int entries)
426 cmd0 |= DSCR_CMD0_IE | DSCR_CMD0_CV; 415 cmd0 |= DSCR_CMD0_IE | DSCR_CMD0_CV;
427 cmd0 |= DSCR_CMD0_ST(DSCR_CMD0_ST_NOCHANGE); 416 cmd0 |= DSCR_CMD0_ST(DSCR_CMD0_ST_NOCHANGE);
428 417
429 /* is it mem to mem transfer? */ 418 /* Is it mem to mem transfer? */
430 if(((DSCR_CUSTOM2DEV_ID(srcid) == DSCR_CMD0_THROTTLE) || (DSCR_CUSTOM2DEV_ID(srcid) == DSCR_CMD0_ALWAYS)) && 419 if (((DSCR_CUSTOM2DEV_ID(srcid) == DSCR_CMD0_THROTTLE) ||
431 ((DSCR_CUSTOM2DEV_ID(destid) == DSCR_CMD0_THROTTLE) || (DSCR_CUSTOM2DEV_ID(destid) == DSCR_CMD0_ALWAYS))) { 420 (DSCR_CUSTOM2DEV_ID(srcid) == DSCR_CMD0_ALWAYS)) &&
432 cmd0 |= DSCR_CMD0_MEM; 421 ((DSCR_CUSTOM2DEV_ID(destid) == DSCR_CMD0_THROTTLE) ||
433 } 422 (DSCR_CUSTOM2DEV_ID(destid) == DSCR_CMD0_ALWAYS)))
423 cmd0 |= DSCR_CMD0_MEM;
434 424
435 switch (stp->dev_devwidth) { 425 switch (stp->dev_devwidth) {
436 case 8: 426 case 8:
@@ -458,15 +448,17 @@ au1xxx_dbdma_ring_alloc(u32 chanid, int entries)
458 break; 448 break;
459 } 449 }
460 450
461 /* If the device is marked as an in/out FIFO, ensure it is 451 /*
452 * If the device is marked as an in/out FIFO, ensure it is
462 * set non-coherent. 453 * set non-coherent.
463 */ 454 */
464 if (stp->dev_flags & DEV_FLAGS_IN) 455 if (stp->dev_flags & DEV_FLAGS_IN)
465 cmd0 |= DSCR_CMD0_SN; /* Source in fifo */ 456 cmd0 |= DSCR_CMD0_SN; /* Source in FIFO */
466 if (dtp->dev_flags & DEV_FLAGS_OUT) 457 if (dtp->dev_flags & DEV_FLAGS_OUT)
467 cmd0 |= DSCR_CMD0_DN; /* Destination out fifo */ 458 cmd0 |= DSCR_CMD0_DN; /* Destination out FIFO */
468 459
469 /* Set up source1. For now, assume no stride and increment. 460 /*
461 * Set up source1. For now, assume no stride and increment.
470 * A channel attribute update can change this later. 462 * A channel attribute update can change this later.
471 */ 463 */
472 switch (stp->dev_tsize) { 464 switch (stp->dev_tsize) {
@@ -485,19 +477,19 @@ au1xxx_dbdma_ring_alloc(u32 chanid, int entries)
485 break; 477 break;
486 } 478 }
487 479
488 /* If source input is fifo, set static address. 480 /* If source input is FIFO, set static address. */
489 */
490 if (stp->dev_flags & DEV_FLAGS_IN) { 481 if (stp->dev_flags & DEV_FLAGS_IN) {
491 if ( stp->dev_flags & DEV_FLAGS_BURSTABLE ) 482 if (stp->dev_flags & DEV_FLAGS_BURSTABLE)
492 src1 |= DSCR_SRC1_SAM(DSCR_xAM_BURST); 483 src1 |= DSCR_SRC1_SAM(DSCR_xAM_BURST);
493 else 484 else
494 src1 |= DSCR_SRC1_SAM(DSCR_xAM_STATIC); 485 src1 |= DSCR_SRC1_SAM(DSCR_xAM_STATIC);
495
496 } 486 }
487
497 if (stp->dev_physaddr) 488 if (stp->dev_physaddr)
498 src0 = stp->dev_physaddr; 489 src0 = stp->dev_physaddr;
499 490
500 /* Set up dest1. For now, assume no stride and increment. 491 /*
492 * Set up dest1. For now, assume no stride and increment.
501 * A channel attribute update can change this later. 493 * A channel attribute update can change this later.
502 */ 494 */
503 switch (dtp->dev_tsize) { 495 switch (dtp->dev_tsize) {
@@ -516,22 +508,24 @@ au1xxx_dbdma_ring_alloc(u32 chanid, int entries)
516 break; 508 break;
517 } 509 }
518 510
519 /* If destination output is fifo, set static address. 511 /* If destination output is FIFO, set static address. */
520 */
521 if (dtp->dev_flags & DEV_FLAGS_OUT) { 512 if (dtp->dev_flags & DEV_FLAGS_OUT) {
522 if ( dtp->dev_flags & DEV_FLAGS_BURSTABLE ) 513 if (dtp->dev_flags & DEV_FLAGS_BURSTABLE)
523 dest1 |= DSCR_DEST1_DAM(DSCR_xAM_BURST); 514 dest1 |= DSCR_DEST1_DAM(DSCR_xAM_BURST);
524 else 515 else
525 dest1 |= DSCR_DEST1_DAM(DSCR_xAM_STATIC); 516 dest1 |= DSCR_DEST1_DAM(DSCR_xAM_STATIC);
526 } 517 }
518
527 if (dtp->dev_physaddr) 519 if (dtp->dev_physaddr)
528 dest0 = dtp->dev_physaddr; 520 dest0 = dtp->dev_physaddr;
529 521
530#if 0 522#if 0
531 printk("did:%x sid:%x cmd0:%x cmd1:%x source0:%x source1:%x dest0:%x dest1:%x\n", 523 printk(KERN_DEBUG "did:%x sid:%x cmd0:%x cmd1:%x source0:%x "
532 dtp->dev_id, stp->dev_id, cmd0, cmd1, src0, src1, dest0, dest1 ); 524 "source1:%x dest0:%x dest1:%x\n",
525 dtp->dev_id, stp->dev_id, cmd0, cmd1, src0,
526 src1, dest0, dest1);
533#endif 527#endif
534 for (i=0; i<entries; i++) { 528 for (i = 0; i < entries; i++) {
535 dp->dscr_cmd0 = cmd0; 529 dp->dscr_cmd0 = cmd0;
536 dp->dscr_cmd1 = cmd1; 530 dp->dscr_cmd1 = cmd1;
537 dp->dscr_source0 = src0; 531 dp->dscr_source0 = src0;
@@ -545,49 +539,49 @@ au1xxx_dbdma_ring_alloc(u32 chanid, int entries)
545 dp++; 539 dp++;
546 } 540 }
547 541
548 /* Make last descrptor point to the first. 542 /* Make last descrptor point to the first. */
549 */
550 dp--; 543 dp--;
551 dp->dscr_nxtptr = DSCR_NXTPTR(virt_to_phys(ctp->chan_desc_base)); 544 dp->dscr_nxtptr = DSCR_NXTPTR(virt_to_phys(ctp->chan_desc_base));
552 ctp->get_ptr = ctp->put_ptr = ctp->cur_ptr = ctp->chan_desc_base; 545 ctp->get_ptr = ctp->put_ptr = ctp->cur_ptr = ctp->chan_desc_base;
553 546
554 return (u32)(ctp->chan_desc_base); 547 return (u32)ctp->chan_desc_base;
555} 548}
556EXPORT_SYMBOL(au1xxx_dbdma_ring_alloc); 549EXPORT_SYMBOL(au1xxx_dbdma_ring_alloc);
557 550
558/* Put a source buffer into the DMA ring. 551/*
552 * Put a source buffer into the DMA ring.
559 * This updates the source pointer and byte count. Normally used 553 * This updates the source pointer and byte count. Normally used
560 * for memory to fifo transfers. 554 * for memory to fifo transfers.
561 */ 555 */
562u32 556u32 _au1xxx_dbdma_put_source(u32 chanid, void *buf, int nbytes, u32 flags)
563_au1xxx_dbdma_put_source(u32 chanid, void *buf, int nbytes, u32 flags)
564{ 557{
565 chan_tab_t *ctp; 558 chan_tab_t *ctp;
566 au1x_ddma_desc_t *dp; 559 au1x_ddma_desc_t *dp;
567 560
568 /* I guess we could check this to be within the 561 /*
562 * I guess we could check this to be within the
569 * range of the table...... 563 * range of the table......
570 */ 564 */
571 ctp = *((chan_tab_t **)chanid); 565 ctp = *(chan_tab_t **)chanid;
572 566
573 /* We should have multiple callers for a particular channel, 567 /*
568 * We should have multiple callers for a particular channel,
574 * an interrupt doesn't affect this pointer nor the descriptor, 569 * an interrupt doesn't affect this pointer nor the descriptor,
575 * so no locking should be needed. 570 * so no locking should be needed.
576 */ 571 */
577 dp = ctp->put_ptr; 572 dp = ctp->put_ptr;
578 573
579 /* If the descriptor is valid, we are way ahead of the DMA 574 /*
575 * If the descriptor is valid, we are way ahead of the DMA
580 * engine, so just return an error condition. 576 * engine, so just return an error condition.
581 */ 577 */
582 if (dp->dscr_cmd0 & DSCR_CMD0_V) { 578 if (dp->dscr_cmd0 & DSCR_CMD0_V)
583 return 0; 579 return 0;
584 }
585 580
586 /* Load up buffer address and byte count. 581 /* Load up buffer address and byte count. */
587 */
588 dp->dscr_source0 = virt_to_phys(buf); 582 dp->dscr_source0 = virt_to_phys(buf);
589 dp->dscr_cmd1 = nbytes; 583 dp->dscr_cmd1 = nbytes;
590 /* Check flags */ 584 /* Check flags */
591 if (flags & DDMA_FLAGS_IE) 585 if (flags & DDMA_FLAGS_IE)
592 dp->dscr_cmd0 |= DSCR_CMD0_IE; 586 dp->dscr_cmd0 |= DSCR_CMD0_IE;
593 if (flags & DDMA_FLAGS_NOIE) 587 if (flags & DDMA_FLAGS_NOIE)
@@ -595,23 +589,21 @@ _au1xxx_dbdma_put_source(u32 chanid, void *buf, int nbytes, u32 flags)
595 589
596 /* 590 /*
597 * There is an errata on the Au1200/Au1550 parts that could result 591 * There is an errata on the Au1200/Au1550 parts that could result
598 * in "stale" data being DMA'd. It has to do with the snoop logic on 592 * in "stale" data being DMA'ed. It has to do with the snoop logic on
599 * the dache eviction buffer. NONCOHERENT_IO is on by default for 593 * the cache eviction buffer. DMA_NONCOHERENT is on by default for
600 * these parts. If it is fixedin the future, these dma_cache_inv will 594 * these parts. If it is fixed in the future, these dma_cache_inv will
601 * just be nothing more than empty macros. See io.h. 595 * just be nothing more than empty macros. See io.h.
602 * */ 596 */
603 dma_cache_wback_inv((unsigned long)buf, nbytes); 597 dma_cache_wback_inv((unsigned long)buf, nbytes);
604 dp->dscr_cmd0 |= DSCR_CMD0_V; /* Let it rip */ 598 dp->dscr_cmd0 |= DSCR_CMD0_V; /* Let it rip */
605 au_sync(); 599 au_sync();
606 dma_cache_wback_inv((unsigned long)dp, sizeof(dp)); 600 dma_cache_wback_inv((unsigned long)dp, sizeof(dp));
607 ctp->chan_ptr->ddma_dbell = 0; 601 ctp->chan_ptr->ddma_dbell = 0;
608 602
609 /* Get next descriptor pointer. 603 /* Get next descriptor pointer. */
610 */
611 ctp->put_ptr = phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr)); 604 ctp->put_ptr = phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr));
612 605
613 /* return something not zero. 606 /* Return something non-zero. */
614 */
615 return nbytes; 607 return nbytes;
616} 608}
617EXPORT_SYMBOL(_au1xxx_dbdma_put_source); 609EXPORT_SYMBOL(_au1xxx_dbdma_put_source);
@@ -654,81 +646,77 @@ _au1xxx_dbdma_put_dest(u32 chanid, void *buf, int nbytes, u32 flags)
654 dp->dscr_dest0 = virt_to_phys(buf); 646 dp->dscr_dest0 = virt_to_phys(buf);
655 dp->dscr_cmd1 = nbytes; 647 dp->dscr_cmd1 = nbytes;
656#if 0 648#if 0
657 printk("cmd0:%x cmd1:%x source0:%x source1:%x dest0:%x dest1:%x\n", 649 printk(KERN_DEBUG "cmd0:%x cmd1:%x source0:%x source1:%x dest0:%x dest1:%x\n",
658 dp->dscr_cmd0, dp->dscr_cmd1, dp->dscr_source0, 650 dp->dscr_cmd0, dp->dscr_cmd1, dp->dscr_source0,
659 dp->dscr_source1, dp->dscr_dest0, dp->dscr_dest1 ); 651 dp->dscr_source1, dp->dscr_dest0, dp->dscr_dest1);
660#endif 652#endif
661 /* 653 /*
662 * There is an errata on the Au1200/Au1550 parts that could result in 654 * There is an errata on the Au1200/Au1550 parts that could result in
663 * "stale" data being DMA'd. It has to do with the snoop logic on the 655 * "stale" data being DMA'ed. It has to do with the snoop logic on the
664 * dache eviction buffer. NONCOHERENT_IO is on by default for these 656 * cache eviction buffer. DMA_NONCOHERENT is on by default for these
665 * parts. If it is fixedin the future, these dma_cache_inv will just 657 * parts. If it is fixed in the future, these dma_cache_inv will just
666 * be nothing more than empty macros. See io.h. 658 * be nothing more than empty macros. See io.h.
667 * */ 659 */
668 dma_cache_inv((unsigned long)buf, nbytes); 660 dma_cache_inv((unsigned long)buf, nbytes);
669 dp->dscr_cmd0 |= DSCR_CMD0_V; /* Let it rip */ 661 dp->dscr_cmd0 |= DSCR_CMD0_V; /* Let it rip */
670 au_sync(); 662 au_sync();
671 dma_cache_wback_inv((unsigned long)dp, sizeof(dp)); 663 dma_cache_wback_inv((unsigned long)dp, sizeof(dp));
672 ctp->chan_ptr->ddma_dbell = 0; 664 ctp->chan_ptr->ddma_dbell = 0;
673 665
674 /* Get next descriptor pointer. 666 /* Get next descriptor pointer. */
675 */
676 ctp->put_ptr = phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr)); 667 ctp->put_ptr = phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr));
677 668
678 /* return something not zero. 669 /* Return something non-zero. */
679 */
680 return nbytes; 670 return nbytes;
681} 671}
682EXPORT_SYMBOL(_au1xxx_dbdma_put_dest); 672EXPORT_SYMBOL(_au1xxx_dbdma_put_dest);
683 673
684/* Get a destination buffer into the DMA ring. 674/*
675 * Get a destination buffer into the DMA ring.
685 * Normally used to get a full buffer from the ring during fifo 676 * Normally used to get a full buffer from the ring during fifo
686 * to memory transfers. This does not set the valid bit, you will 677 * to memory transfers. This does not set the valid bit, you will
687 * have to put another destination buffer to keep the DMA going. 678 * have to put another destination buffer to keep the DMA going.
688 */ 679 */
689u32 680u32 au1xxx_dbdma_get_dest(u32 chanid, void **buf, int *nbytes)
690au1xxx_dbdma_get_dest(u32 chanid, void **buf, int *nbytes)
691{ 681{
692 chan_tab_t *ctp; 682 chan_tab_t *ctp;
693 au1x_ddma_desc_t *dp; 683 au1x_ddma_desc_t *dp;
694 u32 rv; 684 u32 rv;
695 685
696 /* I guess we could check this to be within the 686 /*
687 * I guess we could check this to be within the
697 * range of the table...... 688 * range of the table......
698 */ 689 */
699 ctp = *((chan_tab_t **)chanid); 690 ctp = *((chan_tab_t **)chanid);
700 691
701 /* We should have multiple callers for a particular channel, 692 /*
693 * We should have multiple callers for a particular channel,
702 * an interrupt doesn't affect this pointer nor the descriptor, 694 * an interrupt doesn't affect this pointer nor the descriptor,
703 * so no locking should be needed. 695 * so no locking should be needed.
704 */ 696 */
705 dp = ctp->get_ptr; 697 dp = ctp->get_ptr;
706 698
707 /* If the descriptor is valid, we are way ahead of the DMA 699 /*
700 * If the descriptor is valid, we are way ahead of the DMA
708 * engine, so just return an error condition. 701 * engine, so just return an error condition.
709 */ 702 */
710 if (dp->dscr_cmd0 & DSCR_CMD0_V) 703 if (dp->dscr_cmd0 & DSCR_CMD0_V)
711 return 0; 704 return 0;
712 705
713 /* Return buffer address and byte count. 706 /* Return buffer address and byte count. */
714 */
715 *buf = (void *)(phys_to_virt(dp->dscr_dest0)); 707 *buf = (void *)(phys_to_virt(dp->dscr_dest0));
716 *nbytes = dp->dscr_cmd1; 708 *nbytes = dp->dscr_cmd1;
717 rv = dp->dscr_stat; 709 rv = dp->dscr_stat;
718 710
719 /* Get next descriptor pointer. 711 /* Get next descriptor pointer. */
720 */
721 ctp->get_ptr = phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr)); 712 ctp->get_ptr = phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr));
722 713
723 /* return something not zero. 714 /* Return something non-zero. */
724 */
725 return rv; 715 return rv;
726} 716}
727
728EXPORT_SYMBOL_GPL(au1xxx_dbdma_get_dest); 717EXPORT_SYMBOL_GPL(au1xxx_dbdma_get_dest);
729 718
730void 719void au1xxx_dbdma_stop(u32 chanid)
731au1xxx_dbdma_stop(u32 chanid)
732{ 720{
733 chan_tab_t *ctp; 721 chan_tab_t *ctp;
734 au1x_dma_chan_t *cp; 722 au1x_dma_chan_t *cp;
@@ -743,7 +731,7 @@ au1xxx_dbdma_stop(u32 chanid)
743 udelay(1); 731 udelay(1);
744 halt_timeout++; 732 halt_timeout++;
745 if (halt_timeout > 100) { 733 if (halt_timeout > 100) {
746 printk("warning: DMA channel won't halt\n"); 734 printk(KERN_WARNING "warning: DMA channel won't halt\n");
747 break; 735 break;
748 } 736 }
749 } 737 }
@@ -753,12 +741,12 @@ au1xxx_dbdma_stop(u32 chanid)
753} 741}
754EXPORT_SYMBOL(au1xxx_dbdma_stop); 742EXPORT_SYMBOL(au1xxx_dbdma_stop);
755 743
756/* Start using the current descriptor pointer. If the dbdma encounters 744/*
757 * a not valid descriptor, it will stop. In this case, we can just 745 * Start using the current descriptor pointer. If the DBDMA encounters
746 * a non-valid descriptor, it will stop. In this case, we can just
758 * continue by adding a buffer to the list and starting again. 747 * continue by adding a buffer to the list and starting again.
759 */ 748 */
760void 749void au1xxx_dbdma_start(u32 chanid)
761au1xxx_dbdma_start(u32 chanid)
762{ 750{
763 chan_tab_t *ctp; 751 chan_tab_t *ctp;
764 au1x_dma_chan_t *cp; 752 au1x_dma_chan_t *cp;
@@ -773,8 +761,7 @@ au1xxx_dbdma_start(u32 chanid)
773} 761}
774EXPORT_SYMBOL(au1xxx_dbdma_start); 762EXPORT_SYMBOL(au1xxx_dbdma_start);
775 763
776void 764void au1xxx_dbdma_reset(u32 chanid)
777au1xxx_dbdma_reset(u32 chanid)
778{ 765{
779 chan_tab_t *ctp; 766 chan_tab_t *ctp;
780 au1x_ddma_desc_t *dp; 767 au1x_ddma_desc_t *dp;
@@ -784,14 +771,14 @@ au1xxx_dbdma_reset(u32 chanid)
784 ctp = *((chan_tab_t **)chanid); 771 ctp = *((chan_tab_t **)chanid);
785 ctp->get_ptr = ctp->put_ptr = ctp->cur_ptr = ctp->chan_desc_base; 772 ctp->get_ptr = ctp->put_ptr = ctp->cur_ptr = ctp->chan_desc_base;
786 773
787 /* Run through the descriptors and reset the valid indicator. 774 /* Run through the descriptors and reset the valid indicator. */
788 */
789 dp = ctp->chan_desc_base; 775 dp = ctp->chan_desc_base;
790 776
791 do { 777 do {
792 dp->dscr_cmd0 &= ~DSCR_CMD0_V; 778 dp->dscr_cmd0 &= ~DSCR_CMD0_V;
793 /* reset our SW status -- this is used to determine 779 /*
794 * if a descriptor is in use by upper level SW. Since 780 * Reset our software status -- this is used to determine
781 * if a descriptor is in use by upper level software. Since
795 * posting can reset 'V' bit. 782 * posting can reset 'V' bit.
796 */ 783 */
797 dp->sw_status = 0; 784 dp->sw_status = 0;
@@ -800,8 +787,7 @@ au1xxx_dbdma_reset(u32 chanid)
800} 787}
801EXPORT_SYMBOL(au1xxx_dbdma_reset); 788EXPORT_SYMBOL(au1xxx_dbdma_reset);
802 789
803u32 790u32 au1xxx_get_dma_residue(u32 chanid)
804au1xxx_get_dma_residue(u32 chanid)
805{ 791{
806 chan_tab_t *ctp; 792 chan_tab_t *ctp;
807 au1x_dma_chan_t *cp; 793 au1x_dma_chan_t *cp;
@@ -810,18 +796,15 @@ au1xxx_get_dma_residue(u32 chanid)
810 ctp = *((chan_tab_t **)chanid); 796 ctp = *((chan_tab_t **)chanid);
811 cp = ctp->chan_ptr; 797 cp = ctp->chan_ptr;
812 798
813 /* This is only valid if the channel is stopped. 799 /* This is only valid if the channel is stopped. */
814 */
815 rv = cp->ddma_bytecnt; 800 rv = cp->ddma_bytecnt;
816 au_sync(); 801 au_sync();
817 802
818 return rv; 803 return rv;
819} 804}
820
821EXPORT_SYMBOL_GPL(au1xxx_get_dma_residue); 805EXPORT_SYMBOL_GPL(au1xxx_get_dma_residue);
822 806
823void 807void au1xxx_dbdma_chan_free(u32 chanid)
824au1xxx_dbdma_chan_free(u32 chanid)
825{ 808{
826 chan_tab_t *ctp; 809 chan_tab_t *ctp;
827 dbdev_tab_t *stp, *dtp; 810 dbdev_tab_t *stp, *dtp;
@@ -842,8 +825,7 @@ au1xxx_dbdma_chan_free(u32 chanid)
842} 825}
843EXPORT_SYMBOL(au1xxx_dbdma_chan_free); 826EXPORT_SYMBOL(au1xxx_dbdma_chan_free);
844 827
845static irqreturn_t 828static irqreturn_t dbdma_interrupt(int irq, void *dev_id)
846dbdma_interrupt(int irq, void *dev_id)
847{ 829{
848 u32 intstat; 830 u32 intstat;
849 u32 chan_index; 831 u32 chan_index;
@@ -859,13 +841,12 @@ dbdma_interrupt(int irq, void *dev_id)
859 cp = ctp->chan_ptr; 841 cp = ctp->chan_ptr;
860 dp = ctp->cur_ptr; 842 dp = ctp->cur_ptr;
861 843
862 /* Reset interrupt. 844 /* Reset interrupt. */
863 */
864 cp->ddma_irq = 0; 845 cp->ddma_irq = 0;
865 au_sync(); 846 au_sync();
866 847
867 if (ctp->chan_callback) 848 if (ctp->chan_callback)
868 (ctp->chan_callback)(irq, ctp->chan_callparam); 849 ctp->chan_callback(irq, ctp->chan_callparam);
869 850
870 ctp->cur_ptr = phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr)); 851 ctp->cur_ptr = phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr));
871 return IRQ_RETVAL(1); 852 return IRQ_RETVAL(1);
@@ -890,47 +871,47 @@ static void au1xxx_dbdma_init(void)
890 871
891 if (request_irq(irq_nr, dbdma_interrupt, IRQF_DISABLED, 872 if (request_irq(irq_nr, dbdma_interrupt, IRQF_DISABLED,
892 "Au1xxx dbdma", (void *)dbdma_gptr)) 873 "Au1xxx dbdma", (void *)dbdma_gptr))
893 printk("Can't get 1550 dbdma irq"); 874 printk(KERN_ERR "Can't get 1550 dbdma irq");
894} 875}
895 876
896void 877void au1xxx_dbdma_dump(u32 chanid)
897au1xxx_dbdma_dump(u32 chanid)
898{ 878{
899 chan_tab_t *ctp; 879 chan_tab_t *ctp;
900 au1x_ddma_desc_t *dp; 880 au1x_ddma_desc_t *dp;
901 dbdev_tab_t *stp, *dtp; 881 dbdev_tab_t *stp, *dtp;
902 au1x_dma_chan_t *cp; 882 au1x_dma_chan_t *cp;
903 u32 i = 0; 883 u32 i = 0;
904 884
905 ctp = *((chan_tab_t **)chanid); 885 ctp = *((chan_tab_t **)chanid);
906 stp = ctp->chan_src; 886 stp = ctp->chan_src;
907 dtp = ctp->chan_dest; 887 dtp = ctp->chan_dest;
908 cp = ctp->chan_ptr; 888 cp = ctp->chan_ptr;
909 889
910 printk("Chan %x, stp %x (dev %d) dtp %x (dev %d) \n", 890 printk(KERN_DEBUG "Chan %x, stp %x (dev %d) dtp %x (dev %d) \n",
911 (u32)ctp, (u32)stp, stp - dbdev_tab, (u32)dtp, dtp - dbdev_tab); 891 (u32)ctp, (u32)stp, stp - dbdev_tab, (u32)dtp,
912 printk("desc base %x, get %x, put %x, cur %x\n", 892 dtp - dbdev_tab);
913 (u32)(ctp->chan_desc_base), (u32)(ctp->get_ptr), 893 printk(KERN_DEBUG "desc base %x, get %x, put %x, cur %x\n",
914 (u32)(ctp->put_ptr), (u32)(ctp->cur_ptr)); 894 (u32)(ctp->chan_desc_base), (u32)(ctp->get_ptr),
915 895 (u32)(ctp->put_ptr), (u32)(ctp->cur_ptr));
916 printk("dbdma chan %x\n", (u32)cp); 896
917 printk("cfg %08x, desptr %08x, statptr %08x\n", 897 printk(KERN_DEBUG "dbdma chan %x\n", (u32)cp);
918 cp->ddma_cfg, cp->ddma_desptr, cp->ddma_statptr); 898 printk(KERN_DEBUG "cfg %08x, desptr %08x, statptr %08x\n",
919 printk("dbell %08x, irq %08x, stat %08x, bytecnt %08x\n", 899 cp->ddma_cfg, cp->ddma_desptr, cp->ddma_statptr);
920 cp->ddma_dbell, cp->ddma_irq, cp->ddma_stat, cp->ddma_bytecnt); 900 printk(KERN_DEBUG "dbell %08x, irq %08x, stat %08x, bytecnt %08x\n",
921 901 cp->ddma_dbell, cp->ddma_irq, cp->ddma_stat,
922 902 cp->ddma_bytecnt);
923 /* Run through the descriptors 903
924 */ 904 /* Run through the descriptors */
925 dp = ctp->chan_desc_base; 905 dp = ctp->chan_desc_base;
926 906
927 do { 907 do {
928 printk("Dp[%d]= %08x, cmd0 %08x, cmd1 %08x\n", 908 printk(KERN_DEBUG "Dp[%d]= %08x, cmd0 %08x, cmd1 %08x\n",
929 i++, (u32)dp, dp->dscr_cmd0, dp->dscr_cmd1); 909 i++, (u32)dp, dp->dscr_cmd0, dp->dscr_cmd1);
930 printk("src0 %08x, src1 %08x, dest0 %08x, dest1 %08x\n", 910 printk(KERN_DEBUG "src0 %08x, src1 %08x, dest0 %08x, dest1 %08x\n",
931 dp->dscr_source0, dp->dscr_source1, dp->dscr_dest0, dp->dscr_dest1); 911 dp->dscr_source0, dp->dscr_source1,
932 printk("stat %08x, nxtptr %08x\n", 912 dp->dscr_dest0, dp->dscr_dest1);
933 dp->dscr_stat, dp->dscr_nxtptr); 913 printk(KERN_DEBUG "stat %08x, nxtptr %08x\n",
914 dp->dscr_stat, dp->dscr_nxtptr);
934 dp = phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr)); 915 dp = phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr));
935 } while (dp != ctp->chan_desc_base); 916 } while (dp != ctp->chan_desc_base);
936} 917}
@@ -938,32 +919,33 @@ au1xxx_dbdma_dump(u32 chanid)
938/* Put a descriptor into the DMA ring. 919/* Put a descriptor into the DMA ring.
939 * This updates the source/destination pointers and byte count. 920 * This updates the source/destination pointers and byte count.
940 */ 921 */
941u32 922u32 au1xxx_dbdma_put_dscr(u32 chanid, au1x_ddma_desc_t *dscr)
942au1xxx_dbdma_put_dscr(u32 chanid, au1x_ddma_desc_t *dscr )
943{ 923{
944 chan_tab_t *ctp; 924 chan_tab_t *ctp;
945 au1x_ddma_desc_t *dp; 925 au1x_ddma_desc_t *dp;
946 u32 nbytes=0; 926 u32 nbytes = 0;
947 927
948 /* I guess we could check this to be within the 928 /*
949 * range of the table...... 929 * I guess we could check this to be within the
950 */ 930 * range of the table......
931 */
951 ctp = *((chan_tab_t **)chanid); 932 ctp = *((chan_tab_t **)chanid);
952 933
953 /* We should have multiple callers for a particular channel, 934 /*
954 * an interrupt doesn't affect this pointer nor the descriptor, 935 * We should have multiple callers for a particular channel,
955 * so no locking should be needed. 936 * an interrupt doesn't affect this pointer nor the descriptor,
956 */ 937 * so no locking should be needed.
938 */
957 dp = ctp->put_ptr; 939 dp = ctp->put_ptr;
958 940
959 /* If the descriptor is valid, we are way ahead of the DMA 941 /*
960 * engine, so just return an error condition. 942 * If the descriptor is valid, we are way ahead of the DMA
961 */ 943 * engine, so just return an error condition.
944 */
962 if (dp->dscr_cmd0 & DSCR_CMD0_V) 945 if (dp->dscr_cmd0 & DSCR_CMD0_V)
963 return 0; 946 return 0;
964 947
965 /* Load up buffer addresses and byte count. 948 /* Load up buffer addresses and byte count. */
966 */
967 dp->dscr_dest0 = dscr->dscr_dest0; 949 dp->dscr_dest0 = dscr->dscr_dest0;
968 dp->dscr_source0 = dscr->dscr_source0; 950 dp->dscr_source0 = dscr->dscr_source0;
969 dp->dscr_dest1 = dscr->dscr_dest1; 951 dp->dscr_dest1 = dscr->dscr_dest1;
@@ -975,14 +957,11 @@ au1xxx_dbdma_put_dscr(u32 chanid, au1x_ddma_desc_t *dscr )
975 dp->dscr_cmd0 |= dscr->dscr_cmd0 | DSCR_CMD0_V; 957 dp->dscr_cmd0 |= dscr->dscr_cmd0 | DSCR_CMD0_V;
976 ctp->chan_ptr->ddma_dbell = 0; 958 ctp->chan_ptr->ddma_dbell = 0;
977 959
978 /* Get next descriptor pointer. 960 /* Get next descriptor pointer. */
979 */
980 ctp->put_ptr = phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr)); 961 ctp->put_ptr = phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr));
981 962
982 /* return something not zero. 963 /* Return something non-zero. */
983 */
984 return nbytes; 964 return nbytes;
985} 965}
986 966
987#endif /* defined(CONFIG_SOC_AU1550) || defined(CONFIG_SOC_AU1200) */ 967#endif /* defined(CONFIG_SOC_AU1550) || defined(CONFIG_SOC_AU1200) */
988
diff --git a/arch/mips/au1000/common/dbg_io.c b/arch/mips/au1000/common/dbg_io.c
index eae1bb2ca26e..af5be7df2f2a 100644
--- a/arch/mips/au1000/common/dbg_io.c
+++ b/arch/mips/au1000/common/dbg_io.c
@@ -1,3 +1,4 @@
1#include <linux/types.h>
1 2
2#include <asm/mach-au1x00/au1000.h> 3#include <asm/mach-au1x00/au1000.h>
3 4
@@ -8,12 +9,6 @@
8 * uart to be used for debugging. 9 * uart to be used for debugging.
9 */ 10 */
10#define DEBUG_BASE UART_DEBUG_BASE 11#define DEBUG_BASE UART_DEBUG_BASE
11/**/
12
13/* we need uint32 uint8 */
14/* #include "types.h" */
15typedef unsigned char uint8;
16typedef unsigned int uint32;
17 12
18#define UART16550_BAUD_2400 2400 13#define UART16550_BAUD_2400 2400
19#define UART16550_BAUD_4800 4800 14#define UART16550_BAUD_4800 4800
@@ -51,17 +46,15 @@ typedef unsigned int uint32;
51#define UART_MOD_CNTRL 0x100 /* Module Control */ 46#define UART_MOD_CNTRL 0x100 /* Module Control */
52 47
53/* memory-mapped read/write of the port */ 48/* memory-mapped read/write of the port */
54#define UART16550_READ(y) (au_readl(DEBUG_BASE + y) & 0xff) 49#define UART16550_READ(y) (au_readl(DEBUG_BASE + y) & 0xff)
55#define UART16550_WRITE(y, z) (au_writel(z&0xff, DEBUG_BASE + y)) 50#define UART16550_WRITE(y, z) (au_writel(z & 0xff, DEBUG_BASE + y))
56 51
57extern unsigned long calc_clock(void); 52extern unsigned long calc_clock(void);
58 53
59void debugInit(uint32 baud, uint8 data, uint8 parity, uint8 stop) 54void debugInit(u32 baud, u8 data, u8 parity, u8 stop)
60{ 55{
61 56 if (UART16550_READ(UART_MOD_CNTRL) != 0x3)
62 if (UART16550_READ(UART_MOD_CNTRL) != 0x3) {
63 UART16550_WRITE(UART_MOD_CNTRL, 3); 57 UART16550_WRITE(UART_MOD_CNTRL, 3);
64 }
65 calc_clock(); 58 calc_clock();
66 59
67 /* disable interrupts */ 60 /* disable interrupts */
@@ -69,7 +62,7 @@ void debugInit(uint32 baud, uint8 data, uint8 parity, uint8 stop)
69 62
70 /* set up baud rate */ 63 /* set up baud rate */
71 { 64 {
72 uint32 divisor; 65 u32 divisor;
73 66
74 /* set divisor */ 67 /* set divisor */
75 divisor = get_au1x00_uart_baud_base() / baud; 68 divisor = get_au1x00_uart_baud_base() / baud;
@@ -80,9 +73,9 @@ void debugInit(uint32 baud, uint8 data, uint8 parity, uint8 stop)
80 UART16550_WRITE(UART_LCR, (data | parity | stop)); 73 UART16550_WRITE(UART_LCR, (data | parity | stop));
81} 74}
82 75
83static int remoteDebugInitialized = 0; 76static int remoteDebugInitialized;
84 77
85uint8 getDebugChar(void) 78u8 getDebugChar(void)
86{ 79{
87 if (!remoteDebugInitialized) { 80 if (!remoteDebugInitialized) {
88 remoteDebugInitialized = 1; 81 remoteDebugInitialized = 1;
@@ -92,15 +85,13 @@ uint8 getDebugChar(void)
92 UART16550_STOP_1BIT); 85 UART16550_STOP_1BIT);
93 } 86 }
94 87
95 while((UART16550_READ(UART_LSR) & 0x1) == 0); 88 while ((UART16550_READ(UART_LSR) & 0x1) == 0);
96 return UART16550_READ(UART_RX); 89 return UART16550_READ(UART_RX);
97} 90}
98 91
99 92
100int putDebugChar(uint8 byte) 93int putDebugChar(u8 byte)
101{ 94{
102// int i;
103
104 if (!remoteDebugInitialized) { 95 if (!remoteDebugInitialized) {
105 remoteDebugInitialized = 1; 96 remoteDebugInitialized = 1;
106 debugInit(UART16550_BAUD_115200, 97 debugInit(UART16550_BAUD_115200,
@@ -109,9 +100,8 @@ int putDebugChar(uint8 byte)
109 UART16550_STOP_1BIT); 100 UART16550_STOP_1BIT);
110 } 101 }
111 102
112 while ((UART16550_READ(UART_LSR)&0x40) == 0); 103 while ((UART16550_READ(UART_LSR) & 0x40) == 0);
113 UART16550_WRITE(UART_TX, byte); 104 UART16550_WRITE(UART_TX, byte);
114 //for (i=0;i<0xfff;i++);
115 105
116 return 1; 106 return 1;
117} 107}
diff --git a/arch/mips/au1000/common/dma.c b/arch/mips/au1000/common/dma.c
index 95f69ea146e9..d6fbda232e6a 100644
--- a/arch/mips/au1000/common/dma.c
+++ b/arch/mips/au1000/common/dma.c
@@ -1,12 +1,11 @@
1/* 1/*
2 * 2 *
3 * BRIEF MODULE DESCRIPTION 3 * BRIEF MODULE DESCRIPTION
4 * A DMA channel allocator for Au1000. API is modeled loosely off of 4 * A DMA channel allocator for Au1x00. API is modeled loosely off of
5 * linux/kernel/dma.c. 5 * linux/kernel/dma.c.
6 * 6 *
7 * Copyright 2000 MontaVista Software Inc. 7 * Copyright 2000, 2008 MontaVista Software Inc.
8 * Author: MontaVista Software, Inc. 8 * Author: MontaVista Software, Inc. <source@mvista.com>
9 * stevel@mvista.com or source@mvista.com
10 * Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org) 9 * Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org)
11 * 10 *
12 * This program is free software; you can redistribute it and/or modify it 11 * This program is free software; you can redistribute it and/or modify it
@@ -39,7 +38,8 @@
39#include <asm/mach-au1x00/au1000.h> 38#include <asm/mach-au1x00/au1000.h>
40#include <asm/mach-au1x00/au1000_dma.h> 39#include <asm/mach-au1x00/au1000_dma.h>
41 40
42#if defined(CONFIG_SOC_AU1000) || defined(CONFIG_SOC_AU1500) || defined(CONFIG_SOC_AU1100) 41#if defined(CONFIG_SOC_AU1000) || defined(CONFIG_SOC_AU1500) || \
42 defined(CONFIG_SOC_AU1100)
43/* 43/*
44 * A note on resource allocation: 44 * A note on resource allocation:
45 * 45 *
@@ -56,7 +56,6 @@
56 * returned from request_dma. 56 * returned from request_dma.
57 */ 57 */
58 58
59
60DEFINE_SPINLOCK(au1000_dma_spin_lock); 59DEFINE_SPINLOCK(au1000_dma_spin_lock);
61 60
62struct dma_chan au1000_dma_table[NUM_AU1000_DMA_CHANNELS] = { 61struct dma_chan au1000_dma_table[NUM_AU1000_DMA_CHANNELS] = {
@@ -71,7 +70,7 @@ struct dma_chan au1000_dma_table[NUM_AU1000_DMA_CHANNELS] = {
71}; 70};
72EXPORT_SYMBOL(au1000_dma_table); 71EXPORT_SYMBOL(au1000_dma_table);
73 72
74// Device FIFO addresses and default DMA modes 73/* Device FIFO addresses and default DMA modes */
75static const struct dma_dev { 74static const struct dma_dev {
76 unsigned int fifo_addr; 75 unsigned int fifo_addr;
77 unsigned int dma_mode; 76 unsigned int dma_mode;
@@ -80,8 +79,8 @@ static const struct dma_dev {
80 {UART0_ADDR + UART_RX, 0}, 79 {UART0_ADDR + UART_RX, 0},
81 {0, 0}, 80 {0, 0},
82 {0, 0}, 81 {0, 0},
83 {AC97C_DATA, DMA_DW16 }, // coherent 82 {AC97C_DATA, DMA_DW16 }, /* coherent */
84 {AC97C_DATA, DMA_DR | DMA_DW16 }, // coherent 83 {AC97C_DATA, DMA_DR | DMA_DW16 }, /* coherent */
85 {UART3_ADDR + UART_TX, DMA_DW8 | DMA_NC}, 84 {UART3_ADDR + UART_TX, DMA_DW8 | DMA_NC},
86 {UART3_ADDR + UART_RX, DMA_DR | DMA_DW8 | DMA_NC}, 85 {UART3_ADDR + UART_RX, DMA_DR | DMA_DW8 | DMA_NC},
87 {USBD_EP0RD, DMA_DR | DMA_DW8 | DMA_NC}, 86 {USBD_EP0RD, DMA_DR | DMA_DW8 | DMA_NC},
@@ -101,10 +100,10 @@ int au1000_dma_read_proc(char *buf, char **start, off_t fpos,
101 struct dma_chan *chan; 100 struct dma_chan *chan;
102 101
103 for (i = 0; i < NUM_AU1000_DMA_CHANNELS; i++) { 102 for (i = 0; i < NUM_AU1000_DMA_CHANNELS; i++) {
104 if ((chan = get_dma_chan(i)) != NULL) { 103 chan = get_dma_chan(i);
104 if (chan != NULL)
105 len += sprintf(buf + len, "%2d: %s\n", 105 len += sprintf(buf + len, "%2d: %s\n",
106 i, chan->dev_str); 106 i, chan->dev_str);
107 }
108 } 107 }
109 108
110 if (fpos >= len) { 109 if (fpos >= len) {
@@ -113,18 +112,19 @@ int au1000_dma_read_proc(char *buf, char **start, off_t fpos,
113 return 0; 112 return 0;
114 } 113 }
115 *start = buf + fpos; 114 *start = buf + fpos;
116 if ((len -= fpos) > length) 115 len -= fpos;
116 if (len > length)
117 return length; 117 return length;
118 *eof = 1; 118 *eof = 1;
119 return len; 119 return len;
120} 120}
121 121
122// Device FIFO addresses and default DMA modes - 2nd bank 122/* Device FIFO addresses and default DMA modes - 2nd bank */
123static const struct dma_dev dma_dev_table_bank2[DMA_NUM_DEV_BANK2] = { 123static const struct dma_dev dma_dev_table_bank2[DMA_NUM_DEV_BANK2] = {
124 {SD0_XMIT_FIFO, DMA_DS | DMA_DW8}, // coherent 124 { SD0_XMIT_FIFO, DMA_DS | DMA_DW8 }, /* coherent */
125 {SD0_RECV_FIFO, DMA_DS | DMA_DR | DMA_DW8}, // coherent 125 { SD0_RECV_FIFO, DMA_DS | DMA_DR | DMA_DW8 }, /* coherent */
126 {SD1_XMIT_FIFO, DMA_DS | DMA_DW8}, // coherent 126 { SD1_XMIT_FIFO, DMA_DS | DMA_DW8 }, /* coherent */
127 {SD1_RECV_FIFO, DMA_DS | DMA_DR | DMA_DW8} // coherent 127 { SD1_RECV_FIFO, DMA_DS | DMA_DR | DMA_DW8 } /* coherent */
128}; 128};
129 129
130void dump_au1000_dma_channel(unsigned int dmanr) 130void dump_au1000_dma_channel(unsigned int dmanr)
@@ -150,7 +150,6 @@ void dump_au1000_dma_channel(unsigned int dmanr)
150 au_readl(chan->io + DMA_BUFFER1_COUNT)); 150 au_readl(chan->io + DMA_BUFFER1_COUNT));
151} 151}
152 152
153
154/* 153/*
155 * Finds a free channel, and binds the requested device to it. 154 * Finds a free channel, and binds the requested device to it.
156 * Returns the allocated channel number, or negative on error. 155 * Returns the allocated channel number, or negative on error.
@@ -169,14 +168,14 @@ int request_au1000_dma(int dev_id, const char *dev_str,
169 if (dev_id < 0 || dev_id >= (DMA_NUM_DEV + DMA_NUM_DEV_BANK2)) 168 if (dev_id < 0 || dev_id >= (DMA_NUM_DEV + DMA_NUM_DEV_BANK2))
170 return -EINVAL; 169 return -EINVAL;
171#else 170#else
172 if (dev_id < 0 || dev_id >= DMA_NUM_DEV) 171 if (dev_id < 0 || dev_id >= DMA_NUM_DEV)
173 return -EINVAL; 172 return -EINVAL;
174#endif 173#endif
175 174
176 for (i = 0; i < NUM_AU1000_DMA_CHANNELS; i++) { 175 for (i = 0; i < NUM_AU1000_DMA_CHANNELS; i++)
177 if (au1000_dma_table[i].dev_id < 0) 176 if (au1000_dma_table[i].dev_id < 0)
178 break; 177 break;
179 } 178
180 if (i == NUM_AU1000_DMA_CHANNELS) 179 if (i == NUM_AU1000_DMA_CHANNELS)
181 return -ENODEV; 180 return -ENODEV;
182 181
@@ -185,15 +184,15 @@ int request_au1000_dma(int dev_id, const char *dev_str,
185 if (dev_id >= DMA_NUM_DEV) { 184 if (dev_id >= DMA_NUM_DEV) {
186 dev_id -= DMA_NUM_DEV; 185 dev_id -= DMA_NUM_DEV;
187 dev = &dma_dev_table_bank2[dev_id]; 186 dev = &dma_dev_table_bank2[dev_id];
188 } else { 187 } else
189 dev = &dma_dev_table[dev_id]; 188 dev = &dma_dev_table[dev_id];
190 }
191 189
192 if (irqhandler) { 190 if (irqhandler) {
193 chan->irq = AU1000_DMA_INT_BASE + i; 191 chan->irq = AU1000_DMA_INT_BASE + i;
194 chan->irq_dev = irq_dev_id; 192 chan->irq_dev = irq_dev_id;
195 if ((ret = request_irq(chan->irq, irqhandler, irqflags, 193 ret = request_irq(chan->irq, irqhandler, irqflags, dev_str,
196 dev_str, chan->irq_dev))) { 194 chan->irq_dev);
195 if (ret) {
197 chan->irq = 0; 196 chan->irq = 0;
198 chan->irq_dev = NULL; 197 chan->irq_dev = NULL;
199 return ret; 198 return ret;
@@ -203,7 +202,7 @@ int request_au1000_dma(int dev_id, const char *dev_str,
203 chan->irq_dev = NULL; 202 chan->irq_dev = NULL;
204 } 203 }
205 204
206 // fill it in 205 /* fill it in */
207 chan->io = DMA_CHANNEL_BASE + i * DMA_CHANNEL_LEN; 206 chan->io = DMA_CHANNEL_BASE + i * DMA_CHANNEL_LEN;
208 chan->dev_id = dev_id; 207 chan->dev_id = dev_id;
209 chan->dev_str = dev_str; 208 chan->dev_str = dev_str;
@@ -220,8 +219,9 @@ EXPORT_SYMBOL(request_au1000_dma);
220void free_au1000_dma(unsigned int dmanr) 219void free_au1000_dma(unsigned int dmanr)
221{ 220{
222 struct dma_chan *chan = get_dma_chan(dmanr); 221 struct dma_chan *chan = get_dma_chan(dmanr);
222
223 if (!chan) { 223 if (!chan) {
224 printk("Trying to free DMA%d\n", dmanr); 224 printk(KERN_ERR "Error trying to free DMA%d\n", dmanr);
225 return; 225 return;
226 } 226 }
227 227
@@ -235,4 +235,4 @@ void free_au1000_dma(unsigned int dmanr)
235} 235}
236EXPORT_SYMBOL(free_au1000_dma); 236EXPORT_SYMBOL(free_au1000_dma);
237 237
238#endif // AU1000 AU1500 AU1100 238#endif /* AU1000 AU1500 AU1100 */
diff --git a/arch/mips/au1000/common/gpio.c b/arch/mips/au1000/common/gpio.c
index 525452589971..b485d94ce8a5 100644
--- a/arch/mips/au1000/common/gpio.c
+++ b/arch/mips/au1000/common/gpio.c
@@ -69,7 +69,7 @@ static int au1xxx_gpio2_direction_output(unsigned gpio, int value)
69 69
70static int au1xxx_gpio1_read(unsigned gpio) 70static int au1xxx_gpio1_read(unsigned gpio)
71{ 71{
72 return ((gpio1->pinstaterd >> gpio) & 0x01); 72 return (gpio1->pinstaterd >> gpio) & 0x01;
73} 73}
74 74
75static void au1xxx_gpio1_write(unsigned gpio, int value) 75static void au1xxx_gpio1_write(unsigned gpio, int value)
@@ -104,7 +104,6 @@ int au1xxx_gpio_get_value(unsigned gpio)
104 else 104 else
105 return au1xxx_gpio1_read(gpio); 105 return au1xxx_gpio1_read(gpio);
106} 106}
107
108EXPORT_SYMBOL(au1xxx_gpio_get_value); 107EXPORT_SYMBOL(au1xxx_gpio_get_value);
109 108
110void au1xxx_gpio_set_value(unsigned gpio, int value) 109void au1xxx_gpio_set_value(unsigned gpio, int value)
@@ -118,7 +117,6 @@ void au1xxx_gpio_set_value(unsigned gpio, int value)
118 else 117 else
119 au1xxx_gpio1_write(gpio, value); 118 au1xxx_gpio1_write(gpio, value);
120} 119}
121
122EXPORT_SYMBOL(au1xxx_gpio_set_value); 120EXPORT_SYMBOL(au1xxx_gpio_set_value);
123 121
124int au1xxx_gpio_direction_input(unsigned gpio) 122int au1xxx_gpio_direction_input(unsigned gpio)
@@ -132,7 +130,6 @@ int au1xxx_gpio_direction_input(unsigned gpio)
132 130
133 return au1xxx_gpio1_direction_input(gpio); 131 return au1xxx_gpio1_direction_input(gpio);
134} 132}
135
136EXPORT_SYMBOL(au1xxx_gpio_direction_input); 133EXPORT_SYMBOL(au1xxx_gpio_direction_input);
137 134
138int au1xxx_gpio_direction_output(unsigned gpio, int value) 135int au1xxx_gpio_direction_output(unsigned gpio, int value)
@@ -146,5 +143,4 @@ int au1xxx_gpio_direction_output(unsigned gpio, int value)
146 143
147 return au1xxx_gpio1_direction_output(gpio, value); 144 return au1xxx_gpio1_direction_output(gpio, value);
148} 145}
149
150EXPORT_SYMBOL(au1xxx_gpio_direction_output); 146EXPORT_SYMBOL(au1xxx_gpio_direction_output);
diff --git a/arch/mips/au1000/common/irq.c b/arch/mips/au1000/common/irq.c
index f0626992fd75..40c6ceceb5f9 100644
--- a/arch/mips/au1000/common/irq.c
+++ b/arch/mips/au1000/common/irq.c
@@ -210,10 +210,8 @@ static inline void mask_and_ack_either_edge_irq(unsigned int irq_nr)
210 au_sync(); 210 au_sync();
211} 211}
212 212
213
214static inline void mask_and_ack_level_irq(unsigned int irq_nr) 213static inline void mask_and_ack_level_irq(unsigned int irq_nr)
215{ 214{
216
217 local_disable_irq(irq_nr); 215 local_disable_irq(irq_nr);
218 au_sync(); 216 au_sync();
219#if defined(CONFIG_MIPS_PB1000) 217#if defined(CONFIG_MIPS_PB1000)
@@ -263,14 +261,14 @@ void restore_local_and_enable(int controller, unsigned long mask)
263 unsigned long flags, new_mask; 261 unsigned long flags, new_mask;
264 262
265 spin_lock_irqsave(&irq_lock, flags); 263 spin_lock_irqsave(&irq_lock, flags);
266 for (i = 0; i < 32; i++) { 264 for (i = 0; i < 32; i++)
267 if (mask & (1 << i)) { 265 if (mask & (1 << i)) {
268 if (controller) 266 if (controller)
269 local_enable_irq(i + 32); 267 local_enable_irq(i + 32);
270 else 268 else
271 local_enable_irq(i); 269 local_enable_irq(i);
272 } 270 }
273 } 271
274 if (controller) 272 if (controller)
275 new_mask = au_readl(IC1_MASKSET); 273 new_mask = au_readl(IC1_MASKSET);
276 else 274 else
diff --git a/arch/mips/au1000/common/pci.c b/arch/mips/au1000/common/pci.c
index 7e966b31e3e1..7866cf50cf99 100644
--- a/arch/mips/au1000/common/pci.c
+++ b/arch/mips/au1000/common/pci.c
@@ -2,9 +2,8 @@
2 * BRIEF MODULE DESCRIPTION 2 * BRIEF MODULE DESCRIPTION
3 * Alchemy/AMD Au1x00 PCI support. 3 * Alchemy/AMD Au1x00 PCI support.
4 * 4 *
5 * Copyright 2001-2003, 2007 MontaVista Software Inc. 5 * Copyright 2001-2003, 2007-2008 MontaVista Software Inc.
6 * Author: MontaVista Software, Inc. 6 * Author: MontaVista Software, Inc. <source@mvista.com>
7 * ppopov@mvista.com or source@mvista.com
8 * 7 *
9 * Copyright (C) 2004 by Ralf Baechle (ralf@linux-mips.org) 8 * Copyright (C) 2004 by Ralf Baechle (ralf@linux-mips.org)
10 * 9 *
@@ -86,9 +85,9 @@ static int __init au1x_pci_setup(void)
86 u32 prid = read_c0_prid(); 85 u32 prid = read_c0_prid();
87 86
88 if ((prid & 0xFF000000) == 0x01000000 && prid < 0x01030202) { 87 if ((prid & 0xFF000000) == 0x01000000 && prid < 0x01030202) {
89 au_writel((1 << 16) | au_readl(Au1500_PCI_CFG), 88 au_writel((1 << 16) | au_readl(Au1500_PCI_CFG),
90 Au1500_PCI_CFG); 89 Au1500_PCI_CFG);
91 printk("Non-coherent PCI accesses enabled\n"); 90 printk(KERN_INFO "Non-coherent PCI accesses enabled\n");
92 } 91 }
93 } 92 }
94#endif 93#endif
diff --git a/arch/mips/au1000/common/platform.c b/arch/mips/au1000/common/platform.c
index 31d2a2270878..8cae7753ef79 100644
--- a/arch/mips/au1000/common/platform.c
+++ b/arch/mips/au1000/common/platform.c
@@ -269,8 +269,8 @@ static struct platform_device au1x00_pcmcia_device = {
269#ifdef SMBUS_PSC_BASE 269#ifdef SMBUS_PSC_BASE
270static struct resource pbdb_smbus_resources[] = { 270static struct resource pbdb_smbus_resources[] = {
271 { 271 {
272 .start = SMBUS_PSC_BASE, 272 .start = CPHYSADDR(SMBUS_PSC_BASE),
273 .end = SMBUS_PSC_BASE + 0x24 - 1, 273 .end = CPHYSADDR(SMBUS_PSC_BASE + 0xfffff),
274 .flags = IORESOURCE_MEM, 274 .flags = IORESOURCE_MEM,
275 }, 275 },
276}; 276};
@@ -302,16 +302,17 @@ static struct platform_device *au1xxx_platform_devices[] __initdata = {
302#endif 302#endif
303}; 303};
304 304
305int __init au1xxx_platform_init(void) 305static int __init au1xxx_platform_init(void)
306{ 306{
307 unsigned int uartclk = get_au1x00_uart_baud_base() * 16; 307 unsigned int uartclk = get_au1x00_uart_baud_base() * 16;
308 int i; 308 int i;
309 309
310 /* Fill up uartclk. */ 310 /* Fill up uartclk. */
311 for (i = 0; au1x00_uart_data[i].flags ; i++) 311 for (i = 0; au1x00_uart_data[i].flags; i++)
312 au1x00_uart_data[i].uartclk = uartclk; 312 au1x00_uart_data[i].uartclk = uartclk;
313 313
314 return platform_add_devices(au1xxx_platform_devices, ARRAY_SIZE(au1xxx_platform_devices)); 314 return platform_add_devices(au1xxx_platform_devices,
315 ARRAY_SIZE(au1xxx_platform_devices));
315} 316}
316 317
317arch_initcall(au1xxx_platform_init); 318arch_initcall(au1xxx_platform_init);
diff --git a/arch/mips/au1000/common/power.c b/arch/mips/au1000/common/power.c
index a8cd2c1b9e1b..2166b9e1e80c 100644
--- a/arch/mips/au1000/common/power.c
+++ b/arch/mips/au1000/common/power.c
@@ -1,10 +1,9 @@
1/* 1/*
2 * BRIEF MODULE DESCRIPTION 2 * BRIEF MODULE DESCRIPTION
3 * Au1000 Power Management routines. 3 * Au1xx0 Power Management routines.
4 * 4 *
5 * Copyright 2001 MontaVista Software Inc. 5 * Copyright 2001, 2008 MontaVista Software Inc.
6 * Author: MontaVista Software, Inc. 6 * Author: MontaVista Software, Inc. <source@mvista.com>
7 * ppopov@mvista.com or source@mvista.com
8 * 7 *
9 * Some of the routines are right out of init/main.c, whose 8 * Some of the routines are right out of init/main.c, whose
10 * copyrights apply here. 9 * copyrights apply here.
@@ -43,10 +42,10 @@
43#ifdef CONFIG_PM 42#ifdef CONFIG_PM
44 43
45#define DEBUG 1 44#define DEBUG 1
46#ifdef DEBUG 45#ifdef DEBUG
47# define DPRINTK(fmt, args...) printk("%s: " fmt, __func__, ## args) 46#define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __func__, ## args)
48#else 47#else
49# define DPRINTK(fmt, args...) 48#define DPRINTK(fmt, args...)
50#endif 49#endif
51 50
52static void au1000_calibrate_delay(void); 51static void au1000_calibrate_delay(void);
@@ -57,7 +56,8 @@ extern void local_enable_irq(unsigned int irq_nr);
57 56
58static DEFINE_SPINLOCK(pm_lock); 57static DEFINE_SPINLOCK(pm_lock);
59 58
60/* We need to save/restore a bunch of core registers that are 59/*
60 * We need to save/restore a bunch of core registers that are
61 * either volatile or reset to some state across a processor sleep. 61 * either volatile or reset to some state across a processor sleep.
62 * If reading a register doesn't provide a proper result for a 62 * If reading a register doesn't provide a proper result for a
63 * later restore, we have to provide a function for loading that 63 * later restore, we have to provide a function for loading that
@@ -78,24 +78,25 @@ static unsigned int sleep_usbhost_enable;
78static unsigned int sleep_usbdev_enable; 78static unsigned int sleep_usbdev_enable;
79static unsigned int sleep_static_memctlr[4][3]; 79static unsigned int sleep_static_memctlr[4][3];
80 80
81/* Define this to cause the value you write to /proc/sys/pm/sleep to 81/*
82 * Define this to cause the value you write to /proc/sys/pm/sleep to
82 * set the TOY timer for the amount of time you want to sleep. 83 * set the TOY timer for the amount of time you want to sleep.
83 * This is done mainly for testing, but may be useful in other cases. 84 * This is done mainly for testing, but may be useful in other cases.
84 * The value is number of 32KHz ticks to sleep. 85 * The value is number of 32KHz ticks to sleep.
85 */ 86 */
86#define SLEEP_TEST_TIMEOUT 1 87#define SLEEP_TEST_TIMEOUT 1
87#ifdef SLEEP_TEST_TIMEOUT 88#ifdef SLEEP_TEST_TIMEOUT
88static int sleep_ticks; 89static int sleep_ticks;
89void wakeup_counter0_set(int ticks); 90void wakeup_counter0_set(int ticks);
90#endif 91#endif
91 92
92static void 93static void save_core_regs(void)
93save_core_regs(void)
94{ 94{
95 extern void save_au1xxx_intctl(void); 95 extern void save_au1xxx_intctl(void);
96 extern void pm_eth0_shutdown(void); 96 extern void pm_eth0_shutdown(void);
97 97
98 /* Do the serial ports.....these really should be a pm_* 98 /*
99 * Do the serial ports.....these really should be a pm_*
99 * registered function by the driver......but of course the 100 * registered function by the driver......but of course the
100 * standard serial driver doesn't understand our Au1xxx 101 * standard serial driver doesn't understand our Au1xxx
101 * unique registers. 102 * unique registers.
@@ -106,27 +107,24 @@ save_core_regs(void)
106 sleep_uart0_clkdiv = au_readl(UART0_ADDR + UART_CLK); 107 sleep_uart0_clkdiv = au_readl(UART0_ADDR + UART_CLK);
107 sleep_uart0_enable = au_readl(UART0_ADDR + UART_MOD_CNTRL); 108 sleep_uart0_enable = au_readl(UART0_ADDR + UART_MOD_CNTRL);
108 109
109 /* Shutdown USB host/device. 110 /* Shutdown USB host/device. */
110 */
111 sleep_usbhost_enable = au_readl(USB_HOST_CONFIG); 111 sleep_usbhost_enable = au_readl(USB_HOST_CONFIG);
112 112
113 /* There appears to be some undocumented reset register.... 113 /* There appears to be some undocumented reset register.... */
114 */
115 au_writel(0, 0xb0100004); au_sync(); 114 au_writel(0, 0xb0100004); au_sync();
116 au_writel(0, USB_HOST_CONFIG); au_sync(); 115 au_writel(0, USB_HOST_CONFIG); au_sync();
117 116
118 sleep_usbdev_enable = au_readl(USBD_ENABLE); 117 sleep_usbdev_enable = au_readl(USBD_ENABLE);
119 au_writel(0, USBD_ENABLE); au_sync(); 118 au_writel(0, USBD_ENABLE); au_sync();
120 119
121 /* Save interrupt controller state. 120 /* Save interrupt controller state. */
122 */
123 save_au1xxx_intctl(); 121 save_au1xxx_intctl();
124 122
125 /* Clocks and PLLs. 123 /* Clocks and PLLs. */
126 */
127 sleep_aux_pll_cntrl = au_readl(SYS_AUXPLL); 124 sleep_aux_pll_cntrl = au_readl(SYS_AUXPLL);
128 125
129 /* We don't really need to do this one, but unless we 126 /*
127 * We don't really need to do this one, but unless we
130 * write it again it won't have a valid value if we 128 * write it again it won't have a valid value if we
131 * happen to read it. 129 * happen to read it.
132 */ 130 */
@@ -134,8 +132,7 @@ save_core_regs(void)
134 132
135 sleep_pin_function = au_readl(SYS_PINFUNC); 133 sleep_pin_function = au_readl(SYS_PINFUNC);
136 134
137 /* Save the static memory controller configuration. 135 /* Save the static memory controller configuration. */
138 */
139 sleep_static_memctlr[0][0] = au_readl(MEM_STCFG0); 136 sleep_static_memctlr[0][0] = au_readl(MEM_STCFG0);
140 sleep_static_memctlr[0][1] = au_readl(MEM_STTIME0); 137 sleep_static_memctlr[0][1] = au_readl(MEM_STTIME0);
141 sleep_static_memctlr[0][2] = au_readl(MEM_STADDR0); 138 sleep_static_memctlr[0][2] = au_readl(MEM_STADDR0);
@@ -150,8 +147,7 @@ save_core_regs(void)
150 sleep_static_memctlr[3][2] = au_readl(MEM_STADDR3); 147 sleep_static_memctlr[3][2] = au_readl(MEM_STADDR3);
151} 148}
152 149
153static void 150static void restore_core_regs(void)
154restore_core_regs(void)
155{ 151{
156 extern void restore_au1xxx_intctl(void); 152 extern void restore_au1xxx_intctl(void);
157 extern void wakeup_counter0_adjust(void); 153 extern void wakeup_counter0_adjust(void);
@@ -160,8 +156,7 @@ restore_core_regs(void)
160 au_writel(sleep_cpu_pll_cntrl, SYS_CPUPLL); au_sync(); 156 au_writel(sleep_cpu_pll_cntrl, SYS_CPUPLL); au_sync();
161 au_writel(sleep_pin_function, SYS_PINFUNC); au_sync(); 157 au_writel(sleep_pin_function, SYS_PINFUNC); au_sync();
162 158
163 /* Restore the static memory controller configuration. 159 /* Restore the static memory controller configuration. */
164 */
165 au_writel(sleep_static_memctlr[0][0], MEM_STCFG0); 160 au_writel(sleep_static_memctlr[0][0], MEM_STCFG0);
166 au_writel(sleep_static_memctlr[0][1], MEM_STTIME0); 161 au_writel(sleep_static_memctlr[0][1], MEM_STTIME0);
167 au_writel(sleep_static_memctlr[0][2], MEM_STADDR0); 162 au_writel(sleep_static_memctlr[0][2], MEM_STADDR0);
@@ -175,7 +170,8 @@ restore_core_regs(void)
175 au_writel(sleep_static_memctlr[3][1], MEM_STTIME3); 170 au_writel(sleep_static_memctlr[3][1], MEM_STTIME3);
176 au_writel(sleep_static_memctlr[3][2], MEM_STADDR3); 171 au_writel(sleep_static_memctlr[3][2], MEM_STADDR3);
177 172
178 /* Enable the UART if it was enabled before sleep. 173 /*
174 * Enable the UART if it was enabled before sleep.
179 * I guess I should define module control bits........ 175 * I guess I should define module control bits........
180 */ 176 */
181 if (sleep_uart0_enable & 0x02) { 177 if (sleep_uart0_enable & 0x02) {
@@ -202,7 +198,7 @@ void wakeup_from_suspend(void)
202int au_sleep(void) 198int au_sleep(void)
203{ 199{
204 unsigned long wakeup, flags; 200 unsigned long wakeup, flags;
205 extern void save_and_sleep(void); 201 extern void save_and_sleep(void);
206 202
207 spin_lock_irqsave(&pm_lock, flags); 203 spin_lock_irqsave(&pm_lock, flags);
208 204
@@ -210,23 +206,22 @@ int au_sleep(void)
210 206
211 flush_cache_all(); 207 flush_cache_all();
212 208
213 /** The code below is all system dependent and we should probably 209 /**
210 ** The code below is all system dependent and we should probably
214 ** have a function call out of here to set this up. You need 211 ** have a function call out of here to set this up. You need
215 ** to configure the GPIO or timer interrupts that will bring 212 ** to configure the GPIO or timer interrupts that will bring
216 ** you out of sleep. 213 ** you out of sleep.
217 ** For testing, the TOY counter wakeup is useful. 214 ** For testing, the TOY counter wakeup is useful.
218 **/ 215 **/
219
220#if 0 216#if 0
221 au_writel(au_readl(SYS_PINSTATERD) & ~(1 << 11), SYS_PINSTATERD); 217 au_writel(au_readl(SYS_PINSTATERD) & ~(1 << 11), SYS_PINSTATERD);
222 218
223 /* gpio 6 can cause a wake up event */ 219 /* GPIO 6 can cause a wake up event */
224 wakeup = au_readl(SYS_WAKEMSK); 220 wakeup = au_readl(SYS_WAKEMSK);
225 wakeup &= ~(1 << 8); /* turn off match20 wakeup */ 221 wakeup &= ~(1 << 8); /* turn off match20 wakeup */
226 wakeup |= 1 << 6; /* turn on gpio 6 wakeup */ 222 wakeup |= 1 << 6; /* turn on GPIO 6 wakeup */
227#else 223#else
228 /* For testing, allow match20 to wake us up. 224 /* For testing, allow match20 to wake us up. */
229 */
230#ifdef SLEEP_TEST_TIMEOUT 225#ifdef SLEEP_TEST_TIMEOUT
231 wakeup_counter0_set(sleep_ticks); 226 wakeup_counter0_set(sleep_ticks);
232#endif 227#endif
@@ -240,7 +235,8 @@ int au_sleep(void)
240 235
241 save_and_sleep(); 236 save_and_sleep();
242 237
243 /* after a wakeup, the cpu vectors back to 0x1fc00000 so 238 /*
239 * After a wakeup, the cpu vectors back to 0x1fc00000, so
244 * it's up to the boot code to get us back here. 240 * it's up to the boot code to get us back here.
245 */ 241 */
246 restore_core_regs(); 242 restore_core_regs();
@@ -248,24 +244,22 @@ int au_sleep(void)
248 return 0; 244 return 0;
249} 245}
250 246
251static int pm_do_sleep(ctl_table * ctl, int write, struct file *file, 247static int pm_do_sleep(ctl_table *ctl, int write, struct file *file,
252 void __user *buffer, size_t * len, loff_t *ppos) 248 void __user *buffer, size_t *len, loff_t *ppos)
253{ 249{
254#ifdef SLEEP_TEST_TIMEOUT 250#ifdef SLEEP_TEST_TIMEOUT
255#define TMPBUFLEN2 16 251#define TMPBUFLEN2 16
256 char buf[TMPBUFLEN2], *p; 252 char buf[TMPBUFLEN2], *p;
257#endif 253#endif
258 254
259 if (!write) { 255 if (!write)
260 *len = 0; 256 *len = 0;
261 } else { 257 else {
262#ifdef SLEEP_TEST_TIMEOUT 258#ifdef SLEEP_TEST_TIMEOUT
263 if (*len > TMPBUFLEN2 - 1) { 259 if (*len > TMPBUFLEN2 - 1)
264 return -EFAULT; 260 return -EFAULT;
265 } 261 if (copy_from_user(buf, buffer, *len))
266 if (copy_from_user(buf, buffer, *len)) {
267 return -EFAULT; 262 return -EFAULT;
268 }
269 buf[*len] = 0; 263 buf[*len] = 0;
270 p = buf; 264 p = buf;
271 sleep_ticks = simple_strtoul(p, &p, 0); 265 sleep_ticks = simple_strtoul(p, &p, 0);
@@ -276,8 +270,8 @@ static int pm_do_sleep(ctl_table * ctl, int write, struct file *file,
276 return 0; 270 return 0;
277} 271}
278 272
279static int pm_do_freq(ctl_table * ctl, int write, struct file *file, 273static int pm_do_freq(ctl_table *ctl, int write, struct file *file,
280 void __user *buffer, size_t * len, loff_t *ppos) 274 void __user *buffer, size_t *len, loff_t *ppos)
281{ 275{
282 int retval = 0, i; 276 int retval = 0, i;
283 unsigned long val, pll; 277 unsigned long val, pll;
@@ -285,14 +279,14 @@ static int pm_do_freq(ctl_table * ctl, int write, struct file *file,
285#define MAX_CPU_FREQ 396 279#define MAX_CPU_FREQ 396
286 char buf[TMPBUFLEN], *p; 280 char buf[TMPBUFLEN], *p;
287 unsigned long flags, intc0_mask, intc1_mask; 281 unsigned long flags, intc0_mask, intc1_mask;
288 unsigned long old_baud_base, old_cpu_freq, baud_rate, old_clk, 282 unsigned long old_baud_base, old_cpu_freq, old_clk, old_refresh;
289 old_refresh;
290 unsigned long new_baud_base, new_cpu_freq, new_clk, new_refresh; 283 unsigned long new_baud_base, new_cpu_freq, new_clk, new_refresh;
284 unsigned long baud_rate;
291 285
292 spin_lock_irqsave(&pm_lock, flags); 286 spin_lock_irqsave(&pm_lock, flags);
293 if (!write) { 287 if (!write)
294 *len = 0; 288 *len = 0;
295 } else { 289 else {
296 /* Parse the new frequency */ 290 /* Parse the new frequency */
297 if (*len > TMPBUFLEN - 1) { 291 if (*len > TMPBUFLEN - 1) {
298 spin_unlock_irqrestore(&pm_lock, flags); 292 spin_unlock_irqrestore(&pm_lock, flags);
@@ -312,7 +306,7 @@ static int pm_do_freq(ctl_table * ctl, int write, struct file *file,
312 306
313 pll = val / 12; 307 pll = val / 12;
314 if ((pll > 33) || (pll < 7)) { /* 396 MHz max, 84 MHz min */ 308 if ((pll > 33) || (pll < 7)) { /* 396 MHz max, 84 MHz min */
315 /* revisit this for higher speed cpus */ 309 /* Revisit this for higher speed CPUs */
316 spin_unlock_irqrestore(&pm_lock, flags); 310 spin_unlock_irqrestore(&pm_lock, flags);
317 return -EFAULT; 311 return -EFAULT;
318 } 312 }
@@ -321,30 +315,28 @@ static int pm_do_freq(ctl_table * ctl, int write, struct file *file,
321 old_cpu_freq = get_au1x00_speed(); 315 old_cpu_freq = get_au1x00_speed();
322 316
323 new_cpu_freq = pll * 12 * 1000000; 317 new_cpu_freq = pll * 12 * 1000000;
324 new_baud_base = (new_cpu_freq / (2 * ((int)(au_readl(SYS_POWERCTRL)&0x03) + 2) * 16)); 318 new_baud_base = (new_cpu_freq / (2 * ((int)(au_readl(SYS_POWERCTRL)
319 & 0x03) + 2) * 16));
325 set_au1x00_speed(new_cpu_freq); 320 set_au1x00_speed(new_cpu_freq);
326 set_au1x00_uart_baud_base(new_baud_base); 321 set_au1x00_uart_baud_base(new_baud_base);
327 322
328 old_refresh = au_readl(MEM_SDREFCFG) & 0x1ffffff; 323 old_refresh = au_readl(MEM_SDREFCFG) & 0x1ffffff;
329 new_refresh = 324 new_refresh = ((old_refresh * new_cpu_freq) / old_cpu_freq) |
330 ((old_refresh * new_cpu_freq) / 325 (au_readl(MEM_SDREFCFG) & ~0x1ffffff);
331 old_cpu_freq) | (au_readl(MEM_SDREFCFG) & ~0x1ffffff);
332 326
333 au_writel(pll, SYS_CPUPLL); 327 au_writel(pll, SYS_CPUPLL);
334 au_sync_delay(1); 328 au_sync_delay(1);
335 au_writel(new_refresh, MEM_SDREFCFG); 329 au_writel(new_refresh, MEM_SDREFCFG);
336 au_sync_delay(1); 330 au_sync_delay(1);
337 331
338 for (i = 0; i < 4; i++) { 332 for (i = 0; i < 4; i++)
339 if (au_readl 333 if (au_readl(UART_BASE + UART_MOD_CNTRL +
340 (UART_BASE + UART_MOD_CNTRL + 334 i * 0x00100000) == 3) {
341 i * 0x00100000) == 3) { 335 old_clk = au_readl(UART_BASE + UART_CLK +
342 old_clk = 336 i * 0x00100000);
343 au_readl(UART_BASE + UART_CLK +
344 i * 0x00100000);
345 // baud_rate = baud_base/clk
346 baud_rate = old_baud_base / old_clk; 337 baud_rate = old_baud_base / old_clk;
347 /* we won't get an exact baud rate and the error 338 /*
339 * We won't get an exact baud rate and the error
348 * could be significant enough that our new 340 * could be significant enough that our new
349 * calculation will result in a clock that will 341 * calculation will result in a clock that will
350 * give us a baud rate that's too far off from 342 * give us a baud rate that's too far off from
@@ -359,18 +351,14 @@ static int pm_do_freq(ctl_table * ctl, int write, struct file *file,
359 else if (baud_rate > 17000) 351 else if (baud_rate > 17000)
360 baud_rate = 19200; 352 baud_rate = 19200;
361 else 353 else
362 (baud_rate = 9600); 354 baud_rate = 9600;
363 // new_clk = new_baud_base/baud_rate
364 new_clk = new_baud_base / baud_rate; 355 new_clk = new_baud_base / baud_rate;
365 au_writel(new_clk, 356 au_writel(new_clk, UART_BASE + UART_CLK +
366 UART_BASE + UART_CLK + 357 i * 0x00100000);
367 i * 0x00100000);
368 au_sync_delay(10); 358 au_sync_delay(10);
369 } 359 }
370 }
371 } 360 }
372 361
373
374 /* 362 /*
375 * We don't want _any_ interrupts other than match20. Otherwise our 363 * We don't want _any_ interrupts other than match20. Otherwise our
376 * au1000_calibrate_delay() calculation will be off, potentially a lot. 364 * au1000_calibrate_delay() calculation will be off, potentially a lot.
@@ -428,14 +416,15 @@ static int __init pm_init(void)
428 416
429__initcall(pm_init); 417__initcall(pm_init);
430 418
431
432/* 419/*
433 * This is right out of init/main.c 420 * This is right out of init/main.c
434 */ 421 */
435 422
436/* This is the number of bits of precision for the loops_per_jiffy. Each 423/*
437 bit takes on average 1.5/HZ seconds. This (like the original) is a little 424 * This is the number of bits of precision for the loops_per_jiffy.
438 better than 1% */ 425 * Each bit takes on average 1.5/HZ seconds. This (like the original)
426 * is a little better than 1%.
427 */
439#define LPS_PREC 8 428#define LPS_PREC 8
440 429
441static void au1000_calibrate_delay(void) 430static void au1000_calibrate_delay(void)
@@ -443,14 +432,14 @@ static void au1000_calibrate_delay(void)
443 unsigned long ticks, loopbit; 432 unsigned long ticks, loopbit;
444 int lps_precision = LPS_PREC; 433 int lps_precision = LPS_PREC;
445 434
446 loops_per_jiffy = (1 << 12); 435 loops_per_jiffy = 1 << 12;
447 436
448 while (loops_per_jiffy <<= 1) { 437 while (loops_per_jiffy <<= 1) {
449 /* wait for "start of" clock tick */ 438 /* Wait for "start of" clock tick */
450 ticks = jiffies; 439 ticks = jiffies;
451 while (ticks == jiffies) 440 while (ticks == jiffies)
452 /* nothing */ ; 441 /* nothing */ ;
453 /* Go .. */ 442 /* Go ... */
454 ticks = jiffies; 443 ticks = jiffies;
455 __delay(loops_per_jiffy); 444 __delay(loops_per_jiffy);
456 ticks = jiffies - ticks; 445 ticks = jiffies - ticks;
@@ -458,8 +447,10 @@ static void au1000_calibrate_delay(void)
458 break; 447 break;
459 } 448 }
460 449
461/* Do a binary approximation to get loops_per_jiffy set to equal one clock 450 /*
462 (up to lps_precision bits) */ 451 * Do a binary approximation to get loops_per_jiffy set to be equal
452 * one clock (up to lps_precision bits)
453 */
463 loops_per_jiffy >>= 1; 454 loops_per_jiffy >>= 1;
464 loopbit = loops_per_jiffy; 455 loopbit = loops_per_jiffy;
465 while (lps_precision-- && (loopbit >>= 1)) { 456 while (lps_precision-- && (loopbit >>= 1)) {
@@ -472,4 +463,4 @@ static void au1000_calibrate_delay(void)
472 loops_per_jiffy &= ~loopbit; 463 loops_per_jiffy &= ~loopbit;
473 } 464 }
474} 465}
475#endif /* CONFIG_PM */ 466#endif /* CONFIG_PM */
diff --git a/arch/mips/au1000/common/prom.c b/arch/mips/au1000/common/prom.c
index f10af829e4ec..18b310b475ca 100644
--- a/arch/mips/au1000/common/prom.c
+++ b/arch/mips/au1000/common/prom.c
@@ -3,9 +3,8 @@
3 * BRIEF MODULE DESCRIPTION 3 * BRIEF MODULE DESCRIPTION
4 * PROM library initialisation code, supports YAMON and U-Boot. 4 * PROM library initialisation code, supports YAMON and U-Boot.
5 * 5 *
6 * Copyright 2000, 2001, 2006 MontaVista Software Inc. 6 * Copyright 2000-2001, 2006, 2008 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc. 7 * Author: MontaVista Software, Inc. <source@mvista.com>
8 * ppopov@mvista.com or source@mvista.com
9 * 8 *
10 * This file was derived from Carsten Langgaard's 9 * This file was derived from Carsten Langgaard's
11 * arch/mips/mips-boards/xx files. 10 * arch/mips/mips-boards/xx files.
@@ -57,7 +56,7 @@ void prom_init_cmdline(void)
57 actr = 1; /* Always ignore argv[0] */ 56 actr = 1; /* Always ignore argv[0] */
58 57
59 cp = &(arcs_cmdline[0]); 58 cp = &(arcs_cmdline[0]);
60 while(actr < prom_argc) { 59 while (actr < prom_argc) {
61 strcpy(cp, prom_argv[actr]); 60 strcpy(cp, prom_argv[actr]);
62 cp += strlen(prom_argv[actr]); 61 cp += strlen(prom_argv[actr]);
63 *cp++ = ' '; 62 *cp++ = ' ';
@@ -84,10 +83,8 @@ char *prom_getenv(char *envname)
84 if (yamon) { 83 if (yamon) {
85 if (strcmp(envname, *env++) == 0) 84 if (strcmp(envname, *env++) == 0)
86 return *env; 85 return *env;
87 } else { 86 } else if (strncmp(envname, *env, i) == 0 && (*env)[i] == '=')
88 if (strncmp(envname, *env, i) == 0 && (*env)[i] == '=') 87 return *env + i + 1;
89 return *env + i + 1;
90 }
91 env++; 88 env++;
92 } 89 }
93 90
@@ -110,13 +107,13 @@ static inline void str2eaddr(unsigned char *ea, unsigned char *str)
110{ 107{
111 int i; 108 int i;
112 109
113 for(i = 0; i < 6; i++) { 110 for (i = 0; i < 6; i++) {
114 unsigned char num; 111 unsigned char num;
115 112
116 if((*str == '.') || (*str == ':')) 113 if ((*str == '.') || (*str == ':'))
117 str++; 114 str++;
118 num = str2hexnum(*str++) << 4; 115 num = str2hexnum(*str++) << 4;
119 num |= (str2hexnum(*str++)); 116 num |= str2hexnum(*str++);
120 ea[i] = num; 117 ea[i] = num;
121 } 118 }
122} 119}
diff --git a/arch/mips/au1000/common/puts.c b/arch/mips/au1000/common/puts.c
index e34c67e89293..55bbe24d45b6 100644
--- a/arch/mips/au1000/common/puts.c
+++ b/arch/mips/au1000/common/puts.c
@@ -1,11 +1,10 @@
1/* 1/*
2 * 2 *
3 * BRIEF MODULE DESCRIPTION 3 * BRIEF MODULE DESCRIPTION
4 * Low level uart routines to directly access a 16550 uart. 4 * Low level UART routines to directly access Alchemy UART.
5 * 5 *
6 * Copyright 2001 MontaVista Software Inc. 6 * Copyright 2001, 2008 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc. 7 * Author: MontaVista Software, Inc. <source@mvista.com>
8 * ppopov@mvista.com or source@mvista.com
9 * 8 *
10 * This program is free software; you can redistribute it and/or modify it 9 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the 10 * under the terms of the GNU General Public License as published by the
@@ -40,12 +39,12 @@
40 39
41static volatile unsigned long * const com1 = (unsigned long *)SERIAL_BASE; 40static volatile unsigned long * const com1 = (unsigned long *)SERIAL_BASE;
42 41
43
44#ifdef SLOW_DOWN 42#ifdef SLOW_DOWN
45static inline void slow_down(void) 43static inline void slow_down(void)
46{ 44{
47 int k; 45 int k;
48 for (k=0; k<10000; k++); 46
47 for (k = 0; k < 10000; k++);
49} 48}
50#else 49#else
51#define slow_down() 50#define slow_down()
@@ -54,16 +53,16 @@ static inline void slow_down(void)
54void 53void
55prom_putchar(const unsigned char c) 54prom_putchar(const unsigned char c)
56{ 55{
57 unsigned char ch; 56 unsigned char ch;
58 int i = 0; 57 int i = 0;
58
59 do {
60 ch = com1[SER_CMD];
61 slow_down();
62 i++;
63 if (i > TIMEOUT)
64 break;
65 } while (0 == (ch & TX_BUSY));
59 66
60 do { 67 com1[SER_DATA] = c;
61 ch = com1[SER_CMD];
62 slow_down();
63 i++;
64 if (i>TIMEOUT) {
65 break;
66 }
67 } while (0 == (ch & TX_BUSY));
68 com1[SER_DATA] = c;
69} 68}
diff --git a/arch/mips/au1000/common/reset.c b/arch/mips/au1000/common/reset.c
index 60cec537c745..d555429c8d6f 100644
--- a/arch/mips/au1000/common/reset.c
+++ b/arch/mips/au1000/common/reset.c
@@ -1,11 +1,10 @@
1/* 1/*
2 * 2 *
3 * BRIEF MODULE DESCRIPTION 3 * BRIEF MODULE DESCRIPTION
4 * Au1000 reset routines. 4 * Au1xx0 reset routines.
5 * 5 *
6 * Copyright 2001 MontaVista Software Inc. 6 * Copyright 2001, 2006, 2008 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc. 7 * Author: MontaVista Software, Inc. <source@mvista.com>
8 * ppopov@mvista.com or source@mvista.com
9 * 8 *
10 * This program is free software; you can redistribute it and/or modify it 9 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the 10 * under the terms of the GNU General Public License as published by the
@@ -28,10 +27,11 @@
28 * 675 Mass Ave, Cambridge, MA 02139, USA. 27 * 675 Mass Ave, Cambridge, MA 02139, USA.
29 */ 28 */
30 29
30#include <asm/cacheflush.h>
31
31#include <asm/mach-au1x00/au1000.h> 32#include <asm/mach-au1x00/au1000.h>
32 33
33extern int au_sleep(void); 34extern int au_sleep(void);
34extern void (*flush_cache_all)(void);
35 35
36void au1000_restart(char *command) 36void au1000_restart(char *command)
37{ 37{
@@ -40,8 +40,8 @@ void au1000_restart(char *command)
40 u32 prid = read_c0_prid(); 40 u32 prid = read_c0_prid();
41 41
42 printk(KERN_NOTICE "\n** Resetting Integrated Peripherals\n"); 42 printk(KERN_NOTICE "\n** Resetting Integrated Peripherals\n");
43 switch (prid & 0xFF000000) 43
44 { 44 switch (prid & 0xFF000000) {
45 case 0x00000000: /* Au1000 */ 45 case 0x00000000: /* Au1000 */
46 au_writel(0x02, 0xb0000010); /* ac97_enable */ 46 au_writel(0x02, 0xb0000010); /* ac97_enable */
47 au_writel(0x08, 0xb017fffc); /* usbh_enable - early errata */ 47 au_writel(0x08, 0xb017fffc); /* usbh_enable - early errata */
@@ -138,9 +138,6 @@ void au1000_restart(char *command)
138 au_writel(0x00, 0xb1900064); /* sys_auxpll */ 138 au_writel(0x00, 0xb1900064); /* sys_auxpll */
139 au_writel(0x00, 0xb1900100); /* sys_pininputen */ 139 au_writel(0x00, 0xb1900100); /* sys_pininputen */
140 break; 140 break;
141
142 default:
143 break;
144 } 141 }
145 142
146 set_c0_status(ST0_BEV | ST0_ERL); 143 set_c0_status(ST0_BEV | ST0_ERL);
@@ -158,25 +155,25 @@ void au1000_restart(char *command)
158void au1000_halt(void) 155void au1000_halt(void)
159{ 156{
160#if defined(CONFIG_MIPS_PB1550) || defined(CONFIG_MIPS_DB1550) 157#if defined(CONFIG_MIPS_PB1550) || defined(CONFIG_MIPS_DB1550)
161 /* power off system */ 158 /* Power off system */
162 printk("\n** Powering off...\n"); 159 printk(KERN_NOTICE "\n** Powering off...\n");
163 au_writew(au_readw(0xAF00001C) | (3<<14), 0xAF00001C); 160 au_writew(au_readw(0xAF00001C) | (3 << 14), 0xAF00001C);
164 au_sync(); 161 au_sync();
165 while(1); /* should not get here */ 162 while (1); /* should not get here */
166#else 163#else
167 printk(KERN_NOTICE "\n** You can safely turn off the power\n"); 164 printk(KERN_NOTICE "\n** You can safely turn off the power\n");
168#ifdef CONFIG_MIPS_MIRAGE 165#ifdef CONFIG_MIPS_MIRAGE
169 au_writel((1 << 26) | (1 << 10), GPIO2_OUTPUT); 166 au_writel((1 << 26) | (1 << 10), GPIO2_OUTPUT);
170#endif 167#endif
171#ifdef CONFIG_MIPS_DB1200 168#ifdef CONFIG_MIPS_DB1200
172 au_writew(au_readw(0xB980001C) | (1<<14), 0xB980001C); 169 au_writew(au_readw(0xB980001C) | (1 << 14), 0xB980001C);
173#endif 170#endif
174#ifdef CONFIG_PM 171#ifdef CONFIG_PM
175 au_sleep(); 172 au_sleep();
176 173
177 /* should not get here */ 174 /* Should not get here */
178 printk(KERN_ERR "Unable to put cpu in sleep mode\n"); 175 printk(KERN_ERR "Unable to put CPU in sleep mode\n");
179 while(1); 176 while (1);
180#else 177#else
181 while (1) 178 while (1)
182 __asm__(".set\tmips3\n\t" 179 __asm__(".set\tmips3\n\t"
diff --git a/arch/mips/au1000/common/setup.c b/arch/mips/au1000/common/setup.c
index 0e86f7a6b4a7..1ac6b06f42a3 100644
--- a/arch/mips/au1000/common/setup.c
+++ b/arch/mips/au1000/common/setup.c
@@ -1,7 +1,6 @@
1/* 1/*
2 * Copyright 2000 MontaVista Software Inc. 2 * Copyright 2000, 2007-2008 MontaVista Software Inc.
3 * Author: MontaVista Software, Inc. 3 * Author: MontaVista Software, Inc. <source@mvista.com
4 * ppopov@mvista.com or source@mvista.com
5 * 4 *
6 * Updates to 2.6, Pete Popov, Embedded Alley Solutions, Inc. 5 * Updates to 2.6, Pete Popov, Embedded Alley Solutions, Inc.
7 * 6 *
@@ -48,7 +47,7 @@ void __init plat_mem_setup(void)
48{ 47{
49 struct cpu_spec *sp; 48 struct cpu_spec *sp;
50 char *argptr; 49 char *argptr;
51 unsigned long prid, cpufreq, bclk = 1; 50 unsigned long prid, cpufreq, bclk;
52 51
53 set_cpuspec(); 52 set_cpuspec();
54 sp = cur_cpu_spec[0]; 53 sp = cur_cpu_spec[0];
@@ -66,42 +65,39 @@ void __init plat_mem_setup(void)
66 cpufreq = (au_readl(SYS_CPUPLL) & 0x3F) * 12; 65 cpufreq = (au_readl(SYS_CPUPLL) & 0x3F) * 12;
67 printk(KERN_INFO "(PRID %08lx) @ %ld MHz\n", prid, cpufreq); 66 printk(KERN_INFO "(PRID %08lx) @ %ld MHz\n", prid, cpufreq);
68 67
69 bclk = sp->cpu_bclk; 68 if (sp->cpu_bclk) {
70 if (bclk)
71 {
72 /* Enable BCLK switching */ 69 /* Enable BCLK switching */
73 bclk = au_readl(0xB190003C); 70 bclk = au_readl(SYS_POWERCTRL);
74 au_writel(bclk | 0x60, 0xB190003C); 71 au_writel(bclk | 0x60, SYS_POWERCTRL);
75 printk("BCLK switching enabled!\n"); 72 printk(KERN_INFO "BCLK switching enabled!\n");
76 } 73 }
77 74
78 if (sp->cpu_od) { 75 if (sp->cpu_od)
79 /* Various early Au1000 Errata corrected by this */ 76 /* Various early Au1xx0 errata corrected by this */
80 set_c0_config(1<<19); /* Set Config[OD] */ 77 set_c0_config(1 << 19); /* Set Config[OD] */
81 } 78 else
82 else {
83 /* Clear to obtain best system bus performance */ 79 /* Clear to obtain best system bus performance */
84 clear_c0_config(1<<19); /* Clear Config[OD] */ 80 clear_c0_config(1 << 19); /* Clear Config[OD] */
85 }
86 81
87 argptr = prom_getcmdline(); 82 argptr = prom_getcmdline();
88 83
89#ifdef CONFIG_SERIAL_8250_CONSOLE 84#ifdef CONFIG_SERIAL_8250_CONSOLE
90 if ((argptr = strstr(argptr, "console=")) == NULL) { 85 argptr = strstr(argptr, "console=");
86 if (argptr == NULL) {
91 argptr = prom_getcmdline(); 87 argptr = prom_getcmdline();
92 strcat(argptr, " console=ttyS0,115200"); 88 strcat(argptr, " console=ttyS0,115200");
93 } 89 }
94#endif 90#endif
95 91
96#ifdef CONFIG_FB_AU1100 92#ifdef CONFIG_FB_AU1100
97 if ((argptr = strstr(argptr, "video=")) == NULL) { 93 argptr = strstr(argptr, "video=");
98 argptr = prom_getcmdline(); 94 if (argptr == NULL) {
99 /* default panel */ 95 argptr = prom_getcmdline();
100 /*strcat(argptr, " video=au1100fb:panel:Sharp_320x240_16");*/ 96 /* default panel */
101 } 97 /*strcat(argptr, " video=au1100fb:panel:Sharp_320x240_16");*/
98 }
102#endif 99#endif
103 100
104
105#if defined(CONFIG_SOUND_AU1X00) && !defined(CONFIG_SOC_AU1000) 101#if defined(CONFIG_SOUND_AU1X00) && !defined(CONFIG_SOC_AU1000)
106 /* au1000 does not support vra, au1500 and au1100 do */ 102 /* au1000 does not support vra, au1500 and au1100 do */
107 strcat(argptr, " au1000_audio=vra"); 103 strcat(argptr, " au1000_audio=vra");
@@ -129,7 +125,7 @@ void __init plat_mem_setup(void)
129/* This routine should be valid for all Au1x based boards */ 125/* This routine should be valid for all Au1x based boards */
130phys_t __fixup_bigphys_addr(phys_t phys_addr, phys_t size) 126phys_t __fixup_bigphys_addr(phys_t phys_addr, phys_t size)
131{ 127{
132 /* Don't fixup 36 bit addresses */ 128 /* Don't fixup 36-bit addresses */
133 if ((phys_addr >> 32) != 0) 129 if ((phys_addr >> 32) != 0)
134 return phys_addr; 130 return phys_addr;
135 131
@@ -145,17 +141,17 @@ phys_t __fixup_bigphys_addr(phys_t phys_addr, phys_t size)
145 } 141 }
146#endif 142#endif
147 143
148 /* All Au1x SOCs have a pcmcia controller */ 144 /*
149 /* We setup our 32 bit pseudo addresses to be equal to the 145 * All Au1xx0 SOCs have a PCMCIA controller.
150 * 36 bit addr >> 4, to make it easier to check the address 146 * We setup our 32-bit pseudo addresses to be equal to the
147 * 36-bit addr >> 4, to make it easier to check the address
151 * and fix it. 148 * and fix it.
152 * The Au1x socket 0 phys attribute address is 0xF 4000 0000. 149 * The PCMCIA socket 0 physical attribute address is 0xF 4000 0000.
153 * The pseudo address we use is 0xF400 0000. Any address over 150 * The pseudo address we use is 0xF400 0000. Any address over
154 * 0xF400 0000 is a pcmcia pseudo address. 151 * 0xF400 0000 is a PCMCIA pseudo address.
155 */ 152 */
156 if ((phys_addr >= 0xF4000000) && (phys_addr < 0xFFFFFFFF)) { 153 if ((phys_addr >= 0xF4000000) && (phys_addr < 0xFFFFFFFF))
157 return (phys_t)(phys_addr << 4); 154 return (phys_t)(phys_addr << 4);
158 }
159 155
160 /* default nop */ 156 /* default nop */
161 return phys_addr; 157 return phys_addr;
diff --git a/arch/mips/au1000/common/time.c b/arch/mips/au1000/common/time.c
index bdb6d73b26fb..563d9390a872 100644
--- a/arch/mips/au1000/common/time.c
+++ b/arch/mips/au1000/common/time.c
@@ -25,11 +25,9 @@
25 * 25 *
26 * Setting up the clock on the MIPS boards. 26 * Setting up the clock on the MIPS boards.
27 * 27 *
28 * Update. Always configure the kernel with CONFIG_NEW_TIME_C. This 28 * We provide the clock interrupt processing and the timer offset compute
29 * will use the user interface gettimeofday() functions from the 29 * functions. If CONFIG_PM is selected, we also ensure the 32KHz timer is
30 * arch/mips/kernel/time.c, and we provide the clock interrupt processing 30 * available. -- Dan
31 * and the timer offset compute functions. If CONFIG_PM is selected,
32 * we also ensure the 32KHz timer is available. -- Dan
33 */ 31 */
34 32
35#include <linux/types.h> 33#include <linux/types.h>
@@ -47,8 +45,7 @@ extern int allow_au1k_wait; /* default off for CP0 Counter */
47#if HZ < 100 || HZ > 1000 45#if HZ < 100 || HZ > 1000
48#error "unsupported HZ value! Must be in [100,1000]" 46#error "unsupported HZ value! Must be in [100,1000]"
49#endif 47#endif
50#define MATCH20_INC (328*100/HZ) /* magic number 328 is for HZ=100... */ 48#define MATCH20_INC (328 * 100 / HZ) /* magic number 328 is for HZ=100... */
51extern void startup_match20_interrupt(irq_handler_t handler);
52static unsigned long last_pc0, last_match20; 49static unsigned long last_pc0, last_match20;
53#endif 50#endif
54 51
@@ -61,7 +58,7 @@ static irqreturn_t counter0_irq(int irq, void *dev_id)
61{ 58{
62 unsigned long pc0; 59 unsigned long pc0;
63 int time_elapsed; 60 int time_elapsed;
64 static int jiffie_drift = 0; 61 static int jiffie_drift;
65 62
66 if (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_M20) { 63 if (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_M20) {
67 /* should never happen! */ 64 /* should never happen! */
@@ -70,13 +67,11 @@ static irqreturn_t counter0_irq(int irq, void *dev_id)
70 } 67 }
71 68
72 pc0 = au_readl(SYS_TOYREAD); 69 pc0 = au_readl(SYS_TOYREAD);
73 if (pc0 < last_match20) { 70 if (pc0 < last_match20)
74 /* counter overflowed */ 71 /* counter overflowed */
75 time_elapsed = (0xffffffff - last_match20) + pc0; 72 time_elapsed = (0xffffffff - last_match20) + pc0;
76 } 73 else
77 else {
78 time_elapsed = pc0 - last_match20; 74 time_elapsed = pc0 - last_match20;
79 }
80 75
81 while (time_elapsed > 0) { 76 while (time_elapsed > 0) {
82 do_timer(1); 77 do_timer(1);
@@ -92,8 +87,9 @@ static irqreturn_t counter0_irq(int irq, void *dev_id)
92 au_writel(last_match20 + MATCH20_INC, SYS_TOYMATCH2); 87 au_writel(last_match20 + MATCH20_INC, SYS_TOYMATCH2);
93 au_sync(); 88 au_sync();
94 89
95 /* our counter ticks at 10.009765625 ms/tick, we we're running 90 /*
96 * almost 10uS too slow per tick. 91 * Our counter ticks at 10.009765625 ms/tick, we we're running
92 * almost 10 uS too slow per tick.
97 */ 93 */
98 94
99 if (jiffie_drift >= 999) { 95 if (jiffie_drift >= 999) {
@@ -117,20 +113,17 @@ struct irqaction counter0_action = {
117/* When we wakeup from sleep, we have to "catch up" on all of the 113/* When we wakeup from sleep, we have to "catch up" on all of the
118 * timer ticks we have missed. 114 * timer ticks we have missed.
119 */ 115 */
120void 116void wakeup_counter0_adjust(void)
121wakeup_counter0_adjust(void)
122{ 117{
123 unsigned long pc0; 118 unsigned long pc0;
124 int time_elapsed; 119 int time_elapsed;
125 120
126 pc0 = au_readl(SYS_TOYREAD); 121 pc0 = au_readl(SYS_TOYREAD);
127 if (pc0 < last_match20) { 122 if (pc0 < last_match20)
128 /* counter overflowed */ 123 /* counter overflowed */
129 time_elapsed = (0xffffffff - last_match20) + pc0; 124 time_elapsed = (0xffffffff - last_match20) + pc0;
130 } 125 else
131 else {
132 time_elapsed = pc0 - last_match20; 126 time_elapsed = pc0 - last_match20;
133 }
134 127
135 while (time_elapsed > 0) { 128 while (time_elapsed > 0) {
136 time_elapsed -= MATCH20_INC; 129 time_elapsed -= MATCH20_INC;
@@ -143,10 +136,8 @@ wakeup_counter0_adjust(void)
143 136
144} 137}
145 138
146/* This is just for debugging to set the timer for a sleep delay. 139/* This is just for debugging to set the timer for a sleep delay. */
147*/ 140void wakeup_counter0_set(int ticks)
148void
149wakeup_counter0_set(int ticks)
150{ 141{
151 unsigned long pc0; 142 unsigned long pc0;
152 143
@@ -157,21 +148,22 @@ wakeup_counter0_set(int ticks)
157} 148}
158#endif 149#endif
159 150
160/* I haven't found anyone that doesn't use a 12 MHz source clock, 151/*
152 * I haven't found anyone that doesn't use a 12 MHz source clock,
161 * but just in case..... 153 * but just in case.....
162 */ 154 */
163#define AU1000_SRC_CLK 12000000 155#define AU1000_SRC_CLK 12000000
164 156
165/* 157/*
166 * We read the real processor speed from the PLL. This is important 158 * We read the real processor speed from the PLL. This is important
167 * because it is more accurate than computing it from the 32KHz 159 * because it is more accurate than computing it from the 32 KHz
168 * counter, if it exists. If we don't have an accurate processor 160 * counter, if it exists. If we don't have an accurate processor
169 * speed, all of the peripherals that derive their clocks based on 161 * speed, all of the peripherals that derive their clocks based on
170 * this advertised speed will introduce error and sometimes not work 162 * this advertised speed will introduce error and sometimes not work
171 * properly. This function is futher convoluted to still allow configurations 163 * properly. This function is futher convoluted to still allow configurations
172 * to do that in case they have really, really old silicon with a 164 * to do that in case they have really, really old silicon with a
173 * write-only PLL register, that we need the 32KHz when power management 165 * write-only PLL register, that we need the 32 KHz when power management
174 * "wait" is enabled, and we need to detect if the 32KHz isn't present 166 * "wait" is enabled, and we need to detect if the 32 KHz isn't present
175 * but requested......got it? :-) -- Dan 167 * but requested......got it? :-) -- Dan
176 */ 168 */
177unsigned long calc_clock(void) 169unsigned long calc_clock(void)
@@ -182,8 +174,7 @@ unsigned long calc_clock(void)
182 174
183 spin_lock_irqsave(&time_lock, flags); 175 spin_lock_irqsave(&time_lock, flags);
184 176
185 /* Power management cares if we don't have a 32KHz counter. 177 /* Power management cares if we don't have a 32 KHz counter. */
186 */
187 no_au1xxx_32khz = 0; 178 no_au1xxx_32khz = 0;
188 counter = au_readl(SYS_COUNTER_CNTRL); 179 counter = au_readl(SYS_COUNTER_CNTRL);
189 if (counter & SYS_CNTRL_E0) { 180 if (counter & SYS_CNTRL_E0) {
@@ -193,7 +184,7 @@ unsigned long calc_clock(void)
193 184
194 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_T1S); 185 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_T1S);
195 /* RTC now ticks at 32.768/16 kHz */ 186 /* RTC now ticks at 32.768/16 kHz */
196 au_writel(trim_divide-1, SYS_RTCTRIM); 187 au_writel(trim_divide - 1, SYS_RTCTRIM);
197 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_T1S); 188 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_T1S);
198 189
199 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_C1S); 190 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_C1S);
@@ -215,9 +206,11 @@ unsigned long calc_clock(void)
215#endif 206#endif
216 else 207 else
217 cpu_speed = (au_readl(SYS_CPUPLL) & 0x0000003f) * AU1000_SRC_CLK; 208 cpu_speed = (au_readl(SYS_CPUPLL) & 0x0000003f) * AU1000_SRC_CLK;
209 /* On Alchemy CPU:counter ratio is 1:1 */
218 mips_hpt_frequency = cpu_speed; 210 mips_hpt_frequency = cpu_speed;
219 // Equation: Baudrate = CPU / (SD * 2 * CLKDIV * 16) 211 /* Equation: Baudrate = CPU / (SD * 2 * CLKDIV * 16) */
220 set_au1x00_uart_baud_base(cpu_speed / (2 * ((int)(au_readl(SYS_POWERCTRL)&0x03) + 2) * 16)); 212 set_au1x00_uart_baud_base(cpu_speed / (2 * ((int)(au_readl(SYS_POWERCTRL)
213 & 0x03) + 2) * 16));
221 spin_unlock_irqrestore(&time_lock, flags); 214 spin_unlock_irqrestore(&time_lock, flags);
222 return cpu_speed; 215 return cpu_speed;
223} 216}
@@ -228,10 +221,10 @@ void __init plat_time_init(void)
228 221
229 est_freq += 5000; /* round */ 222 est_freq += 5000; /* round */
230 est_freq -= est_freq%10000; 223 est_freq -= est_freq%10000;
231 printk("CPU frequency %d.%02d MHz\n", est_freq/1000000, 224 printk(KERN_INFO "CPU frequency %u.%02u MHz\n",
232 (est_freq%1000000)*100/1000000); 225 est_freq / 1000000, ((est_freq % 1000000) * 100) / 1000000);
233 set_au1x00_speed(est_freq); 226 set_au1x00_speed(est_freq);
234 set_au1x00_lcd_clock(); // program the LCD clock 227 set_au1x00_lcd_clock(); /* program the LCD clock */
235 228
236#ifdef CONFIG_PM 229#ifdef CONFIG_PM
237 /* 230 /*
@@ -243,30 +236,29 @@ void __init plat_time_init(void)
243 * counter 0 interrupt as a special irq and it doesn't show 236 * counter 0 interrupt as a special irq and it doesn't show
244 * up under /proc/interrupts. 237 * up under /proc/interrupts.
245 * 238 *
246 * Check to ensure we really have a 32KHz oscillator before 239 * Check to ensure we really have a 32 KHz oscillator before
247 * we do this. 240 * we do this.
248 */ 241 */
249 if (no_au1xxx_32khz) 242 if (no_au1xxx_32khz)
250 printk("WARNING: no 32KHz clock found.\n"); 243 printk(KERN_WARNING "WARNING: no 32KHz clock found.\n");
251 else { 244 else {
252 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_C0S); 245 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_C0S);
253 au_writel(0, SYS_TOYWRITE); 246 au_writel(0, SYS_TOYWRITE);
254 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_C0S); 247 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_C0S);
255 248
256 au_writel(au_readl(SYS_WAKEMSK) | (1<<8), SYS_WAKEMSK); 249 au_writel(au_readl(SYS_WAKEMSK) | (1 << 8), SYS_WAKEMSK);
257 au_writel(~0, SYS_WAKESRC); 250 au_writel(~0, SYS_WAKESRC);
258 au_sync(); 251 au_sync();
259 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_M20); 252 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_M20);
260 253
261 /* setup match20 to interrupt once every HZ */ 254 /* Setup match20 to interrupt once every HZ */
262 last_pc0 = last_match20 = au_readl(SYS_TOYREAD); 255 last_pc0 = last_match20 = au_readl(SYS_TOYREAD);
263 au_writel(last_match20 + MATCH20_INC, SYS_TOYMATCH2); 256 au_writel(last_match20 + MATCH20_INC, SYS_TOYMATCH2);
264 au_sync(); 257 au_sync();
265 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_M20); 258 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_M20);
266 setup_irq(AU1000_TOY_MATCH2_INT, &counter0_action); 259 setup_irq(AU1000_TOY_MATCH2_INT, &counter0_action);
267 260
268 /* We can use the real 'wait' instruction. 261 /* We can use the real 'wait' instruction. */
269 */
270 allow_au1k_wait = 1; 262 allow_au1k_wait = 1;
271 } 263 }
272 264
diff --git a/arch/mips/au1000/db1x00/Makefile b/arch/mips/au1000/db1x00/Makefile
index 51d62bd5d900..274db3b55d82 100644
--- a/arch/mips/au1000/db1x00/Makefile
+++ b/arch/mips/au1000/db1x00/Makefile
@@ -1,8 +1,8 @@
1# 1#
2# Copyright 2000 MontaVista Software Inc. 2# Copyright 2000, 2008 MontaVista Software Inc.
3# Author: MontaVista Software, Inc. 3# Author: MontaVista Software, Inc. <source@mvista.com>
4# ppopov@mvista.com or source@mvista.com 4#
5# Makefile for the Alchemy Semiconductor DBAu1xx0 boards.
5# 6#
6# Makefile for the Alchemy Semiconductor Db1x00 board.
7 7
8lib-y := init.o board_setup.o irqmap.o 8lib-y := init.o board_setup.o irqmap.o
diff --git a/arch/mips/au1000/db1x00/board_setup.c b/arch/mips/au1000/db1x00/board_setup.c
index b7dcbad5c586..9e5ccbbfcedd 100644
--- a/arch/mips/au1000/db1x00/board_setup.c
+++ b/arch/mips/au1000/db1x00/board_setup.c
@@ -3,9 +3,8 @@
3 * BRIEF MODULE DESCRIPTION 3 * BRIEF MODULE DESCRIPTION
4 * Alchemy Db1x00 board setup. 4 * Alchemy Db1x00 board setup.
5 * 5 *
6 * Copyright 2000 MontaVista Software Inc. 6 * Copyright 2000, 2008 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc. 7 * Author: MontaVista Software, Inc. <source@mvista.com>
8 * ppopov@mvista.com or source@mvista.com
9 * 8 *
10 * This program is free software; you can redistribute it and/or modify it 9 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the 10 * under the terms of the GNU General Public License as published by the
@@ -37,49 +36,49 @@ static BCSR * const bcsr = (BCSR *)BCSR_KSEG1_ADDR;
37 36
38void board_reset(void) 37void board_reset(void)
39{ 38{
40 /* Hit BCSR.SYSTEM_CONTROL[SW_RST] */ 39 /* Hit BCSR.SW_RESET[RESET] */
41 bcsr->swreset = 0x0000; 40 bcsr->swreset = 0x0000;
42} 41}
43 42
44void __init board_setup(void) 43void __init board_setup(void)
45{ 44{
46 u32 pin_func; 45 u32 pin_func = 0;
47 46
48 pin_func = 0; 47 /* Not valid for Au1550 */
49 /* not valid for 1550 */ 48#if defined(CONFIG_IRDA) && \
50 49 (defined(CONFIG_SOC_AU1000) || defined(CONFIG_SOC_AU1100))
51#if defined(CONFIG_IRDA) && (defined(CONFIG_SOC_AU1000) || defined(CONFIG_SOC_AU1100)) 50 /* Set IRFIRSEL instead of GPIO15 */
52 /* set IRFIRSEL instead of GPIO15 */ 51 pin_func = au_readl(SYS_PINFUNC) | SYS_PF_IRF;
53 pin_func = au_readl(SYS_PINFUNC) | (u32)((1<<8));
54 au_writel(pin_func, SYS_PINFUNC); 52 au_writel(pin_func, SYS_PINFUNC);
55 /* power off until the driver is in use */ 53 /* Power off until the driver is in use */
56 bcsr->resets &= ~BCSR_RESETS_IRDA_MODE_MASK; 54 bcsr->resets &= ~BCSR_RESETS_IRDA_MODE_MASK;
57 bcsr->resets |= BCSR_RESETS_IRDA_MODE_OFF; 55 bcsr->resets |= BCSR_RESETS_IRDA_MODE_OFF;
58 au_sync(); 56 au_sync();
59#endif 57#endif
60 bcsr->pcmcia = 0x0000; /* turn off PCMCIA power */ 58 bcsr->pcmcia = 0x0000; /* turn off PCMCIA power */
61 59
62#ifdef CONFIG_MIPS_MIRAGE 60#ifdef CONFIG_MIPS_MIRAGE
63 /* enable GPIO[31:0] inputs */ 61 /* Enable GPIO[31:0] inputs */
64 au_writel(0, SYS_PININPUTEN); 62 au_writel(0, SYS_PININPUTEN);
65 63
66 /* GPIO[20] is output, tristate the other input primary GPIO's */ 64 /* GPIO[20] is output, tristate the other input primary GPIOs */
67 au_writel((u32)(~(1<<20)), SYS_TRIOUTCLR); 65 au_writel(~(1 << 20), SYS_TRIOUTCLR);
68 66
69 /* set GPIO[210:208] instead of SSI_0 */ 67 /* Set GPIO[210:208] instead of SSI_0 */
70 pin_func = au_readl(SYS_PINFUNC) | (u32)(1); 68 pin_func = au_readl(SYS_PINFUNC) | SYS_PF_S0;
71 69
72 /* set GPIO[215:211] for LED's */ 70 /* Set GPIO[215:211] for LEDs */
73 pin_func |= (u32)((5<<2)); 71 pin_func |= 5 << 2;
74 72
75 /* set GPIO[214:213] for more LED's */ 73 /* Set GPIO[214:213] for more LEDs */
76 pin_func |= (u32)((5<<12)); 74 pin_func |= 5 << 12;
77 75
78 /* set GPIO[207:200] instead of PCMCIA/LCD */ 76 /* Set GPIO[207:200] instead of PCMCIA/LCD */
79 pin_func |= (u32)((3<<17)); 77 pin_func |= SYS_PF_LCD | SYS_PF_PC;
80 au_writel(pin_func, SYS_PINFUNC); 78 au_writel(pin_func, SYS_PINFUNC);
81 79
82 /* Enable speaker amplifier. This should 80 /*
81 * Enable speaker amplifier. This should
83 * be part of the audio driver. 82 * be part of the audio driver.
84 */ 83 */
85 au_writel(au_readl(GPIO2_DIR) | 0x200, GPIO2_DIR); 84 au_writel(au_readl(GPIO2_DIR) | 0x200, GPIO2_DIR);
@@ -89,21 +88,21 @@ void __init board_setup(void)
89 au_sync(); 88 au_sync();
90 89
91#ifdef CONFIG_MIPS_DB1000 90#ifdef CONFIG_MIPS_DB1000
92 printk("AMD Alchemy Au1000/Db1000 Board\n"); 91 printk(KERN_INFO "AMD Alchemy Au1000/Db1000 Board\n");
93#endif 92#endif
94#ifdef CONFIG_MIPS_DB1500 93#ifdef CONFIG_MIPS_DB1500
95 printk("AMD Alchemy Au1500/Db1500 Board\n"); 94 printk(KERN_INFO "AMD Alchemy Au1500/Db1500 Board\n");
96#endif 95#endif
97#ifdef CONFIG_MIPS_DB1100 96#ifdef CONFIG_MIPS_DB1100
98 printk("AMD Alchemy Au1100/Db1100 Board\n"); 97 printk(KERN_INFO "AMD Alchemy Au1100/Db1100 Board\n");
99#endif 98#endif
100#ifdef CONFIG_MIPS_BOSPORUS 99#ifdef CONFIG_MIPS_BOSPORUS
101 printk("AMD Alchemy Bosporus Board\n"); 100 printk(KERN_INFO "AMD Alchemy Bosporus Board\n");
102#endif 101#endif
103#ifdef CONFIG_MIPS_MIRAGE 102#ifdef CONFIG_MIPS_MIRAGE
104 printk("AMD Alchemy Mirage Board\n"); 103 printk(KERN_INFO "AMD Alchemy Mirage Board\n");
105#endif 104#endif
106#ifdef CONFIG_MIPS_DB1550 105#ifdef CONFIG_MIPS_DB1550
107 printk("AMD Alchemy Au1550/Db1550 Board\n"); 106 printk(KERN_INFO "AMD Alchemy Au1550/Db1550 Board\n");
108#endif 107#endif
109} 108}
diff --git a/arch/mips/au1000/db1x00/init.c b/arch/mips/au1000/db1x00/init.c
index d3b967caf70c..5ebe0de5e459 100644
--- a/arch/mips/au1000/db1x00/init.c
+++ b/arch/mips/au1000/db1x00/init.c
@@ -2,9 +2,8 @@
2 * BRIEF MODULE DESCRIPTION 2 * BRIEF MODULE DESCRIPTION
3 * PB1000 board setup 3 * PB1000 board setup
4 * 4 *
5 * Copyright 2001 MontaVista Software Inc. 5 * Copyright 2001, 2008 MontaVista Software Inc.
6 * Author: MontaVista Software, Inc. 6 * Author: MontaVista Software, Inc. <source@mvista.com>
7 * ppopov@mvista.com or source@mvista.com
8 * 7 *
9 * This program is free software; you can redistribute it and/or modify it 8 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the 9 * under the terms of the GNU General Public License as published by the
@@ -49,8 +48,8 @@ void __init prom_init(void)
49 unsigned long memsize; 48 unsigned long memsize;
50 49
51 prom_argc = fw_arg0; 50 prom_argc = fw_arg0;
52 prom_argv = (char **) fw_arg1; 51 prom_argv = (char **)fw_arg1;
53 prom_envp = (char **) fw_arg2; 52 prom_envp = (char **)fw_arg2;
54 53
55 prom_init_cmdline(); 54 prom_init_cmdline();
56 55
@@ -58,6 +57,6 @@ void __init prom_init(void)
58 if (!memsize_str) 57 if (!memsize_str)
59 memsize = 0x04000000; 58 memsize = 0x04000000;
60 else 59 else
61 memsize = simple_strtol(memsize_str, NULL, 0); 60 memsize = strict_strtol(memsize_str, 0, NULL);
62 add_memory_region(0, memsize, BOOT_MEM_RAM); 61 add_memory_region(0, memsize, BOOT_MEM_RAM);
63} 62}
diff --git a/arch/mips/au1000/db1x00/irqmap.c b/arch/mips/au1000/db1x00/irqmap.c
index eaa50c7b6341..94c090e8bf7a 100644
--- a/arch/mips/au1000/db1x00/irqmap.c
+++ b/arch/mips/au1000/db1x00/irqmap.c
@@ -32,32 +32,32 @@
32 32
33#ifdef CONFIG_MIPS_DB1500 33#ifdef CONFIG_MIPS_DB1500
34char irq_tab_alchemy[][5] __initdata = { 34char irq_tab_alchemy[][5] __initdata = {
35 [12] = { -1, INTA, INTX, INTX, INTX}, /* IDSEL 12 - HPT371 */ 35 [12] = { -1, INTA, INTX, INTX, INTX }, /* IDSEL 12 - HPT371 */
36 [13] = { -1, INTA, INTB, INTC, INTD}, /* IDSEL 13 - PCI slot */ 36 [13] = { -1, INTA, INTB, INTC, INTD }, /* IDSEL 13 - PCI slot */
37}; 37};
38#endif 38#endif
39 39
40#ifdef CONFIG_MIPS_BOSPORUS 40#ifdef CONFIG_MIPS_BOSPORUS
41char irq_tab_alchemy[][5] __initdata = { 41char irq_tab_alchemy[][5] __initdata = {
42 [11] = { -1, INTA, INTB, INTX, INTX}, /* IDSEL 11 - miniPCI */ 42 [11] = { -1, INTA, INTB, INTX, INTX }, /* IDSEL 11 - miniPCI */
43 [12] = { -1, INTA, INTX, INTX, INTX}, /* IDSEL 12 - SN1741 */ 43 [12] = { -1, INTA, INTX, INTX, INTX }, /* IDSEL 12 - SN1741 */
44 [13] = { -1, INTA, INTB, INTC, INTD}, /* IDSEL 13 - PCI slot */ 44 [13] = { -1, INTA, INTB, INTC, INTD }, /* IDSEL 13 - PCI slot */
45}; 45};
46#endif 46#endif
47 47
48#ifdef CONFIG_MIPS_MIRAGE 48#ifdef CONFIG_MIPS_MIRAGE
49char irq_tab_alchemy[][5] __initdata = { 49char irq_tab_alchemy[][5] __initdata = {
50 [11] = { -1, INTD, INTX, INTX, INTX}, /* IDSEL 11 - SMI VGX */ 50 [11] = { -1, INTD, INTX, INTX, INTX }, /* IDSEL 11 - SMI VGX */
51 [12] = { -1, INTX, INTX, INTC, INTX}, /* IDSEL 12 - PNX1300 */ 51 [12] = { -1, INTX, INTX, INTC, INTX }, /* IDSEL 12 - PNX1300 */
52 [13] = { -1, INTA, INTB, INTX, INTX}, /* IDSEL 13 - miniPCI */ 52 [13] = { -1, INTA, INTB, INTX, INTX }, /* IDSEL 13 - miniPCI */
53}; 53};
54#endif 54#endif
55 55
56#ifdef CONFIG_MIPS_DB1550 56#ifdef CONFIG_MIPS_DB1550
57char irq_tab_alchemy[][5] __initdata = { 57char irq_tab_alchemy[][5] __initdata = {
58 [11] = { -1, INTC, INTX, INTX, INTX}, /* IDSEL 11 - on-board HPT371 */ 58 [11] = { -1, INTC, INTX, INTX, INTX }, /* IDSEL 11 - on-board HPT371 */
59 [12] = { -1, INTB, INTC, INTD, INTA}, /* IDSEL 12 - PCI slot 2 (left) */ 59 [12] = { -1, INTB, INTC, INTD, INTA }, /* IDSEL 12 - PCI slot 2 (left) */
60 [13] = { -1, INTA, INTB, INTC, INTD}, /* IDSEL 13 - PCI slot 1 (right) */ 60 [13] = { -1, INTA, INTB, INTC, INTD }, /* IDSEL 13 - PCI slot 1 (right) */
61}; 61};
62#endif 62#endif
63 63
diff --git a/arch/mips/au1000/mtx-1/Makefile b/arch/mips/au1000/mtx-1/Makefile
index 85a90941de4f..7c67b3d33bec 100644
--- a/arch/mips/au1000/mtx-1/Makefile
+++ b/arch/mips/au1000/mtx-1/Makefile
@@ -1,7 +1,6 @@
1# 1#
2# Copyright 2003 MontaVista Software Inc. 2# Copyright 2003 MontaVista Software Inc.
3# Author: MontaVista Software, Inc. 3# Author: MontaVista Software, Inc. <source@mvista.com>
4# ppopov@mvista.com or source@mvista.com
5# Bruno Randolf <bruno.randolf@4g-systems.biz> 4# Bruno Randolf <bruno.randolf@4g-systems.biz>
6# 5#
7# Makefile for 4G Systems MTX-1 board. 6# Makefile for 4G Systems MTX-1 board.
diff --git a/arch/mips/au1000/mtx-1/board_setup.c b/arch/mips/au1000/mtx-1/board_setup.c
index 5736354829c6..3f8079186cf2 100644
--- a/arch/mips/au1000/mtx-1/board_setup.c
+++ b/arch/mips/au1000/mtx-1/board_setup.c
@@ -3,9 +3,8 @@
3 * BRIEF MODULE DESCRIPTION 3 * BRIEF MODULE DESCRIPTION
4 * 4G Systems MTX-1 board setup. 4 * 4G Systems MTX-1 board setup.
5 * 5 *
6 * Copyright 2003 MontaVista Software Inc. 6 * Copyright 2003, 2008 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc. 7 * Author: MontaVista Software, Inc. <source@mvista.com>
8 * ppopov@mvista.com or source@mvista.com
9 * Bruno Randolf <bruno.randolf@4g-systems.biz> 8 * Bruno Randolf <bruno.randolf@4g-systems.biz>
10 * 9 *
11 * This program is free software; you can redistribute it and/or modify it 10 * This program is free software; you can redistribute it and/or modify it
@@ -34,7 +33,7 @@
34#include <asm/mach-au1x00/au1000.h> 33#include <asm/mach-au1x00/au1000.h>
35 34
36extern int (*board_pci_idsel)(unsigned int devsel, int assert); 35extern int (*board_pci_idsel)(unsigned int devsel, int assert);
37int mtx1_pci_idsel(unsigned int devsel, int assert); 36int mtx1_pci_idsel(unsigned int devsel, int assert);
38 37
39void board_reset(void) 38void board_reset(void)
40{ 39{
@@ -45,36 +44,36 @@ void board_reset(void)
45void __init board_setup(void) 44void __init board_setup(void)
46{ 45{
47#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) 46#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
48 // enable USB power switch 47 /* Enable USB power switch */
49 au_writel( au_readl(GPIO2_DIR) | 0x10, GPIO2_DIR ); 48 au_writel(au_readl(GPIO2_DIR) | 0x10, GPIO2_DIR);
50 au_writel( 0x100000, GPIO2_OUTPUT ); 49 au_writel(0x100000, GPIO2_OUTPUT);
51#endif /* defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) */ 50#endif /* defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) */
52 51
53#ifdef CONFIG_PCI 52#ifdef CONFIG_PCI
54#if defined(__MIPSEB__) 53#if defined(__MIPSEB__)
55 au_writel(0xf | (2<<6) | (1<<4), Au1500_PCI_CFG); 54 au_writel(0xf | (2 << 6) | (1 << 4), Au1500_PCI_CFG);
56#else 55#else
57 au_writel(0xf, Au1500_PCI_CFG); 56 au_writel(0xf, Au1500_PCI_CFG);
58#endif 57#endif
59#endif 58#endif
60 59
61 // initialize sys_pinfunc: 60 /* Initialize sys_pinfunc */
62 au_writel( SYS_PF_NI2, SYS_PINFUNC ); 61 au_writel(SYS_PF_NI2, SYS_PINFUNC);
63 62
64 // initialize GPIO 63 /* Initialize GPIO */
65 au_writel( 0xFFFFFFFF, SYS_TRIOUTCLR ); 64 au_writel(0xFFFFFFFF, SYS_TRIOUTCLR);
66 au_writel( 0x00000001, SYS_OUTPUTCLR ); // set M66EN (PCI 66MHz) to OFF 65 au_writel(0x00000001, SYS_OUTPUTCLR); /* set M66EN (PCI 66MHz) to OFF */
67 au_writel( 0x00000008, SYS_OUTPUTSET ); // set PCI CLKRUN# to OFF 66 au_writel(0x00000008, SYS_OUTPUTSET); /* set PCI CLKRUN# to OFF */
68 au_writel( 0x00000002, SYS_OUTPUTSET ); // set EXT_IO3 ON 67 au_writel(0x00000002, SYS_OUTPUTSET); /* set EXT_IO3 ON */
69 au_writel( 0x00000020, SYS_OUTPUTCLR ); // set eth PHY TX_ER to OFF 68 au_writel(0x00000020, SYS_OUTPUTCLR); /* set eth PHY TX_ER to OFF */
70 69
71 // enable LED and set it to green 70 /* Enable LED and set it to green */
72 au_writel( au_readl(GPIO2_DIR) | 0x1800, GPIO2_DIR ); 71 au_writel(au_readl(GPIO2_DIR) | 0x1800, GPIO2_DIR);
73 au_writel( 0x18000800, GPIO2_OUTPUT ); 72 au_writel(0x18000800, GPIO2_OUTPUT);
74 73
75 board_pci_idsel = mtx1_pci_idsel; 74 board_pci_idsel = mtx1_pci_idsel;
76 75
77 printk("4G Systems MTX-1 Board\n"); 76 printk(KERN_INFO "4G Systems MTX-1 Board\n");
78} 77}
79 78
80int 79int
@@ -82,20 +81,18 @@ mtx1_pci_idsel(unsigned int devsel, int assert)
82{ 81{
83#define MTX_IDSEL_ONLY_0_AND_3 0 82#define MTX_IDSEL_ONLY_0_AND_3 0
84#if MTX_IDSEL_ONLY_0_AND_3 83#if MTX_IDSEL_ONLY_0_AND_3
85 if (devsel != 0 && devsel != 3) { 84 if (devsel != 0 && devsel != 3) {
86 printk("*** not 0 or 3\n"); 85 printk(KERN_ERR "*** not 0 or 3\n");
87 return 0; 86 return 0;
88 } 87 }
89#endif 88#endif
90 89
91 if (assert && devsel != 0) { 90 if (assert && devsel != 0)
92 // suppress signal to cardbus 91 /* Suppress signal to Cardbus */
93 au_writel( 0x00000002, SYS_OUTPUTCLR ); // set EXT_IO3 OFF 92 au_writel(0x00000002, SYS_OUTPUTCLR); /* set EXT_IO3 OFF */
94 } 93 else
95 else { 94 au_writel(0x00000002, SYS_OUTPUTSET); /* set EXT_IO3 ON */
96 au_writel( 0x00000002, SYS_OUTPUTSET ); // set EXT_IO3 ON 95 au_sync_udelay(1);
97 } 96 return 1;
98 au_sync_udelay(1);
99 return 1;
100} 97}
101 98
diff --git a/arch/mips/au1000/mtx-1/init.c b/arch/mips/au1000/mtx-1/init.c
index c015cbce1cca..33a4aebe0cba 100644
--- a/arch/mips/au1000/mtx-1/init.c
+++ b/arch/mips/au1000/mtx-1/init.c
@@ -3,9 +3,8 @@
3 * BRIEF MODULE DESCRIPTION 3 * BRIEF MODULE DESCRIPTION
4 * 4G Systems MTX-1 board setup 4 * 4G Systems MTX-1 board setup
5 * 5 *
6 * Copyright 2003 MontaVista Software Inc. 6 * Copyright 2003, 2008 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc. 7 * Author: MontaVista Software, Inc. <source@mvista.com>
8 * ppopov@mvista.com or source@mvista.com
9 * Bruno Randolf <bruno.randolf@4g-systems.biz> 8 * Bruno Randolf <bruno.randolf@4g-systems.biz>
10 * 9 *
11 * This program is free software; you can redistribute it and/or modify it 10 * This program is free software; you can redistribute it and/or modify it
@@ -47,8 +46,8 @@ void __init prom_init(void)
47 unsigned long memsize; 46 unsigned long memsize;
48 47
49 prom_argc = fw_arg0; 48 prom_argc = fw_arg0;
50 prom_argv = (char **) fw_arg1; 49 prom_argv = (char **)fw_arg1;
51 prom_envp = (char **) fw_arg2; 50 prom_envp = (char **)fw_arg2;
52 51
53 prom_init_cmdline(); 52 prom_init_cmdline();
54 53
@@ -56,6 +55,6 @@ void __init prom_init(void)
56 if (!memsize_str) 55 if (!memsize_str)
57 memsize = 0x04000000; 56 memsize = 0x04000000;
58 else 57 else
59 memsize = simple_strtol(memsize_str, NULL, 0); 58 memsize = strict_strtol(memsize_str, 0, NULL);
60 add_memory_region(0, memsize, BOOT_MEM_RAM); 59 add_memory_region(0, memsize, BOOT_MEM_RAM);
61} 60}
diff --git a/arch/mips/au1000/mtx-1/irqmap.c b/arch/mips/au1000/mtx-1/irqmap.c
index 78d70c42c9db..f2bf02951e9c 100644
--- a/arch/mips/au1000/mtx-1/irqmap.c
+++ b/arch/mips/au1000/mtx-1/irqmap.c
@@ -31,18 +31,18 @@
31#include <asm/mach-au1x00/au1000.h> 31#include <asm/mach-au1x00/au1000.h>
32 32
33char irq_tab_alchemy[][5] __initdata = { 33char irq_tab_alchemy[][5] __initdata = {
34 [0] = { -1, INTA, INTA, INTX, INTX}, /* IDSEL 00 - AdapterA-Slot0 (top) */ 34 [0] = { -1, INTA, INTA, INTX, INTX }, /* IDSEL 00 - AdapterA-Slot0 (top) */
35 [1] = { -1, INTB, INTA, INTX, INTX}, /* IDSEL 01 - AdapterA-Slot1 (bottom) */ 35 [1] = { -1, INTB, INTA, INTX, INTX }, /* IDSEL 01 - AdapterA-Slot1 (bottom) */
36 [2] = { -1, INTC, INTD, INTX, INTX}, /* IDSEL 02 - AdapterB-Slot0 (top) */ 36 [2] = { -1, INTC, INTD, INTX, INTX }, /* IDSEL 02 - AdapterB-Slot0 (top) */
37 [3] = { -1, INTD, INTC, INTX, INTX}, /* IDSEL 03 - AdapterB-Slot1 (bottom) */ 37 [3] = { -1, INTD, INTC, INTX, INTX }, /* IDSEL 03 - AdapterB-Slot1 (bottom) */
38 [4] = { -1, INTA, INTB, INTX, INTX}, /* IDSEL 04 - AdapterC-Slot0 (top) */ 38 [4] = { -1, INTA, INTB, INTX, INTX }, /* IDSEL 04 - AdapterC-Slot0 (top) */
39 [5] = { -1, INTB, INTA, INTX, INTX}, /* IDSEL 05 - AdapterC-Slot1 (bottom) */ 39 [5] = { -1, INTB, INTA, INTX, INTX }, /* IDSEL 05 - AdapterC-Slot1 (bottom) */
40 [6] = { -1, INTC, INTD, INTX, INTX}, /* IDSEL 06 - AdapterD-Slot0 (top) */ 40 [6] = { -1, INTC, INTD, INTX, INTX }, /* IDSEL 06 - AdapterD-Slot0 (top) */
41 [7] = { -1, INTD, INTC, INTX, INTX}, /* IDSEL 07 - AdapterD-Slot1 (bottom) */ 41 [7] = { -1, INTD, INTC, INTX, INTX }, /* IDSEL 07 - AdapterD-Slot1 (bottom) */
42}; 42};
43 43
44struct au1xxx_irqmap __initdata au1xxx_irq_map[] = { 44struct au1xxx_irqmap __initdata au1xxx_irq_map[] = {
45 { AU1500_GPIO_204, INTC_INT_HIGH_LEVEL, 0}, 45 { AU1500_GPIO_204, INTC_INT_HIGH_LEVEL, 0 },
46 { AU1500_GPIO_201, INTC_INT_LOW_LEVEL, 0 }, 46 { AU1500_GPIO_201, INTC_INT_LOW_LEVEL, 0 },
47 { AU1500_GPIO_202, INTC_INT_LOW_LEVEL, 0 }, 47 { AU1500_GPIO_202, INTC_INT_LOW_LEVEL, 0 },
48 { AU1500_GPIO_203, INTC_INT_LOW_LEVEL, 0 }, 48 { AU1500_GPIO_203, INTC_INT_LOW_LEVEL, 0 },
diff --git a/arch/mips/au1000/mtx-1/platform.c b/arch/mips/au1000/mtx-1/platform.c
index a7edbf0829ac..9807be37c32f 100644
--- a/arch/mips/au1000/mtx-1/platform.c
+++ b/arch/mips/au1000/mtx-1/platform.c
@@ -21,11 +21,10 @@
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/platform_device.h> 22#include <linux/platform_device.h>
23#include <linux/leds.h> 23#include <linux/leds.h>
24#include <linux/gpio.h>
24#include <linux/gpio_keys.h> 25#include <linux/gpio_keys.h>
25#include <linux/input.h> 26#include <linux/input.h>
26 27
27#include <asm/gpio.h>
28
29static struct gpio_keys_button mtx1_gpio_button[] = { 28static struct gpio_keys_button mtx1_gpio_button[] = {
30 { 29 {
31 .gpio = 207, 30 .gpio = 207,
diff --git a/arch/mips/au1000/pb1000/Makefile b/arch/mips/au1000/pb1000/Makefile
index daa1a507e72f..99bbec0ca41b 100644
--- a/arch/mips/au1000/pb1000/Makefile
+++ b/arch/mips/au1000/pb1000/Makefile
@@ -1,8 +1,8 @@
1# 1#
2# Copyright 2000 MontaVista Software Inc. 2# Copyright 2000, 2008 MontaVista Software Inc.
3# Author: MontaVista Software, Inc. 3# Author: MontaVista Software, Inc. <source@mvista.com>
4# ppopov@mvista.com or source@mvista.com 4#
5# Makefile for the Alchemy Semiconductor Pb1000 board.
5# 6#
6# Makefile for the Alchemy Semiconductor PB1000 board.
7 7
8lib-y := init.o board_setup.o irqmap.o 8lib-y := init.o board_setup.o irqmap.o
diff --git a/arch/mips/au1000/pb1000/board_setup.c b/arch/mips/au1000/pb1000/board_setup.c
index 33f15acc1b17..25df167a95b3 100644
--- a/arch/mips/au1000/pb1000/board_setup.c
+++ b/arch/mips/au1000/pb1000/board_setup.c
@@ -1,7 +1,6 @@
1/* 1/*
2 * Copyright 2000 MontaVista Software Inc. 2 * Copyright 2000, 2008 MontaVista Software Inc.
3 * Author: MontaVista Software, Inc. 3 * Author: MontaVista Software, Inc. <source@mvista.com>
4 * ppopov@mvista.com or source@mvista.com
5 * 4 *
6 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the 6 * under the terms of the GNU General Public License as published by the
@@ -40,128 +39,126 @@ void __init board_setup(void)
40 u32 sys_freqctrl, sys_clksrc; 39 u32 sys_freqctrl, sys_clksrc;
41 u32 prid = read_c0_prid(); 40 u32 prid = read_c0_prid();
42 41
43 // set AUX clock to 12MHz * 8 = 96 MHz 42 /* Set AUX clock to 12 MHz * 8 = 96 MHz */
44 au_writel(8, SYS_AUXPLL); 43 au_writel(8, SYS_AUXPLL);
45 au_writel(0, SYS_PINSTATERD); 44 au_writel(0, SYS_PINSTATERD);
46 udelay(100); 45 udelay(100);
47 46
48#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) 47#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
49 /* zero and disable FREQ2 */ 48 /* Zero and disable FREQ2 */
50 sys_freqctrl = au_readl(SYS_FREQCTRL0); 49 sys_freqctrl = au_readl(SYS_FREQCTRL0);
51 sys_freqctrl &= ~0xFFF00000; 50 sys_freqctrl &= ~0xFFF00000;
52 au_writel(sys_freqctrl, SYS_FREQCTRL0); 51 au_writel(sys_freqctrl, SYS_FREQCTRL0);
53 52
54 /* zero and disable USBH/USBD clocks */ 53 /* Zero and disable USBH/USBD clocks */
55 sys_clksrc = au_readl(SYS_CLKSRC); 54 sys_clksrc = au_readl(SYS_CLKSRC);
56 sys_clksrc &= ~0x00007FE0; 55 sys_clksrc &= ~(SYS_CS_CUD | SYS_CS_DUD | SYS_CS_MUD_MASK |
56 SYS_CS_CUH | SYS_CS_DUH | SYS_CS_MUH_MASK);
57 au_writel(sys_clksrc, SYS_CLKSRC); 57 au_writel(sys_clksrc, SYS_CLKSRC);
58 58
59 sys_freqctrl = au_readl(SYS_FREQCTRL0); 59 sys_freqctrl = au_readl(SYS_FREQCTRL0);
60 sys_freqctrl &= ~0xFFF00000; 60 sys_freqctrl &= ~0xFFF00000;
61 61
62 sys_clksrc = au_readl(SYS_CLKSRC); 62 sys_clksrc = au_readl(SYS_CLKSRC);
63 sys_clksrc &= ~0x00007FE0; 63 sys_clksrc &= ~(SYS_CS_CUD | SYS_CS_DUD | SYS_CS_MUD_MASK |
64 SYS_CS_CUH | SYS_CS_DUH | SYS_CS_MUH_MASK);
64 65
65 switch (prid & 0x000000FF) 66 switch (prid & 0x000000FF) {
66 {
67 case 0x00: /* DA */ 67 case 0x00: /* DA */
68 case 0x01: /* HA */ 68 case 0x01: /* HA */
69 case 0x02: /* HB */ 69 case 0x02: /* HB */
70 /* CPU core freq to 48MHz to slow it way down... */ 70 /* CPU core freq to 48 MHz to slow it way down... */
71 au_writel(4, SYS_CPUPLL); 71 au_writel(4, SYS_CPUPLL);
72 72
73 /* 73 /*
74 * Setup 48MHz FREQ2 from CPUPLL for USB Host 74 * Setup 48 MHz FREQ2 from CPUPLL for USB Host
75 */ 75 * FRDIV2 = 3 -> div by 8 of 384 MHz -> 48 MHz
76 /* FRDIV2=3 -> div by 8 of 384MHz -> 48MHz */ 76 */
77 sys_freqctrl |= ((3<<22) | (1<<21) | (0<<20)); 77 sys_freqctrl |= (3 << SYS_FC_FRDIV2_BIT) | SYS_FC_FE2;
78 au_writel(sys_freqctrl, SYS_FREQCTRL0); 78 au_writel(sys_freqctrl, SYS_FREQCTRL0);
79 79
80 /* CPU core freq to 384MHz */ 80 /* CPU core freq to 384 MHz */
81 au_writel(0x20, SYS_CPUPLL); 81 au_writel(0x20, SYS_CPUPLL);
82 82
83 printk("Au1000: 48MHz OHCI workaround enabled\n"); 83 printk(KERN_INFO "Au1000: 48 MHz OHCI workaround enabled\n");
84 break; 84 break;
85 85
86 default: /* HC and newer */ 86 default: /* HC and newer */
87 // FREQ2 = aux/2 = 48 MHz 87 /* FREQ2 = aux / 2 = 48 MHz */
88 sys_freqctrl |= ((0<<22) | (1<<21) | (1<<20)); 88 sys_freqctrl |= (0 << SYS_FC_FRDIV2_BIT) |
89 au_writel(sys_freqctrl, SYS_FREQCTRL0); 89 SYS_FC_FE2 | SYS_FC_FS2;
90 au_writel(sys_freqctrl, SYS_FREQCTRL0);
90 break; 91 break;
91 } 92 }
92 93
93 /* 94 /*
94 * Route 48MHz FREQ2 into USB Host and/or Device 95 * Route 48 MHz FREQ2 into USB Host and/or Device
95 */ 96 */
96#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) 97 sys_clksrc |= SYS_CS_MUX_FQ2 << SYS_CS_MUH_BIT;
97 sys_clksrc |= ((4<<12) | (0<<11) | (0<<10));
98#endif
99 au_writel(sys_clksrc, SYS_CLKSRC); 98 au_writel(sys_clksrc, SYS_CLKSRC);
100 99
101 // configure pins GPIO[14:9] as GPIO 100 /* Configure pins GPIO[14:9] as GPIO */
102 pin_func = au_readl(SYS_PINFUNC) & (u32)(~0x8080); 101 pin_func = au_readl(SYS_PINFUNC) & ~(SYS_PF_UR3 | SYS_PF_USB);
103 102
104 // 2nd USB port is USB host 103 /* 2nd USB port is USB host */
105 pin_func |= 0x8000; 104 pin_func |= SYS_PF_USB;
106 105
107 au_writel(pin_func, SYS_PINFUNC); 106 au_writel(pin_func, SYS_PINFUNC);
108 au_writel(0x2800, SYS_TRIOUTCLR); 107 au_writel(0x2800, SYS_TRIOUTCLR);
109 au_writel(0x0030, SYS_OUTPUTCLR); 108 au_writel(0x0030, SYS_OUTPUTCLR);
110#endif /* defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) */ 109#endif /* defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) */
111 110
112 // make gpio 15 an input (for interrupt line) 111 /* Make GPIO 15 an input (for interrupt line) */
113 pin_func = au_readl(SYS_PINFUNC) & (u32)(~0x100); 112 pin_func = au_readl(SYS_PINFUNC) & ~SYS_PF_IRF;
114 // we don't need I2S, so make it available for GPIO[31:29] 113 /* We don't need I2S, so make it available for GPIO[31:29] */
115 pin_func |= (1<<5); 114 pin_func |= SYS_PF_I2S;
116 au_writel(pin_func, SYS_PINFUNC); 115 au_writel(pin_func, SYS_PINFUNC);
117 116
118 au_writel(0x8000, SYS_TRIOUTCLR); 117 au_writel(0x8000, SYS_TRIOUTCLR);
119 118
120 static_cfg0 = au_readl(MEM_STCFG0) & (u32)(~0xc00); 119 static_cfg0 = au_readl(MEM_STCFG0) & ~0xc00;
121 au_writel(static_cfg0, MEM_STCFG0); 120 au_writel(static_cfg0, MEM_STCFG0);
122 121
123 // configure RCE2* for LCD 122 /* configure RCE2* for LCD */
124 au_writel(0x00000004, MEM_STCFG2); 123 au_writel(0x00000004, MEM_STCFG2);
125 124
126 // MEM_STTIME2 125 /* MEM_STTIME2 */
127 au_writel(0x09000000, MEM_STTIME2); 126 au_writel(0x09000000, MEM_STTIME2);
128 127
129 // Set 32-bit base address decoding for RCE2* 128 /* Set 32-bit base address decoding for RCE2* */
130 au_writel(0x10003ff0, MEM_STADDR2); 129 au_writel(0x10003ff0, MEM_STADDR2);
131 130
132 // PCI CPLD setup 131 /*
133 // expand CE0 to cover PCI 132 * PCI CPLD setup
133 * Expand CE0 to cover PCI
134 */
134 au_writel(0x11803e40, MEM_STADDR1); 135 au_writel(0x11803e40, MEM_STADDR1);
135 136
136 // burst visibility on 137 /* Burst visibility on */
137 au_writel(au_readl(MEM_STCFG0) | 0x1000, MEM_STCFG0); 138 au_writel(au_readl(MEM_STCFG0) | 0x1000, MEM_STCFG0);
138 139
139 au_writel(0x83, MEM_STCFG1); // ewait enabled, flash timing 140 au_writel(0x83, MEM_STCFG1); /* ewait enabled, flash timing */
140 au_writel(0x33030a10, MEM_STTIME1); // slower timing for FPGA 141 au_writel(0x33030a10, MEM_STTIME1); /* slower timing for FPGA */
141 142
142 /* setup the static bus controller */ 143 /* Setup the static bus controller */
143 au_writel(0x00000002, MEM_STCFG3); /* type = PCMCIA */ 144 au_writel(0x00000002, MEM_STCFG3); /* type = PCMCIA */
144 au_writel(0x280E3D07, MEM_STTIME3); /* 250ns cycle time */ 145 au_writel(0x280E3D07, MEM_STTIME3); /* 250ns cycle time */
145 au_writel(0x10000000, MEM_STADDR3); /* any PCMCIA select */ 146 au_writel(0x10000000, MEM_STADDR3); /* any PCMCIA select */
146 147
147#ifdef CONFIG_PCI 148 /*
148 au_writel(0, PCI_BRIDGE_CONFIG); // set extend byte to 0 149 * Enable Au1000 BCLK switching - note: sed1356 must not use
149 au_writel(0, SDRAM_MBAR); // set mbar to 0 150 * its BCLK (Au1000 LCLK) for any timings
150 au_writel(0x2, SDRAM_CMD); // enable memory accesses 151 */
151 au_sync_delay(1); 152 switch (prid & 0x000000FF) {
152#endif
153
154 /* Enable Au1000 BCLK switching - note: sed1356 must not use
155 * its BCLK (Au1000 LCLK) for any timings */
156 switch (prid & 0x000000FF)
157 {
158 case 0x00: /* DA */ 153 case 0x00: /* DA */
159 case 0x01: /* HA */ 154 case 0x01: /* HA */
160 case 0x02: /* HB */ 155 case 0x02: /* HB */
161 break; 156 break;
162 default: /* HC and newer */ 157 default: /* HC and newer */
163 /* Enable sys bus clock divider when IDLE state or no bus 158 /*
164 activity. */ 159 * Enable sys bus clock divider when IDLE state or no bus
160 * activity.
161 */
165 au_writel(au_readl(SYS_POWERCTRL) | (0x3 << 5), SYS_POWERCTRL); 162 au_writel(au_readl(SYS_POWERCTRL) | (0x3 << 5), SYS_POWERCTRL);
166 break; 163 break;
167 } 164 }
diff --git a/arch/mips/au1000/pb1000/init.c b/arch/mips/au1000/pb1000/init.c
index 549447df71d6..3837365d613d 100644
--- a/arch/mips/au1000/pb1000/init.c
+++ b/arch/mips/au1000/pb1000/init.c
@@ -1,10 +1,9 @@
1/* 1/*
2 * BRIEF MODULE DESCRIPTION 2 * BRIEF MODULE DESCRIPTION
3 * PB1000 board setup 3 * Pb1000 board setup
4 * 4 *
5 * Copyright 2001 MontaVista Software Inc. 5 * Copyright 2001, 2008 MontaVista Software Inc.
6 * Author: MontaVista Software, Inc. 6 * Author: MontaVista Software, Inc. <source@mvista.com>
7 * ppopov@mvista.com or source@mvista.com
8 * 7 *
9 * This program is free software; you can redistribute it and/or modify it 8 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the 9 * under the terms of the GNU General Public License as published by the
@@ -44,16 +43,15 @@ void __init prom_init(void)
44 unsigned char *memsize_str; 43 unsigned char *memsize_str;
45 unsigned long memsize; 44 unsigned long memsize;
46 45
47 prom_argc = (int) fw_arg0; 46 prom_argc = (int)fw_arg0;
48 prom_argv = (char **) fw_arg1; 47 prom_argv = (char **)fw_arg1;
49 prom_envp = (char **) fw_arg2; 48 prom_envp = (char **)fw_arg2;
50 49
51 prom_init_cmdline(); 50 prom_init_cmdline();
52 memsize_str = prom_getenv("memsize"); 51 memsize_str = prom_getenv("memsize");
53 if (!memsize_str) { 52 if (!memsize_str)
54 memsize = 0x04000000; 53 memsize = 0x04000000;
55 } else { 54 else
56 memsize = simple_strtol(memsize_str, NULL, 0); 55 memsize = strict_strtol(memsize_str, 0, NULL);
57 }
58 add_memory_region(0, memsize, BOOT_MEM_RAM); 56 add_memory_region(0, memsize, BOOT_MEM_RAM);
59} 57}
diff --git a/arch/mips/au1000/pb1100/Makefile b/arch/mips/au1000/pb1100/Makefile
index 996236df6375..793e97c49e46 100644
--- a/arch/mips/au1000/pb1100/Makefile
+++ b/arch/mips/au1000/pb1100/Makefile
@@ -1,8 +1,8 @@
1# 1#
2# Copyright 2000,2001 MontaVista Software Inc. 2# Copyright 2000, 2001, 2008 MontaVista Software Inc.
3# Author: MontaVista Software, Inc. 3# Author: MontaVista Software, Inc. <source@mvista.com>
4# ppopov@mvista.com or source@mvista.com
5# 4#
6# Makefile for the Alchemy Semiconductor Pb1100 board. 5# Makefile for the Alchemy Semiconductor Pb1100 board.
6#
7 7
8lib-y := init.o board_setup.o irqmap.o 8lib-y := init.o board_setup.o irqmap.o
diff --git a/arch/mips/au1000/pb1100/board_setup.c b/arch/mips/au1000/pb1100/board_setup.c
index 656164c8e9ca..c0bfd59a7a36 100644
--- a/arch/mips/au1000/pb1100/board_setup.c
+++ b/arch/mips/au1000/pb1100/board_setup.c
@@ -1,7 +1,6 @@
1/* 1/*
2 * Copyright 2002 MontaVista Software Inc. 2 * Copyright 2002, 2008 MontaVista Software Inc.
3 * Author: MontaVista Software, Inc. 3 * Author: MontaVista Software, Inc. <source@mvista.com>
4 * ppopov@mvista.com or source@mvista.com
5 * 4 *
6 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the 6 * under the terms of the GNU General Public License as published by the
@@ -32,15 +31,15 @@
32 31
33void board_reset(void) 32void board_reset(void)
34{ 33{
35 /* Hit BCSR.SYSTEM_CONTROL[SW_RST] */ 34 /* Hit BCSR.RST_VDDI[SOFT_RESET] */
36 au_writel(0x00000000, 0xAE00001C); 35 au_writel(0x00000000, PB1100_RST_VDDI);
37} 36}
38 37
39void __init board_setup(void) 38void __init board_setup(void)
40{ 39{
41 volatile void __iomem * base = (volatile void __iomem *) 0xac000000UL; 40 volatile void __iomem *base = (volatile void __iomem *)0xac000000UL;
42 41
43 // set AUX clock to 12MHz * 8 = 96 MHz 42 /* Set AUX clock to 12 MHz * 8 = 96 MHz */
44 au_writel(8, SYS_AUXPLL); 43 au_writel(8, SYS_AUXPLL);
45 au_writel(0, SYS_PININPUTEN); 44 au_writel(0, SYS_PININPUTEN);
46 udelay(100); 45 udelay(100);
@@ -49,44 +48,47 @@ void __init board_setup(void)
49 { 48 {
50 u32 pin_func, sys_freqctrl, sys_clksrc; 49 u32 pin_func, sys_freqctrl, sys_clksrc;
51 50
52 // configure pins GPIO[14:9] as GPIO 51 /* Configure pins GPIO[14:9] as GPIO */
53 pin_func = au_readl(SYS_PINFUNC) & (u32)(~0x80); 52 pin_func = au_readl(SYS_PINFUNC) & ~SYS_PF_UR3;
54 53
55 /* zero and disable FREQ2 */ 54 /* Zero and disable FREQ2 */
56 sys_freqctrl = au_readl(SYS_FREQCTRL0); 55 sys_freqctrl = au_readl(SYS_FREQCTRL0);
57 sys_freqctrl &= ~0xFFF00000; 56 sys_freqctrl &= ~0xFFF00000;
58 au_writel(sys_freqctrl, SYS_FREQCTRL0); 57 au_writel(sys_freqctrl, SYS_FREQCTRL0);
59 58
60 /* zero and disable USBH/USBD/IrDA clock */ 59 /* Zero and disable USBH/USBD/IrDA clock */
61 sys_clksrc = au_readl(SYS_CLKSRC); 60 sys_clksrc = au_readl(SYS_CLKSRC);
62 sys_clksrc &= ~0x0000001F; 61 sys_clksrc &= ~(SYS_CS_CIR | SYS_CS_DIR | SYS_CS_MIR_MASK);
63 au_writel(sys_clksrc, SYS_CLKSRC); 62 au_writel(sys_clksrc, SYS_CLKSRC);
64 63
65 sys_freqctrl = au_readl(SYS_FREQCTRL0); 64 sys_freqctrl = au_readl(SYS_FREQCTRL0);
66 sys_freqctrl &= ~0xFFF00000; 65 sys_freqctrl &= ~0xFFF00000;
67 66
68 sys_clksrc = au_readl(SYS_CLKSRC); 67 sys_clksrc = au_readl(SYS_CLKSRC);
69 sys_clksrc &= ~0x0000001F; 68 sys_clksrc &= ~(SYS_CS_CIR | SYS_CS_DIR | SYS_CS_MIR_MASK);
70 69
71 // FREQ2 = aux/2 = 48 MHz 70 /* FREQ2 = aux / 2 = 48 MHz */
72 sys_freqctrl |= ((0<<22) | (1<<21) | (1<<20)); 71 sys_freqctrl |= (0 << SYS_FC_FRDIV2_BIT) |
72 SYS_FC_FE2 | SYS_FC_FS2;
73 au_writel(sys_freqctrl, SYS_FREQCTRL0); 73 au_writel(sys_freqctrl, SYS_FREQCTRL0);
74 74
75 /* 75 /*
76 * Route 48MHz FREQ2 into USBH/USBD/IrDA 76 * Route 48 MHz FREQ2 into USBH/USBD/IrDA
77 */ 77 */
78 sys_clksrc |= ((4<<2) | (0<<1) | 0 ); 78 sys_clksrc |= SYS_CS_MUX_FQ2 << SYS_CS_MIR_BIT;
79 au_writel(sys_clksrc, SYS_CLKSRC); 79 au_writel(sys_clksrc, SYS_CLKSRC);
80 80
81 /* setup the static bus controller */ 81 /* Setup the static bus controller */
82 au_writel(0x00000002, MEM_STCFG3); /* type = PCMCIA */ 82 au_writel(0x00000002, MEM_STCFG3); /* type = PCMCIA */
83 au_writel(0x280E3D07, MEM_STTIME3); /* 250ns cycle time */ 83 au_writel(0x280E3D07, MEM_STTIME3); /* 250ns cycle time */
84 au_writel(0x10000000, MEM_STADDR3); /* any PCMCIA select */ 84 au_writel(0x10000000, MEM_STADDR3); /* any PCMCIA select */
85 85
86 // get USB Functionality pin state (device vs host drive pins) 86 /*
87 pin_func = au_readl(SYS_PINFUNC) & (u32)(~0x8000); 87 * Get USB Functionality pin state (device vs host drive pins).
88 // 2nd USB port is USB host 88 */
89 pin_func |= 0x8000; 89 pin_func = au_readl(SYS_PINFUNC) & ~SYS_PF_USB;
90 /* 2nd USB port is USB host. */
91 pin_func |= SYS_PF_USB;
90 au_writel(pin_func, SYS_PINFUNC); 92 au_writel(pin_func, SYS_PINFUNC);
91 } 93 }
92#endif /* defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) */ 94#endif /* defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) */
@@ -94,12 +96,12 @@ void __init board_setup(void)
94 /* Enable sys bus clock divider when IDLE state or no bus activity. */ 96 /* Enable sys bus clock divider when IDLE state or no bus activity. */
95 au_writel(au_readl(SYS_POWERCTRL) | (0x3 << 5), SYS_POWERCTRL); 97 au_writel(au_readl(SYS_POWERCTRL) | (0x3 << 5), SYS_POWERCTRL);
96 98
97 // Enable the RTC if not already enabled 99 /* Enable the RTC if not already enabled. */
98 if (!(readb(base + 0x28) & 0x20)) { 100 if (!(readb(base + 0x28) & 0x20)) {
99 writeb(readb(base + 0x28) | 0x20, base + 0x28); 101 writeb(readb(base + 0x28) | 0x20, base + 0x28);
100 au_sync(); 102 au_sync();
101 } 103 }
102 // Put the clock in BCD mode 104 /* Put the clock in BCD mode. */
103 if (readb(base + 0x2C) & 0x4) { /* reg B */ 105 if (readb(base + 0x2C) & 0x4) { /* reg B */
104 writeb(readb(base + 0x2c) & ~0x4, base + 0x2c); 106 writeb(readb(base + 0x2c) & ~0x4, base + 0x2c);
105 au_sync(); 107 au_sync();
diff --git a/arch/mips/au1000/pb1100/init.c b/arch/mips/au1000/pb1100/init.c
index c91344648ed3..8355483f3de2 100644
--- a/arch/mips/au1000/pb1100/init.c
+++ b/arch/mips/au1000/pb1100/init.c
@@ -3,9 +3,8 @@
3 * BRIEF MODULE DESCRIPTION 3 * BRIEF MODULE DESCRIPTION
4 * Pb1100 board setup 4 * Pb1100 board setup
5 * 5 *
6 * Copyright 2002 MontaVista Software Inc. 6 * Copyright 2002, 2008 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc. 7 * Author: MontaVista Software, Inc. <source@mvista.com>
8 * ppopov@mvista.com or source@mvista.com
9 * 8 *
10 * This program is free software; you can redistribute it and/or modify it 9 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the 10 * under the terms of the GNU General Public License as published by the
@@ -46,8 +45,8 @@ void __init prom_init(void)
46 unsigned long memsize; 45 unsigned long memsize;
47 46
48 prom_argc = fw_arg0; 47 prom_argc = fw_arg0;
49 prom_argv = (char **) fw_arg1; 48 prom_argv = (char **)fw_arg1;
50 prom_envp = (char **) fw_arg3; 49 prom_envp = (char **)fw_arg3;
51 50
52 prom_init_cmdline(); 51 prom_init_cmdline();
53 52
@@ -55,7 +54,7 @@ void __init prom_init(void)
55 if (!memsize_str) 54 if (!memsize_str)
56 memsize = 0x04000000; 55 memsize = 0x04000000;
57 else 56 else
58 memsize = simple_strtol(memsize_str, NULL, 0); 57 memsize = strict_strtol(memsize_str, 0, NULL);
59 58
60 add_memory_region(0, memsize, BOOT_MEM_RAM); 59 add_memory_region(0, memsize, BOOT_MEM_RAM);
61} 60}
diff --git a/arch/mips/au1000/pb1100/irqmap.c b/arch/mips/au1000/pb1100/irqmap.c
index b5021e3d477f..9b7dd8b41283 100644
--- a/arch/mips/au1000/pb1100/irqmap.c
+++ b/arch/mips/au1000/pb1100/irqmap.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * BRIEF MODULE DESCRIPTION 2 * BRIEF MODULE DESCRIPTION
3 * Au1xxx irq map table 3 * Au1xx0 IRQ map table
4 * 4 *
5 * Copyright 2003 Embedded Edge, LLC 5 * Copyright 2003 Embedded Edge, LLC
6 * dan@embeddededge.com 6 * dan@embeddededge.com
@@ -31,10 +31,10 @@
31#include <asm/mach-au1x00/au1000.h> 31#include <asm/mach-au1x00/au1000.h>
32 32
33struct au1xxx_irqmap __initdata au1xxx_irq_map[] = { 33struct au1xxx_irqmap __initdata au1xxx_irq_map[] = {
34 { AU1000_GPIO_9, INTC_INT_LOW_LEVEL, 0 }, // PCMCIA Card Fully_Interted# 34 { AU1000_GPIO_9, INTC_INT_LOW_LEVEL, 0 }, /* PCMCIA Card Fully_Inserted# */
35 { AU1000_GPIO_10, INTC_INT_LOW_LEVEL, 0 }, // PCMCIA Card STSCHG# 35 { AU1000_GPIO_10, INTC_INT_LOW_LEVEL, 0 }, /* PCMCIA Card STSCHG# */
36 { AU1000_GPIO_11, INTC_INT_LOW_LEVEL, 0 }, // PCMCIA Card IRQ# 36 { AU1000_GPIO_11, INTC_INT_LOW_LEVEL, 0 }, /* PCMCIA Card IRQ# */
37 { AU1000_GPIO_13, INTC_INT_LOW_LEVEL, 0 }, // DC_IRQ# 37 { AU1000_GPIO_13, INTC_INT_LOW_LEVEL, 0 }, /* DC_IRQ# */
38}; 38};
39 39
40int __initdata au1xxx_nr_irqs = ARRAY_SIZE(au1xxx_irq_map); 40int __initdata au1xxx_nr_irqs = ARRAY_SIZE(au1xxx_irq_map);
diff --git a/arch/mips/au1000/pb1200/Makefile b/arch/mips/au1000/pb1200/Makefile
index 4fe02ea65a60..d678adf7ce85 100644
--- a/arch/mips/au1000/pb1200/Makefile
+++ b/arch/mips/au1000/pb1200/Makefile
@@ -1,5 +1,5 @@
1# 1#
2# Makefile for the Alchemy Semiconductor PB1200 board. 2# Makefile for the Alchemy Semiconductor Pb1200/DBAu1200 boards.
3# 3#
4 4
5lib-y := init.o board_setup.o irqmap.o 5lib-y := init.o board_setup.o irqmap.o
diff --git a/arch/mips/au1000/pb1200/board_setup.c b/arch/mips/au1000/pb1200/board_setup.c
index 4493a792cc4c..6cb2115059ad 100644
--- a/arch/mips/au1000/pb1200/board_setup.c
+++ b/arch/mips/au1000/pb1200/board_setup.c
@@ -27,16 +27,8 @@
27#include <linux/init.h> 27#include <linux/init.h>
28#include <linux/sched.h> 28#include <linux/sched.h>
29 29
30#include <au1000.h>
31#include <prom.h> 30#include <prom.h>
32 31#include <au1xxx.h>
33#ifdef CONFIG_MIPS_PB1200
34#include <asm/mach-pb1x00/pb1200.h>
35#endif
36
37#ifdef CONFIG_MIPS_DB1200
38#include <asm/mach-db1x00/db1200.h>
39#endif
40 32
41extern void _board_init_irq(void); 33extern void _board_init_irq(void);
42extern void (*board_init_irq)(void); 34extern void (*board_init_irq)(void);
@@ -53,56 +45,57 @@ void __init board_setup(void)
53 45
54#if 0 46#if 0
55 { 47 {
56 u32 pin_func; 48 u32 pin_func;
57 49
58 /* Enable PSC1 SYNC for AC97. Normaly done in audio driver, 50 /*
59 * but it is board specific code, so put it here. 51 * Enable PSC1 SYNC for AC97. Normaly done in audio driver,
60 */ 52 * but it is board specific code, so put it here.
61 pin_func = au_readl(SYS_PINFUNC); 53 */
62 au_sync(); 54 pin_func = au_readl(SYS_PINFUNC);
63 pin_func |= SYS_PF_MUST_BE_SET | SYS_PF_PSC1_S1; 55 au_sync();
64 au_writel(pin_func, SYS_PINFUNC); 56 pin_func |= SYS_PF_MUST_BE_SET | SYS_PF_PSC1_S1;
65 57 au_writel(pin_func, SYS_PINFUNC);
66 au_writel(0, (u32)bcsr|0x10); /* turn off pcmcia power */ 58
67 au_sync(); 59 au_writel(0, (u32)bcsr | 0x10); /* turn off PCMCIA power */
60 au_sync();
68 } 61 }
69#endif 62#endif
70 63
71#if defined(CONFIG_I2C_AU1550) 64#if defined(CONFIG_I2C_AU1550)
72 { 65 {
73 u32 freq0, clksrc; 66 u32 freq0, clksrc;
74 u32 pin_func; 67 u32 pin_func;
75 68
76 /* Select SMBUS in CPLD */ 69 /* Select SMBus in CPLD */
77 bcsr->resets &= ~(BCSR_RESETS_PCS0MUX); 70 bcsr->resets &= ~BCSR_RESETS_PCS0MUX;
78 71
79 pin_func = au_readl(SYS_PINFUNC); 72 pin_func = au_readl(SYS_PINFUNC);
80 au_sync(); 73 au_sync();
81 pin_func &= ~(3<<17 | 1<<4); 74 pin_func &= ~(SYS_PINFUNC_P0A | SYS_PINFUNC_P0B);
82 /* Set GPIOs correctly */ 75 /* Set GPIOs correctly */
83 pin_func |= 2<<17; 76 pin_func |= 2 << 17;
84 au_writel(pin_func, SYS_PINFUNC); 77 au_writel(pin_func, SYS_PINFUNC);
85 au_sync(); 78 au_sync();
86 79
87 /* The i2c driver depends on 50Mhz clock */ 80 /* The I2C driver depends on 50 MHz clock */
88 freq0 = au_readl(SYS_FREQCTRL0); 81 freq0 = au_readl(SYS_FREQCTRL0);
89 au_sync(); 82 au_sync();
90 freq0 &= ~(SYS_FC_FRDIV1_MASK | SYS_FC_FS1 | SYS_FC_FE1); 83 freq0 &= ~(SYS_FC_FRDIV1_MASK | SYS_FC_FS1 | SYS_FC_FE1);
91 freq0 |= (3<<SYS_FC_FRDIV1_BIT); 84 freq0 |= 3 << SYS_FC_FRDIV1_BIT;
92 /* 396Mhz / (3+1)*2 == 49.5Mhz */ 85 /* 396 MHz / (3 + 1) * 2 == 49.5 MHz */
93 au_writel(freq0, SYS_FREQCTRL0); 86 au_writel(freq0, SYS_FREQCTRL0);
94 au_sync(); 87 au_sync();
95 freq0 |= SYS_FC_FE1; 88 freq0 |= SYS_FC_FE1;
96 au_writel(freq0, SYS_FREQCTRL0); 89 au_writel(freq0, SYS_FREQCTRL0);
97 au_sync(); 90 au_sync();
98 91
99 clksrc = au_readl(SYS_CLKSRC); 92 clksrc = au_readl(SYS_CLKSRC);
100 au_sync(); 93 au_sync();
101 clksrc &= ~0x01f00000; 94 clksrc &= ~(SYS_CS_CE0 | SYS_CS_DE0 | SYS_CS_ME0_MASK);
102 /* bit 22 is EXTCLK0 for PSC0 */ 95 /* Bit 22 is EXTCLK0 for PSC0 */
103 clksrc |= (0x3 << 22); 96 clksrc |= SYS_CS_MUX_FQ1 << SYS_CS_ME0_BIT;
104 au_writel(clksrc, SYS_CLKSRC); 97 au_writel(clksrc, SYS_CLKSRC);
105 au_sync(); 98 au_sync();
106 } 99 }
107#endif 100#endif
108 101
@@ -116,27 +109,27 @@ void __init board_setup(void)
116#endif 109#endif
117#endif 110#endif
118 111
119 /* The Pb1200 development board uses external MUX for PSC0 to 112 /*
120 support SMB/SPI. bcsr->resets bit 12: 0=SMB 1=SPI 113 * The Pb1200 development board uses external MUX for PSC0 to
121 */ 114 * support SMB/SPI. bcsr->resets bit 12: 0=SMB 1=SPI
115 */
122#ifdef CONFIG_I2C_AU1550 116#ifdef CONFIG_I2C_AU1550
123 bcsr->resets &= (~BCSR_RESETS_PCS0MUX); 117 bcsr->resets &= ~BCSR_RESETS_PCS0MUX;
124#endif 118#endif
125 au_sync(); 119 au_sync();
126 120
127#ifdef CONFIG_MIPS_PB1200 121#ifdef CONFIG_MIPS_PB1200
128 printk("AMD Alchemy Pb1200 Board\n"); 122 printk(KERN_INFO "AMD Alchemy Pb1200 Board\n");
129#endif 123#endif
130#ifdef CONFIG_MIPS_DB1200 124#ifdef CONFIG_MIPS_DB1200
131 printk("AMD Alchemy Db1200 Board\n"); 125 printk(KERN_INFO "AMD Alchemy Db1200 Board\n");
132#endif 126#endif
133 127
134 /* Setup Pb1200 External Interrupt Controller */ 128 /* Setup Pb1200 External Interrupt Controller */
135 board_init_irq = _board_init_irq; 129 board_init_irq = _board_init_irq;
136} 130}
137 131
138int 132int board_au1200fb_panel(void)
139board_au1200fb_panel(void)
140{ 133{
141 BCSR *bcsr = (BCSR *)BCSR_KSEG1_ADDR; 134 BCSR *bcsr = (BCSR *)BCSR_KSEG1_ADDR;
142 int p; 135 int p;
@@ -147,23 +140,23 @@ board_au1200fb_panel(void)
147 return p; 140 return p;
148} 141}
149 142
150int 143int board_au1200fb_panel_init(void)
151board_au1200fb_panel_init(void)
152{ 144{
153 /* Apply power */ 145 /* Apply power */
154 BCSR *bcsr = (BCSR *)BCSR_KSEG1_ADDR; 146 BCSR *bcsr = (BCSR *)BCSR_KSEG1_ADDR;
155 bcsr->board |= (BCSR_BOARD_LCDVEE | BCSR_BOARD_LCDVDD | BCSR_BOARD_LCDBL); 147
156 /*printk("board_au1200fb_panel_init()\n"); */ 148 bcsr->board |= BCSR_BOARD_LCDVEE | BCSR_BOARD_LCDVDD | BCSR_BOARD_LCDBL;
149 /* printk(KERN_DEBUG "board_au1200fb_panel_init()\n"); */
157 return 0; 150 return 0;
158} 151}
159 152
160int 153int board_au1200fb_panel_shutdown(void)
161board_au1200fb_panel_shutdown(void)
162{ 154{
163 /* Remove power */ 155 /* Remove power */
164 BCSR *bcsr = (BCSR *)BCSR_KSEG1_ADDR; 156 BCSR *bcsr = (BCSR *)BCSR_KSEG1_ADDR;
165 bcsr->board &= ~(BCSR_BOARD_LCDVEE | BCSR_BOARD_LCDVDD | BCSR_BOARD_LCDBL); 157
166 /*printk("board_au1200fb_panel_shutdown()\n"); */ 158 bcsr->board &= ~(BCSR_BOARD_LCDVEE | BCSR_BOARD_LCDVDD |
159 BCSR_BOARD_LCDBL);
160 /* printk(KERN_DEBUG "board_au1200fb_panel_shutdown()\n"); */
167 return 0; 161 return 0;
168} 162}
169
diff --git a/arch/mips/au1000/pb1200/init.c b/arch/mips/au1000/pb1200/init.c
index 72af5500660b..09fd63b86062 100644
--- a/arch/mips/au1000/pb1200/init.c
+++ b/arch/mips/au1000/pb1200/init.c
@@ -3,9 +3,8 @@
3 * BRIEF MODULE DESCRIPTION 3 * BRIEF MODULE DESCRIPTION
4 * PB1200 board setup 4 * PB1200 board setup
5 * 5 *
6 * Copyright 2001 MontaVista Software Inc. 6 * Copyright 2001, 2008 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc. 7 * Author: MontaVista Software, Inc. <source@mvista.com>
8 * ppopov@mvista.com or source@mvista.com
9 * 8 *
10 * This program is free software; you can redistribute it and/or modify it 9 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the 10 * under the terms of the GNU General Public License as published by the
@@ -45,16 +44,15 @@ void __init prom_init(void)
45 unsigned char *memsize_str; 44 unsigned char *memsize_str;
46 unsigned long memsize; 45 unsigned long memsize;
47 46
48 prom_argc = (int) fw_arg0; 47 prom_argc = (int)fw_arg0;
49 prom_argv = (char **) fw_arg1; 48 prom_argv = (char **)fw_arg1;
50 prom_envp = (char **) fw_arg2; 49 prom_envp = (char **)fw_arg2;
51 50
52 prom_init_cmdline(); 51 prom_init_cmdline();
53 memsize_str = prom_getenv("memsize"); 52 memsize_str = prom_getenv("memsize");
54 if (!memsize_str) { 53 if (!memsize_str)
55 memsize = 0x08000000; 54 memsize = 0x08000000;
56 } else { 55 else
57 memsize = simple_strtol(memsize_str, NULL, 0); 56 memsize = strict_strtol(memsize_str, 0, NULL);
58 }
59 add_memory_region(0, memsize, BOOT_MEM_RAM); 57 add_memory_region(0, memsize, BOOT_MEM_RAM);
60} 58}
diff --git a/arch/mips/au1000/pb1200/irqmap.c b/arch/mips/au1000/pb1200/irqmap.c
index e61eb8e0b76b..2a505ad8715b 100644
--- a/arch/mips/au1000/pb1200/irqmap.c
+++ b/arch/mips/au1000/pb1200/irqmap.c
@@ -39,25 +39,25 @@
39#endif 39#endif
40 40
41struct au1xxx_irqmap __initdata au1xxx_irq_map[] = { 41struct au1xxx_irqmap __initdata au1xxx_irq_map[] = {
42 { AU1000_GPIO_7, INTC_INT_LOW_LEVEL, 0 }, // This is exteranl interrupt cascade 42 /* This is external interrupt cascade */
43 { AU1000_GPIO_7, INTC_INT_LOW_LEVEL, 0 },
43}; 44};
44 45
45int __initdata au1xxx_nr_irqs = ARRAY_SIZE(au1xxx_irq_map); 46int __initdata au1xxx_nr_irqs = ARRAY_SIZE(au1xxx_irq_map);
46 47
47/* 48/*
48 * Support for External interrupts on the PbAu1200 Development platform. 49 * Support for External interrupts on the Pb1200 Development platform.
49 */ 50 */
50static volatile int pb1200_cascade_en=0; 51static volatile int pb1200_cascade_en;
51 52
52irqreturn_t pb1200_cascade_handler( int irq, void *dev_id) 53irqreturn_t pb1200_cascade_handler(int irq, void *dev_id)
53{ 54{
54 unsigned short bisr = bcsr->int_status; 55 unsigned short bisr = bcsr->int_status;
55 int extirq_nr = 0; 56 int extirq_nr = 0;
56 57
57 /* Clear all the edge interrupts. This has no effect on level */ 58 /* Clear all the edge interrupts. This has no effect on level. */
58 bcsr->int_status = bisr; 59 bcsr->int_status = bisr;
59 for( ; bisr; bisr &= (bisr-1) ) 60 for ( ; bisr; bisr &= bisr - 1) {
60 {
61 extirq_nr = PB1200_INT_BEGIN + __ffs(bisr); 61 extirq_nr = PB1200_INT_BEGIN + __ffs(bisr);
62 /* Ack and dispatch IRQ */ 62 /* Ack and dispatch IRQ */
63 do_IRQ(extirq_nr); 63 do_IRQ(extirq_nr);
@@ -68,26 +68,20 @@ irqreturn_t pb1200_cascade_handler( int irq, void *dev_id)
68 68
69inline void pb1200_enable_irq(unsigned int irq_nr) 69inline void pb1200_enable_irq(unsigned int irq_nr)
70{ 70{
71 bcsr->intset_mask = 1<<(irq_nr - PB1200_INT_BEGIN); 71 bcsr->intset_mask = 1 << (irq_nr - PB1200_INT_BEGIN);
72 bcsr->intset = 1<<(irq_nr - PB1200_INT_BEGIN); 72 bcsr->intset = 1 << (irq_nr - PB1200_INT_BEGIN);
73} 73}
74 74
75inline void pb1200_disable_irq(unsigned int irq_nr) 75inline void pb1200_disable_irq(unsigned int irq_nr)
76{ 76{
77 bcsr->intclr_mask = 1<<(irq_nr - PB1200_INT_BEGIN); 77 bcsr->intclr_mask = 1 << (irq_nr - PB1200_INT_BEGIN);
78 bcsr->intclr = 1<<(irq_nr - PB1200_INT_BEGIN); 78 bcsr->intclr = 1 << (irq_nr - PB1200_INT_BEGIN);
79} 79}
80 80
81static unsigned int pb1200_setup_cascade(void) 81static unsigned int pb1200_setup_cascade(void)
82{ 82{
83 int err; 83 return request_irq(AU1000_GPIO_7, &pb1200_cascade_handler,
84 84 0, "Pb1200 Cascade", &pb1200_cascade_handler);
85 err = request_irq(AU1000_GPIO_7, &pb1200_cascade_handler,
86 0, "Pb1200 Cascade", &pb1200_cascade_handler);
87 if (err)
88 return err;
89
90 return 0;
91} 85}
92 86
93static unsigned int pb1200_startup_irq(unsigned int irq) 87static unsigned int pb1200_startup_irq(unsigned int irq)
@@ -132,23 +126,23 @@ void _board_init_irq(void)
132 unsigned int irq; 126 unsigned int irq;
133 127
134#ifdef CONFIG_MIPS_PB1200 128#ifdef CONFIG_MIPS_PB1200
135 /* We have a problem with CPLD rev3. Enable a workaround */ 129 /* We have a problem with CPLD rev 3. */
136 if (((bcsr->whoami & BCSR_WHOAMI_CPLD) >> 4) <= 3) { 130 if (((bcsr->whoami & BCSR_WHOAMI_CPLD) >> 4) <= 3) {
137 printk("\nWARNING!!!\n"); 131 printk(KERN_ERR "WARNING!!!\n");
138 printk("\nWARNING!!!\n"); 132 printk(KERN_ERR "WARNING!!!\n");
139 printk("\nWARNING!!!\n"); 133 printk(KERN_ERR "WARNING!!!\n");
140 printk("\nWARNING!!!\n"); 134 printk(KERN_ERR "WARNING!!!\n");
141 printk("\nWARNING!!!\n"); 135 printk(KERN_ERR "WARNING!!!\n");
142 printk("\nWARNING!!!\n"); 136 printk(KERN_ERR "WARNING!!!\n");
143 printk("Pb1200 must be at CPLD rev4. Please have Pb1200\n"); 137 printk(KERN_ERR "Pb1200 must be at CPLD rev 4. Please have Pb1200\n");
144 printk("updated to latest revision. This software will not\n"); 138 printk(KERN_ERR "updated to latest revision. This software will\n");
145 printk("work on anything less than CPLD rev4\n"); 139 printk(KERN_ERR "not work on anything less than CPLD rev 4.\n");
146 printk("\nWARNING!!!\n"); 140 printk(KERN_ERR "WARNING!!!\n");
147 printk("\nWARNING!!!\n"); 141 printk(KERN_ERR "WARNING!!!\n");
148 printk("\nWARNING!!!\n"); 142 printk(KERN_ERR "WARNING!!!\n");
149 printk("\nWARNING!!!\n"); 143 printk(KERN_ERR "WARNING!!!\n");
150 printk("\nWARNING!!!\n"); 144 printk(KERN_ERR "WARNING!!!\n");
151 printk("\nWARNING!!!\n"); 145 printk(KERN_ERR "WARNING!!!\n");
152 panic("Game over. Your score is 0."); 146 panic("Game over. Your score is 0.");
153 } 147 }
154#endif 148#endif
@@ -161,6 +155,6 @@ void _board_init_irq(void)
161 155
162 /* 156 /*
163 * GPIO_7 can not be hooked here, so it is hooked upon first 157 * GPIO_7 can not be hooked here, so it is hooked upon first
164 * request of any source attached to the cascade 158 * request of any source attached to the cascade.
165 */ 159 */
166} 160}
diff --git a/arch/mips/au1000/pb1500/Makefile b/arch/mips/au1000/pb1500/Makefile
index 97a730813cd3..602f38df20bb 100644
--- a/arch/mips/au1000/pb1500/Makefile
+++ b/arch/mips/au1000/pb1500/Makefile
@@ -1,8 +1,8 @@
1# 1#
2# Copyright 2000,2001 MontaVista Software Inc. 2# Copyright 2000, 2001, 2008 MontaVista Software Inc.
3# Author: MontaVista Software, Inc. 3# Author: MontaVista Software, Inc. <source@mvista.com>
4# ppopov@mvista.com or source@mvista.com
5# 4#
6# Makefile for the Alchemy Semiconductor Pb1500 board. 5# Makefile for the Alchemy Semiconductor Pb1500 board.
6#
7 7
8lib-y := init.o board_setup.o irqmap.o 8lib-y := init.o board_setup.o irqmap.o
diff --git a/arch/mips/au1000/pb1500/board_setup.c b/arch/mips/au1000/pb1500/board_setup.c
index 24c652e8ec4b..035771c6e5b8 100644
--- a/arch/mips/au1000/pb1500/board_setup.c
+++ b/arch/mips/au1000/pb1500/board_setup.c
@@ -1,7 +1,6 @@
1/* 1/*
2 * Copyright 2000 MontaVista Software Inc. 2 * Copyright 2000, 2008 MontaVista Software Inc.
3 * Author: MontaVista Software, Inc. 3 * Author: MontaVista Software, Inc. <source@mvista.com>
4 * ppopov@mvista.com or source@mvista.com
5 * 4 *
6 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the 6 * under the terms of the GNU General Public License as published by the
@@ -32,8 +31,8 @@
32 31
33void board_reset(void) 32void board_reset(void)
34{ 33{
35 /* Hit BCSR.SYSTEM_CONTROL[SW_RST] */ 34 /* Hit BCSR.RST_VDDI[SOFT_RESET] */
36 au_writel(0x00000000, 0xAE00001C); 35 au_writel(0x00000000, PB1500_RST_VDDI);
37} 36}
38 37
39void __init board_setup(void) 38void __init board_setup(void)
@@ -42,7 +41,7 @@ void __init board_setup(void)
42 u32 sys_freqctrl, sys_clksrc; 41 u32 sys_freqctrl, sys_clksrc;
43 42
44 sys_clksrc = sys_freqctrl = pin_func = 0; 43 sys_clksrc = sys_freqctrl = pin_func = 0;
45 // set AUX clock to 12MHz * 8 = 96 MHz 44 /* Set AUX clock to 12 MHz * 8 = 96 MHz */
46 au_writel(8, SYS_AUXPLL); 45 au_writel(8, SYS_AUXPLL);
47 au_writel(0, SYS_PINSTATERD); 46 au_writel(0, SYS_PINSTATERD);
48 udelay(100); 47 udelay(100);
@@ -51,51 +50,48 @@ void __init board_setup(void)
51 50
52 /* GPIO201 is input for PCMCIA card detect */ 51 /* GPIO201 is input for PCMCIA card detect */
53 /* GPIO203 is input for PCMCIA interrupt request */ 52 /* GPIO203 is input for PCMCIA interrupt request */
54 au_writel(au_readl(GPIO2_DIR) & (u32)(~((1<<1)|(1<<3))), GPIO2_DIR); 53 au_writel(au_readl(GPIO2_DIR) & ~((1 << 1) | (1 << 3)), GPIO2_DIR);
55 54
56 /* zero and disable FREQ2 */ 55 /* Zero and disable FREQ2 */
57 sys_freqctrl = au_readl(SYS_FREQCTRL0); 56 sys_freqctrl = au_readl(SYS_FREQCTRL0);
58 sys_freqctrl &= ~0xFFF00000; 57 sys_freqctrl &= ~0xFFF00000;
59 au_writel(sys_freqctrl, SYS_FREQCTRL0); 58 au_writel(sys_freqctrl, SYS_FREQCTRL0);
60 59
61 /* zero and disable USBH/USBD clocks */ 60 /* zero and disable USBH/USBD clocks */
62 sys_clksrc = au_readl(SYS_CLKSRC); 61 sys_clksrc = au_readl(SYS_CLKSRC);
63 sys_clksrc &= ~0x00007FE0; 62 sys_clksrc &= ~(SYS_CS_CUD | SYS_CS_DUD | SYS_CS_MUD_MASK |
63 SYS_CS_CUH | SYS_CS_DUH | SYS_CS_MUH_MASK);
64 au_writel(sys_clksrc, SYS_CLKSRC); 64 au_writel(sys_clksrc, SYS_CLKSRC);
65 65
66 sys_freqctrl = au_readl(SYS_FREQCTRL0); 66 sys_freqctrl = au_readl(SYS_FREQCTRL0);
67 sys_freqctrl &= ~0xFFF00000; 67 sys_freqctrl &= ~0xFFF00000;
68 68
69 sys_clksrc = au_readl(SYS_CLKSRC); 69 sys_clksrc = au_readl(SYS_CLKSRC);
70 sys_clksrc &= ~0x00007FE0; 70 sys_clksrc &= ~(SYS_CS_CUD | SYS_CS_DUD | SYS_CS_MUD_MASK |
71 SYS_CS_CUH | SYS_CS_DUH | SYS_CS_MUH_MASK);
71 72
72 // FREQ2 = aux/2 = 48 MHz 73 /* FREQ2 = aux/2 = 48 MHz */
73 sys_freqctrl |= ((0<<22) | (1<<21) | (1<<20)); 74 sys_freqctrl |= (0 << SYS_FC_FRDIV2_BIT) | SYS_FC_FE2 | SYS_FC_FS2;
74 au_writel(sys_freqctrl, SYS_FREQCTRL0); 75 au_writel(sys_freqctrl, SYS_FREQCTRL0);
75 76
76 /* 77 /*
77 * Route 48MHz FREQ2 into USB Host and/or Device 78 * Route 48MHz FREQ2 into USB Host and/or Device
78 */ 79 */
79#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) 80 sys_clksrc |= SYS_CS_MUX_FQ2 << SYS_CS_MUH_BIT;
80 sys_clksrc |= ((4<<12) | (0<<11) | (0<<10));
81#endif
82 au_writel(sys_clksrc, SYS_CLKSRC); 81 au_writel(sys_clksrc, SYS_CLKSRC);
83 82
84 83 pin_func = au_readl(SYS_PINFUNC) & ~SYS_PF_USB;
85 pin_func = au_readl(SYS_PINFUNC) & (u32)(~0x8000); 84 /* 2nd USB port is USB host */
86 // 2nd USB port is USB host 85 pin_func |= SYS_PF_USB;
87 pin_func |= 0x8000;
88 au_writel(pin_func, SYS_PINFUNC); 86 au_writel(pin_func, SYS_PINFUNC);
89#endif /* defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) */ 87#endif /* defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) */
90 88
91
92
93#ifdef CONFIG_PCI 89#ifdef CONFIG_PCI
94 // Setup PCI bus controller 90 /* Setup PCI bus controller */
95 au_writel(0, Au1500_PCI_CMEM); 91 au_writel(0, Au1500_PCI_CMEM);
96 au_writel(0x00003fff, Au1500_CFG_BASE); 92 au_writel(0x00003fff, Au1500_CFG_BASE);
97#if defined(__MIPSEB__) 93#if defined(__MIPSEB__)
98 au_writel(0xf | (2<<6) | (1<<4), Au1500_PCI_CFG); 94 au_writel(0xf | (2 << 6) | (1 << 4), Au1500_PCI_CFG);
99#else 95#else
100 au_writel(0xf, Au1500_PCI_CFG); 96 au_writel(0xf, Au1500_PCI_CFG);
101#endif 97#endif
@@ -112,11 +108,11 @@ void __init board_setup(void)
112 108
113 /* Enable the RTC if not already enabled */ 109 /* Enable the RTC if not already enabled */
114 if (!(au_readl(0xac000028) & 0x20)) { 110 if (!(au_readl(0xac000028) & 0x20)) {
115 printk("enabling clock ...\n"); 111 printk(KERN_INFO "enabling clock ...\n");
116 au_writel((au_readl(0xac000028) | 0x20), 0xac000028); 112 au_writel((au_readl(0xac000028) | 0x20), 0xac000028);
117 } 113 }
118 /* Put the clock in BCD mode */ 114 /* Put the clock in BCD mode */
119 if (au_readl(0xac00002C) & 0x4) { /* reg B */ 115 if (au_readl(0xac00002c) & 0x4) { /* reg B */
120 au_writel(au_readl(0xac00002c) & ~0x4, 0xac00002c); 116 au_writel(au_readl(0xac00002c) & ~0x4, 0xac00002c);
121 au_sync(); 117 au_sync();
122 } 118 }
diff --git a/arch/mips/au1000/pb1500/init.c b/arch/mips/au1000/pb1500/init.c
index 488507c07db9..49f51e165863 100644
--- a/arch/mips/au1000/pb1500/init.c
+++ b/arch/mips/au1000/pb1500/init.c
@@ -1,11 +1,10 @@
1/* 1/*
2 * 2 *
3 * BRIEF MODULE DESCRIPTION 3 * BRIEF MODULE DESCRIPTION
4 * PB1500 board setup 4 * Pb1500 board setup
5 * 5 *
6 * Copyright 2001 MontaVista Software Inc. 6 * Copyright 2001, 2008 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc. 7 * Author: MontaVista Software, Inc. <source@mvista.com>
8 * ppopov@mvista.com or source@mvista.com
9 * 8 *
10 * This program is free software; you can redistribute it and/or modify it 9 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the 10 * under the terms of the GNU General Public License as published by the
@@ -45,16 +44,15 @@ void __init prom_init(void)
45 unsigned char *memsize_str; 44 unsigned char *memsize_str;
46 unsigned long memsize; 45 unsigned long memsize;
47 46
48 prom_argc = (int) fw_arg0; 47 prom_argc = (int)fw_arg0;
49 prom_argv = (char **) fw_arg1; 48 prom_argv = (char **)fw_arg1;
50 prom_envp = (char **) fw_arg2; 49 prom_envp = (char **)fw_arg2;
51 50
52 prom_init_cmdline(); 51 prom_init_cmdline();
53 memsize_str = prom_getenv("memsize"); 52 memsize_str = prom_getenv("memsize");
54 if (!memsize_str) { 53 if (!memsize_str)
55 memsize = 0x04000000; 54 memsize = 0x04000000;
56 } else { 55 else
57 memsize = simple_strtol(memsize_str, NULL, 0); 56 memsize = strict_strtol(memsize_str, 0, NULL);
58 }
59 add_memory_region(0, memsize, BOOT_MEM_RAM); 57 add_memory_region(0, memsize, BOOT_MEM_RAM);
60} 58}
diff --git a/arch/mips/au1000/pb1500/irqmap.c b/arch/mips/au1000/pb1500/irqmap.c
index 4817ab44d07f..39c4682766a8 100644
--- a/arch/mips/au1000/pb1500/irqmap.c
+++ b/arch/mips/au1000/pb1500/irqmap.c
@@ -31,12 +31,12 @@
31#include <asm/mach-au1x00/au1000.h> 31#include <asm/mach-au1x00/au1000.h>
32 32
33char irq_tab_alchemy[][5] __initdata = { 33char irq_tab_alchemy[][5] __initdata = {
34 [12] = { -1, INTA, INTX, INTX, INTX}, /* IDSEL 12 - HPT370 */ 34 [12] = { -1, INTA, INTX, INTX, INTX }, /* IDSEL 12 - HPT370 */
35 [13] = { -1, INTA, INTB, INTC, INTD}, /* IDSEL 13 - PCI slot */ 35 [13] = { -1, INTA, INTB, INTC, INTD }, /* IDSEL 13 - PCI slot */
36}; 36};
37 37
38struct au1xxx_irqmap __initdata au1xxx_irq_map[] = { 38struct au1xxx_irqmap __initdata au1xxx_irq_map[] = {
39 { AU1500_GPIO_204, INTC_INT_HIGH_LEVEL, 0}, 39 { AU1500_GPIO_204, INTC_INT_HIGH_LEVEL, 0 },
40 { AU1500_GPIO_201, INTC_INT_LOW_LEVEL, 0 }, 40 { AU1500_GPIO_201, INTC_INT_LOW_LEVEL, 0 },
41 { AU1500_GPIO_202, INTC_INT_LOW_LEVEL, 0 }, 41 { AU1500_GPIO_202, INTC_INT_LOW_LEVEL, 0 },
42 { AU1500_GPIO_203, INTC_INT_LOW_LEVEL, 0 }, 42 { AU1500_GPIO_203, INTC_INT_LOW_LEVEL, 0 },
diff --git a/arch/mips/au1000/pb1550/Makefile b/arch/mips/au1000/pb1550/Makefile
index aa35bc6cb8cf..7d8beca87fa5 100644
--- a/arch/mips/au1000/pb1550/Makefile
+++ b/arch/mips/au1000/pb1550/Makefile
@@ -1,9 +1,8 @@
1# 1#
2# Copyright 2000 MontaVista Software Inc. 2# Copyright 2000, 2008 MontaVista Software Inc.
3# Author: MontaVista Software, Inc. 3# Author: MontaVista Software, Inc. <source@mvista.com>
4# ppopov@mvista.com or source@mvista.com
5# 4#
6# Makefile for the Alchemy Semiconductor PB1000 board. 5# Makefile for the Alchemy Semiconductor Pb1550 board.
7# 6#
8 7
9lib-y := init.o board_setup.o irqmap.o 8lib-y := init.o board_setup.o irqmap.o
diff --git a/arch/mips/au1000/pb1550/board_setup.c b/arch/mips/au1000/pb1550/board_setup.c
index 45d60872b565..0ed76b64b6ab 100644
--- a/arch/mips/au1000/pb1550/board_setup.c
+++ b/arch/mips/au1000/pb1550/board_setup.c
@@ -3,9 +3,8 @@
3 * BRIEF MODULE DESCRIPTION 3 * BRIEF MODULE DESCRIPTION
4 * Alchemy Pb1550 board setup. 4 * Alchemy Pb1550 board setup.
5 * 5 *
6 * Copyright 2000 MontaVista Software Inc. 6 * Copyright 2000, 2008 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc. 7 * Author: MontaVista Software, Inc. <source@mvista.com>
8 * ppopov@mvista.com or source@mvista.com
9 * 8 *
10 * This program is free software; you can redistribute it and/or modify it 9 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the 10 * under the terms of the GNU General Public License as published by the
@@ -35,15 +34,16 @@
35 34
36void board_reset(void) 35void board_reset(void)
37{ 36{
38 /* Hit BCSR.SYSTEM_CONTROL[SW_RST] */ 37 /* Hit BCSR.SYSTEM[RESET] */
39 au_writew(au_readw(0xAF00001C) & ~(1<<15), 0xAF00001C); 38 au_writew(au_readw(0xAF00001C) & ~BCSR_SYSTEM_RESET, 0xAF00001C);
40} 39}
41 40
42void __init board_setup(void) 41void __init board_setup(void)
43{ 42{
44 u32 pin_func; 43 u32 pin_func;
45 44
46 /* Enable PSC1 SYNC for AC97. Normaly done in audio driver, 45 /*
46 * Enable PSC1 SYNC for AC'97. Normaly done in audio driver,
47 * but it is board specific code, so put it here. 47 * but it is board specific code, so put it here.
48 */ 48 */
49 pin_func = au_readl(SYS_PINFUNC); 49 pin_func = au_readl(SYS_PINFUNC);
@@ -51,8 +51,8 @@ void __init board_setup(void)
51 pin_func |= SYS_PF_MUST_BE_SET | SYS_PF_PSC1_S1; 51 pin_func |= SYS_PF_MUST_BE_SET | SYS_PF_PSC1_S1;
52 au_writel(pin_func, SYS_PINFUNC); 52 au_writel(pin_func, SYS_PINFUNC);
53 53
54 au_writel(0, (u32)bcsr|0x10); /* turn off pcmcia power */ 54 au_writel(0, (u32)bcsr | 0x10); /* turn off PCMCIA power */
55 au_sync(); 55 au_sync();
56 56
57 printk("AMD Alchemy Pb1550 Board\n"); 57 printk(KERN_INFO "AMD Alchemy Pb1550 Board\n");
58} 58}
diff --git a/arch/mips/au1000/pb1550/init.c b/arch/mips/au1000/pb1550/init.c
index f6b2fc587980..1b5f58434bb7 100644
--- a/arch/mips/au1000/pb1550/init.c
+++ b/arch/mips/au1000/pb1550/init.c
@@ -1,11 +1,10 @@
1/* 1/*
2 * 2 *
3 * BRIEF MODULE DESCRIPTION 3 * BRIEF MODULE DESCRIPTION
4 * PB1550 board setup 4 * Pb1550 board setup
5 * 5 *
6 * Copyright 2001 MontaVista Software Inc. 6 * Copyright 2001, 2008 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc. 7 * Author: MontaVista Software, Inc. <source@mvista.com>
8 * ppopov@mvista.com or source@mvista.com
9 * 8 *
10 * This program is free software; you can redistribute it and/or modify it 9 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the 10 * under the terms of the GNU General Public License as published by the
@@ -45,16 +44,15 @@ void __init prom_init(void)
45 unsigned char *memsize_str; 44 unsigned char *memsize_str;
46 unsigned long memsize; 45 unsigned long memsize;
47 46
48 prom_argc = (int) fw_arg0; 47 prom_argc = (int)fw_arg0;
49 prom_argv = (char **) fw_arg1; 48 prom_argv = (char **)fw_arg1;
50 prom_envp = (char **) fw_arg2; 49 prom_envp = (char **)fw_arg2;
51 50
52 prom_init_cmdline(); 51 prom_init_cmdline();
53 memsize_str = prom_getenv("memsize"); 52 memsize_str = prom_getenv("memsize");
54 if (!memsize_str) { 53 if (!memsize_str)
55 memsize = 0x08000000; 54 memsize = 0x08000000;
56 } else { 55 else
57 memsize = simple_strtol(memsize_str, NULL, 0); 56 memsize = strict_strtol(memsize_str, 0, NULL);
58 }
59 add_memory_region(0, memsize, BOOT_MEM_RAM); 57 add_memory_region(0, memsize, BOOT_MEM_RAM);
60} 58}
diff --git a/arch/mips/au1000/pb1550/irqmap.c b/arch/mips/au1000/pb1550/irqmap.c
index e1dac37af08a..a02a4d1fa899 100644
--- a/arch/mips/au1000/pb1550/irqmap.c
+++ b/arch/mips/au1000/pb1550/irqmap.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * BRIEF MODULE DESCRIPTION 2 * BRIEF MODULE DESCRIPTION
3 * Au1xxx irq map table 3 * Au1xx0 IRQ map table
4 * 4 *
5 * Copyright 2003 Embedded Edge, LLC 5 * Copyright 2003 Embedded Edge, LLC
6 * dan@embeddededge.com 6 * dan@embeddededge.com
@@ -31,8 +31,8 @@
31#include <asm/mach-au1x00/au1000.h> 31#include <asm/mach-au1x00/au1000.h>
32 32
33char irq_tab_alchemy[][5] __initdata = { 33char irq_tab_alchemy[][5] __initdata = {
34 [12] = { -1, INTB, INTC, INTD, INTA}, /* IDSEL 12 - PCI slot 2 (left) */ 34 [12] = { -1, INTB, INTC, INTD, INTA }, /* IDSEL 12 - PCI slot 2 (left) */
35 [13] = { -1, INTA, INTB, INTC, INTD}, /* IDSEL 13 - PCI slot 1 (right) */ 35 [13] = { -1, INTA, INTB, INTC, INTD }, /* IDSEL 13 - PCI slot 1 (right) */
36}; 36};
37 37
38struct au1xxx_irqmap __initdata au1xxx_irq_map[] = { 38struct au1xxx_irqmap __initdata au1xxx_irq_map[] = {
diff --git a/arch/mips/au1000/xxs1500/Makefile b/arch/mips/au1000/xxs1500/Makefile
index 44d7f7056ae7..db3c526f64d8 100644
--- a/arch/mips/au1000/xxs1500/Makefile
+++ b/arch/mips/au1000/xxs1500/Makefile
@@ -1,7 +1,6 @@
1# 1#
2# Copyright 2003 MontaVista Software Inc. 2# Copyright 2003 MontaVista Software Inc.
3# Author: MontaVista Software, Inc. 3# Author: MontaVista Software, Inc. <source@mvista.com>
4# ppopov@mvista.com or source@mvista.com
5# 4#
6# Makefile for MyCable XXS1500 board. 5# Makefile for MyCable XXS1500 board.
7# 6#
diff --git a/arch/mips/au1000/xxs1500/board_setup.c b/arch/mips/au1000/xxs1500/board_setup.c
index 79d1798621bf..4c587acac5c3 100644
--- a/arch/mips/au1000/xxs1500/board_setup.c
+++ b/arch/mips/au1000/xxs1500/board_setup.c
@@ -1,7 +1,6 @@
1/* 1/*
2 * Copyright 2000-2003 MontaVista Software Inc. 2 * Copyright 2000-2003, 2008 MontaVista Software Inc.
3 * Author: MontaVista Software, Inc. 3 * Author: MontaVista Software, Inc. <source@mvista.com>
4 * ppopov@mvista.com or source@mvista.com
5 * 4 *
6 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the 6 * under the terms of the GNU General Public License as published by the
@@ -39,40 +38,40 @@ void __init board_setup(void)
39{ 38{
40 u32 pin_func; 39 u32 pin_func;
41 40
42 // set multiple use pins (UART3/GPIO) to UART (it's used as UART too) 41 /* Set multiple use pins (UART3/GPIO) to UART (it's used as UART too) */
43 pin_func = au_readl(SYS_PINFUNC) & (u32)(~SYS_PF_UR3); 42 pin_func = au_readl(SYS_PINFUNC) & ~SYS_PF_UR3;
44 pin_func |= SYS_PF_UR3; 43 pin_func |= SYS_PF_UR3;
45 au_writel(pin_func, SYS_PINFUNC); 44 au_writel(pin_func, SYS_PINFUNC);
46 45
47 // enable UART 46 /* Enable UART */
48 au_writel(0x01, UART3_ADDR+UART_MOD_CNTRL); // clock enable (CE) 47 au_writel(0x01, UART3_ADDR + UART_MOD_CNTRL); /* clock enable (CE) */
49 mdelay(10); 48 mdelay(10);
50 au_writel(0x03, UART3_ADDR+UART_MOD_CNTRL); // CE and "enable" 49 au_writel(0x03, UART3_ADDR + UART_MOD_CNTRL); /* CE and "enable" */
51 mdelay(10); 50 mdelay(10);
52 51
53 // enable DTR = USB power up 52 /* Enable DTR = USB power up */
54 au_writel(0x01, UART3_ADDR+UART_MCR); //? UART_MCR_DTR is 0x01??? 53 au_writel(0x01, UART3_ADDR + UART_MCR); /* UART_MCR_DTR is 0x01??? */
55 54
56#ifdef CONFIG_PCMCIA_XXS1500 55#ifdef CONFIG_PCMCIA_XXS1500
57 /* setup pcmcia signals */ 56 /* Setup PCMCIA signals */
58 au_writel(0, SYS_PININPUTEN); 57 au_writel(0, SYS_PININPUTEN);
59 58
60 /* gpio 0, 1, and 4 are inputs */ 59 /* GPIO 0, 1, and 4 are inputs */
61 au_writel(1 | (1<<1) | (1<<4), SYS_TRIOUTCLR); 60 au_writel(1 | (1 << 1) | (1 << 4), SYS_TRIOUTCLR);
62 61
63 /* enable GPIO2 if not already enabled */ 62 /* Enable GPIO2 if not already enabled */
64 au_writel(1, GPIO2_ENABLE); 63 au_writel(1, GPIO2_ENABLE);
65 /* gpio2 208/9/10/11 are inputs */ 64 /* GPIO2 208/9/10/11 are inputs */
66 au_writel((1<<8) | (1<<9) | (1<<10) | (1<<11), GPIO2_DIR); 65 au_writel((1 << 8) | (1 << 9) | (1 << 10) | (1 << 11), GPIO2_DIR);
67 66
68 /* turn off power */ 67 /* Turn off power */
69 au_writel((au_readl(GPIO2_PINSTATE) & ~(1<<14))|(1<<30), GPIO2_OUTPUT); 68 au_writel((au_readl(GPIO2_PINSTATE) & ~(1 << 14)) | (1 << 30),
69 GPIO2_OUTPUT);
70#endif 70#endif
71 71
72
73#ifdef CONFIG_PCI 72#ifdef CONFIG_PCI
74#if defined(__MIPSEB__) 73#if defined(__MIPSEB__)
75 au_writel(0xf | (2<<6) | (1<<4), Au1500_PCI_CFG); 74 au_writel(0xf | (2 << 6) | (1 << 4), Au1500_PCI_CFG);
76#else 75#else
77 au_writel(0xf, Au1500_PCI_CFG); 76 au_writel(0xf, Au1500_PCI_CFG);
78#endif 77#endif
diff --git a/arch/mips/au1000/xxs1500/init.c b/arch/mips/au1000/xxs1500/init.c
index 24fc6e132dc0..b849bf501c04 100644
--- a/arch/mips/au1000/xxs1500/init.c
+++ b/arch/mips/au1000/xxs1500/init.c
@@ -2,9 +2,8 @@
2 * BRIEF MODULE DESCRIPTION 2 * BRIEF MODULE DESCRIPTION
3 * XXS1500 board setup 3 * XXS1500 board setup
4 * 4 *
5 * Copyright 2003 MontaVista Software Inc. 5 * Copyright 2003, 2008 MontaVista Software Inc.
6 * Author: MontaVista Software, Inc. 6 * Author: MontaVista Software, Inc. <source@mvista.com>
7 * ppopov@mvista.com or source@mvista.com
8 * 7 *
9 * This program is free software; you can redistribute it and/or modify it 8 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the 9 * under the terms of the GNU General Public License as published by the
@@ -45,8 +44,8 @@ void __init prom_init(void)
45 unsigned long memsize; 44 unsigned long memsize;
46 45
47 prom_argc = fw_arg0; 46 prom_argc = fw_arg0;
48 prom_argv = (char **) fw_arg1; 47 prom_argv = (char **)fw_arg1;
49 prom_envp = (char **) fw_arg2; 48 prom_envp = (char **)fw_arg2;
50 49
51 prom_init_cmdline(); 50 prom_init_cmdline();
52 51
@@ -54,6 +53,6 @@ void __init prom_init(void)
54 if (!memsize_str) 53 if (!memsize_str)
55 memsize = 0x04000000; 54 memsize = 0x04000000;
56 else 55 else
57 memsize = simple_strtol(memsize_str, NULL, 0); 56 memsize = strict_strtol(memsize_str, 0, NULL);
58 add_memory_region(0, memsize, BOOT_MEM_RAM); 57 add_memory_region(0, memsize, BOOT_MEM_RAM);
59} 58}
diff --git a/arch/mips/au1000/xxs1500/irqmap.c b/arch/mips/au1000/xxs1500/irqmap.c
index dd6e3d1eb4d4..edf06ed11870 100644
--- a/arch/mips/au1000/xxs1500/irqmap.c
+++ b/arch/mips/au1000/xxs1500/irqmap.c
@@ -31,7 +31,7 @@
31#include <asm/mach-au1x00/au1000.h> 31#include <asm/mach-au1x00/au1000.h>
32 32
33struct au1xxx_irqmap __initdata au1xxx_irq_map[] = { 33struct au1xxx_irqmap __initdata au1xxx_irq_map[] = {
34 { AU1500_GPIO_204, INTC_INT_HIGH_LEVEL, 0}, 34 { AU1500_GPIO_204, INTC_INT_HIGH_LEVEL, 0 },
35 { AU1500_GPIO_201, INTC_INT_LOW_LEVEL, 0 }, 35 { AU1500_GPIO_201, INTC_INT_LOW_LEVEL, 0 },
36 { AU1500_GPIO_202, INTC_INT_LOW_LEVEL, 0 }, 36 { AU1500_GPIO_202, INTC_INT_LOW_LEVEL, 0 },
37 { AU1500_GPIO_203, INTC_INT_LOW_LEVEL, 0 }, 37 { AU1500_GPIO_203, INTC_INT_LOW_LEVEL, 0 },
diff --git a/arch/mips/emma2rh/markeins/setup.c b/arch/mips/emma2rh/markeins/setup.c
index 82f9e9013e70..62bfb455d1b1 100644
--- a/arch/mips/emma2rh/markeins/setup.c
+++ b/arch/mips/emma2rh/markeins/setup.c
@@ -76,7 +76,9 @@ static void markeins_machine_power_off(void)
76 while (1) ; 76 while (1) ;
77} 77}
78 78
79static unsigned long clock[4] = { 166500000, 187312500, 199800000, 210600000 }; 79static unsigned long __initdata emma2rh_clock[4] = {
80 166500000, 187312500, 199800000, 210600000
81};
80 82
81static unsigned int __init detect_bus_frequency(unsigned long rtc_base) 83static unsigned int __init detect_bus_frequency(unsigned long rtc_base)
82{ 84{
@@ -85,7 +87,8 @@ static unsigned int __init detect_bus_frequency(unsigned long rtc_base)
85 /* detect from boot strap */ 87 /* detect from boot strap */
86 reg = emma2rh_in32(EMMA2RH_BHIF_STRAP_0); 88 reg = emma2rh_in32(EMMA2RH_BHIF_STRAP_0);
87 reg = (reg >> 4) & 0x3; 89 reg = (reg >> 4) & 0x3;
88 return clock[reg]; 90
91 return emma2rh_clock[reg];
89} 92}
90 93
91void __init plat_time_init(void) 94void __init plat_time_init(void)
diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile
index 45545be3eb86..cc0244036aec 100644
--- a/arch/mips/kernel/Makefile
+++ b/arch/mips/kernel/Makefile
@@ -56,9 +56,9 @@ obj-$(CONFIG_MIPS_MT_SMP) += smp-mt.o
56obj-$(CONFIG_MIPS_CMP) += smp-cmp.o 56obj-$(CONFIG_MIPS_CMP) += smp-cmp.o
57obj-$(CONFIG_CPU_MIPSR2) += spram.o 57obj-$(CONFIG_CPU_MIPSR2) += spram.o
58 58
59obj-$(CONFIG_MIPS_APSP_KSPD) += kspd.o
60obj-$(CONFIG_MIPS_VPE_LOADER) += vpe.o 59obj-$(CONFIG_MIPS_VPE_LOADER) += vpe.o
61obj-$(CONFIG_MIPS_VPE_APSP_API) += rtlx.o 60obj-$(CONFIG_MIPS_VPE_APSP_API) += rtlx.o
61obj-$(CONFIG_MIPS_APSP_KSPD) += kspd.o
62 62
63obj-$(CONFIG_I8259) += i8259.o 63obj-$(CONFIG_I8259) += i8259.o
64obj-$(CONFIG_IRQ_CPU) += irq_cpu.o 64obj-$(CONFIG_IRQ_CPU) += irq_cpu.o
diff --git a/arch/mips/kernel/cpu-bugs64.c b/arch/mips/kernel/cpu-bugs64.c
index a1b48af0992f..02b7713cf71c 100644
--- a/arch/mips/kernel/cpu-bugs64.c
+++ b/arch/mips/kernel/cpu-bugs64.c
@@ -38,7 +38,7 @@ static inline void align_mod(const int align, const int mod)
38 ".endr\n\t" 38 ".endr\n\t"
39 ".set pop" 39 ".set pop"
40 : 40 :
41 : GCC_IMM_ASM(align), GCC_IMM_ASM(mod)); 41 : GCC_IMM_ASM() (align), GCC_IMM_ASM() (mod));
42} 42}
43 43
44static inline void mult_sh_align_mod(long *v1, long *v2, long *w, 44static inline void mult_sh_align_mod(long *v1, long *v2, long *w,
diff --git a/arch/mips/kernel/irixelf.c b/arch/mips/kernel/irixelf.c
index 290d8e3a664d..469c7237e5ba 100644
--- a/arch/mips/kernel/irixelf.c
+++ b/arch/mips/kernel/irixelf.c
@@ -578,7 +578,7 @@ static inline int map_interpreter(struct elf_phdr *epp, struct elfhdr *ihp,
578 * process and the system, here we map the page and fill the 578 * process and the system, here we map the page and fill the
579 * structure 579 * structure
580 */ 580 */
581static void irix_map_prda_page(void) 581static int irix_map_prda_page(void)
582{ 582{
583 unsigned long v; 583 unsigned long v;
584 struct prda *pp; 584 struct prda *pp;
@@ -587,8 +587,8 @@ static void irix_map_prda_page(void)
587 v = do_brk(PRDA_ADDRESS, PAGE_SIZE); 587 v = do_brk(PRDA_ADDRESS, PAGE_SIZE);
588 up_write(&current->mm->mmap_sem); 588 up_write(&current->mm->mmap_sem);
589 589
590 if (v < 0) 590 if (v != PRDA_ADDRESS)
591 return; 591 return v; /* v must be an error code */
592 592
593 pp = (struct prda *) v; 593 pp = (struct prda *) v;
594 pp->prda_sys.t_pid = task_pid_vnr(current); 594 pp->prda_sys.t_pid = task_pid_vnr(current);
@@ -596,6 +596,8 @@ static void irix_map_prda_page(void)
596 pp->prda_sys.t_rpid = task_pid_vnr(current); 596 pp->prda_sys.t_rpid = task_pid_vnr(current);
597 597
598 /* We leave the rest set to zero */ 598 /* We leave the rest set to zero */
599
600 return 0;
599} 601}
600 602
601 603
@@ -781,7 +783,8 @@ static int load_irix_binary(struct linux_binprm * bprm, struct pt_regs * regs)
781 * IRIX maps a page at 0x200000 which holds some system 783 * IRIX maps a page at 0x200000 which holds some system
782 * information. Programs depend on this. 784 * information. Programs depend on this.
783 */ 785 */
784 irix_map_prda_page(); 786 if (irix_map_prda_page())
787 goto out_free_dentry;
785 788
786 padzero(elf_bss); 789 padzero(elf_bss);
787 790
diff --git a/arch/mips/kernel/kspd.c b/arch/mips/kernel/kspd.c
index ceb62dce1c9c..b0591ae0ce56 100644
--- a/arch/mips/kernel/kspd.c
+++ b/arch/mips/kernel/kspd.c
@@ -257,7 +257,7 @@ void sp_work_handle_request(void)
257 257
258 vcwd = vpe_getcwd(tclimit); 258 vcwd = vpe_getcwd(tclimit);
259 259
260 /* change to the cwd of the process that loaded the SP program */ 260 /* change to cwd of the process that loaded the SP program */
261 old_fs = get_fs(); 261 old_fs = get_fs();
262 set_fs(KERNEL_DS); 262 set_fs(KERNEL_DS);
263 sys_chdir(vcwd); 263 sys_chdir(vcwd);
@@ -323,6 +323,9 @@ static void sp_cleanup(void)
323 set >>= 1; 323 set >>= 1;
324 } 324 }
325 } 325 }
326
327 /* Put daemon cwd back to root to avoid umount problems */
328 sys_chdir("/");
326} 329}
327 330
328static int channel_open = 0; 331static int channel_open = 0;
diff --git a/arch/mips/kernel/rtlx.c b/arch/mips/kernel/rtlx.c
index 0233798f7155..b88f1c18ff4d 100644
--- a/arch/mips/kernel/rtlx.c
+++ b/arch/mips/kernel/rtlx.c
@@ -72,6 +72,15 @@ static void rtlx_dispatch(void)
72static irqreturn_t rtlx_interrupt(int irq, void *dev_id) 72static irqreturn_t rtlx_interrupt(int irq, void *dev_id)
73{ 73{
74 int i; 74 int i;
75 unsigned int flags, vpeflags;
76
77 /* Ought not to be strictly necessary for SMTC builds */
78 local_irq_save(flags);
79 vpeflags = dvpe();
80 set_c0_status(0x100 << MIPS_CPU_RTLX_IRQ);
81 irq_enable_hazard();
82 evpe(vpeflags);
83 local_irq_restore(flags);
75 84
76 for (i = 0; i < RTLX_CHANNELS; i++) { 85 for (i = 0; i < RTLX_CHANNELS; i++) {
77 wake_up(&channel_wqs[i].lx_queue); 86 wake_up(&channel_wqs[i].lx_queue);
@@ -108,7 +117,8 @@ static void __used dump_rtlx(void)
108static int rtlx_init(struct rtlx_info *rtlxi) 117static int rtlx_init(struct rtlx_info *rtlxi)
109{ 118{
110 if (rtlxi->id != RTLX_ID) { 119 if (rtlxi->id != RTLX_ID) {
111 printk(KERN_ERR "no valid RTLX id at 0x%p 0x%lx\n", rtlxi, rtlxi->id); 120 printk(KERN_ERR "no valid RTLX id at 0x%p 0x%lx\n",
121 rtlxi, rtlxi->id);
112 return -ENOEXEC; 122 return -ENOEXEC;
113 } 123 }
114 124
@@ -162,18 +172,17 @@ int rtlx_open(int index, int can_sleep)
162 172
163 if (rtlx == NULL) { 173 if (rtlx == NULL) {
164 if( (p = vpe_get_shared(tclimit)) == NULL) { 174 if( (p = vpe_get_shared(tclimit)) == NULL) {
165 if (can_sleep) { 175 if (can_sleep) {
166 __wait_event_interruptible(channel_wqs[index].lx_queue, 176 __wait_event_interruptible(channel_wqs[index].lx_queue,
167 (p = vpe_get_shared(tclimit)), 177 (p = vpe_get_shared(tclimit)), ret);
168 ret); 178 if (ret)
169 if (ret)
170 goto out_fail;
171 } else {
172 printk(KERN_DEBUG "No SP program loaded, and device "
173 "opened with O_NONBLOCK\n");
174 ret = -ENOSYS;
175 goto out_fail; 179 goto out_fail;
176 } 180 } else {
181 printk(KERN_DEBUG "No SP program loaded, and device "
182 "opened with O_NONBLOCK\n");
183 ret = -ENOSYS;
184 goto out_fail;
185 }
177 } 186 }
178 187
179 smp_rmb(); 188 smp_rmb();
@@ -182,7 +191,9 @@ int rtlx_open(int index, int can_sleep)
182 DEFINE_WAIT(wait); 191 DEFINE_WAIT(wait);
183 192
184 for (;;) { 193 for (;;) {
185 prepare_to_wait(&channel_wqs[index].lx_queue, &wait, TASK_INTERRUPTIBLE); 194 prepare_to_wait(
195 &channel_wqs[index].lx_queue,
196 &wait, TASK_INTERRUPTIBLE);
186 smp_rmb(); 197 smp_rmb();
187 if (*p != NULL) 198 if (*p != NULL)
188 break; 199 break;
@@ -195,7 +206,7 @@ int rtlx_open(int index, int can_sleep)
195 } 206 }
196 finish_wait(&channel_wqs[index].lx_queue, &wait); 207 finish_wait(&channel_wqs[index].lx_queue, &wait);
197 } else { 208 } else {
198 printk(" *vpe_get_shared is NULL. " 209 pr_err(" *vpe_get_shared is NULL. "
199 "Has an SP program been loaded?\n"); 210 "Has an SP program been loaded?\n");
200 ret = -ENOSYS; 211 ret = -ENOSYS;
201 goto out_fail; 212 goto out_fail;
@@ -203,8 +214,9 @@ int rtlx_open(int index, int can_sleep)
203 } 214 }
204 215
205 if ((unsigned int)*p < KSEG0) { 216 if ((unsigned int)*p < KSEG0) {
206 printk(KERN_WARNING "vpe_get_shared returned an invalid pointer " 217 printk(KERN_WARNING "vpe_get_shared returned an "
207 "maybe an error code %d\n", (int)*p); 218 "invalid pointer maybe an error code %d\n",
219 (int)*p);
208 ret = -ENOSYS; 220 ret = -ENOSYS;
209 goto out_fail; 221 goto out_fail;
210 } 222 }
@@ -232,6 +244,10 @@ out_ret:
232 244
233int rtlx_release(int index) 245int rtlx_release(int index)
234{ 246{
247 if (rtlx == NULL) {
248 pr_err("rtlx_release() with null rtlx\n");
249 return 0;
250 }
235 rtlx->channel[index].lx_state = RTLX_STATE_UNUSED; 251 rtlx->channel[index].lx_state = RTLX_STATE_UNUSED;
236 return 0; 252 return 0;
237} 253}
@@ -251,8 +267,8 @@ unsigned int rtlx_read_poll(int index, int can_sleep)
251 int ret = 0; 267 int ret = 0;
252 268
253 __wait_event_interruptible(channel_wqs[index].lx_queue, 269 __wait_event_interruptible(channel_wqs[index].lx_queue,
254 chan->lx_read != chan->lx_write || sp_stopping, 270 (chan->lx_read != chan->lx_write) ||
255 ret); 271 sp_stopping, ret);
256 if (ret) 272 if (ret)
257 return ret; 273 return ret;
258 274
@@ -282,7 +298,9 @@ static inline int write_spacefree(int read, int write, int size)
282unsigned int rtlx_write_poll(int index) 298unsigned int rtlx_write_poll(int index)
283{ 299{
284 struct rtlx_channel *chan = &rtlx->channel[index]; 300 struct rtlx_channel *chan = &rtlx->channel[index];
285 return write_spacefree(chan->rt_read, chan->rt_write, chan->buffer_size); 301
302 return write_spacefree(chan->rt_read, chan->rt_write,
303 chan->buffer_size);
286} 304}
287 305
288ssize_t rtlx_read(int index, void __user *buff, size_t count) 306ssize_t rtlx_read(int index, void __user *buff, size_t count)
@@ -344,8 +362,8 @@ ssize_t rtlx_write(int index, const void __user *buffer, size_t count)
344 rt_read = rt->rt_read; 362 rt_read = rt->rt_read;
345 363
346 /* total number of bytes to copy */ 364 /* total number of bytes to copy */
347 count = min(count, 365 count = min(count, (size_t)write_spacefree(rt_read, rt->rt_write,
348 (size_t)write_spacefree(rt_read, rt->rt_write, rt->buffer_size)); 366 rt->buffer_size));
349 367
350 /* first bit from write pointer to the end of the buffer, or count */ 368 /* first bit from write pointer to the end of the buffer, or count */
351 fl = min(count, (size_t) rt->buffer_size - rt->rt_write); 369 fl = min(count, (size_t) rt->buffer_size - rt->rt_write);
@@ -514,6 +532,11 @@ static int __init rtlx_module_init(void)
514 532
515 if (cpu_has_vint) 533 if (cpu_has_vint)
516 set_vi_handler(MIPS_CPU_RTLX_IRQ, rtlx_dispatch); 534 set_vi_handler(MIPS_CPU_RTLX_IRQ, rtlx_dispatch);
535 else {
536 pr_err("APRP RTLX init on non-vectored-interrupt processor\n");
537 err = -ENODEV;
538 goto out_chrdev;
539 }
517 540
518 rtlx_irq.dev_id = rtlx; 541 rtlx_irq.dev_id = rtlx;
519 setup_irq(rtlx_irq_num, &rtlx_irq); 542 setup_irq(rtlx_irq_num, &rtlx_irq);
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index 39f3dfe134fb..c6a063b2a0d9 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -331,6 +331,7 @@ static void __init bootmem_init(void)
331 /* 331 /*
332 * Determine low and high memory ranges 332 * Determine low and high memory ranges
333 */ 333 */
334 max_pfn = max_low_pfn;
334 if (max_low_pfn > PFN_DOWN(HIGHMEM_START)) { 335 if (max_low_pfn > PFN_DOWN(HIGHMEM_START)) {
335#ifdef CONFIG_HIGHMEM 336#ifdef CONFIG_HIGHMEM
336 highstart_pfn = PFN_DOWN(HIGHMEM_START); 337 highstart_pfn = PFN_DOWN(HIGHMEM_START);
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
index 33780cc61ce9..63370cdd3c90 100644
--- a/arch/mips/kernel/smp.c
+++ b/arch/mips/kernel/smp.c
@@ -87,8 +87,8 @@ struct plat_smp_ops *mp_ops;
87 87
88__cpuinit void register_smp_ops(struct plat_smp_ops *ops) 88__cpuinit void register_smp_ops(struct plat_smp_ops *ops)
89{ 89{
90 if (ops) 90 if (mp_ops)
91 printk(KERN_WARNING "Overriding previous set SMP ops\n"); 91 printk(KERN_WARNING "Overriding previously set SMP ops\n");
92 92
93 mp_ops = ops; 93 mp_ops = ops;
94} 94}
diff --git a/arch/mips/kernel/vpe.c b/arch/mips/kernel/vpe.c
index 39804c584edd..2794501ff302 100644
--- a/arch/mips/kernel/vpe.c
+++ b/arch/mips/kernel/vpe.c
@@ -269,7 +269,7 @@ static void *alloc_progmem(unsigned long len)
269 * This means you must tell Linux to use less memory than you 269 * This means you must tell Linux to use less memory than you
270 * physically have, for example by passing a mem= boot argument. 270 * physically have, for example by passing a mem= boot argument.
271 */ 271 */
272 addr = pfn_to_kaddr(max_pfn); 272 addr = pfn_to_kaddr(max_low_pfn);
273 memset(addr, 0, len); 273 memset(addr, 0, len);
274#else 274#else
275 /* simple grab some mem for now */ 275 /* simple grab some mem for now */
@@ -781,10 +781,15 @@ static int vpe_run(struct vpe * v)
781 /* take system out of configuration state */ 781 /* take system out of configuration state */
782 clear_c0_mvpcontrol(MVPCONTROL_VPC); 782 clear_c0_mvpcontrol(MVPCONTROL_VPC);
783 783
784 /*
785 * SMTC/SMVP kernels manage VPE enable independently,
786 * but uniprocessor kernels need to turn it on, even
787 * if that wasn't the pre-dvpe() state.
788 */
784#ifdef CONFIG_SMP 789#ifdef CONFIG_SMP
785 evpe(EVPE_ENABLE);
786#else
787 evpe(vpeflags); 790 evpe(vpeflags);
791#else
792 evpe(EVPE_ENABLE);
788#endif 793#endif
789 emt(dmt_flag); 794 emt(dmt_flag);
790 local_irq_restore(flags); 795 local_irq_restore(flags);
@@ -840,7 +845,7 @@ static int vpe_elfload(struct vpe * v)
840 845
841 /* Sanity checks against insmoding binaries or wrong arch, 846 /* Sanity checks against insmoding binaries or wrong arch,
842 weird elf version */ 847 weird elf version */
843 if (memcmp(hdr->e_ident, ELFMAG, 4) != 0 848 if (memcmp(hdr->e_ident, ELFMAG, SELFMAG) != 0
844 || (hdr->e_type != ET_REL && hdr->e_type != ET_EXEC) 849 || (hdr->e_type != ET_REL && hdr->e_type != ET_EXEC)
845 || !elf_check_arch(hdr) 850 || !elf_check_arch(hdr)
846 || hdr->e_shentsize != sizeof(*sechdrs)) { 851 || hdr->e_shentsize != sizeof(*sechdrs)) {
@@ -947,12 +952,14 @@ static int vpe_elfload(struct vpe * v)
947 struct elf_phdr *phdr = (struct elf_phdr *) ((char *)hdr + hdr->e_phoff); 952 struct elf_phdr *phdr = (struct elf_phdr *) ((char *)hdr + hdr->e_phoff);
948 953
949 for (i = 0; i < hdr->e_phnum; i++) { 954 for (i = 0; i < hdr->e_phnum; i++) {
950 if (phdr->p_type != PT_LOAD) 955 if (phdr->p_type == PT_LOAD) {
951 continue; 956 memcpy((void *)phdr->p_paddr,
952 957 (char *)hdr + phdr->p_offset,
953 memcpy((void *)phdr->p_paddr, (char *)hdr + phdr->p_offset, phdr->p_filesz); 958 phdr->p_filesz);
954 memset((void *)phdr->p_paddr + phdr->p_filesz, 0, phdr->p_memsz - phdr->p_filesz); 959 memset((void *)phdr->p_paddr + phdr->p_filesz,
955 phdr++; 960 0, phdr->p_memsz - phdr->p_filesz);
961 }
962 phdr++;
956 } 963 }
957 964
958 for (i = 0; i < hdr->e_shnum; i++) { 965 for (i = 0; i < hdr->e_shnum; i++) {
@@ -1107,7 +1114,7 @@ static int vpe_release(struct inode *inode, struct file *filp)
1107 return -ENODEV; 1114 return -ENODEV;
1108 1115
1109 hdr = (Elf_Ehdr *) v->pbuffer; 1116 hdr = (Elf_Ehdr *) v->pbuffer;
1110 if (memcmp(hdr->e_ident, ELFMAG, 4) == 0) { 1117 if (memcmp(hdr->e_ident, ELFMAG, SELFMAG) == 0) {
1111 if (vpe_elfload(v) >= 0) { 1118 if (vpe_elfload(v) >= 0) {
1112 vpe_run(v); 1119 vpe_run(v);
1113 } else { 1120 } else {
diff --git a/arch/mips/mm/highmem.c b/arch/mips/mm/highmem.c
index 10dd2af2343b..8f2cd8eda741 100644
--- a/arch/mips/mm/highmem.c
+++ b/arch/mips/mm/highmem.c
@@ -116,4 +116,3 @@ EXPORT_SYMBOL(__kmap);
116EXPORT_SYMBOL(__kunmap); 116EXPORT_SYMBOL(__kunmap);
117EXPORT_SYMBOL(__kmap_atomic); 117EXPORT_SYMBOL(__kmap_atomic);
118EXPORT_SYMBOL(__kunmap_atomic); 118EXPORT_SYMBOL(__kunmap_atomic);
119EXPORT_SYMBOL(__kmap_atomic_to_page);
diff --git a/arch/mips/oprofile/op_model_mipsxx.c b/arch/mips/oprofile/op_model_mipsxx.c
index da8cbb6899dc..b40df7d2cf44 100644
--- a/arch/mips/oprofile/op_model_mipsxx.c
+++ b/arch/mips/oprofile/op_model_mipsxx.c
@@ -281,7 +281,7 @@ static inline int n_counters(void)
281 281
282static void reset_counters(void *arg) 282static void reset_counters(void *arg)
283{ 283{
284 int counters = (int)arg; 284 int counters = (int)(long)arg;
285 switch (counters) { 285 switch (counters) {
286 case 4: 286 case 4:
287 w_c0_perfctrl3(0); 287 w_c0_perfctrl3(0);
@@ -313,7 +313,7 @@ static int __init mipsxx_init(void)
313 if (!cpu_has_mipsmt_pertccounters) 313 if (!cpu_has_mipsmt_pertccounters)
314 counters = counters_total_to_per_cpu(counters); 314 counters = counters_total_to_per_cpu(counters);
315#endif 315#endif
316 on_each_cpu(reset_counters, (void *)counters, 0, 1); 316 on_each_cpu(reset_counters, (void *)(long)counters, 0, 1);
317 317
318 op_model_mipsxx_ops.num_counters = counters; 318 op_model_mipsxx_ops.num_counters = counters;
319 switch (current_cpu_type()) { 319 switch (current_cpu_type()) {
@@ -382,7 +382,7 @@ static void mipsxx_exit(void)
382 int counters = op_model_mipsxx_ops.num_counters; 382 int counters = op_model_mipsxx_ops.num_counters;
383 383
384 counters = counters_per_cpu_to_total(counters); 384 counters = counters_per_cpu_to_total(counters);
385 on_each_cpu(reset_counters, (void *)counters, 0, 1); 385 on_each_cpu(reset_counters, (void *)(long)counters, 0, 1);
386 386
387 perf_irq = save_perf_irq; 387 perf_irq = save_perf_irq;
388} 388}
diff --git a/arch/mips/pci/fixup-au1000.c b/arch/mips/pci/fixup-au1000.c
index 00c36c9dbe0e..e2ddfc49237c 100644
--- a/arch/mips/pci/fixup-au1000.c
+++ b/arch/mips/pci/fixup-au1000.c
@@ -1,10 +1,9 @@
1/* 1/*
2 * BRIEF MODULE DESCRIPTION 2 * BRIEF MODULE DESCRIPTION
3 * Board specific pci fixups. 3 * Board specific PCI fixups.
4 * 4 *
5 * Copyright 2001-2003 MontaVista Software Inc. 5 * Copyright 2001-2003, 2008 MontaVista Software Inc.
6 * Author: MontaVista Software, Inc. 6 * Author: MontaVista Software, Inc. <source@mvista.com>
7 * ppopov@mvista.com or source@mvista.com
8 * 7 *
9 * This program is free software; you can redistribute it and/or modify it 8 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the 9 * under the terms of the GNU General Public License as published by the
diff --git a/arch/mips/pci/ops-au1000.c b/arch/mips/pci/ops-au1000.c
index 1314bd58f036..9a57c5ab91dd 100644
--- a/arch/mips/pci/ops-au1000.c
+++ b/arch/mips/pci/ops-au1000.c
@@ -1,10 +1,9 @@
1/* 1/*
2 * BRIEF MODULE DESCRIPTION 2 * BRIEF MODULE DESCRIPTION
3 * Alchemy/AMD Au1x00 PCI support. 3 * Alchemy/AMD Au1xx0 PCI support.
4 * 4 *
5 * Copyright 2001-2003, 2007 MontaVista Software Inc. 5 * Copyright 2001-2003, 2007-2008 MontaVista Software Inc.
6 * Author: MontaVista Software, Inc. 6 * Author: MontaVista Software, Inc. <source@mvista.com>
7 * ppopov@mvista.com or source@mvista.com
8 * 7 *
9 * Support for all devices (greater than 16) added by David Gathright. 8 * Support for all devices (greater than 16) added by David Gathright.
10 * 9 *
@@ -28,6 +27,7 @@
28 * with this program; if not, write to the Free Software Foundation, Inc., 27 * with this program; if not, write to the Free Software Foundation, Inc.,
29 * 675 Mass Ave, Cambridge, MA 02139, USA. 28 * 675 Mass Ave, Cambridge, MA 02139, USA.
30 */ 29 */
30
31#include <linux/types.h> 31#include <linux/types.h>
32#include <linux/pci.h> 32#include <linux/pci.h>
33#include <linux/kernel.h> 33#include <linux/kernel.h>
@@ -36,9 +36,9 @@
36 36
37#include <asm/mach-au1x00/au1000.h> 37#include <asm/mach-au1x00/au1000.h>
38 38
39#undef DEBUG 39#undef DEBUG
40#ifdef DEBUG 40#ifdef DEBUG
41#define DBG(x...) printk(x) 41#define DBG(x...) printk(KERN_DEBUG x)
42#else 42#else
43#define DBG(x...) 43#define DBG(x...)
44#endif 44#endif
@@ -46,7 +46,6 @@
46#define PCI_ACCESS_READ 0 46#define PCI_ACCESS_READ 0
47#define PCI_ACCESS_WRITE 1 47#define PCI_ACCESS_WRITE 1
48 48
49
50int (*board_pci_idsel)(unsigned int devsel, int assert); 49int (*board_pci_idsel)(unsigned int devsel, int assert);
51 50
52void mod_wired_entry(int entry, unsigned long entrylo0, 51void mod_wired_entry(int entry, unsigned long entrylo0,
@@ -92,10 +91,9 @@ void __init au1x_pci_cfg_init(void)
92} 91}
93 92
94static int config_access(unsigned char access_type, struct pci_bus *bus, 93static int config_access(unsigned char access_type, struct pci_bus *bus,
95 unsigned int dev_fn, unsigned char where, 94 unsigned int dev_fn, unsigned char where, u32 *data)
96 u32 * data)
97{ 95{
98#if defined( CONFIG_SOC_AU1500 ) || defined( CONFIG_SOC_AU1550 ) 96#if defined(CONFIG_SOC_AU1500) || defined(CONFIG_SOC_AU1550)
99 unsigned int device = PCI_SLOT(dev_fn); 97 unsigned int device = PCI_SLOT(dev_fn);
100 unsigned int function = PCI_FUNC(dev_fn); 98 unsigned int function = PCI_FUNC(dev_fn);
101 unsigned long offset, status; 99 unsigned long offset, status;
@@ -114,38 +112,36 @@ static int config_access(unsigned char access_type, struct pci_bus *bus,
114 Au1500_PCI_STATCMD); 112 Au1500_PCI_STATCMD);
115 au_sync_udelay(1); 113 au_sync_udelay(1);
116 114
117 /* Allow board vendors to implement their own off-chip idsel. 115 /*
116 * Allow board vendors to implement their own off-chip IDSEL.
118 * If it doesn't succeed, may as well bail out at this point. 117 * If it doesn't succeed, may as well bail out at this point.
119 */ 118 */
120 if (board_pci_idsel) { 119 if (board_pci_idsel && board_pci_idsel(device, 1) == 0) {
121 if (board_pci_idsel(device, 1) == 0) { 120 *data = 0xffffffff;
122 *data = 0xffffffff; 121 local_irq_restore(flags);
123 local_irq_restore(flags); 122 return -1;
124 return -1;
125 }
126 } 123 }
127 124
128 /* setup the config window */ 125 /* Setup the config window */
129 if (bus->number == 0) { 126 if (bus->number == 0)
130 cfg_base = ((1<<device)<<11); 127 cfg_base = (1 << device) << 11;
131 } else { 128 else
132 cfg_base = 0x80000000 | (bus->number<<16) | (device<<11); 129 cfg_base = 0x80000000 | (bus->number << 16) | (device << 11);
133 }
134 130
135 /* setup the lower bits of the 36 bit address */ 131 /* Setup the lower bits of the 36-bit address */
136 offset = (function << 8) | (where & ~0x3); 132 offset = (function << 8) | (where & ~0x3);
137 /* pick up any address that falls below the page mask */ 133 /* Pick up any address that falls below the page mask */
138 offset |= cfg_base & ~PAGE_MASK; 134 offset |= cfg_base & ~PAGE_MASK;
139 135
140 /* page boundary */ 136 /* Page boundary */
141 cfg_base = cfg_base & PAGE_MASK; 137 cfg_base = cfg_base & PAGE_MASK;
142 138
143 /* 139 /*
144 * To improve performance, if the current device is the same as 140 * To improve performance, if the current device is the same as
145 * the last device accessed, we don't touch the TLB. 141 * the last device accessed, we don't touch the TLB.
146 */ 142 */
147 entryLo0 = (6 << 26) | (cfg_base >> 6) | (2 << 3) | 7; 143 entryLo0 = (6 << 26) | (cfg_base >> 6) | (2 << 3) | 7;
148 entryLo1 = (6 << 26) | (cfg_base >> 6) | (0x1000 >> 6) | (2 << 3) | 7; 144 entryLo1 = (6 << 26) | (cfg_base >> 6) | (0x1000 >> 6) | (2 << 3) | 7;
149 if ((entryLo0 != last_entryLo0) || (entryLo1 != last_entryLo1)) { 145 if ((entryLo0 != last_entryLo0) || (entryLo1 != last_entryLo1)) {
150 mod_wired_entry(pci_cfg_wired_entry, entryLo0, entryLo1, 146 mod_wired_entry(pci_cfg_wired_entry, entryLo0, entryLo1,
151 (unsigned long)pci_cfg_vm->addr, PM_4K); 147 (unsigned long)pci_cfg_vm->addr, PM_4K);
@@ -153,38 +149,37 @@ static int config_access(unsigned char access_type, struct pci_bus *bus,
153 last_entryLo1 = entryLo1; 149 last_entryLo1 = entryLo1;
154 } 150 }
155 151
156 if (access_type == PCI_ACCESS_WRITE) { 152 if (access_type == PCI_ACCESS_WRITE)
157 au_writel(*data, (int)(pci_cfg_vm->addr + offset)); 153 au_writel(*data, (int)(pci_cfg_vm->addr + offset));
158 } else { 154 else
159 *data = au_readl((int)(pci_cfg_vm->addr + offset)); 155 *data = au_readl((int)(pci_cfg_vm->addr + offset));
160 } 156
161 au_sync_udelay(2); 157 au_sync_udelay(2);
162 158
163 DBG("cfg_access %d bus->number %d dev %d at %x *data %x conf %x\n", 159 DBG("cfg_access %d bus->number %u dev %u at %x *data %x conf %lx\n",
164 access_type, bus->number, device, where, *data, offset); 160 access_type, bus->number, device, where, *data, offset);
165 161
166 /* check master abort */ 162 /* Check master abort */
167 status = au_readl(Au1500_PCI_STATCMD); 163 status = au_readl(Au1500_PCI_STATCMD);
168 164
169 if (status & (1<<29)) { 165 if (status & (1 << 29)) {
170 *data = 0xffffffff; 166 *data = 0xffffffff;
171 error = -1; 167 error = -1;
172 DBG("Au1x Master Abort\n"); 168 DBG("Au1x Master Abort\n");
173 } else if ((status >> 28) & 0xf) { 169 } else if ((status >> 28) & 0xf) {
174 DBG("PCI ERR detected: device %d, status %x\n", device, ((status >> 28) & 0xf)); 170 DBG("PCI ERR detected: device %u, status %lx\n",
171 device, (status >> 28) & 0xf);
175 172
176 /* clear errors */ 173 /* Clear errors */
177 au_writel(status & 0xf000ffff, Au1500_PCI_STATCMD); 174 au_writel(status & 0xf000ffff, Au1500_PCI_STATCMD);
178 175
179 *data = 0xffffffff; 176 *data = 0xffffffff;
180 error = -1; 177 error = -1;
181 } 178 }
182 179
183 /* Take away the idsel. 180 /* Take away the IDSEL. */
184 */ 181 if (board_pci_idsel)
185 if (board_pci_idsel) {
186 (void)board_pci_idsel(device, 0); 182 (void)board_pci_idsel(device, 0);
187 }
188 183
189 local_irq_restore(flags); 184 local_irq_restore(flags);
190 return error; 185 return error;
@@ -192,7 +187,7 @@ static int config_access(unsigned char access_type, struct pci_bus *bus,
192} 187}
193 188
194static int read_config_byte(struct pci_bus *bus, unsigned int devfn, 189static int read_config_byte(struct pci_bus *bus, unsigned int devfn,
195 int where, u8 * val) 190 int where, u8 *val)
196{ 191{
197 u32 data; 192 u32 data;
198 int ret; 193 int ret;
@@ -206,9 +201,8 @@ static int read_config_byte(struct pci_bus *bus, unsigned int devfn,
206 return ret; 201 return ret;
207} 202}
208 203
209
210static int read_config_word(struct pci_bus *bus, unsigned int devfn, 204static int read_config_word(struct pci_bus *bus, unsigned int devfn,
211 int where, u16 * val) 205 int where, u16 *val)
212{ 206{
213 u32 data; 207 u32 data;
214 int ret; 208 int ret;
@@ -221,7 +215,7 @@ static int read_config_word(struct pci_bus *bus, unsigned int devfn,
221} 215}
222 216
223static int read_config_dword(struct pci_bus *bus, unsigned int devfn, 217static int read_config_dword(struct pci_bus *bus, unsigned int devfn,
224 int where, u32 * val) 218 int where, u32 *val)
225{ 219{
226 int ret; 220 int ret;
227 221
@@ -229,9 +223,8 @@ static int read_config_dword(struct pci_bus *bus, unsigned int devfn,
229 return ret; 223 return ret;
230} 224}
231 225
232static int 226static int write_config_byte(struct pci_bus *bus, unsigned int devfn,
233write_config_byte(struct pci_bus *bus, unsigned int devfn, int where, 227 int where, u8 val)
234 u8 val)
235{ 228{
236 u32 data = 0; 229 u32 data = 0;
237 230
@@ -239,7 +232,7 @@ write_config_byte(struct pci_bus *bus, unsigned int devfn, int where,
239 return -1; 232 return -1;
240 233
241 data = (data & ~(0xff << ((where & 3) << 3))) | 234 data = (data & ~(0xff << ((where & 3) << 3))) |
242 (val << ((where & 3) << 3)); 235 (val << ((where & 3) << 3));
243 236
244 if (config_access(PCI_ACCESS_WRITE, bus, devfn, where, &data)) 237 if (config_access(PCI_ACCESS_WRITE, bus, devfn, where, &data))
245 return -1; 238 return -1;
@@ -247,9 +240,8 @@ write_config_byte(struct pci_bus *bus, unsigned int devfn, int where,
247 return PCIBIOS_SUCCESSFUL; 240 return PCIBIOS_SUCCESSFUL;
248} 241}
249 242
250static int 243static int write_config_word(struct pci_bus *bus, unsigned int devfn,
251write_config_word(struct pci_bus *bus, unsigned int devfn, int where, 244 int where, u16 val)
252 u16 val)
253{ 245{
254 u32 data = 0; 246 u32 data = 0;
255 247
@@ -257,18 +249,16 @@ write_config_word(struct pci_bus *bus, unsigned int devfn, int where,
257 return -1; 249 return -1;
258 250
259 data = (data & ~(0xffff << ((where & 3) << 3))) | 251 data = (data & ~(0xffff << ((where & 3) << 3))) |
260 (val << ((where & 3) << 3)); 252 (val << ((where & 3) << 3));
261 253
262 if (config_access(PCI_ACCESS_WRITE, bus, devfn, where, &data)) 254 if (config_access(PCI_ACCESS_WRITE, bus, devfn, where, &data))
263 return -1; 255 return -1;
264 256
265
266 return PCIBIOS_SUCCESSFUL; 257 return PCIBIOS_SUCCESSFUL;
267} 258}
268 259
269static int 260static int write_config_dword(struct pci_bus *bus, unsigned int devfn,
270write_config_dword(struct pci_bus *bus, unsigned int devfn, int where, 261 int where, u32 val)
271 u32 val)
272{ 262{
273 if (config_access(PCI_ACCESS_WRITE, bus, devfn, where, &val)) 263 if (config_access(PCI_ACCESS_WRITE, bus, devfn, where, &val))
274 return -1; 264 return -1;
@@ -277,18 +267,20 @@ write_config_dword(struct pci_bus *bus, unsigned int devfn, int where,
277} 267}
278 268
279static int config_read(struct pci_bus *bus, unsigned int devfn, 269static int config_read(struct pci_bus *bus, unsigned int devfn,
280 int where, int size, u32 * val) 270 int where, int size, u32 *val)
281{ 271{
282 switch (size) { 272 switch (size) {
283 case 1: { 273 case 1: {
284 u8 _val; 274 u8 _val;
285 int rc = read_config_byte(bus, devfn, where, &_val); 275 int rc = read_config_byte(bus, devfn, where, &_val);
276
286 *val = _val; 277 *val = _val;
287 return rc; 278 return rc;
288 } 279 }
289 case 2: { 280 case 2: {
290 u16 _val; 281 u16 _val;
291 int rc = read_config_word(bus, devfn, where, &_val); 282 int rc = read_config_word(bus, devfn, where, &_val);
283
292 *val = _val; 284 *val = _val;
293 return rc; 285 return rc;
294 } 286 }
@@ -310,7 +302,6 @@ static int config_write(struct pci_bus *bus, unsigned int devfn,
310 } 302 }
311} 303}
312 304
313
314struct pci_ops au1x_pci_ops = { 305struct pci_ops au1x_pci_ops = {
315 config_read, 306 config_read,
316 config_write 307 config_write
diff --git a/arch/mips/pmc-sierra/msp71xx/msp_hwbutton.c b/arch/mips/pmc-sierra/msp71xx/msp_hwbutton.c
index ab96a2d7f4c4..11769b55438c 100644
--- a/arch/mips/pmc-sierra/msp71xx/msp_hwbutton.c
+++ b/arch/mips/pmc-sierra/msp71xx/msp_hwbutton.c
@@ -126,9 +126,6 @@ static irqreturn_t hwbutton_handler(int irq, void *data)
126 struct hwbutton_interrupt *hirq = data; 126 struct hwbutton_interrupt *hirq = data;
127 unsigned long cic_ext = *CIC_EXT_CFG_REG; 127 unsigned long cic_ext = *CIC_EXT_CFG_REG;
128 128
129 if (irq != hirq->irq)
130 return IRQ_NONE;
131
132 if (CIC_EXT_IS_ACTIVE_HI(cic_ext, hirq->eirq)) { 129 if (CIC_EXT_IS_ACTIVE_HI(cic_ext, hirq->eirq)) {
133 /* Interrupt: pin is now HI */ 130 /* Interrupt: pin is now HI */
134 CIC_EXT_SET_ACTIVE_LO(cic_ext, hirq->eirq); 131 CIC_EXT_SET_ACTIVE_LO(cic_ext, hirq->eirq);
@@ -164,7 +161,7 @@ static int msp_hwbutton_register(struct hwbutton_interrupt *hirq)
164 *CIC_EXT_CFG_REG = cic_ext; 161 *CIC_EXT_CFG_REG = cic_ext;
165 162
166 return request_irq(hirq->irq, hwbutton_handler, IRQF_DISABLED, 163 return request_irq(hirq->irq, hwbutton_handler, IRQF_DISABLED,
167 hirq->name, (void *)hirq); 164 hirq->name, hirq);
168} 165}
169 166
170static int __init msp_hwbutton_setup(void) 167static int __init msp_hwbutton_setup(void)
diff --git a/arch/mips/sgi-ip27/ip27-timer.c b/arch/mips/sgi-ip27/ip27-timer.c
index 25d3baf0ebc4..9cebc9e7da63 100644
--- a/arch/mips/sgi-ip27/ip27-timer.c
+++ b/arch/mips/sgi-ip27/ip27-timer.c
@@ -158,7 +158,7 @@ static void rt_set_mode(enum clock_event_mode mode,
158 } 158 }
159} 159}
160 160
161unsigned int rt_timer_irq; 161int rt_timer_irq;
162 162
163static irqreturn_t hub_rt_counter_handler(int irq, void *dev_id) 163static irqreturn_t hub_rt_counter_handler(int irq, void *dev_id)
164{ 164{
@@ -219,7 +219,7 @@ static void __cpuinit hub_rt_clock_event_init(void)
219 219
220static void __init hub_rt_clock_event_global_init(void) 220static void __init hub_rt_clock_event_global_init(void)
221{ 221{
222 unsigned int irq; 222 int irq;
223 223
224 do { 224 do {
225 smp_wmb(); 225 smp_wmb();
diff --git a/drivers/i2c/busses/i2c-au1550.c b/drivers/i2c/busses/i2c-au1550.c
index 491718fe46b7..cae9dc89d88c 100644
--- a/drivers/i2c/busses/i2c-au1550.c
+++ b/drivers/i2c/busses/i2c-au1550.c
@@ -335,7 +335,7 @@ i2c_au1550_probe(struct platform_device *pdev)
335 goto out_mem; 335 goto out_mem;
336 } 336 }
337 337
338 priv->psc_base = r->start; 338 priv->psc_base = CKSEG1ADDR(r->start);
339 priv->xfer_timeout = 200; 339 priv->xfer_timeout = 200;
340 priv->ack_timeout = 200; 340 priv->ack_timeout = 200;
341 341
diff --git a/include/asm-mips/bitops.h b/include/asm-mips/bitops.h
index c2bd126c3b4e..642724734eba 100644
--- a/include/asm-mips/bitops.h
+++ b/include/asm-mips/bitops.h
@@ -558,11 +558,13 @@ static inline void __clear_bit_unlock(unsigned long nr, volatile unsigned long *
558 __clear_bit(nr, addr); 558 __clear_bit(nr, addr);
559} 559}
560 560
561#if defined(CONFIG_CPU_MIPS32) || defined(CONFIG_CPU_MIPS64)
562
561/* 563/*
562 * Return the bit position (0..63) of the most significant 1 bit in a word 564 * Return the bit position (0..63) of the most significant 1 bit in a word
563 * Returns -1 if no 1 bit exists 565 * Returns -1 if no 1 bit exists
564 */ 566 */
565static inline int __ilog2(unsigned long x) 567static inline unsigned long __fls(unsigned long x)
566{ 568{
567 int lz; 569 int lz;
568 570
@@ -591,13 +593,6 @@ static inline int __ilog2(unsigned long x)
591 return 63 - lz; 593 return 63 - lz;
592} 594}
593 595
594static inline unsigned long __fls(unsigned long x)
595{
596 return __ilog2(x);
597}
598
599#if defined(CONFIG_CPU_MIPS32) || defined(CONFIG_CPU_MIPS64)
600
601/* 596/*
602 * __ffs - find first bit in word. 597 * __ffs - find first bit in word.
603 * @word: The word to search 598 * @word: The word to search
@@ -607,7 +602,7 @@ static inline unsigned long __fls(unsigned long x)
607 */ 602 */
608static inline unsigned long __ffs(unsigned long word) 603static inline unsigned long __ffs(unsigned long word)
609{ 604{
610 return __ilog2(word & -word); 605 return __fls(word & -word);
611} 606}
612 607
613/* 608/*
@@ -654,6 +649,7 @@ static inline int ffs(int word)
654#else 649#else
655 650
656#include <asm-generic/bitops/__ffs.h> 651#include <asm-generic/bitops/__ffs.h>
652#include <asm-generic/bitops/__fls.h>
657#include <asm-generic/bitops/ffs.h> 653#include <asm-generic/bitops/ffs.h>
658#include <asm-generic/bitops/fls.h> 654#include <asm-generic/bitops/fls.h>
659#include <asm-generic/bitops/fls64.h> 655#include <asm-generic/bitops/fls64.h>
diff --git a/include/asm-mips/compiler.h b/include/asm-mips/compiler.h
index aa6b876bbd78..71f5c5cfc58a 100644
--- a/include/asm-mips/compiler.h
+++ b/include/asm-mips/compiler.h
@@ -9,10 +9,10 @@
9#define _ASM_COMPILER_H 9#define _ASM_COMPILER_H
10 10
11#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) 11#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
12#define GCC_IMM_ASM "n" 12#define GCC_IMM_ASM() "n"
13#define GCC_REG_ACCUM "$0" 13#define GCC_REG_ACCUM "$0"
14#else 14#else
15#define GCC_IMM_ASM "rn" 15#define GCC_IMM_ASM() "rn"
16#define GCC_REG_ACCUM "accum" 16#define GCC_REG_ACCUM "accum"
17#endif 17#endif
18 18
diff --git a/include/asm-mips/mach-au1x00/au1000.h b/include/asm-mips/mach-au1x00/au1000.h
index a05555165d05..363a14ee0ae5 100644
--- a/include/asm-mips/mach-au1x00/au1000.h
+++ b/include/asm-mips/mach-au1x00/au1000.h
@@ -40,8 +40,8 @@
40#include <linux/delay.h> 40#include <linux/delay.h>
41#include <linux/types.h> 41#include <linux/types.h>
42 42
43#include <asm/io.h> 43#include <linux/io.h>
44#include <asm/irq.h> 44#include <linux/irq.h>
45 45
46/* cpu pipeline flush */ 46/* cpu pipeline flush */
47void static inline au_sync(void) 47void static inline au_sync(void)
@@ -63,32 +63,32 @@ void static inline au_sync_delay(int ms)
63 63
64void static inline au_writeb(u8 val, unsigned long reg) 64void static inline au_writeb(u8 val, unsigned long reg)
65{ 65{
66 *(volatile u8 *)(reg) = val; 66 *(volatile u8 *)reg = val;
67} 67}
68 68
69void static inline au_writew(u16 val, unsigned long reg) 69void static inline au_writew(u16 val, unsigned long reg)
70{ 70{
71 *(volatile u16 *)(reg) = val; 71 *(volatile u16 *)reg = val;
72} 72}
73 73
74void static inline au_writel(u32 val, unsigned long reg) 74void static inline au_writel(u32 val, unsigned long reg)
75{ 75{
76 *(volatile u32 *)(reg) = val; 76 *(volatile u32 *)reg = val;
77} 77}
78 78
79static inline u8 au_readb(unsigned long reg) 79static inline u8 au_readb(unsigned long reg)
80{ 80{
81 return (*(volatile u8 *)reg); 81 return *(volatile u8 *)reg;
82} 82}
83 83
84static inline u16 au_readw(unsigned long reg) 84static inline u16 au_readw(unsigned long reg)
85{ 85{
86 return (*(volatile u16 *)reg); 86 return *(volatile u16 *)reg;
87} 87}
88 88
89static inline u32 au_readl(unsigned long reg) 89static inline u32 au_readl(unsigned long reg)
90{ 90{
91 return (*(volatile u32 *)reg); 91 return *(volatile u32 *)reg;
92} 92}
93 93
94 94
@@ -117,76 +117,77 @@ extern struct au1xxx_irqmap au1xxx_irq_map[];
117#endif /* !defined (_LANGUAGE_ASSEMBLY) */ 117#endif /* !defined (_LANGUAGE_ASSEMBLY) */
118 118
119/* 119/*
120 * SDRAM Register Offsets 120 * SDRAM register offsets
121 */ 121 */
122#if defined(CONFIG_SOC_AU1000) || defined(CONFIG_SOC_AU1500) || defined(CONFIG_SOC_AU1100) 122#if defined(CONFIG_SOC_AU1000) || defined(CONFIG_SOC_AU1500) || \
123#define MEM_SDMODE0 (0x0000) 123 defined(CONFIG_SOC_AU1100)
124#define MEM_SDMODE1 (0x0004) 124#define MEM_SDMODE0 0x0000
125#define MEM_SDMODE2 (0x0008) 125#define MEM_SDMODE1 0x0004
126#define MEM_SDADDR0 (0x000C) 126#define MEM_SDMODE2 0x0008
127#define MEM_SDADDR1 (0x0010) 127#define MEM_SDADDR0 0x000C
128#define MEM_SDADDR2 (0x0014) 128#define MEM_SDADDR1 0x0010
129#define MEM_SDREFCFG (0x0018) 129#define MEM_SDADDR2 0x0014
130#define MEM_SDPRECMD (0x001C) 130#define MEM_SDREFCFG 0x0018
131#define MEM_SDAUTOREF (0x0020) 131#define MEM_SDPRECMD 0x001C
132#define MEM_SDWRMD0 (0x0024) 132#define MEM_SDAUTOREF 0x0020
133#define MEM_SDWRMD1 (0x0028) 133#define MEM_SDWRMD0 0x0024
134#define MEM_SDWRMD2 (0x002C) 134#define MEM_SDWRMD1 0x0028
135#define MEM_SDSLEEP (0x0030) 135#define MEM_SDWRMD2 0x002C
136#define MEM_SDSMCKE (0x0034) 136#define MEM_SDSLEEP 0x0030
137#define MEM_SDSMCKE 0x0034
137 138
138/* 139/*
139 * MEM_SDMODE register content definitions 140 * MEM_SDMODE register content definitions
140 */ 141 */
141#define MEM_SDMODE_F (1<<22) 142#define MEM_SDMODE_F (1 << 22)
142#define MEM_SDMODE_SR (1<<21) 143#define MEM_SDMODE_SR (1 << 21)
143#define MEM_SDMODE_BS (1<<20) 144#define MEM_SDMODE_BS (1 << 20)
144#define MEM_SDMODE_RS (3<<18) 145#define MEM_SDMODE_RS (3 << 18)
145#define MEM_SDMODE_CS (7<<15) 146#define MEM_SDMODE_CS (7 << 15)
146#define MEM_SDMODE_TRAS (15<<11) 147#define MEM_SDMODE_TRAS (15 << 11)
147#define MEM_SDMODE_TMRD (3<<9) 148#define MEM_SDMODE_TMRD (3 << 9)
148#define MEM_SDMODE_TWR (3<<7) 149#define MEM_SDMODE_TWR (3 << 7)
149#define MEM_SDMODE_TRP (3<<5) 150#define MEM_SDMODE_TRP (3 << 5)
150#define MEM_SDMODE_TRCD (3<<3) 151#define MEM_SDMODE_TRCD (3 << 3)
151#define MEM_SDMODE_TCL (7<<0) 152#define MEM_SDMODE_TCL (7 << 0)
152 153
153#define MEM_SDMODE_BS_2Bank (0<<20) 154#define MEM_SDMODE_BS_2Bank (0 << 20)
154#define MEM_SDMODE_BS_4Bank (1<<20) 155#define MEM_SDMODE_BS_4Bank (1 << 20)
155#define MEM_SDMODE_RS_11Row (0<<18) 156#define MEM_SDMODE_RS_11Row (0 << 18)
156#define MEM_SDMODE_RS_12Row (1<<18) 157#define MEM_SDMODE_RS_12Row (1 << 18)
157#define MEM_SDMODE_RS_13Row (2<<18) 158#define MEM_SDMODE_RS_13Row (2 << 18)
158#define MEM_SDMODE_RS_N(N) ((N)<<18) 159#define MEM_SDMODE_RS_N(N) ((N) << 18)
159#define MEM_SDMODE_CS_7Col (0<<15) 160#define MEM_SDMODE_CS_7Col (0 << 15)
160#define MEM_SDMODE_CS_8Col (1<<15) 161#define MEM_SDMODE_CS_8Col (1 << 15)
161#define MEM_SDMODE_CS_9Col (2<<15) 162#define MEM_SDMODE_CS_9Col (2 << 15)
162#define MEM_SDMODE_CS_10Col (3<<15) 163#define MEM_SDMODE_CS_10Col (3 << 15)
163#define MEM_SDMODE_CS_11Col (4<<15) 164#define MEM_SDMODE_CS_11Col (4 << 15)
164#define MEM_SDMODE_CS_N(N) ((N)<<15) 165#define MEM_SDMODE_CS_N(N) ((N) << 15)
165#define MEM_SDMODE_TRAS_N(N) ((N)<<11) 166#define MEM_SDMODE_TRAS_N(N) ((N) << 11)
166#define MEM_SDMODE_TMRD_N(N) ((N)<<9) 167#define MEM_SDMODE_TMRD_N(N) ((N) << 9)
167#define MEM_SDMODE_TWR_N(N) ((N)<<7) 168#define MEM_SDMODE_TWR_N(N) ((N) << 7)
168#define MEM_SDMODE_TRP_N(N) ((N)<<5) 169#define MEM_SDMODE_TRP_N(N) ((N) << 5)
169#define MEM_SDMODE_TRCD_N(N) ((N)<<3) 170#define MEM_SDMODE_TRCD_N(N) ((N) << 3)
170#define MEM_SDMODE_TCL_N(N) ((N)<<0) 171#define MEM_SDMODE_TCL_N(N) ((N) << 0)
171 172
172/* 173/*
173 * MEM_SDADDR register contents definitions 174 * MEM_SDADDR register contents definitions
174 */ 175 */
175#define MEM_SDADDR_E (1<<20) 176#define MEM_SDADDR_E (1 << 20)
176#define MEM_SDADDR_CSBA (0x03FF<<10) 177#define MEM_SDADDR_CSBA (0x03FF << 10)
177#define MEM_SDADDR_CSMASK (0x03FF<<0) 178#define MEM_SDADDR_CSMASK (0x03FF << 0)
178#define MEM_SDADDR_CSBA_N(N) ((N)&(0x03FF<<22)>>12) 179#define MEM_SDADDR_CSBA_N(N) ((N) & (0x03FF << 22) >> 12)
179#define MEM_SDADDR_CSMASK_N(N) ((N)&(0x03FF<<22)>>22) 180#define MEM_SDADDR_CSMASK_N(N) ((N)&(0x03FF << 22) >> 22)
180 181
181/* 182/*
182 * MEM_SDREFCFG register content definitions 183 * MEM_SDREFCFG register content definitions
183 */ 184 */
184#define MEM_SDREFCFG_TRC (15<<28) 185#define MEM_SDREFCFG_TRC (15 << 28)
185#define MEM_SDREFCFG_TRPM (3<<26) 186#define MEM_SDREFCFG_TRPM (3 << 26)
186#define MEM_SDREFCFG_E (1<<25) 187#define MEM_SDREFCFG_E (1 << 25)
187#define MEM_SDREFCFG_RE (0x1ffffff<<0) 188#define MEM_SDREFCFG_RE (0x1ffffff << 0)
188#define MEM_SDREFCFG_TRC_N(N) ((N)<<MEM_SDREFCFG_TRC) 189#define MEM_SDREFCFG_TRC_N(N) ((N) << MEM_SDREFCFG_TRC)
189#define MEM_SDREFCFG_TRPM_N(N) ((N)<<MEM_SDREFCFG_TRPM) 190#define MEM_SDREFCFG_TRPM_N(N) ((N) << MEM_SDREFCFG_TRPM)
190#define MEM_SDREFCFG_REF_N(N) (N) 191#define MEM_SDREFCFG_REF_N(N) (N)
191#endif 192#endif
192 193
@@ -199,25 +200,25 @@ extern struct au1xxx_irqmap au1xxx_irq_map[];
199/***********************************************************************/ 200/***********************************************************************/
200 201
201#if defined(CONFIG_SOC_AU1550) || defined(CONFIG_SOC_AU1200) 202#if defined(CONFIG_SOC_AU1550) || defined(CONFIG_SOC_AU1200)
202#define MEM_SDMODE0 (0x0800) 203#define MEM_SDMODE0 0x0800
203#define MEM_SDMODE1 (0x0808) 204#define MEM_SDMODE1 0x0808
204#define MEM_SDMODE2 (0x0810) 205#define MEM_SDMODE2 0x0810
205#define MEM_SDADDR0 (0x0820) 206#define MEM_SDADDR0 0x0820
206#define MEM_SDADDR1 (0x0828) 207#define MEM_SDADDR1 0x0828
207#define MEM_SDADDR2 (0x0830) 208#define MEM_SDADDR2 0x0830
208#define MEM_SDCONFIGA (0x0840) 209#define MEM_SDCONFIGA 0x0840
209#define MEM_SDCONFIGB (0x0848) 210#define MEM_SDCONFIGB 0x0848
210#define MEM_SDSTAT (0x0850) 211#define MEM_SDSTAT 0x0850
211#define MEM_SDERRADDR (0x0858) 212#define MEM_SDERRADDR 0x0858
212#define MEM_SDSTRIDE0 (0x0860) 213#define MEM_SDSTRIDE0 0x0860
213#define MEM_SDSTRIDE1 (0x0868) 214#define MEM_SDSTRIDE1 0x0868
214#define MEM_SDSTRIDE2 (0x0870) 215#define MEM_SDSTRIDE2 0x0870
215#define MEM_SDWRMD0 (0x0880) 216#define MEM_SDWRMD0 0x0880
216#define MEM_SDWRMD1 (0x0888) 217#define MEM_SDWRMD1 0x0888
217#define MEM_SDWRMD2 (0x0890) 218#define MEM_SDWRMD2 0x0890
218#define MEM_SDPRECMD (0x08C0) 219#define MEM_SDPRECMD 0x08C0
219#define MEM_SDAUTOREF (0x08C8) 220#define MEM_SDAUTOREF 0x08C8
220#define MEM_SDSREF (0x08D0) 221#define MEM_SDSREF 0x08D0
221#define MEM_SDSLEEP MEM_SDSREF 222#define MEM_SDSLEEP MEM_SDSREF
222 223
223#endif 224#endif
@@ -256,9 +257,9 @@ extern struct au1xxx_irqmap au1xxx_irq_map[];
256#define SSI0_PHYS_ADDR 0x11600000 257#define SSI0_PHYS_ADDR 0x11600000
257#define SSI1_PHYS_ADDR 0x11680000 258#define SSI1_PHYS_ADDR 0x11680000
258#define SYS_PHYS_ADDR 0x11900000 259#define SYS_PHYS_ADDR 0x11900000
259#define PCMCIA_IO_PHYS_ADDR 0xF00000000ULL 260#define PCMCIA_IO_PHYS_ADDR 0xF00000000ULL
260#define PCMCIA_ATTR_PHYS_ADDR 0xF40000000ULL 261#define PCMCIA_ATTR_PHYS_ADDR 0xF40000000ULL
261#define PCMCIA_MEM_PHYS_ADDR 0xF80000000ULL 262#define PCMCIA_MEM_PHYS_ADDR 0xF80000000ULL
262#endif 263#endif
263 264
264/********************************************************************/ 265/********************************************************************/
@@ -290,13 +291,13 @@ extern struct au1xxx_irqmap au1xxx_irq_map[];
290#define UART3_PHYS_ADDR 0x11400000 291#define UART3_PHYS_ADDR 0x11400000
291#define GPIO2_PHYS_ADDR 0x11700000 292#define GPIO2_PHYS_ADDR 0x11700000
292#define SYS_PHYS_ADDR 0x11900000 293#define SYS_PHYS_ADDR 0x11900000
293#define PCI_MEM_PHYS_ADDR 0x400000000ULL 294#define PCI_MEM_PHYS_ADDR 0x400000000ULL
294#define PCI_IO_PHYS_ADDR 0x500000000ULL 295#define PCI_IO_PHYS_ADDR 0x500000000ULL
295#define PCI_CONFIG0_PHYS_ADDR 0x600000000ULL 296#define PCI_CONFIG0_PHYS_ADDR 0x600000000ULL
296#define PCI_CONFIG1_PHYS_ADDR 0x680000000ULL 297#define PCI_CONFIG1_PHYS_ADDR 0x680000000ULL
297#define PCMCIA_IO_PHYS_ADDR 0xF00000000ULL 298#define PCMCIA_IO_PHYS_ADDR 0xF00000000ULL
298#define PCMCIA_ATTR_PHYS_ADDR 0xF40000000ULL 299#define PCMCIA_ATTR_PHYS_ADDR 0xF40000000ULL
299#define PCMCIA_MEM_PHYS_ADDR 0xF80000000ULL 300#define PCMCIA_MEM_PHYS_ADDR 0xF80000000ULL
300#endif 301#endif
301 302
302/********************************************************************/ 303/********************************************************************/
@@ -333,9 +334,9 @@ extern struct au1xxx_irqmap au1xxx_irq_map[];
333#define GPIO2_PHYS_ADDR 0x11700000 334#define GPIO2_PHYS_ADDR 0x11700000
334#define SYS_PHYS_ADDR 0x11900000 335#define SYS_PHYS_ADDR 0x11900000
335#define LCD_PHYS_ADDR 0x15000000 336#define LCD_PHYS_ADDR 0x15000000
336#define PCMCIA_IO_PHYS_ADDR 0xF00000000ULL 337#define PCMCIA_IO_PHYS_ADDR 0xF00000000ULL
337#define PCMCIA_ATTR_PHYS_ADDR 0xF40000000ULL 338#define PCMCIA_ATTR_PHYS_ADDR 0xF40000000ULL
338#define PCMCIA_MEM_PHYS_ADDR 0xF80000000ULL 339#define PCMCIA_MEM_PHYS_ADDR 0xF80000000ULL
339#endif 340#endif
340 341
341/***********************************************************************/ 342/***********************************************************************/
@@ -360,17 +361,17 @@ extern struct au1xxx_irqmap au1xxx_irq_map[];
360#define SYS_PHYS_ADDR 0x11900000 361#define SYS_PHYS_ADDR 0x11900000
361#define DDMA_PHYS_ADDR 0x14002000 362#define DDMA_PHYS_ADDR 0x14002000
362#define PE_PHYS_ADDR 0x14008000 363#define PE_PHYS_ADDR 0x14008000
363#define PSC0_PHYS_ADDR 0x11A00000 364#define PSC0_PHYS_ADDR 0x11A00000
364#define PSC1_PHYS_ADDR 0x11B00000 365#define PSC1_PHYS_ADDR 0x11B00000
365#define PSC2_PHYS_ADDR 0x10A00000 366#define PSC2_PHYS_ADDR 0x10A00000
366#define PSC3_PHYS_ADDR 0x10B00000 367#define PSC3_PHYS_ADDR 0x10B00000
367#define PCI_MEM_PHYS_ADDR 0x400000000ULL 368#define PCI_MEM_PHYS_ADDR 0x400000000ULL
368#define PCI_IO_PHYS_ADDR 0x500000000ULL 369#define PCI_IO_PHYS_ADDR 0x500000000ULL
369#define PCI_CONFIG0_PHYS_ADDR 0x600000000ULL 370#define PCI_CONFIG0_PHYS_ADDR 0x600000000ULL
370#define PCI_CONFIG1_PHYS_ADDR 0x680000000ULL 371#define PCI_CONFIG1_PHYS_ADDR 0x680000000ULL
371#define PCMCIA_IO_PHYS_ADDR 0xF00000000ULL 372#define PCMCIA_IO_PHYS_ADDR 0xF00000000ULL
372#define PCMCIA_ATTR_PHYS_ADDR 0xF40000000ULL 373#define PCMCIA_ATTR_PHYS_ADDR 0xF40000000ULL
373#define PCMCIA_MEM_PHYS_ADDR 0xF80000000ULL 374#define PCMCIA_MEM_PHYS_ADDR 0xF80000000ULL
374#endif 375#endif
375 376
376/***********************************************************************/ 377/***********************************************************************/
@@ -397,122 +398,121 @@ extern struct au1xxx_irqmap au1xxx_irq_map[];
397#define SWCNT_PHYS_ADDR 0x1110010C 398#define SWCNT_PHYS_ADDR 0x1110010C
398#define MAEFE_PHYS_ADDR 0x14012000 399#define MAEFE_PHYS_ADDR 0x14012000
399#define MAEBE_PHYS_ADDR 0x14010000 400#define MAEBE_PHYS_ADDR 0x14010000
400#define PCMCIA_IO_PHYS_ADDR 0xF00000000ULL 401#define PCMCIA_IO_PHYS_ADDR 0xF00000000ULL
401#define PCMCIA_ATTR_PHYS_ADDR 0xF40000000ULL 402#define PCMCIA_ATTR_PHYS_ADDR 0xF40000000ULL
402#define PCMCIA_MEM_PHYS_ADDR 0xF80000000ULL 403#define PCMCIA_MEM_PHYS_ADDR 0xF80000000ULL
403#endif 404#endif
404 405
405
406/* Static Bus Controller */ 406/* Static Bus Controller */
407#define MEM_STCFG0 0xB4001000 407#define MEM_STCFG0 0xB4001000
408#define MEM_STTIME0 0xB4001004 408#define MEM_STTIME0 0xB4001004
409#define MEM_STADDR0 0xB4001008 409#define MEM_STADDR0 0xB4001008
410 410
411#define MEM_STCFG1 0xB4001010 411#define MEM_STCFG1 0xB4001010
412#define MEM_STTIME1 0xB4001014 412#define MEM_STTIME1 0xB4001014
413#define MEM_STADDR1 0xB4001018 413#define MEM_STADDR1 0xB4001018
414 414
415#define MEM_STCFG2 0xB4001020 415#define MEM_STCFG2 0xB4001020
416#define MEM_STTIME2 0xB4001024 416#define MEM_STTIME2 0xB4001024
417#define MEM_STADDR2 0xB4001028 417#define MEM_STADDR2 0xB4001028
418 418
419#define MEM_STCFG3 0xB4001030 419#define MEM_STCFG3 0xB4001030
420#define MEM_STTIME3 0xB4001034 420#define MEM_STTIME3 0xB4001034
421#define MEM_STADDR3 0xB4001038 421#define MEM_STADDR3 0xB4001038
422 422
423#if defined(CONFIG_SOC_AU1550) || defined(CONFIG_SOC_AU1200) 423#if defined(CONFIG_SOC_AU1550) || defined(CONFIG_SOC_AU1200)
424#define MEM_STNDCTL 0xB4001100 424#define MEM_STNDCTL 0xB4001100
425#define MEM_STSTAT 0xB4001104 425#define MEM_STSTAT 0xB4001104
426 426
427#define MEM_STNAND_CMD (0x0) 427#define MEM_STNAND_CMD 0x0
428#define MEM_STNAND_ADDR (0x4) 428#define MEM_STNAND_ADDR 0x4
429#define MEM_STNAND_DATA (0x20) 429#define MEM_STNAND_DATA 0x20
430#endif 430#endif
431 431
432/* Interrupt Controller 0 */ 432/* Interrupt Controller 0 */
433#define IC0_CFG0RD 0xB0400040 433#define IC0_CFG0RD 0xB0400040
434#define IC0_CFG0SET 0xB0400040 434#define IC0_CFG0SET 0xB0400040
435#define IC0_CFG0CLR 0xB0400044 435#define IC0_CFG0CLR 0xB0400044
436 436
437#define IC0_CFG1RD 0xB0400048 437#define IC0_CFG1RD 0xB0400048
438#define IC0_CFG1SET 0xB0400048 438#define IC0_CFG1SET 0xB0400048
439#define IC0_CFG1CLR 0xB040004C 439#define IC0_CFG1CLR 0xB040004C
440 440
441#define IC0_CFG2RD 0xB0400050 441#define IC0_CFG2RD 0xB0400050
442#define IC0_CFG2SET 0xB0400050 442#define IC0_CFG2SET 0xB0400050
443#define IC0_CFG2CLR 0xB0400054 443#define IC0_CFG2CLR 0xB0400054
444 444
445#define IC0_REQ0INT 0xB0400054 445#define IC0_REQ0INT 0xB0400054
446#define IC0_SRCRD 0xB0400058 446#define IC0_SRCRD 0xB0400058
447#define IC0_SRCSET 0xB0400058 447#define IC0_SRCSET 0xB0400058
448#define IC0_SRCCLR 0xB040005C 448#define IC0_SRCCLR 0xB040005C
449#define IC0_REQ1INT 0xB040005C 449#define IC0_REQ1INT 0xB040005C
450 450
451#define IC0_ASSIGNRD 0xB0400060 451#define IC0_ASSIGNRD 0xB0400060
452#define IC0_ASSIGNSET 0xB0400060 452#define IC0_ASSIGNSET 0xB0400060
453#define IC0_ASSIGNCLR 0xB0400064 453#define IC0_ASSIGNCLR 0xB0400064
454 454
455#define IC0_WAKERD 0xB0400068 455#define IC0_WAKERD 0xB0400068
456#define IC0_WAKESET 0xB0400068 456#define IC0_WAKESET 0xB0400068
457#define IC0_WAKECLR 0xB040006C 457#define IC0_WAKECLR 0xB040006C
458 458
459#define IC0_MASKRD 0xB0400070 459#define IC0_MASKRD 0xB0400070
460#define IC0_MASKSET 0xB0400070 460#define IC0_MASKSET 0xB0400070
461#define IC0_MASKCLR 0xB0400074 461#define IC0_MASKCLR 0xB0400074
462 462
463#define IC0_RISINGRD 0xB0400078 463#define IC0_RISINGRD 0xB0400078
464#define IC0_RISINGCLR 0xB0400078 464#define IC0_RISINGCLR 0xB0400078
465#define IC0_FALLINGRD 0xB040007C 465#define IC0_FALLINGRD 0xB040007C
466#define IC0_FALLINGCLR 0xB040007C 466#define IC0_FALLINGCLR 0xB040007C
467 467
468#define IC0_TESTBIT 0xB0400080 468#define IC0_TESTBIT 0xB0400080
469 469
470/* Interrupt Controller 1 */ 470/* Interrupt Controller 1 */
471#define IC1_CFG0RD 0xB1800040 471#define IC1_CFG0RD 0xB1800040
472#define IC1_CFG0SET 0xB1800040 472#define IC1_CFG0SET 0xB1800040
473#define IC1_CFG0CLR 0xB1800044 473#define IC1_CFG0CLR 0xB1800044
474 474
475#define IC1_CFG1RD 0xB1800048 475#define IC1_CFG1RD 0xB1800048
476#define IC1_CFG1SET 0xB1800048 476#define IC1_CFG1SET 0xB1800048
477#define IC1_CFG1CLR 0xB180004C 477#define IC1_CFG1CLR 0xB180004C
478 478
479#define IC1_CFG2RD 0xB1800050 479#define IC1_CFG2RD 0xB1800050
480#define IC1_CFG2SET 0xB1800050 480#define IC1_CFG2SET 0xB1800050
481#define IC1_CFG2CLR 0xB1800054 481#define IC1_CFG2CLR 0xB1800054
482 482
483#define IC1_REQ0INT 0xB1800054 483#define IC1_REQ0INT 0xB1800054
484#define IC1_SRCRD 0xB1800058 484#define IC1_SRCRD 0xB1800058
485#define IC1_SRCSET 0xB1800058 485#define IC1_SRCSET 0xB1800058
486#define IC1_SRCCLR 0xB180005C 486#define IC1_SRCCLR 0xB180005C
487#define IC1_REQ1INT 0xB180005C 487#define IC1_REQ1INT 0xB180005C
488 488
489#define IC1_ASSIGNRD 0xB1800060 489#define IC1_ASSIGNRD 0xB1800060
490#define IC1_ASSIGNSET 0xB1800060 490#define IC1_ASSIGNSET 0xB1800060
491#define IC1_ASSIGNCLR 0xB1800064 491#define IC1_ASSIGNCLR 0xB1800064
492 492
493#define IC1_WAKERD 0xB1800068 493#define IC1_WAKERD 0xB1800068
494#define IC1_WAKESET 0xB1800068 494#define IC1_WAKESET 0xB1800068
495#define IC1_WAKECLR 0xB180006C 495#define IC1_WAKECLR 0xB180006C
496 496
497#define IC1_MASKRD 0xB1800070 497#define IC1_MASKRD 0xB1800070
498#define IC1_MASKSET 0xB1800070 498#define IC1_MASKSET 0xB1800070
499#define IC1_MASKCLR 0xB1800074 499#define IC1_MASKCLR 0xB1800074
500 500
501#define IC1_RISINGRD 0xB1800078 501#define IC1_RISINGRD 0xB1800078
502#define IC1_RISINGCLR 0xB1800078 502#define IC1_RISINGCLR 0xB1800078
503#define IC1_FALLINGRD 0xB180007C 503#define IC1_FALLINGRD 0xB180007C
504#define IC1_FALLINGCLR 0xB180007C 504#define IC1_FALLINGCLR 0xB180007C
505 505
506#define IC1_TESTBIT 0xB1800080 506#define IC1_TESTBIT 0xB1800080
507 507
508/* Interrupt Configuration Modes */ 508/* Interrupt Configuration Modes */
509#define INTC_INT_DISABLED 0 509#define INTC_INT_DISABLED 0x0
510#define INTC_INT_RISE_EDGE 0x1 510#define INTC_INT_RISE_EDGE 0x1
511#define INTC_INT_FALL_EDGE 0x2 511#define INTC_INT_FALL_EDGE 0x2
512#define INTC_INT_RISE_AND_FALL_EDGE 0x3 512#define INTC_INT_RISE_AND_FALL_EDGE 0x3
513#define INTC_INT_HIGH_LEVEL 0x5 513#define INTC_INT_HIGH_LEVEL 0x5
514#define INTC_INT_LOW_LEVEL 0x6 514#define INTC_INT_LOW_LEVEL 0x6
515#define INTC_INT_HIGH_AND_LOW_LEVEL 0x7 515#define INTC_INT_HIGH_AND_LOW_LEVEL 0x7
516 516
517/* Interrupt Numbers */ 517/* Interrupt Numbers */
518/* Au1000 */ 518/* Au1000 */
@@ -579,18 +579,18 @@ enum soc_au1000_ints {
579 AU1000_GPIO_31, 579 AU1000_GPIO_31,
580}; 580};
581 581
582#define UART0_ADDR 0xB1100000 582#define UART0_ADDR 0xB1100000
583#define UART1_ADDR 0xB1200000 583#define UART1_ADDR 0xB1200000
584#define UART2_ADDR 0xB1300000 584#define UART2_ADDR 0xB1300000
585#define UART3_ADDR 0xB1400000 585#define UART3_ADDR 0xB1400000
586 586
587#define USB_OHCI_BASE 0x10100000 // phys addr for ioremap 587#define USB_OHCI_BASE 0x10100000 /* phys addr for ioremap */
588#define USB_HOST_CONFIG 0xB017fffc 588#define USB_HOST_CONFIG 0xB017FFFC
589 589
590#define AU1000_ETH0_BASE 0xB0500000 590#define AU1000_ETH0_BASE 0xB0500000
591#define AU1000_ETH1_BASE 0xB0510000 591#define AU1000_ETH1_BASE 0xB0510000
592#define AU1000_MAC0_ENABLE 0xB0520000 592#define AU1000_MAC0_ENABLE 0xB0520000
593#define AU1000_MAC1_ENABLE 0xB0520004 593#define AU1000_MAC1_ENABLE 0xB0520004
594#define NUM_ETH_INTERFACES 2 594#define NUM_ETH_INTERFACES 2
595#endif /* CONFIG_SOC_AU1000 */ 595#endif /* CONFIG_SOC_AU1000 */
596 596
@@ -662,16 +662,16 @@ enum soc_au1500_ints {
662#define INTC AU1000_PCI_INTC 662#define INTC AU1000_PCI_INTC
663#define INTD AU1000_PCI_INTD 663#define INTD AU1000_PCI_INTD
664 664
665#define UART0_ADDR 0xB1100000 665#define UART0_ADDR 0xB1100000
666#define UART3_ADDR 0xB1400000 666#define UART3_ADDR 0xB1400000
667 667
668#define USB_OHCI_BASE 0x10100000 // phys addr for ioremap 668#define USB_OHCI_BASE 0x10100000 /* phys addr for ioremap */
669#define USB_HOST_CONFIG 0xB017fffc 669#define USB_HOST_CONFIG 0xB017fffc
670 670
671#define AU1500_ETH0_BASE 0xB1500000 671#define AU1500_ETH0_BASE 0xB1500000
672#define AU1500_ETH1_BASE 0xB1510000 672#define AU1500_ETH1_BASE 0xB1510000
673#define AU1500_MAC0_ENABLE 0xB1520000 673#define AU1500_MAC0_ENABLE 0xB1520000
674#define AU1500_MAC1_ENABLE 0xB1520004 674#define AU1500_MAC1_ENABLE 0xB1520004
675#define NUM_ETH_INTERFACES 2 675#define NUM_ETH_INTERFACES 2
676#endif /* CONFIG_SOC_AU1500 */ 676#endif /* CONFIG_SOC_AU1500 */
677 677
@@ -739,15 +739,15 @@ enum soc_au1100_ints {
739 AU1000_GPIO_31, 739 AU1000_GPIO_31,
740}; 740};
741 741
742#define UART0_ADDR 0xB1100000 742#define UART0_ADDR 0xB1100000
743#define UART1_ADDR 0xB1200000 743#define UART1_ADDR 0xB1200000
744#define UART3_ADDR 0xB1400000 744#define UART3_ADDR 0xB1400000
745 745
746#define USB_OHCI_BASE 0x10100000 // phys addr for ioremap 746#define USB_OHCI_BASE 0x10100000 /* phys addr for ioremap */
747#define USB_HOST_CONFIG 0xB017fffc 747#define USB_HOST_CONFIG 0xB017FFFC
748 748
749#define AU1100_ETH0_BASE 0xB0500000 749#define AU1100_ETH0_BASE 0xB0500000
750#define AU1100_MAC0_ENABLE 0xB0520000 750#define AU1100_MAC0_ENABLE 0xB0520000
751#define NUM_ETH_INTERFACES 1 751#define NUM_ETH_INTERFACES 1
752#endif /* CONFIG_SOC_AU1100 */ 752#endif /* CONFIG_SOC_AU1100 */
753 753
@@ -826,18 +826,18 @@ enum soc_au1550_ints {
826#define INTC AU1550_PCI_INTC 826#define INTC AU1550_PCI_INTC
827#define INTD AU1550_PCI_INTD 827#define INTD AU1550_PCI_INTD
828 828
829#define UART0_ADDR 0xB1100000 829#define UART0_ADDR 0xB1100000
830#define UART1_ADDR 0xB1200000 830#define UART1_ADDR 0xB1200000
831#define UART3_ADDR 0xB1400000 831#define UART3_ADDR 0xB1400000
832 832
833#define USB_OHCI_BASE 0x14020000 // phys addr for ioremap 833#define USB_OHCI_BASE 0x14020000 /* phys addr for ioremap */
834#define USB_OHCI_LEN 0x00060000 834#define USB_OHCI_LEN 0x00060000
835#define USB_HOST_CONFIG 0xB4027ffc 835#define USB_HOST_CONFIG 0xB4027ffc
836 836
837#define AU1550_ETH0_BASE 0xB0500000 837#define AU1550_ETH0_BASE 0xB0500000
838#define AU1550_ETH1_BASE 0xB0510000 838#define AU1550_ETH1_BASE 0xB0510000
839#define AU1550_MAC0_ENABLE 0xB0520000 839#define AU1550_MAC0_ENABLE 0xB0520000
840#define AU1550_MAC1_ENABLE 0xB0520004 840#define AU1550_MAC1_ENABLE 0xB0520004
841#define NUM_ETH_INTERFACES 2 841#define NUM_ETH_INTERFACES 2
842#endif /* CONFIG_SOC_AU1550 */ 842#endif /* CONFIG_SOC_AU1550 */
843 843
@@ -911,32 +911,32 @@ enum soc_au1200_ints {
911 AU1000_GPIO_31, 911 AU1000_GPIO_31,
912}; 912};
913 913
914#define UART0_ADDR 0xB1100000 914#define UART0_ADDR 0xB1100000
915#define UART1_ADDR 0xB1200000 915#define UART1_ADDR 0xB1200000
916 916
917#define USB_UOC_BASE 0x14020020 917#define USB_UOC_BASE 0x14020020
918#define USB_UOC_LEN 0x20 918#define USB_UOC_LEN 0x20
919#define USB_OHCI_BASE 0x14020100 919#define USB_OHCI_BASE 0x14020100
920#define USB_OHCI_LEN 0x100 920#define USB_OHCI_LEN 0x100
921#define USB_EHCI_BASE 0x14020200 921#define USB_EHCI_BASE 0x14020200
922#define USB_EHCI_LEN 0x100 922#define USB_EHCI_LEN 0x100
923#define USB_UDC_BASE 0x14022000 923#define USB_UDC_BASE 0x14022000
924#define USB_UDC_LEN 0x2000 924#define USB_UDC_LEN 0x2000
925#define USB_MSR_BASE 0xB4020000 925#define USB_MSR_BASE 0xB4020000
926#define USB_MSR_MCFG 4 926#define USB_MSR_MCFG 4
927#define USBMSRMCFG_OMEMEN 0 927#define USBMSRMCFG_OMEMEN 0
928#define USBMSRMCFG_OBMEN 1 928#define USBMSRMCFG_OBMEN 1
929#define USBMSRMCFG_EMEMEN 2 929#define USBMSRMCFG_EMEMEN 2
930#define USBMSRMCFG_EBMEN 3 930#define USBMSRMCFG_EBMEN 3
931#define USBMSRMCFG_DMEMEN 4 931#define USBMSRMCFG_DMEMEN 4
932#define USBMSRMCFG_DBMEN 5 932#define USBMSRMCFG_DBMEN 5
933#define USBMSRMCFG_GMEMEN 6 933#define USBMSRMCFG_GMEMEN 6
934#define USBMSRMCFG_OHCCLKEN 16 934#define USBMSRMCFG_OHCCLKEN 16
935#define USBMSRMCFG_EHCCLKEN 17 935#define USBMSRMCFG_EHCCLKEN 17
936#define USBMSRMCFG_UDCCLKEN 18 936#define USBMSRMCFG_UDCCLKEN 18
937#define USBMSRMCFG_PHYPLLEN 19 937#define USBMSRMCFG_PHYPLLEN 19
938#define USBMSRMCFG_RDCOMB 30 938#define USBMSRMCFG_RDCOMB 30
939#define USBMSRMCFG_PFEN 31 939#define USBMSRMCFG_PFEN 31
940 940
941#endif /* CONFIG_SOC_AU1200 */ 941#endif /* CONFIG_SOC_AU1200 */
942 942
@@ -949,259 +949,258 @@ enum soc_au1200_ints {
949#define INTX 0xFF /* not valid */ 949#define INTX 0xFF /* not valid */
950 950
951/* Programmable Counters 0 and 1 */ 951/* Programmable Counters 0 and 1 */
952#define SYS_BASE 0xB1900000 952#define SYS_BASE 0xB1900000
953#define SYS_COUNTER_CNTRL (SYS_BASE + 0x14) 953#define SYS_COUNTER_CNTRL (SYS_BASE + 0x14)
954# define SYS_CNTRL_E1S (1<<23) 954# define SYS_CNTRL_E1S (1 << 23)
955# define SYS_CNTRL_T1S (1<<20) 955# define SYS_CNTRL_T1S (1 << 20)
956# define SYS_CNTRL_M21 (1<<19) 956# define SYS_CNTRL_M21 (1 << 19)
957# define SYS_CNTRL_M11 (1<<18) 957# define SYS_CNTRL_M11 (1 << 18)
958# define SYS_CNTRL_M01 (1<<17) 958# define SYS_CNTRL_M01 (1 << 17)
959# define SYS_CNTRL_C1S (1<<16) 959# define SYS_CNTRL_C1S (1 << 16)
960# define SYS_CNTRL_BP (1<<14) 960# define SYS_CNTRL_BP (1 << 14)
961# define SYS_CNTRL_EN1 (1<<13) 961# define SYS_CNTRL_EN1 (1 << 13)
962# define SYS_CNTRL_BT1 (1<<12) 962# define SYS_CNTRL_BT1 (1 << 12)
963# define SYS_CNTRL_EN0 (1<<11) 963# define SYS_CNTRL_EN0 (1 << 11)
964# define SYS_CNTRL_BT0 (1<<10) 964# define SYS_CNTRL_BT0 (1 << 10)
965# define SYS_CNTRL_E0 (1<<8) 965# define SYS_CNTRL_E0 (1 << 8)
966# define SYS_CNTRL_E0S (1<<7) 966# define SYS_CNTRL_E0S (1 << 7)
967# define SYS_CNTRL_32S (1<<5) 967# define SYS_CNTRL_32S (1 << 5)
968# define SYS_CNTRL_T0S (1<<4) 968# define SYS_CNTRL_T0S (1 << 4)
969# define SYS_CNTRL_M20 (1<<3) 969# define SYS_CNTRL_M20 (1 << 3)
970# define SYS_CNTRL_M10 (1<<2) 970# define SYS_CNTRL_M10 (1 << 2)
971# define SYS_CNTRL_M00 (1<<1) 971# define SYS_CNTRL_M00 (1 << 1)
972# define SYS_CNTRL_C0S (1<<0) 972# define SYS_CNTRL_C0S (1 << 0)
973 973
974/* Programmable Counter 0 Registers */ 974/* Programmable Counter 0 Registers */
975#define SYS_TOYTRIM (SYS_BASE + 0) 975#define SYS_TOYTRIM (SYS_BASE + 0)
976#define SYS_TOYWRITE (SYS_BASE + 4) 976#define SYS_TOYWRITE (SYS_BASE + 4)
977#define SYS_TOYMATCH0 (SYS_BASE + 8) 977#define SYS_TOYMATCH0 (SYS_BASE + 8)
978#define SYS_TOYMATCH1 (SYS_BASE + 0xC) 978#define SYS_TOYMATCH1 (SYS_BASE + 0xC)
979#define SYS_TOYMATCH2 (SYS_BASE + 0x10) 979#define SYS_TOYMATCH2 (SYS_BASE + 0x10)
980#define SYS_TOYREAD (SYS_BASE + 0x40) 980#define SYS_TOYREAD (SYS_BASE + 0x40)
981 981
982/* Programmable Counter 1 Registers */ 982/* Programmable Counter 1 Registers */
983#define SYS_RTCTRIM (SYS_BASE + 0x44) 983#define SYS_RTCTRIM (SYS_BASE + 0x44)
984#define SYS_RTCWRITE (SYS_BASE + 0x48) 984#define SYS_RTCWRITE (SYS_BASE + 0x48)
985#define SYS_RTCMATCH0 (SYS_BASE + 0x4C) 985#define SYS_RTCMATCH0 (SYS_BASE + 0x4C)
986#define SYS_RTCMATCH1 (SYS_BASE + 0x50) 986#define SYS_RTCMATCH1 (SYS_BASE + 0x50)
987#define SYS_RTCMATCH2 (SYS_BASE + 0x54) 987#define SYS_RTCMATCH2 (SYS_BASE + 0x54)
988#define SYS_RTCREAD (SYS_BASE + 0x58) 988#define SYS_RTCREAD (SYS_BASE + 0x58)
989 989
990/* I2S Controller */ 990/* I2S Controller */
991#define I2S_DATA 0xB1000000 991#define I2S_DATA 0xB1000000
992# define I2S_DATA_MASK (0xffffff) 992# define I2S_DATA_MASK 0xffffff
993#define I2S_CONFIG 0xB1000004 993#define I2S_CONFIG 0xB1000004
994# define I2S_CONFIG_XU (1<<25) 994# define I2S_CONFIG_XU (1 << 25)
995# define I2S_CONFIG_XO (1<<24) 995# define I2S_CONFIG_XO (1 << 24)
996# define I2S_CONFIG_RU (1<<23) 996# define I2S_CONFIG_RU (1 << 23)
997# define I2S_CONFIG_RO (1<<22) 997# define I2S_CONFIG_RO (1 << 22)
998# define I2S_CONFIG_TR (1<<21) 998# define I2S_CONFIG_TR (1 << 21)
999# define I2S_CONFIG_TE (1<<20) 999# define I2S_CONFIG_TE (1 << 20)
1000# define I2S_CONFIG_TF (1<<19) 1000# define I2S_CONFIG_TF (1 << 19)
1001# define I2S_CONFIG_RR (1<<18) 1001# define I2S_CONFIG_RR (1 << 18)
1002# define I2S_CONFIG_RE (1<<17) 1002# define I2S_CONFIG_RE (1 << 17)
1003# define I2S_CONFIG_RF (1<<16) 1003# define I2S_CONFIG_RF (1 << 16)
1004# define I2S_CONFIG_PD (1<<11) 1004# define I2S_CONFIG_PD (1 << 11)
1005# define I2S_CONFIG_LB (1<<10) 1005# define I2S_CONFIG_LB (1 << 10)
1006# define I2S_CONFIG_IC (1<<9) 1006# define I2S_CONFIG_IC (1 << 9)
1007# define I2S_CONFIG_FM_BIT 7 1007# define I2S_CONFIG_FM_BIT 7
1008# define I2S_CONFIG_FM_MASK (0x3 << I2S_CONFIG_FM_BIT) 1008# define I2S_CONFIG_FM_MASK (0x3 << I2S_CONFIG_FM_BIT)
1009# define I2S_CONFIG_FM_I2S (0x0 << I2S_CONFIG_FM_BIT) 1009# define I2S_CONFIG_FM_I2S (0x0 << I2S_CONFIG_FM_BIT)
1010# define I2S_CONFIG_FM_LJ (0x1 << I2S_CONFIG_FM_BIT) 1010# define I2S_CONFIG_FM_LJ (0x1 << I2S_CONFIG_FM_BIT)
1011# define I2S_CONFIG_FM_RJ (0x2 << I2S_CONFIG_FM_BIT) 1011# define I2S_CONFIG_FM_RJ (0x2 << I2S_CONFIG_FM_BIT)
1012# define I2S_CONFIG_TN (1<<6) 1012# define I2S_CONFIG_TN (1 << 6)
1013# define I2S_CONFIG_RN (1<<5) 1013# define I2S_CONFIG_RN (1 << 5)
1014# define I2S_CONFIG_SZ_BIT 0 1014# define I2S_CONFIG_SZ_BIT 0
1015# define I2S_CONFIG_SZ_MASK (0x1F << I2S_CONFIG_SZ_BIT) 1015# define I2S_CONFIG_SZ_MASK (0x1F << I2S_CONFIG_SZ_BIT)
1016 1016
1017#define I2S_CONTROL 0xB1000008 1017#define I2S_CONTROL 0xB1000008
1018# define I2S_CONTROL_D (1<<1) 1018# define I2S_CONTROL_D (1 << 1)
1019# define I2S_CONTROL_CE (1<<0) 1019# define I2S_CONTROL_CE (1 << 0)
1020 1020
1021/* USB Host Controller */ 1021/* USB Host Controller */
1022#ifndef USB_OHCI_LEN 1022#ifndef USB_OHCI_LEN
1023#define USB_OHCI_LEN 0x00100000 1023#define USB_OHCI_LEN 0x00100000
1024#endif 1024#endif
1025 1025
1026#ifndef CONFIG_SOC_AU1200 1026#ifndef CONFIG_SOC_AU1200
1027 1027
1028/* USB Device Controller */ 1028/* USB Device Controller */
1029#define USBD_EP0RD 0xB0200000 1029#define USBD_EP0RD 0xB0200000
1030#define USBD_EP0WR 0xB0200004 1030#define USBD_EP0WR 0xB0200004
1031#define USBD_EP2WR 0xB0200008 1031#define USBD_EP2WR 0xB0200008
1032#define USBD_EP3WR 0xB020000C 1032#define USBD_EP3WR 0xB020000C
1033#define USBD_EP4RD 0xB0200010 1033#define USBD_EP4RD 0xB0200010
1034#define USBD_EP5RD 0xB0200014 1034#define USBD_EP5RD 0xB0200014
1035#define USBD_INTEN 0xB0200018 1035#define USBD_INTEN 0xB0200018
1036#define USBD_INTSTAT 0xB020001C 1036#define USBD_INTSTAT 0xB020001C
1037# define USBDEV_INT_SOF (1<<12) 1037# define USBDEV_INT_SOF (1 << 12)
1038# define USBDEV_INT_HF_BIT 6 1038# define USBDEV_INT_HF_BIT 6
1039# define USBDEV_INT_HF_MASK (0x3f << USBDEV_INT_HF_BIT) 1039# define USBDEV_INT_HF_MASK 0x3f << USBDEV_INT_HF_BIT)
1040# define USBDEV_INT_CMPLT_BIT 0 1040# define USBDEV_INT_CMPLT_BIT 0
1041# define USBDEV_INT_CMPLT_MASK (0x3f << USBDEV_INT_CMPLT_BIT) 1041# define USBDEV_INT_CMPLT_MASK (0x3f << USBDEV_INT_CMPLT_BIT)
1042#define USBD_CONFIG 0xB0200020 1042#define USBD_CONFIG 0xB0200020
1043#define USBD_EP0CS 0xB0200024 1043#define USBD_EP0CS 0xB0200024
1044#define USBD_EP2CS 0xB0200028 1044#define USBD_EP2CS 0xB0200028
1045#define USBD_EP3CS 0xB020002C 1045#define USBD_EP3CS 0xB020002C
1046#define USBD_EP4CS 0xB0200030 1046#define USBD_EP4CS 0xB0200030
1047#define USBD_EP5CS 0xB0200034 1047#define USBD_EP5CS 0xB0200034
1048# define USBDEV_CS_SU (1<<14) 1048# define USBDEV_CS_SU (1 << 14)
1049# define USBDEV_CS_NAK (1<<13) 1049# define USBDEV_CS_NAK (1 << 13)
1050# define USBDEV_CS_ACK (1<<12) 1050# define USBDEV_CS_ACK (1 << 12)
1051# define USBDEV_CS_BUSY (1<<11) 1051# define USBDEV_CS_BUSY (1 << 11)
1052# define USBDEV_CS_TSIZE_BIT 1 1052# define USBDEV_CS_TSIZE_BIT 1
1053# define USBDEV_CS_TSIZE_MASK (0x3ff << USBDEV_CS_TSIZE_BIT) 1053# define USBDEV_CS_TSIZE_MASK (0x3ff << USBDEV_CS_TSIZE_BIT)
1054# define USBDEV_CS_STALL (1<<0) 1054# define USBDEV_CS_STALL (1 << 0)
1055#define USBD_EP0RDSTAT 0xB0200040 1055#define USBD_EP0RDSTAT 0xB0200040
1056#define USBD_EP0WRSTAT 0xB0200044 1056#define USBD_EP0WRSTAT 0xB0200044
1057#define USBD_EP2WRSTAT 0xB0200048 1057#define USBD_EP2WRSTAT 0xB0200048
1058#define USBD_EP3WRSTAT 0xB020004C 1058#define USBD_EP3WRSTAT 0xB020004C
1059#define USBD_EP4RDSTAT 0xB0200050 1059#define USBD_EP4RDSTAT 0xB0200050
1060#define USBD_EP5RDSTAT 0xB0200054 1060#define USBD_EP5RDSTAT 0xB0200054
1061# define USBDEV_FSTAT_FLUSH (1<<6) 1061# define USBDEV_FSTAT_FLUSH (1 << 6)
1062# define USBDEV_FSTAT_UF (1<<5) 1062# define USBDEV_FSTAT_UF (1 << 5)
1063# define USBDEV_FSTAT_OF (1<<4) 1063# define USBDEV_FSTAT_OF (1 << 4)
1064# define USBDEV_FSTAT_FCNT_BIT 0 1064# define USBDEV_FSTAT_FCNT_BIT 0
1065# define USBDEV_FSTAT_FCNT_MASK (0x0f << USBDEV_FSTAT_FCNT_BIT) 1065# define USBDEV_FSTAT_FCNT_MASK (0x0f << USBDEV_FSTAT_FCNT_BIT)
1066#define USBD_ENABLE 0xB0200058 1066#define USBD_ENABLE 0xB0200058
1067# define USBDEV_ENABLE (1<<1) 1067# define USBDEV_ENABLE (1 << 1)
1068# define USBDEV_CE (1<<0) 1068# define USBDEV_CE (1 << 0)
1069 1069
1070#endif /* !CONFIG_SOC_AU1200 */ 1070#endif /* !CONFIG_SOC_AU1200 */
1071 1071
1072/* Ethernet Controllers */ 1072/* Ethernet Controllers */
1073 1073
1074/* 4 byte offsets from AU1000_ETH_BASE */ 1074/* 4 byte offsets from AU1000_ETH_BASE */
1075#define MAC_CONTROL 0x0 1075#define MAC_CONTROL 0x0
1076# define MAC_RX_ENABLE (1<<2) 1076# define MAC_RX_ENABLE (1 << 2)
1077# define MAC_TX_ENABLE (1<<3) 1077# define MAC_TX_ENABLE (1 << 3)
1078# define MAC_DEF_CHECK (1<<5) 1078# define MAC_DEF_CHECK (1 << 5)
1079# define MAC_SET_BL(X) (((X)&0x3)<<6) 1079# define MAC_SET_BL(X) (((X) & 0x3) << 6)
1080# define MAC_AUTO_PAD (1<<8) 1080# define MAC_AUTO_PAD (1 << 8)
1081# define MAC_DISABLE_RETRY (1<<10) 1081# define MAC_DISABLE_RETRY (1 << 10)
1082# define MAC_DISABLE_BCAST (1<<11) 1082# define MAC_DISABLE_BCAST (1 << 11)
1083# define MAC_LATE_COL (1<<12) 1083# define MAC_LATE_COL (1 << 12)
1084# define MAC_HASH_MODE (1<<13) 1084# define MAC_HASH_MODE (1 << 13)
1085# define MAC_HASH_ONLY (1<<15) 1085# define MAC_HASH_ONLY (1 << 15)
1086# define MAC_PASS_ALL (1<<16) 1086# define MAC_PASS_ALL (1 << 16)
1087# define MAC_INVERSE_FILTER (1<<17) 1087# define MAC_INVERSE_FILTER (1 << 17)
1088# define MAC_PROMISCUOUS (1<<18) 1088# define MAC_PROMISCUOUS (1 << 18)
1089# define MAC_PASS_ALL_MULTI (1<<19) 1089# define MAC_PASS_ALL_MULTI (1 << 19)
1090# define MAC_FULL_DUPLEX (1<<20) 1090# define MAC_FULL_DUPLEX (1 << 20)
1091# define MAC_NORMAL_MODE 0 1091# define MAC_NORMAL_MODE 0
1092# define MAC_INT_LOOPBACK (1<<21) 1092# define MAC_INT_LOOPBACK (1 << 21)
1093# define MAC_EXT_LOOPBACK (1<<22) 1093# define MAC_EXT_LOOPBACK (1 << 22)
1094# define MAC_DISABLE_RX_OWN (1<<23) 1094# define MAC_DISABLE_RX_OWN (1 << 23)
1095# define MAC_BIG_ENDIAN (1<<30) 1095# define MAC_BIG_ENDIAN (1 << 30)
1096# define MAC_RX_ALL (1<<31) 1096# define MAC_RX_ALL (1 << 31)
1097#define MAC_ADDRESS_HIGH 0x4 1097#define MAC_ADDRESS_HIGH 0x4
1098#define MAC_ADDRESS_LOW 0x8 1098#define MAC_ADDRESS_LOW 0x8
1099#define MAC_MCAST_HIGH 0xC 1099#define MAC_MCAST_HIGH 0xC
1100#define MAC_MCAST_LOW 0x10 1100#define MAC_MCAST_LOW 0x10
1101#define MAC_MII_CNTRL 0x14 1101#define MAC_MII_CNTRL 0x14
1102# define MAC_MII_BUSY (1<<0) 1102# define MAC_MII_BUSY (1 << 0)
1103# define MAC_MII_READ 0 1103# define MAC_MII_READ 0
1104# define MAC_MII_WRITE (1<<1) 1104# define MAC_MII_WRITE (1 << 1)
1105# define MAC_SET_MII_SELECT_REG(X) (((X)&0x1f)<<6) 1105# define MAC_SET_MII_SELECT_REG(X) (((X) & 0x1f) << 6)
1106# define MAC_SET_MII_SELECT_PHY(X) (((X)&0x1f)<<11) 1106# define MAC_SET_MII_SELECT_PHY(X) (((X) & 0x1f) << 11)
1107#define MAC_MII_DATA 0x18 1107#define MAC_MII_DATA 0x18
1108#define MAC_FLOW_CNTRL 0x1C 1108#define MAC_FLOW_CNTRL 0x1C
1109# define MAC_FLOW_CNTRL_BUSY (1<<0) 1109# define MAC_FLOW_CNTRL_BUSY (1 << 0)
1110# define MAC_FLOW_CNTRL_ENABLE (1<<1) 1110# define MAC_FLOW_CNTRL_ENABLE (1 << 1)
1111# define MAC_PASS_CONTROL (1<<2) 1111# define MAC_PASS_CONTROL (1 << 2)
1112# define MAC_SET_PAUSE(X) (((X)&0xffff)<<16) 1112# define MAC_SET_PAUSE(X) (((X) & 0xffff) << 16)
1113#define MAC_VLAN1_TAG 0x20 1113#define MAC_VLAN1_TAG 0x20
1114#define MAC_VLAN2_TAG 0x24 1114#define MAC_VLAN2_TAG 0x24
1115 1115
1116/* Ethernet Controller Enable */ 1116/* Ethernet Controller Enable */
1117 1117
1118# define MAC_EN_CLOCK_ENABLE (1<<0) 1118# define MAC_EN_CLOCK_ENABLE (1 << 0)
1119# define MAC_EN_RESET0 (1<<1) 1119# define MAC_EN_RESET0 (1 << 1)
1120# define MAC_EN_TOSS (0<<2) 1120# define MAC_EN_TOSS (0 << 2)
1121# define MAC_EN_CACHEABLE (1<<3) 1121# define MAC_EN_CACHEABLE (1 << 3)
1122# define MAC_EN_RESET1 (1<<4) 1122# define MAC_EN_RESET1 (1 << 4)
1123# define MAC_EN_RESET2 (1<<5) 1123# define MAC_EN_RESET2 (1 << 5)
1124# define MAC_DMA_RESET (1<<6) 1124# define MAC_DMA_RESET (1 << 6)
1125 1125
1126/* Ethernet Controller DMA Channels */ 1126/* Ethernet Controller DMA Channels */
1127 1127
1128#define MAC0_TX_DMA_ADDR 0xB4004000 1128#define MAC0_TX_DMA_ADDR 0xB4004000
1129#define MAC1_TX_DMA_ADDR 0xB4004200 1129#define MAC1_TX_DMA_ADDR 0xB4004200
1130/* offsets from MAC_TX_RING_ADDR address */ 1130/* offsets from MAC_TX_RING_ADDR address */
1131#define MAC_TX_BUFF0_STATUS 0x0 1131#define MAC_TX_BUFF0_STATUS 0x0
1132# define TX_FRAME_ABORTED (1<<0) 1132# define TX_FRAME_ABORTED (1 << 0)
1133# define TX_JAB_TIMEOUT (1<<1) 1133# define TX_JAB_TIMEOUT (1 << 1)
1134# define TX_NO_CARRIER (1<<2) 1134# define TX_NO_CARRIER (1 << 2)
1135# define TX_LOSS_CARRIER (1<<3) 1135# define TX_LOSS_CARRIER (1 << 3)
1136# define TX_EXC_DEF (1<<4) 1136# define TX_EXC_DEF (1 << 4)
1137# define TX_LATE_COLL_ABORT (1<<5) 1137# define TX_LATE_COLL_ABORT (1 << 5)
1138# define TX_EXC_COLL (1<<6) 1138# define TX_EXC_COLL (1 << 6)
1139# define TX_UNDERRUN (1<<7) 1139# define TX_UNDERRUN (1 << 7)
1140# define TX_DEFERRED (1<<8) 1140# define TX_DEFERRED (1 << 8)
1141# define TX_LATE_COLL (1<<9) 1141# define TX_LATE_COLL (1 << 9)
1142# define TX_COLL_CNT_MASK (0xF<<10) 1142# define TX_COLL_CNT_MASK (0xF << 10)
1143# define TX_PKT_RETRY (1<<31) 1143# define TX_PKT_RETRY (1 << 31)
1144#define MAC_TX_BUFF0_ADDR 0x4 1144#define MAC_TX_BUFF0_ADDR 0x4
1145# define TX_DMA_ENABLE (1<<0) 1145# define TX_DMA_ENABLE (1 << 0)
1146# define TX_T_DONE (1<<1) 1146# define TX_T_DONE (1 << 1)
1147# define TX_GET_DMA_BUFFER(X) (((X)>>2)&0x3) 1147# define TX_GET_DMA_BUFFER(X) (((X) >> 2) & 0x3)
1148#define MAC_TX_BUFF0_LEN 0x8 1148#define MAC_TX_BUFF0_LEN 0x8
1149#define MAC_TX_BUFF1_STATUS 0x10 1149#define MAC_TX_BUFF1_STATUS 0x10
1150#define MAC_TX_BUFF1_ADDR 0x14 1150#define MAC_TX_BUFF1_ADDR 0x14
1151#define MAC_TX_BUFF1_LEN 0x18 1151#define MAC_TX_BUFF1_LEN 0x18
1152#define MAC_TX_BUFF2_STATUS 0x20 1152#define MAC_TX_BUFF2_STATUS 0x20
1153#define MAC_TX_BUFF2_ADDR 0x24 1153#define MAC_TX_BUFF2_ADDR 0x24
1154#define MAC_TX_BUFF2_LEN 0x28 1154#define MAC_TX_BUFF2_LEN 0x28
1155#define MAC_TX_BUFF3_STATUS 0x30 1155#define MAC_TX_BUFF3_STATUS 0x30
1156#define MAC_TX_BUFF3_ADDR 0x34 1156#define MAC_TX_BUFF3_ADDR 0x34
1157#define MAC_TX_BUFF3_LEN 0x38 1157#define MAC_TX_BUFF3_LEN 0x38
1158 1158
1159#define MAC0_RX_DMA_ADDR 0xB4004100 1159#define MAC0_RX_DMA_ADDR 0xB4004100
1160#define MAC1_RX_DMA_ADDR 0xB4004300 1160#define MAC1_RX_DMA_ADDR 0xB4004300
1161/* offsets from MAC_RX_RING_ADDR */ 1161/* offsets from MAC_RX_RING_ADDR */
1162#define MAC_RX_BUFF0_STATUS 0x0 1162#define MAC_RX_BUFF0_STATUS 0x0
1163# define RX_FRAME_LEN_MASK 0x3fff 1163# define RX_FRAME_LEN_MASK 0x3fff
1164# define RX_WDOG_TIMER (1<<14) 1164# define RX_WDOG_TIMER (1 << 14)
1165# define RX_RUNT (1<<15) 1165# define RX_RUNT (1 << 15)
1166# define RX_OVERLEN (1<<16) 1166# define RX_OVERLEN (1 << 16)
1167# define RX_COLL (1<<17) 1167# define RX_COLL (1 << 17)
1168# define RX_ETHER (1<<18) 1168# define RX_ETHER (1 << 18)
1169# define RX_MII_ERROR (1<<19) 1169# define RX_MII_ERROR (1 << 19)
1170# define RX_DRIBBLING (1<<20) 1170# define RX_DRIBBLING (1 << 20)
1171# define RX_CRC_ERROR (1<<21) 1171# define RX_CRC_ERROR (1 << 21)
1172# define RX_VLAN1 (1<<22) 1172# define RX_VLAN1 (1 << 22)
1173# define RX_VLAN2 (1<<23) 1173# define RX_VLAN2 (1 << 23)
1174# define RX_LEN_ERROR (1<<24) 1174# define RX_LEN_ERROR (1 << 24)
1175# define RX_CNTRL_FRAME (1<<25) 1175# define RX_CNTRL_FRAME (1 << 25)
1176# define RX_U_CNTRL_FRAME (1<<26) 1176# define RX_U_CNTRL_FRAME (1 << 26)
1177# define RX_MCAST_FRAME (1<<27) 1177# define RX_MCAST_FRAME (1 << 27)
1178# define RX_BCAST_FRAME (1<<28) 1178# define RX_BCAST_FRAME (1 << 28)
1179# define RX_FILTER_FAIL (1<<29) 1179# define RX_FILTER_FAIL (1 << 29)
1180# define RX_PACKET_FILTER (1<<30) 1180# define RX_PACKET_FILTER (1 << 30)
1181# define RX_MISSED_FRAME (1<<31) 1181# define RX_MISSED_FRAME (1 << 31)
1182 1182
1183# define RX_ERROR (RX_WDOG_TIMER | RX_RUNT | RX_OVERLEN | \ 1183# define RX_ERROR (RX_WDOG_TIMER | RX_RUNT | RX_OVERLEN | \
1184 RX_COLL | RX_MII_ERROR | RX_CRC_ERROR | \ 1184 RX_COLL | RX_MII_ERROR | RX_CRC_ERROR | \
1185 RX_LEN_ERROR | RX_U_CNTRL_FRAME | RX_MISSED_FRAME) 1185 RX_LEN_ERROR | RX_U_CNTRL_FRAME | RX_MISSED_FRAME)
1186#define MAC_RX_BUFF0_ADDR 0x4 1186#define MAC_RX_BUFF0_ADDR 0x4
1187# define RX_DMA_ENABLE (1<<0) 1187# define RX_DMA_ENABLE (1 << 0)
1188# define RX_T_DONE (1<<1) 1188# define RX_T_DONE (1 << 1)
1189# define RX_GET_DMA_BUFFER(X) (((X)>>2)&0x3) 1189# define RX_GET_DMA_BUFFER(X) (((X) >> 2) & 0x3)
1190# define RX_SET_BUFF_ADDR(X) ((X)&0xffffffc0) 1190# define RX_SET_BUFF_ADDR(X) ((X) & 0xffffffc0)
1191#define MAC_RX_BUFF1_STATUS 0x10 1191#define MAC_RX_BUFF1_STATUS 0x10
1192#define MAC_RX_BUFF1_ADDR 0x14 1192#define MAC_RX_BUFF1_ADDR 0x14
1193#define MAC_RX_BUFF2_STATUS 0x20 1193#define MAC_RX_BUFF2_STATUS 0x20
1194#define MAC_RX_BUFF2_ADDR 0x24 1194#define MAC_RX_BUFF2_ADDR 0x24
1195#define MAC_RX_BUFF3_STATUS 0x30 1195#define MAC_RX_BUFF3_STATUS 0x30
1196#define MAC_RX_BUFF3_ADDR 0x34 1196#define MAC_RX_BUFF3_ADDR 0x34
1197
1198 1197
1199/* UARTS 0-3 */ 1198/* UARTS 0-3 */
1200#define UART_BASE UART0_ADDR 1199#define UART_BASE UART0_ADDR
1201#ifdef CONFIG_SOC_AU1200 1200#ifdef CONFIG_SOC_AU1200
1202#define UART_DEBUG_BASE UART1_ADDR 1201#define UART_DEBUG_BASE UART1_ADDR
1203#else 1202#else
1204#define UART_DEBUG_BASE UART3_ADDR 1203#define UART_DEBUG_BASE UART3_ADDR
1205#endif 1204#endif
1206 1205
1207#define UART_RX 0 /* Receive buffer */ 1206#define UART_RX 0 /* Receive buffer */
@@ -1294,341 +1293,337 @@ enum soc_au1200_ints {
1294#define UART_MSR_DCTS 0x01 /* Delta CTS */ 1293#define UART_MSR_DCTS 0x01 /* Delta CTS */
1295#define UART_MSR_ANY_DELTA 0x0F /* Any of the delta bits! */ 1294#define UART_MSR_ANY_DELTA 0x0F /* Any of the delta bits! */
1296 1295
1297
1298
1299/* SSIO */ 1296/* SSIO */
1300#define SSI0_STATUS 0xB1600000 1297#define SSI0_STATUS 0xB1600000
1301# define SSI_STATUS_BF (1<<4) 1298# define SSI_STATUS_BF (1 << 4)
1302# define SSI_STATUS_OF (1<<3) 1299# define SSI_STATUS_OF (1 << 3)
1303# define SSI_STATUS_UF (1<<2) 1300# define SSI_STATUS_UF (1 << 2)
1304# define SSI_STATUS_D (1<<1) 1301# define SSI_STATUS_D (1 << 1)
1305# define SSI_STATUS_B (1<<0) 1302# define SSI_STATUS_B (1 << 0)
1306#define SSI0_INT 0xB1600004 1303#define SSI0_INT 0xB1600004
1307# define SSI_INT_OI (1<<3) 1304# define SSI_INT_OI (1 << 3)
1308# define SSI_INT_UI (1<<2) 1305# define SSI_INT_UI (1 << 2)
1309# define SSI_INT_DI (1<<1) 1306# define SSI_INT_DI (1 << 1)
1310#define SSI0_INT_ENABLE 0xB1600008 1307#define SSI0_INT_ENABLE 0xB1600008
1311# define SSI_INTE_OIE (1<<3) 1308# define SSI_INTE_OIE (1 << 3)
1312# define SSI_INTE_UIE (1<<2) 1309# define SSI_INTE_UIE (1 << 2)
1313# define SSI_INTE_DIE (1<<1) 1310# define SSI_INTE_DIE (1 << 1)
1314#define SSI0_CONFIG 0xB1600020 1311#define SSI0_CONFIG 0xB1600020
1315# define SSI_CONFIG_AO (1<<24) 1312# define SSI_CONFIG_AO (1 << 24)
1316# define SSI_CONFIG_DO (1<<23) 1313# define SSI_CONFIG_DO (1 << 23)
1317# define SSI_CONFIG_ALEN_BIT 20 1314# define SSI_CONFIG_ALEN_BIT 20
1318# define SSI_CONFIG_ALEN_MASK (0x7<<20) 1315# define SSI_CONFIG_ALEN_MASK (0x7 << 20)
1319# define SSI_CONFIG_DLEN_BIT 16 1316# define SSI_CONFIG_DLEN_BIT 16
1320# define SSI_CONFIG_DLEN_MASK (0x7<<16) 1317# define SSI_CONFIG_DLEN_MASK (0x7 << 16)
1321# define SSI_CONFIG_DD (1<<11) 1318# define SSI_CONFIG_DD (1 << 11)
1322# define SSI_CONFIG_AD (1<<10) 1319# define SSI_CONFIG_AD (1 << 10)
1323# define SSI_CONFIG_BM_BIT 8 1320# define SSI_CONFIG_BM_BIT 8
1324# define SSI_CONFIG_BM_MASK (0x3<<8) 1321# define SSI_CONFIG_BM_MASK (0x3 << 8)
1325# define SSI_CONFIG_CE (1<<7) 1322# define SSI_CONFIG_CE (1 << 7)
1326# define SSI_CONFIG_DP (1<<6) 1323# define SSI_CONFIG_DP (1 << 6)
1327# define SSI_CONFIG_DL (1<<5) 1324# define SSI_CONFIG_DL (1 << 5)
1328# define SSI_CONFIG_EP (1<<4) 1325# define SSI_CONFIG_EP (1 << 4)
1329#define SSI0_ADATA 0xB1600024 1326#define SSI0_ADATA 0xB1600024
1330# define SSI_AD_D (1<<24) 1327# define SSI_AD_D (1 << 24)
1331# define SSI_AD_ADDR_BIT 16 1328# define SSI_AD_ADDR_BIT 16
1332# define SSI_AD_ADDR_MASK (0xff<<16) 1329# define SSI_AD_ADDR_MASK (0xff << 16)
1333# define SSI_AD_DATA_BIT 0 1330# define SSI_AD_DATA_BIT 0
1334# define SSI_AD_DATA_MASK (0xfff<<0) 1331# define SSI_AD_DATA_MASK (0xfff << 0)
1335#define SSI0_CLKDIV 0xB1600028 1332#define SSI0_CLKDIV 0xB1600028
1336#define SSI0_CONTROL 0xB1600100 1333#define SSI0_CONTROL 0xB1600100
1337# define SSI_CONTROL_CD (1<<1) 1334# define SSI_CONTROL_CD (1 << 1)
1338# define SSI_CONTROL_E (1<<0) 1335# define SSI_CONTROL_E (1 << 0)
1339 1336
1340/* SSI1 */ 1337/* SSI1 */
1341#define SSI1_STATUS 0xB1680000 1338#define SSI1_STATUS 0xB1680000
1342#define SSI1_INT 0xB1680004 1339#define SSI1_INT 0xB1680004
1343#define SSI1_INT_ENABLE 0xB1680008 1340#define SSI1_INT_ENABLE 0xB1680008
1344#define SSI1_CONFIG 0xB1680020 1341#define SSI1_CONFIG 0xB1680020
1345#define SSI1_ADATA 0xB1680024 1342#define SSI1_ADATA 0xB1680024
1346#define SSI1_CLKDIV 0xB1680028 1343#define SSI1_CLKDIV 0xB1680028
1347#define SSI1_ENABLE 0xB1680100 1344#define SSI1_ENABLE 0xB1680100
1348 1345
1349/* 1346/*
1350 * Register content definitions 1347 * Register content definitions
1351 */ 1348 */
1352#define SSI_STATUS_BF (1<<4) 1349#define SSI_STATUS_BF (1 << 4)
1353#define SSI_STATUS_OF (1<<3) 1350#define SSI_STATUS_OF (1 << 3)
1354#define SSI_STATUS_UF (1<<2) 1351#define SSI_STATUS_UF (1 << 2)
1355#define SSI_STATUS_D (1<<1) 1352#define SSI_STATUS_D (1 << 1)
1356#define SSI_STATUS_B (1<<0) 1353#define SSI_STATUS_B (1 << 0)
1357 1354
1358/* SSI_INT */ 1355/* SSI_INT */
1359#define SSI_INT_OI (1<<3) 1356#define SSI_INT_OI (1 << 3)
1360#define SSI_INT_UI (1<<2) 1357#define SSI_INT_UI (1 << 2)
1361#define SSI_INT_DI (1<<1) 1358#define SSI_INT_DI (1 << 1)
1362 1359
1363/* SSI_INTEN */ 1360/* SSI_INTEN */
1364#define SSI_INTEN_OIE (1<<3) 1361#define SSI_INTEN_OIE (1 << 3)
1365#define SSI_INTEN_UIE (1<<2) 1362#define SSI_INTEN_UIE (1 << 2)
1366#define SSI_INTEN_DIE (1<<1) 1363#define SSI_INTEN_DIE (1 << 1)
1367 1364
1368#define SSI_CONFIG_AO (1<<24) 1365#define SSI_CONFIG_AO (1 << 24)
1369#define SSI_CONFIG_DO (1<<23) 1366#define SSI_CONFIG_DO (1 << 23)
1370#define SSI_CONFIG_ALEN (7<<20) 1367#define SSI_CONFIG_ALEN (7 << 20)
1371#define SSI_CONFIG_DLEN (15<<16) 1368#define SSI_CONFIG_DLEN (15 << 16)
1372#define SSI_CONFIG_DD (1<<11) 1369#define SSI_CONFIG_DD (1 << 11)
1373#define SSI_CONFIG_AD (1<<10) 1370#define SSI_CONFIG_AD (1 << 10)
1374#define SSI_CONFIG_BM (3<<8) 1371#define SSI_CONFIG_BM (3 << 8)
1375#define SSI_CONFIG_CE (1<<7) 1372#define SSI_CONFIG_CE (1 << 7)
1376#define SSI_CONFIG_DP (1<<6) 1373#define SSI_CONFIG_DP (1 << 6)
1377#define SSI_CONFIG_DL (1<<5) 1374#define SSI_CONFIG_DL (1 << 5)
1378#define SSI_CONFIG_EP (1<<4) 1375#define SSI_CONFIG_EP (1 << 4)
1379#define SSI_CONFIG_ALEN_N(N) ((N-1)<<20) 1376#define SSI_CONFIG_ALEN_N(N) ((N-1) << 20)
1380#define SSI_CONFIG_DLEN_N(N) ((N-1)<<16) 1377#define SSI_CONFIG_DLEN_N(N) ((N-1) << 16)
1381#define SSI_CONFIG_BM_HI (0<<8) 1378#define SSI_CONFIG_BM_HI (0 << 8)
1382#define SSI_CONFIG_BM_LO (1<<8) 1379#define SSI_CONFIG_BM_LO (1 << 8)
1383#define SSI_CONFIG_BM_CY (2<<8) 1380#define SSI_CONFIG_BM_CY (2 << 8)
1384 1381
1385#define SSI_ADATA_D (1<<24) 1382#define SSI_ADATA_D (1 << 24)
1386#define SSI_ADATA_ADDR (0xFF<<16) 1383#define SSI_ADATA_ADDR (0xFF << 16)
1387#define SSI_ADATA_DATA (0x0FFF) 1384#define SSI_ADATA_DATA 0x0FFF
1388#define SSI_ADATA_ADDR_N(N) (N<<16) 1385#define SSI_ADATA_ADDR_N(N) (N << 16)
1389 1386
1390#define SSI_ENABLE_CD (1<<1) 1387#define SSI_ENABLE_CD (1 << 1)
1391#define SSI_ENABLE_E (1<<0) 1388#define SSI_ENABLE_E (1 << 0)
1392
1393 1389
1394/* IrDA Controller */ 1390/* IrDA Controller */
1395#define IRDA_BASE 0xB0300000 1391#define IRDA_BASE 0xB0300000
1396#define IR_RING_PTR_STATUS (IRDA_BASE+0x00) 1392#define IR_RING_PTR_STATUS (IRDA_BASE + 0x00)
1397#define IR_RING_BASE_ADDR_H (IRDA_BASE+0x04) 1393#define IR_RING_BASE_ADDR_H (IRDA_BASE + 0x04)
1398#define IR_RING_BASE_ADDR_L (IRDA_BASE+0x08) 1394#define IR_RING_BASE_ADDR_L (IRDA_BASE + 0x08)
1399#define IR_RING_SIZE (IRDA_BASE+0x0C) 1395#define IR_RING_SIZE (IRDA_BASE + 0x0C)
1400#define IR_RING_PROMPT (IRDA_BASE+0x10) 1396#define IR_RING_PROMPT (IRDA_BASE + 0x10)
1401#define IR_RING_ADDR_CMPR (IRDA_BASE+0x14) 1397#define IR_RING_ADDR_CMPR (IRDA_BASE + 0x14)
1402#define IR_INT_CLEAR (IRDA_BASE+0x18) 1398#define IR_INT_CLEAR (IRDA_BASE + 0x18)
1403#define IR_CONFIG_1 (IRDA_BASE+0x20) 1399#define IR_CONFIG_1 (IRDA_BASE + 0x20)
1404# define IR_RX_INVERT_LED (1<<0) 1400# define IR_RX_INVERT_LED (1 << 0)
1405# define IR_TX_INVERT_LED (1<<1) 1401# define IR_TX_INVERT_LED (1 << 1)
1406# define IR_ST (1<<2) 1402# define IR_ST (1 << 2)
1407# define IR_SF (1<<3) 1403# define IR_SF (1 << 3)
1408# define IR_SIR (1<<4) 1404# define IR_SIR (1 << 4)
1409# define IR_MIR (1<<5) 1405# define IR_MIR (1 << 5)
1410# define IR_FIR (1<<6) 1406# define IR_FIR (1 << 6)
1411# define IR_16CRC (1<<7) 1407# define IR_16CRC (1 << 7)
1412# define IR_TD (1<<8) 1408# define IR_TD (1 << 8)
1413# define IR_RX_ALL (1<<9) 1409# define IR_RX_ALL (1 << 9)
1414# define IR_DMA_ENABLE (1<<10) 1410# define IR_DMA_ENABLE (1 << 10)
1415# define IR_RX_ENABLE (1<<11) 1411# define IR_RX_ENABLE (1 << 11)
1416# define IR_TX_ENABLE (1<<12) 1412# define IR_TX_ENABLE (1 << 12)
1417# define IR_LOOPBACK (1<<14) 1413# define IR_LOOPBACK (1 << 14)
1418# define IR_SIR_MODE (IR_SIR | IR_DMA_ENABLE | \ 1414# define IR_SIR_MODE (IR_SIR | IR_DMA_ENABLE | \
1419 IR_RX_ALL | IR_RX_ENABLE | IR_SF | IR_16CRC) 1415 IR_RX_ALL | IR_RX_ENABLE | IR_SF | IR_16CRC)
1420#define IR_SIR_FLAGS (IRDA_BASE+0x24) 1416#define IR_SIR_FLAGS (IRDA_BASE + 0x24)
1421#define IR_ENABLE (IRDA_BASE+0x28) 1417#define IR_ENABLE (IRDA_BASE + 0x28)
1422# define IR_RX_STATUS (1<<9) 1418# define IR_RX_STATUS (1 << 9)
1423# define IR_TX_STATUS (1<<10) 1419# define IR_TX_STATUS (1 << 10)
1424#define IR_READ_PHY_CONFIG (IRDA_BASE+0x2C) 1420#define IR_READ_PHY_CONFIG (IRDA_BASE + 0x2C)
1425#define IR_WRITE_PHY_CONFIG (IRDA_BASE+0x30) 1421#define IR_WRITE_PHY_CONFIG (IRDA_BASE + 0x30)
1426#define IR_MAX_PKT_LEN (IRDA_BASE+0x34) 1422#define IR_MAX_PKT_LEN (IRDA_BASE + 0x34)
1427#define IR_RX_BYTE_CNT (IRDA_BASE+0x38) 1423#define IR_RX_BYTE_CNT (IRDA_BASE + 0x38)
1428#define IR_CONFIG_2 (IRDA_BASE+0x3C) 1424#define IR_CONFIG_2 (IRDA_BASE + 0x3C)
1429# define IR_MODE_INV (1<<0) 1425# define IR_MODE_INV (1 << 0)
1430# define IR_ONE_PIN (1<<1) 1426# define IR_ONE_PIN (1 << 1)
1431#define IR_INTERFACE_CONFIG (IRDA_BASE+0x40) 1427#define IR_INTERFACE_CONFIG (IRDA_BASE + 0x40)
1432 1428
1433/* GPIO */ 1429/* GPIO */
1434#define SYS_PINFUNC 0xB190002C 1430#define SYS_PINFUNC 0xB190002C
1435# define SYS_PF_USB (1<<15) /* 2nd USB device/host */ 1431# define SYS_PF_USB (1 << 15) /* 2nd USB device/host */
1436# define SYS_PF_U3 (1<<14) /* GPIO23/U3TXD */ 1432# define SYS_PF_U3 (1 << 14) /* GPIO23/U3TXD */
1437# define SYS_PF_U2 (1<<13) /* GPIO22/U2TXD */ 1433# define SYS_PF_U2 (1 << 13) /* GPIO22/U2TXD */
1438# define SYS_PF_U1 (1<<12) /* GPIO21/U1TXD */ 1434# define SYS_PF_U1 (1 << 12) /* GPIO21/U1TXD */
1439# define SYS_PF_SRC (1<<11) /* GPIO6/SROMCKE */ 1435# define SYS_PF_SRC (1 << 11) /* GPIO6/SROMCKE */
1440# define SYS_PF_CK5 (1<<10) /* GPIO3/CLK5 */ 1436# define SYS_PF_CK5 (1 << 10) /* GPIO3/CLK5 */
1441# define SYS_PF_CK4 (1<<9) /* GPIO2/CLK4 */ 1437# define SYS_PF_CK4 (1 << 9) /* GPIO2/CLK4 */
1442# define SYS_PF_IRF (1<<8) /* GPIO15/IRFIRSEL */ 1438# define SYS_PF_IRF (1 << 8) /* GPIO15/IRFIRSEL */
1443# define SYS_PF_UR3 (1<<7) /* GPIO[14:9]/UART3 */ 1439# define SYS_PF_UR3 (1 << 7) /* GPIO[14:9]/UART3 */
1444# define SYS_PF_I2D (1<<6) /* GPIO8/I2SDI */ 1440# define SYS_PF_I2D (1 << 6) /* GPIO8/I2SDI */
1445# define SYS_PF_I2S (1<<5) /* I2S/GPIO[29:31] */ 1441# define SYS_PF_I2S (1 << 5) /* I2S/GPIO[29:31] */
1446# define SYS_PF_NI2 (1<<4) /* NI2/GPIO[24:28] */ 1442# define SYS_PF_NI2 (1 << 4) /* NI2/GPIO[24:28] */
1447# define SYS_PF_U0 (1<<3) /* U0TXD/GPIO20 */ 1443# define SYS_PF_U0 (1 << 3) /* U0TXD/GPIO20 */
1448# define SYS_PF_RD (1<<2) /* IRTXD/GPIO19 */ 1444# define SYS_PF_RD (1 << 2) /* IRTXD/GPIO19 */
1449# define SYS_PF_A97 (1<<1) /* AC97/SSL1 */ 1445# define SYS_PF_A97 (1 << 1) /* AC97/SSL1 */
1450# define SYS_PF_S0 (1<<0) /* SSI_0/GPIO[16:18] */ 1446# define SYS_PF_S0 (1 << 0) /* SSI_0/GPIO[16:18] */
1451 1447
1452/* Au1100 Only */ 1448/* Au1100 only */
1453# define SYS_PF_PC (1<<18) /* PCMCIA/GPIO[207:204] */ 1449# define SYS_PF_PC (1 << 18) /* PCMCIA/GPIO[207:204] */
1454# define SYS_PF_LCD (1<<17) /* extern lcd/GPIO[203:200] */ 1450# define SYS_PF_LCD (1 << 17) /* extern lcd/GPIO[203:200] */
1455# define SYS_PF_CS (1<<16) /* EXTCLK0/32khz to gpio2 */ 1451# define SYS_PF_CS (1 << 16) /* EXTCLK0/32KHz to gpio2 */
1456# define SYS_PF_EX0 (1<<9) /* gpio2/clock */ 1452# define SYS_PF_EX0 (1 << 9) /* GPIO2/clock */
1457 1453
1458/* Au1550 Only. Redefines lots of pins */ 1454/* Au1550 only. Redefines lots of pins */
1459# define SYS_PF_PSC2_MASK (7 << 17) 1455# define SYS_PF_PSC2_MASK (7 << 17)
1460# define SYS_PF_PSC2_AC97 (0) 1456# define SYS_PF_PSC2_AC97 0
1461# define SYS_PF_PSC2_SPI (0) 1457# define SYS_PF_PSC2_SPI 0
1462# define SYS_PF_PSC2_I2S (1 << 17) 1458# define SYS_PF_PSC2_I2S (1 << 17)
1463# define SYS_PF_PSC2_SMBUS (3 << 17) 1459# define SYS_PF_PSC2_SMBUS (3 << 17)
1464# define SYS_PF_PSC2_GPIO (7 << 17) 1460# define SYS_PF_PSC2_GPIO (7 << 17)
1465# define SYS_PF_PSC3_MASK (7 << 20) 1461# define SYS_PF_PSC3_MASK (7 << 20)
1466# define SYS_PF_PSC3_AC97 (0) 1462# define SYS_PF_PSC3_AC97 0
1467# define SYS_PF_PSC3_SPI (0) 1463# define SYS_PF_PSC3_SPI 0
1468# define SYS_PF_PSC3_I2S (1 << 20) 1464# define SYS_PF_PSC3_I2S (1 << 20)
1469# define SYS_PF_PSC3_SMBUS (3 << 20) 1465# define SYS_PF_PSC3_SMBUS (3 << 20)
1470# define SYS_PF_PSC3_GPIO (7 << 20) 1466# define SYS_PF_PSC3_GPIO (7 << 20)
1471# define SYS_PF_PSC1_S1 (1 << 1) 1467# define SYS_PF_PSC1_S1 (1 << 1)
1472# define SYS_PF_MUST_BE_SET ((1 << 5) | (1 << 2)) 1468# define SYS_PF_MUST_BE_SET ((1 << 5) | (1 << 2))
1473 1469
1474/* Au1200 Only */ 1470/* Au1200 only */
1475#ifdef CONFIG_SOC_AU1200 1471#ifdef CONFIG_SOC_AU1200
1476#define SYS_PINFUNC_DMA (1<<31) 1472#define SYS_PINFUNC_DMA (1 << 31)
1477#define SYS_PINFUNC_S0A (1<<30) 1473#define SYS_PINFUNC_S0A (1 << 30)
1478#define SYS_PINFUNC_S1A (1<<29) 1474#define SYS_PINFUNC_S1A (1 << 29)
1479#define SYS_PINFUNC_LP0 (1<<28) 1475#define SYS_PINFUNC_LP0 (1 << 28)
1480#define SYS_PINFUNC_LP1 (1<<27) 1476#define SYS_PINFUNC_LP1 (1 << 27)
1481#define SYS_PINFUNC_LD16 (1<<26) 1477#define SYS_PINFUNC_LD16 (1 << 26)
1482#define SYS_PINFUNC_LD8 (1<<25) 1478#define SYS_PINFUNC_LD8 (1 << 25)
1483#define SYS_PINFUNC_LD1 (1<<24) 1479#define SYS_PINFUNC_LD1 (1 << 24)
1484#define SYS_PINFUNC_LD0 (1<<23) 1480#define SYS_PINFUNC_LD0 (1 << 23)
1485#define SYS_PINFUNC_P1A (3<<21) 1481#define SYS_PINFUNC_P1A (3 << 21)
1486#define SYS_PINFUNC_P1B (1<<20) 1482#define SYS_PINFUNC_P1B (1 << 20)
1487#define SYS_PINFUNC_FS3 (1<<19) 1483#define SYS_PINFUNC_FS3 (1 << 19)
1488#define SYS_PINFUNC_P0A (3<<17) 1484#define SYS_PINFUNC_P0A (3 << 17)
1489#define SYS_PINFUNC_CS (1<<16) 1485#define SYS_PINFUNC_CS (1 << 16)
1490#define SYS_PINFUNC_CIM (1<<15) 1486#define SYS_PINFUNC_CIM (1 << 15)
1491#define SYS_PINFUNC_P1C (1<<14) 1487#define SYS_PINFUNC_P1C (1 << 14)
1492#define SYS_PINFUNC_U1T (1<<12) 1488#define SYS_PINFUNC_U1T (1 << 12)
1493#define SYS_PINFUNC_U1R (1<<11) 1489#define SYS_PINFUNC_U1R (1 << 11)
1494#define SYS_PINFUNC_EX1 (1<<10) 1490#define SYS_PINFUNC_EX1 (1 << 10)
1495#define SYS_PINFUNC_EX0 (1<<9) 1491#define SYS_PINFUNC_EX0 (1 << 9)
1496#define SYS_PINFUNC_U0R (1<<8) 1492#define SYS_PINFUNC_U0R (1 << 8)
1497#define SYS_PINFUNC_MC (1<<7) 1493#define SYS_PINFUNC_MC (1 << 7)
1498#define SYS_PINFUNC_S0B (1<<6) 1494#define SYS_PINFUNC_S0B (1 << 6)
1499#define SYS_PINFUNC_S0C (1<<5) 1495#define SYS_PINFUNC_S0C (1 << 5)
1500#define SYS_PINFUNC_P0B (1<<4) 1496#define SYS_PINFUNC_P0B (1 << 4)
1501#define SYS_PINFUNC_U0T (1<<3) 1497#define SYS_PINFUNC_U0T (1 << 3)
1502#define SYS_PINFUNC_S1B (1<<2) 1498#define SYS_PINFUNC_S1B (1 << 2)
1503#endif 1499#endif
1504 1500
1505#define SYS_TRIOUTRD 0xB1900100 1501#define SYS_TRIOUTRD 0xB1900100
1506#define SYS_TRIOUTCLR 0xB1900100 1502#define SYS_TRIOUTCLR 0xB1900100
1507#define SYS_OUTPUTRD 0xB1900108 1503#define SYS_OUTPUTRD 0xB1900108
1508#define SYS_OUTPUTSET 0xB1900108 1504#define SYS_OUTPUTSET 0xB1900108
1509#define SYS_OUTPUTCLR 0xB190010C 1505#define SYS_OUTPUTCLR 0xB190010C
1510#define SYS_PINSTATERD 0xB1900110 1506#define SYS_PINSTATERD 0xB1900110
1511#define SYS_PININPUTEN 0xB1900110 1507#define SYS_PININPUTEN 0xB1900110
1512 1508
1513/* GPIO2, Au1500, Au1550 only */ 1509/* GPIO2, Au1500, Au1550 only */
1514#define GPIO2_BASE 0xB1700000 1510#define GPIO2_BASE 0xB1700000
1515#define GPIO2_DIR (GPIO2_BASE + 0) 1511#define GPIO2_DIR (GPIO2_BASE + 0)
1516#define GPIO2_OUTPUT (GPIO2_BASE + 8) 1512#define GPIO2_OUTPUT (GPIO2_BASE + 8)
1517#define GPIO2_PINSTATE (GPIO2_BASE + 0xC) 1513#define GPIO2_PINSTATE (GPIO2_BASE + 0xC)
1518#define GPIO2_INTENABLE (GPIO2_BASE + 0x10) 1514#define GPIO2_INTENABLE (GPIO2_BASE + 0x10)
1519#define GPIO2_ENABLE (GPIO2_BASE + 0x14) 1515#define GPIO2_ENABLE (GPIO2_BASE + 0x14)
1520 1516
1521/* Power Management */ 1517/* Power Management */
1522#define SYS_SCRATCH0 0xB1900018 1518#define SYS_SCRATCH0 0xB1900018
1523#define SYS_SCRATCH1 0xB190001C 1519#define SYS_SCRATCH1 0xB190001C
1524#define SYS_WAKEMSK 0xB1900034 1520#define SYS_WAKEMSK 0xB1900034
1525#define SYS_ENDIAN 0xB1900038 1521#define SYS_ENDIAN 0xB1900038
1526#define SYS_POWERCTRL 0xB190003C 1522#define SYS_POWERCTRL 0xB190003C
1527#define SYS_WAKESRC 0xB190005C 1523#define SYS_WAKESRC 0xB190005C
1528#define SYS_SLPPWR 0xB1900078 1524#define SYS_SLPPWR 0xB1900078
1529#define SYS_SLEEP 0xB190007C 1525#define SYS_SLEEP 0xB190007C
1530 1526
1531/* Clock Controller */ 1527/* Clock Controller */
1532#define SYS_FREQCTRL0 0xB1900020 1528#define SYS_FREQCTRL0 0xB1900020
1533# define SYS_FC_FRDIV2_BIT 22 1529# define SYS_FC_FRDIV2_BIT 22
1534# define SYS_FC_FRDIV2_MASK (0xff << SYS_FC_FRDIV2_BIT) 1530# define SYS_FC_FRDIV2_MASK (0xff << SYS_FC_FRDIV2_BIT)
1535# define SYS_FC_FE2 (1<<21) 1531# define SYS_FC_FE2 (1 << 21)
1536# define SYS_FC_FS2 (1<<20) 1532# define SYS_FC_FS2 (1 << 20)
1537# define SYS_FC_FRDIV1_BIT 12 1533# define SYS_FC_FRDIV1_BIT 12
1538# define SYS_FC_FRDIV1_MASK (0xff << SYS_FC_FRDIV1_BIT) 1534# define SYS_FC_FRDIV1_MASK (0xff << SYS_FC_FRDIV1_BIT)
1539# define SYS_FC_FE1 (1<<11) 1535# define SYS_FC_FE1 (1 << 11)
1540# define SYS_FC_FS1 (1<<10) 1536# define SYS_FC_FS1 (1 << 10)
1541# define SYS_FC_FRDIV0_BIT 2 1537# define SYS_FC_FRDIV0_BIT 2
1542# define SYS_FC_FRDIV0_MASK (0xff << SYS_FC_FRDIV0_BIT) 1538# define SYS_FC_FRDIV0_MASK (0xff << SYS_FC_FRDIV0_BIT)
1543# define SYS_FC_FE0 (1<<1) 1539# define SYS_FC_FE0 (1 << 1)
1544# define SYS_FC_FS0 (1<<0) 1540# define SYS_FC_FS0 (1 << 0)
1545#define SYS_FREQCTRL1 0xB1900024 1541#define SYS_FREQCTRL1 0xB1900024
1546# define SYS_FC_FRDIV5_BIT 22 1542# define SYS_FC_FRDIV5_BIT 22
1547# define SYS_FC_FRDIV5_MASK (0xff << SYS_FC_FRDIV5_BIT) 1543# define SYS_FC_FRDIV5_MASK (0xff << SYS_FC_FRDIV5_BIT)
1548# define SYS_FC_FE5 (1<<21) 1544# define SYS_FC_FE5 (1 << 21)
1549# define SYS_FC_FS5 (1<<20) 1545# define SYS_FC_FS5 (1 << 20)
1550# define SYS_FC_FRDIV4_BIT 12 1546# define SYS_FC_FRDIV4_BIT 12
1551# define SYS_FC_FRDIV4_MASK (0xff << SYS_FC_FRDIV4_BIT) 1547# define SYS_FC_FRDIV4_MASK (0xff << SYS_FC_FRDIV4_BIT)
1552# define SYS_FC_FE4 (1<<11) 1548# define SYS_FC_FE4 (1 << 11)
1553# define SYS_FC_FS4 (1<<10) 1549# define SYS_FC_FS4 (1 << 10)
1554# define SYS_FC_FRDIV3_BIT 2 1550# define SYS_FC_FRDIV3_BIT 2
1555# define SYS_FC_FRDIV3_MASK (0xff << SYS_FC_FRDIV3_BIT) 1551# define SYS_FC_FRDIV3_MASK (0xff << SYS_FC_FRDIV3_BIT)
1556# define SYS_FC_FE3 (1<<1) 1552# define SYS_FC_FE3 (1 << 1)
1557# define SYS_FC_FS3 (1<<0) 1553# define SYS_FC_FS3 (1 << 0)
1558#define SYS_CLKSRC 0xB1900028 1554#define SYS_CLKSRC 0xB1900028
1559# define SYS_CS_ME1_BIT 27 1555# define SYS_CS_ME1_BIT 27
1560# define SYS_CS_ME1_MASK (0x7<<SYS_CS_ME1_BIT) 1556# define SYS_CS_ME1_MASK (0x7 << SYS_CS_ME1_BIT)
1561# define SYS_CS_DE1 (1<<26) 1557# define SYS_CS_DE1 (1 << 26)
1562# define SYS_CS_CE1 (1<<25) 1558# define SYS_CS_CE1 (1 << 25)
1563# define SYS_CS_ME0_BIT 22 1559# define SYS_CS_ME0_BIT 22
1564# define SYS_CS_ME0_MASK (0x7<<SYS_CS_ME0_BIT) 1560# define SYS_CS_ME0_MASK (0x7 << SYS_CS_ME0_BIT)
1565# define SYS_CS_DE0 (1<<21) 1561# define SYS_CS_DE0 (1 << 21)
1566# define SYS_CS_CE0 (1<<20) 1562# define SYS_CS_CE0 (1 << 20)
1567# define SYS_CS_MI2_BIT 17 1563# define SYS_CS_MI2_BIT 17
1568# define SYS_CS_MI2_MASK (0x7<<SYS_CS_MI2_BIT) 1564# define SYS_CS_MI2_MASK (0x7 << SYS_CS_MI2_BIT)
1569# define SYS_CS_DI2 (1<<16) 1565# define SYS_CS_DI2 (1 << 16)
1570# define SYS_CS_CI2 (1<<15) 1566# define SYS_CS_CI2 (1 << 15)
1571#ifdef CONFIG_SOC_AU1100 1567#ifdef CONFIG_SOC_AU1100
1572# define SYS_CS_ML_BIT 7 1568# define SYS_CS_ML_BIT 7
1573# define SYS_CS_ML_MASK (0x7<<SYS_CS_ML_BIT) 1569# define SYS_CS_ML_MASK (0x7 << SYS_CS_ML_BIT)
1574# define SYS_CS_DL (1<<6) 1570# define SYS_CS_DL (1 << 6)
1575# define SYS_CS_CL (1<<5) 1571# define SYS_CS_CL (1 << 5)
1576#else 1572#else
1577# define SYS_CS_MUH_BIT 12 1573# define SYS_CS_MUH_BIT 12
1578# define SYS_CS_MUH_MASK (0x7<<SYS_CS_MUH_BIT) 1574# define SYS_CS_MUH_MASK (0x7 << SYS_CS_MUH_BIT)
1579# define SYS_CS_DUH (1<<11) 1575# define SYS_CS_DUH (1 << 11)
1580# define SYS_CS_CUH (1<<10) 1576# define SYS_CS_CUH (1 << 10)
1581# define SYS_CS_MUD_BIT 7 1577# define SYS_CS_MUD_BIT 7
1582# define SYS_CS_MUD_MASK (0x7<<SYS_CS_MUD_BIT) 1578# define SYS_CS_MUD_MASK (0x7 << SYS_CS_MUD_BIT)
1583# define SYS_CS_DUD (1<<6) 1579# define SYS_CS_DUD (1 << 6)
1584# define SYS_CS_CUD (1<<5) 1580# define SYS_CS_CUD (1 << 5)
1585#endif 1581#endif
1586# define SYS_CS_MIR_BIT 2 1582# define SYS_CS_MIR_BIT 2
1587# define SYS_CS_MIR_MASK (0x7<<SYS_CS_MIR_BIT) 1583# define SYS_CS_MIR_MASK (0x7 << SYS_CS_MIR_BIT)
1588# define SYS_CS_DIR (1<<1) 1584# define SYS_CS_DIR (1 << 1)
1589# define SYS_CS_CIR (1<<0) 1585# define SYS_CS_CIR (1 << 0)
1590 1586
1591# define SYS_CS_MUX_AUX 0x1 1587# define SYS_CS_MUX_AUX 0x1
1592# define SYS_CS_MUX_FQ0 0x2 1588# define SYS_CS_MUX_FQ0 0x2
1593# define SYS_CS_MUX_FQ1 0x3 1589# define SYS_CS_MUX_FQ1 0x3
1594# define SYS_CS_MUX_FQ2 0x4 1590# define SYS_CS_MUX_FQ2 0x4
1595# define SYS_CS_MUX_FQ3 0x5 1591# define SYS_CS_MUX_FQ3 0x5
1596# define SYS_CS_MUX_FQ4 0x6 1592# define SYS_CS_MUX_FQ4 0x6
1597# define SYS_CS_MUX_FQ5 0x7 1593# define SYS_CS_MUX_FQ5 0x7
1598#define SYS_CPUPLL 0xB1900060 1594#define SYS_CPUPLL 0xB1900060
1599#define SYS_AUXPLL 0xB1900064 1595#define SYS_AUXPLL 0xB1900064
1600 1596
1601/* AC97 Controller */ 1597/* AC97 Controller */
1602#define AC97C_CONFIG 0xB0000000 1598#define AC97C_CONFIG 0xB0000000
1603# define AC97C_RECV_SLOTS_BIT 13 1599# define AC97C_RECV_SLOTS_BIT 13
1604# define AC97C_RECV_SLOTS_MASK (0x3ff << AC97C_RECV_SLOTS_BIT) 1600# define AC97C_RECV_SLOTS_MASK (0x3ff << AC97C_RECV_SLOTS_BIT)
1605# define AC97C_XMIT_SLOTS_BIT 3 1601# define AC97C_XMIT_SLOTS_BIT 3
1606# define AC97C_XMIT_SLOTS_MASK (0x3ff << AC97C_XMIT_SLOTS_BIT) 1602# define AC97C_XMIT_SLOTS_MASK (0x3ff << AC97C_XMIT_SLOTS_BIT)
1607# define AC97C_SG (1<<2) 1603# define AC97C_SG (1 << 2)
1608# define AC97C_SYNC (1<<1) 1604# define AC97C_SYNC (1 << 1)
1609# define AC97C_RESET (1<<0) 1605# define AC97C_RESET (1 << 0)
1610#define AC97C_STATUS 0xB0000004 1606#define AC97C_STATUS 0xB0000004
1611# define AC97C_XU (1<<11) 1607# define AC97C_XU (1 << 11)
1612# define AC97C_XO (1<<10) 1608# define AC97C_XO (1 << 10)
1613# define AC97C_RU (1<<9) 1609# define AC97C_RU (1 << 9)
1614# define AC97C_RO (1<<8) 1610# define AC97C_RO (1 << 8)
1615# define AC97C_READY (1<<7) 1611# define AC97C_READY (1 << 7)
1616# define AC97C_CP (1<<6) 1612# define AC97C_CP (1 << 6)
1617# define AC97C_TR (1<<5) 1613# define AC97C_TR (1 << 5)
1618# define AC97C_TE (1<<4) 1614# define AC97C_TE (1 << 4)
1619# define AC97C_TF (1<<3) 1615# define AC97C_TF (1 << 3)
1620# define AC97C_RR (1<<2) 1616# define AC97C_RR (1 << 2)
1621# define AC97C_RE (1<<1) 1617# define AC97C_RE (1 << 1)
1622# define AC97C_RF (1<<0) 1618# define AC97C_RF (1 << 0)
1623#define AC97C_DATA 0xB0000008 1619#define AC97C_DATA 0xB0000008
1624#define AC97C_CMD 0xB000000C 1620#define AC97C_CMD 0xB000000C
1625# define AC97C_WD_BIT 16 1621# define AC97C_WD_BIT 16
1626# define AC97C_READ (1<<7) 1622# define AC97C_READ (1 << 7)
1627# define AC97C_INDEX_MASK 0x7f 1623# define AC97C_INDEX_MASK 0x7f
1628#define AC97C_CNTRL 0xB0000010 1624#define AC97C_CNTRL 0xB0000010
1629# define AC97C_RS (1<<1) 1625# define AC97C_RS (1 << 1)
1630# define AC97C_CE (1<<0) 1626# define AC97C_CE (1 << 0)
1631
1632 1627
1633/* Secure Digital (SD) Controller */ 1628/* Secure Digital (SD) Controller */
1634#define SD0_XMIT_FIFO 0xB0600000 1629#define SD0_XMIT_FIFO 0xB0600000
@@ -1638,73 +1633,74 @@ enum soc_au1200_ints {
1638 1633
1639#if defined(CONFIG_SOC_AU1500) || defined(CONFIG_SOC_AU1550) 1634#if defined(CONFIG_SOC_AU1500) || defined(CONFIG_SOC_AU1550)
1640/* Au1500 PCI Controller */ 1635/* Au1500 PCI Controller */
1641#define Au1500_CFG_BASE 0xB4005000 // virtual, kseg0 addr 1636#define Au1500_CFG_BASE 0xB4005000 /* virtual, KSEG1 addr */
1642#define Au1500_PCI_CMEM (Au1500_CFG_BASE + 0) 1637#define Au1500_PCI_CMEM (Au1500_CFG_BASE + 0)
1643#define Au1500_PCI_CFG (Au1500_CFG_BASE + 4) 1638#define Au1500_PCI_CFG (Au1500_CFG_BASE + 4)
1644# define PCI_ERROR ((1<<22) | (1<<23) | (1<<24) | (1<<25) | (1<<26) | (1<<27)) 1639# define PCI_ERROR ((1 << 22) | (1 << 23) | (1 << 24) | \
1645#define Au1500_PCI_B2BMASK_CCH (Au1500_CFG_BASE + 8) 1640 (1 << 25) | (1 << 26) | (1 << 27))
1646#define Au1500_PCI_B2B0_VID (Au1500_CFG_BASE + 0xC) 1641#define Au1500_PCI_B2BMASK_CCH (Au1500_CFG_BASE + 8)
1647#define Au1500_PCI_B2B1_ID (Au1500_CFG_BASE + 0x10) 1642#define Au1500_PCI_B2B0_VID (Au1500_CFG_BASE + 0xC)
1648#define Au1500_PCI_MWMASK_DEV (Au1500_CFG_BASE + 0x14) 1643#define Au1500_PCI_B2B1_ID (Au1500_CFG_BASE + 0x10)
1644#define Au1500_PCI_MWMASK_DEV (Au1500_CFG_BASE + 0x14)
1649#define Au1500_PCI_MWBASE_REV_CCL (Au1500_CFG_BASE + 0x18) 1645#define Au1500_PCI_MWBASE_REV_CCL (Au1500_CFG_BASE + 0x18)
1650#define Au1500_PCI_ERR_ADDR (Au1500_CFG_BASE + 0x1C) 1646#define Au1500_PCI_ERR_ADDR (Au1500_CFG_BASE + 0x1C)
1651#define Au1500_PCI_SPEC_INTACK (Au1500_CFG_BASE + 0x20) 1647#define Au1500_PCI_SPEC_INTACK (Au1500_CFG_BASE + 0x20)
1652#define Au1500_PCI_ID (Au1500_CFG_BASE + 0x100) 1648#define Au1500_PCI_ID (Au1500_CFG_BASE + 0x100)
1653#define Au1500_PCI_STATCMD (Au1500_CFG_BASE + 0x104) 1649#define Au1500_PCI_STATCMD (Au1500_CFG_BASE + 0x104)
1654#define Au1500_PCI_CLASSREV (Au1500_CFG_BASE + 0x108) 1650#define Au1500_PCI_CLASSREV (Au1500_CFG_BASE + 0x108)
1655#define Au1500_PCI_HDRTYPE (Au1500_CFG_BASE + 0x10C) 1651#define Au1500_PCI_HDRTYPE (Au1500_CFG_BASE + 0x10C)
1656#define Au1500_PCI_MBAR (Au1500_CFG_BASE + 0x110) 1652#define Au1500_PCI_MBAR (Au1500_CFG_BASE + 0x110)
1657 1653
1658#define Au1500_PCI_HDR 0xB4005100 // virtual, kseg0 addr 1654#define Au1500_PCI_HDR 0xB4005100 /* virtual, KSEG1 addr */
1659 1655
1660/* All of our structures, like pci resource, have 32 bit members. 1656/*
1657 * All of our structures, like PCI resource, have 32-bit members.
1661 * Drivers are expected to do an ioremap on the PCI MEM resource, but it's 1658 * Drivers are expected to do an ioremap on the PCI MEM resource, but it's
1662 * hard to store 0x4 0000 0000 in a 32 bit type. We require a small patch 1659 * hard to store 0x4 0000 0000 in a 32-bit type. We require a small patch
1663 * to __ioremap to check for addresses between (u32)Au1500_PCI_MEM_START and 1660 * to __ioremap to check for addresses between (u32)Au1500_PCI_MEM_START and
1664 * (u32)Au1500_PCI_MEM_END and change those to the full 36 bit PCI MEM 1661 * (u32)Au1500_PCI_MEM_END and change those to the full 36-bit PCI MEM
1665 * addresses. For PCI IO, it's simpler because we get to do the ioremap 1662 * addresses. For PCI I/O, it's simpler because we get to do the ioremap
1666 * ourselves and then adjust the device's resources. 1663 * ourselves and then adjust the device's resources.
1667 */ 1664 */
1668#define Au1500_EXT_CFG 0x600000000ULL 1665#define Au1500_EXT_CFG 0x600000000ULL
1669#define Au1500_EXT_CFG_TYPE1 0x680000000ULL 1666#define Au1500_EXT_CFG_TYPE1 0x680000000ULL
1670#define Au1500_PCI_IO_START 0x500000000ULL 1667#define Au1500_PCI_IO_START 0x500000000ULL
1671#define Au1500_PCI_IO_END 0x5000FFFFFULL 1668#define Au1500_PCI_IO_END 0x5000FFFFFULL
1672#define Au1500_PCI_MEM_START 0x440000000ULL 1669#define Au1500_PCI_MEM_START 0x440000000ULL
1673#define Au1500_PCI_MEM_END 0x44FFFFFFFULL 1670#define Au1500_PCI_MEM_END 0x44FFFFFFFULL
1674 1671
1675#define PCI_IO_START 0x00001000 1672#define PCI_IO_START 0x00001000
1676#define PCI_IO_END 0x000FFFFF 1673#define PCI_IO_END 0x000FFFFF
1677#define PCI_MEM_START 0x40000000 1674#define PCI_MEM_START 0x40000000
1678#define PCI_MEM_END 0x4FFFFFFF 1675#define PCI_MEM_END 0x4FFFFFFF
1679 1676
1680#define PCI_FIRST_DEVFN (0<<3) 1677#define PCI_FIRST_DEVFN (0 << 3)
1681#define PCI_LAST_DEVFN (19<<3) 1678#define PCI_LAST_DEVFN (19 << 3)
1682 1679
1683#define IOPORT_RESOURCE_START 0x00001000 /* skip legacy probing */ 1680#define IOPORT_RESOURCE_START 0x00001000 /* skip legacy probing */
1684#define IOPORT_RESOURCE_END 0xffffffff 1681#define IOPORT_RESOURCE_END 0xffffffff
1685#define IOMEM_RESOURCE_START 0x10000000 1682#define IOMEM_RESOURCE_START 0x10000000
1686#define IOMEM_RESOURCE_END 0xffffffff 1683#define IOMEM_RESOURCE_END 0xffffffff
1687 1684
1688#else /* Au1000 and Au1100 and Au1200 */ 1685#else /* Au1000 and Au1100 and Au1200 */
1689 1686
1690/* don't allow any legacy ports probing */ 1687/* Don't allow any legacy ports probing */
1691#define IOPORT_RESOURCE_START 0x10000000 1688#define IOPORT_RESOURCE_START 0x10000000
1692#define IOPORT_RESOURCE_END 0xffffffff 1689#define IOPORT_RESOURCE_END 0xffffffff
1693#define IOMEM_RESOURCE_START 0x10000000 1690#define IOMEM_RESOURCE_START 0x10000000
1694#define IOMEM_RESOURCE_END 0xffffffff 1691#define IOMEM_RESOURCE_END 0xffffffff
1695 1692
1696#define PCI_IO_START 0 1693#define PCI_IO_START 0
1697#define PCI_IO_END 0 1694#define PCI_IO_END 0
1698#define PCI_MEM_START 0 1695#define PCI_MEM_START 0
1699#define PCI_MEM_END 0 1696#define PCI_MEM_END 0
1700#define PCI_FIRST_DEVFN 0 1697#define PCI_FIRST_DEVFN 0
1701#define PCI_LAST_DEVFN 0 1698#define PCI_LAST_DEVFN 0
1702 1699
1703#endif 1700#endif
1704 1701
1705#ifndef _LANGUAGE_ASSEMBLY 1702#ifndef _LANGUAGE_ASSEMBLY
1706typedef volatile struct 1703typedef volatile struct {
1707{
1708 /* 0x0000 */ u32 toytrim; 1704 /* 0x0000 */ u32 toytrim;
1709 /* 0x0004 */ u32 toywrite; 1705 /* 0x0004 */ u32 toywrite;
1710 /* 0x0008 */ u32 toymatch0; 1706 /* 0x0008 */ u32 toymatch0;
@@ -1746,13 +1742,14 @@ typedef volatile struct
1746 /* 0x010C */ u32 outputclr; 1742 /* 0x010C */ u32 outputclr;
1747 /* 0x0110 */ u32 pinstaterd; 1743 /* 0x0110 */ u32 pinstaterd;
1748#define pininputen pinstaterd 1744#define pininputen pinstaterd
1749
1750} AU1X00_SYS; 1745} AU1X00_SYS;
1751 1746
1752static AU1X00_SYS* const sys = (AU1X00_SYS *)SYS_BASE; 1747static AU1X00_SYS * const sys = (AU1X00_SYS *)SYS_BASE;
1753 1748
1754#endif 1749#endif
1755/* Processor information base on prid. 1750
1751/*
1752 * Processor information based on PRID.
1756 * Copied from PowerPC. 1753 * Copied from PowerPC.
1757 */ 1754 */
1758#ifndef _LANGUAGE_ASSEMBLY 1755#ifndef _LANGUAGE_ASSEMBLY
@@ -1767,9 +1764,8 @@ struct cpu_spec {
1767 unsigned char cpu_pll_wo; /* sys_cpupll reg. write-only */ 1764 unsigned char cpu_pll_wo; /* sys_cpupll reg. write-only */
1768}; 1765};
1769 1766
1770extern struct cpu_spec cpu_specs[]; 1767extern struct cpu_spec cpu_specs[];
1771extern struct cpu_spec *cur_cpu_spec[]; 1768extern struct cpu_spec *cur_cpu_spec[];
1772#endif 1769#endif
1773 1770
1774#endif 1771#endif
1775
diff --git a/include/asm-mips/mach-au1x00/au1000_dma.h b/include/asm-mips/mach-au1x00/au1000_dma.h
index 9f29520e8fb0..c333b4e1cd44 100644
--- a/include/asm-mips/mach-au1x00/au1000_dma.h
+++ b/include/asm-mips/mach-au1x00/au1000_dma.h
@@ -1,11 +1,10 @@
1/* 1/*
2 * BRIEF MODULE DESCRIPTION 2 * BRIEF MODULE DESCRIPTION
3 * Defines for using and allocating dma channels on the Alchemy 3 * Defines for using and allocating DMA channels on the Alchemy
4 * Au1000 mips processor. 4 * Au1x00 MIPS processors.
5 * 5 *
6 * Copyright 2000 MontaVista Software Inc. 6 * Copyright 2000, 2008 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc. 7 * Author: MontaVista Software, Inc. <source@mvista.com>
8 * stevel@mvista.com or source@mvista.com
9 * 8 *
10 * This program is free software; you can redistribute it and/or modify it 9 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the 10 * under the terms of the GNU General Public License as published by the
@@ -31,7 +30,7 @@
31#ifndef __ASM_AU1000_DMA_H 30#ifndef __ASM_AU1000_DMA_H
32#define __ASM_AU1000_DMA_H 31#define __ASM_AU1000_DMA_H
33 32
34#include <asm/io.h> /* need byte IO */ 33#include <linux/io.h> /* need byte IO */
35#include <linux/spinlock.h> /* And spinlocks */ 34#include <linux/spinlock.h> /* And spinlocks */
36#include <linux/delay.h> 35#include <linux/delay.h>
37#include <asm/system.h> 36#include <asm/system.h>
@@ -50,36 +49,36 @@
50#define DMA_DAH_MASK (0x0f << 20) 49#define DMA_DAH_MASK (0x0f << 20)
51#define DMA_DID_BIT 16 50#define DMA_DID_BIT 16
52#define DMA_DID_MASK (0x0f << DMA_DID_BIT) 51#define DMA_DID_MASK (0x0f << DMA_DID_BIT)
53#define DMA_DS (1<<15) 52#define DMA_DS (1 << 15)
54#define DMA_BE (1<<13) 53#define DMA_BE (1 << 13)
55#define DMA_DR (1<<12) 54#define DMA_DR (1 << 12)
56#define DMA_TS8 (1<<11) 55#define DMA_TS8 (1 << 11)
57#define DMA_DW_BIT 9 56#define DMA_DW_BIT 9
58#define DMA_DW_MASK (0x03 << DMA_DW_BIT) 57#define DMA_DW_MASK (0x03 << DMA_DW_BIT)
59#define DMA_DW8 (0 << DMA_DW_BIT) 58#define DMA_DW8 (0 << DMA_DW_BIT)
60#define DMA_DW16 (1 << DMA_DW_BIT) 59#define DMA_DW16 (1 << DMA_DW_BIT)
61#define DMA_DW32 (2 << DMA_DW_BIT) 60#define DMA_DW32 (2 << DMA_DW_BIT)
62#define DMA_NC (1<<8) 61#define DMA_NC (1 << 8)
63#define DMA_IE (1<<7) 62#define DMA_IE (1 << 7)
64#define DMA_HALT (1<<6) 63#define DMA_HALT (1 << 6)
65#define DMA_GO (1<<5) 64#define DMA_GO (1 << 5)
66#define DMA_AB (1<<4) 65#define DMA_AB (1 << 4)
67#define DMA_D1 (1<<3) 66#define DMA_D1 (1 << 3)
68#define DMA_BE1 (1<<2) 67#define DMA_BE1 (1 << 2)
69#define DMA_D0 (1<<1) 68#define DMA_D0 (1 << 1)
70#define DMA_BE0 (1<<0) 69#define DMA_BE0 (1 << 0)
71 70
72#define DMA_PERIPHERAL_ADDR 0x00000008 71#define DMA_PERIPHERAL_ADDR 0x00000008
73#define DMA_BUFFER0_START 0x0000000C 72#define DMA_BUFFER0_START 0x0000000C
74#define DMA_BUFFER1_START 0x00000014 73#define DMA_BUFFER1_START 0x00000014
75#define DMA_BUFFER0_COUNT 0x00000010 74#define DMA_BUFFER0_COUNT 0x00000010
76#define DMA_BUFFER1_COUNT 0x00000018 75#define DMA_BUFFER1_COUNT 0x00000018
77#define DMA_BAH_BIT 16 76#define DMA_BAH_BIT 16
78#define DMA_BAH_MASK (0x0f << DMA_BAH_BIT) 77#define DMA_BAH_MASK (0x0f << DMA_BAH_BIT)
79#define DMA_COUNT_BIT 0 78#define DMA_COUNT_BIT 0
80#define DMA_COUNT_MASK (0xffff << DMA_COUNT_BIT) 79#define DMA_COUNT_MASK (0xffff << DMA_COUNT_BIT)
81 80
82/* DMA Device ID's follow */ 81/* DMA Device IDs follow */
83enum { 82enum {
84 DMA_ID_UART0_TX = 0, 83 DMA_ID_UART0_TX = 0,
85 DMA_ID_UART0_RX, 84 DMA_ID_UART0_RX,
@@ -110,7 +109,8 @@ enum {
110}; 109};
111 110
112struct dma_chan { 111struct dma_chan {
113 int dev_id; // this channel is allocated if >=0, free otherwise 112 int dev_id; /* this channel is allocated if >= 0, */
113 /* free otherwise */
114 unsigned int io; 114 unsigned int io;
115 const char *dev_str; 115 const char *dev_str;
116 int irq; 116 int irq;
@@ -132,23 +132,23 @@ extern int au1000_dma_read_proc(char *buf, char **start, off_t fpos,
132extern void dump_au1000_dma_channel(unsigned int dmanr); 132extern void dump_au1000_dma_channel(unsigned int dmanr);
133extern spinlock_t au1000_dma_spin_lock; 133extern spinlock_t au1000_dma_spin_lock;
134 134
135 135static inline struct dma_chan *get_dma_chan(unsigned int dmanr)
136static __inline__ struct dma_chan *get_dma_chan(unsigned int dmanr)
137{ 136{
138 if (dmanr >= NUM_AU1000_DMA_CHANNELS 137 if (dmanr >= NUM_AU1000_DMA_CHANNELS ||
139 || au1000_dma_table[dmanr].dev_id < 0) 138 au1000_dma_table[dmanr].dev_id < 0)
140 return NULL; 139 return NULL;
141 return &au1000_dma_table[dmanr]; 140 return &au1000_dma_table[dmanr];
142} 141}
143 142
144static __inline__ unsigned long claim_dma_lock(void) 143static inline unsigned long claim_dma_lock(void)
145{ 144{
146 unsigned long flags; 145 unsigned long flags;
146
147 spin_lock_irqsave(&au1000_dma_spin_lock, flags); 147 spin_lock_irqsave(&au1000_dma_spin_lock, flags);
148 return flags; 148 return flags;
149} 149}
150 150
151static __inline__ void release_dma_lock(unsigned long flags) 151static inline void release_dma_lock(unsigned long flags)
152{ 152{
153 spin_unlock_irqrestore(&au1000_dma_spin_lock, flags); 153 spin_unlock_irqrestore(&au1000_dma_spin_lock, flags);
154} 154}
@@ -156,48 +156,53 @@ static __inline__ void release_dma_lock(unsigned long flags)
156/* 156/*
157 * Set the DMA buffer enable bits in the mode register. 157 * Set the DMA buffer enable bits in the mode register.
158 */ 158 */
159static __inline__ void enable_dma_buffer0(unsigned int dmanr) 159static inline void enable_dma_buffer0(unsigned int dmanr)
160{ 160{
161 struct dma_chan *chan = get_dma_chan(dmanr); 161 struct dma_chan *chan = get_dma_chan(dmanr);
162
162 if (!chan) 163 if (!chan)
163 return; 164 return;
164 au_writel(DMA_BE0, chan->io + DMA_MODE_SET); 165 au_writel(DMA_BE0, chan->io + DMA_MODE_SET);
165} 166}
166static __inline__ void enable_dma_buffer1(unsigned int dmanr) 167
168static inline void enable_dma_buffer1(unsigned int dmanr)
167{ 169{
168 struct dma_chan *chan = get_dma_chan(dmanr); 170 struct dma_chan *chan = get_dma_chan(dmanr);
171
169 if (!chan) 172 if (!chan)
170 return; 173 return;
171 au_writel(DMA_BE1, chan->io + DMA_MODE_SET); 174 au_writel(DMA_BE1, chan->io + DMA_MODE_SET);
172} 175}
173static __inline__ void enable_dma_buffers(unsigned int dmanr) 176static inline void enable_dma_buffers(unsigned int dmanr)
174{ 177{
175 struct dma_chan *chan = get_dma_chan(dmanr); 178 struct dma_chan *chan = get_dma_chan(dmanr);
179
176 if (!chan) 180 if (!chan)
177 return; 181 return;
178 au_writel(DMA_BE0 | DMA_BE1, chan->io + DMA_MODE_SET); 182 au_writel(DMA_BE0 | DMA_BE1, chan->io + DMA_MODE_SET);
179} 183}
180 184
181static __inline__ void start_dma(unsigned int dmanr) 185static inline void start_dma(unsigned int dmanr)
182{ 186{
183 struct dma_chan *chan = get_dma_chan(dmanr); 187 struct dma_chan *chan = get_dma_chan(dmanr);
188
184 if (!chan) 189 if (!chan)
185 return; 190 return;
186
187 au_writel(DMA_GO, chan->io + DMA_MODE_SET); 191 au_writel(DMA_GO, chan->io + DMA_MODE_SET);
188} 192}
189 193
190#define DMA_HALT_POLL 0x5000 194#define DMA_HALT_POLL 0x5000
191 195
192static __inline__ void halt_dma(unsigned int dmanr) 196static inline void halt_dma(unsigned int dmanr)
193{ 197{
194 struct dma_chan *chan = get_dma_chan(dmanr); 198 struct dma_chan *chan = get_dma_chan(dmanr);
195 int i; 199 int i;
200
196 if (!chan) 201 if (!chan)
197 return; 202 return;
198
199 au_writel(DMA_GO, chan->io + DMA_MODE_CLEAR); 203 au_writel(DMA_GO, chan->io + DMA_MODE_CLEAR);
200 // poll the halt bit 204
205 /* Poll the halt bit */
201 for (i = 0; i < DMA_HALT_POLL; i++) 206 for (i = 0; i < DMA_HALT_POLL; i++)
202 if (au_readl(chan->io + DMA_MODE_READ) & DMA_HALT) 207 if (au_readl(chan->io + DMA_MODE_READ) & DMA_HALT)
203 break; 208 break;
@@ -205,55 +210,57 @@ static __inline__ void halt_dma(unsigned int dmanr)
205 printk(KERN_INFO "halt_dma: HALT poll expired!\n"); 210 printk(KERN_INFO "halt_dma: HALT poll expired!\n");
206} 211}
207 212
208 213static inline void disable_dma(unsigned int dmanr)
209static __inline__ void disable_dma(unsigned int dmanr)
210{ 214{
211 struct dma_chan *chan = get_dma_chan(dmanr); 215 struct dma_chan *chan = get_dma_chan(dmanr);
216
212 if (!chan) 217 if (!chan)
213 return; 218 return;
214 219
215 halt_dma(dmanr); 220 halt_dma(dmanr);
216 221
217 // now we can disable the buffers 222 /* Now we can disable the buffers */
218 au_writel(~DMA_GO, chan->io + DMA_MODE_CLEAR); 223 au_writel(~DMA_GO, chan->io + DMA_MODE_CLEAR);
219} 224}
220 225
221static __inline__ int dma_halted(unsigned int dmanr) 226static inline int dma_halted(unsigned int dmanr)
222{ 227{
223 struct dma_chan *chan = get_dma_chan(dmanr); 228 struct dma_chan *chan = get_dma_chan(dmanr);
229
224 if (!chan) 230 if (!chan)
225 return 1; 231 return 1;
226 return (au_readl(chan->io + DMA_MODE_READ) & DMA_HALT) ? 1 : 0; 232 return (au_readl(chan->io + DMA_MODE_READ) & DMA_HALT) ? 1 : 0;
227} 233}
228 234
229/* initialize a DMA channel */ 235/* Initialize a DMA channel. */
230static __inline__ void init_dma(unsigned int dmanr) 236static inline void init_dma(unsigned int dmanr)
231{ 237{
232 struct dma_chan *chan = get_dma_chan(dmanr); 238 struct dma_chan *chan = get_dma_chan(dmanr);
233 u32 mode; 239 u32 mode;
240
234 if (!chan) 241 if (!chan)
235 return; 242 return;
236 243
237 disable_dma(dmanr); 244 disable_dma(dmanr);
238 245
239 // set device FIFO address 246 /* Set device FIFO address */
240 au_writel(CPHYSADDR(chan->fifo_addr), 247 au_writel(CPHYSADDR(chan->fifo_addr), chan->io + DMA_PERIPHERAL_ADDR);
241 chan->io + DMA_PERIPHERAL_ADDR);
242 248
243 mode = chan->mode | (chan->dev_id << DMA_DID_BIT); 249 mode = chan->mode | (chan->dev_id << DMA_DID_BIT);
244 if (chan->irq) 250 if (chan->irq)
245 mode |= DMA_IE; 251 mode |= DMA_IE;
246 252
247 au_writel(~mode, chan->io + DMA_MODE_CLEAR); 253 au_writel(~mode, chan->io + DMA_MODE_CLEAR);
248 au_writel(mode, chan->io + DMA_MODE_SET); 254 au_writel(mode, chan->io + DMA_MODE_SET);
249} 255}
250 256
251/* 257/*
252 * set mode for a specific DMA channel 258 * Set mode for a specific DMA channel
253 */ 259 */
254static __inline__ void set_dma_mode(unsigned int dmanr, unsigned int mode) 260static inline void set_dma_mode(unsigned int dmanr, unsigned int mode)
255{ 261{
256 struct dma_chan *chan = get_dma_chan(dmanr); 262 struct dma_chan *chan = get_dma_chan(dmanr);
263
257 if (!chan) 264 if (!chan)
258 return; 265 return;
259 /* 266 /*
@@ -266,36 +273,37 @@ static __inline__ void set_dma_mode(unsigned int dmanr, unsigned int mode)
266 chan->mode |= mode; 273 chan->mode |= mode;
267} 274}
268 275
269static __inline__ unsigned int get_dma_mode(unsigned int dmanr) 276static inline unsigned int get_dma_mode(unsigned int dmanr)
270{ 277{
271 struct dma_chan *chan = get_dma_chan(dmanr); 278 struct dma_chan *chan = get_dma_chan(dmanr);
279
272 if (!chan) 280 if (!chan)
273 return 0; 281 return 0;
274 return chan->mode; 282 return chan->mode;
275} 283}
276 284
277static __inline__ int get_dma_active_buffer(unsigned int dmanr) 285static inline int get_dma_active_buffer(unsigned int dmanr)
278{ 286{
279 struct dma_chan *chan = get_dma_chan(dmanr); 287 struct dma_chan *chan = get_dma_chan(dmanr);
288
280 if (!chan) 289 if (!chan)
281 return -1; 290 return -1;
282 return (au_readl(chan->io + DMA_MODE_READ) & DMA_AB) ? 1 : 0; 291 return (au_readl(chan->io + DMA_MODE_READ) & DMA_AB) ? 1 : 0;
283} 292}
284 293
285
286/* 294/*
287 * set the device FIFO address for a specific DMA channel - only 295 * Set the device FIFO address for a specific DMA channel - only
288 * applicable to GPO4 and GPO5. All the other devices have fixed 296 * applicable to GPO4 and GPO5. All the other devices have fixed
289 * FIFO addresses. 297 * FIFO addresses.
290 */ 298 */
291static __inline__ void set_dma_fifo_addr(unsigned int dmanr, 299static inline void set_dma_fifo_addr(unsigned int dmanr, unsigned int a)
292 unsigned int a)
293{ 300{
294 struct dma_chan *chan = get_dma_chan(dmanr); 301 struct dma_chan *chan = get_dma_chan(dmanr);
302
295 if (!chan) 303 if (!chan)
296 return; 304 return;
297 305
298 if (chan->mode & DMA_DS) /* second bank of device ids */ 306 if (chan->mode & DMA_DS) /* second bank of device IDs */
299 return; 307 return;
300 308
301 if (chan->dev_id != DMA_ID_GP04 && chan->dev_id != DMA_ID_GP05) 309 if (chan->dev_id != DMA_ID_GP04 && chan->dev_id != DMA_ID_GP05)
@@ -307,16 +315,19 @@ static __inline__ void set_dma_fifo_addr(unsigned int dmanr,
307/* 315/*
308 * Clear the DMA buffer done bits in the mode register. 316 * Clear the DMA buffer done bits in the mode register.
309 */ 317 */
310static __inline__ void clear_dma_done0(unsigned int dmanr) 318static inline void clear_dma_done0(unsigned int dmanr)
311{ 319{
312 struct dma_chan *chan = get_dma_chan(dmanr); 320 struct dma_chan *chan = get_dma_chan(dmanr);
321
313 if (!chan) 322 if (!chan)
314 return; 323 return;
315 au_writel(DMA_D0, chan->io + DMA_MODE_CLEAR); 324 au_writel(DMA_D0, chan->io + DMA_MODE_CLEAR);
316} 325}
317static __inline__ void clear_dma_done1(unsigned int dmanr) 326
327static inline void clear_dma_done1(unsigned int dmanr)
318{ 328{
319 struct dma_chan *chan = get_dma_chan(dmanr); 329 struct dma_chan *chan = get_dma_chan(dmanr);
330
320 if (!chan) 331 if (!chan)
321 return; 332 return;
322 au_writel(DMA_D1, chan->io + DMA_MODE_CLEAR); 333 au_writel(DMA_D1, chan->io + DMA_MODE_CLEAR);
@@ -325,16 +336,17 @@ static __inline__ void clear_dma_done1(unsigned int dmanr)
325/* 336/*
326 * This does nothing - not applicable to Au1000 DMA. 337 * This does nothing - not applicable to Au1000 DMA.
327 */ 338 */
328static __inline__ void set_dma_page(unsigned int dmanr, char pagenr) 339static inline void set_dma_page(unsigned int dmanr, char pagenr)
329{ 340{
330} 341}
331 342
332/* 343/*
333 * Set Buffer 0 transfer address for specific DMA channel. 344 * Set Buffer 0 transfer address for specific DMA channel.
334 */ 345 */
335static __inline__ void set_dma_addr0(unsigned int dmanr, unsigned int a) 346static inline void set_dma_addr0(unsigned int dmanr, unsigned int a)
336{ 347{
337 struct dma_chan *chan = get_dma_chan(dmanr); 348 struct dma_chan *chan = get_dma_chan(dmanr);
349
338 if (!chan) 350 if (!chan)
339 return; 351 return;
340 au_writel(a, chan->io + DMA_BUFFER0_START); 352 au_writel(a, chan->io + DMA_BUFFER0_START);
@@ -343,9 +355,10 @@ static __inline__ void set_dma_addr0(unsigned int dmanr, unsigned int a)
343/* 355/*
344 * Set Buffer 1 transfer address for specific DMA channel. 356 * Set Buffer 1 transfer address for specific DMA channel.
345 */ 357 */
346static __inline__ void set_dma_addr1(unsigned int dmanr, unsigned int a) 358static inline void set_dma_addr1(unsigned int dmanr, unsigned int a)
347{ 359{
348 struct dma_chan *chan = get_dma_chan(dmanr); 360 struct dma_chan *chan = get_dma_chan(dmanr);
361
349 if (!chan) 362 if (!chan)
350 return; 363 return;
351 au_writel(a, chan->io + DMA_BUFFER1_START); 364 au_writel(a, chan->io + DMA_BUFFER1_START);
@@ -355,10 +368,10 @@ static __inline__ void set_dma_addr1(unsigned int dmanr, unsigned int a)
355/* 368/*
356 * Set Buffer 0 transfer size (max 64k) for a specific DMA channel. 369 * Set Buffer 0 transfer size (max 64k) for a specific DMA channel.
357 */ 370 */
358static __inline__ void set_dma_count0(unsigned int dmanr, 371static inline void set_dma_count0(unsigned int dmanr, unsigned int count)
359 unsigned int count)
360{ 372{
361 struct dma_chan *chan = get_dma_chan(dmanr); 373 struct dma_chan *chan = get_dma_chan(dmanr);
374
362 if (!chan) 375 if (!chan)
363 return; 376 return;
364 count &= DMA_COUNT_MASK; 377 count &= DMA_COUNT_MASK;
@@ -368,10 +381,10 @@ static __inline__ void set_dma_count0(unsigned int dmanr,
368/* 381/*
369 * Set Buffer 1 transfer size (max 64k) for a specific DMA channel. 382 * Set Buffer 1 transfer size (max 64k) for a specific DMA channel.
370 */ 383 */
371static __inline__ void set_dma_count1(unsigned int dmanr, 384static inline void set_dma_count1(unsigned int dmanr, unsigned int count)
372 unsigned int count)
373{ 385{
374 struct dma_chan *chan = get_dma_chan(dmanr); 386 struct dma_chan *chan = get_dma_chan(dmanr);
387
375 if (!chan) 388 if (!chan)
376 return; 389 return;
377 count &= DMA_COUNT_MASK; 390 count &= DMA_COUNT_MASK;
@@ -381,10 +394,10 @@ static __inline__ void set_dma_count1(unsigned int dmanr,
381/* 394/*
382 * Set both buffer transfer sizes (max 64k) for a specific DMA channel. 395 * Set both buffer transfer sizes (max 64k) for a specific DMA channel.
383 */ 396 */
384static __inline__ void set_dma_count(unsigned int dmanr, 397static inline void set_dma_count(unsigned int dmanr, unsigned int count)
385 unsigned int count)
386{ 398{
387 struct dma_chan *chan = get_dma_chan(dmanr); 399 struct dma_chan *chan = get_dma_chan(dmanr);
400
388 if (!chan) 401 if (!chan)
389 return; 402 return;
390 count &= DMA_COUNT_MASK; 403 count &= DMA_COUNT_MASK;
@@ -396,35 +409,36 @@ static __inline__ void set_dma_count(unsigned int dmanr,
396 * Returns which buffer has its done bit set in the mode register. 409 * Returns which buffer has its done bit set in the mode register.
397 * Returns -1 if neither or both done bits set. 410 * Returns -1 if neither or both done bits set.
398 */ 411 */
399static __inline__ unsigned int get_dma_buffer_done(unsigned int dmanr) 412static inline unsigned int get_dma_buffer_done(unsigned int dmanr)
400{ 413{
401 struct dma_chan *chan = get_dma_chan(dmanr); 414 struct dma_chan *chan = get_dma_chan(dmanr);
415
402 if (!chan) 416 if (!chan)
403 return 0; 417 return 0;
404 418 return au_readl(chan->io + DMA_MODE_READ) & (DMA_D0 | DMA_D1);
405 return au_readl(chan->io + DMA_MODE_READ) & (DMA_D0 | DMA_D1);
406} 419}
407 420
408 421
409/* 422/*
410 * Returns the DMA channel's Buffer Done IRQ number. 423 * Returns the DMA channel's Buffer Done IRQ number.
411 */ 424 */
412static __inline__ int get_dma_done_irq(unsigned int dmanr) 425static inline int get_dma_done_irq(unsigned int dmanr)
413{ 426{
414 struct dma_chan *chan = get_dma_chan(dmanr); 427 struct dma_chan *chan = get_dma_chan(dmanr);
428
415 if (!chan) 429 if (!chan)
416 return -1; 430 return -1;
417
418 return chan->irq; 431 return chan->irq;
419} 432}
420 433
421/* 434/*
422 * Get DMA residue count. Returns the number of _bytes_ left to transfer. 435 * Get DMA residue count. Returns the number of _bytes_ left to transfer.
423 */ 436 */
424static __inline__ int get_dma_residue(unsigned int dmanr) 437static inline int get_dma_residue(unsigned int dmanr)
425{ 438{
426 int curBufCntReg, count; 439 int curBufCntReg, count;
427 struct dma_chan *chan = get_dma_chan(dmanr); 440 struct dma_chan *chan = get_dma_chan(dmanr);
441
428 if (!chan) 442 if (!chan)
429 return 0; 443 return 0;
430 444
@@ -442,4 +456,3 @@ static __inline__ int get_dma_residue(unsigned int dmanr)
442} 456}
443 457
444#endif /* __ASM_AU1000_DMA_H */ 458#endif /* __ASM_AU1000_DMA_H */
445
diff --git a/include/asm-mips/mach-au1x00/au1000_gpio.h b/include/asm-mips/mach-au1x00/au1000_gpio.h
index 298f92012e8e..d8c96fda5549 100644
--- a/include/asm-mips/mach-au1x00/au1000_gpio.h
+++ b/include/asm-mips/mach-au1x00/au1000_gpio.h
@@ -2,12 +2,12 @@
2 * FILE NAME au1000_gpio.h 2 * FILE NAME au1000_gpio.h
3 * 3 *
4 * BRIEF MODULE DESCRIPTION 4 * BRIEF MODULE DESCRIPTION
5 * API to Alchemy Au1000 GPIO device. 5 * API to Alchemy Au1xx0 GPIO device.
6 * 6 *
7 * Author: MontaVista Software, Inc. <source@mvista.com> 7 * Author: MontaVista Software, Inc. <source@mvista.com>
8 * Steve Longerbeam <stevel@mvista.com> 8 * Steve Longerbeam
9 * 9 *
10 * Copyright 2001 MontaVista Software Inc. 10 * Copyright 2001, 2008 MontaVista Software Inc.
11 * 11 *
12 * This program is free software; you can redistribute it and/or modify it 12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the 13 * under the terms of the GNU General Public License as published by the
@@ -37,12 +37,12 @@
37 37
38#define AU1000GPIO_IOC_MAGIC 'A' 38#define AU1000GPIO_IOC_MAGIC 'A'
39 39
40#define AU1000GPIO_IN _IOR (AU1000GPIO_IOC_MAGIC, 0, int) 40#define AU1000GPIO_IN _IOR(AU1000GPIO_IOC_MAGIC, 0, int)
41#define AU1000GPIO_SET _IOW (AU1000GPIO_IOC_MAGIC, 1, int) 41#define AU1000GPIO_SET _IOW(AU1000GPIO_IOC_MAGIC, 1, int)
42#define AU1000GPIO_CLEAR _IOW (AU1000GPIO_IOC_MAGIC, 2, int) 42#define AU1000GPIO_CLEAR _IOW(AU1000GPIO_IOC_MAGIC, 2, int)
43#define AU1000GPIO_OUT _IOW (AU1000GPIO_IOC_MAGIC, 3, int) 43#define AU1000GPIO_OUT _IOW(AU1000GPIO_IOC_MAGIC, 3, int)
44#define AU1000GPIO_TRISTATE _IOW (AU1000GPIO_IOC_MAGIC, 4, int) 44#define AU1000GPIO_TRISTATE _IOW(AU1000GPIO_IOC_MAGIC, 4, int)
45#define AU1000GPIO_AVAIL_MASK _IOR (AU1000GPIO_IOC_MAGIC, 5, int) 45#define AU1000GPIO_AVAIL_MASK _IOR(AU1000GPIO_IOC_MAGIC, 5, int)
46 46
47#ifdef __KERNEL__ 47#ifdef __KERNEL__
48extern u32 get_au1000_avail_gpio_mask(void); 48extern u32 get_au1000_avail_gpio_mask(void);
diff --git a/include/asm-mips/mach-au1x00/au1550_spi.h b/include/asm-mips/mach-au1x00/au1550_spi.h
index c2f0466523ec..40e6c489833a 100644
--- a/include/asm-mips/mach-au1x00/au1550_spi.h
+++ b/include/asm-mips/mach-au1x00/au1550_spi.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * au1550_spi.h - au1550 psc spi controller driver - platform data struct 2 * au1550_spi.h - Au1550 PSC SPI controller driver - platform data structure
3 */ 3 */
4 4
5#ifndef _AU1550_SPI_H_ 5#ifndef _AU1550_SPI_H_
diff --git a/include/asm-mips/mach-au1x00/au1xxx.h b/include/asm-mips/mach-au1x00/au1xxx.h
index 947135941033..1b3655090ed3 100644
--- a/include/asm-mips/mach-au1x00/au1xxx.h
+++ b/include/asm-mips/mach-au1x00/au1xxx.h
@@ -23,10 +23,10 @@
23#ifndef _AU1XXX_H_ 23#ifndef _AU1XXX_H_
24#define _AU1XXX_H_ 24#define _AU1XXX_H_
25 25
26
27#include <asm/mach-au1x00/au1000.h> 26#include <asm/mach-au1x00/au1000.h>
28 27
29#if defined(CONFIG_MIPS_DB1000) || defined(CONFIG_MIPS_DB1100) || defined(CONFIG_MIPS_DB1500) || defined(CONFIG_MIPS_DB1550) 28#if defined(CONFIG_MIPS_DB1000) || defined(CONFIG_MIPS_DB1100) || \
29 defined(CONFIG_MIPS_DB1500) || defined(CONFIG_MIPS_DB1550)
30#include <asm/mach-db1x00/db1x00.h> 30#include <asm/mach-db1x00/db1x00.h>
31 31
32#elif defined(CONFIG_MIPS_PB1550) 32#elif defined(CONFIG_MIPS_PB1550)
diff --git a/include/asm-mips/mach-au1x00/au1xxx_dbdma.h b/include/asm-mips/mach-au1x00/au1xxx_dbdma.h
index 93d507cea518..ad17d7ce516a 100644
--- a/include/asm-mips/mach-au1x00/au1xxx_dbdma.h
+++ b/include/asm-mips/mach-au1x00/au1xxx_dbdma.h
@@ -28,17 +28,18 @@
28 * 675 Mass Ave, Cambridge, MA 02139, USA. 28 * 675 Mass Ave, Cambridge, MA 02139, USA.
29 */ 29 */
30 30
31/* Specifics for the Au1xxx Descriptor-Based DMA Controllers, first 31/*
32 * seen in the AU1550 part. 32 * Specifics for the Au1xxx Descriptor-Based DMA Controller,
33 * first seen in the AU1550 part.
33 */ 34 */
34#ifndef _AU1000_DBDMA_H_ 35#ifndef _AU1000_DBDMA_H_
35#define _AU1000_DBDMA_H_ 36#define _AU1000_DBDMA_H_
36 37
37
38#ifndef _LANGUAGE_ASSEMBLY 38#ifndef _LANGUAGE_ASSEMBLY
39 39
40/* The DMA base addresses. 40/*
41 * The Channels are every 256 bytes (0x0100) from the channel 0 base. 41 * The DMA base addresses.
42 * The channels are every 256 bytes (0x0100) from the channel 0 base.
42 * Interrupt status/enable is bits 15:0 for channels 15 to zero. 43 * Interrupt status/enable is bits 15:0 for channels 15 to zero.
43 */ 44 */
44#define DDMA_GLOBAL_BASE 0xb4003000 45#define DDMA_GLOBAL_BASE 0xb4003000
@@ -51,16 +52,14 @@ typedef volatile struct dbdma_global {
51 u32 ddma_inten; 52 u32 ddma_inten;
52} dbdma_global_t; 53} dbdma_global_t;
53 54
54/* General Configuration. 55/* General Configuration. */
55*/
56#define DDMA_CONFIG_AF (1 << 2) 56#define DDMA_CONFIG_AF (1 << 2)
57#define DDMA_CONFIG_AH (1 << 1) 57#define DDMA_CONFIG_AH (1 << 1)
58#define DDMA_CONFIG_AL (1 << 0) 58#define DDMA_CONFIG_AL (1 << 0)
59 59
60#define DDMA_THROTTLE_EN (1 << 31) 60#define DDMA_THROTTLE_EN (1 << 31)
61 61
62/* The structure of a DMA Channel. 62/* The structure of a DMA Channel. */
63*/
64typedef volatile struct au1xxx_dma_channel { 63typedef volatile struct au1xxx_dma_channel {
65 u32 ddma_cfg; /* See below */ 64 u32 ddma_cfg; /* See below */
66 u32 ddma_desptr; /* 32-byte aligned pointer to descriptor */ 65 u32 ddma_desptr; /* 32-byte aligned pointer to descriptor */
@@ -69,8 +68,7 @@ typedef volatile struct au1xxx_dma_channel {
69 u32 ddma_irq; /* If bit 0 set, interrupt pending */ 68 u32 ddma_irq; /* If bit 0 set, interrupt pending */
70 u32 ddma_stat; /* See below */ 69 u32 ddma_stat; /* See below */
71 u32 ddma_bytecnt; /* Byte count, valid only when chan idle */ 70 u32 ddma_bytecnt; /* Byte count, valid only when chan idle */
72 /* Remainder, up to the 256 byte boundary, is reserved. 71 /* Remainder, up to the 256 byte boundary, is reserved. */
73 */
74} au1x_dma_chan_t; 72} au1x_dma_chan_t;
75 73
76#define DDMA_CFG_SED (1 << 9) /* source DMA level/edge detect */ 74#define DDMA_CFG_SED (1 << 9) /* source DMA level/edge detect */
@@ -84,7 +82,8 @@ typedef volatile struct au1xxx_dma_channel {
84#define DDMA_CFG_DBE (1 << 1) /* Destination big endian */ 82#define DDMA_CFG_DBE (1 << 1) /* Destination big endian */
85#define DDMA_CFG_EN (1 << 0) /* Channel enable */ 83#define DDMA_CFG_EN (1 << 0) /* Channel enable */
86 84
87/* Always set when descriptor processing done, regardless of 85/*
86 * Always set when descriptor processing done, regardless of
88 * interrupt enable state. Reflected in global intstat, don't 87 * interrupt enable state. Reflected in global intstat, don't
89 * clear this until global intstat is read/used. 88 * clear this until global intstat is read/used.
90 */ 89 */
@@ -94,7 +93,8 @@ typedef volatile struct au1xxx_dma_channel {
94#define DDMA_STAT_V (1 << 1) /* Descriptor valid */ 93#define DDMA_STAT_V (1 << 1) /* Descriptor valid */
95#define DDMA_STAT_H (1 << 0) /* Channel Halted */ 94#define DDMA_STAT_H (1 << 0) /* Channel Halted */
96 95
97/* "Standard" DDMA Descriptor. 96/*
97 * "Standard" DDMA Descriptor.
98 * Must be 32-byte aligned. 98 * Must be 32-byte aligned.
99 */ 99 */
100typedef volatile struct au1xxx_ddma_desc { 100typedef volatile struct au1xxx_ddma_desc {
@@ -106,8 +106,9 @@ typedef volatile struct au1xxx_ddma_desc {
106 u32 dscr_dest1; /* See below */ 106 u32 dscr_dest1; /* See below */
107 u32 dscr_stat; /* completion status */ 107 u32 dscr_stat; /* completion status */
108 u32 dscr_nxtptr; /* Next descriptor pointer (mostly) */ 108 u32 dscr_nxtptr; /* Next descriptor pointer (mostly) */
109 /* First 32bytes are HW specific!!! 109 /*
110 Lets have some SW data following.. make sure its 32bytes 110 * First 32 bytes are HW specific!!!
111 * Lets have some SW data following -- make sure it's 32 bytes.
111 */ 112 */
112 u32 sw_status; 113 u32 sw_status;
113 u32 sw_context; 114 u32 sw_context;
@@ -130,10 +131,9 @@ typedef volatile struct au1xxx_ddma_desc {
130#define DSCR_CMD0_CV (0x1 << 2) /* Clear Valid when done */ 131#define DSCR_CMD0_CV (0x1 << 2) /* Clear Valid when done */
131#define DSCR_CMD0_ST_MASK (0x3 << 0) /* Status instruction */ 132#define DSCR_CMD0_ST_MASK (0x3 << 0) /* Status instruction */
132 133
133#define SW_STATUS_INUSE (1<<0) 134#define SW_STATUS_INUSE (1 << 0)
134 135
135/* Command 0 device IDs. 136/* Command 0 device IDs. */
136*/
137#ifdef CONFIG_SOC_AU1550 137#ifdef CONFIG_SOC_AU1550
138#define DSCR_CMD0_UART0_TX 0 138#define DSCR_CMD0_UART0_TX 0
139#define DSCR_CMD0_UART0_RX 1 139#define DSCR_CMD0_UART0_RX 1
@@ -198,16 +198,15 @@ typedef volatile struct au1xxx_ddma_desc {
198#define DSCR_CMD0_THROTTLE 30 198#define DSCR_CMD0_THROTTLE 30
199#define DSCR_CMD0_ALWAYS 31 199#define DSCR_CMD0_ALWAYS 31
200#define DSCR_NDEV_IDS 32 200#define DSCR_NDEV_IDS 32
201/* THis macro is used to find/create custom device types */ 201/* This macro is used to find/create custom device types */
202#define DSCR_DEV2CUSTOM_ID(x, d) (((((x)&0xFFFF)<<8)|0x32000000)|((d)&0xFF)) 202#define DSCR_DEV2CUSTOM_ID(x, d) (((((x) & 0xFFFF) << 8) | 0x32000000) | \
203#define DSCR_CUSTOM2DEV_ID(x) ((x)&0xFF) 203 ((d) & 0xFF))
204 204#define DSCR_CUSTOM2DEV_ID(x) ((x) & 0xFF)
205 205
206#define DSCR_CMD0_SID(x) (((x) & 0x1f) << 25) 206#define DSCR_CMD0_SID(x) (((x) & 0x1f) << 25)
207#define DSCR_CMD0_DID(x) (((x) & 0x1f) << 20) 207#define DSCR_CMD0_DID(x) (((x) & 0x1f) << 20)
208 208
209/* Source/Destination transfer width. 209/* Source/Destination transfer width. */
210*/
211#define DSCR_CMD0_BYTE 0 210#define DSCR_CMD0_BYTE 0
212#define DSCR_CMD0_HALFWORD 1 211#define DSCR_CMD0_HALFWORD 1
213#define DSCR_CMD0_WORD 2 212#define DSCR_CMD0_WORD 2
@@ -215,16 +214,14 @@ typedef volatile struct au1xxx_ddma_desc {
215#define DSCR_CMD0_SW(x) (((x) & 0x3) << 18) 214#define DSCR_CMD0_SW(x) (((x) & 0x3) << 18)
216#define DSCR_CMD0_DW(x) (((x) & 0x3) << 16) 215#define DSCR_CMD0_DW(x) (((x) & 0x3) << 16)
217 216
218/* DDMA Descriptor Type. 217/* DDMA Descriptor Type. */
219*/
220#define DSCR_CMD0_STANDARD 0 218#define DSCR_CMD0_STANDARD 0
221#define DSCR_CMD0_LITERAL 1 219#define DSCR_CMD0_LITERAL 1
222#define DSCR_CMD0_CMP_BRANCH 2 220#define DSCR_CMD0_CMP_BRANCH 2
223 221
224#define DSCR_CMD0_DT(x) (((x) & 0x3) << 13) 222#define DSCR_CMD0_DT(x) (((x) & 0x3) << 13)
225 223
226/* Status Instruction. 224/* Status Instruction. */
227*/
228#define DSCR_CMD0_ST_NOCHANGE 0 /* Don't change */ 225#define DSCR_CMD0_ST_NOCHANGE 0 /* Don't change */
229#define DSCR_CMD0_ST_CURRENT 1 /* Write current status */ 226#define DSCR_CMD0_ST_CURRENT 1 /* Write current status */
230#define DSCR_CMD0_ST_CMD0 2 /* Write cmd0 with V cleared */ 227#define DSCR_CMD0_ST_CMD0 2 /* Write cmd0 with V cleared */
@@ -232,23 +229,20 @@ typedef volatile struct au1xxx_ddma_desc {
232 229
233#define DSCR_CMD0_ST(x) (((x) & 0x3) << 0) 230#define DSCR_CMD0_ST(x) (((x) & 0x3) << 0)
234 231
235/* Descriptor Command 1 232/* Descriptor Command 1. */
236*/
237#define DSCR_CMD1_SUPTR_MASK (0xf << 28) /* upper 4 bits of src addr */ 233#define DSCR_CMD1_SUPTR_MASK (0xf << 28) /* upper 4 bits of src addr */
238#define DSCR_CMD1_DUPTR_MASK (0xf << 24) /* upper 4 bits of dest addr */ 234#define DSCR_CMD1_DUPTR_MASK (0xf << 24) /* upper 4 bits of dest addr */
239#define DSCR_CMD1_FL_MASK (0x3 << 22) /* Flag bits */ 235#define DSCR_CMD1_FL_MASK (0x3 << 22) /* Flag bits */
240#define DSCR_CMD1_BC_MASK (0x3fffff) /* Byte count */ 236#define DSCR_CMD1_BC_MASK (0x3fffff) /* Byte count */
241 237
242/* Flag description. 238/* Flag description. */
243*/
244#define DSCR_CMD1_FL_MEM_STRIDE0 0 239#define DSCR_CMD1_FL_MEM_STRIDE0 0
245#define DSCR_CMD1_FL_MEM_STRIDE1 1 240#define DSCR_CMD1_FL_MEM_STRIDE1 1
246#define DSCR_CMD1_FL_MEM_STRIDE2 2 241#define DSCR_CMD1_FL_MEM_STRIDE2 2
247 242
248#define DSCR_CMD1_FL(x) (((x) & 0x3) << 22) 243#define DSCR_CMD1_FL(x) (((x) & 0x3) << 22)
249 244
250/* Source1, 1-dimensional stride. 245/* Source1, 1-dimensional stride. */
251*/
252#define DSCR_SRC1_STS_MASK (3 << 30) /* Src xfer size */ 246#define DSCR_SRC1_STS_MASK (3 << 30) /* Src xfer size */
253#define DSCR_SRC1_SAM_MASK (3 << 28) /* Src xfer movement */ 247#define DSCR_SRC1_SAM_MASK (3 << 28) /* Src xfer movement */
254#define DSCR_SRC1_SB_MASK (0x3fff << 14) /* Block size */ 248#define DSCR_SRC1_SB_MASK (0x3fff << 14) /* Block size */
@@ -256,8 +250,7 @@ typedef volatile struct au1xxx_ddma_desc {
256#define DSCR_SRC1_SS_MASK (0x3fff << 0) /* Stride */ 250#define DSCR_SRC1_SS_MASK (0x3fff << 0) /* Stride */
257#define DSCR_SRC1_SS(x) (((x) & 0x3fff) << 0) 251#define DSCR_SRC1_SS(x) (((x) & 0x3fff) << 0)
258 252
259/* Dest1, 1-dimensional stride. 253/* Dest1, 1-dimensional stride. */
260*/
261#define DSCR_DEST1_DTS_MASK (3 << 30) /* Dest xfer size */ 254#define DSCR_DEST1_DTS_MASK (3 << 30) /* Dest xfer size */
262#define DSCR_DEST1_DAM_MASK (3 << 28) /* Dest xfer movement */ 255#define DSCR_DEST1_DAM_MASK (3 << 28) /* Dest xfer movement */
263#define DSCR_DEST1_DB_MASK (0x3fff << 14) /* Block size */ 256#define DSCR_DEST1_DB_MASK (0x3fff << 14) /* Block size */
@@ -279,29 +272,27 @@ typedef volatile struct au1xxx_ddma_desc {
279#define DSCR_SRC1_SAM(x) (((x) & 3) << 28) 272#define DSCR_SRC1_SAM(x) (((x) & 3) << 28)
280#define DSCR_DEST1_DAM(x) (((x) & 3) << 28) 273#define DSCR_DEST1_DAM(x) (((x) & 3) << 28)
281 274
282/* The next descriptor pointer. 275/* The next descriptor pointer. */
283*/
284#define DSCR_NXTPTR_MASK (0x07ffffff) 276#define DSCR_NXTPTR_MASK (0x07ffffff)
285#define DSCR_NXTPTR(x) ((x) >> 5) 277#define DSCR_NXTPTR(x) ((x) >> 5)
286#define DSCR_GET_NXTPTR(x) ((x) << 5) 278#define DSCR_GET_NXTPTR(x) ((x) << 5)
287#define DSCR_NXTPTR_MS (1 << 27) 279#define DSCR_NXTPTR_MS (1 << 27)
288 280
289/* The number of DBDMA channels. 281/* The number of DBDMA channels. */
290*/
291#define NUM_DBDMA_CHANS 16 282#define NUM_DBDMA_CHANS 16
292 283
293/* 284/*
294 * Ddma API definitions 285 * DDMA API definitions
295 * FIXME: may not fit to this header file 286 * FIXME: may not fit to this header file
296 */ 287 */
297typedef struct dbdma_device_table { 288typedef struct dbdma_device_table {
298 u32 dev_id; 289 u32 dev_id;
299 u32 dev_flags; 290 u32 dev_flags;
300 u32 dev_tsize; 291 u32 dev_tsize;
301 u32 dev_devwidth; 292 u32 dev_devwidth;
302 u32 dev_physaddr; /* If FIFO */ 293 u32 dev_physaddr; /* If FIFO */
303 u32 dev_intlevel; 294 u32 dev_intlevel;
304 u32 dev_intpolarity; 295 u32 dev_intpolarity;
305} dbdev_tab_t; 296} dbdev_tab_t;
306 297
307 298
@@ -316,44 +307,41 @@ typedef struct dbdma_chan_config {
316 au1x_ddma_desc_t *chan_desc_base; 307 au1x_ddma_desc_t *chan_desc_base;
317 au1x_ddma_desc_t *get_ptr, *put_ptr, *cur_ptr; 308 au1x_ddma_desc_t *get_ptr, *put_ptr, *cur_ptr;
318 void *chan_callparam; 309 void *chan_callparam;
319 void (*chan_callback)(int, void *); 310 void (*chan_callback)(int, void *);
320} chan_tab_t; 311} chan_tab_t;
321 312
322#define DEV_FLAGS_INUSE (1 << 0) 313#define DEV_FLAGS_INUSE (1 << 0)
323#define DEV_FLAGS_ANYUSE (1 << 1) 314#define DEV_FLAGS_ANYUSE (1 << 1)
324#define DEV_FLAGS_OUT (1 << 2) 315#define DEV_FLAGS_OUT (1 << 2)
325#define DEV_FLAGS_IN (1 << 3) 316#define DEV_FLAGS_IN (1 << 3)
326#define DEV_FLAGS_BURSTABLE (1 << 4) 317#define DEV_FLAGS_BURSTABLE (1 << 4)
327#define DEV_FLAGS_SYNC (1 << 5) 318#define DEV_FLAGS_SYNC (1 << 5)
328/* end Ddma API definitions */ 319/* end DDMA API definitions */
329 320
330/* External functions for drivers to use. 321/*
331*/ 322 * External functions for drivers to use.
332/* Use this to allocate a dbdma channel. The device ids are one of the 323 * Use this to allocate a DBDMA channel. The device IDs are one of
333 * DSCR_CMD0 devices IDs, which is usually redefined to a more 324 * the DSCR_CMD0 devices IDs, which is usually redefined to a more
334 * meaningful name. The 'callback' is called during dma completion 325 * meaningful name. The 'callback' is called during DMA completion
335 * interrupt. 326 * interrupt.
336 */ 327 */
337extern u32 au1xxx_dbdma_chan_alloc(u32 srcid, u32 destid, 328extern u32 au1xxx_dbdma_chan_alloc(u32 srcid, u32 destid,
338 void (*callback)(int, void *), void *callparam); 329 void (*callback)(int, void *),
330 void *callparam);
339 331
340#define DBDMA_MEM_CHAN DSCR_CMD0_ALWAYS 332#define DBDMA_MEM_CHAN DSCR_CMD0_ALWAYS
341 333
342/* Set the device width of a in/out fifo. 334/* Set the device width of an in/out FIFO. */
343*/
344u32 au1xxx_dbdma_set_devwidth(u32 chanid, int bits); 335u32 au1xxx_dbdma_set_devwidth(u32 chanid, int bits);
345 336
346/* Allocate a ring of descriptors for dbdma. 337/* Allocate a ring of descriptors for DBDMA. */
347*/
348u32 au1xxx_dbdma_ring_alloc(u32 chanid, int entries); 338u32 au1xxx_dbdma_ring_alloc(u32 chanid, int entries);
349 339
350/* Put buffers on source/destination descriptors. 340/* Put buffers on source/destination descriptors. */
351*/
352u32 _au1xxx_dbdma_put_source(u32 chanid, void *buf, int nbytes, u32 flags); 341u32 _au1xxx_dbdma_put_source(u32 chanid, void *buf, int nbytes, u32 flags);
353u32 _au1xxx_dbdma_put_dest(u32 chanid, void *buf, int nbytes, u32 flags); 342u32 _au1xxx_dbdma_put_dest(u32 chanid, void *buf, int nbytes, u32 flags);
354 343
355/* Get a buffer from the destination descriptor. 344/* Get a buffer from the destination descriptor. */
356*/
357u32 au1xxx_dbdma_get_dest(u32 chanid, void **buf, int *nbytes); 345u32 au1xxx_dbdma_get_dest(u32 chanid, void **buf, int *nbytes);
358 346
359void au1xxx_dbdma_stop(u32 chanid); 347void au1xxx_dbdma_stop(u32 chanid);
@@ -364,29 +352,34 @@ u32 au1xxx_get_dma_residue(u32 chanid);
364void au1xxx_dbdma_chan_free(u32 chanid); 352void au1xxx_dbdma_chan_free(u32 chanid);
365void au1xxx_dbdma_dump(u32 chanid); 353void au1xxx_dbdma_dump(u32 chanid);
366 354
367u32 au1xxx_dbdma_put_dscr(u32 chanid, au1x_ddma_desc_t *dscr ); 355u32 au1xxx_dbdma_put_dscr(u32 chanid, au1x_ddma_desc_t *dscr);
368 356
369u32 au1xxx_ddma_add_device( dbdev_tab_t *dev ); 357u32 au1xxx_ddma_add_device(dbdev_tab_t *dev);
370void * au1xxx_ddma_get_nextptr_virt(au1x_ddma_desc_t *dp); 358void *au1xxx_ddma_get_nextptr_virt(au1x_ddma_desc_t *dp);
371 359
372/* 360/*
373 Some compatibilty macros -- 361 * Some compatibilty macros -- needed to make changes to API
374 Needed to make changes to API without breaking existing drivers 362 * without breaking existing drivers.
375*/ 363 */
376#define au1xxx_dbdma_put_source(chanid, buf, nbytes)_au1xxx_dbdma_put_source(chanid, buf, nbytes, DDMA_FLAGS_IE) 364#define au1xxx_dbdma_put_source(chanid, buf, nbytes) \
377#define au1xxx_dbdma_put_source_flags(chanid, buf, nbytes, flags) _au1xxx_dbdma_put_source(chanid, buf, nbytes, flags) 365 _au1xxx_dbdma_put_source(chanid, buf, nbytes, DDMA_FLAGS_IE)
378#define put_source_flags(chanid, buf, nbytes, flags) au1xxx_dbdma_put_source_flags(chanid, buf, nbytes, flags) 366#define au1xxx_dbdma_put_source_flags(chanid, buf, nbytes, flags) \
379 367 _au1xxx_dbdma_put_source(chanid, buf, nbytes, flags)
380 368#define put_source_flags(chanid, buf, nbytes, flags) \
381#define au1xxx_dbdma_put_dest(chanid, buf, nbytes) _au1xxx_dbdma_put_dest(chanid, buf, nbytes, DDMA_FLAGS_IE) 369 au1xxx_dbdma_put_source_flags(chanid, buf, nbytes, flags)
382#define au1xxx_dbdma_put_dest_flags(chanid, buf, nbytes, flags) _au1xxx_dbdma_put_dest(chanid, buf, nbytes, flags) 370
383#define put_dest_flags(chanid, buf, nbytes, flags) au1xxx_dbdma_put_dest_flags(chanid, buf, nbytes, flags) 371#define au1xxx_dbdma_put_dest(chanid, buf, nbytes) \
372 _au1xxx_dbdma_put_dest(chanid, buf, nbytes, DDMA_FLAGS_IE)
373#define au1xxx_dbdma_put_dest_flags(chanid, buf, nbytes, flags) \
374 _au1xxx_dbdma_put_dest(chanid, buf, nbytes, flags)
375#define put_dest_flags(chanid, buf, nbytes, flags) \
376 au1xxx_dbdma_put_dest_flags(chanid, buf, nbytes, flags)
384 377
385/* 378/*
386 * Flags for the put_source/put_dest functions. 379 * Flags for the put_source/put_dest functions.
387 */ 380 */
388#define DDMA_FLAGS_IE (1<<0) 381#define DDMA_FLAGS_IE (1 << 0)
389#define DDMA_FLAGS_NOIE (1<<1) 382#define DDMA_FLAGS_NOIE (1 << 1)
390 383
391#endif /* _LANGUAGE_ASSEMBLY */ 384#endif /* _LANGUAGE_ASSEMBLY */
392#endif /* _AU1000_DBDMA_H_ */ 385#endif /* _AU1000_DBDMA_H_ */
diff --git a/include/asm-mips/mach-au1x00/au1xxx_ide.h b/include/asm-mips/mach-au1x00/au1xxx_ide.h
index b493a5e46c63..60638b8969ba 100644
--- a/include/asm-mips/mach-au1x00/au1xxx_ide.h
+++ b/include/asm-mips/mach-au1x00/au1xxx_ide.h
@@ -31,167 +31,164 @@
31 */ 31 */
32 32
33#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA 33#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA
34 #define DMA_WAIT_TIMEOUT 100 34#define DMA_WAIT_TIMEOUT 100
35 #define NUM_DESCRIPTORS PRD_ENTRIES 35#define NUM_DESCRIPTORS PRD_ENTRIES
36#else /* CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA */ 36#else /* CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA */
37 #define NUM_DESCRIPTORS 2 37#define NUM_DESCRIPTORS 2
38#endif 38#endif
39 39
40#ifndef AU1XXX_ATA_RQSIZE 40#ifndef AU1XXX_ATA_RQSIZE
41 #define AU1XXX_ATA_RQSIZE 128 41#define AU1XXX_ATA_RQSIZE 128
42#endif 42#endif
43 43
44/* Disable Burstable-Support for DBDMA */ 44/* Disable Burstable-Support for DBDMA */
45#ifndef CONFIG_BLK_DEV_IDE_AU1XXX_BURSTABLE_ON 45#ifndef CONFIG_BLK_DEV_IDE_AU1XXX_BURSTABLE_ON
46 #define CONFIG_BLK_DEV_IDE_AU1XXX_BURSTABLE_ON 0 46#define CONFIG_BLK_DEV_IDE_AU1XXX_BURSTABLE_ON 0
47#endif 47#endif
48 48
49#ifdef CONFIG_PM 49#ifdef CONFIG_PM
50/* 50/*
51* This will enable the device to be powered up when write() or read() 51 * This will enable the device to be powered up when write() or read()
52* is called. If this is not defined, the driver will return -EBUSY. 52 * is called. If this is not defined, the driver will return -EBUSY.
53*/ 53 */
54#define WAKE_ON_ACCESS 1 54#define WAKE_ON_ACCESS 1
55 55
56typedef struct 56typedef struct {
57{ 57 spinlock_t lock; /* Used to block on state transitions */
58 spinlock_t lock; /* Used to block on state transitions */ 58 au1xxx_power_dev_t *dev; /* Power Managers device structure */
59 au1xxx_power_dev_t *dev; /* Power Managers device structure */ 59 unsigned stopped; /* Used to signal device is stopped */
60 unsigned stopped; /* USed to signaling device is stopped */
61} pm_state; 60} pm_state;
62#endif 61#endif
63 62
64 63typedef struct {
65typedef struct 64 u32 tx_dev_id, rx_dev_id, target_dev_id;
66{ 65 u32 tx_chan, rx_chan;
67 u32 tx_dev_id, rx_dev_id, target_dev_id; 66 void *tx_desc_head, *rx_desc_head;
68 u32 tx_chan, rx_chan; 67 ide_hwif_t *hwif;
69 void *tx_desc_head, *rx_desc_head;
70 ide_hwif_t *hwif;
71#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA 68#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA
72 ide_drive_t *drive; 69 ide_drive_t *drive;
73 struct dbdma_cmd *dma_table_cpu; 70 struct dbdma_cmd *dma_table_cpu;
74 dma_addr_t dma_table_dma; 71 dma_addr_t dma_table_dma;
75#endif 72#endif
76 int irq; 73 int irq;
77 u32 regbase; 74 u32 regbase;
78#ifdef CONFIG_PM 75#ifdef CONFIG_PM
79 pm_state pm; 76 pm_state pm;
80#endif 77#endif
81} _auide_hwif; 78} _auide_hwif;
82 79
83/******************************************************************************* 80/******************************************************************************/
84* PIO Mode timing calculation : * 81/* PIO Mode timing calculation : */
85* * 82/* */
86* Static Bus Spec ATA Spec * 83/* Static Bus Spec ATA Spec */
87* Tcsoe = t1 * 84/* Tcsoe = t1 */
88* Toecs = t9 * 85/* Toecs = t9 */
89* Twcs = t9 * 86/* Twcs = t9 */
90* Tcsh = t2i | t2 * 87/* Tcsh = t2i | t2 */
91* Tcsoff = t2i | t2 * 88/* Tcsoff = t2i | t2 */
92* Twp = t2 * 89/* Twp = t2 */
93* Tcsw = t1 * 90/* Tcsw = t1 */
94* Tpm = 0 * 91/* Tpm = 0 */
95* Ta = t1+t2 * 92/* Ta = t1+t2 */
96*******************************************************************************/ 93/******************************************************************************/
97 94
98#define TCSOE_MASK (0x07<<29) 95#define TCSOE_MASK (0x07 << 29)
99#define TOECS_MASK (0x07<<26) 96#define TOECS_MASK (0x07 << 26)
100#define TWCS_MASK (0x07<<28) 97#define TWCS_MASK (0x07 << 28)
101#define TCSH_MASK (0x0F<<24) 98#define TCSH_MASK (0x0F << 24)
102#define TCSOFF_MASK (0x07<<20) 99#define TCSOFF_MASK (0x07 << 20)
103#define TWP_MASK (0x3F<<14) 100#define TWP_MASK (0x3F << 14)
104#define TCSW_MASK (0x0F<<10) 101#define TCSW_MASK (0x0F << 10)
105#define TPM_MASK (0x0F<<6) 102#define TPM_MASK (0x0F << 6)
106#define TA_MASK (0x3F<<0) 103#define TA_MASK (0x3F << 0)
107#define TS_MASK (1<<8) 104#define TS_MASK (1 << 8)
108 105
109/* Timing parameters PIO mode 0 */ 106/* Timing parameters PIO mode 0 */
110#define SBC_IDE_PIO0_TCSOE (0x04<<29) 107#define SBC_IDE_PIO0_TCSOE (0x04 << 29)
111#define SBC_IDE_PIO0_TOECS (0x01<<26) 108#define SBC_IDE_PIO0_TOECS (0x01 << 26)
112#define SBC_IDE_PIO0_TWCS (0x02<<28) 109#define SBC_IDE_PIO0_TWCS (0x02 << 28)
113#define SBC_IDE_PIO0_TCSH (0x08<<24) 110#define SBC_IDE_PIO0_TCSH (0x08 << 24)
114#define SBC_IDE_PIO0_TCSOFF (0x07<<20) 111#define SBC_IDE_PIO0_TCSOFF (0x07 << 20)
115#define SBC_IDE_PIO0_TWP (0x10<<14) 112#define SBC_IDE_PIO0_TWP (0x10 << 14)
116#define SBC_IDE_PIO0_TCSW (0x04<<10) 113#define SBC_IDE_PIO0_TCSW (0x04 << 10)
117#define SBC_IDE_PIO0_TPM (0x0<<6) 114#define SBC_IDE_PIO0_TPM (0x00 << 6)
118#define SBC_IDE_PIO0_TA (0x15<<0) 115#define SBC_IDE_PIO0_TA (0x15 << 0)
119/* Timing parameters PIO mode 1 */ 116/* Timing parameters PIO mode 1 */
120#define SBC_IDE_PIO1_TCSOE (0x03<<29) 117#define SBC_IDE_PIO1_TCSOE (0x03 << 29)
121#define SBC_IDE_PIO1_TOECS (0x01<<26) 118#define SBC_IDE_PIO1_TOECS (0x01 << 26)
122#define SBC_IDE_PIO1_TWCS (0x01<<28) 119#define SBC_IDE_PIO1_TWCS (0x01 << 28)
123#define SBC_IDE_PIO1_TCSH (0x06<<24) 120#define SBC_IDE_PIO1_TCSH (0x06 << 24)
124#define SBC_IDE_PIO1_TCSOFF (0x06<<20) 121#define SBC_IDE_PIO1_TCSOFF (0x06 << 20)
125#define SBC_IDE_PIO1_TWP (0x08<<14) 122#define SBC_IDE_PIO1_TWP (0x08 << 14)
126#define SBC_IDE_PIO1_TCSW (0x03<<10) 123#define SBC_IDE_PIO1_TCSW (0x03 << 10)
127#define SBC_IDE_PIO1_TPM (0x00<<6) 124#define SBC_IDE_PIO1_TPM (0x00 << 6)
128#define SBC_IDE_PIO1_TA (0x0B<<0) 125#define SBC_IDE_PIO1_TA (0x0B << 0)
129/* Timing parameters PIO mode 2 */ 126/* Timing parameters PIO mode 2 */
130#define SBC_IDE_PIO2_TCSOE (0x05<<29) 127#define SBC_IDE_PIO2_TCSOE (0x05 << 29)
131#define SBC_IDE_PIO2_TOECS (0x01<<26) 128#define SBC_IDE_PIO2_TOECS (0x01 << 26)
132#define SBC_IDE_PIO2_TWCS (0x01<<28) 129#define SBC_IDE_PIO2_TWCS (0x01 << 28)
133#define SBC_IDE_PIO2_TCSH (0x07<<24) 130#define SBC_IDE_PIO2_TCSH (0x07 << 24)
134#define SBC_IDE_PIO2_TCSOFF (0x07<<20) 131#define SBC_IDE_PIO2_TCSOFF (0x07 << 20)
135#define SBC_IDE_PIO2_TWP (0x1F<<14) 132#define SBC_IDE_PIO2_TWP (0x1F << 14)
136#define SBC_IDE_PIO2_TCSW (0x05<<10) 133#define SBC_IDE_PIO2_TCSW (0x05 << 10)
137#define SBC_IDE_PIO2_TPM (0x00<<6) 134#define SBC_IDE_PIO2_TPM (0x00 << 6)
138#define SBC_IDE_PIO2_TA (0x22<<0) 135#define SBC_IDE_PIO2_TA (0x22 << 0)
139/* Timing parameters PIO mode 3 */ 136/* Timing parameters PIO mode 3 */
140#define SBC_IDE_PIO3_TCSOE (0x05<<29) 137#define SBC_IDE_PIO3_TCSOE (0x05 << 29)
141#define SBC_IDE_PIO3_TOECS (0x01<<26) 138#define SBC_IDE_PIO3_TOECS (0x01 << 26)
142#define SBC_IDE_PIO3_TWCS (0x01<<28) 139#define SBC_IDE_PIO3_TWCS (0x01 << 28)
143#define SBC_IDE_PIO3_TCSH (0x0D<<24) 140#define SBC_IDE_PIO3_TCSH (0x0D << 24)
144#define SBC_IDE_PIO3_TCSOFF (0x0D<<20) 141#define SBC_IDE_PIO3_TCSOFF (0x0D << 20)
145#define SBC_IDE_PIO3_TWP (0x15<<14) 142#define SBC_IDE_PIO3_TWP (0x15 << 14)
146#define SBC_IDE_PIO3_TCSW (0x05<<10) 143#define SBC_IDE_PIO3_TCSW (0x05 << 10)
147#define SBC_IDE_PIO3_TPM (0x00<<6) 144#define SBC_IDE_PIO3_TPM (0x00 << 6)
148#define SBC_IDE_PIO3_TA (0x1A<<0) 145#define SBC_IDE_PIO3_TA (0x1A << 0)
149/* Timing parameters PIO mode 4 */ 146/* Timing parameters PIO mode 4 */
150#define SBC_IDE_PIO4_TCSOE (0x04<<29) 147#define SBC_IDE_PIO4_TCSOE (0x04 << 29)
151#define SBC_IDE_PIO4_TOECS (0x01<<26) 148#define SBC_IDE_PIO4_TOECS (0x01 << 26)
152#define SBC_IDE_PIO4_TWCS (0x01<<28) 149#define SBC_IDE_PIO4_TWCS (0x01 << 28)
153#define SBC_IDE_PIO4_TCSH (0x04<<24) 150#define SBC_IDE_PIO4_TCSH (0x04 << 24)
154#define SBC_IDE_PIO4_TCSOFF (0x04<<20) 151#define SBC_IDE_PIO4_TCSOFF (0x04 << 20)
155#define SBC_IDE_PIO4_TWP (0x0D<<14) 152#define SBC_IDE_PIO4_TWP (0x0D << 14)
156#define SBC_IDE_PIO4_TCSW (0x03<<10) 153#define SBC_IDE_PIO4_TCSW (0x03 << 10)
157#define SBC_IDE_PIO4_TPM (0x00<<6) 154#define SBC_IDE_PIO4_TPM (0x00 << 6)
158#define SBC_IDE_PIO4_TA (0x12<<0) 155#define SBC_IDE_PIO4_TA (0x12 << 0)
159/* Timing parameters MDMA mode 0 */ 156/* Timing parameters MDMA mode 0 */
160#define SBC_IDE_MDMA0_TCSOE (0x03<<29) 157#define SBC_IDE_MDMA0_TCSOE (0x03 << 29)
161#define SBC_IDE_MDMA0_TOECS (0x01<<26) 158#define SBC_IDE_MDMA0_TOECS (0x01 << 26)
162#define SBC_IDE_MDMA0_TWCS (0x01<<28) 159#define SBC_IDE_MDMA0_TWCS (0x01 << 28)
163#define SBC_IDE_MDMA0_TCSH (0x07<<24) 160#define SBC_IDE_MDMA0_TCSH (0x07 << 24)
164#define SBC_IDE_MDMA0_TCSOFF (0x07<<20) 161#define SBC_IDE_MDMA0_TCSOFF (0x07 << 20)
165#define SBC_IDE_MDMA0_TWP (0x0C<<14) 162#define SBC_IDE_MDMA0_TWP (0x0C << 14)
166#define SBC_IDE_MDMA0_TCSW (0x03<<10) 163#define SBC_IDE_MDMA0_TCSW (0x03 << 10)
167#define SBC_IDE_MDMA0_TPM (0x00<<6) 164#define SBC_IDE_MDMA0_TPM (0x00 << 6)
168#define SBC_IDE_MDMA0_TA (0x0F<<0) 165#define SBC_IDE_MDMA0_TA (0x0F << 0)
169/* Timing parameters MDMA mode 1 */ 166/* Timing parameters MDMA mode 1 */
170#define SBC_IDE_MDMA1_TCSOE (0x05<<29) 167#define SBC_IDE_MDMA1_TCSOE (0x05 << 29)
171#define SBC_IDE_MDMA1_TOECS (0x01<<26) 168#define SBC_IDE_MDMA1_TOECS (0x01 << 26)
172#define SBC_IDE_MDMA1_TWCS (0x01<<28) 169#define SBC_IDE_MDMA1_TWCS (0x01 << 28)
173#define SBC_IDE_MDMA1_TCSH (0x05<<24) 170#define SBC_IDE_MDMA1_TCSH (0x05 << 24)
174#define SBC_IDE_MDMA1_TCSOFF (0x05<<20) 171#define SBC_IDE_MDMA1_TCSOFF (0x05 << 20)
175#define SBC_IDE_MDMA1_TWP (0x0F<<14) 172#define SBC_IDE_MDMA1_TWP (0x0F << 14)
176#define SBC_IDE_MDMA1_TCSW (0x05<<10) 173#define SBC_IDE_MDMA1_TCSW (0x05 << 10)
177#define SBC_IDE_MDMA1_TPM (0x00<<6) 174#define SBC_IDE_MDMA1_TPM (0x00 << 6)
178#define SBC_IDE_MDMA1_TA (0x15<<0) 175#define SBC_IDE_MDMA1_TA (0x15 << 0)
179/* Timing parameters MDMA mode 2 */ 176/* Timing parameters MDMA mode 2 */
180#define SBC_IDE_MDMA2_TCSOE (0x04<<29) 177#define SBC_IDE_MDMA2_TCSOE (0x04 << 29)
181#define SBC_IDE_MDMA2_TOECS (0x01<<26) 178#define SBC_IDE_MDMA2_TOECS (0x01 << 26)
182#define SBC_IDE_MDMA2_TWCS (0x01<<28) 179#define SBC_IDE_MDMA2_TWCS (0x01 << 28)
183#define SBC_IDE_MDMA2_TCSH (0x04<<24) 180#define SBC_IDE_MDMA2_TCSH (0x04 << 24)
184#define SBC_IDE_MDMA2_TCSOFF (0x04<<20) 181#define SBC_IDE_MDMA2_TCSOFF (0x04 << 20)
185#define SBC_IDE_MDMA2_TWP (0x0D<<14) 182#define SBC_IDE_MDMA2_TWP (0x0D << 14)
186#define SBC_IDE_MDMA2_TCSW (0x04<<10) 183#define SBC_IDE_MDMA2_TCSW (0x04 << 10)
187#define SBC_IDE_MDMA2_TPM (0x00<<6) 184#define SBC_IDE_MDMA2_TPM (0x00 << 6)
188#define SBC_IDE_MDMA2_TA (0x12<<0) 185#define SBC_IDE_MDMA2_TA (0x12 << 0)
189 186
190#define SBC_IDE_TIMING(mode) \ 187#define SBC_IDE_TIMING(mode) \
191 SBC_IDE_##mode##_TWCS | \ 188 (SBC_IDE_##mode##_TWCS | \
192 SBC_IDE_##mode##_TCSH | \ 189 SBC_IDE_##mode##_TCSH | \
193 SBC_IDE_##mode##_TCSOFF | \ 190 SBC_IDE_##mode##_TCSOFF | \
194 SBC_IDE_##mode##_TWP | \ 191 SBC_IDE_##mode##_TWP | \
195 SBC_IDE_##mode##_TCSW | \ 192 SBC_IDE_##mode##_TCSW | \
196 SBC_IDE_##mode##_TPM | \ 193 SBC_IDE_##mode##_TPM | \
197 SBC_IDE_##mode##_TA 194 SBC_IDE_##mode##_TA)
diff --git a/include/asm-mips/mach-au1x00/au1xxx_psc.h b/include/asm-mips/mach-au1x00/au1xxx_psc.h
index 1bd4e27caf6b..dae4eca2417e 100644
--- a/include/asm-mips/mach-au1x00/au1xxx_psc.h
+++ b/include/asm-mips/mach-au1x00/au1xxx_psc.h
@@ -33,7 +33,6 @@
33#ifndef _AU1000_PSC_H_ 33#ifndef _AU1000_PSC_H_
34#define _AU1000_PSC_H_ 34#define _AU1000_PSC_H_
35 35
36
37/* The PSC base addresses. */ 36/* The PSC base addresses. */
38#ifdef CONFIG_SOC_AU1550 37#ifdef CONFIG_SOC_AU1550
39#define PSC0_BASE_ADDR 0xb1a00000 38#define PSC0_BASE_ADDR 0xb1a00000
@@ -47,8 +46,8 @@
47#define PSC1_BASE_ADDR 0xb1b00000 46#define PSC1_BASE_ADDR 0xb1b00000
48#endif 47#endif
49 48
50/* The PSC select and control registers are common to 49/*
51 * all protocols. 50 * The PSC select and control registers are common to all protocols.
52 */ 51 */
53#define PSC_SEL_OFFSET 0x00000000 52#define PSC_SEL_OFFSET 0x00000000
54#define PSC_CTRL_OFFSET 0x00000004 53#define PSC_CTRL_OFFSET 0x00000004
@@ -59,18 +58,17 @@
59#define PSC_SEL_CLK_SERCLK (2 << 4) 58#define PSC_SEL_CLK_SERCLK (2 << 4)
60 59
61#define PSC_SEL_PS_MASK 0x00000007 60#define PSC_SEL_PS_MASK 0x00000007
62#define PSC_SEL_PS_DISABLED (0) 61#define PSC_SEL_PS_DISABLED 0
63#define PSC_SEL_PS_SPIMODE (2) 62#define PSC_SEL_PS_SPIMODE 2
64#define PSC_SEL_PS_I2SMODE (3) 63#define PSC_SEL_PS_I2SMODE 3
65#define PSC_SEL_PS_AC97MODE (4) 64#define PSC_SEL_PS_AC97MODE 4
66#define PSC_SEL_PS_SMBUSMODE (5) 65#define PSC_SEL_PS_SMBUSMODE 5
67 66
68#define PSC_CTRL_DISABLE (0) 67#define PSC_CTRL_DISABLE 0
69#define PSC_CTRL_SUSPEND (2) 68#define PSC_CTRL_SUSPEND 2
70#define PSC_CTRL_ENABLE (3) 69#define PSC_CTRL_ENABLE 3
71 70
72/* AC97 Registers. 71/* AC97 Registers. */
73*/
74#define PSC_AC97CFG_OFFSET 0x00000008 72#define PSC_AC97CFG_OFFSET 0x00000008
75#define PSC_AC97MSK_OFFSET 0x0000000c 73#define PSC_AC97MSK_OFFSET 0x0000000c
76#define PSC_AC97PCR_OFFSET 0x00000010 74#define PSC_AC97PCR_OFFSET 0x00000010
@@ -95,8 +93,7 @@
95#define PSC_AC97GPO (AC97_PSC_BASE + PSC_AC97GPO_OFFSET) 93#define PSC_AC97GPO (AC97_PSC_BASE + PSC_AC97GPO_OFFSET)
96#define PSC_AC97GPI (AC97_PSC_BASE + PSC_AC97GPI_OFFSET) 94#define PSC_AC97GPI (AC97_PSC_BASE + PSC_AC97GPI_OFFSET)
97 95
98/* AC97 Config Register. 96/* AC97 Config Register. */
99*/
100#define PSC_AC97CFG_RT_MASK (3 << 30) 97#define PSC_AC97CFG_RT_MASK (3 << 30)
101#define PSC_AC97CFG_RT_FIFO1 (0 << 30) 98#define PSC_AC97CFG_RT_FIFO1 (0 << 30)
102#define PSC_AC97CFG_RT_FIFO2 (1 << 30) 99#define PSC_AC97CFG_RT_FIFO2 (1 << 30)
@@ -118,20 +115,19 @@
118#define PSC_AC97CFG_RXSLOT_MASK (0x3ff << 1) 115#define PSC_AC97CFG_RXSLOT_MASK (0x3ff << 1)
119#define PSC_AC97CFG_GE_ENABLE (1) 116#define PSC_AC97CFG_GE_ENABLE (1)
120 117
121/* Enable slots 3-12. 118/* Enable slots 3-12. */
122*/
123#define PSC_AC97CFG_TXSLOT_ENA(x) (1 << (((x) - 3) + 11)) 119#define PSC_AC97CFG_TXSLOT_ENA(x) (1 << (((x) - 3) + 11))
124#define PSC_AC97CFG_RXSLOT_ENA(x) (1 << (((x) - 3) + 1)) 120#define PSC_AC97CFG_RXSLOT_ENA(x) (1 << (((x) - 3) + 1))
125 121
126/* The word length equation is ((x) * 2) + 2, so choose 'x' appropriately. 122/*
123 * The word length equation is ((x) * 2) + 2, so choose 'x' appropriately.
127 * The only sensible numbers are 7, 9, or possibly 11. Nah, just do the 124 * The only sensible numbers are 7, 9, or possibly 11. Nah, just do the
128 * arithmetic in the macro. 125 * arithmetic in the macro.
129 */ 126 */
130#define PSC_AC97CFG_SET_LEN(x) (((((x)-2)/2) & 0xf) << 21) 127#define PSC_AC97CFG_SET_LEN(x) (((((x) - 2) / 2) & 0xf) << 21)
131#define PSC_AC97CFG_GET_LEN(x) (((((x) >> 21) & 0xf) * 2) + 2) 128#define PSC_AC97CFG_GET_LEN(x) (((((x) >> 21) & 0xf) * 2) + 2)
132 129
133/* AC97 Mask Register. 130/* AC97 Mask Register. */
134*/
135#define PSC_AC97MSK_GR (1 << 25) 131#define PSC_AC97MSK_GR (1 << 25)
136#define PSC_AC97MSK_CD (1 << 24) 132#define PSC_AC97MSK_CD (1 << 24)
137#define PSC_AC97MSK_RR (1 << 13) 133#define PSC_AC97MSK_RR (1 << 13)
@@ -148,8 +144,7 @@
148 PSC_AC97MSK_TO | PSC_AC97MSK_TU | \ 144 PSC_AC97MSK_TO | PSC_AC97MSK_TU | \
149 PSC_AC97MSK_RD | PSC_AC97MSK_TD) 145 PSC_AC97MSK_RD | PSC_AC97MSK_TD)
150 146
151/* AC97 Protocol Control Register. 147/* AC97 Protocol Control Register. */
152*/
153#define PSC_AC97PCR_RC (1 << 6) 148#define PSC_AC97PCR_RC (1 << 6)
154#define PSC_AC97PCR_RP (1 << 5) 149#define PSC_AC97PCR_RP (1 << 5)
155#define PSC_AC97PCR_RS (1 << 4) 150#define PSC_AC97PCR_RS (1 << 4)
@@ -157,8 +152,7 @@
157#define PSC_AC97PCR_TP (1 << 1) 152#define PSC_AC97PCR_TP (1 << 1)
158#define PSC_AC97PCR_TS (1 << 0) 153#define PSC_AC97PCR_TS (1 << 0)
159 154
160/* AC97 Status register (read only). 155/* AC97 Status register (read only). */
161*/
162#define PSC_AC97STAT_CB (1 << 26) 156#define PSC_AC97STAT_CB (1 << 26)
163#define PSC_AC97STAT_CP (1 << 25) 157#define PSC_AC97STAT_CP (1 << 25)
164#define PSC_AC97STAT_CR (1 << 24) 158#define PSC_AC97STAT_CR (1 << 24)
@@ -174,8 +168,7 @@
174#define PSC_AC97STAT_DR (1 << 1) 168#define PSC_AC97STAT_DR (1 << 1)
175#define PSC_AC97STAT_SR (1 << 0) 169#define PSC_AC97STAT_SR (1 << 0)
176 170
177/* AC97 Event Register. 171/* AC97 Event Register. */
178*/
179#define PSC_AC97EVNT_GR (1 << 25) 172#define PSC_AC97EVNT_GR (1 << 25)
180#define PSC_AC97EVNT_CD (1 << 24) 173#define PSC_AC97EVNT_CD (1 << 24)
181#define PSC_AC97EVNT_RR (1 << 13) 174#define PSC_AC97EVNT_RR (1 << 13)
@@ -187,22 +180,18 @@
187#define PSC_AC97EVNT_RD (1 << 5) 180#define PSC_AC97EVNT_RD (1 << 5)
188#define PSC_AC97EVNT_TD (1 << 4) 181#define PSC_AC97EVNT_TD (1 << 4)
189 182
190/* CODEC Command Register. 183/* CODEC Command Register. */
191*/
192#define PSC_AC97CDC_RD (1 << 25) 184#define PSC_AC97CDC_RD (1 << 25)
193#define PSC_AC97CDC_ID_MASK (3 << 23) 185#define PSC_AC97CDC_ID_MASK (3 << 23)
194#define PSC_AC97CDC_INDX_MASK (0x7f << 16) 186#define PSC_AC97CDC_INDX_MASK (0x7f << 16)
195#define PSC_AC97CDC_ID(x) (((x) & 0x3) << 23) 187#define PSC_AC97CDC_ID(x) (((x) & 0x03) << 23)
196#define PSC_AC97CDC_INDX(x) (((x) & 0x7f) << 16) 188#define PSC_AC97CDC_INDX(x) (((x) & 0x7f) << 16)
197 189
198/* AC97 Reset Control Register. 190/* AC97 Reset Control Register. */
199*/
200#define PSC_AC97RST_RST (1 << 1) 191#define PSC_AC97RST_RST (1 << 1)
201#define PSC_AC97RST_SNC (1 << 0) 192#define PSC_AC97RST_SNC (1 << 0)
202 193
203 194/* PSC in I2S Mode. */
204/* PSC in I2S Mode.
205*/
206typedef struct psc_i2s { 195typedef struct psc_i2s {
207 u32 psc_sel; 196 u32 psc_sel;
208 u32 psc_ctrl; 197 u32 psc_ctrl;
@@ -215,8 +204,7 @@ typedef struct psc_i2s {
215 u32 psc_i2sudf; 204 u32 psc_i2sudf;
216} psc_i2s_t; 205} psc_i2s_t;
217 206
218/* I2S Config Register. 207/* I2S Config Register. */
219*/
220#define PSC_I2SCFG_RT_MASK (3 << 30) 208#define PSC_I2SCFG_RT_MASK (3 << 30)
221#define PSC_I2SCFG_RT_FIFO1 (0 << 30) 209#define PSC_I2SCFG_RT_FIFO1 (0 << 30)
222#define PSC_I2SCFG_RT_FIFO2 (1 << 30) 210#define PSC_I2SCFG_RT_FIFO2 (1 << 30)
@@ -247,8 +235,7 @@ typedef struct psc_i2s {
247#define PSC_I2SCFG_MLJ (1 << 10) 235#define PSC_I2SCFG_MLJ (1 << 10)
248#define PSC_I2SCFG_XM (1 << 9) 236#define PSC_I2SCFG_XM (1 << 9)
249 237
250/* The word length equation is simply LEN+1. 238/* The word length equation is simply LEN+1. */
251 */
252#define PSC_I2SCFG_SET_LEN(x) ((((x) - 1) & 0x1f) << 4) 239#define PSC_I2SCFG_SET_LEN(x) ((((x) - 1) & 0x1f) << 4)
253#define PSC_I2SCFG_GET_LEN(x) ((((x) >> 4) & 0x1f) + 1) 240#define PSC_I2SCFG_GET_LEN(x) ((((x) >> 4) & 0x1f) + 1)
254 241
@@ -256,8 +243,7 @@ typedef struct psc_i2s {
256#define PSC_I2SCFG_MLF (1 << 1) 243#define PSC_I2SCFG_MLF (1 << 1)
257#define PSC_I2SCFG_MS (1 << 0) 244#define PSC_I2SCFG_MS (1 << 0)
258 245
259/* I2S Mask Register. 246/* I2S Mask Register. */
260*/
261#define PSC_I2SMSK_RR (1 << 13) 247#define PSC_I2SMSK_RR (1 << 13)
262#define PSC_I2SMSK_RO (1 << 12) 248#define PSC_I2SMSK_RO (1 << 12)
263#define PSC_I2SMSK_RU (1 << 11) 249#define PSC_I2SMSK_RU (1 << 11)
@@ -271,8 +257,7 @@ typedef struct psc_i2s {
271 PSC_I2SMSK_TO | PSC_I2SMSK_TU | \ 257 PSC_I2SMSK_TO | PSC_I2SMSK_TU | \
272 PSC_I2SMSK_RD | PSC_I2SMSK_TD) 258 PSC_I2SMSK_RD | PSC_I2SMSK_TD)
273 259
274/* I2S Protocol Control Register. 260/* I2S Protocol Control Register. */
275*/
276#define PSC_I2SPCR_RC (1 << 6) 261#define PSC_I2SPCR_RC (1 << 6)
277#define PSC_I2SPCR_RP (1 << 5) 262#define PSC_I2SPCR_RP (1 << 5)
278#define PSC_I2SPCR_RS (1 << 4) 263#define PSC_I2SPCR_RS (1 << 4)
@@ -280,8 +265,7 @@ typedef struct psc_i2s {
280#define PSC_I2SPCR_TP (1 << 1) 265#define PSC_I2SPCR_TP (1 << 1)
281#define PSC_I2SPCR_TS (1 << 0) 266#define PSC_I2SPCR_TS (1 << 0)
282 267
283/* I2S Status register (read only). 268/* I2S Status register (read only). */
284*/
285#define PSC_I2SSTAT_RF (1 << 13) 269#define PSC_I2SSTAT_RF (1 << 13)
286#define PSC_I2SSTAT_RE (1 << 12) 270#define PSC_I2SSTAT_RE (1 << 12)
287#define PSC_I2SSTAT_RR (1 << 11) 271#define PSC_I2SSTAT_RR (1 << 11)
@@ -294,8 +278,7 @@ typedef struct psc_i2s {
294#define PSC_I2SSTAT_DR (1 << 1) 278#define PSC_I2SSTAT_DR (1 << 1)
295#define PSC_I2SSTAT_SR (1 << 0) 279#define PSC_I2SSTAT_SR (1 << 0)
296 280
297/* I2S Event Register. 281/* I2S Event Register. */
298*/
299#define PSC_I2SEVNT_RR (1 << 13) 282#define PSC_I2SEVNT_RR (1 << 13)
300#define PSC_I2SEVNT_RO (1 << 12) 283#define PSC_I2SEVNT_RO (1 << 12)
301#define PSC_I2SEVNT_RU (1 << 11) 284#define PSC_I2SEVNT_RU (1 << 11)
@@ -305,8 +288,7 @@ typedef struct psc_i2s {
305#define PSC_I2SEVNT_RD (1 << 5) 288#define PSC_I2SEVNT_RD (1 << 5)
306#define PSC_I2SEVNT_TD (1 << 4) 289#define PSC_I2SEVNT_TD (1 << 4)
307 290
308/* PSC in SPI Mode. 291/* PSC in SPI Mode. */
309*/
310typedef struct psc_spi { 292typedef struct psc_spi {
311 u32 psc_sel; 293 u32 psc_sel;
312 u32 psc_ctrl; 294 u32 psc_ctrl;
@@ -318,8 +300,7 @@ typedef struct psc_spi {
318 u32 psc_spitxrx; 300 u32 psc_spitxrx;
319} psc_spi_t; 301} psc_spi_t;
320 302
321/* SPI Config Register. 303/* SPI Config Register. */
322*/
323#define PSC_SPICFG_RT_MASK (3 << 30) 304#define PSC_SPICFG_RT_MASK (3 << 30)
324#define PSC_SPICFG_RT_FIFO1 (0 << 30) 305#define PSC_SPICFG_RT_FIFO1 (0 << 30)
325#define PSC_SPICFG_RT_FIFO2 (1 << 30) 306#define PSC_SPICFG_RT_FIFO2 (1 << 30)
@@ -355,8 +336,7 @@ typedef struct psc_spi {
355#define PSC_SPICFG_MLF (1 << 1) 336#define PSC_SPICFG_MLF (1 << 1)
356#define PSC_SPICFG_MO (1 << 0) 337#define PSC_SPICFG_MO (1 << 0)
357 338
358/* SPI Mask Register. 339/* SPI Mask Register. */
359*/
360#define PSC_SPIMSK_MM (1 << 16) 340#define PSC_SPIMSK_MM (1 << 16)
361#define PSC_SPIMSK_RR (1 << 13) 341#define PSC_SPIMSK_RR (1 << 13)
362#define PSC_SPIMSK_RO (1 << 12) 342#define PSC_SPIMSK_RO (1 << 12)
@@ -371,16 +351,14 @@ typedef struct psc_spi {
371 PSC_SPIMSK_TU | PSC_SPIMSK_SD | \ 351 PSC_SPIMSK_TU | PSC_SPIMSK_SD | \
372 PSC_SPIMSK_MD) 352 PSC_SPIMSK_MD)
373 353
374/* SPI Protocol Control Register. 354/* SPI Protocol Control Register. */
375*/
376#define PSC_SPIPCR_RC (1 << 6) 355#define PSC_SPIPCR_RC (1 << 6)
377#define PSC_SPIPCR_SP (1 << 5) 356#define PSC_SPIPCR_SP (1 << 5)
378#define PSC_SPIPCR_SS (1 << 4) 357#define PSC_SPIPCR_SS (1 << 4)
379#define PSC_SPIPCR_TC (1 << 2) 358#define PSC_SPIPCR_TC (1 << 2)
380#define PSC_SPIPCR_MS (1 << 0) 359#define PSC_SPIPCR_MS (1 << 0)
381 360
382/* SPI Status register (read only). 361/* SPI Status register (read only). */
383*/
384#define PSC_SPISTAT_RF (1 << 13) 362#define PSC_SPISTAT_RF (1 << 13)
385#define PSC_SPISTAT_RE (1 << 12) 363#define PSC_SPISTAT_RE (1 << 12)
386#define PSC_SPISTAT_RR (1 << 11) 364#define PSC_SPISTAT_RR (1 << 11)
@@ -393,8 +371,7 @@ typedef struct psc_spi {
393#define PSC_SPISTAT_DR (1 << 1) 371#define PSC_SPISTAT_DR (1 << 1)
394#define PSC_SPISTAT_SR (1 << 0) 372#define PSC_SPISTAT_SR (1 << 0)
395 373
396/* SPI Event Register. 374/* SPI Event Register. */
397*/
398#define PSC_SPIEVNT_MM (1 << 16) 375#define PSC_SPIEVNT_MM (1 << 16)
399#define PSC_SPIEVNT_RR (1 << 13) 376#define PSC_SPIEVNT_RR (1 << 13)
400#define PSC_SPIEVNT_RO (1 << 12) 377#define PSC_SPIEVNT_RO (1 << 12)
@@ -405,13 +382,11 @@ typedef struct psc_spi {
405#define PSC_SPIEVNT_SD (1 << 5) 382#define PSC_SPIEVNT_SD (1 << 5)
406#define PSC_SPIEVNT_MD (1 << 4) 383#define PSC_SPIEVNT_MD (1 << 4)
407 384
408/* Transmit register control. 385/* Transmit register control. */
409*/
410#define PSC_SPITXRX_LC (1 << 29) 386#define PSC_SPITXRX_LC (1 << 29)
411#define PSC_SPITXRX_SR (1 << 28) 387#define PSC_SPITXRX_SR (1 << 28)
412 388
413/* PSC in SMBus (I2C) Mode. 389/* PSC in SMBus (I2C) Mode. */
414*/
415typedef struct psc_smb { 390typedef struct psc_smb {
416 u32 psc_sel; 391 u32 psc_sel;
417 u32 psc_ctrl; 392 u32 psc_ctrl;
@@ -424,8 +399,7 @@ typedef struct psc_smb {
424 u32 psc_smbtmr; 399 u32 psc_smbtmr;
425} psc_smb_t; 400} psc_smb_t;
426 401
427/* SMBus Config Register. 402/* SMBus Config Register. */
428*/
429#define PSC_SMBCFG_RT_MASK (3 << 30) 403#define PSC_SMBCFG_RT_MASK (3 << 30)
430#define PSC_SMBCFG_RT_FIFO1 (0 << 30) 404#define PSC_SMBCFG_RT_FIFO1 (0 << 30)
431#define PSC_SMBCFG_RT_FIFO2 (1 << 30) 405#define PSC_SMBCFG_RT_FIFO2 (1 << 30)
@@ -452,8 +426,7 @@ typedef struct psc_smb {
452 426
453#define PSC_SMBCFG_SET_SLV(x) (((x) & 0x7f) << 1) 427#define PSC_SMBCFG_SET_SLV(x) (((x) & 0x7f) << 1)
454 428
455/* SMBus Mask Register. 429/* SMBus Mask Register. */
456*/
457#define PSC_SMBMSK_DN (1 << 30) 430#define PSC_SMBMSK_DN (1 << 30)
458#define PSC_SMBMSK_AN (1 << 29) 431#define PSC_SMBMSK_AN (1 << 29)
459#define PSC_SMBMSK_AL (1 << 28) 432#define PSC_SMBMSK_AL (1 << 28)
@@ -471,13 +444,11 @@ typedef struct psc_smb {
471 PSC_SMBMSK_TU | PSC_SMBMSK_SD | \ 444 PSC_SMBMSK_TU | PSC_SMBMSK_SD | \
472 PSC_SMBMSK_MD) 445 PSC_SMBMSK_MD)
473 446
474/* SMBus Protocol Control Register. 447/* SMBus Protocol Control Register. */
475*/
476#define PSC_SMBPCR_DC (1 << 2) 448#define PSC_SMBPCR_DC (1 << 2)
477#define PSC_SMBPCR_MS (1 << 0) 449#define PSC_SMBPCR_MS (1 << 0)
478 450
479/* SMBus Status register (read only). 451/* SMBus Status register (read only). */
480*/
481#define PSC_SMBSTAT_BB (1 << 28) 452#define PSC_SMBSTAT_BB (1 << 28)
482#define PSC_SMBSTAT_RF (1 << 13) 453#define PSC_SMBSTAT_RF (1 << 13)
483#define PSC_SMBSTAT_RE (1 << 12) 454#define PSC_SMBSTAT_RE (1 << 12)
@@ -491,8 +462,7 @@ typedef struct psc_smb {
491#define PSC_SMBSTAT_DR (1 << 1) 462#define PSC_SMBSTAT_DR (1 << 1)
492#define PSC_SMBSTAT_SR (1 << 0) 463#define PSC_SMBSTAT_SR (1 << 0)
493 464
494/* SMBus Event Register. 465/* SMBus Event Register. */
495*/
496#define PSC_SMBEVNT_DN (1 << 30) 466#define PSC_SMBEVNT_DN (1 << 30)
497#define PSC_SMBEVNT_AN (1 << 29) 467#define PSC_SMBEVNT_AN (1 << 29)
498#define PSC_SMBEVNT_AL (1 << 28) 468#define PSC_SMBEVNT_AL (1 << 28)
@@ -510,15 +480,13 @@ typedef struct psc_smb {
510 PSC_SMBEVNT_TU | PSC_SMBEVNT_SD | \ 480 PSC_SMBEVNT_TU | PSC_SMBEVNT_SD | \
511 PSC_SMBEVNT_MD) 481 PSC_SMBEVNT_MD)
512 482
513/* Transmit register control. 483/* Transmit register control. */
514*/
515#define PSC_SMBTXRX_RSR (1 << 28) 484#define PSC_SMBTXRX_RSR (1 << 28)
516#define PSC_SMBTXRX_STP (1 << 29) 485#define PSC_SMBTXRX_STP (1 << 29)
517#define PSC_SMBTXRX_DATAMASK (0xff) 486#define PSC_SMBTXRX_DATAMASK 0xff
518 487
519/* SMBus protocol timers register. 488/* SMBus protocol timers register. */
520*/ 489#define PSC_SMBTMR_SET_TH(x) (((x) & 0x03) << 30)
521#define PSC_SMBTMR_SET_TH(x) (((x) & 0x3) << 30)
522#define PSC_SMBTMR_SET_PS(x) (((x) & 0x1f) << 25) 490#define PSC_SMBTMR_SET_PS(x) (((x) & 0x1f) << 25)
523#define PSC_SMBTMR_SET_PU(x) (((x) & 0x1f) << 20) 491#define PSC_SMBTMR_SET_PU(x) (((x) & 0x1f) << 20)
524#define PSC_SMBTMR_SET_SH(x) (((x) & 0x1f) << 15) 492#define PSC_SMBTMR_SET_SH(x) (((x) & 0x1f) << 15)
@@ -526,5 +494,4 @@ typedef struct psc_smb {
526#define PSC_SMBTMR_SET_CL(x) (((x) & 0x1f) << 5) 494#define PSC_SMBTMR_SET_CL(x) (((x) & 0x1f) << 5)
527#define PSC_SMBTMR_SET_CH(x) (((x) & 0x1f) << 0) 495#define PSC_SMBTMR_SET_CH(x) (((x) & 0x1f) << 0)
528 496
529
530#endif /* _AU1000_PSC_H_ */ 497#endif /* _AU1000_PSC_H_ */
diff --git a/include/asm-mips/mach-db1x00/db1200.h b/include/asm-mips/mach-db1x00/db1200.h
index eedd048a7261..27f26102b1bb 100644
--- a/include/asm-mips/mach-db1x00/db1200.h
+++ b/include/asm-mips/mach-db1x00/db1200.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * AMD Alchemy DB1200 Referrence Board 2 * AMD Alchemy DBAu1200 Reference Board
3 * Board Registers defines. 3 * Board register defines.
4 * 4 *
5 * ######################################################################## 5 * ########################################################################
6 * 6 *
@@ -27,26 +27,25 @@
27#include <linux/types.h> 27#include <linux/types.h>
28#include <asm/mach-au1x00/au1xxx_psc.h> 28#include <asm/mach-au1x00/au1xxx_psc.h>
29 29
30// This is defined in au1000.h with bogus value 30#define DBDMA_AC97_TX_CHAN DSCR_CMD0_PSC1_TX
31#undef AU1X00_EXTERNAL_INT 31#define DBDMA_AC97_RX_CHAN DSCR_CMD0_PSC1_RX
32#define DBDMA_I2S_TX_CHAN DSCR_CMD0_PSC1_TX
33#define DBDMA_I2S_RX_CHAN DSCR_CMD0_PSC1_RX
32 34
33#define DBDMA_AC97_TX_CHAN DSCR_CMD0_PSC1_TX 35/*
34#define DBDMA_AC97_RX_CHAN DSCR_CMD0_PSC1_RX 36 * SPI and SMB are muxed on the DBAu1200 board.
35#define DBDMA_I2S_TX_CHAN DSCR_CMD0_PSC1_TX 37 * Refer to board documentation.
36#define DBDMA_I2S_RX_CHAN DSCR_CMD0_PSC1_RX
37
38/* SPI and SMB are muxed on the Pb1200 board.
39 Refer to board documentation.
40 */ 38 */
41#define SPI_PSC_BASE PSC0_BASE_ADDR 39#define SPI_PSC_BASE PSC0_BASE_ADDR
42#define SMBUS_PSC_BASE PSC0_BASE_ADDR 40#define SMBUS_PSC_BASE PSC0_BASE_ADDR
43/* AC97 and I2S are muxed on the Pb1200 board. 41/*
44 Refer to board documentation. 42 * AC'97 and I2S are muxed on the DBAu1200 board.
43 * Refer to board documentation.
45 */ 44 */
46#define AC97_PSC_BASE PSC1_BASE_ADDR 45#define AC97_PSC_BASE PSC1_BASE_ADDR
47#define I2S_PSC_BASE PSC1_BASE_ADDR 46#define I2S_PSC_BASE PSC1_BASE_ADDR
48 47
49#define BCSR_KSEG1_ADDR 0xB9800000 48#define BCSR_KSEG1_ADDR 0xB9800000
50 49
51typedef volatile struct 50typedef volatile struct
52{ 51{
@@ -102,9 +101,9 @@ static BCSR * const bcsr = (BCSR *)BCSR_KSEG1_ADDR;
102#define BCSR_STATUS_SWAPBOOT 0x0040 101#define BCSR_STATUS_SWAPBOOT 0x0040
103#define BCSR_STATUS_FLASHBUSY 0x0100 102#define BCSR_STATUS_FLASHBUSY 0x0100
104#define BCSR_STATUS_IDECBLID 0x0200 103#define BCSR_STATUS_IDECBLID 0x0200
105#define BCSR_STATUS_SD0WP 0x0400 104#define BCSR_STATUS_SD0WP 0x0400
106#define BCSR_STATUS_U0RXD 0x1000 105#define BCSR_STATUS_U0RXD 0x1000
107#define BCSR_STATUS_U1RXD 0x2000 106#define BCSR_STATUS_U1RXD 0x2000
108 107
109#define BCSR_SWITCHES_OCTAL 0x00FF 108#define BCSR_SWITCHES_OCTAL 0x00FF
110#define BCSR_SWITCHES_DIP_1 0x0080 109#define BCSR_SWITCHES_DIP_1 0x0080
@@ -122,8 +121,8 @@ static BCSR * const bcsr = (BCSR *)BCSR_KSEG1_ADDR;
122#define BCSR_RESETS_DC 0x0004 121#define BCSR_RESETS_DC 0x0004
123#define BCSR_RESETS_IDE 0x0008 122#define BCSR_RESETS_IDE 0x0008
124#define BCSR_RESETS_TV 0x0010 123#define BCSR_RESETS_TV 0x0010
125/* not resets but in the same register */ 124/* Not resets but in the same register */
126#define BCSR_RESETS_PWMR1mUX 0x0800 125#define BCSR_RESETS_PWMR1MUX 0x0800
127#define BCSR_RESETS_PCS0MUX 0x1000 126#define BCSR_RESETS_PCS0MUX 0x1000
128#define BCSR_RESETS_PCS1MUX 0x2000 127#define BCSR_RESETS_PCS1MUX 0x2000
129#define BCSR_RESETS_SPISEL 0x4000 128#define BCSR_RESETS_SPISEL 0x4000
@@ -160,7 +159,7 @@ static BCSR * const bcsr = (BCSR *)BCSR_KSEG1_ADDR;
160#define BCSR_INT_PC0STSCHG 0x0008 159#define BCSR_INT_PC0STSCHG 0x0008
161#define BCSR_INT_PC1 0x0010 160#define BCSR_INT_PC1 0x0010
162#define BCSR_INT_PC1STSCHG 0x0020 161#define BCSR_INT_PC1STSCHG 0x0020
163#define BCSR_INT_DC 0x0040 162#define BCSR_INT_DC 0x0040
164#define BCSR_INT_FLASHBUSY 0x0080 163#define BCSR_INT_FLASHBUSY 0x0080
165#define BCSR_INT_PC0INSERT 0x0100 164#define BCSR_INT_PC0INSERT 0x0100
166#define BCSR_INT_PC0EJECT 0x0200 165#define BCSR_INT_PC0EJECT 0x0200
@@ -179,10 +178,10 @@ static BCSR * const bcsr = (BCSR *)BCSR_KSEG1_ADDR;
179#define IDE_DDMA_REQ DSCR_CMD0_DMA_REQ1 178#define IDE_DDMA_REQ DSCR_CMD0_DMA_REQ1
180#define IDE_RQSIZE 128 179#define IDE_RQSIZE 128
181 180
182#define NAND_PHYS_ADDR 0x20000000 181#define NAND_PHYS_ADDR 0x20000000
183 182
184/* 183/*
185 * External Interrupts for Pb1200 as of 8/6/2004. 184 * External Interrupts for DBAu1200 as of 8/6/2004.
186 * Bit positions in the CPLD registers can be calculated by taking 185 * Bit positions in the CPLD registers can be calculated by taking
187 * the interrupt define and subtracting the DB1200_INT_BEGIN value. 186 * the interrupt define and subtracting the DB1200_INT_BEGIN value.
188 * 187 *
@@ -211,23 +210,21 @@ enum external_pb1200_ints {
211}; 210};
212 211
213 212
214/* For drivers/pcmcia/au1000_db1x00.c */ 213/*
215 214 * DBAu1200 specific PCMCIA defines for drivers/pcmcia/au1000_db1x00.c
216/* PCMCIA Db1x00 specific defines */ 215 */
217 216#define PCMCIA_MAX_SOCK 1
218#define PCMCIA_MAX_SOCK 1 217#define PCMCIA_NUM_SOCKS (PCMCIA_MAX_SOCK + 1)
219#define PCMCIA_NUM_SOCKS (PCMCIA_MAX_SOCK+1)
220 218
221/* VPP/VCC */ 219/* VPP/VCC */
222#define SET_VCC_VPP(VCC, VPP, SLOT)\ 220#define SET_VCC_VPP(VCC, VPP, SLOT) \
223 ((((VCC)<<2) | ((VPP)<<0)) << ((SLOT)*8)) 221 ((((VCC) << 2) | ((VPP) << 0)) << ((SLOT) * 8))
224 222
225#define BOARD_PC0_INT DB1200_PC0_INT 223#define BOARD_PC0_INT DB1200_PC0_INT
226#define BOARD_PC1_INT DB1200_PC1_INT 224#define BOARD_PC1_INT DB1200_PC1_INT
227#define BOARD_CARD_INSERTED(SOCKET) bcsr->sig_status & (1<<(8+(2*SOCKET))) 225#define BOARD_CARD_INSERTED(SOCKET) bcsr->sig_status & (1 << (8 + (2 * SOCKET)))
228 226
229/* Nand chip select */ 227/* NAND chip select */
230#define NAND_CS 1 228#define NAND_CS 1
231 229
232#endif /* __ASM_DB1200_H */ 230#endif /* __ASM_DB1200_H */
233
diff --git a/include/asm-mips/mach-db1x00/db1x00.h b/include/asm-mips/mach-db1x00/db1x00.h
index e7a88ba35833..612ae90dbcb8 100644
--- a/include/asm-mips/mach-db1x00/db1x00.h
+++ b/include/asm-mips/mach-db1x00/db1x00.h
@@ -1,9 +1,8 @@
1/* 1/*
2 * AMD Alchemy DB1x00 Reference Boards 2 * AMD Alchemy DBAu1x00 Reference Boards
3 * 3 *
4 * Copyright 2001 MontaVista Software Inc. 4 * Copyright 2001, 2008 MontaVista Software Inc.
5 * Author: MontaVista Software, Inc. 5 * Author: MontaVista Software, Inc. <source@mvista.com>
6 * ppopov@mvista.com or source@mvista.com
7 * Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org) 6 * Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org)
8 * 7 *
9 * ######################################################################## 8 * ########################################################################
@@ -32,26 +31,26 @@
32 31
33#ifdef CONFIG_MIPS_DB1550 32#ifdef CONFIG_MIPS_DB1550
34 33
35#define DBDMA_AC97_TX_CHAN DSCR_CMD0_PSC1_TX 34#define DBDMA_AC97_TX_CHAN DSCR_CMD0_PSC1_TX
36#define DBDMA_AC97_RX_CHAN DSCR_CMD0_PSC1_RX 35#define DBDMA_AC97_RX_CHAN DSCR_CMD0_PSC1_RX
37#define DBDMA_I2S_TX_CHAN DSCR_CMD0_PSC3_TX 36#define DBDMA_I2S_TX_CHAN DSCR_CMD0_PSC3_TX
38#define DBDMA_I2S_RX_CHAN DSCR_CMD0_PSC3_RX 37#define DBDMA_I2S_RX_CHAN DSCR_CMD0_PSC3_RX
39 38
40#define SPI_PSC_BASE PSC0_BASE_ADDR 39#define SPI_PSC_BASE PSC0_BASE_ADDR
41#define AC97_PSC_BASE PSC1_BASE_ADDR 40#define AC97_PSC_BASE PSC1_BASE_ADDR
42#define SMBUS_PSC_BASE PSC2_BASE_ADDR 41#define SMBUS_PSC_BASE PSC2_BASE_ADDR
43#define I2S_PSC_BASE PSC3_BASE_ADDR 42#define I2S_PSC_BASE PSC3_BASE_ADDR
44 43
45#define BCSR_KSEG1_ADDR 0xAF000000 44#define BCSR_KSEG1_ADDR 0xAF000000
46#define NAND_PHYS_ADDR 0x20000000 45#define NAND_PHYS_ADDR 0x20000000
47 46
48#else 47#else
49#define BCSR_KSEG1_ADDR 0xAE000000 48#define BCSR_KSEG1_ADDR 0xAE000000
50#endif 49#endif
51 50
52/* 51/*
53 * Overlay data structure of the Db1x00 board registers. 52 * Overlay data structure of the DBAu1x00 board registers.
54 * Registers located at physical 0E0000xx, KSEG1 0xAE0000xx 53 * Registers are located at physical 0E0000xx, KSEG1 0xAE0000xx.
55 */ 54 */
56typedef volatile struct 55typedef volatile struct
57{ 56{
@@ -138,18 +137,19 @@ typedef volatile struct
138 137
139#define BCSR_SWRESET_RESET 0x0080 138#define BCSR_SWRESET_RESET 0x0080
140 139
141/* PCMCIA Db1x00 specific defines */ 140/* PCMCIA DBAu1x00 specific defines */
142#define PCMCIA_MAX_SOCK 1 141#define PCMCIA_MAX_SOCK 1
143#define PCMCIA_NUM_SOCKS (PCMCIA_MAX_SOCK+1) 142#define PCMCIA_NUM_SOCKS (PCMCIA_MAX_SOCK + 1)
144 143
145/* VPP/VCC */ 144/* VPP/VCC */
146#define SET_VCC_VPP(VCC, VPP, SLOT)\ 145#define SET_VCC_VPP(VCC, VPP, SLOT)\
147 ((((VCC)<<2) | ((VPP)<<0)) << ((SLOT)*8)) 146 ((((VCC) << 2) | ((VPP) << 0)) << ((SLOT) * 8))
148 147
149/* SD controller macros */
150/* 148/*
151 * Detect card. 149 * SD controller macros
152 */ 150 */
151
152/* Detect card. */
153#define mmc_card_inserted(_n_, _res_) \ 153#define mmc_card_inserted(_n_, _res_) \
154 do { \ 154 do { \
155 BCSR * const bcsr = (BCSR *)0xAE000000; \ 155 BCSR * const bcsr = (BCSR *)0xAE000000; \
@@ -176,10 +176,10 @@ typedef volatile struct
176 unsigned long mmc_pwr, mmc_wp, board_specific; \ 176 unsigned long mmc_pwr, mmc_wp, board_specific; \
177 if ((_n_)) { \ 177 if ((_n_)) { \
178 mmc_pwr = BCSR_BOARD_SD1_PWR; \ 178 mmc_pwr = BCSR_BOARD_SD1_PWR; \
179 mmc_wp = BCSR_BOARD_SD1_WP; \ 179 mmc_wp = BCSR_BOARD_SD1_WP; \
180 } else { \ 180 } else { \
181 mmc_pwr = BCSR_BOARD_SD0_PWR; \ 181 mmc_pwr = BCSR_BOARD_SD0_PWR; \
182 mmc_wp = BCSR_BOARD_SD0_WP; \ 182 mmc_wp = BCSR_BOARD_SD0_WP; \
183 } \ 183 } \
184 board_specific = au_readl((unsigned long)(&bcsr->specific)); \ 184 board_specific = au_readl((unsigned long)(&bcsr->specific)); \
185 if (!(board_specific & mmc_wp)) {/* low means card present */ \ 185 if (!(board_specific & mmc_wp)) {/* low means card present */ \
@@ -190,17 +190,19 @@ typedef volatile struct
190 } while (0) 190 } while (0)
191 191
192 192
193/* NAND defines */ 193/*
194/* Timing values as described in databook, * ns value stripped of 194 * NAND defines
195 *
196 * Timing values as described in databook, * ns value stripped of the
195 * lower 2 bits. 197 * lower 2 bits.
196 * These defines are here rather than an SOC1550 generic file because 198 * These defines are here rather than an Au1550 generic file because
197 * the parts chosen on another board may be different and may require 199 * the parts chosen on another board may be different and may require
198 * different timings. 200 * different timings.
199 */ 201 */
200#define NAND_T_H (18 >> 2) 202#define NAND_T_H (18 >> 2)
201#define NAND_T_PUL (30 >> 2) 203#define NAND_T_PUL (30 >> 2)
202#define NAND_T_SU (30 >> 2) 204#define NAND_T_SU (30 >> 2)
203#define NAND_T_WH (30 >> 2) 205#define NAND_T_WH (30 >> 2)
204 206
205/* Bitfield shift amounts */ 207/* Bitfield shift amounts */
206#define NAND_T_H_SHIFT 0 208#define NAND_T_H_SHIFT 0
@@ -208,16 +210,15 @@ typedef volatile struct
208#define NAND_T_SU_SHIFT 8 210#define NAND_T_SU_SHIFT 8
209#define NAND_T_WH_SHIFT 12 211#define NAND_T_WH_SHIFT 12
210 212
211#define NAND_TIMING ((NAND_T_H & 0xF) << NAND_T_H_SHIFT) | \ 213#define NAND_TIMING (((NAND_T_H & 0xF) << NAND_T_H_SHIFT) | \
212 ((NAND_T_PUL & 0xF) << NAND_T_PUL_SHIFT) | \ 214 ((NAND_T_PUL & 0xF) << NAND_T_PUL_SHIFT) | \
213 ((NAND_T_SU & 0xF) << NAND_T_SU_SHIFT) | \ 215 ((NAND_T_SU & 0xF) << NAND_T_SU_SHIFT) | \
214 ((NAND_T_WH & 0xF) << NAND_T_WH_SHIFT) 216 ((NAND_T_WH & 0xF) << NAND_T_WH_SHIFT))
215#define NAND_CS 1 217#define NAND_CS 1
216 218
217/* should be done by yamon */ 219/* Should be done by YAMON */
218#define NAND_STCFG 0x00400005 /* 8-bit NAND */ 220#define NAND_STCFG 0x00400005 /* 8-bit NAND */
219#define NAND_STTIME 0x00007774 /* valid for 396MHz SD=2 only */ 221#define NAND_STTIME 0x00007774 /* valid for 396 MHz SD=2 only */
220#define NAND_STADDR 0x12000FFF /* physical address 0x20000000 */ 222#define NAND_STADDR 0x12000FFF /* physical address 0x20000000 */
221 223
222#endif /* __ASM_DB1X00_H */ 224#endif /* __ASM_DB1X00_H */
223
diff --git a/include/asm-mips/mach-pb1x00/pb1000.h b/include/asm-mips/mach-pb1x00/pb1000.h
index b52e0e7ee3fb..6d1ff9060e44 100644
--- a/include/asm-mips/mach-pb1x00/pb1000.h
+++ b/include/asm-mips/mach-pb1x00/pb1000.h
@@ -1,9 +1,8 @@
1/* 1/*
2 * Alchemy Semi PB1000 Referrence Board 2 * Alchemy Semi Pb1000 Referrence Board
3 * 3 *
4 * Copyright 2001 MontaVista Software Inc. 4 * Copyright 2001, 2008 MontaVista Software Inc.
5 * Author: MontaVista Software, Inc. 5 * Author: MontaVista Software, Inc. <source@mvista.com>
6 * ppopov@mvista.com or source@mvista.com
7 * 6 *
8 * ######################################################################## 7 * ########################################################################
9 * 8 *
@@ -28,145 +27,61 @@
28#define __ASM_PB1000_H 27#define __ASM_PB1000_H
29 28
30/* PCMCIA PB1000 specific defines */ 29/* PCMCIA PB1000 specific defines */
31#define PCMCIA_MAX_SOCK 1 30#define PCMCIA_MAX_SOCK 1
32#define PCMCIA_NUM_SOCKS (PCMCIA_MAX_SOCK+1) 31#define PCMCIA_NUM_SOCKS (PCMCIA_MAX_SOCK + 1)
33 32
34#define PB1000_PCR 0xBE000000 33#define PB1000_PCR 0xBE000000
35# define PCR_SLOT_0_VPP0 (1<<0) 34# define PCR_SLOT_0_VPP0 (1 << 0)
36# define PCR_SLOT_0_VPP1 (1<<1) 35# define PCR_SLOT_0_VPP1 (1 << 1)
37# define PCR_SLOT_0_VCC0 (1<<2) 36# define PCR_SLOT_0_VCC0 (1 << 2)
38# define PCR_SLOT_0_VCC1 (1<<3) 37# define PCR_SLOT_0_VCC1 (1 << 3)
39# define PCR_SLOT_0_RST (1<<4) 38# define PCR_SLOT_0_RST (1 << 4)
40 39# define PCR_SLOT_1_VPP0 (1 << 8)
41# define PCR_SLOT_1_VPP0 (1<<8) 40# define PCR_SLOT_1_VPP1 (1 << 9)
42# define PCR_SLOT_1_VPP1 (1<<9) 41# define PCR_SLOT_1_VCC0 (1 << 10)
43# define PCR_SLOT_1_VCC0 (1<<10) 42# define PCR_SLOT_1_VCC1 (1 << 11)
44# define PCR_SLOT_1_VCC1 (1<<11) 43# define PCR_SLOT_1_RST (1 << 12)
45# define PCR_SLOT_1_RST (1<<12) 44
46 45#define PB1000_MDR 0xBE000004
47#define PB1000_MDR 0xBE000004 46# define MDR_PI (1 << 5) /* PCMCIA int latch */
48# define MDR_PI (1<<5) /* pcmcia int latch */ 47# define MDR_EPI (1 << 14) /* enable PCMCIA int */
49# define MDR_EPI (1<<14) /* enable pcmcia int */ 48# define MDR_CPI (1 << 15) /* clear PCMCIA int */
50# define MDR_CPI (1<<15) /* clear pcmcia int */ 49
51 50#define PB1000_ACR1 0xBE000008
52#define PB1000_ACR1 0xBE000008 51# define ACR1_SLOT_0_CD1 (1 << 0) /* card detect 1 */
53# define ACR1_SLOT_0_CD1 (1<<0) /* card detect 1 */ 52# define ACR1_SLOT_0_CD2 (1 << 1) /* card detect 2 */
54# define ACR1_SLOT_0_CD2 (1<<1) /* card detect 2 */ 53# define ACR1_SLOT_0_READY (1 << 2) /* ready */
55# define ACR1_SLOT_0_READY (1<<2) /* ready */ 54# define ACR1_SLOT_0_STATUS (1 << 3) /* status change */
56# define ACR1_SLOT_0_STATUS (1<<3) /* status change */ 55# define ACR1_SLOT_0_VS1 (1 << 4) /* voltage sense 1 */
57# define ACR1_SLOT_0_VS1 (1<<4) /* voltage sense 1 */ 56# define ACR1_SLOT_0_VS2 (1 << 5) /* voltage sense 2 */
58# define ACR1_SLOT_0_VS2 (1<<5) /* voltage sense 2 */ 57# define ACR1_SLOT_0_INPACK (1 << 6) /* inpack pin status */
59# define ACR1_SLOT_0_INPACK (1<<6) /* inpack pin status */ 58# define ACR1_SLOT_1_CD1 (1 << 8) /* card detect 1 */
60# define ACR1_SLOT_1_CD1 (1<<8) /* card detect 1 */ 59# define ACR1_SLOT_1_CD2 (1 << 9) /* card detect 2 */
61# define ACR1_SLOT_1_CD2 (1<<9) /* card detect 2 */ 60# define ACR1_SLOT_1_READY (1 << 10) /* ready */
62# define ACR1_SLOT_1_READY (1<<10) /* ready */ 61# define ACR1_SLOT_1_STATUS (1 << 11) /* status change */
63# define ACR1_SLOT_1_STATUS (1<<11) /* status change */ 62# define ACR1_SLOT_1_VS1 (1 << 12) /* voltage sense 1 */
64# define ACR1_SLOT_1_VS1 (1<<12) /* voltage sense 1 */ 63# define ACR1_SLOT_1_VS2 (1 << 13) /* voltage sense 2 */
65# define ACR1_SLOT_1_VS2 (1<<13) /* voltage sense 2 */ 64# define ACR1_SLOT_1_INPACK (1 << 14) /* inpack pin status */
66# define ACR1_SLOT_1_INPACK (1<<14) /* inpack pin status */ 65
67 66#define CPLD_AUX0 0xBE00000C
68#define CPLD_AUX0 0xBE00000C 67#define CPLD_AUX1 0xBE000010
69#define CPLD_AUX1 0xBE000010 68#define CPLD_AUX2 0xBE000014
70#define CPLD_AUX2 0xBE000014
71 69
72/* Voltage levels */ 70/* Voltage levels */
73 71
74/* VPPEN1 - VPPEN0 */ 72/* VPPEN1 - VPPEN0 */
75#define VPP_GND ((0<<1) | (0<<0)) 73#define VPP_GND ((0 << 1) | (0 << 0))
76#define VPP_5V ((1<<1) | (0<<0)) 74#define VPP_5V ((1 << 1) | (0 << 0))
77#define VPP_3V ((0<<1) | (1<<0)) 75#define VPP_3V ((0 << 1) | (1 << 0))
78#define VPP_12V ((0<<1) | (1<<0)) 76#define VPP_12V ((0 << 1) | (1 << 0))
79#define VPP_HIZ ((1<<1) | (1<<0)) 77#define VPP_HIZ ((1 << 1) | (1 << 0))
80 78
81/* VCCEN1 - VCCEN0 */ 79/* VCCEN1 - VCCEN0 */
82#define VCC_3V ((0<<1) | (1<<0)) 80#define VCC_3V ((0 << 1) | (1 << 0))
83#define VCC_5V ((1<<1) | (0<<0)) 81#define VCC_5V ((1 << 1) | (0 << 0))
84#define VCC_HIZ ((0<<1) | (0<<0)) 82#define VCC_HIZ ((0 << 1) | (0 << 0))
85 83
86/* VPP/VCC */ 84/* VPP/VCC */
87#define SET_VCC_VPP(VCC, VPP, SLOT)\ 85#define SET_VCC_VPP(VCC, VPP, SLOT) \
88 ((((VCC)<<2) | ((VPP)<<0)) << ((SLOT)*8)) 86 ((((VCC) << 2) | ((VPP) << 0)) << ((SLOT) * 8))
89
90
91/* PCI PB1000 specific defines */
92/* The reason these defines are here instead of au1000.h is because
93 * the Au1000 does not have a PCI bus controller so the PCI implementation
94 * on the some of the older Pb1000 boards was very board specific.
95 */
96#define PCI_CONFIG_BASE 0xBA020000 /* the only external slot */
97
98#define SDRAM_DEVID 0xBA010000
99#define SDRAM_CMD 0xBA010004
100#define SDRAM_CLASS 0xBA010008
101#define SDRAM_MISC 0xBA01000C
102#define SDRAM_MBAR 0xBA010010
103
104#define PCI_IO_DATA_PORT 0xBA800000
105
106#define PCI_IO_ADDR 0xBE00001C
107#define PCI_INT_ACK 0xBBC00000
108#define PCI_IO_READ 0xBBC00020
109#define PCI_IO_WRITE 0xBBC00030
110
111#define PCI_BRIDGE_CONFIG 0xBE000018
112
113#define PCI_IO_START 0x10000000
114#define PCI_IO_END 0x1000ffff
115#define PCI_MEM_START 0x18000000
116#define PCI_MEM_END 0x18ffffff
117
118#define PCI_FIRST_DEVFN 0
119#define PCI_LAST_DEVFN 1
120
121static inline u8 au_pci_io_readb(u32 addr)
122{
123 writel(addr, PCI_IO_ADDR);
124 writel((readl(PCI_BRIDGE_CONFIG) & 0xffffcfff) | (1<<12), PCI_BRIDGE_CONFIG);
125 return (readl(PCI_IO_DATA_PORT) & 0xff);
126}
127
128static inline u16 au_pci_io_readw(u32 addr)
129{
130 writel(addr, PCI_IO_ADDR);
131 writel((readl(PCI_BRIDGE_CONFIG) & 0xffffcfff) | (1<<13), PCI_BRIDGE_CONFIG);
132 return (readl(PCI_IO_DATA_PORT) & 0xffff);
133}
134
135static inline u32 au_pci_io_readl(u32 addr)
136{
137 writel(addr, PCI_IO_ADDR);
138 writel((readl(PCI_BRIDGE_CONFIG) & 0xffffcfff), PCI_BRIDGE_CONFIG);
139 return readl(PCI_IO_DATA_PORT);
140}
141
142static inline void au_pci_io_writeb(u8 val, u32 addr)
143{
144 writel(addr, PCI_IO_ADDR);
145 writel((readl(PCI_BRIDGE_CONFIG) & 0xffffcfff) | (1<<12), PCI_BRIDGE_CONFIG);
146 writel(val, PCI_IO_DATA_PORT);
147}
148
149static inline void au_pci_io_writew(u16 val, u32 addr)
150{
151 writel(addr, PCI_IO_ADDR);
152 writel((readl(PCI_BRIDGE_CONFIG) & 0xffffcfff) | (1<<13), PCI_BRIDGE_CONFIG);
153 writel(val, PCI_IO_DATA_PORT);
154}
155
156static inline void au_pci_io_writel(u32 val, u32 addr)
157{
158 writel(addr, PCI_IO_ADDR);
159 writel(readl(PCI_BRIDGE_CONFIG) & 0xffffcfff, PCI_BRIDGE_CONFIG);
160 writel(val, PCI_IO_DATA_PORT);
161}
162
163static inline void set_sdram_extbyte(void)
164{
165 writel(readl(PCI_BRIDGE_CONFIG) & 0xffffff00, PCI_BRIDGE_CONFIG);
166}
167
168static inline void set_slot_extbyte(void)
169{
170 writel((readl(PCI_BRIDGE_CONFIG) & 0xffffbf00) | 0x18, PCI_BRIDGE_CONFIG);
171}
172#endif /* __ASM_PB1000_H */ 87#endif /* __ASM_PB1000_H */
diff --git a/include/asm-mips/mach-pb1x00/pb1100.h b/include/asm-mips/mach-pb1x00/pb1100.h
index 63aa3926b297..b1a60f1cbd02 100644
--- a/include/asm-mips/mach-pb1x00/pb1100.h
+++ b/include/asm-mips/mach-pb1x00/pb1100.h
@@ -1,9 +1,8 @@
1/* 1/*
2 * Alchemy Semi PB1100 Referrence Board 2 * Alchemy Semi Pb1100 Referrence Board
3 * 3 *
4 * Copyright 2001 MontaVista Software Inc. 4 * Copyright 2001, 2008 MontaVista Software Inc.
5 * Author: MontaVista Software, Inc. 5 * Author: MontaVista Software, Inc. <source@mvista.com>
6 * ppopov@mvista.com or source@mvista.com
7 * 6 *
8 * ######################################################################## 7 * ########################################################################
9 * 8 *
@@ -27,59 +26,60 @@
27#ifndef __ASM_PB1100_H 26#ifndef __ASM_PB1100_H
28#define __ASM_PB1100_H 27#define __ASM_PB1100_H
29 28
30#define PB1100_IDENT 0xAE000000 29#define PB1100_IDENT 0xAE000000
31#define BOARD_STATUS_REG 0xAE000004 30#define BOARD_STATUS_REG 0xAE000004
32# define PB1100_ROM_SEL (1<<15) 31# define PB1100_ROM_SEL (1 << 15)
33# define PB1100_ROM_SIZ (1<<14) 32# define PB1100_ROM_SIZ (1 << 14)
34# define PB1100_SWAP_BOOT (1<<13) 33# define PB1100_SWAP_BOOT (1 << 13)
35# define PB1100_FLASH_WP (1<<12) 34# define PB1100_FLASH_WP (1 << 12)
36# define PB1100_ROM_H_STS (1<<11) 35# define PB1100_ROM_H_STS (1 << 11)
37# define PB1100_ROM_L_STS (1<<10) 36# define PB1100_ROM_L_STS (1 << 10)
38# define PB1100_FLASH_H_STS (1<<9) 37# define PB1100_FLASH_H_STS (1 << 9)
39# define PB1100_FLASH_L_STS (1<<8) 38# define PB1100_FLASH_L_STS (1 << 8)
40# define PB1100_SRAM_SIZ (1<<7) 39# define PB1100_SRAM_SIZ (1 << 7)
41# define PB1100_TSC_BUSY (1<<6) 40# define PB1100_TSC_BUSY (1 << 6)
42# define PB1100_PCMCIA_VS_MASK (3<<4) 41# define PB1100_PCMCIA_VS_MASK (3 << 4)
43# define PB1100_RS232_CD (1<<3) 42# define PB1100_RS232_CD (1 << 3)
44# define PB1100_RS232_CTS (1<<2) 43# define PB1100_RS232_CTS (1 << 2)
45# define PB1100_RS232_DSR (1<<1) 44# define PB1100_RS232_DSR (1 << 1)
46# define PB1100_RS232_RI (1<<0) 45# define PB1100_RS232_RI (1 << 0)
47 46
48#define PB1100_IRDA_RS232 0xAE00000C 47#define PB1100_IRDA_RS232 0xAE00000C
49# define PB1100_IRDA_FULL (0<<14) /* full power */ 48# define PB1100_IRDA_FULL (0 << 14) /* full power */
50# define PB1100_IRDA_SHUTDOWN (1<<14) 49# define PB1100_IRDA_SHUTDOWN (1 << 14)
51# define PB1100_IRDA_TT (2<<14) /* 2/3 power */ 50# define PB1100_IRDA_TT (2 << 14) /* 2/3 power */
52# define PB1100_IRDA_OT (3<<14) /* 1/3 power */ 51# define PB1100_IRDA_OT (3 << 14) /* 1/3 power */
53# define PB1100_IRDA_FIR (1<<13) 52# define PB1100_IRDA_FIR (1 << 13)
54 53
55#define PCMCIA_BOARD_REG 0xAE000010 54#define PCMCIA_BOARD_REG 0xAE000010
56# define PB1100_SD_WP1_RO (1<<15) /* read only */ 55# define PB1100_SD_WP1_RO (1 << 15) /* read only */
57# define PB1100_SD_WP0_RO (1<<14) /* read only */ 56# define PB1100_SD_WP0_RO (1 << 14) /* read only */
58# define PB1100_SD_PWR1 (1<<11) /* applies power to SD1 */ 57# define PB1100_SD_PWR1 (1 << 11) /* applies power to SD1 */
59# define PB1100_SD_PWR0 (1<<10) /* applies power to SD0 */ 58# define PB1100_SD_PWR0 (1 << 10) /* applies power to SD0 */
60# define PB1100_SEL_SD_CONN1 (1<<9) 59# define PB1100_SEL_SD_CONN1 (1 << 9)
61# define PB1100_SEL_SD_CONN0 (1<<8) 60# define PB1100_SEL_SD_CONN0 (1 << 8)
62# define PC_DEASSERT_RST (1<<7) 61# define PC_DEASSERT_RST (1 << 7)
63# define PC_DRV_EN (1<<4) 62# define PC_DRV_EN (1 << 4)
64 63
65#define PB1100_G_CONTROL 0xAE000014 /* graphics control */ 64#define PB1100_G_CONTROL 0xAE000014 /* graphics control */
66 65
67#define PB1100_RST_VDDI 0xAE00001C 66#define PB1100_RST_VDDI 0xAE00001C
68# define PB1100_SOFT_RESET (1<<15) /* clear to reset the board */ 67# define PB1100_SOFT_RESET (1 << 15) /* clear to reset the board */
69# define PB1100_VDDI_MASK (0x1F) 68# define PB1100_VDDI_MASK 0x1F
70 69
71#define PB1100_LEDS 0xAE000018 70#define PB1100_LEDS 0xAE000018
72 71
73/* 11:8 is 4 discreet LEDs. Clearing a bit illuminates the LED. 72/*
74 * 7:0 is the LED Display's decimal points. 73 * 11:8 is 4 discreet LEDs. Clearing a bit illuminates the LED.
74 * 7:0 is the LED Display's decimal points.
75 */ 75 */
76#define PB1100_HEX_LED 0xAE000018 76#define PB1100_HEX_LED 0xAE000018
77 77
78/* PCMCIA PB1100 specific defines */ 78/* PCMCIA Pb1100 specific defines */
79#define PCMCIA_MAX_SOCK 0 79#define PCMCIA_MAX_SOCK 0
80#define PCMCIA_NUM_SOCKS (PCMCIA_MAX_SOCK+1) 80#define PCMCIA_NUM_SOCKS (PCMCIA_MAX_SOCK + 1)
81 81
82/* VPP/VCC */ 82/* VPP/VCC */
83#define SET_VCC_VPP(VCC, VPP) (((VCC)<<2) | ((VPP)<<0)) 83#define SET_VCC_VPP(VCC, VPP) (((VCC) << 2) | ((VPP) << 0))
84 84
85#endif /* __ASM_PB1100_H */ 85#endif /* __ASM_PB1100_H */
diff --git a/include/asm-mips/mach-pb1x00/pb1200.h b/include/asm-mips/mach-pb1x00/pb1200.h
index e2c6bcac3b42..c8618df88cb5 100644
--- a/include/asm-mips/mach-pb1x00/pb1200.h
+++ b/include/asm-mips/mach-pb1x00/pb1200.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * AMD Alchemy PB1200 Referrence Board 2 * AMD Alchemy Pb1200 Referrence Board
3 * Board Registers defines. 3 * Board Registers defines.
4 * 4 *
5 * ######################################################################## 5 * ########################################################################
@@ -27,21 +27,20 @@
27#include <linux/types.h> 27#include <linux/types.h>
28#include <asm/mach-au1x00/au1xxx_psc.h> 28#include <asm/mach-au1x00/au1xxx_psc.h>
29 29
30// This is defined in au1000.h with bogus value 30#define DBDMA_AC97_TX_CHAN DSCR_CMD0_PSC1_TX
31#undef AU1X00_EXTERNAL_INT 31#define DBDMA_AC97_RX_CHAN DSCR_CMD0_PSC1_RX
32#define DBDMA_I2S_TX_CHAN DSCR_CMD0_PSC1_TX
33#define DBDMA_I2S_RX_CHAN DSCR_CMD0_PSC1_RX
32 34
33#define DBDMA_AC97_TX_CHAN DSCR_CMD0_PSC1_TX 35/*
34#define DBDMA_AC97_RX_CHAN DSCR_CMD0_PSC1_RX 36 * SPI and SMB are muxed on the Pb1200 board.
35#define DBDMA_I2S_TX_CHAN DSCR_CMD0_PSC1_TX 37 * Refer to board documentation.
36#define DBDMA_I2S_RX_CHAN DSCR_CMD0_PSC1_RX
37
38/* SPI and SMB are muxed on the Pb1200 board.
39 Refer to board documentation.
40 */ 38 */
41#define SPI_PSC_BASE PSC0_BASE_ADDR 39#define SPI_PSC_BASE PSC0_BASE_ADDR
42#define SMBUS_PSC_BASE PSC0_BASE_ADDR 40#define SMBUS_PSC_BASE PSC0_BASE_ADDR
43/* AC97 and I2S are muxed on the Pb1200 board. 41/*
44 Refer to board documentation. 42 * AC97 and I2S are muxed on the Pb1200 board.
43 * Refer to board documentation.
45 */ 44 */
46#define AC97_PSC_BASE PSC1_BASE_ADDR 45#define AC97_PSC_BASE PSC1_BASE_ADDR
47#define I2S_PSC_BASE PSC1_BASE_ADDR 46#define I2S_PSC_BASE PSC1_BASE_ADDR
@@ -102,10 +101,10 @@ static BCSR * const bcsr = (BCSR *)BCSR_KSEG1_ADDR;
102#define BCSR_STATUS_SWAPBOOT 0x0040 101#define BCSR_STATUS_SWAPBOOT 0x0040
103#define BCSR_STATUS_FLASHBUSY 0x0100 102#define BCSR_STATUS_FLASHBUSY 0x0100
104#define BCSR_STATUS_IDECBLID 0x0200 103#define BCSR_STATUS_IDECBLID 0x0200
105#define BCSR_STATUS_SD0WP 0x0400 104#define BCSR_STATUS_SD0WP 0x0400
106#define BCSR_STATUS_SD1WP 0x0800 105#define BCSR_STATUS_SD1WP 0x0800
107#define BCSR_STATUS_U0RXD 0x1000 106#define BCSR_STATUS_U0RXD 0x1000
108#define BCSR_STATUS_U1RXD 0x2000 107#define BCSR_STATUS_U1RXD 0x2000
109 108
110#define BCSR_SWITCHES_OCTAL 0x00FF 109#define BCSR_SWITCHES_OCTAL 0x00FF
111#define BCSR_SWITCHES_DIP_1 0x0080 110#define BCSR_SWITCHES_DIP_1 0x0080
@@ -123,11 +122,11 @@ static BCSR * const bcsr = (BCSR *)BCSR_KSEG1_ADDR;
123#define BCSR_RESETS_DC 0x0004 122#define BCSR_RESETS_DC 0x0004
124#define BCSR_RESETS_IDE 0x0008 123#define BCSR_RESETS_IDE 0x0008
125/* not resets but in the same register */ 124/* not resets but in the same register */
126#define BCSR_RESETS_WSCFSM 0x0800 125#define BCSR_RESETS_WSCFSM 0x0800
127#define BCSR_RESETS_PCS0MUX 0x1000 126#define BCSR_RESETS_PCS0MUX 0x1000
128#define BCSR_RESETS_PCS1MUX 0x2000 127#define BCSR_RESETS_PCS1MUX 0x2000
129#define BCSR_RESETS_SPISEL 0x4000 128#define BCSR_RESETS_SPISEL 0x4000
130#define BCSR_RESETS_SD1MUX 0x8000 129#define BCSR_RESETS_SD1MUX 0x8000
131 130
132#define BCSR_PCMCIA_PC0VPP 0x0003 131#define BCSR_PCMCIA_PC0VPP 0x0003
133#define BCSR_PCMCIA_PC0VCC 0x000C 132#define BCSR_PCMCIA_PC0VCC 0x000C
@@ -163,7 +162,7 @@ static BCSR * const bcsr = (BCSR *)BCSR_KSEG1_ADDR;
163#define BCSR_INT_PC0STSCHG 0x0008 162#define BCSR_INT_PC0STSCHG 0x0008
164#define BCSR_INT_PC1 0x0010 163#define BCSR_INT_PC1 0x0010
165#define BCSR_INT_PC1STSCHG 0x0020 164#define BCSR_INT_PC1STSCHG 0x0020
166#define BCSR_INT_DC 0x0040 165#define BCSR_INT_DC 0x0040
167#define BCSR_INT_FLASHBUSY 0x0080 166#define BCSR_INT_FLASHBUSY 0x0080
168#define BCSR_INT_PC0INSERT 0x0100 167#define BCSR_INT_PC0INSERT 0x0100
169#define BCSR_INT_PC0EJECT 0x0200 168#define BCSR_INT_PC0EJECT 0x0200
@@ -174,14 +173,6 @@ static BCSR * const bcsr = (BCSR *)BCSR_KSEG1_ADDR;
174#define BCSR_INT_SD1INSERT 0x4000 173#define BCSR_INT_SD1INSERT 0x4000
175#define BCSR_INT_SD1EJECT 0x8000 174#define BCSR_INT_SD1EJECT 0x8000
176 175
177/* PCMCIA Db1x00 specific defines */
178#define PCMCIA_MAX_SOCK 1
179#define PCMCIA_NUM_SOCKS (PCMCIA_MAX_SOCK+1)
180
181/* VPP/VCC */
182#define SET_VCC_VPP(VCC, VPP, SLOT)\
183 ((((VCC)<<2) | ((VPP)<<0)) << ((SLOT)*8))
184
185#define SMC91C111_PHYS_ADDR 0x0D000300 176#define SMC91C111_PHYS_ADDR 0x0D000300
186#define SMC91C111_INT PB1200_ETH_INT 177#define SMC91C111_INT PB1200_ETH_INT
187 178
@@ -192,18 +183,19 @@ static BCSR * const bcsr = (BCSR *)BCSR_KSEG1_ADDR;
192#define IDE_DDMA_REQ DSCR_CMD0_DMA_REQ1 183#define IDE_DDMA_REQ DSCR_CMD0_DMA_REQ1
193#define IDE_RQSIZE 128 184#define IDE_RQSIZE 128
194 185
195#define NAND_PHYS_ADDR 0x1C000000 186#define NAND_PHYS_ADDR 0x1C000000
196 187
197/* Timing values as described in databook, * ns value stripped of 188/*
189 * Timing values as described in databook, * ns value stripped of
198 * lower 2 bits. 190 * lower 2 bits.
199 * These defines are here rather than an SOC1200 generic file because 191 * These defines are here rather than an Au1200 generic file because
200 * the parts chosen on another board may be different and may require 192 * the parts chosen on another board may be different and may require
201 * different timings. 193 * different timings.
202 */ 194 */
203#define NAND_T_H (18 >> 2) 195#define NAND_T_H (18 >> 2)
204#define NAND_T_PUL (30 >> 2) 196#define NAND_T_PUL (30 >> 2)
205#define NAND_T_SU (30 >> 2) 197#define NAND_T_SU (30 >> 2)
206#define NAND_T_WH (30 >> 2) 198#define NAND_T_WH (30 >> 2)
207 199
208/* Bitfield shift amounts */ 200/* Bitfield shift amounts */
209#define NAND_T_H_SHIFT 0 201#define NAND_T_H_SHIFT 0
@@ -211,11 +203,10 @@ static BCSR * const bcsr = (BCSR *)BCSR_KSEG1_ADDR;
211#define NAND_T_SU_SHIFT 8 203#define NAND_T_SU_SHIFT 8
212#define NAND_T_WH_SHIFT 12 204#define NAND_T_WH_SHIFT 12
213 205
214#define NAND_TIMING ((NAND_T_H & 0xF) << NAND_T_H_SHIFT) | \ 206#define NAND_TIMING (((NAND_T_H & 0xF) << NAND_T_H_SHIFT) | \
215 ((NAND_T_PUL & 0xF) << NAND_T_PUL_SHIFT) | \ 207 ((NAND_T_PUL & 0xF) << NAND_T_PUL_SHIFT) | \
216 ((NAND_T_SU & 0xF) << NAND_T_SU_SHIFT) | \ 208 ((NAND_T_SU & 0xF) << NAND_T_SU_SHIFT) | \
217 ((NAND_T_WH & 0xF) << NAND_T_WH_SHIFT) 209 ((NAND_T_WH & 0xF) << NAND_T_WH_SHIFT))
218
219 210
220/* 211/*
221 * External Interrupts for Pb1200 as of 8/6/2004. 212 * External Interrupts for Pb1200 as of 8/6/2004.
@@ -248,13 +239,21 @@ enum external_pb1200_ints {
248 PB1200_INT_END = PB1200_INT_BEGIN + 15 239 PB1200_INT_END = PB1200_INT_BEGIN + 15
249}; 240};
250 241
251/* For drivers/pcmcia/au1000_db1x00.c */ 242/*
252#define BOARD_PC0_INT PB1200_PC0_INT 243 * Pb1200 specific PCMCIA defines for drivers/pcmcia/au1000_db1x00.c
253#define BOARD_PC1_INT PB1200_PC1_INT 244 */
254#define BOARD_CARD_INSERTED(SOCKET) bcsr->sig_status & (1<<(8+(2*SOCKET))) 245#define PCMCIA_MAX_SOCK 1
246#define PCMCIA_NUM_SOCKS (PCMCIA_MAX_SOCK + 1)
255 247
256/* Nand chip select */ 248/* VPP/VCC */
249#define SET_VCC_VPP(VCC, VPP, SLOT) \
250 ((((VCC) << 2) | ((VPP) << 0)) << ((SLOT) * 8))
251
252#define BOARD_PC0_INT PB1200_PC0_INT
253#define BOARD_PC1_INT PB1200_PC1_INT
254#define BOARD_CARD_INSERTED(SOCKET) bcsr->sig_status & (1 << (8 + (2 * SOCKET)))
255
256/* NAND chip select */
257#define NAND_CS 1 257#define NAND_CS 1
258 258
259#endif /* __ASM_PB1200_H */ 259#endif /* __ASM_PB1200_H */
260
diff --git a/include/asm-mips/mach-pb1x00/pb1500.h b/include/asm-mips/mach-pb1x00/pb1500.h
index ff6d40c87a25..da51a2eb7b82 100644
--- a/include/asm-mips/mach-pb1x00/pb1500.h
+++ b/include/asm-mips/mach-pb1x00/pb1500.h
@@ -1,9 +1,8 @@
1/* 1/*
2 * Alchemy Semi PB1500 Referrence Board 2 * Alchemy Semi Pb1500 Referrence Board
3 * 3 *
4 * Copyright 2001 MontaVista Software Inc. 4 * Copyright 2001, 2008 MontaVista Software Inc.
5 * Author: MontaVista Software, Inc. 5 * Author: MontaVista Software, Inc. <source@mvista.com>
6 * ppopov@mvista.com or source@mvista.com
7 * 6 *
8 * ######################################################################## 7 * ########################################################################
9 * 8 *
@@ -27,25 +26,24 @@
27#ifndef __ASM_PB1500_H 26#ifndef __ASM_PB1500_H
28#define __ASM_PB1500_H 27#define __ASM_PB1500_H
29 28
29#define IDENT_BOARD_REG 0xAE000000
30#define BOARD_STATUS_REG 0xAE000004
31#define PCI_BOARD_REG 0xAE000010
32#define PCMCIA_BOARD_REG 0xAE000010
33# define PC_DEASSERT_RST 0x80
34# define PC_DRV_EN 0x10
35#define PB1500_G_CONTROL 0xAE000014
36#define PB1500_RST_VDDI 0xAE00001C
37#define PB1500_LEDS 0xAE000018
30 38
31#define IDENT_BOARD_REG 0xAE000000 39#define PB1500_HEX_LED 0xAF000004
32#define BOARD_STATUS_REG 0xAE000004 40#define PB1500_HEX_LED_BLANK 0xAF000008
33#define PCI_BOARD_REG 0xAE000010
34#define PCMCIA_BOARD_REG 0xAE000010
35 #define PC_DEASSERT_RST 0x80
36 #define PC_DRV_EN 0x10
37#define PB1500_G_CONTROL 0xAE000014
38#define PB1500_RST_VDDI 0xAE00001C
39#define PB1500_LEDS 0xAE000018
40 41
41#define PB1500_HEX_LED 0xAF000004 42/* PCMCIA Pb1500 specific defines */
42#define PB1500_HEX_LED_BLANK 0xAF000008 43#define PCMCIA_MAX_SOCK 0
43 44#define PCMCIA_NUM_SOCKS (PCMCIA_MAX_SOCK + 1)
44/* PCMCIA PB1500 specific defines */
45#define PCMCIA_MAX_SOCK 0
46#define PCMCIA_NUM_SOCKS (PCMCIA_MAX_SOCK+1)
47 45
48/* VPP/VCC */ 46/* VPP/VCC */
49#define SET_VCC_VPP(VCC, VPP) (((VCC)<<2) | ((VPP)<<0)) 47#define SET_VCC_VPP(VCC, VPP) (((VCC) << 2) | ((VPP) << 0))
50 48
51#endif /* __ASM_PB1500_H */ 49#endif /* __ASM_PB1500_H */
diff --git a/include/asm-mips/mach-pb1x00/pb1550.h b/include/asm-mips/mach-pb1x00/pb1550.h
index c2ab0e2df4ae..6704a11497db 100644
--- a/include/asm-mips/mach-pb1x00/pb1550.h
+++ b/include/asm-mips/mach-pb1x00/pb1550.h
@@ -30,15 +30,15 @@
30#include <linux/types.h> 30#include <linux/types.h>
31#include <asm/mach-au1x00/au1xxx_psc.h> 31#include <asm/mach-au1x00/au1xxx_psc.h>
32 32
33#define DBDMA_AC97_TX_CHAN DSCR_CMD0_PSC1_TX 33#define DBDMA_AC97_TX_CHAN DSCR_CMD0_PSC1_TX
34#define DBDMA_AC97_RX_CHAN DSCR_CMD0_PSC1_RX 34#define DBDMA_AC97_RX_CHAN DSCR_CMD0_PSC1_RX
35#define DBDMA_I2S_TX_CHAN DSCR_CMD0_PSC3_TX 35#define DBDMA_I2S_TX_CHAN DSCR_CMD0_PSC3_TX
36#define DBDMA_I2S_RX_CHAN DSCR_CMD0_PSC3_RX 36#define DBDMA_I2S_RX_CHAN DSCR_CMD0_PSC3_RX
37 37
38#define SPI_PSC_BASE PSC0_BASE_ADDR 38#define SPI_PSC_BASE PSC0_BASE_ADDR
39#define AC97_PSC_BASE PSC1_BASE_ADDR 39#define AC97_PSC_BASE PSC1_BASE_ADDR
40#define SMBUS_PSC_BASE PSC2_BASE_ADDR 40#define SMBUS_PSC_BASE PSC2_BASE_ADDR
41#define I2S_PSC_BASE PSC3_BASE_ADDR 41#define I2S_PSC_BASE PSC3_BASE_ADDR
42 42
43#define BCSR_PHYS_ADDR 0xAF000000 43#define BCSR_PHYS_ADDR 0xAF000000
44 44
@@ -129,12 +129,12 @@ static BCSR * const bcsr = (BCSR *)BCSR_PHYS_ADDR;
129#define BCSR_SYSTEM_POWEROFF 0x4000 129#define BCSR_SYSTEM_POWEROFF 0x4000
130#define BCSR_SYSTEM_RESET 0x8000 130#define BCSR_SYSTEM_RESET 0x8000
131 131
132#define PCMCIA_MAX_SOCK 1 132#define PCMCIA_MAX_SOCK 1
133#define PCMCIA_NUM_SOCKS (PCMCIA_MAX_SOCK+1) 133#define PCMCIA_NUM_SOCKS (PCMCIA_MAX_SOCK + 1)
134 134
135/* VPP/VCC */ 135/* VPP/VCC */
136#define SET_VCC_VPP(VCC, VPP, SLOT)\ 136#define SET_VCC_VPP(VCC, VPP, SLOT) \
137 ((((VCC)<<2) | ((VPP)<<0)) << ((SLOT)*8)) 137 ((((VCC) << 2) | ((VPP) << 0)) << ((SLOT) * 8))
138 138
139#if defined(CONFIG_MTD_PB1550_BOOT) && defined(CONFIG_MTD_PB1550_USER) 139#if defined(CONFIG_MTD_PB1550_BOOT) && defined(CONFIG_MTD_PB1550_USER)
140#define PB1550_BOTH_BANKS 140#define PB1550_BOTH_BANKS
@@ -144,16 +144,17 @@ static BCSR * const bcsr = (BCSR *)BCSR_PHYS_ADDR;
144#define PB1550_USER_ONLY 144#define PB1550_USER_ONLY
145#endif 145#endif
146 146
147/* Timing values as described in databook, * ns value stripped of 147/*
148 * Timing values as described in databook, * ns value stripped of
148 * lower 2 bits. 149 * lower 2 bits.
149 * These defines are here rather than an SOC1550 generic file because 150 * These defines are here rather than an SOC1550 generic file because
150 * the parts chosen on another board may be different and may require 151 * the parts chosen on another board may be different and may require
151 * different timings. 152 * different timings.
152 */ 153 */
153#define NAND_T_H (18 >> 2) 154#define NAND_T_H (18 >> 2)
154#define NAND_T_PUL (30 >> 2) 155#define NAND_T_PUL (30 >> 2)
155#define NAND_T_SU (30 >> 2) 156#define NAND_T_SU (30 >> 2)
156#define NAND_T_WH (30 >> 2) 157#define NAND_T_WH (30 >> 2)
157 158
158/* Bitfield shift amounts */ 159/* Bitfield shift amounts */
159#define NAND_T_H_SHIFT 0 160#define NAND_T_H_SHIFT 0
@@ -161,16 +162,16 @@ static BCSR * const bcsr = (BCSR *)BCSR_PHYS_ADDR;
161#define NAND_T_SU_SHIFT 8 162#define NAND_T_SU_SHIFT 8
162#define NAND_T_WH_SHIFT 12 163#define NAND_T_WH_SHIFT 12
163 164
164#define NAND_TIMING ((NAND_T_H & 0xF) << NAND_T_H_SHIFT) | \ 165#define NAND_TIMING (((NAND_T_H & 0xF) << NAND_T_H_SHIFT) | \
165 ((NAND_T_PUL & 0xF) << NAND_T_PUL_SHIFT) | \ 166 ((NAND_T_PUL & 0xF) << NAND_T_PUL_SHIFT) | \
166 ((NAND_T_SU & 0xF) << NAND_T_SU_SHIFT) | \ 167 ((NAND_T_SU & 0xF) << NAND_T_SU_SHIFT) | \
167 ((NAND_T_WH & 0xF) << NAND_T_WH_SHIFT) 168 ((NAND_T_WH & 0xF) << NAND_T_WH_SHIFT))
168 169
169#define NAND_CS 1 170#define NAND_CS 1
170 171
171/* should be done by yamon */ 172/* Should be done by YAMON */
172#define NAND_STCFG 0x00400005 /* 8-bit NAND */ 173#define NAND_STCFG 0x00400005 /* 8-bit NAND */
173#define NAND_STTIME 0x00007774 /* valid for 396MHz SD=2 only */ 174#define NAND_STTIME 0x00007774 /* valid for 396 MHz SD=2 only */
174#define NAND_STADDR 0x12000FFF /* physical address 0x20000000 */ 175#define NAND_STADDR 0x12000FFF /* physical address 0x20000000 */
175 176
176#endif /* __ASM_PB1550_H */ 177#endif /* __ASM_PB1550_H */
diff --git a/include/asm-mips/rtlx.h b/include/asm-mips/rtlx.h
index 65778c890a62..20b666022dcb 100644
--- a/include/asm-mips/rtlx.h
+++ b/include/asm-mips/rtlx.h
@@ -29,13 +29,13 @@ extern unsigned int rtlx_read_poll(int index, int can_sleep);
29extern unsigned int rtlx_write_poll(int index); 29extern unsigned int rtlx_write_poll(int index);
30 30
31enum rtlx_state { 31enum rtlx_state {
32 RTLX_STATE_UNUSED, 32 RTLX_STATE_UNUSED = 0,
33 RTLX_STATE_INITIALISED, 33 RTLX_STATE_INITIALISED,
34 RTLX_STATE_REMOTE_READY, 34 RTLX_STATE_REMOTE_READY,
35 RTLX_STATE_OPENED 35 RTLX_STATE_OPENED
36}; 36};
37 37
38#define RTLX_BUFFER_SIZE 1024 38#define RTLX_BUFFER_SIZE 2048
39 39
40/* each channel supports read and write. 40/* each channel supports read and write.
41 linux (vpe0) reads lx_buffer and writes rt_buffer 41 linux (vpe0) reads lx_buffer and writes rt_buffer