1*040b2583STom Rini // SPDX-License-Identifier: GPL-2.0+ 263e22517SMarek Vasut /* 363e22517SMarek Vasut * board/renesas/ebisu/ebisu.c 463e22517SMarek Vasut * This file is Ebisu board support. 563e22517SMarek Vasut * 663e22517SMarek Vasut * Copyright (C) 2018 Marek Vasut <marek.vasut+renesas@gmail.com> 763e22517SMarek Vasut */ 863e22517SMarek Vasut 963e22517SMarek Vasut #include <common.h> 1063e22517SMarek Vasut #include <malloc.h> 1163e22517SMarek Vasut #include <netdev.h> 1263e22517SMarek Vasut #include <dm.h> 1363e22517SMarek Vasut #include <dm/platform_data/serial_sh.h> 1463e22517SMarek Vasut #include <asm/processor.h> 1563e22517SMarek Vasut #include <asm/mach-types.h> 1663e22517SMarek Vasut #include <asm/io.h> 1763e22517SMarek Vasut #include <linux/errno.h> 1863e22517SMarek Vasut #include <asm/arch/sys_proto.h> 1963e22517SMarek Vasut #include <asm/gpio.h> 2063e22517SMarek Vasut #include <asm/arch/gpio.h> 2163e22517SMarek Vasut #include <asm/arch/rmobile.h> 2263e22517SMarek Vasut #include <asm/arch/rcar-mstp.h> 2363e22517SMarek Vasut #include <asm/arch/sh_sdhi.h> 2463e22517SMarek Vasut #include <i2c.h> 2563e22517SMarek Vasut #include <mmc.h> 2663e22517SMarek Vasut 2763e22517SMarek Vasut DECLARE_GLOBAL_DATA_PTR; 2863e22517SMarek Vasut 2963e22517SMarek Vasut void s_init(void) 3063e22517SMarek Vasut { 3163e22517SMarek Vasut } 3263e22517SMarek Vasut 3363e22517SMarek Vasut #define TMU0_MSTP125 BIT(25) /* secure */ 3463e22517SMarek Vasut 3563e22517SMarek Vasut int board_early_init_f(void) 3663e22517SMarek Vasut { 3763e22517SMarek Vasut /* TMU0 */ 3863e22517SMarek Vasut mstp_clrbits_le32(MSTPSR1, SMSTPCR1, TMU0_MSTP125); 3963e22517SMarek Vasut 4063e22517SMarek Vasut return 0; 4163e22517SMarek Vasut } 4263e22517SMarek Vasut 4363e22517SMarek Vasut int board_init(void) 4463e22517SMarek Vasut { 4563e22517SMarek Vasut /* adress of boot parameters */ 4663e22517SMarek Vasut gd->bd->bi_boot_params = CONFIG_SYS_TEXT_BASE + 0x50000; 4763e22517SMarek Vasut 4863e22517SMarek Vasut return 0; 4963e22517SMarek Vasut } 5063e22517SMarek Vasut 5163e22517SMarek Vasut int dram_init(void) 5263e22517SMarek Vasut { 5363e22517SMarek Vasut if (fdtdec_setup_memory_size() != 0) 5463e22517SMarek Vasut return -EINVAL; 5563e22517SMarek Vasut 5663e22517SMarek Vasut return 0; 5763e22517SMarek Vasut } 5863e22517SMarek Vasut 5963e22517SMarek Vasut int dram_init_banksize(void) 6063e22517SMarek Vasut { 6163e22517SMarek Vasut fdtdec_setup_memory_banksize(); 6263e22517SMarek Vasut 6363e22517SMarek Vasut return 0; 6463e22517SMarek Vasut } 6563e22517SMarek Vasut 6663e22517SMarek Vasut #define RST_BASE 0xE6160000 6763e22517SMarek Vasut #define RST_CA57RESCNT (RST_BASE + 0x40) 6863e22517SMarek Vasut #define RST_CA53RESCNT (RST_BASE + 0x44) 6963e22517SMarek Vasut #define RST_RSTOUTCR (RST_BASE + 0x58) 7063e22517SMarek Vasut #define RST_CA57_CODE 0xA5A5000F 7163e22517SMarek Vasut #define RST_CA53_CODE 0x5A5A000F 7263e22517SMarek Vasut 7363e22517SMarek Vasut void reset_cpu(ulong addr) 7463e22517SMarek Vasut { 7563e22517SMarek Vasut unsigned long midr, cputype; 7663e22517SMarek Vasut 7763e22517SMarek Vasut asm volatile("mrs %0, midr_el1" : "=r" (midr)); 7863e22517SMarek Vasut cputype = (midr >> 4) & 0xfff; 7963e22517SMarek Vasut 8063e22517SMarek Vasut if (cputype == 0xd03) 8163e22517SMarek Vasut writel(RST_CA53_CODE, RST_CA53RESCNT); 8263e22517SMarek Vasut else if (cputype == 0xd07) 8363e22517SMarek Vasut writel(RST_CA57_CODE, RST_CA57RESCNT); 8463e22517SMarek Vasut else 8563e22517SMarek Vasut hang(); 8663e22517SMarek Vasut } 87