mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-04-01 12:01:31 +00:00
ARM: uniphier: optimize ProXstream2 UMC init code with "for" loop
Now this code can be re-written with a "for" statement instead of calling the same function multiple times. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
This commit is contained in:
parent
46abfcc99e
commit
59fe23c2e0
1 changed files with 11 additions and 22 deletions
|
@ -585,11 +585,9 @@ static void um_init(void __iomem *um_base)
|
||||||
int proxstream2_umc_init(const struct uniphier_board_data *bd)
|
int proxstream2_umc_init(const struct uniphier_board_data *bd)
|
||||||
{
|
{
|
||||||
void __iomem *um_base = (void __iomem *)0x5b600000;
|
void __iomem *um_base = (void __iomem *)0x5b600000;
|
||||||
void __iomem *umc_ch0_base = (void __iomem *)0x5b800000;
|
void __iomem *umc_ch_base = (void __iomem *)0x5b800000;
|
||||||
void __iomem *umc_ch1_base = (void __iomem *)0x5ba00000;
|
|
||||||
void __iomem *umc_ch2_base = (void __iomem *)0x5bc00000;
|
|
||||||
enum dram_freq freq;
|
enum dram_freq freq;
|
||||||
int ret;
|
int ch, ret;
|
||||||
|
|
||||||
switch (bd->dram_freq) {
|
switch (bd->dram_freq) {
|
||||||
case 1866:
|
case 1866:
|
||||||
|
@ -603,25 +601,16 @@ int proxstream2_umc_init(const struct uniphier_board_data *bd)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = umc_init(umc_ch0_base, freq, 0, bd->dram_ch[0].size / SZ_256M,
|
for (ch = 0; ch < bd->dram_nr_ch; ch++) {
|
||||||
bd->dram_ch[0].width);
|
ret = umc_init(umc_ch_base, freq, ch,
|
||||||
if (ret) {
|
bd->dram_ch[ch].size / SZ_256M,
|
||||||
printf("failed to initialize UMC ch0\n");
|
bd->dram_ch[ch].width);
|
||||||
return ret;
|
if (ret) {
|
||||||
}
|
printf("failed to initialize UMC ch%d\n", ch);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
ret = umc_init(umc_ch1_base, freq, 1, bd->dram_ch[1].size / SZ_256M,
|
umc_ch_base += 0x00200000;
|
||||||
bd->dram_ch[1].width);
|
|
||||||
if (ret) {
|
|
||||||
printf("failed to initialize UMC ch1\n");
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = umc_init(umc_ch2_base, freq, 2, bd->dram_ch[2].size / SZ_256M,
|
|
||||||
bd->dram_ch[2].width);
|
|
||||||
if (ret) {
|
|
||||||
printf("failed to initialize UMC ch2\n");
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
um_init(um_base);
|
um_init(um_base);
|
||||||
|
|
Loading…
Add table
Reference in a new issue