18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Old U-boot compatibility for Taishan
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Author: Hugh Blemings <hugh@au.ibm.com>
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * Copyright 2007 Hugh Blemings, IBM Corporation.
88c2ecf20Sopenharmony_ci *   Based on cuboot-ebony.c which is:
98c2ecf20Sopenharmony_ci * Copyright 2007 David Gibson, IBM Corporation.
108c2ecf20Sopenharmony_ci *   Based on cuboot-83xx.c, which is:
118c2ecf20Sopenharmony_ci * Copyright (c) 2007 Freescale Semiconductor, Inc.
128c2ecf20Sopenharmony_ci */
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci#include "ops.h"
158c2ecf20Sopenharmony_ci#include "stdio.h"
168c2ecf20Sopenharmony_ci#include "cuboot.h"
178c2ecf20Sopenharmony_ci#include "reg.h"
188c2ecf20Sopenharmony_ci#include "dcr.h"
198c2ecf20Sopenharmony_ci#include "4xx.h"
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci#define TARGET_4xx
228c2ecf20Sopenharmony_ci#define TARGET_44x
238c2ecf20Sopenharmony_ci#define TARGET_440GX
248c2ecf20Sopenharmony_ci#include "ppcboot.h"
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_cistatic bd_t bd;
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ciBSS_STACK(4096);
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_cistatic void taishan_fixups(void)
318c2ecf20Sopenharmony_ci{
328c2ecf20Sopenharmony_ci	/* FIXME: sysclk should be derived by reading the FPGA
338c2ecf20Sopenharmony_ci	   registers */
348c2ecf20Sopenharmony_ci	unsigned long sysclk = 33000000;
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci	ibm440gx_fixup_clocks(sysclk, 6 * 1843200, 25000000);
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci	ibm4xx_sdram_fixup_memsize();
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci	dt_fixup_mac_address_by_alias("ethernet0", bd.bi_enetaddr);
418c2ecf20Sopenharmony_ci	dt_fixup_mac_address_by_alias("ethernet1", bd.bi_enet1addr);
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci	ibm4xx_fixup_ebc_ranges("/plb/opb/ebc");
448c2ecf20Sopenharmony_ci}
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_civoid platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
478c2ecf20Sopenharmony_ci		   unsigned long r6, unsigned long r7)
488c2ecf20Sopenharmony_ci{
498c2ecf20Sopenharmony_ci	CUBOOT_INIT();
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ci	platform_ops.fixups = taishan_fixups;
528c2ecf20Sopenharmony_ci	fdt_init(_dtb_start);
538c2ecf20Sopenharmony_ci	serial_console_init();
548c2ecf20Sopenharmony_ci}
55