Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 91181
b: refs/heads/master
c: a287453
h: refs/heads/master
i:
  91179: fac2a26
v: v3
  • Loading branch information
Uwe Kleine-König authored and Uwe Kleine-König committed Mar 31, 2008
1 parent b3c220d commit 5e4924a
Show file tree
Hide file tree
Showing 2 changed files with 137 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 724ce5ee15ff4c4f3035110b683b990a3b33c832
refs/heads/master: a287453e37a11a128ee0761e1db2e79d7faacdb3
143 changes: 136 additions & 7 deletions trunk/include/asm-arm/arch-ns9xxx/uncompress.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,149 @@
#ifndef __ASM_ARCH_UNCOMPRESS_H
#define __ASM_ARCH_UNCOMPRESS_H

static void putc(char c)
#include <asm/io.h>

#define __REG(x) ((void __iomem __force *)(x))

static void putc_dummy(char c, void __iomem *base)
{
volatile u8 *base = (volatile u8 *)0x40000000;
int t = 0x10000;
/* nothing */
}

static void putc_ns9360(char c, void __iomem *base)
{
static int t = 0x10000;
do {
if (t)
--t;

if (__raw_readl(base + 8) & (1 << 3)) {
__raw_writeb(c, base + 16);
t = 0x10000;
break;
}
} 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);

}

static void putc_ns921x(char c, void __iomem *base)
{
static int t = 0x10000;
do {
if (base[5] & 0x20) {
base[0] = c;
if (t)
--t;

if (!(__raw_readl(base) & (1 << 11))) {
__raw_writeb(c, base + 0x0028);
t = 0x10000;
break;
}
} while (--t);
} while (t);
}

#define arch_decomp_setup()
#define MSCS __REG(0xA0900184)

#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))

#define A9M9750DEV_UARTA __REG(0x40000000)

#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 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;
}
}

*putc = putc_dummy;
}

void (*myputc)(char, void __iomem *);
void __iomem *base;

static void putc(char c)
{
myputc(c, base);
}

static void arch_decomp_setup(void)
{
autodetect(&myputc, &base);
}
#define arch_decomp_wdog()

static void flush(void)
Expand Down

0 comments on commit 5e4924a

Please sign in to comment.