Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

John Crispin and committed by
Matthias Brugger
5ae48040 b28d78cd

+43
+43
drivers/soc/mediatek/mtk-pmic-wrap.c
··· 93 93 PWRAP_DEW_EVENT_TEST, 94 94 PWRAP_DEW_CIPHER_LOAD, 95 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 119 static const u32 mt6397_regs[] = { ··· 392 371 }; 393 372 394 373 enum pmic_type { 374 + PMIC_MT6323, 395 375 PMIC_MT6397, 396 376 }; 397 377 ··· 683 661 pwrap_write(wrp, wrp->slave->dew_regs[PWRAP_DEW_CIPHER_LOAD], 0x1); 684 662 pwrap_write(wrp, wrp->slave->dew_regs[PWRAP_DEW_CIPHER_START], 0x1); 685 663 664 + switch (wrp->slave->type) { 665 + case PMIC_MT6397: 666 + pwrap_write(wrp, wrp->slave->dew_regs[PWRAP_DEW_CIPHER_LOAD], 667 + 0x1); 668 + pwrap_write(wrp, wrp->slave->dew_regs[PWRAP_DEW_CIPHER_START], 669 + 0x1); 670 + break; 671 + case PMIC_MT6323: 672 + pwrap_write(wrp, wrp->slave->dew_regs[PWRAP_DEW_CIPHER_EN], 673 + 0x1); 674 + break; 675 + } 676 + 686 677 /* wait for cipher data ready@AP */ 687 678 ret = pwrap_wait_for_state(wrp, pwrap_is_cipher_ready); 688 679 if (ret) { ··· 893 858 .max_register = 0xffff, 894 859 }; 895 860 861 + static const struct pwrap_slv_type pmic_mt6323 = { 862 + .dew_regs = mt6323_regs, 863 + .type = PMIC_MT6323, 864 + }; 865 + 896 866 static const struct pwrap_slv_type pmic_mt6397 = { 897 867 .dew_regs = mt6397_regs, 898 868 .type = PMIC_MT6397, ··· 905 865 906 866 static const struct of_device_id of_slave_match_tbl[] = { 907 867 { 868 + .compatible = "mediatek,mt6323", 869 + .data = &pmic_mt6323, 870 + }, { 908 871 .compatible = "mediatek,mt6397", 909 872 .data = &pmic_mt6397, 910 873 }, {