18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Old U-boot compatibility for Sam440ep based off bamboo.c code
48c2ecf20Sopenharmony_ci * original copyrights below
58c2ecf20Sopenharmony_ci *
68c2ecf20Sopenharmony_ci * Author: Josh Boyer <jwboyer@linux.vnet.ibm.com>
78c2ecf20Sopenharmony_ci *
88c2ecf20Sopenharmony_ci * Copyright 2007 IBM Corporation
98c2ecf20Sopenharmony_ci *
108c2ecf20Sopenharmony_ci * Based on cuboot-ebony.c
118c2ecf20Sopenharmony_ci *
128c2ecf20Sopenharmony_ci * Modified from cuboot-bamboo.c for sam440ep:
138c2ecf20Sopenharmony_ci * Copyright 2008 Giuseppe Coviello <gicoviello@gmail.com>
148c2ecf20Sopenharmony_ci */
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci#include "ops.h"
178c2ecf20Sopenharmony_ci#include "stdio.h"
188c2ecf20Sopenharmony_ci#include "44x.h"
198c2ecf20Sopenharmony_ci#include "4xx.h"
208c2ecf20Sopenharmony_ci#include "cuboot.h"
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci#define TARGET_4xx
238c2ecf20Sopenharmony_ci#define TARGET_44x
248c2ecf20Sopenharmony_ci#include "ppcboot.h"
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_cistatic bd_t bd;
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_cistatic void sam440ep_fixups(void)
298c2ecf20Sopenharmony_ci{
308c2ecf20Sopenharmony_ci       unsigned long sysclk = 66666666;
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci       ibm440ep_fixup_clocks(sysclk, 11059200, 25000000);
338c2ecf20Sopenharmony_ci       ibm4xx_sdram_fixup_memsize();
348c2ecf20Sopenharmony_ci       ibm4xx_quiesce_eth((u32 *)0xef600e00, (u32 *)0xef600f00);
358c2ecf20Sopenharmony_ci       dt_fixup_mac_addresses(&bd.bi_enetaddr, &bd.bi_enet1addr);
368c2ecf20Sopenharmony_ci}
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_civoid platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
398c2ecf20Sopenharmony_ci		unsigned long r6, unsigned long r7)
408c2ecf20Sopenharmony_ci{
418c2ecf20Sopenharmony_ci	CUBOOT_INIT();
428c2ecf20Sopenharmony_ci	platform_ops.fixups = sam440ep_fixups;
438c2ecf20Sopenharmony_ci	platform_ops.exit = ibm44x_dbcr_reset;
448c2ecf20Sopenharmony_ci	fdt_init(_dtb_start);
458c2ecf20Sopenharmony_ci	serial_console_init();
468c2ecf20Sopenharmony_ci}
47