aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/boot/ebony.c
diff options
context:
space:
mode:
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)