2 * arch/arm/mach-ns9xxx/include/mach/uncompress.h
4 * Copyright (C) 2006 by Digi International Inc.
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
11 #ifndef __ASM_ARCH_UNCOMPRESS_H
12 #define __ASM_ARCH_UNCOMPRESS_H
16 #define __REG(x) ((void __iomem __force *)(x))
18 static void putc_dummy(char c
, void __iomem
*base
)
23 static void putc_ns9360(char c
, void __iomem
*base
)
25 static int t
= 0x10000;
30 if (__raw_readl(base
+ 8) & (1 << 3)) {
31 __raw_writeb(c
, base
+ 16);
38 static void putc_a9m9750dev(char c
, void __iomem
*base
)
40 static int t
= 0x10000;
45 if (__raw_readb(base
+ 5) & (1 << 5)) {
46 __raw_writeb(c
, base
);
54 static void putc_ns921x(char c
, void __iomem
*base
)
56 static int t
= 0x10000;
61 if (!(__raw_readl(base
) & (1 << 11))) {
62 __raw_writeb(c
, base
+ 0x0028);
69 #define MSCS __REG(0xA0900184)
71 #define NS9360_UARTA __REG(0x90200040)
72 #define NS9360_UARTB __REG(0x90200000)
73 #define NS9360_UARTC __REG(0x90300000)
74 #define NS9360_UARTD __REG(0x90300040)
76 #define NS9360_UART_ENABLED(base) \
77 (__raw_readl(NS9360_UARTA) & (1 << 31))
79 #define A9M9750DEV_UARTA __REG(0x40000000)
81 #define NS921XSYS_CLOCK __REG(0xa090017c)
82 #define NS921X_UARTA __REG(0x90010000)
83 #define NS921X_UARTB __REG(0x90018000)
84 #define NS921X_UARTC __REG(0x90020000)
85 #define NS921X_UARTD __REG(0x90028000)
87 #define NS921X_UART_ENABLED(base) \
88 (__raw_readl((base) + 0x1000) & (1 << 29))
90 static void autodetect(void (**putc
)(char, void __iomem
*), void __iomem
**base
)
92 if (((__raw_readl(MSCS
) >> 16) & 0xfe) == 0x00) {
93 /* ns9360 or ns9750 */
94 if (NS9360_UART_ENABLED(NS9360_UARTA
)) {
98 } else if (NS9360_UART_ENABLED(NS9360_UARTB
)) {
100 *base
= NS9360_UARTB
;
102 } else if (NS9360_UART_ENABLED(NS9360_UARTC
)) {
104 *base
= NS9360_UARTC
;
106 } else if (NS9360_UART_ENABLED(NS9360_UARTD
)) {
108 *base
= NS9360_UARTD
;
110 } else if (__raw_readl(__REG(0xa09001f4)) == 0xfffff001) {
111 *putc
= putc_a9m9750dev
;
112 *base
= A9M9750DEV_UARTA
;
115 } else if (((__raw_readl(MSCS
) >> 16) & 0xfe) == 0x02) {
117 u32 clock
= __raw_readl(NS921XSYS_CLOCK
);
119 if ((clock
& (1 << 1)) &&
120 NS921X_UART_ENABLED(NS921X_UARTA
)) {
122 *base
= NS921X_UARTA
;
124 } else if ((clock
& (1 << 2)) &&
125 NS921X_UART_ENABLED(NS921X_UARTB
)) {
127 *base
= NS921X_UARTB
;
129 } else if ((clock
& (1 << 3)) &&
130 NS921X_UART_ENABLED(NS921X_UARTC
)) {
132 *base
= NS921X_UARTC
;
134 } else if ((clock
& (1 << 4)) &&
135 NS921X_UART_ENABLED(NS921X_UARTD
)) {
137 *base
= NS921X_UARTD
;
145 void (*myputc
)(char, void __iomem
*);
148 static void putc(char c
)
153 static void arch_decomp_setup(void)
155 autodetect(&myputc
, &base
);
157 #define arch_decomp_wdog()
159 static void flush(void)
164 #endif /* ifndef __ASM_ARCH_UNCOMPRESS_H */