0040-soc-mediatek-PMIC-wrap-add-mt6323-slave-support.patch 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. From 4418ba9a0bb105f00259d10ceb16f9e27199e9b0 Mon Sep 17 00:00:00 2001
  2. From: John Crispin <[email protected]>
  3. Date: Wed, 20 Jan 2016 11:40:43 +0100
  4. Subject: [PATCH 040/102] soc: mediatek: PMIC wrap: add mt6323 slave support
  5. Add support for MT6323 slaves. This PMIC can be found on MT2701 and MT7623
  6. EVB. The only function that we need to touch is pwrap_init_cipher().
  7. Signed-off-by: John Crispin <[email protected]>
  8. ---
  9. drivers/soc/mediatek/mtk-pmic-wrap.c | 43 ++++++++++++++++++++++++++++++++++
  10. 1 file changed, 43 insertions(+)
  11. diff --git a/drivers/soc/mediatek/mtk-pmic-wrap.c b/drivers/soc/mediatek/mtk-pmic-wrap.c
  12. index bcc841e..0e4ebb8 100644
  13. --- a/drivers/soc/mediatek/mtk-pmic-wrap.c
  14. +++ b/drivers/soc/mediatek/mtk-pmic-wrap.c
  15. @@ -93,6 +93,27 @@ enum dew_regs {
  16. PWRAP_DEW_EVENT_TEST,
  17. PWRAP_DEW_CIPHER_LOAD,
  18. PWRAP_DEW_CIPHER_START,
  19. +
  20. + /* MT6323 only regs */
  21. + PWRAP_DEW_CIPHER_EN,
  22. + PWRAP_DEW_RDDMY_NO,
  23. +};
  24. +
  25. +static const u32 mt6323_regs[] = {
  26. + [PWRAP_DEW_BASE] = 0x0000,
  27. + [PWRAP_DEW_DIO_EN] = 0x018a,
  28. + [PWRAP_DEW_READ_TEST] = 0x018c,
  29. + [PWRAP_DEW_WRITE_TEST] = 0x018e,
  30. + [PWRAP_DEW_CRC_EN] = 0x0192,
  31. + [PWRAP_DEW_CRC_VAL] = 0x0194,
  32. + [PWRAP_DEW_MON_GRP_SEL] = 0x0196,
  33. + [PWRAP_DEW_CIPHER_KEY_SEL] = 0x0198,
  34. + [PWRAP_DEW_CIPHER_IV_SEL] = 0x019a,
  35. + [PWRAP_DEW_CIPHER_EN] = 0x019c,
  36. + [PWRAP_DEW_CIPHER_RDY] = 0x019e,
  37. + [PWRAP_DEW_CIPHER_MODE] = 0x01a0,
  38. + [PWRAP_DEW_CIPHER_SWRST] = 0x01a2,
  39. + [PWRAP_DEW_RDDMY_NO] = 0x01a4,
  40. };
  41. static const u32 mt6397_regs[] = {
  42. @@ -371,6 +392,7 @@ static int mt8135_regs[] = {
  43. };
  44. enum pmic_type {
  45. + PMIC_MT6323,
  46. PMIC_MT6397,
  47. };
  48. @@ -661,6 +683,19 @@ static int pwrap_init_cipher(struct pmic_wrapper *wrp)
  49. pwrap_write(wrp, wrp->slave->dew_regs[PWRAP_DEW_CIPHER_LOAD], 0x1);
  50. pwrap_write(wrp, wrp->slave->dew_regs[PWRAP_DEW_CIPHER_START], 0x1);
  51. + switch (wrp->slave->type) {
  52. + case PMIC_MT6397:
  53. + pwrap_write(wrp, wrp->slave->dew_regs[PWRAP_DEW_CIPHER_LOAD],
  54. + 0x1);
  55. + pwrap_write(wrp, wrp->slave->dew_regs[PWRAP_DEW_CIPHER_START],
  56. + 0x1);
  57. + break;
  58. + case PMIC_MT6323:
  59. + pwrap_write(wrp, wrp->slave->dew_regs[PWRAP_DEW_CIPHER_EN],
  60. + 0x1);
  61. + break;
  62. + }
  63. +
  64. /* wait for cipher data ready@AP */
  65. ret = pwrap_wait_for_state(wrp, pwrap_is_cipher_ready);
  66. if (ret) {
  67. @@ -858,6 +893,11 @@ static const struct regmap_config pwrap_regmap_config = {
  68. .max_register = 0xffff,
  69. };
  70. +static const struct pwrap_slv_type pmic_mt6323 = {
  71. + .dew_regs = mt6323_regs,
  72. + .type = PMIC_MT6323,
  73. +};
  74. +
  75. static const struct pwrap_slv_type pmic_mt6397 = {
  76. .dew_regs = mt6397_regs,
  77. .type = PMIC_MT6397,
  78. @@ -865,6 +905,9 @@ static const struct pwrap_slv_type pmic_mt6397 = {
  79. static const struct of_device_id of_slave_match_tbl[] = {
  80. {
  81. + .compatible = "mediatek,mt6323",
  82. + .data = &pmic_mt6323,
  83. + }, {
  84. .compatible = "mediatek,mt6397",
  85. .data = &pmic_mt6397,
  86. }, {
  87. --
  88. 1.7.10.4