diff options
author | John Crispin <blogic@openwrt.org> | 2016-02-19 03:44:14 -0500 |
---|---|---|
committer | Matthias Brugger <matthias.bgg@gmail.com> | 2016-04-20 07:03:05 -0400 |
commit | 5ae48040aa479e9bb4f2e4630867725edca1a1c3 (patch) | |
tree | 21338aced5ed87b5ff4a9ce58a4d7e30d154147b | |
parent | b28d78cd1812e4c65063ff6db9c7f4ab213e75d8 (diff) |
soc: mediatek: PMIC wrap: add mt6323 slave support
Add support for MT6323 slaves. This PMIC can be found on MT2701 and MT7623
EVB. The only function that we need to touch is pwrap_init_cipher().
Signed-off-by: John Crispin <blogic@openwrt.org>
Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
-rw-r--r-- | drivers/soc/mediatek/mtk-pmic-wrap.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/drivers/soc/mediatek/mtk-pmic-wrap.c b/drivers/soc/mediatek/mtk-pmic-wrap.c index bcc841ebbdc3..0e4ebb84ee7f 100644 --- a/drivers/soc/mediatek/mtk-pmic-wrap.c +++ b/drivers/soc/mediatek/mtk-pmic-wrap.c | |||
@@ -93,6 +93,27 @@ enum dew_regs { | |||
93 | PWRAP_DEW_EVENT_TEST, | 93 | PWRAP_DEW_EVENT_TEST, |
94 | PWRAP_DEW_CIPHER_LOAD, | 94 | PWRAP_DEW_CIPHER_LOAD, |
95 | PWRAP_DEW_CIPHER_START, | 95 | PWRAP_DEW_CIPHER_START, |
96 | |||
97 | /* MT6323 only regs */ | ||
98 | PWRAP_DEW_CIPHER_EN, | ||
99 | PWRAP_DEW_RDDMY_NO, | ||
100 | }; | ||
101 | |||
102 | static const u32 mt6323_regs[] = { | ||
103 | [PWRAP_DEW_BASE] = 0x0000, | ||
104 | [PWRAP_DEW_DIO_EN] = 0x018a, | ||
105 | [PWRAP_DEW_READ_TEST] = 0x018c, | ||
106 | [PWRAP_DEW_WRITE_TEST] = 0x018e, | ||
107 | [PWRAP_DEW_CRC_EN] = 0x0192, | ||
108 | [PWRAP_DEW_CRC_VAL] = 0x0194, | ||
109 | [PWRAP_DEW_MON_GRP_SEL] = 0x0196, | ||
110 | [PWRAP_DEW_CIPHER_KEY_SEL] = 0x0198, | ||
111 | [PWRAP_DEW_CIPHER_IV_SEL] = 0x019a, | ||
112 | [PWRAP_DEW_CIPHER_EN] = 0x019c, | ||
113 | [PWRAP_DEW_CIPHER_RDY] = 0x019e, | ||
114 | [PWRAP_DEW_CIPHER_MODE] = 0x01a0, | ||
115 | [PWRAP_DEW_CIPHER_SWRST] = 0x01a2, | ||
116 | [PWRAP_DEW_RDDMY_NO] = 0x01a4, | ||
96 | }; | 117 | }; |
97 | 118 | ||
98 | static const u32 mt6397_regs[] = { | 119 | static const u32 mt6397_regs[] = { |
@@ -371,6 +392,7 @@ static int mt8135_regs[] = { | |||
371 | }; | 392 | }; |
372 | 393 | ||
373 | enum pmic_type { | 394 | enum pmic_type { |
395 | PMIC_MT6323, | ||
374 | PMIC_MT6397, | 396 | PMIC_MT6397, |
375 | }; | 397 | }; |
376 | 398 | ||
@@ -661,6 +683,19 @@ static int pwrap_init_cipher(struct pmic_wrapper *wrp) | |||
661 | pwrap_write(wrp, wrp->slave->dew_regs[PWRAP_DEW_CIPHER_LOAD], 0x1); | 683 | pwrap_write(wrp, wrp->slave->dew_regs[PWRAP_DEW_CIPHER_LOAD], 0x1); |
662 | pwrap_write(wrp, wrp->slave->dew_regs[PWRAP_DEW_CIPHER_START], 0x1); | 684 | pwrap_write(wrp, wrp->slave->dew_regs[PWRAP_DEW_CIPHER_START], 0x1); |
663 | 685 | ||
686 | switch (wrp->slave->type) { | ||
687 | case PMIC_MT6397: | ||
688 | pwrap_write(wrp, wrp->slave->dew_regs[PWRAP_DEW_CIPHER_LOAD], | ||
689 | 0x1); | ||
690 | pwrap_write(wrp, wrp->slave->dew_regs[PWRAP_DEW_CIPHER_START], | ||
691 | 0x1); | ||
692 | break; | ||
693 | case PMIC_MT6323: | ||
694 | pwrap_write(wrp, wrp->slave->dew_regs[PWRAP_DEW_CIPHER_EN], | ||
695 | 0x1); | ||
696 | break; | ||
697 | } | ||
698 | |||
664 | /* wait for cipher data ready@AP */ | 699 | /* wait for cipher data ready@AP */ |
665 | ret = pwrap_wait_for_state(wrp, pwrap_is_cipher_ready); | 700 | ret = pwrap_wait_for_state(wrp, pwrap_is_cipher_ready); |
666 | if (ret) { | 701 | if (ret) { |
@@ -858,6 +893,11 @@ static const struct regmap_config pwrap_regmap_config = { | |||
858 | .max_register = 0xffff, | 893 | .max_register = 0xffff, |
859 | }; | 894 | }; |
860 | 895 | ||
896 | static const struct pwrap_slv_type pmic_mt6323 = { | ||
897 | .dew_regs = mt6323_regs, | ||
898 | .type = PMIC_MT6323, | ||
899 | }; | ||
900 | |||
861 | static const struct pwrap_slv_type pmic_mt6397 = { | 901 | static const struct pwrap_slv_type pmic_mt6397 = { |
862 | .dew_regs = mt6397_regs, | 902 | .dew_regs = mt6397_regs, |
863 | .type = PMIC_MT6397, | 903 | .type = PMIC_MT6397, |
@@ -865,6 +905,9 @@ static const struct pwrap_slv_type pmic_mt6397 = { | |||
865 | 905 | ||
866 | static const struct of_device_id of_slave_match_tbl[] = { | 906 | static const struct of_device_id of_slave_match_tbl[] = { |
867 | { | 907 | { |
908 | .compatible = "mediatek,mt6323", | ||
909 | .data = &pmic_mt6323, | ||
910 | }, { | ||
868 | .compatible = "mediatek,mt6397", | 911 | .compatible = "mediatek,mt6397", |
869 | .data = &pmic_mt6397, | 912 | .data = &pmic_mt6397, |
870 | }, { | 913 | }, { |