| #include "io.h" |
| #include "lgpl_printf.h" |
| #include "chip_voltage_info.h" |
| #include "berlin_bootinfo.h" |
| #include "board_config.h" |
| #include "pmic_select.h" |
| |
| // SY8824 |
| static struct leakage_table SY8824B_table_vcpu_h[] = |
| { |
| { 800, 900}, |
| { 0xffff, 875}, |
| }; |
| |
| static struct leakage_table SY8824B_table_vcpu_l[] = |
| { |
| { 800, 825}, |
| { 0xffff, 800}, |
| }; |
| |
| static struct freq_leakage_table SY8824B_leakage_table_vcpu[] = |
| { |
| {1400, SY8824B_table_vcpu_l}, |
| {1800, SY8824B_table_vcpu_h}, |
| {0, NULL}, |
| }; |
| |
| // SY20276 |
| static struct leakage_table SY20276_table_vcpu_h[] = |
| { |
| { 800, 900}, |
| { 0xffff, 880}, |
| }; |
| |
| static struct leakage_table SY20276_table_vcpu_l[] = |
| { |
| { 800, 830}, |
| { 0xffff, 800}, |
| }; |
| |
| static struct freq_leakage_table SY20276_leakage_table_vcpu[] = |
| { |
| {1400, SY20276_table_vcpu_l}, |
| {1800, SY20276_table_vcpu_h}, |
| {0, NULL}, |
| }; |
| |
| struct freq_leakage_table * as370_get_vcpu_leakage_table() |
| { |
| unsigned int pmic_id = get_pmic_id(); |
| |
| if (SY20276 == pmic_id) |
| return SY20276_leakage_table_vcpu; |
| else if (SY8824B == pmic_id || SY20278 == pmic_id) |
| return SY8824B_leakage_table_vcpu; |
| else |
| return SY8824B_leakage_table_vcpu; |
| } |
| |
| unsigned int as370_get_default_cpu_voltage() |
| { |
| unsigned int volt; |
| volt = DEFAULT_CPU_VOLTAGE; |
| return volt; |
| } |
| |
| unsigned int as370_get_default_core_voltage() |
| { |
| unsigned int volt; |
| volt = DEFAULT_CORE_VOLTAGE; |
| return volt; |
| } |
| |
| int is_AS370_A0(void) |
| { |
| unsigned int chip_version = 0; |
| const volatile BERLIN_BOOTINFO *pinfo = (BERLIN_BOOTINFO *)BERLIN_BOOTINFO_ADDR; |
| |
| chip_version = (unsigned int)(pinfo->chip_version); |
| |
| lgpl_printf("chip rev is "); |
| |
| if(chip_version == 0x0) { |
| lgpl_printf("A0\n"); |
| return 1; |
| } |
| |
| lgpl_printf("A1\n"); |
| return 0; |
| } |
| |
| unsigned int get_leakage_info() |
| { |
| unsigned int lkg = 0; |
| const volatile BERLIN_BOOTINFO *pinfo = (BERLIN_BOOTINFO *)BERLIN_BOOTINFO_ADDR; |
| |
| lkg = (unsigned int)(pinfo->leakage_current); |
| |
| if(is_AS370_A0()) { |
| /* if A0, convert 100C SIDD to 90C SIDD |
| * the fomula is 90C SIDD = 100C SIDD / 1.38 |
| */ |
| lkg *= 100; |
| lkg /= 138; |
| } |
| |
| return lkg; |
| } |
| |
| unsigned int get_temp_id() |
| { |
| unsigned int temp_id = 0; |
| const volatile BERLIN_BOOTINFO *pinfo = (BERLIN_BOOTINFO *)BERLIN_BOOTINFO_ADDR; |
| |
| temp_id = (unsigned int)(pinfo->temp_id); |
| |
| return temp_id; |
| } |
| |
| unsigned int get_unique_id(int index) |
| { |
| if (index < 0 || index > 1) { |
| lgpl_printf("get_unique_id invalid index %d\n", index); |
| return -1; |
| } |
| unsigned int unique_id = 0; |
| const volatile BERLIN_BOOTINFO *pinfo = (BERLIN_BOOTINFO *)BERLIN_BOOTINFO_ADDR; |
| |
| unique_id = (unsigned int)(pinfo->unique_id[index]); |
| |
| return unique_id; |
| } |
| |
| unsigned int get_feature0(int index) |
| { |
| if (index < 0 || index > 1) { |
| lgpl_printf("get_feature0 invalid index %d\n", index); |
| return -1; |
| } |
| unsigned int feature0 = 0; |
| const volatile BERLIN_BOOTINFO *pinfo = (BERLIN_BOOTINFO *)BERLIN_BOOTINFO_ADDR; |
| |
| feature0 = (unsigned int)(pinfo->feature0[index]); |
| |
| return feature0; |
| } |
| |
| unsigned int get_feature2_swapped(int index) |
| { |
| if (index < 0 || index > 1) { |
| lgpl_printf("get_feature2 invalid index %d\n", index); |
| return -1; |
| } |
| unsigned int feature2 = 0; |
| const volatile BERLIN_BOOTINFO *pinfo = (BERLIN_BOOTINFO *)BERLIN_BOOTINFO_ADDR; |
| |
| feature2 = (unsigned int)(pinfo->feature2[index]); |
| |
| return ((feature2 >> 24) & 0xFF) | ((feature2 >> 8) & 0xFF00) | |
| ((feature2 << 8) & 0xFF0000) | ((feature2 << 24) & 0xFF000000); |
| } |
| |
| unsigned int get_feature4_swapped(int index) |
| { |
| if (index < 0 || index > 1) { |
| lgpl_printf("get_feature4 invalid index %d\n", index); |
| return -1; |
| } |
| unsigned int feature4 = 0; |
| const volatile BERLIN_BOOTINFO *pinfo = (BERLIN_BOOTINFO *)BERLIN_BOOTINFO_ADDR; |
| |
| feature4 = (unsigned int)(pinfo->feature4[index]); |
| |
| return ((feature4 >> 24) & 0xFF) | ((feature4 >> 8) & 0xFF00) | |
| ((feature4 << 8) & 0xFF0000) | ((feature4 << 24) & 0xFF000000); |
| } |
| |
| int is_SPI_controller() |
| { |
| return 0; |
| } |
| void pv_pinmux_setting() |
| { |
| return; |
| } |
| |