1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * Copyright (C) 2010 Samsung Electronics
4  * Naveen Krishna Ch <ch.naveen@samsung.com>
5  */
6 
7 #include <common.h>
8 #include <asm/io.h>
9 #include <asm/arch/sromc.h>
10 
11 /*
12  * 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
17  */
s5p_config_sromc(u32 srom_bank,u32 srom_bw_conf,u32 srom_bc_conf)18 void s5p_config_sromc(u32 srom_bank, u32 srom_bw_conf, u32 srom_bc_conf)
19 {
20 	u32 tmp;
21 	struct s5p_sromc *srom =
22 		(struct s5p_sromc *)samsung_get_base_sromc();
23 
24 	/* Configure SMC_BW register to handle proper SROMC bank */
25 	tmp = srom->bw;
26 	tmp &= ~(0xF << (srom_bank * 4));
27 	tmp |= srom_bw_conf;
28 	srom->bw = tmp;
29 
30 	/* Configure SMC_BC register */
31 	srom->bc[srom_bank] = srom_bc_conf;
32 }
33