aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/boot/ebony.c
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2007-07-30 01:55:02 -0400
committerPaul Mackerras <paulus@samba.org>2007-08-16 21:01:51 -0400
commit0d279d47612d1b63155a1d9637a6fc5143dad594 (patch)
treedbe42e6da4aacd499ea3deacccdf9294c7d98006 /arch/powerpc/boot/ebony.c
parent9420dc65ff9e6b67c032286efde823aeb8684670 (diff)
[POWERPC] Fixes to allow use of Ebony's flash chips through physmap_of
This patch contains a handful of small fixes to allow the Ebony's flash to be exposed as MTD devices via the physmap_of driver. Specifically it: - Makes a small addition to the device tree and zImage wrapper to record the correct address for the flash in the device tree based on the board switches as reported via an FPGA register. - Prohibits building the old hard-coded "Ebony" flash map on arch/powerpc kernels, in favour of using physmap_of's device tree based approach. - Enables MTD and physmap_of in the Ebony defconfig. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/boot/ebony.c')
-rw-r--r--arch/powerpc/boot/ebony.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/arch/powerpc/boot/ebony.c b/arch/powerpc/boot/ebony.c
index 75daedafd0a4..eaf0b9bb68d6 100644
--- a/arch/powerpc/boot/ebony.c
+++ b/arch/powerpc/boot/ebony.c
@@ -24,6 +24,7 @@
24#include "page.h" 24#include "page.h"
25#include "ops.h" 25#include "ops.h"
26#include "reg.h" 26#include "reg.h"
27#include "io.h"
27#include "dcr.h" 28#include "dcr.h"
28#include "44x.h" 29#include "44x.h"
29 30
@@ -92,6 +93,43 @@ void ibm440gp_fixup_clocks(unsigned int sysclk, unsigned int ser_clk)
92 dt_fixup_clock("/plb/opb/serial@40000300", uart1); 93 dt_fixup_clock("/plb/opb/serial@40000300", uart1);
93} 94}
94 95
96#define EBONY_FPGA_PATH "/plb/opb/ebc/fpga"
97#define EBONY_FPGA_FLASH_SEL 0x01
98#define EBONY_SMALL_FLASH_PATH "/plb/opb/ebc/small-flash"
99
100static void ebony_flashsel_fixup(void)
101{
102 void *devp;
103 u32 reg[3] = {0x0, 0x0, 0x80000};
104 u8 *fpga;
105 u8 fpga_reg0 = 0x0;
106
107 devp = finddevice(EBONY_FPGA_PATH);
108 if (!devp)
109 fatal("Couldn't locate FPGA node %s\n\r", EBONY_FPGA_PATH);
110
111 if (getprop(devp, "virtual-reg", &fpga, sizeof(fpga)) != sizeof(fpga))
112 fatal("%s has missing or invalid virtual-reg property\n\r",
113 EBONY_FPGA_PATH);
114
115 fpga_reg0 = in_8(fpga);
116
117 devp = finddevice(EBONY_SMALL_FLASH_PATH);
118 if (!devp)
119 fatal("Couldn't locate small flash node %s\n\r",
120 EBONY_SMALL_FLASH_PATH);
121
122 if (getprop(devp, "reg", reg, sizeof(reg)) != sizeof(reg))
123 fatal("%s has reg property of unexpected size\n\r",
124 EBONY_SMALL_FLASH_PATH);
125
126 /* Invert address bit 14 (IBM-endian) if FLASH_SEL fpga bit is set */
127 if (fpga_reg0 & EBONY_FPGA_FLASH_SEL)
128 reg[1] ^= 0x80000;
129
130 setprop(devp, "reg", reg, sizeof(reg));
131}
132
95static void ebony_fixups(void) 133static void ebony_fixups(void)
96{ 134{
97 // FIXME: sysclk should be derived by reading the FPGA registers 135 // FIXME: sysclk should be derived by reading the FPGA registers
@@ -101,6 +139,7 @@ static void ebony_fixups(void)
101 ibm44x_fixup_memsize(); 139 ibm44x_fixup_memsize();
102 dt_fixup_mac_addresses(ebony_mac0, ebony_mac1); 140 dt_fixup_mac_addresses(ebony_mac0, ebony_mac1);
103 ibm4xx_fixup_ebc_ranges("/plb/opb/ebc"); 141 ibm4xx_fixup_ebc_ranges("/plb/opb/ebc");
142 ebony_flashsel_fixup();
104} 143}
105 144
106void ebony_init(void *mac0, void *mac1) 145void ebony_init(void *mac0, void *mac1)