Linux Audio

Check our new training course

Loading...
v6.8
  1// SPDX-License-Identifier: GPL-2.0-only
  2/*
  3 * Old U-boot compatibility for Esteem 195E Hotfoot CPU Board
  4 *
  5 * Author: Solomon Peachy <solomon@linux-wlan.com>
 
 
 
 
  6 */
  7
  8#include "ops.h"
  9#include "stdio.h"
 10#include "reg.h"
 11#include "dcr.h"
 12#include "4xx.h"
 13#include "cuboot.h"
 14
 15#define TARGET_4xx
 16#define TARGET_HOTFOOT
 17
 18#include "ppcboot-hotfoot.h"
 19
 20static bd_t bd;
 21
 22#define NUM_REGS 3
 23
 24static void hotfoot_fixups(void)
 25{
 26	u32 uart = mfdcr(DCRN_CPC0_UCR) & 0x7f;
 27
 28	dt_fixup_memory(bd.bi_memstart, bd.bi_memsize); 
 29
 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); 
 36	
 37	dt_fixup_mac_address_by_alias("ethernet0", bd.bi_enetaddr);
 38	dt_fixup_mac_address_by_alias("ethernet1", bd.bi_enet1addr);
 39
 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)) {
 47		void *devp;
 48
 49		printf("Trimming devtree for single serial/eth board\n");
 50
 51		devp = finddevice("/plb/opb/serial@ef600300");
 52		if (!devp)
 53			fatal("Can't find node for /plb/opb/serial@ef600300");
 54		del_node(devp);
 55
 56		devp = finddevice("/plb/opb/ethernet@ef600900");
 57		if (!devp)
 58			fatal("Can't find node for /plb/opb/ethernet@ef600900");
 59		del_node(devp);
 60	}
 61
 62	ibm4xx_quiesce_eth((u32 *)0xef600800, (u32 *)0xef600900);
 63
 64	/* Fix up flash size in fdt for 4M boards. */
 65	if (bd.bi_flashsize < 0x800000) {
 66		u32 regs[NUM_REGS];
 67		void *devp = finddevice("/plb/ebc/nor_flash@0");
 68		if (!devp)
 69			fatal("Can't find FDT node for nor_flash!??");
 70
 71		printf("Fixing devtree for 4M Flash\n");
 72		
 73		/* First fix up the base address */
 74		getprop(devp, "reg", regs, sizeof(regs));
 75		regs[0] = 0;
 76		regs[1] = 0xffc00000;
 77		regs[2] = 0x00400000;
 78		setprop(devp, "reg", regs, sizeof(regs));
 79		
 80		/* Then the offsets */
 81		devp = finddevice("/plb/ebc/nor_flash@0/partition@0");
 82		if (!devp)
 83			fatal("Can't find FDT node for partition@0");
 84		getprop(devp, "reg", regs, 2*sizeof(u32));
 85		regs[0] -= 0x400000;
 86		setprop(devp, "reg", regs,  2*sizeof(u32));
 87
 88		devp = finddevice("/plb/ebc/nor_flash@0/partition@1");
 89		if (!devp)
 90			fatal("Can't find FDT node for partition@1");
 91		getprop(devp, "reg", regs, 2*sizeof(u32));
 92		regs[0] -= 0x400000;
 93		setprop(devp, "reg", regs,  2*sizeof(u32));
 94
 95		devp = finddevice("/plb/ebc/nor_flash@0/partition@2");
 96		if (!devp)
 97			fatal("Can't find FDT node for partition@2");
 98		getprop(devp, "reg", regs, 2*sizeof(u32));
 99		regs[0] -= 0x400000;
100		setprop(devp, "reg", regs,  2*sizeof(u32));
101
102		devp = finddevice("/plb/ebc/nor_flash@0/partition@3");
103		if (!devp)
104			fatal("Can't find FDT node for partition@3");
105		getprop(devp, "reg", regs, 2*sizeof(u32));
106		regs[0] -= 0x400000;
107		setprop(devp, "reg", regs,  2*sizeof(u32));
108
109		devp = finddevice("/plb/ebc/nor_flash@0/partition@4");
110		if (!devp)
111			fatal("Can't find FDT node for partition@4");
112		getprop(devp, "reg", regs, 2*sizeof(u32));
113		regs[0] -= 0x400000;
114		setprop(devp, "reg", regs,  2*sizeof(u32));
115
116		devp = finddevice("/plb/ebc/nor_flash@0/partition@6");
117		if (!devp)
118			fatal("Can't find FDT node for partition@6");
119		getprop(devp, "reg", regs, 2*sizeof(u32));
120		regs[0] -= 0x400000;
121		setprop(devp, "reg", regs,  2*sizeof(u32));
122
123		/* Delete the FeatFS node */
124		devp = finddevice("/plb/ebc/nor_flash@0/partition@5");
125		if (!devp)
126			fatal("Can't find FDT node for partition@5");
127		del_node(devp);
128	}
129}
130
131void platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
132		   unsigned long r6, unsigned long r7)
133{
134	CUBOOT_INIT();
135	platform_ops.fixups = hotfoot_fixups;
136        platform_ops.exit = ibm40x_dbcr_reset;
137	fdt_init(_dtb_start);
138	serial_console_init();
139}
v3.15
 
  1/*
  2 * Old U-boot compatibility for Esteem 195E Hotfoot CPU Board
  3 *
  4 * Author: Solomon Peachy <solomon@linux-wlan.com>
  5 *
  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.
  9 */
 10
 11#include "ops.h"
 12#include "stdio.h"
 13#include "reg.h"
 14#include "dcr.h"
 15#include "4xx.h"
 16#include "cuboot.h"
 17
 18#define TARGET_4xx
 19#define TARGET_HOTFOOT
 20
 21#include "ppcboot-hotfoot.h"
 22
 23static bd_t bd;
 24
 25#define NUM_REGS 3
 26
 27static void hotfoot_fixups(void)
 28{
 29	u32 uart = mfdcr(DCRN_CPC0_UCR) & 0x7f;
 30
 31	dt_fixup_memory(bd.bi_memstart, bd.bi_memsize); 
 32
 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); 
 39	
 40	dt_fixup_mac_address_by_alias("ethernet0", bd.bi_enetaddr);
 41	dt_fixup_mac_address_by_alias("ethernet1", bd.bi_enet1addr);
 42
 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)) {
 50		void *devp;
 51
 52		printf("Trimming devtree for single serial/eth board\n");
 53
 54		devp = finddevice("/plb/opb/serial@ef600300");
 55		if (!devp)
 56			fatal("Can't find node for /plb/opb/serial@ef600300");
 57		del_node(devp);
 58
 59		devp = finddevice("/plb/opb/ethernet@ef600900");
 60		if (!devp)
 61			fatal("Can't find node for /plb/opb/ethernet@ef600900");
 62		del_node(devp);
 63	}
 64
 65	ibm4xx_quiesce_eth((u32 *)0xef600800, (u32 *)0xef600900);
 66
 67	/* Fix up flash size in fdt for 4M boards. */
 68	if (bd.bi_flashsize < 0x800000) {
 69		u32 regs[NUM_REGS];
 70		void *devp = finddevice("/plb/ebc/nor_flash@0");
 71		if (!devp)
 72			fatal("Can't find FDT node for nor_flash!??");
 73
 74		printf("Fixing devtree for 4M Flash\n");
 75		
 76		/* First fix up the base addresse */
 77		getprop(devp, "reg", regs, sizeof(regs));
 78		regs[0] = 0;
 79		regs[1] = 0xffc00000;
 80		regs[2] = 0x00400000;
 81		setprop(devp, "reg", regs, sizeof(regs));
 82		
 83		/* Then the offsets */
 84		devp = finddevice("/plb/ebc/nor_flash@0/partition@0");
 85		if (!devp)
 86			fatal("Can't find FDT node for partition@0");
 87		getprop(devp, "reg", regs, 2*sizeof(u32));
 88		regs[0] -= 0x400000;
 89		setprop(devp, "reg", regs,  2*sizeof(u32));
 90
 91		devp = finddevice("/plb/ebc/nor_flash@0/partition@1");
 92		if (!devp)
 93			fatal("Can't find FDT node for partition@1");
 94		getprop(devp, "reg", regs, 2*sizeof(u32));
 95		regs[0] -= 0x400000;
 96		setprop(devp, "reg", regs,  2*sizeof(u32));
 97
 98		devp = finddevice("/plb/ebc/nor_flash@0/partition@2");
 99		if (!devp)
100			fatal("Can't find FDT node for partition@2");
101		getprop(devp, "reg", regs, 2*sizeof(u32));
102		regs[0] -= 0x400000;
103		setprop(devp, "reg", regs,  2*sizeof(u32));
104
105		devp = finddevice("/plb/ebc/nor_flash@0/partition@3");
106		if (!devp)
107			fatal("Can't find FDT node for partition@3");
108		getprop(devp, "reg", regs, 2*sizeof(u32));
109		regs[0] -= 0x400000;
110		setprop(devp, "reg", regs,  2*sizeof(u32));
111
112		devp = finddevice("/plb/ebc/nor_flash@0/partition@4");
113		if (!devp)
114			fatal("Can't find FDT node for partition@4");
115		getprop(devp, "reg", regs, 2*sizeof(u32));
116		regs[0] -= 0x400000;
117		setprop(devp, "reg", regs,  2*sizeof(u32));
118
119		devp = finddevice("/plb/ebc/nor_flash@0/partition@6");
120		if (!devp)
121			fatal("Can't find FDT node for partition@6");
122		getprop(devp, "reg", regs, 2*sizeof(u32));
123		regs[0] -= 0x400000;
124		setprop(devp, "reg", regs,  2*sizeof(u32));
125
126		/* Delete the FeatFS node */
127		devp = finddevice("/plb/ebc/nor_flash@0/partition@5");
128		if (!devp)
129			fatal("Can't find FDT node for partition@5");
130		del_node(devp);
131	}
132}
133
134void platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
135		   unsigned long r6, unsigned long r7)
136{
137	CUBOOT_INIT();
138	platform_ops.fixups = hotfoot_fixups;
139        platform_ops.exit = ibm40x_dbcr_reset;
140	fdt_init(_dtb_start);
141	serial_console_init();
142}