emif 79 drivers/memory/emif.c static void do_emif_regdump_show(struct seq_file *s, struct emif_data *emif, emif 82 drivers/memory/emif.c u32 type = emif->plat_data->device_info->type; emif 83 drivers/memory/emif.c u32 ip_rev = emif->plat_data->ip_rev; emif 117 drivers/memory/emif.c struct emif_data *emif = s->private; emif 121 drivers/memory/emif.c if (emif->duplicate) emif 124 drivers/memory/emif.c regs_cache = emif->regs_cache; emif 127 drivers/memory/emif.c do_emif_regdump_show(s, emif, regs_cache[i]); emif 147 drivers/memory/emif.c struct emif_data *emif = s->private; emif 149 drivers/memory/emif.c seq_printf(s, "MR4=%d\n", emif->temperature_level); emif 164 drivers/memory/emif.c static int __init_or_module emif_debugfs_init(struct emif_data *emif) emif 169 drivers/memory/emif.c dentry = debugfs_create_dir(dev_name(emif->dev), NULL); emif 174 drivers/memory/emif.c emif->debugfs_root = dentry; emif 177 drivers/memory/emif.c emif->debugfs_root, emif, &emif_regdump_fops); emif 184 drivers/memory/emif.c emif->debugfs_root, emif, &emif_mr4_fops); emif 192 drivers/memory/emif.c debugfs_remove_recursive(emif->debugfs_root); emif 197 drivers/memory/emif.c static void __exit emif_debugfs_exit(struct emif_data *emif) emif 199 drivers/memory/emif.c debugfs_remove_recursive(emif->debugfs_root); emif 200 drivers/memory/emif.c emif->debugfs_root = NULL; emif 203 drivers/memory/emif.c static inline int __init_or_module emif_debugfs_init(struct emif_data *emif) emif 208 drivers/memory/emif.c static inline void __exit emif_debugfs_exit(struct emif_data *emif) emif 228 drivers/memory/emif.c static u32 get_emif_bus_width(struct emif_data *emif) emif 231 drivers/memory/emif.c void __iomem *base = emif->base; emif 243 drivers/memory/emif.c static u32 get_cl(struct emif_data *emif) emif 246 drivers/memory/emif.c void __iomem *base = emif->base; emif 253 drivers/memory/emif.c static void set_lpmode(struct emif_data *emif, u8 lpmode) emif 256 drivers/memory/emif.c void __iomem *base = emif->base; emif 284 drivers/memory/emif.c if ((emif->plat_data->ip_rev == EMIF_4D) && emif 301 drivers/memory/emif.c struct emif_data *emif; emif 326 drivers/memory/emif.c list_for_each_entry(emif, &device_list, node) { emif 327 drivers/memory/emif.c if (emif->lpmode == EMIF_LP_MODE_SELF_REFRESH) emif 328 drivers/memory/emif.c set_lpmode(emif, EMIF_LP_MODE_DISABLE); emif 337 drivers/memory/emif.c list_for_each_entry(emif, &device_list, node) { emif 338 drivers/memory/emif.c if (emif->lpmode == EMIF_LP_MODE_SELF_REFRESH) emif 339 drivers/memory/emif.c set_lpmode(emif, EMIF_LP_MODE_SELF_REFRESH); emif 377 drivers/memory/emif.c static const struct lpddr2_timings *get_timings_table(struct emif_data *emif, emif 382 drivers/memory/emif.c const struct lpddr2_timings *timings_arr = emif->plat_data->timings; emif 383 drivers/memory/emif.c struct device *dev = emif->dev; emif 393 drivers/memory/emif.c for (i = 0; i < emif->plat_data->timings_arr_size; i++) { emif 745 drivers/memory/emif.c static u32 get_pwr_mgmt_ctrl(u32 freq, struct emif_data *emif, u32 ip_rev) emif 755 drivers/memory/emif.c struct emif_custom_configs *cust_cfgs = emif->plat_data->custom_configs; emif 836 drivers/memory/emif.c static void get_temperature_level(struct emif_data *emif) emif 841 drivers/memory/emif.c base = emif->base; emif 849 drivers/memory/emif.c if (emif->plat_data->device_info->cs1_used) { emif 863 drivers/memory/emif.c emif->temperature_level = temperature_level; emif 870 drivers/memory/emif.c static void setup_registers(struct emif_data *emif, struct emif_regs *regs) emif 872 drivers/memory/emif.c void __iomem *base = emif->base; emif 880 drivers/memory/emif.c if (emif->plat_data->ip_rev != EMIF_4D5) emif 891 drivers/memory/emif.c static void setup_volt_sensitive_regs(struct emif_data *emif, emif 895 drivers/memory/emif.c void __iomem *base = emif->base; emif 919 drivers/memory/emif.c static void setup_temperature_sensitive_regs(struct emif_data *emif, emif 923 drivers/memory/emif.c void __iomem *base = emif->base; emif 926 drivers/memory/emif.c type = emif->plat_data->device_info->type; emif 936 drivers/memory/emif.c temperature = emif->temperature_level; emif 951 drivers/memory/emif.c static irqreturn_t handle_temp_alert(void __iomem *base, struct emif_data *emif) emif 958 drivers/memory/emif.c old_temp_level = emif->temperature_level; emif 959 drivers/memory/emif.c get_temperature_level(emif); emif 961 drivers/memory/emif.c if (unlikely(emif->temperature_level == old_temp_level)) { emif 963 drivers/memory/emif.c } else if (!emif->curr_regs) { emif 964 drivers/memory/emif.c dev_err(emif->dev, "temperature alert before registers are calculated, not de-rating timings\n"); emif 968 drivers/memory/emif.c custom_configs = emif->plat_data->custom_configs; emif 976 drivers/memory/emif.c if (emif->temperature_level >= SDRAM_TEMP_HIGH_DERATE_REFRESH) { emif 977 drivers/memory/emif.c dev_err(emif->dev, emif 980 drivers/memory/emif.c __func__, emif->temperature_level); emif 985 drivers/memory/emif.c emif->temperature_level = SDRAM_TEMP_VERY_HIGH_SHUTDOWN; emif 991 drivers/memory/emif.c if (emif->temperature_level < old_temp_level || emif 992 drivers/memory/emif.c emif->temperature_level == SDRAM_TEMP_VERY_HIGH_SHUTDOWN) { emif 1001 drivers/memory/emif.c setup_temperature_sensitive_regs(emif, emif->curr_regs); emif 1013 drivers/memory/emif.c struct emif_data *emif = dev_id; emif 1014 drivers/memory/emif.c void __iomem *base = emif->base; emif 1015 drivers/memory/emif.c struct device *dev = emif->dev; emif 1028 drivers/memory/emif.c ret = handle_temp_alert(base, emif); emif 1033 drivers/memory/emif.c if (emif->plat_data->hw_caps & EMIF_HW_CAPS_LL_INTERFACE) { emif 1048 drivers/memory/emif.c struct emif_data *emif = dev_id; emif 1050 drivers/memory/emif.c if (emif->temperature_level == SDRAM_TEMP_VERY_HIGH_SHUTDOWN) { emif 1051 drivers/memory/emif.c dev_emerg(emif->dev, "SDRAM temperature exceeds operating limit.. Needs shut down!!!\n"); emif 1065 drivers/memory/emif.c if (emif->curr_regs) { emif 1066 drivers/memory/emif.c setup_temperature_sensitive_regs(emif, emif->curr_regs); emif 1069 drivers/memory/emif.c dev_err(emif->dev, "temperature alert before registers are calculated, not de-rating timings\n"); emif 1077 drivers/memory/emif.c static void clear_all_interrupts(struct emif_data *emif) emif 1079 drivers/memory/emif.c void __iomem *base = emif->base; emif 1083 drivers/memory/emif.c if (emif->plat_data->hw_caps & EMIF_HW_CAPS_LL_INTERFACE) emif 1088 drivers/memory/emif.c static void disable_and_clear_all_interrupts(struct emif_data *emif) emif 1090 drivers/memory/emif.c void __iomem *base = emif->base; emif 1095 drivers/memory/emif.c if (emif->plat_data->hw_caps & EMIF_HW_CAPS_LL_INTERFACE) emif 1100 drivers/memory/emif.c clear_all_interrupts(emif); emif 1103 drivers/memory/emif.c static int __init_or_module setup_interrupts(struct emif_data *emif, u32 irq) emif 1106 drivers/memory/emif.c void __iomem *base = emif->base; emif 1108 drivers/memory/emif.c type = emif->plat_data->device_info->type; emif 1110 drivers/memory/emif.c clear_all_interrupts(emif); emif 1119 drivers/memory/emif.c if (emif->plat_data->hw_caps & EMIF_HW_CAPS_LL_INTERFACE) { emif 1126 drivers/memory/emif.c return devm_request_threaded_irq(emif->dev, irq, emif 1129 drivers/memory/emif.c 0, dev_name(emif->dev), emif 1130 drivers/memory/emif.c emif); emif 1134 drivers/memory/emif.c static void __init_or_module emif_onetime_settings(struct emif_data *emif) emif 1137 drivers/memory/emif.c void __iomem *base = emif->base; emif 1141 drivers/memory/emif.c device_info = emif->plat_data->device_info; emif 1149 drivers/memory/emif.c pwr_mgmt_ctrl = get_pwr_mgmt_ctrl(1000000000, emif, emif 1150 drivers/memory/emif.c emif->plat_data->ip_rev); emif 1151 drivers/memory/emif.c emif->lpmode = (pwr_mgmt_ctrl & LP_MODE_MASK) >> LP_MODE_SHIFT; emif 1160 drivers/memory/emif.c get_temperature_level(emif); emif 1161 drivers/memory/emif.c if (emif->temperature_level == SDRAM_TEMP_VERY_HIGH_SHUTDOWN) emif 1162 drivers/memory/emif.c dev_emerg(emif->dev, "SDRAM temperature exceeds operating limit.. Needs shut down!!!\n"); emif 1166 drivers/memory/emif.c emif->plat_data->custom_configs, device_info->cs1_used, emif 1167 drivers/memory/emif.c device_info->io_width, get_emif_bus_width(emif)); emif 1174 drivers/memory/emif.c if (emif->plat_data->phy_type != EMIF_PHY_TYPE_INTELLIPHY) emif 1199 drivers/memory/emif.c static void get_default_timings(struct emif_data *emif) emif 1201 drivers/memory/emif.c struct emif_platform_data *pd = emif->plat_data; emif 1206 drivers/memory/emif.c dev_warn(emif->dev, "%s: using default timings\n", __func__); emif 1260 drivers/memory/emif.c struct emif_data *emif) emif 1270 drivers/memory/emif.c cust_cfgs = devm_kzalloc(emif->dev, sizeof(*cust_cfgs), emif 1300 drivers/memory/emif.c if (!is_custom_config_valid(cust_cfgs, emif->dev)) { emif 1301 drivers/memory/emif.c devm_kfree(emif->dev, cust_cfgs); emif 1305 drivers/memory/emif.c emif->plat_data->custom_configs = cust_cfgs; emif 1345 drivers/memory/emif.c struct emif_data *emif = NULL; emif 1354 drivers/memory/emif.c emif = devm_kzalloc(dev, sizeof(struct emif_data), GFP_KERNEL); emif 1358 drivers/memory/emif.c if (!emif || !pd || !dev_info) { emif 1364 drivers/memory/emif.c emif->plat_data = pd; emif 1366 drivers/memory/emif.c emif->dev = dev; emif 1367 drivers/memory/emif.c emif->np_ddr = np_ddr; emif 1368 drivers/memory/emif.c emif->temperature_level = SDRAM_TEMP_NOMINAL; emif 1371 drivers/memory/emif.c emif->plat_data->ip_rev = EMIF_4D; emif 1373 drivers/memory/emif.c emif->plat_data->ip_rev = EMIF_4D5; emif 1383 drivers/memory/emif.c emif->dev)) { emif 1394 drivers/memory/emif.c emif->duplicate = true; emif 1397 drivers/memory/emif.c dev_warn(emif->dev, "%s: Non-symmetric DDR geometry\n", emif 1401 drivers/memory/emif.c of_get_custom_configs(np_emif, emif); emif 1402 drivers/memory/emif.c emif->plat_data->timings = of_get_ddr_timings(np_ddr, emif->dev, emif 1403 drivers/memory/emif.c emif->plat_data->device_info->type, emif 1404 drivers/memory/emif.c &emif->plat_data->timings_arr_size); emif 1406 drivers/memory/emif.c emif->plat_data->min_tck = of_get_min_tck(np_ddr, emif->dev); emif 1412 drivers/memory/emif.c return emif; emif 1428 drivers/memory/emif.c struct emif_data *emif = NULL; emif 1445 drivers/memory/emif.c emif = devm_kzalloc(dev, sizeof(*emif), GFP_KERNEL); emif 1449 drivers/memory/emif.c if (!emif || !pd || !dev_info) { emif 1459 drivers/memory/emif.c emif->plat_data = pd; emif 1460 drivers/memory/emif.c emif->dev = dev; emif 1461 drivers/memory/emif.c emif->temperature_level = SDRAM_TEMP_NOMINAL; emif 1469 drivers/memory/emif.c emif->duplicate = emif1 && (memcmp(dev_info, emif 1473 drivers/memory/emif.c if (emif->duplicate) { emif 1478 drivers/memory/emif.c dev_warn(emif->dev, "%s: Non-symmetric DDR geometry\n", emif 1510 drivers/memory/emif.c get_default_timings(emif); emif 1513 drivers/memory/emif.c get_default_timings(emif); emif 1531 drivers/memory/emif.c return emif; emif 1539 drivers/memory/emif.c struct emif_data *emif; emif 1544 drivers/memory/emif.c emif = of_get_memory_device_details(pdev->dev.of_node, &pdev->dev); emif 1546 drivers/memory/emif.c emif = get_device_details(pdev); emif 1548 drivers/memory/emif.c if (!emif) { emif 1553 drivers/memory/emif.c list_add(&emif->node, &device_list); emif 1554 drivers/memory/emif.c emif->addressing = get_addressing_table(emif->plat_data->device_info); emif 1557 drivers/memory/emif.c emif->dev = &pdev->dev; emif 1558 drivers/memory/emif.c platform_set_drvdata(pdev, emif); emif 1561 drivers/memory/emif.c emif->base = devm_ioremap_resource(emif->dev, res); emif 1562 drivers/memory/emif.c if (IS_ERR(emif->base)) emif 1567 drivers/memory/emif.c dev_err(emif->dev, "%s: error getting IRQ resource - %d\n", emif 1572 drivers/memory/emif.c emif_onetime_settings(emif); emif 1573 drivers/memory/emif.c emif_debugfs_init(emif); emif 1574 drivers/memory/emif.c disable_and_clear_all_interrupts(emif); emif 1575 drivers/memory/emif.c setup_interrupts(emif, irq); emif 1579 drivers/memory/emif.c emif1 = emif; emif 1590 drivers/memory/emif.c __func__, emif->base, irq); emif 1599 drivers/memory/emif.c struct emif_data *emif = platform_get_drvdata(pdev); emif 1601 drivers/memory/emif.c emif_debugfs_exit(emif); emif 1608 drivers/memory/emif.c struct emif_data *emif = platform_get_drvdata(pdev); emif 1610 drivers/memory/emif.c disable_and_clear_all_interrupts(emif); emif 1613 drivers/memory/emif.c static int get_emif_reg_values(struct emif_data *emif, u32 freq, emif 1626 drivers/memory/emif.c dev = emif->dev; emif 1631 drivers/memory/emif.c emif_for_calc = emif->duplicate ? emif1 : emif; emif 1659 drivers/memory/emif.c cl = get_cl(emif); emif 1724 drivers/memory/emif.c static struct emif_regs *get_regs(struct emif_data *emif, u32 freq) emif 1731 drivers/memory/emif.c dev = emif->dev; emif 1732 drivers/memory/emif.c if (emif->curr_regs && emif->curr_regs->freq == freq) { emif 1734 drivers/memory/emif.c return emif->curr_regs; emif 1737 drivers/memory/emif.c if (emif->duplicate) emif 1740 drivers/memory/emif.c regs_cache = emif->regs_cache; emif 1757 drivers/memory/emif.c regs = devm_kzalloc(emif->dev, sizeof(*regs), GFP_ATOMIC); emif 1761 drivers/memory/emif.c if (get_emif_reg_values(emif, freq, regs)) { emif 1762 drivers/memory/emif.c devm_kfree(emif->dev, regs); emif 1778 drivers/memory/emif.c devm_kfree(emif->dev, regs_cache[i]); emif 1786 drivers/memory/emif.c static void do_volt_notify_handling(struct emif_data *emif, u32 volt_state) emif 1788 drivers/memory/emif.c dev_dbg(emif->dev, "%s: voltage notification : %d", __func__, emif 1791 drivers/memory/emif.c if (!emif->curr_regs) { emif 1792 drivers/memory/emif.c dev_err(emif->dev, emif 1798 drivers/memory/emif.c setup_volt_sensitive_regs(emif, emif->curr_regs, volt_state); emif 1809 drivers/memory/emif.c struct emif_data *emif; emif 1813 drivers/memory/emif.c list_for_each_entry(emif, &device_list, node) emif 1814 drivers/memory/emif.c do_volt_notify_handling(emif, volt_state); emif 1820 drivers/memory/emif.c static void do_freq_pre_notify_handling(struct emif_data *emif, u32 new_freq) emif 1824 drivers/memory/emif.c regs = get_regs(emif, new_freq); emif 1828 drivers/memory/emif.c emif->curr_regs = regs; emif 1836 drivers/memory/emif.c dev_dbg(emif->dev, "%s: setting up shadow registers for %uHz", emif 1838 drivers/memory/emif.c setup_registers(emif, regs); emif 1839 drivers/memory/emif.c setup_temperature_sensitive_regs(emif, regs); emif 1840 drivers/memory/emif.c setup_volt_sensitive_regs(emif, regs, DDR_VOLTAGE_STABLE); emif 1846 drivers/memory/emif.c if (emif->lpmode == EMIF_LP_MODE_SELF_REFRESH) emif 1847 drivers/memory/emif.c set_lpmode(emif, EMIF_LP_MODE_DISABLE); emif 1858 drivers/memory/emif.c struct emif_data *emif; emif 1881 drivers/memory/emif.c list_for_each_entry(emif, &device_list, node) emif 1882 drivers/memory/emif.c do_freq_pre_notify_handling(emif, new_freq); emif 1885 drivers/memory/emif.c static void do_freq_post_notify_handling(struct emif_data *emif) emif 1891 drivers/memory/emif.c if (emif->lpmode == EMIF_LP_MODE_SELF_REFRESH) emif 1892 drivers/memory/emif.c set_lpmode(emif, EMIF_LP_MODE_SELF_REFRESH); emif 1903 drivers/memory/emif.c struct emif_data *emif; emif 1905 drivers/memory/emif.c list_for_each_entry(emif, &device_list, node) emif 1906 drivers/memory/emif.c do_freq_post_notify_handling(emif);