diff options
author | Lennert Buytenhek <buytenh@wantstofly.org> | 2006-03-26 15:40:27 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2006-03-26 15:40:27 -0500 |
commit | c9b4470e2d9d611181fe488fdf463948d8b24901 (patch) | |
tree | 5f74c641d602d2f3aa68f9fa3795a46ebb0fbe08 | |
parent | 36ddf5bbdea7ba4582abc62f106f0f0e9f0b6b91 (diff) |
[ARM] 3414/1: ep93xx: reset ethernet controller before uncompressing
Patch from Lennert Buytenhek
The Redboot version that cirrus supplies for the cirrus ep93xx doesn't
turn off DMA from the ethernet MAC before jumping to linux, which means
that we might end up with bits of RX status and packet data scribbled
over the uncompressed kernel image.
Work around this by resetting the ethernet MAC before we uncompress.
We don't usually work around bootloader bugs, but considering that the
large majority of ep93xx boards out there have this problem, I figured
this it was justified in this case.
Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r-- | include/asm-arm/arch-ep93xx/uncompress.h | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/include/asm-arm/arch-ep93xx/uncompress.h b/include/asm-arm/arch-ep93xx/uncompress.h index 4410d217077e..2171082d4fc5 100644 --- a/include/asm-arm/arch-ep93xx/uncompress.h +++ b/include/asm-arm/arch-ep93xx/uncompress.h | |||
@@ -16,11 +16,21 @@ static unsigned char __raw_readb(unsigned int ptr) | |||
16 | return *((volatile unsigned char *)ptr); | 16 | return *((volatile unsigned char *)ptr); |
17 | } | 17 | } |
18 | 18 | ||
19 | static unsigned int __raw_readl(unsigned int ptr) | ||
20 | { | ||
21 | return *((volatile unsigned int *)ptr); | ||
22 | } | ||
23 | |||
19 | static void __raw_writeb(unsigned char value, unsigned int ptr) | 24 | static void __raw_writeb(unsigned char value, unsigned int ptr) |
20 | { | 25 | { |
21 | *((volatile unsigned char *)ptr) = value; | 26 | *((volatile unsigned char *)ptr) = value; |
22 | } | 27 | } |
23 | 28 | ||
29 | static void __raw_writel(unsigned int value, unsigned int ptr) | ||
30 | { | ||
31 | *((volatile unsigned int *)ptr) = value; | ||
32 | } | ||
33 | |||
24 | 34 | ||
25 | #define PHYS_UART1_DATA 0x808c0000 | 35 | #define PHYS_UART1_DATA 0x808c0000 |
26 | #define PHYS_UART1_FLAG 0x808c0018 | 36 | #define PHYS_UART1_FLAG 0x808c0018 |
@@ -49,5 +59,33 @@ static void putstr(const char *s) | |||
49 | } | 59 | } |
50 | } | 60 | } |
51 | 61 | ||
52 | #define arch_decomp_setup() | 62 | |
63 | /* | ||
64 | * Some bootloaders don't turn off DMA from the ethernet MAC before | ||
65 | * jumping to linux, which means that we might end up with bits of RX | ||
66 | * status and packet data scribbled over the uncompressed kernel image. | ||
67 | * Work around this by resetting the ethernet MAC before we uncompress. | ||
68 | */ | ||
69 | #define PHYS_ETH_SELF_CTL 0x80010020 | ||
70 | #define ETH_SELF_CTL_RESET 0x00000001 | ||
71 | |||
72 | static void ethernet_reset(void) | ||
73 | { | ||
74 | unsigned int v; | ||
75 | |||
76 | /* Reset the ethernet MAC. */ | ||
77 | v = __raw_readl(PHYS_ETH_SELF_CTL); | ||
78 | __raw_writel(v | ETH_SELF_CTL_RESET, PHYS_ETH_SELF_CTL); | ||
79 | |||
80 | /* Wait for reset to finish. */ | ||
81 | while (__raw_readl(PHYS_ETH_SELF_CTL) & ETH_SELF_CTL_RESET) | ||
82 | ; | ||
83 | } | ||
84 | |||
85 | |||
86 | static void arch_decomp_setup(void) | ||
87 | { | ||
88 | ethernet_reset(); | ||
89 | } | ||
90 | |||
53 | #define arch_decomp_wdog() | 91 | #define arch_decomp_wdog() |