1 // SPDX-License-Identifier: GPL-2.0-only
3 * Old U-boot compatibility for Esteem 195E Hotfoot CPU Board
16 #define TARGET_HOTFOOT
18 #include "ppcboot-hotfoot.h"
24 static void hotfoot_fixups(void)
26 u32 uart = mfdcr(DCRN_CPC0_UCR) & 0x7f;
28 dt_fixup_memory(bd.bi_memstart, bd.bi_memsize);
30 dt_fixup_cpu_clocks(bd.bi_procfreq, bd.bi_procfreq, 0);
31 dt_fixup_clock("/plb", bd.bi_plb_busfreq);
32 dt_fixup_clock("/plb/opb", bd.bi_opbfreq);
33 dt_fixup_clock("/plb/ebc", bd.bi_pci_busfreq);
34 dt_fixup_clock("/plb/opb/serial@ef600300", bd.bi_procfreq / uart);
35 dt_fixup_clock("/plb/opb/serial@ef600400", bd.bi_procfreq / uart);
37 dt_fixup_mac_address_by_alias("ethernet0", bd.bi_enetaddr);
38 dt_fixup_mac_address_by_alias("ethernet1", bd.bi_enet1addr);
40 /* Is this a single eth/serial board? */
41 if ((bd.bi_enet1addr[0] == 0) &&
42 (bd.bi_enet1addr[1] == 0) &&
43 (bd.bi_enet1addr[2] == 0) &&
44 (bd.bi_enet1addr[3] == 0) &&
45 (bd.bi_enet1addr[4] == 0) &&
46 (bd.bi_enet1addr[5] == 0)) {
49 printf("Trimming devtree for single serial/eth board\n");
51 devp = finddevice("/plb/opb/serial@ef600300");
53 fatal("Can't find node for /plb/opb/serial@ef600300");
56 devp = finddevice("/plb/opb/ethernet@ef600900");
58 fatal("Can't find node for /plb/opb/ethernet@ef600900");
62 ibm4xx_quiesce_eth((u32 *)0xef600800, (u32 *)0xef600900);
64 /* Fix up flash size in fdt for 4M boards. */
65 if (bd.bi_flashsize < 0x800000) {
67 void *devp = finddevice("/plb/ebc/nor_flash@0");
69 fatal("Can't find FDT node for nor_flash!??");
71 printf("Fixing devtree for 4M Flash\n");
73 /* First fix up the base address */
74 getprop(devp, "reg", regs, sizeof(regs));
78 setprop(devp, "reg", regs, sizeof(regs));
80 /* Then the offsets */
81 devp = finddevice("/plb/ebc/nor_flash@0/partition@0");
83 fatal("Can't find FDT node for partition@0");
84 getprop(devp, "reg", regs, 2*sizeof(u32));
86 setprop(devp, "reg", regs, 2*sizeof(u32));
88 devp = finddevice("/plb/ebc/nor_flash@0/partition@1");
90 fatal("Can't find FDT node for partition@1");
91 getprop(devp, "reg", regs, 2*sizeof(u32));
93 setprop(devp, "reg", regs, 2*sizeof(u32));
95 devp = finddevice("/plb/ebc/nor_flash@0/partition@2");
97 fatal("Can't find FDT node for partition@2");
98 getprop(devp, "reg", regs, 2*sizeof(u32));
100 setprop(devp, "reg", regs, 2*sizeof(u32));
102 devp = finddevice("/plb/ebc/nor_flash@0/partition@3");
104 fatal("Can't find FDT node for partition@3");
105 getprop(devp, "reg", regs, 2*sizeof(u32));
107 setprop(devp, "reg", regs, 2*sizeof(u32));
109 devp = finddevice("/plb/ebc/nor_flash@0/partition@4");
111 fatal("Can't find FDT node for partition@4");
112 getprop(devp, "reg", regs, 2*sizeof(u32));
114 setprop(devp, "reg", regs, 2*sizeof(u32));
116 devp = finddevice("/plb/ebc/nor_flash@0/partition@6");
118 fatal("Can't find FDT node for partition@6");
119 getprop(devp, "reg", regs, 2*sizeof(u32));
121 setprop(devp, "reg", regs, 2*sizeof(u32));
123 /* Delete the FeatFS node */
124 devp = finddevice("/plb/ebc/nor_flash@0/partition@5");
126 fatal("Can't find FDT node for partition@5");
131 void platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
132 unsigned long r6, unsigned long r7)
135 platform_ops.fixups = hotfoot_fixups;
136 platform_ops.exit = ibm40x_dbcr_reset;
137 fdt_init(_dtb_start);
138 serial_console_init();