Path: blob/master/arch/powerpc/boot/cuboot-hotfoot.c
10817 views
/*1* Old U-boot compatibility for Esteem 195E Hotfoot CPU Board2*3* Author: Solomon Peachy <[email protected]>4*5* This program is free software; you can redistribute it and/or modify it6* under the terms of the GNU General Public License version 2 as published7* by the Free Software Foundation.8*/910#include "ops.h"11#include "stdio.h"12#include "reg.h"13#include "dcr.h"14#include "4xx.h"15#include "cuboot.h"1617#define TARGET_4xx18#define TARGET_HOTFOOT1920#include "ppcboot-hotfoot.h"2122static bd_t bd;2324#define NUM_REGS 32526static void hotfoot_fixups(void)27{28u32 uart = mfdcr(DCRN_CPC0_UCR) & 0x7f;2930dt_fixup_memory(bd.bi_memstart, bd.bi_memsize);3132dt_fixup_cpu_clocks(bd.bi_procfreq, bd.bi_procfreq, 0);33dt_fixup_clock("/plb", bd.bi_plb_busfreq);34dt_fixup_clock("/plb/opb", bd.bi_opbfreq);35dt_fixup_clock("/plb/ebc", bd.bi_pci_busfreq);36dt_fixup_clock("/plb/opb/serial@ef600300", bd.bi_procfreq / uart);37dt_fixup_clock("/plb/opb/serial@ef600400", bd.bi_procfreq / uart);3839dt_fixup_mac_address_by_alias("ethernet0", bd.bi_enetaddr);40dt_fixup_mac_address_by_alias("ethernet1", bd.bi_enet1addr);4142/* Is this a single eth/serial board? */43if ((bd.bi_enet1addr[0] == 0) &&44(bd.bi_enet1addr[1] == 0) &&45(bd.bi_enet1addr[2] == 0) &&46(bd.bi_enet1addr[3] == 0) &&47(bd.bi_enet1addr[4] == 0) &&48(bd.bi_enet1addr[5] == 0)) {49void *devp;5051printf("Trimming devtree for single serial/eth board\n");5253devp = finddevice("/plb/opb/serial@ef600300");54if (!devp)55fatal("Can't find node for /plb/opb/serial@ef600300");56del_node(devp);5758devp = finddevice("/plb/opb/ethernet@ef600900");59if (!devp)60fatal("Can't find node for /plb/opb/ethernet@ef600900");61del_node(devp);62}6364ibm4xx_quiesce_eth((u32 *)0xef600800, (u32 *)0xef600900);6566/* Fix up flash size in fdt for 4M boards. */67if (bd.bi_flashsize < 0x800000) {68u32 regs[NUM_REGS];69void *devp = finddevice("/plb/ebc/nor_flash@0");70if (!devp)71fatal("Can't find FDT node for nor_flash!??");7273printf("Fixing devtree for 4M Flash\n");7475/* First fix up the base addresse */76getprop(devp, "reg", regs, sizeof(regs));77regs[0] = 0;78regs[1] = 0xffc00000;79regs[2] = 0x00400000;80setprop(devp, "reg", regs, sizeof(regs));8182/* Then the offsets */83devp = finddevice("/plb/ebc/nor_flash@0/partition@0");84if (!devp)85fatal("Can't find FDT node for partition@0");86getprop(devp, "reg", regs, 2*sizeof(u32));87regs[0] -= 0x400000;88setprop(devp, "reg", regs, 2*sizeof(u32));8990devp = finddevice("/plb/ebc/nor_flash@0/partition@1");91if (!devp)92fatal("Can't find FDT node for partition@1");93getprop(devp, "reg", regs, 2*sizeof(u32));94regs[0] -= 0x400000;95setprop(devp, "reg", regs, 2*sizeof(u32));9697devp = finddevice("/plb/ebc/nor_flash@0/partition@2");98if (!devp)99fatal("Can't find FDT node for partition@2");100getprop(devp, "reg", regs, 2*sizeof(u32));101regs[0] -= 0x400000;102setprop(devp, "reg", regs, 2*sizeof(u32));103104devp = finddevice("/plb/ebc/nor_flash@0/partition@3");105if (!devp)106fatal("Can't find FDT node for partition@3");107getprop(devp, "reg", regs, 2*sizeof(u32));108regs[0] -= 0x400000;109setprop(devp, "reg", regs, 2*sizeof(u32));110111devp = finddevice("/plb/ebc/nor_flash@0/partition@4");112if (!devp)113fatal("Can't find FDT node for partition@4");114getprop(devp, "reg", regs, 2*sizeof(u32));115regs[0] -= 0x400000;116setprop(devp, "reg", regs, 2*sizeof(u32));117118devp = finddevice("/plb/ebc/nor_flash@0/partition@6");119if (!devp)120fatal("Can't find FDT node for partition@6");121getprop(devp, "reg", regs, 2*sizeof(u32));122regs[0] -= 0x400000;123setprop(devp, "reg", regs, 2*sizeof(u32));124125/* Delete the FeatFS node */126devp = finddevice("/plb/ebc/nor_flash@0/partition@5");127if (!devp)128fatal("Can't find FDT node for partition@5");129del_node(devp);130}131}132133void platform_init(unsigned long r3, unsigned long r4, unsigned long r5,134unsigned long r6, unsigned long r7)135{136CUBOOT_INIT();137platform_ops.fixups = hotfoot_fixups;138platform_ops.exit = ibm40x_dbcr_reset;139fdt_init(_dtb_start);140serial_console_init();141}142143144