summaryrefslogtreecommitdiff
path: root/arch/arm/mach-ns9xxx/include/mach/uncompress.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-ns9xxx/include/mach/uncompress.h')
-rw-r--r--arch/arm/mach-ns9xxx/include/mach/uncompress.h185
1 files changed, 101 insertions, 84 deletions
diff --git a/arch/arm/mach-ns9xxx/include/mach/uncompress.h b/arch/arm/mach-ns9xxx/include/mach/uncompress.h
index 1b12d324b087..fc9b0a424230 100644
--- a/arch/arm/mach-ns9xxx/include/mach/uncompress.h
+++ b/arch/arm/mach-ns9xxx/include/mach/uncompress.h
@@ -11,15 +11,21 @@
#ifndef __ASM_ARCH_UNCOMPRESS_H
#define __ASM_ARCH_UNCOMPRESS_H
-#include <linux/io.h>
-
-#define __REG(x) ((void __iomem __force *)(x))
+#include <asm/io.h>
+#define __REG(x) ((void __iomem __force *)(x))
static void putc_dummy(char c, void __iomem *base)
{
/* nothing */
}
+#if defined(CONFIG_PROCESSOR_NS9360)
+# define NS9360_UARTA __REG(0x90200040)
+# define NS9360_UARTB __REG(0x90200000)
+# define NS9360_UARTC __REG(0x90300000)
+# define NS9360_UARTD __REG(0x90300040)
+# define NS9360_UART_ENABLED(base) \
+ (__raw_readl(NS9360_UARTA) & (1 << 31))
static void putc_ns9360(char c, void __iomem *base)
{
static int t = 0x10000;
@@ -34,22 +40,16 @@ static void putc_ns9360(char c, void __iomem *base)
}
} while (t);
}
-
-static void putc_a9m9750dev(char c, void __iomem *base)
-{
- static int t = 0x10000;
- do {
- if (t)
- --t;
-
- if (__raw_readb(base + 5) & (1 << 5)) {
- __raw_writeb(c, base);
- t = 0x10000;
- break;
- }
- } while (t);
-
-}
+#endif
+
+#if defined(CONFIG_PROCESSOR_NS921X)
+# define NS921XSYS_CLOCK __REG(0xa090017c)
+# define NS921X_UARTA __REG(0x90010000)
+# define NS921X_UARTB __REG(0x90018000)
+# define NS921X_UARTC __REG(0x90020000)
+# define NS921X_UARTD __REG(0x90028000)
+# define NS921X_UART_ENABLED(base) \
+ (__raw_readl((base) + 0x1000) & (1 << 29))
static void putc_ns921x(char c, void __iomem *base)
{
@@ -66,79 +66,96 @@ static void putc_ns921x(char c, void __iomem *base)
} while (t);
}
-#define MSCS __REG(0xA0900184)
+#include "fim-uncompress.h"
-#define NS9360_UARTA __REG(0x90200040)
-#define NS9360_UARTB __REG(0x90200000)
-#define NS9360_UARTC __REG(0x90300000)
-#define NS9360_UARTD __REG(0x90300040)
+static void putc_ns921x_fim(char ch, void __iomem *base)
+{
+ unsigned int status;
+ unsigned short data = 1;
+ int pic = 0;
-#define NS9360_UART_ENABLED(base) \
- (__raw_readl(NS9360_UARTA) & (1 << 31))
+ if ('\n' == ch)
+ ch = '\r';
-#define A9M9750DEV_UARTA __REG(0x40000000)
+ data = (data << FIM_SERIAL_DATA_BITS) | (ch & ((1 << FIM_SERIAL_DATA_BITS) - 1));
-#define NS921XSYS_CLOCK __REG(0xa090017c)
-#define NS921X_UARTA __REG(0x90010000)
-#define NS921X_UARTB __REG(0x90018000)
-#define NS921X_UARTC __REG(0x90020000)
-#define NS921X_UARTD __REG(0x90028000)
+ /* Check if the PIC is tasked with another send-char request */
+ do {
+ status = fim_get_exp_reg(pic, 0);
+ } while (status & FIM_SERIAL_INT_INSERT_CHAR);
-#define NS921X_UART_ENABLED(base) \
- (__raw_readl((base) + 0x1000) & (1 << 29))
+ /* And send the char using the interrupt function */
+ fim_set_ctrl_reg(pic, 0, data & 0xFF);
+ fim_set_ctrl_reg(pic, 1, (data >> 8) & 0xFF);
+ fim_send_interrupt(pic, FIM_SERIAL_INT_INSERT_CHAR);
+}
+#endif
static void autodetect(void (**putc)(char, void __iomem *), void __iomem **base)
{
- if (((__raw_readl(MSCS) >> 16) & 0xfe) == 0x00) {
- /* ns9360 or ns9750 */
- if (NS9360_UART_ENABLED(NS9360_UARTA)) {
- *putc = putc_ns9360;
- *base = NS9360_UARTA;
- return;
- } else if (NS9360_UART_ENABLED(NS9360_UARTB)) {
- *putc = putc_ns9360;
- *base = NS9360_UARTB;
- return;
- } else if (NS9360_UART_ENABLED(NS9360_UARTC)) {
- *putc = putc_ns9360;
- *base = NS9360_UARTC;
- return;
- } else if (NS9360_UART_ENABLED(NS9360_UARTD)) {
- *putc = putc_ns9360;
- *base = NS9360_UARTD;
- return;
- } else if (__raw_readl(__REG(0xa09001f4)) == 0xfffff001) {
- *putc = putc_a9m9750dev;
- *base = A9M9750DEV_UARTA;
- return;
- }
- } else if (((__raw_readl(MSCS) >> 16) & 0xfe) == 0x02) {
- /* ns921x */
- u32 clock = __raw_readl(NS921XSYS_CLOCK);
-
- if ((clock & (1 << 1)) &&
- NS921X_UART_ENABLED(NS921X_UARTA)) {
- *putc = putc_ns921x;
- *base = NS921X_UARTA;
- return;
- } else if ((clock & (1 << 2)) &&
- NS921X_UART_ENABLED(NS921X_UARTB)) {
- *putc = putc_ns921x;
- *base = NS921X_UARTB;
- return;
- } else if ((clock & (1 << 3)) &&
- NS921X_UART_ENABLED(NS921X_UARTC)) {
- *putc = putc_ns921x;
- *base = NS921X_UARTC;
- return;
- } else if ((clock & (1 << 4)) &&
- NS921X_UART_ENABLED(NS921X_UARTD)) {
- *putc = putc_ns921x;
- *base = NS921X_UARTD;
- return;
- }
+#if defined(CONFIG_PROCESSOR_NS9360)
+ /* ns9360 */
+ if (NS9360_UART_ENABLED(NS9360_UARTA)) {
+ *putc = putc_ns9360;
+ *base = NS9360_UARTA;
+ return;
+ } else if (NS9360_UART_ENABLED(NS9360_UARTB)) {
+ *putc = putc_ns9360;
+ *base = NS9360_UARTB;
+ return;
+ } else if (NS9360_UART_ENABLED(NS9360_UARTC)) {
+ *putc = putc_ns9360;
+ *base = NS9360_UARTC;
+ return;
+ } else if (NS9360_UART_ENABLED(NS9360_UARTD)) {
+ *putc = putc_ns9360;
+ *base = NS9360_UARTD;
+ return;
}
-
+#elif defined(CONFIG_PROCESSOR_NS921X)
+ /* ns921x */
+ u32 clock = __raw_readl(NS921XSYS_CLOCK);
+
+ if ((clock & (1 << 1)) &&
+ NS921X_UART_ENABLED(NS921X_UARTA)) {
+ *putc = putc_ns921x;
+ *base = NS921X_UARTA;
+ return;
+ } else if ((clock & (1 << 2)) &&
+ NS921X_UART_ENABLED(NS921X_UARTB)) {
+ *putc = putc_ns921x;
+ *base = NS921X_UARTB;
+ return;
+ } else if ((clock & (1 << 3)) &&
+ NS921X_UART_ENABLED(NS921X_UARTC)) {
+ *putc = putc_ns921x;
+ *base = NS921X_UARTC;
+ return;
+ } else if ((clock & (1 << 4)) &&
+ NS921X_UART_ENABLED(NS921X_UARTD)) {
+ *putc = putc_ns921x;
+ *base = NS921X_UARTD;
+ return;
+ }
+# if defined(CONFIG_SERIAL_FIM_CONSOLE)
+ /* None of the standard UARTs is enabled. Try with the FIMs */
+# if defined(CONFIG_FIM_ZERO_SERIAL_SELECTED) && !defined(CONFIG_FIM_ONE_SERIAL_SELECTED)
+ /* Try with UART on FIM0 */
+ else if (NS921X_FIM_ENABLED(NS921X_FIM0)) {
+ *putc = putc_ns921x_fim;
+ *base = NS921X_FIM0;
+ return;
+ }
+# elif !defined(CONFIG_FIM_ZERO_SERIAL_SELECTED) && defined(CONFIG_FIM_ONE_SERIAL_SELECTED)
+ /* Try with UART on FIM1 */
+ else if (NS921X_FIM_ENABLED(NS921X_FIM1)) {
+ *putc = putc_ns921x_fim;
+ *base = NS921X_FIM1;
+ return;
+ }
+# endif /* FIM_x */
+# endif /* SERIAL_FIM_CONSOLE */
+#endif /* PROCESSOR_x */
*putc = putc_dummy;
}
@@ -147,7 +164,7 @@ void __iomem *base;
static void putc(char c)
{
- myputc(c, base);
+ myputc(c, base);
}
static void arch_decomp_setup(void)