/** * omap2_sdrc_init - initialize SMS, SDRC devices on boot * @sdrc_cs[01]: pointers to a null-terminated list of struct omap_sdrc_params * Support for 2 chip selects timings * * Turn on smart idle modes for SDRAM scheduler and controller. * Program a known-good configuration for the SDRC to deal with buggy * bootloaders. */ void __init omap2_sdrc_init(struct omap_sdrc_params *sdrc_cs0, struct omap_sdrc_params *sdrc_cs1) { u32 l; l = sms_read_reg(SMS_SYSCONFIG); l &= ~(0x3 << 3); l |= (0x2 << 3); sms_write_reg(l, SMS_SYSCONFIG); l = sdrc_read_reg(SDRC_SYSCONFIG); l &= ~(0x3 << 3); l |= (0x2 << 3); sdrc_write_reg(l, SDRC_SYSCONFIG); sdrc_init_params_cs0 = sdrc_cs0; sdrc_init_params_cs1 = sdrc_cs1; /* XXX Enable SRFRONIDLEREQ here also? */ /* * PWDENA should not be set due to 34xx erratum 1.150 - PWDENA * can cause random memory corruption */ l = (1 << SDRC_POWER_PAGEPOLICY_SHIFT); sdrc_write_reg(l, SDRC_POWER); omap2_sms_save_context(); }
int __init omap3_sdrc_init(struct omap3_sdrc_params *sdrc_cs0, struct omap3_sdrc_params *sdrc_cs1) { u32 l; /* This function does the task same as omap2_init_common_devices() of * <linux>/arch/arm/mach-omap2/io.c */ if(!omap3_sdrc_base) { omap3_sdrc_base = vmm_host_iomap(OMAP3_SDRC_BASE, OMAP3_SDRC_SIZE); if(!omap3_sdrc_base) { return VMM_EFAIL; } } if(!omap3_sms_base) { omap3_sms_base = vmm_host_iomap(OMAP3_SMS_BASE, OMAP3_SMS_SIZE); if(!omap3_sms_base) { return VMM_EFAIL; } } /* Initiaize SDRC as per omap2_sdrc_init() of * <linux>/arch/arm/mach-omap2/sdrc.c */ l = sms_read_reg(SMS_SYSCONFIG); l &= ~(0x3 << 3); l |= (0x2 << 3); sms_write_reg(l, SMS_SYSCONFIG); l = sdrc_read_reg(SDRC_SYSCONFIG); l &= ~(0x3 << 3); l |= (0x2 << 3); sdrc_write_reg(l, SDRC_SYSCONFIG); sdrc_init_params_cs0 = sdrc_cs0; sdrc_init_params_cs1 = sdrc_cs1; /* XXX Enable SRFRONIDLEREQ here also? */ /* * PWDENA should not be set due to 34xx erratum 1.150 - PWDENA * can cause random memory corruption */ l = (1 << SDRC_POWER_EXTCLKDIS_SHIFT) | (1 << SDRC_POWER_PAGEPOLICY_SHIFT); sdrc_write_reg(l, SDRC_POWER); /* FIXME: Reprogram SDRC timing parameters as per * _omap2_init_reprogram_sdrc() function of * <linux>/arch/arm/mach-omap2/io.c */ return VMM_OK; }
/* turn on smart idle modes for SDRAM scheduler and controller */ void __init omap2_init_memory(void) { u32 l; l = sms_read_reg(SMS_SYSCONFIG); l &= ~(0x3 << 3); l |= (0x2 << 3); sms_write_reg(l, SMS_SYSCONFIG); l = sdrc_read_reg(SDRC_SYSCONFIG); l &= ~(0x3 << 3); l |= (0x2 << 3); sdrc_write_reg(l, SDRC_SYSCONFIG); }
/** * omap2_sdrc_init - initialize SMS, SDRC devices on boot * @sp: pointer to a null-terminated list of struct omap_sdrc_params * * Turn on smart idle modes for SDRAM scheduler and controller. * Program a known-good configuration for the SDRC to deal with buggy * bootloaders. */ void __init omap2_sdrc_init(struct omap_sdrc_params *sp) { u32 l; l = sms_read_reg(SMS_SYSCONFIG); l &= ~(0x3 << 3); l |= (0x2 << 3); sms_write_reg(l, SMS_SYSCONFIG); l = sdrc_read_reg(SDRC_SYSCONFIG); l &= ~(0x3 << 3); l |= (0x2 << 3); sdrc_write_reg(l, SDRC_SYSCONFIG); sdrc_init_params = sp; /* XXX Enable SRFRONIDLEREQ here also? */ l = (1 << SDRC_POWER_EXTCLKDIS_SHIFT) | (1 << SDRC_POWER_PWDENA_SHIFT) | (1 << SDRC_POWER_PAGEPOLICY_SHIFT); sdrc_write_reg(l, SDRC_POWER); omap2_sms_save_context(); }
/** * omap2_sms_restore_context - Restore SMS registers * * Restore SMS registers that need to be Restored after off mode. */ void omap2_sms_restore_context(void) { sms_write_reg(sms_context.sms_sysconfig, SMS_SYSCONFIG); }
void omap2_sms_write_rot_physical_ba(u32 val, unsigned ctx) { sms_write_reg(val, SMS_ROT_PHYSICAL_BA(ctx)); }
void omap2_sms_write_rot_size(u32 val, unsigned ctx) { sms_write_reg(val, SMS_ROT_SIZE(ctx)); }
void omap2_sms_write_rot_control(u32 val, unsigned ctx) { sms_write_reg(val, SMS_ROT_CONTROL(ctx)); }