|
@@ -5,7 +5,10 @@
|
|
*/
|
|
*/
|
|
|
|
|
|
#include <common.h>
|
|
#include <common.h>
|
|
|
|
+#include <linux/err.h>
|
|
#include <linux/io.h>
|
|
#include <linux/io.h>
|
|
|
|
+#include <linux/sizes.h>
|
|
|
|
+#include <mach/init.h>
|
|
#include <mach/umc-regs.h>
|
|
#include <mach/umc-regs.h>
|
|
#include <mach/ddrphy-regs.h>
|
|
#include <mach/ddrphy-regs.h>
|
|
|
|
|
|
@@ -107,28 +110,28 @@ static int umc_init_sub(int freq, int size_ch0, int size_ch1)
|
|
|
|
|
|
writel(0x00000101, dramcont0 + UMC_DIOCTLA);
|
|
writel(0x00000101, dramcont0 + UMC_DIOCTLA);
|
|
|
|
|
|
- ddrphy_init(phy0_0, freq, size_ch0);
|
|
|
|
|
|
+ ph1_pro4_ddrphy_init(phy0_0, freq, size_ch0);
|
|
|
|
|
|
ddrphy_prepare_training(phy0_0, 0);
|
|
ddrphy_prepare_training(phy0_0, 0);
|
|
ddrphy_training(phy0_0);
|
|
ddrphy_training(phy0_0);
|
|
|
|
|
|
writel(0x00000103, dramcont0 + UMC_DIOCTLA);
|
|
writel(0x00000103, dramcont0 + UMC_DIOCTLA);
|
|
|
|
|
|
- ddrphy_init(phy0_1, freq, size_ch0);
|
|
|
|
|
|
+ ph1_pro4_ddrphy_init(phy0_1, freq, size_ch0);
|
|
|
|
|
|
ddrphy_prepare_training(phy0_1, 1);
|
|
ddrphy_prepare_training(phy0_1, 1);
|
|
ddrphy_training(phy0_1);
|
|
ddrphy_training(phy0_1);
|
|
|
|
|
|
writel(0x00000101, dramcont1 + UMC_DIOCTLA);
|
|
writel(0x00000101, dramcont1 + UMC_DIOCTLA);
|
|
|
|
|
|
- ddrphy_init(phy1_0, freq, size_ch1);
|
|
|
|
|
|
+ ph1_pro4_ddrphy_init(phy1_0, freq, size_ch1);
|
|
|
|
|
|
ddrphy_prepare_training(phy1_0, 0);
|
|
ddrphy_prepare_training(phy1_0, 0);
|
|
ddrphy_training(phy1_0);
|
|
ddrphy_training(phy1_0);
|
|
|
|
|
|
writel(0x00000103, dramcont1 + UMC_DIOCTLA);
|
|
writel(0x00000103, dramcont1 + UMC_DIOCTLA);
|
|
|
|
|
|
- ddrphy_init(phy1_1, freq, size_ch1);
|
|
|
|
|
|
+ ph1_pro4_ddrphy_init(phy1_1, freq, size_ch1);
|
|
|
|
|
|
ddrphy_prepare_training(phy1_1, 1);
|
|
ddrphy_prepare_training(phy1_1, 1);
|
|
ddrphy_training(phy1_1);
|
|
ddrphy_training(phy1_1);
|
|
@@ -141,17 +144,18 @@ static int umc_init_sub(int freq, int size_ch0, int size_ch1)
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
-int umc_init(void)
|
|
|
|
|
|
+int ph1_pro4_umc_init(const struct uniphier_board_data *bd)
|
|
{
|
|
{
|
|
- return umc_init_sub(CONFIG_DDR_FREQ, CONFIG_SDRAM0_SIZE / 0x08000000,
|
|
|
|
- CONFIG_SDRAM1_SIZE / 0x08000000);
|
|
|
|
|
|
+ if (((bd->dram_ch0_size == SZ_512M && bd->dram_ch0_width == 32) ||
|
|
|
|
+ (bd->dram_ch0_size == SZ_256M && bd->dram_ch0_width == 16)) &&
|
|
|
|
+ ((bd->dram_ch1_size == SZ_512M && bd->dram_ch1_width == 32) ||
|
|
|
|
+ (bd->dram_ch1_size == SZ_256M && bd->dram_ch1_width == 16)) &&
|
|
|
|
+ bd->dram_freq == 1600) {
|
|
|
|
+ return umc_init_sub(bd->dram_freq,
|
|
|
|
+ bd->dram_ch0_size / SZ_128M,
|
|
|
|
+ bd->dram_ch1_size / SZ_128M);
|
|
|
|
+ } else {
|
|
|
|
+ pr_err("Unsupported DDR configuration\n");
|
|
|
|
+ return -EINVAL;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
-
|
|
|
|
-#if ((CONFIG_SDRAM0_SIZE == 0x20000000 && CONFIG_DDR_NUM_CH0 == 2) || \
|
|
|
|
- (CONFIG_SDRAM0_SIZE == 0x10000000 && CONFIG_DDR_NUM_CH0 == 1)) && \
|
|
|
|
- ((CONFIG_SDRAM1_SIZE == 0x20000000 && CONFIG_DDR_NUM_CH1 == 2) || \
|
|
|
|
- (CONFIG_SDRAM1_SIZE == 0x10000000 && CONFIG_DDR_NUM_CH1 == 1))
|
|
|
|
-/* OK */
|
|
|
|
-#else
|
|
|
|
- #error Unsupported DDR configuration.
|
|
|
|
-#endif
|
|
|