@ -22,9 +22,11 @@
# include <fdtdec.h>
# include <fdtdec.h>
# include <tmu.h>
# include <tmu.h>
# include <asm/arch/tmu.h>
# include <asm/arch/tmu.h>
# include <asm/arch/power.h>
# define TRIMINFO_RELOAD 1
# define TRIMINFO_RELOAD 1
# define CORE_EN 1
# define CORE_EN 1
# define THERM_TRIP_EN (1 << 12)
# define INTEN_RISE0 1
# define INTEN_RISE0 1
# define INTEN_RISE1 (1 << 4)
# define INTEN_RISE1 (1 << 4)
@ -55,6 +57,8 @@ struct temperature_params {
unsigned int start_warning ;
unsigned int start_warning ;
/* temperature threshold CPU tripping */
/* temperature threshold CPU tripping */
unsigned int start_tripping ;
unsigned int start_tripping ;
/* temperature threshold for HW tripping */
unsigned int hardware_tripping ;
} ;
} ;
/* Pre-defined values and thresholds for calibration of current temperature */
/* Pre-defined values and thresholds for calibration of current temperature */
@ -196,6 +200,9 @@ static int get_tmu_fdt_values(struct tmu_info *info, const void *blob)
info - > data . ts . start_tripping = fdtdec_get_int ( blob ,
info - > data . ts . start_tripping = fdtdec_get_int ( blob ,
node , " samsung,start-tripping " , - 1 ) ;
node , " samsung,start-tripping " , - 1 ) ;
error | = info - > data . ts . start_tripping ;
error | = info - > data . ts . start_tripping ;
info - > data . ts . hardware_tripping = fdtdec_get_int ( blob ,
node , " samsung,hw-tripping " , - 1 ) ;
error | = info - > data . ts . hardware_tripping ;
info - > data . efuse_min_value = fdtdec_get_int ( blob ,
info - > data . efuse_min_value = fdtdec_get_int ( blob ,
node , " samsung,efuse-min-value " , - 1 ) ;
node , " samsung,efuse-min-value " , - 1 ) ;
error | = info - > data . efuse_min_value ;
error | = info - > data . efuse_min_value ;
@ -230,7 +237,7 @@ static int get_tmu_fdt_values(struct tmu_info *info, const void *blob)
static void tmu_setup_parameters ( struct tmu_info * info )
static void tmu_setup_parameters ( struct tmu_info * info )
{
{
unsigned int te_code , con ;
unsigned int te_code , con ;
unsigned int warning_code , trip_code ;
unsigned int warning_code , trip_code , hwtrip_code ;
unsigned int cooling_temp ;
unsigned int cooling_temp ;
unsigned int rising_value ;
unsigned int rising_value ;
struct tmu_data * data = & info - > data ;
struct tmu_data * data = & info - > data ;
@ -254,9 +261,14 @@ static void tmu_setup_parameters(struct tmu_info *info)
+ info - > te1 - info - > dc_value ;
+ info - > te1 - info - > dc_value ;
trip_code = data - > ts . start_tripping
trip_code = data - > ts . start_tripping
+ info - > te1 - info - > dc_value ;
+ info - > te1 - info - > dc_value ;
hwtrip_code = data - > ts . hardware_tripping
+ info - > te1 - info - > dc_value ;
cooling_temp = 0 ;
cooling_temp = 0 ;
rising_value = ( ( warning_code < < 8 ) | ( trip_code < < 16 ) ) ;
rising_value = ( ( warning_code < < 8 ) |
( trip_code < < 16 ) |
( hwtrip_code < < 24 ) ) ;
/* Set interrupt level */
/* Set interrupt level */
writel ( rising_value , & reg - > threshold_temp_rise ) ;
writel ( rising_value , & reg - > threshold_temp_rise ) ;
@ -276,12 +288,15 @@ static void tmu_setup_parameters(struct tmu_info *info)
/* TMU core enable */
/* TMU core enable */
con = readl ( & reg - > tmu_control ) ;
con = readl ( & reg - > tmu_control ) ;
con | = CORE_EN ;
con | = THERM_TRIP_EN | CORE_EN ;
writel ( con , & reg - > tmu_control ) ;
writel ( con , & reg - > tmu_control ) ;
/* LEV0 LEV1 LEV2 interrupt enable */
/* Enable HW thermal trip */
writel ( INTEN_RISE0 | INTEN_RISE1 | INTEN_RISE2 , & reg - > inten ) ;
set_hw_thermal_trip ( ) ;
/* LEV1 LEV2 interrupt enable */
writel ( INTEN_RISE1 | INTEN_RISE2 , & reg - > inten ) ;
}
}
/*
/*