blob: 0fc170936ae442be71b7a7966ba4147af285e0db [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Naveen Krishna CH4b3bece2010-03-05 17:15:38 +09002/*
3 * Copyright (C) 2010 Samsung Electronics
4 * Naveen Krishna Ch <ch.naveen@samsung.com>
Naveen Krishna CH4b3bece2010-03-05 17:15:38 +09005 */
6
7#include <common.h>
8#include <asm/io.h>
Chander Kashyap9c88fb82011-04-14 19:05:18 +00009#include <asm/arch/sromc.h>
Naveen Krishna CH4b3bece2010-03-05 17:15:38 +090010
11/*
Chander Kashyap9c88fb82011-04-14 19:05:18 +000012 * s5p_config_sromc() - select the proper SROMC Bank and configure the
13 * band width control and bank control registers
14 * srom_bank - SROM
15 * srom_bw_conf - SMC Band witdh reg configuration value
16 * srom_bc_conf - SMC Bank Control reg configuration value
Naveen Krishna CH4b3bece2010-03-05 17:15:38 +090017 */
Chander Kashyap9c88fb82011-04-14 19:05:18 +000018void s5p_config_sromc(u32 srom_bank, u32 srom_bw_conf, u32 srom_bc_conf)
Naveen Krishna CH4b3bece2010-03-05 17:15:38 +090019{
20 u32 tmp;
Chander Kashyap9c88fb82011-04-14 19:05:18 +000021 struct s5p_sromc *srom =
22 (struct s5p_sromc *)samsung_get_base_sromc();
Naveen Krishna CH4b3bece2010-03-05 17:15:38 +090023
24 /* Configure SMC_BW register to handle proper SROMC bank */
25 tmp = srom->bw;
26 tmp &= ~(0xF << (srom_bank * 4));
Chander Kashyap9c88fb82011-04-14 19:05:18 +000027 tmp |= srom_bw_conf;
Naveen Krishna CH4b3bece2010-03-05 17:15:38 +090028 srom->bw = tmp;
29
30 /* Configure SMC_BC register */
Chander Kashyap9c88fb82011-04-14 19:05:18 +000031 srom->bc[srom_bank] = srom_bc_conf;
Naveen Krishna CH4b3bece2010-03-05 17:15:38 +090032}