2 * Old U-boot compatibility for Esteem 195E Hotfoot CPU Board
4 * Author: Solomon Peachy <solomon@linux-wlan.com>
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published
8 * by the Free Software Foundation.
19 #define TARGET_HOTFOOT
21 #include "ppcboot-hotfoot.h"
27 static void hotfoot_fixups(void)
29 u32 uart = mfdcr(DCRN_CPC0_UCR) & 0x7f;
31 dt_fixup_memory(bd.bi_memstart, bd.bi_memsize);
33 dt_fixup_cpu_clocks(bd.bi_procfreq, bd.bi_procfreq, 0);
34 dt_fixup_clock("/plb", bd.bi_plb_busfreq);
35 dt_fixup_clock("/plb/opb", bd.bi_opbfreq);
36 dt_fixup_clock("/plb/ebc", bd.bi_pci_busfreq);
37 dt_fixup_clock("/plb/opb/serial@ef600300", bd.bi_procfreq / uart);
38 dt_fixup_clock("/plb/opb/serial@ef600400", bd.bi_procfreq / uart);
40 dt_fixup_mac_address_by_alias("ethernet0", bd.bi_enetaddr);
41 dt_fixup_mac_address_by_alias("ethernet1", bd.bi_enet1addr);
43 /* Is this a single eth/serial board? */
44 if ((bd.bi_enet1addr[0] == 0) &&
45 (bd.bi_enet1addr[1] == 0) &&
46 (bd.bi_enet1addr[2] == 0) &&
47 (bd.bi_enet1addr[3] == 0) &&
48 (bd.bi_enet1addr[4] == 0) &&
49 (bd.bi_enet1addr[5] == 0)) {
52 printf("Trimming devtree for single serial/eth board\n");
54 devp = finddevice("/plb/opb/serial@ef600300");
56 fatal("Can't find node for /plb/opb/serial@ef600300");
59 devp = finddevice("/plb/opb/ethernet@ef600900");
61 fatal("Can't find node for /plb/opb/ethernet@ef600900");
65 ibm4xx_quiesce_eth((u32 *)0xef600800, (u32 *)0xef600900);
67 /* Fix up flash size in fdt for 4M boards. */
68 if (bd.bi_flashsize < 0x800000) {
70 void *devp = finddevice("/plb/ebc/nor_flash@0");
72 fatal("Can't find FDT node for nor_flash!??");
74 printf("Fixing devtree for 4M Flash\n");
76 /* First fix up the base addresse */
77 getprop(devp, "reg", regs, sizeof(regs));
81 setprop(devp, "reg", regs, sizeof(regs));
83 /* Then the offsets */
84 devp = finddevice("/plb/ebc/nor_flash@0/partition@0");
86 fatal("Can't find FDT node for partition@0");
87 getprop(devp, "reg", regs, 2*sizeof(u32));
89 setprop(devp, "reg", regs, 2*sizeof(u32));
91 devp = finddevice("/plb/ebc/nor_flash@0/partition@1");
93 fatal("Can't find FDT node for partition@1");
94 getprop(devp, "reg", regs, 2*sizeof(u32));
96 setprop(devp, "reg", regs, 2*sizeof(u32));
98 devp = finddevice("/plb/ebc/nor_flash@0/partition@2");
100 fatal("Can't find FDT node for partition@2");
101 getprop(devp, "reg", regs, 2*sizeof(u32));
103 setprop(devp, "reg", regs, 2*sizeof(u32));
105 devp = finddevice("/plb/ebc/nor_flash@0/partition@3");
107 fatal("Can't find FDT node for partition@3");
108 getprop(devp, "reg", regs, 2*sizeof(u32));
110 setprop(devp, "reg", regs, 2*sizeof(u32));
112 devp = finddevice("/plb/ebc/nor_flash@0/partition@4");
114 fatal("Can't find FDT node for partition@4");
115 getprop(devp, "reg", regs, 2*sizeof(u32));
117 setprop(devp, "reg", regs, 2*sizeof(u32));
119 devp = finddevice("/plb/ebc/nor_flash@0/partition@6");
121 fatal("Can't find FDT node for partition@6");
122 getprop(devp, "reg", regs, 2*sizeof(u32));
124 setprop(devp, "reg", regs, 2*sizeof(u32));
126 /* Delete the FeatFS node */
127 devp = finddevice("/plb/ebc/nor_flash@0/partition@5");
129 fatal("Can't find FDT node for partition@5");
134 void platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
135 unsigned long r6, unsigned long r7)
138 platform_ops.fixups = hotfoot_fixups;
139 platform_ops.exit = ibm40x_dbcr_reset;
140 fdt_init(_dtb_start);
141 serial_console_init();