/* sys_ccu_dram - Set the freq of the dram @freq: freq want to set  */
void __startup sys_ccu_dram(uint32_t freq)
/* sys_ccu_dram - Set the freq of the dram @freq: freq want to set  */
void __startup sys_ccu_dram(uint32_t freq)
{
    uint32_t val, n, m;
    pll_get_factors(freq, &n, &m);
    write32(GCTL_BASE + GX6605S_PLL_DDR_BASE, (1 << 14)|(n << 8)| m);
    val = read32(GCTL_BASE + GX6605S_PLL_DDR_BASE);
    val &= ~BIT(14);
    write32(GCTL_BASE + GX6605S_PLL_DDR_BASE, val);
    val = read32(GCTL_BASE + GX6605S_SOURCE_SEL0);
    val |= GX6605S_SOURCE_SEL0_DRAMC;
    write32(GCTL_BASE + GX6605S_SOURCE_SEL0, val);
}