static void emif_update_timings(u32 base, const struct emif_regs *regs) { struct emif_reg_struct *emif = (struct emif_reg_struct *)base; writel(regs->ref_ctrl, &emif->emif_sdram_ref_ctrl_shdw); writel(regs->sdram_tim1, &emif->emif_sdram_tim_1_shdw); writel(regs->sdram_tim2, &emif->emif_sdram_tim_2_shdw); writel(regs->sdram_tim3, &emif->emif_sdram_tim_3_shdw); if (omap_revision() == OMAP4430_ES1_0) { /* ES1 bug EMIF should be in force idle during freq_update */ writel(0, &emif->emif_pwr_mgmt_ctrl); } else { writel(EMIF_PWR_MGMT_CTRL, &emif->emif_pwr_mgmt_ctrl); writel(EMIF_PWR_MGMT_CTRL_SHDW, &emif->emif_pwr_mgmt_ctrl_shdw); } writel(regs->read_idle_ctrl, &emif->emif_read_idlectrl_shdw); writel(regs->zq_config, &emif->emif_zq_config); writel(regs->temp_alert_config, &emif->emif_temp_alert_config); writel(regs->emif_ddr_phy_ctlr_1, &emif->emif_ddr_phy_ctrl_1_shdw); if (omap_revision() >= OMAP4460_ES1_0) { writel(EMIF_L3_CONFIG_VAL_SYS_10_MPU_3_LL_0, &emif->emif_l3_config); } else { writel(EMIF_L3_CONFIG_VAL_SYS_10_LL_0, &emif->emif_l3_config); } }
void set_muxconf_regs_non_essential(void) { do_set_mux(CONTROL_PADCONF_CORE, core_padconf_array_non_essential, sizeof(core_padconf_array_non_essential) / sizeof(struct pad_conf_entry)); if (omap_revision() < OMAP4460_ES1_0) do_set_mux(CONTROL_PADCONF_CORE, core_padconf_array_non_essential_4430, sizeof(core_padconf_array_non_essential_4430) / sizeof(struct pad_conf_entry)); else do_set_mux(CONTROL_PADCONF_CORE, core_padconf_array_non_essential_4460, sizeof(core_padconf_array_non_essential_4460) / sizeof(struct pad_conf_entry)); do_set_mux(CONTROL_PADCONF_WKUP, wkup_padconf_array_non_essential, sizeof(wkup_padconf_array_non_essential) / sizeof(struct pad_conf_entry)); if (omap_revision() < OMAP4460_ES1_0) do_set_mux(CONTROL_PADCONF_WKUP, wkup_padconf_array_non_essential_4430, sizeof(wkup_padconf_array_non_essential_4430) / sizeof(struct pad_conf_entry)); }
void set_muxconf_regs_non_essential(void) { do_set_mux((*ctrl)->control_padconf_core_base, core_padconf_array_non_essential, sizeof(core_padconf_array_non_essential) / sizeof(struct pad_conf_entry)); if (omap_revision() < OMAP4460_ES1_0) do_set_mux((*ctrl)->control_padconf_core_base, core_padconf_array_non_essential_4430, sizeof(core_padconf_array_non_essential_4430) / sizeof(struct pad_conf_entry)); else do_set_mux((*ctrl)->control_padconf_core_base, core_padconf_array_non_essential_4460, sizeof(core_padconf_array_non_essential_4460) / sizeof(struct pad_conf_entry)); do_set_mux((*ctrl)->control_padconf_wkup_base, wkup_padconf_array_non_essential, sizeof(wkup_padconf_array_non_essential) / sizeof(struct pad_conf_entry)); if (omap_revision() < OMAP4460_ES1_0) do_set_mux((*ctrl)->control_padconf_wkup_base, wkup_padconf_array_non_essential_4430, sizeof(wkup_padconf_array_non_essential_4430) / sizeof(struct pad_conf_entry)); }
/* to remove warning about unused function; will be deleted in decruft patch */ static void configure_core_dpll(int clk_index) { struct dpll_param *dpll_param_p; /* Get the sysclk speed from cm_sys_clksel * Set it to 38.4 MHz, in case ROM code is bypassed */ if (!clk_index) return; /* CORE_CLK=CORE_X2_CLK/2, L3_CLK=CORE_CLK/2, L4_CLK=L3_CLK/2 */ sr32(CM_CLKSEL_CORE, 0, 32, 0x110); /* Unlock the CORE dpll */ sr32(CM_CLKMODE_DPLL_CORE, 0, 3, PLL_MN_POWER_BYPASS); wait_on_value(BIT0, 0, CM_IDLEST_DPLL_CORE, LDELAY); /* Program Core DPLL */ switch (omap_revision()) { case OMAP4430_ES1_0: dpll_param_p = &core_dpll_param_l3_190[clk_index]; break; case OMAP4430_ES2_0: dpll_param_p = &core_dpll_param[clk_index]; break; case OMAP4430_ES2_1: default: dpll_param_p = &core_dpll_param_ddr400[clk_index]; break; } /* Disable autoidle */ sr32(CM_AUTOIDLE_DPLL_CORE, 0, 3, 0x0); sr32(CM_CLKSEL_DPLL_CORE, 8, 11, dpll_param_p->m); sr32(CM_CLKSEL_DPLL_CORE, 0, 6, dpll_param_p->n); sr32(CM_DIV_M2_DPLL_CORE, 0, 5, dpll_param_p->m2); sr32(CM_DIV_M3_DPLL_CORE, 0, 5, dpll_param_p->m3); sr32(CM_DIV_M4_DPLL_CORE, 0, 5, dpll_param_p->m4); sr32(CM_DIV_M5_DPLL_CORE, 0, 5, dpll_param_p->m5); sr32(CM_DIV_M6_DPLL_CORE, 0, 5, dpll_param_p->m6); sr32(CM_DIV_M7_DPLL_CORE, 0, 5, dpll_param_p->m7); if (omap_revision() == OMAP4430_ES1_0) { /* Do this only on ES1.0 */ sr32(CM_DIV_M2_DPLL_CORE, 8, 1, 0x1); sr32(CM_DIV_M3_DPLL_CORE, 8, 1, 0x1); sr32(CM_DIV_M4_DPLL_CORE, 8, 1, 0x1); sr32(CM_DIV_M5_DPLL_CORE, 8, 1, 0x1); sr32(CM_DIV_M6_DPLL_CORE, 8, 1, 0x0); sr32(CM_DIV_M7_DPLL_CORE, 8, 1, 0x1); } /* Lock the core dpll */ sr32(CM_CLKMODE_DPLL_CORE, 0, 3, PLL_LOCK); wait_on_value(BIT0, 1, CM_IDLEST_DPLL_CORE, LDELAY); }
void configure_core_dpll_no_lock(void) { dpll_param *dpll_param_p = 0; u32 clk_index; /* Get the sysclk speed from cm_sys_clksel * Set it to 38.4 MHz, in case ROM code is bypassed */ __raw_writel(0x7,CM_SYS_CLKSEL); clk_index = 7; clk_index = clk_index - 1; /* CORE_CLK=CORE_X2_CLK/2, L3_CLK=CORE_CLK/2, L4_CLK=L3_CLK/2 */ sr32(CM_CLKSEL_CORE, 0, 32, 0x110); /* Unlock the CORE dpll */ sr32(CM_CLKMODE_DPLL_CORE, 0, 3, PLL_MN_POWER_BYPASS); wait_on_value(BIT0, 0, CM_IDLEST_DPLL_CORE, LDELAY); /* Program Core DPLL */ if(omap_revision() == OMAP4430_ES1_0) dpll_param_p = &core_dpll_param_l3_190[clk_index]; else if (omap_revision() == OMAP4430_ES2_0) dpll_param_p = &core_dpll_param[clk_index]; else if (omap_revision() >= OMAP4430_ES2_1) dpll_param_p = &core_dpll_param_ddr400[clk_index]; /* Disable autoidle */ sr32(CM_AUTOIDLE_DPLL_CORE, 0, 3, 0x0); sr32(CM_CLKSEL_DPLL_CORE, 8, 11, dpll_param_p->m); sr32(CM_CLKSEL_DPLL_CORE, 0, 6, dpll_param_p->n); sr32(CM_DIV_M2_DPLL_CORE, 0, 5, dpll_param_p->m2); sr32(CM_DIV_M3_DPLL_CORE, 0, 5, dpll_param_p->m3); sr32(CM_DIV_M4_DPLL_CORE, 0, 5, dpll_param_p->m4); sr32(CM_DIV_M5_DPLL_CORE, 0, 5, dpll_param_p->m5); sr32(CM_DIV_M6_DPLL_CORE, 0, 5, dpll_param_p->m6); sr32(CM_DIV_M7_DPLL_CORE, 0, 5, dpll_param_p->m7); if(omap_revision() == OMAP4430_ES1_0) { /* Do this only on ES1.0 */ sr32(CM_DIV_M2_DPLL_CORE, 8, 1, 0x1); sr32(CM_DIV_M3_DPLL_CORE, 8, 1, 0x1); sr32(CM_DIV_M4_DPLL_CORE, 8, 1, 0x1); sr32(CM_DIV_M5_DPLL_CORE, 8, 1, 0x1); sr32(CM_DIV_M6_DPLL_CORE, 8, 1, 0x1); sr32(CM_DIV_M7_DPLL_CORE, 8, 1, 0x1); } return; }
void lock_core_dpll_shadow(void) { dpll_param *dpll_param_p = 0; u32 clk_index; u32 temp; temp = __raw_readl(CM_MEMIF_CLKSTCTRL); temp &= (~3); temp |= 2; __raw_writel(temp, CM_MEMIF_CLKSTCTRL); while(__raw_readl(CM_MEMIF_EMIF_1_CLKCTRL) & 0x30000) ; while(__raw_readl(CM_MEMIF_EMIF_2_CLKCTRL) & 0x30000) ; /* Lock the core dpll using freq update method */ /*(CM_CLKMODE_DPLL_CORE) */ __raw_writel(0x0A, 0x4A004120); clk_index = 6; if(omap_revision() == OMAP4430_ES1_0) dpll_param_p = &core_dpll_param_l3_190[clk_index]; else if (omap_revision() == OMAP4430_ES2_0) dpll_param_p = &core_dpll_param[clk_index]; else if (omap_revision() >= OMAP4430_ES2_1) dpll_param_p = &core_dpll_param_ddr400[clk_index]; /* CM_SHADOW_FREQ_CONFIG1: DLL_OVERRIDE = 1(hack), DLL_RESET = 1, * DPLL_CORE_M2_DIV =1, DPLL_CORE_DPLL_EN = 0x7, FREQ_UPDATE = 1 */ __raw_writel(0x70D | (dpll_param_p->m2 << 11), 0x4A004260); /* Wait for Freq_Update to get cleared: CM_SHADOW_FREQ_CONFIG1 */ while((__raw_readl(0x4A004260) & 0x1) == 0x1) ; /* Wait for DPLL to Lock : CM_IDLEST_DPLL_CORE */ wait_on_value(BIT0, 1, CM_IDLEST_DPLL_CORE, LDELAY); //lock_core_dpll(); while(__raw_readl(CM_MEMIF_EMIF_1_CLKCTRL) & 0x30000) ; while(__raw_readl(CM_MEMIF_EMIF_2_CLKCTRL) & 0x30000) ; __raw_writel(temp|3, CM_MEMIF_CLKSTCTRL); return; }
static inline u32 __get_sys_clk_index(void) { s8 ind; /* * For ES1 the ROM code calibration of sys clock is not reliable * due to hw issue. So, use hard-coded value. If this value is not * correct for any board over-ride this function in board file * From ES2.0 onwards you will get this information from * CM_SYS_CLKSEL */ if (omap_revision() == OMAP4430_ES1_0) ind = OMAP_SYS_CLK_IND_38_4_MHZ; else { /* SYS_CLKSEL - 1 to match the dpll param array indices */ ind = (readl((*prcm)->cm_sys_clksel) & CM_SYS_CLKSEL_SYS_CLKSEL_MASK) - 1; /* * SYS_CLKSEL value for 20MHz is 0. This is introduced newly * in DRA7XX socs. SYS_CLKSEL -1 will be greater than * NUM_SYS_CLK. So considering the last 3 bits as the index * for the dpll param array. */ ind &= CM_SYS_CLKSEL_SYS_CLKSEL_MASK; } return ind; }
static void emif_get_reg_dump_sdp(u32 emif_nr, const struct emif_regs **regs) { switch (omap_revision()) { case OMAP5430_ES1_0: *regs = &emif_regs_532_mhz_2cs; break; case OMAP5432_ES1_0: *regs = &emif_regs_ddr3_532_mhz_1cs; break; case OMAP5430_ES2_0: *regs = &emif_regs_532_mhz_2cs_es2; break; case OMAP5432_ES2_0: *regs = &emif_regs_ddr3_532_mhz_1cs_es2; break; case DRA752_ES1_0: case DRA752_ES1_1: switch (emif_nr) { case 1: *regs = &emif_1_regs_ddr3_532_mhz_1cs_dra_es1; break; case 2: *regs = &emif_2_regs_ddr3_532_mhz_1cs_dra_es1; break; } break; case DRA722_ES1_0: *regs = &emif_1_regs_ddr3_666_mhz_1cs_dra_es1; break; default: *regs = &emif_1_regs_ddr3_532_mhz_1cs_dra_es1; } }
void hw_data_init(void) { u32 omap_rev = omap_revision(); switch (omap_rev) { case OMAP5430_ES1_0: case OMAP5432_ES1_0: *prcm = &omap5_es1_prcm; *dplls_data = &omap5_dplls_es1; *omap_vcores = &omap5430_volts; *ctrl = &omap5_ctrl; break; case OMAP5430_ES2_0: case OMAP5432_ES2_0: *prcm = &omap5_es2_prcm; *dplls_data = &omap5_dplls_es2; *omap_vcores = &omap5430_volts_es2; *ctrl = &omap5_ctrl; break; case DRA752_ES1_0: case DRA752_ES1_1: *prcm = &dra7xx_prcm; *dplls_data = &dra7xx_dplls; *omap_vcores = &dra752_volts; *ctrl = &dra7xx_ctrl; break; default: printf("\n INVALID OMAP REVISION "); } }
static void do_scale_vcore(u32 vcore_reg, u32 volt_mv) { u32 temp, offset_code; u32 step = 12660; /* 12.66 mV represented in uV */ u32 offset = volt_mv; /* convert to uV for better accuracy in the calculations */ offset *= 1000; if (omap_revision() == OMAP4430_ES1_0) offset -= PHOENIX_SMPS_BASE_VOLT_STD_MODE_UV; else offset -= PHOENIX_SMPS_BASE_VOLT_STD_MODE_WITH_OFFSET_UV; offset_code = (offset + step - 1) / step; /* The code starts at 1 not 0 */ offset_code++; debug("do_scale_vcore: volt - %d offset_code - 0x%x\n", volt_mv, offset_code); temp = SMPS_I2C_SLAVE_ADDR | (vcore_reg << PRM_VC_VAL_BYPASS_REGADDR_SHIFT) | (offset_code << PRM_VC_VAL_BYPASS_DATA_SHIFT) | PRM_VC_VAL_BYPASS_VALID_BIT; writel(temp, &prcm->prm_vc_val_bypass); if (!wait_on_value(PRM_VC_VAL_BYPASS_VALID_BIT, 0, &prcm->prm_vc_val_bypass, LDELAY)) { printf("Scaling voltage failed for 0x%x\n", vcore_reg); } }
/* * Lock MPU dpll * * Resulting MPU frequencies: * 4430 ES1.0 : 600 MHz * 4430 ES2.x : 792 MHz (OPP Turbo) * 4460 : 920 MHz (OPP Turbo) - DCC disabled */ void configure_mpu_dpll(void) { const struct dpll_params *params; struct dpll_regs *mpu_dpll_regs; u32 omap4_rev, sysclk_ind; omap4_rev = omap_revision(); sysclk_ind = get_sys_clk_index(); if (omap4_rev == OMAP4430_ES1_0) params = &mpu_dpll_params_1200mhz[sysclk_ind]; else if (omap4_rev < OMAP4460_ES1_0) params = &mpu_dpll_params_1584mhz[sysclk_ind]; else params = &mpu_dpll_params_1840mhz[sysclk_ind]; /* DCC and clock divider settings for 4460 */ if (omap4_rev >= OMAP4460_ES1_0) { mpu_dpll_regs = (struct dpll_regs *)&prcm->cm_clkmode_dpll_mpu; bypass_dpll(&prcm->cm_clkmode_dpll_mpu); clrbits_le32(&prcm->cm_mpu_mpu_clkctrl, MPU_CLKCTRL_CLKSEL_EMIF_DIV_MODE_MASK); setbits_le32(&prcm->cm_mpu_mpu_clkctrl, MPU_CLKCTRL_CLKSEL_ABE_DIV_MODE_MASK); clrbits_le32(&mpu_dpll_regs->cm_clksel_dpll, CM_CLKSEL_DCC_EN_MASK); } do_setup_dpll(&prcm->cm_clkmode_dpll_mpu, params, DPLL_LOCK); debug("MPU DPLL locked\n"); }
const struct read_write_regs *get_bug_regs(u32 *iterations) { const struct read_write_regs *bug_00339_regs_ptr = NULL; switch (omap_revision()) { case OMAP5430_ES1_0: case OMAP5430_ES2_0: case OMAP5432_ES1_0: case OMAP5432_ES2_0: bug_00339_regs_ptr = omap5_bug_00339_regs; *iterations = sizeof(omap5_bug_00339_regs)/ sizeof(omap5_bug_00339_regs[0]); break; case DRA752_ES1_0: case DRA752_ES1_1: case DRA722_ES1_0: bug_00339_regs_ptr = dra_bug_00339_regs; *iterations = sizeof(dra_bug_00339_regs)/ sizeof(dra_bug_00339_regs[0]); break; default: printf("\n Error: UnKnown SOC"); } return bug_00339_regs_ptr; }
/***************************************** * Routine: board_init * Description: Early hardware init. *****************************************/ int board_init(void) { unsigned int rev = omap_revision(); if (rev != OMAP4430_ES1_0) { if (__raw_readl(0x4805D138) & (1<<22)) { /* enable software ioreq */ sr32(0x4A30a31C, 8, 1, 0x1); /* set for sys_clk (38.4MHz) */ sr32(0x4A30a31C, 1, 2, 0x0); /* set divisor to 2 */ sr32(0x4A30a31C, 16, 4, 0x1); /* set the clock source to active */ sr32(0x4A30a110, 0, 1, 0x1); /* enable clocks */ sr32(0x4A30a110, 2, 2, 0x3); } else { /* enable software ioreq */ sr32(0x4A30a314, 8, 1, 0x1); /* set for PER_DPLL */ sr32(0x4A30a314, 1, 2, 0x2); /* set divisor to 16 */ sr32(0x4A30a314, 16, 4, 0xf); /* set the clock source to active */ sr32(0x4A30a110, 0, 1, 0x1); /* enable clocks */ sr32(0x4A30a110, 2, 2, 0x3); } } return 0; }
void emif_get_dmm_regs(const struct dmm_lisa_map_regs **dmm_lisa_regs) { u64 ram_size; ram_size = board_ti_get_emif_size(); switch (omap_revision()) { case DRA752_ES1_0: case DRA752_ES1_1: case DRA752_ES2_0: if (ram_size > CONFIG_MAX_MEM_MAPPED) *dmm_lisa_regs = &lisa_map_dra7_2GB; else *dmm_lisa_regs = &lisa_map_dra7_1536MB; break; case DRA722_ES1_0: case DRA722_ES2_0: default: if (ram_size < CONFIG_MAX_MEM_MAPPED) *dmm_lisa_regs = &lisa_map_2G_x_2; else *dmm_lisa_regs = &lisa_map_2G_x_4; break; } }
/* * Lock MPU dpll * * Resulting MPU frequencies: * 4430 ES1.0 : 600 MHz * 4430 ES2.x : 792 MHz (OPP Turbo) * 4460 : 920 MHz (OPP Turbo) - DCC disabled */ void configure_mpu_dpll(void) { const struct dpll_params *params; struct dpll_regs *mpu_dpll_regs; u32 omap_rev; omap_rev = omap_revision(); /* * DCC and clock divider settings for 4460. * DCC is required, if more than a certain frequency is required. * For, 4460 > 1GHZ. * 5430 > 1.4GHZ. */ if ((omap_rev >= OMAP4460_ES1_0) && (omap_rev < OMAP5430_ES1_0)) { mpu_dpll_regs = (struct dpll_regs *)((*prcm)->cm_clkmode_dpll_mpu); bypass_dpll((*prcm)->cm_clkmode_dpll_mpu); clrbits_le32((*prcm)->cm_mpu_mpu_clkctrl, MPU_CLKCTRL_CLKSEL_EMIF_DIV_MODE_MASK); setbits_le32((*prcm)->cm_mpu_mpu_clkctrl, MPU_CLKCTRL_CLKSEL_ABE_DIV_MODE_MASK); clrbits_le32(&mpu_dpll_regs->cm_clksel_dpll, CM_CLKSEL_DCC_EN_MASK); } params = get_mpu_dpll_params(*dplls_data); do_setup_dpll((*prcm)->cm_clkmode_dpll_mpu, params, DPLL_LOCK, "mpu"); debug("MPU DPLL locked\n"); }
void get_ioregs(const struct ctrl_ioregs **regs) { u32 omap_rev = omap_revision(); switch (omap_rev) { case OMAP5430_ES1_0: case OMAP5430_ES2_0: *regs = &ioregs_omap5430; break; case OMAP5432_ES1_0: *regs = &ioregs_omap5432_es1; break; case OMAP5432_ES2_0: *regs = &ioregs_omap5432_es2; break; case DRA752_ES1_0: case DRA752_ES1_1: case DRA752_ES2_0: *regs = &ioregs_dra7xx_es1; break; case DRA722_ES1_0: *regs = &ioregs_dra72x_es1; break; case DRA722_ES2_0: *regs = &ioregs_dra72x_es2; break; default: printf("\n INVALID OMAP REVISION "); } }
/** * @brief misc_init_r - Configure Panda board specific configurations * such as power configurations, ethernet initialization as phase2 of * boot sequence * * @return 0 */ int misc_init_r(void) { int phy_type; u32 auxclk, altclksrc; /* EHCI is not supported on ES1.0 */ if (omap_revision() == OMAP4430_ES1_0) return 0; get_board_revision(); gpio_direction_input(PANDA_ULPI_PHY_TYPE_GPIO); phy_type = gpio_get_value(PANDA_ULPI_PHY_TYPE_GPIO); if (phy_type == 1) { /* ULPI PHY supplied by auxclk3 derived from sys_clk */ debug("ULPI PHY supplied by auxclk3\n"); auxclk = readl(&scrm->auxclk3); /* Select sys_clk */ auxclk &= ~AUXCLK_SRCSELECT_MASK; auxclk |= AUXCLK_SRCSELECT_SYS_CLK << AUXCLK_SRCSELECT_SHIFT; /* Set the divisor to 2 */ auxclk &= ~AUXCLK_CLKDIV_MASK; auxclk |= AUXCLK_CLKDIV_2 << AUXCLK_CLKDIV_SHIFT; /* Request auxilary clock #3 */ auxclk |= AUXCLK_ENABLE_MASK; writel(auxclk, &scrm->auxclk3); } else { /* ULPI PHY supplied by auxclk1 derived from PER dpll */ debug("ULPI PHY supplied by auxclk1\n"); auxclk = readl(&scrm->auxclk1); /* Select per DPLL */ auxclk &= ~AUXCLK_SRCSELECT_MASK; auxclk |= AUXCLK_SRCSELECT_PER_DPLL << AUXCLK_SRCSELECT_SHIFT; /* Set the divisor to 16 */ auxclk &= ~AUXCLK_CLKDIV_MASK; auxclk |= AUXCLK_CLKDIV_16 << AUXCLK_CLKDIV_SHIFT; /* Request auxilary clock #3 */ auxclk |= AUXCLK_ENABLE_MASK; writel(auxclk, &scrm->auxclk1); } altclksrc = readl(&scrm->altclksrc); /* Activate alternate system clock supplier */ altclksrc &= ~ALTCLKSRC_MODE_MASK; altclksrc |= ALTCLKSRC_MODE_ACTIVE; /* enable clocks */ altclksrc |= ALTCLKSRC_ENABLE_INT_MASK | ALTCLKSRC_ENABLE_EXT_MASK; writel(altclksrc, &scrm->altclksrc); return 0; }
/* * Some tuning of IOs for optimal power and performance */ void do_io_settings(void) { u32 lpddr2io; u32 omap4_rev = omap_revision(); if (omap4_rev == OMAP4430_ES1_0) lpddr2io = CONTROL_LPDDR2IO_SLEW_125PS_DRV8_PULL_DOWN; else if (omap4_rev == OMAP4430_ES2_0) lpddr2io = CONTROL_LPDDR2IO_SLEW_325PS_DRV8_GATE_KEEPER; else lpddr2io = CONTROL_LPDDR2IO_SLEW_315PS_DRV12_PULL_DOWN; /* EMIF1 */ writel(lpddr2io, (*ctrl)->control_lpddr2io1_0); writel(lpddr2io, (*ctrl)->control_lpddr2io1_1); /* No pull for GR10 as per hw team's recommendation */ writel(lpddr2io & ~LPDDR2IO_GR10_WD_MASK, (*ctrl)->control_lpddr2io1_2); writel(CONTROL_LPDDR2IO_3_VAL, (*ctrl)->control_lpddr2io1_3); /* EMIF2 */ writel(lpddr2io, (*ctrl)->control_lpddr2io2_0); writel(lpddr2io, (*ctrl)->control_lpddr2io2_1); /* No pull for GR10 as per hw team's recommendation */ writel(lpddr2io & ~LPDDR2IO_GR10_WD_MASK, (*ctrl)->control_lpddr2io2_2); writel(CONTROL_LPDDR2IO_3_VAL, (*ctrl)->control_lpddr2io2_3); /* * Some of these settings (TRIM values) come from eFuse and are * in turn programmed in the eFuse at manufacturing time after * calibration of the device. Do the software over-ride only if * the device is not correctly trimmed */ if (!(readl((*ctrl)->control_std_fuse_opp_bgap) & 0xFFFF)) { writel(LDOSRAM_VOLT_CTRL_OVERRIDE, (*ctrl)->control_ldosram_iva_voltage_ctrl); writel(LDOSRAM_VOLT_CTRL_OVERRIDE, (*ctrl)->control_ldosram_mpu_voltage_ctrl); writel(LDOSRAM_VOLT_CTRL_OVERRIDE, (*ctrl)->control_ldosram_core_voltage_ctrl); } /* * Over-ride the register * i. unconditionally for all 4430 * ii. only if un-trimmed for 4460 */ if (!readl((*ctrl)->control_efuse_1)) writel(CONTROL_EFUSE_1_OVERRIDE, (*ctrl)->control_efuse_1); if ((omap4_rev < OMAP4460_ES1_0) || !readl((*ctrl)->control_efuse_2)) writel(CONTROL_EFUSE_2_OVERRIDE, (*ctrl)->control_efuse_2); }
void emif_get_dmm_regs(const struct dmm_lisa_map_regs **dmm_lisa_regs) { /* Disable SDRAM controller EMIF2 for single core SOC */ *dmm_lisa_regs = &cl_som_am57x_lisa_regs; if (omap_revision() == DRA722_ES1_0) { ((struct dmm_lisa_map_regs *) *dmm_lisa_regs)->dmm_lisa_map_3 = 0x80640100; } }
/* * Some tuning of IOs for optimal power and performance */ void do_io_settings(void) { u32 lpddr2io; struct control_lpddr2io_regs *lpddr2io_regs = (struct control_lpddr2io_regs *)LPDDR2_IO_REGS_BASE; struct omap4_sys_ctrl_regs *const ctrl = (struct omap4_sys_ctrl_regs *)SYSCTRL_GENERAL_CORE_BASE; u32 omap4_rev = omap_revision(); if (omap4_rev == OMAP4430_ES1_0) lpddr2io = CONTROL_LPDDR2IO_SLEW_125PS_DRV8_PULL_DOWN; else if (omap4_rev == OMAP4430_ES2_0) lpddr2io = CONTROL_LPDDR2IO_SLEW_325PS_DRV8_GATE_KEEPER; else lpddr2io = CONTROL_LPDDR2IO_SLEW_315PS_DRV12_PULL_DOWN; /* EMIF1 */ writel(lpddr2io, &lpddr2io_regs->control_lpddr2io1_0); writel(lpddr2io, &lpddr2io_regs->control_lpddr2io1_1); /* No pull for GR10 as per hw team's recommendation */ writel(lpddr2io & ~LPDDR2IO_GR10_WD_MASK, &lpddr2io_regs->control_lpddr2io1_2); writel(CONTROL_LPDDR2IO_3_VAL, &lpddr2io_regs->control_lpddr2io1_3); /* EMIF2 */ writel(lpddr2io, &lpddr2io_regs->control_lpddr2io2_0); writel(lpddr2io, &lpddr2io_regs->control_lpddr2io2_1); /* No pull for GR10 as per hw team's recommendation */ writel(lpddr2io & ~LPDDR2IO_GR10_WD_MASK, &lpddr2io_regs->control_lpddr2io2_2); writel(CONTROL_LPDDR2IO_3_VAL, &lpddr2io_regs->control_lpddr2io2_3); /* * Some of these settings (TRIM values) come from eFuse and are * in turn programmed in the eFuse at manufacturing time after * calibration of the device. Do the software over-ride only if * the device is not correctly trimmed */ if (!(readl(&ctrl->control_std_fuse_opp_bgap) & 0xFFFF)) { writel(LDOSRAM_VOLT_CTRL_OVERRIDE, &ctrl->control_ldosram_iva_voltage_ctrl); writel(LDOSRAM_VOLT_CTRL_OVERRIDE, &ctrl->control_ldosram_mpu_voltage_ctrl); writel(LDOSRAM_VOLT_CTRL_OVERRIDE, &ctrl->control_ldosram_core_voltage_ctrl); } if (!readl(&ctrl->control_efuse_1)) writel(CONTROL_EFUSE_1_OVERRIDE, &ctrl->control_efuse_1); if (!readl(&ctrl->control_efuse_2)) writel(CONTROL_EFUSE_2_OVERRIDE, &ctrl->control_efuse_2); }
static void emif_get_dmm_regs_sdp(const struct dmm_lisa_map_regs **dmm_lisa_regs) { u32 omap_rev = omap_revision(); if (omap_rev == OMAP4430_ES1_0) *dmm_lisa_regs = &lisa_map_2G_x_1_x_2; else *dmm_lisa_regs = &lisa_map_2G_x_2_x_2; }
static void emif_get_reg_dump_sdp(u32 emif_nr, const struct emif_regs **regs) { u32 omap4_rev = omap_revision(); /* Same devices and geometry on both EMIFs */ if (omap4_rev == OMAP4430_ES1_0) *regs = &emif_regs_elpida_380_mhz_1cs; else if (omap4_rev == OMAP4430_ES2_0) *regs = &emif_regs_elpida_200_mhz_2cs; else *regs = &emif_regs_elpida_400_mhz_2cs; }
/* * Routine: get_board_revision * Description: Detect if we are running on a panda revision A1-A6, * or an ES panda board. This can be done by reading * the level of GPIOs and checking the processor revisions. * This should result in: * Panda 4430: * GPIO171, GPIO101, GPIO182: 0 1 1 => A1-A5 * GPIO171, GPIO101, GPIO182: 1 0 1 => A6 * Panda ES: * GPIO2, GPIO3, GPIO171, GPIO48, GPIO182: 0 0 0 1 1 => B1/B2 * GPIO2, GPIO3, GPIO171, GPIO48, GPIO182: 0 0 1 1 1 => B3 */ int get_board_revision(void) { int board_id0, board_id1, board_id2; int board_id3, board_id4; int board_id; int processor_rev = omap_revision(); /* Setup the mux for the common board ID pins (gpio 171 and 182) */ writew((IEN | M3), (*ctrl)->control_padconf_core_base + UNIPRO_TX0); writew((IEN | M3), (*ctrl)->control_padconf_core_base + FREF_CLK2_OUT); board_id0 = gpio_get_value(PANDA_ULPI_PHY_TYPE_GPIO); board_id2 = gpio_get_value(PANDA_BOARD_ID_2_GPIO); if ((processor_rev >= OMAP4460_ES1_0 && processor_rev <= OMAP4460_ES1_1)) { /* * Setup the mux for the ES specific board ID pins (gpio 101, * 2 and 3. */ writew((IEN | M3), (*ctrl)->control_padconf_core_base + GPMC_A24); writew((IEN | M3), (*ctrl)->control_padconf_core_base + UNIPRO_RY0); writew((IEN | M3), (*ctrl)->control_padconf_core_base + UNIPRO_RX1); board_id1 = gpio_get_value(PANDA_ES_BOARD_ID_1_GPIO); board_id3 = gpio_get_value(PANDA_ES_BOARD_ID_3_GPIO); board_id4 = gpio_get_value(PANDA_ES_BOARD_ID_4_GPIO); #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG setenv("board_name", "panda-es"); #endif board_id = ((board_id4 << 4) | (board_id3 << 3) | (board_id2 << 2) | (board_id1 << 1) | (board_id0)); } else { /* Setup the mux for the Ax specific board ID pins (gpio 101) */ writew((IEN | M3), (*ctrl)->control_padconf_core_base + FREF_CLK2_OUT); board_id1 = gpio_get_value(PANDA_BOARD_ID_1_GPIO); board_id = ((board_id2 << 2) | (board_id1 << 1) | (board_id0)); #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG if ((board_id >= 0x3) && (processor_rev == OMAP4430_ES2_3)) setenv("board_name", "panda-a4"); #endif } return board_id; }
void reset_cpu(ulong ignored) { u32 omap_rev = omap_revision(); /* * WARM reset is not functional in case of OMAP5430 ES1.0 soc. * So use cold reset in case instead. */ if (omap_rev == OMAP5430_ES1_0) writel(PRM_RSTCTRL_RESET << 0x1, PRM_RSTCTRL); else writel(PRM_RSTCTRL_RESET, PRM_RSTCTRL); }
const struct mmc_platform_fixups *platform_fixups_mmc(uint32_t addr) { switch (omap_revision()) { case DRA752_ES1_0: case DRA752_ES1_1: if (addr == OMAP_HSMMC1_BASE) return &am57x_es1_1_mmc1_fixups; else return &am57x_es1_1_mmc23_fixups; default: return NULL; } }
void emif_get_device_timings_sdp(u32 emif_nr, const struct lpddr2_device_timings **cs0_device_timings, const struct lpddr2_device_timings **cs1_device_timings) { u32 omap_rev = omap_revision(); /* Identical devices on EMIF1 & EMIF2 */ *cs0_device_timings = &elpida_2G_S4_timings; if (omap_rev == OMAP4430_ES1_0) *cs1_device_timings = NULL; else *cs1_device_timings = &elpida_2G_S4_timings; }
static void emif_get_dmm_regs_sdp(const struct dmm_lisa_map_regs **dmm_lisa_regs) { switch (omap_revision()) { case OMAP5430_ES1_0: case OMAP5430_ES2_0: case OMAP5432_ES1_0: case OMAP5432_ES2_0: default: *dmm_lisa_regs = &lisa_map_4G_x_2_x_2; break; } }
void emif_get_dmm_regs(const struct dmm_lisa_map_regs **dmm_lisa_regs) { u32 omap_rev = omap_revision(); if (omap_rev == OMAP4430_ES1_0) *dmm_lisa_regs = &lisa_map_2G_x_1_x_2; else if (omap_rev == OMAP4430_ES2_3) *dmm_lisa_regs = &lisa_map_2G_x_2_x_2; else if (omap_rev < OMAP4460_ES1_0) *dmm_lisa_regs = &lisa_map_2G_x_2_x_2; else *dmm_lisa_regs = &ma_lisa_map_2G_x_2_x_2; }
struct lpddr2_device_details *emif_get_device_details_sdp(u32 emif_nr, u8 cs, struct lpddr2_device_details *lpddr2_dev_details) { u32 omap_rev = omap_revision(); /* EMIF1 & EMIF2 have identical configuration */ if ((omap_rev == OMAP4430_ES1_0) && (cs == CS1)) { /* Nothing connected on CS1 for ES1.0 */ return NULL; } else { /* In all other cases Elpida 2G device */ *lpddr2_dev_details = elpida_2G_S4_details; return lpddr2_dev_details; } }
const struct dpll_params *get_core_dpll_params(void) { u32 sysclk_ind = get_sys_clk_index(); switch (omap_revision()) { case OMAP4430_ES1_0: return &core_dpll_params_es1_1524mhz[sysclk_ind]; case OMAP4430_ES2_0: case OMAP4430_SILICON_ID_INVALID: /* safest */ return &core_dpll_params_es2_1600mhz_ddr200mhz[sysclk_ind]; default: return &core_dpll_params_1600mhz[sysclk_ind]; } }