1 From 8f3597ca8c8a28d2501d03643569f0cea920c24d Mon Sep 17 00:00:00 2001
2 From: John Crispin <blogic@openwrt.org>
3 Date: Wed, 20 Jan 2016 11:40:43 +0100
4 Subject: [PATCH 40/81] soc: mediatek: PMIC wrap: add mt6323 slave support
6 Add support for MT6323 slaves. This PMIC can be found on MT2701 and MT7623
7 EVB. The only function that we need to touch is pwrap_init_cipher().
9 Signed-off-by: John Crispin <blogic@openwrt.org>
11 drivers/soc/mediatek/mtk-pmic-wrap.c | 43 ++++++++++++++++++++++++++++++++++
12 1 file changed, 43 insertions(+)
14 --- a/drivers/soc/mediatek/mtk-pmic-wrap.c
15 +++ b/drivers/soc/mediatek/mtk-pmic-wrap.c
16 @@ -93,6 +93,27 @@ enum dew_regs {
18 PWRAP_DEW_CIPHER_LOAD,
19 PWRAP_DEW_CIPHER_START,
21 + /* MT6323 only regs */
22 + PWRAP_DEW_CIPHER_EN,
26 +static const u32 mt6323_regs[] = {
27 + [PWRAP_DEW_BASE] = 0x0000,
28 + [PWRAP_DEW_DIO_EN] = 0x018a,
29 + [PWRAP_DEW_READ_TEST] = 0x018c,
30 + [PWRAP_DEW_WRITE_TEST] = 0x018e,
31 + [PWRAP_DEW_CRC_EN] = 0x0192,
32 + [PWRAP_DEW_CRC_VAL] = 0x0194,
33 + [PWRAP_DEW_MON_GRP_SEL] = 0x0196,
34 + [PWRAP_DEW_CIPHER_KEY_SEL] = 0x0198,
35 + [PWRAP_DEW_CIPHER_IV_SEL] = 0x019a,
36 + [PWRAP_DEW_CIPHER_EN] = 0x019c,
37 + [PWRAP_DEW_CIPHER_RDY] = 0x019e,
38 + [PWRAP_DEW_CIPHER_MODE] = 0x01a0,
39 + [PWRAP_DEW_CIPHER_SWRST] = 0x01a2,
40 + [PWRAP_DEW_RDDMY_NO] = 0x01a4,
43 static const u32 mt6397_regs[] = {
44 @@ -371,6 +392,7 @@ static int mt8135_regs[] = {
52 @@ -661,6 +683,19 @@ static int pwrap_init_cipher(struct pmic
53 pwrap_write(wrp, wrp->slave->dew_regs[PWRAP_DEW_CIPHER_LOAD], 0x1);
54 pwrap_write(wrp, wrp->slave->dew_regs[PWRAP_DEW_CIPHER_START], 0x1);
56 + switch (wrp->slave->type) {
58 + pwrap_write(wrp, wrp->slave->dew_regs[PWRAP_DEW_CIPHER_LOAD],
60 + pwrap_write(wrp, wrp->slave->dew_regs[PWRAP_DEW_CIPHER_START],
64 + pwrap_write(wrp, wrp->slave->dew_regs[PWRAP_DEW_CIPHER_EN],
69 /* wait for cipher data ready@AP */
70 ret = pwrap_wait_for_state(wrp, pwrap_is_cipher_ready);
72 @@ -858,6 +893,11 @@ static const struct regmap_config pwrap_
73 .max_register = 0xffff,
76 +static const struct pwrap_slv_type pmic_mt6323 = {
77 + .dew_regs = mt6323_regs,
78 + .type = PMIC_MT6323,
81 static const struct pwrap_slv_type pmic_mt6397 = {
82 .dew_regs = mt6397_regs,
84 @@ -865,6 +905,9 @@ static const struct pwrap_slv_type pmic_
86 static const struct of_device_id of_slave_match_tbl[] = {
88 + .compatible = "mediatek,mt6323",
89 + .data = &pmic_mt6323,
91 .compatible = "mediatek,mt6397",