diff options
-rw-r--r-- | drivers/memory/emif.c | 27 | ||||
-rw-r--r-- | include/linux/platform_data/emif_plat.h | 1 |
2 files changed, 28 insertions, 0 deletions
diff --git a/drivers/memory/emif.c b/drivers/memory/emif.c index 249222905c94..96add5b9ce5d 100644 --- a/drivers/memory/emif.c +++ b/drivers/memory/emif.c | |||
@@ -918,6 +918,7 @@ static irqreturn_t handle_temp_alert(void __iomem *base, struct emif_data *emif) | |||
918 | { | 918 | { |
919 | u32 old_temp_level; | 919 | u32 old_temp_level; |
920 | irqreturn_t ret = IRQ_HANDLED; | 920 | irqreturn_t ret = IRQ_HANDLED; |
921 | struct emif_custom_configs *custom_configs; | ||
921 | 922 | ||
922 | spin_lock_irqsave(&emif_lock, irq_state); | 923 | spin_lock_irqsave(&emif_lock, irq_state); |
923 | old_temp_level = emif->temperature_level; | 924 | old_temp_level = emif->temperature_level; |
@@ -930,6 +931,29 @@ static irqreturn_t handle_temp_alert(void __iomem *base, struct emif_data *emif) | |||
930 | goto out; | 931 | goto out; |
931 | } | 932 | } |
932 | 933 | ||
934 | custom_configs = emif->plat_data->custom_configs; | ||
935 | |||
936 | /* | ||
937 | * IF we detect higher than "nominal rating" from DDR sensor | ||
938 | * on an unsupported DDR part, shutdown system | ||
939 | */ | ||
940 | if (custom_configs && !(custom_configs->mask & | ||
941 | EMIF_CUSTOM_CONFIG_EXTENDED_TEMP_PART)) { | ||
942 | if (emif->temperature_level >= SDRAM_TEMP_HIGH_DERATE_REFRESH) { | ||
943 | dev_err(emif->dev, | ||
944 | "%s:NOT Extended temperature capable memory." | ||
945 | "Converting MR4=0x%02x as shutdown event\n", | ||
946 | __func__, emif->temperature_level); | ||
947 | /* | ||
948 | * Temperature far too high - do kernel_power_off() | ||
949 | * from thread context | ||
950 | */ | ||
951 | emif->temperature_level = SDRAM_TEMP_VERY_HIGH_SHUTDOWN; | ||
952 | ret = IRQ_WAKE_THREAD; | ||
953 | goto out; | ||
954 | } | ||
955 | } | ||
956 | |||
933 | if (emif->temperature_level < old_temp_level || | 957 | if (emif->temperature_level < old_temp_level || |
934 | emif->temperature_level == SDRAM_TEMP_VERY_HIGH_SHUTDOWN) { | 958 | emif->temperature_level == SDRAM_TEMP_VERY_HIGH_SHUTDOWN) { |
935 | /* | 959 | /* |
@@ -1228,6 +1252,9 @@ static void __init_or_module of_get_custom_configs(struct device_node *np_emif, | |||
1228 | cust_cfgs->temp_alert_poll_interval_ms = *poll_intvl; | 1252 | cust_cfgs->temp_alert_poll_interval_ms = *poll_intvl; |
1229 | } | 1253 | } |
1230 | 1254 | ||
1255 | if (of_find_property(np_emif, "extended-temp-part", &len)) | ||
1256 | cust_cfgs->mask |= EMIF_CUSTOM_CONFIG_EXTENDED_TEMP_PART; | ||
1257 | |||
1231 | if (!is_custom_config_valid(cust_cfgs, emif->dev)) { | 1258 | if (!is_custom_config_valid(cust_cfgs, emif->dev)) { |
1232 | devm_kfree(emif->dev, cust_cfgs); | 1259 | devm_kfree(emif->dev, cust_cfgs); |
1233 | return; | 1260 | return; |
diff --git a/include/linux/platform_data/emif_plat.h b/include/linux/platform_data/emif_plat.h index 03378ca84061..5c19a2a647c4 100644 --- a/include/linux/platform_data/emif_plat.h +++ b/include/linux/platform_data/emif_plat.h | |||
@@ -40,6 +40,7 @@ | |||
40 | /* Custom config requests */ | 40 | /* Custom config requests */ |
41 | #define EMIF_CUSTOM_CONFIG_LPMODE 0x00000001 | 41 | #define EMIF_CUSTOM_CONFIG_LPMODE 0x00000001 |
42 | #define EMIF_CUSTOM_CONFIG_TEMP_ALERT_POLL_INTERVAL 0x00000002 | 42 | #define EMIF_CUSTOM_CONFIG_TEMP_ALERT_POLL_INTERVAL 0x00000002 |
43 | #define EMIF_CUSTOM_CONFIG_EXTENDED_TEMP_PART 0x00000004 | ||
43 | 44 | ||
44 | #ifndef __ASSEMBLY__ | 45 | #ifndef __ASSEMBLY__ |
45 | /** | 46 | /** |