diff options
Diffstat (limited to 'src/soc/mediatek/mt8192/mt6315.c')
-rw-r--r-- | src/soc/mediatek/mt8192/mt6315.c | 102 |
1 files changed, 1 insertions, 101 deletions
diff --git a/src/soc/mediatek/mt8192/mt6315.c b/src/soc/mediatek/mt8192/mt6315.c index efb1504d5c..6457f58993 100644 --- a/src/soc/mediatek/mt8192/mt6315.c +++ b/src/soc/mediatek/mt8192/mt6315.c @@ -1,13 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0-only */ -#include <assert.h> -#include <console/console.h> -#include <delay.h> -#include <soc/pmif.h> #include <soc/mt6315.h> -static struct pmif *pmif_arb = NULL; - static const struct mt6315_setting init_setting_cpu[] = { /* disable magic key protection */ {0x3A9, 0x63, 0xFF, 0}, @@ -194,35 +188,7 @@ static const struct mt6315_setting init_setting_gpu[] = { {0x3A9, 0, 0xFF, 0}, }; -static void mt6315_read(u32 slvid, u32 reg, u32 *data) -{ - pmif_arb->read(pmif_arb, slvid, reg, data); -} - -static void mt6315_write(u32 slvid, u32 reg, u32 data) -{ - pmif_arb->write(pmif_arb, slvid, reg, data); -} - -static void mt6315_write_field(u32 slvid, u32 reg, u32 val, u32 mask, u32 shift) -{ - pmif_arb->write_field(pmif_arb, slvid, reg, val, mask, shift); -} - -static void mt6315_wdt_enable(u32 slvid) -{ - mt6315_write(slvid, 0x3A9, 0x63); - mt6315_write(slvid, 0x3A8, 0x15); - mt6315_write(slvid, 0x127, 0x2); - mt6315_write(slvid, 0x127, 0x1); - mt6315_write(slvid, 0x127, 0x8); - udelay(50); - mt6315_write(slvid, 0x128, 0x8); - mt6315_write(slvid, 0x3A8, 0); - mt6315_write(slvid, 0x3A9, 0); -} - -static void mt6315_init_setting(void) +void mt6315_init_setting(void) { for (int i = 0; i < ARRAY_SIZE(init_setting_cpu); i++) mt6315_write_field(MT6315_CPU, @@ -234,69 +200,3 @@ static void mt6315_init_setting(void) init_setting_gpu[i].addr, init_setting_gpu[i].val, init_setting_gpu[i].mask, init_setting_gpu[i].shift); } - -void mt6315_buck_set_voltage(u32 slvid, u32 buck_id, u32 buck_uv) -{ - unsigned int vol_reg, vol_val; - - if (!pmif_arb) - die("ERROR: pmif_arb not initialized"); - - switch (buck_id) { - case MT6315_BUCK_1: - vol_reg = MT6315_BUCK_TOP_ELR0; - break; - case MT6315_BUCK_3: - vol_reg = MT6315_BUCK_TOP_ELR3; - break; - default: - die("ERROR: Unknown buck_id %u", buck_id); - return; - }; - - vol_val = buck_uv / 6250; - mt6315_write(slvid, vol_reg, vol_val); -} - -u32 mt6315_buck_get_voltage(u32 slvid, u32 buck_id) -{ - u32 vol_reg, vol; - - if (!pmif_arb) - die("ERROR: pmif_arb not initialized"); - - switch (buck_id) { - case MT6315_BUCK_1: - vol_reg = MT6315_BUCK_VBUCK1_DBG0; - break; - case MT6315_BUCK_3: - vol_reg = MT6315_BUCK_VBUCK1_DBG3; - break; - default: - die("ERROR: Unknown buck_id %u", buck_id); - return 0; - }; - - mt6315_read(slvid, vol_reg, &vol); - return vol * 6250; -} - -static void init_pmif_arb(void) -{ - if (!pmif_arb) { - pmif_arb = get_pmif_controller(PMIF_SPMI, 0); - if (!pmif_arb) - die("ERROR: No spmi device"); - } - - if (pmif_arb->is_pmif_init_done(pmif_arb)) - die("ERROR - Failed to initialize pmif spmi"); -} - -void mt6315_init(void) -{ - init_pmif_arb(); - mt6315_wdt_enable(MT6315_CPU); - mt6315_wdt_enable(MT6315_GPU); - mt6315_init_setting(); -} |