summaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-uniphier
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2016-02-26 14:21:50 +0900
committerMasahiro Yamada <yamada.masahiro@socionext.com>2016-02-29 03:50:16 +0900
commitfd14397e93894995116583aced817f2fad9ac57b (patch)
treed6c577c517652594178eadb9ce9529dcc2ec6881 /arch/arm/mach-uniphier
parent9a71844a381b606d1c9c28c5974e389671ee1cd5 (diff)
downloadtalos-obmc-uboot-fd14397e93894995116583aced817f2fad9ac57b.tar.gz
talos-obmc-uboot-fd14397e93894995116583aced817f2fad9ac57b.zip
ARM: uniphier: rework DRAM size handling in UMC init code
Currently, DRAM size is converted twice: size in byte -> size in Gbit -> enum Optimize the code by converting the "size in byte" into enum directly. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'arch/arm/mach-uniphier')
-rw-r--r--arch/arm/mach-uniphier/dram/umc-ph1-ld4.c14
-rw-r--r--arch/arm/mach-uniphier/dram/umc-ph1-sld8.c16
2 files changed, 15 insertions, 15 deletions
diff --git a/arch/arm/mach-uniphier/dram/umc-ph1-ld4.c b/arch/arm/mach-uniphier/dram/umc-ph1-ld4.c
index 92b0f1832f..0eb47d73d7 100644
--- a/arch/arm/mach-uniphier/dram/umc-ph1-ld4.c
+++ b/arch/arm/mach-uniphier/dram/umc-ph1-ld4.c
@@ -76,7 +76,7 @@ static void umc_start_ssif(void __iomem *ssif_base)
}
static int umc_dramcont_init(void __iomem *dramcont, void __iomem *ca_base,
- int size, int freq, bool ddr3plus)
+ int freq, unsigned long size, bool ddr3plus)
{
enum dram_freq freq_e;
enum dram_size size_e;
@@ -101,14 +101,14 @@ static int umc_dramcont_init(void __iomem *dramcont, void __iomem *ca_base,
switch (size) {
case 0:
return 0;
- case 1:
+ case SZ_128M:
size_e = DRAM_SZ_128M;
break;
- case 2:
+ case SZ_256M:
size_e = DRAM_SZ_256M;
break;
default:
- pr_err("unsupported DRAM size\n");
+ pr_err("unsupported DRAM size 0x%08lx\n", size);
return -EINVAL;
}
@@ -140,7 +140,7 @@ static int umc_dramcont_init(void __iomem *dramcont, void __iomem *ca_base,
}
static int umc_ch_init(void __iomem *dc_base, void __iomem *ca_base,
- int freq, int size, bool ddr3plus, int ch)
+ int freq, unsigned long size, bool ddr3plus, int ch)
{
void __iomem *phy_base = dc_base + 0x00001000;
int ret;
@@ -159,7 +159,7 @@ static int umc_ch_init(void __iomem *dc_base, void __iomem *ca_base,
if (ret)
return ret;
- return umc_dramcont_init(dc_base, ca_base, size, freq, ddr3plus);
+ return umc_dramcont_init(dc_base, ca_base, freq, size, ddr3plus);
}
int ph1_ld4_umc_init(const struct uniphier_board_data *bd)
@@ -172,7 +172,7 @@ int ph1_ld4_umc_init(const struct uniphier_board_data *bd)
for (ch = 0; ch < DRAM_CH_NR; ch++) {
ret = umc_ch_init(dc_base, ca_base, bd->dram_freq,
- bd->dram_ch[ch].size / SZ_128M,
+ bd->dram_ch[ch].size,
bd->dram_ddr3plus, ch);
if (ret) {
pr_err("failed to initialize UMC ch%d\n", ch);
diff --git a/arch/arm/mach-uniphier/dram/umc-ph1-sld8.c b/arch/arm/mach-uniphier/dram/umc-ph1-sld8.c
index a2ed9ba832..43e53fd562 100644
--- a/arch/arm/mach-uniphier/dram/umc-ph1-sld8.c
+++ b/arch/arm/mach-uniphier/dram/umc-ph1-sld8.c
@@ -79,7 +79,7 @@ static void umc_start_ssif(void __iomem *ssif_base)
}
static int umc_dramcont_init(void __iomem *dramcont, void __iomem *ca_base,
- int size, int freq, bool ddr3plus)
+ int freq, unsigned long size, bool ddr3plus)
{
enum dram_freq freq_e;
enum dram_size size_e;
@@ -99,17 +99,17 @@ static int umc_dramcont_init(void __iomem *dramcont, void __iomem *ca_base,
switch (size) {
case 0:
return 0;
- case 1:
+ case SZ_128M:
size_e = DRAM_SZ_128M;
break;
- case 2:
+ case SZ_256M:
size_e = DRAM_SZ_256M;
break;
- case 4:
+ case SZ_512M:
size_e = DRAM_SZ_512M;
break;
default:
- pr_err("unsupported DRAM size\n");
+ pr_err("unsupported DRAM size 0x%08lx\n", size);
return -EINVAL;
}
@@ -143,7 +143,7 @@ static int umc_dramcont_init(void __iomem *dramcont, void __iomem *ca_base,
}
static int umc_ch_init(void __iomem *dc_base, void __iomem *ca_base,
- int freq, int size, bool ddr3plus, int ch)
+ int freq, unsigned long size, bool ddr3plus, int ch)
{
void __iomem *phy_base = dc_base + 0x00001000;
int ret;
@@ -162,7 +162,7 @@ static int umc_ch_init(void __iomem *dc_base, void __iomem *ca_base,
if (ret)
return ret;
- return umc_dramcont_init(dc_base, ca_base, size, freq, ddr3plus);
+ return umc_dramcont_init(dc_base, ca_base, freq, size, ddr3plus);
}
int ph1_sld8_umc_init(const struct uniphier_board_data *bd)
@@ -175,7 +175,7 @@ int ph1_sld8_umc_init(const struct uniphier_board_data *bd)
for (ch = 0; ch < DRAM_CH_NR; ch++) {
ret = umc_ch_init(dc_base, ca_base, bd->dram_freq,
- bd->dram_ch[ch].size / SZ_128M,
+ bd->dram_ch[ch].size,
bd->dram_ddr3plus, ch);
if (ret) {
pr_err("failed to initialize UMC ch%d\n", ch);
OpenPOWER on IntegriCloud