0036-soc-mediatek-PMIC-wrap-SPI_WRITE-needs-a-different-b.patch 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. From 511e697282c6425950b95373ac8dc59a42fd2485 Mon Sep 17 00:00:00 2001
  2. From: John Crispin <blogic@openwrt.org>
  3. Date: Wed, 20 Jan 2016 10:21:42 +0100
  4. Subject: [PATCH 036/102] soc: mediatek: PMIC wrap: SPI_WRITE needs a
  5. different bitmask for MT2701/7623
  6. Different SoCs will use different bitmask for the SPI_WRITE command. This
  7. patch defines the bitmask in the pmic_wrapper_type struct. This allows us
  8. to support new SoCs with a different bitmask to the one currently used.
  9. Signed-off-by: John Crispin <blogic@openwrt.org>
  10. ---
  11. drivers/soc/mediatek/mtk-pmic-wrap.c | 11 +++++++----
  12. 1 file changed, 7 insertions(+), 4 deletions(-)
  13. --- a/drivers/soc/mediatek/mtk-pmic-wrap.c
  14. +++ b/drivers/soc/mediatek/mtk-pmic-wrap.c
  15. @@ -372,6 +372,7 @@ struct pmic_wrapper_type {
  16. enum pwrap_type type;
  17. u32 arb_en_all;
  18. u32 int_en_all;
  19. + u32 spi_w;
  20. int (*init_reg_clock)(struct pmic_wrapper *wrp);
  21. int (*init_soc_specific)(struct pmic_wrapper *wrp);
  22. };
  23. @@ -511,15 +512,15 @@ static int pwrap_reset_spislave(struct p
  24. pwrap_writel(wrp, 1, PWRAP_MAN_EN);
  25. pwrap_writel(wrp, 0, PWRAP_DIO_EN);
  26. - pwrap_writel(wrp, PWRAP_MAN_CMD_SPI_WRITE | PWRAP_MAN_CMD_OP_CSL,
  27. + pwrap_writel(wrp, wrp->master->spi_w | PWRAP_MAN_CMD_OP_CSL,
  28. PWRAP_MAN_CMD);
  29. - pwrap_writel(wrp, PWRAP_MAN_CMD_SPI_WRITE | PWRAP_MAN_CMD_OP_OUTS,
  30. + pwrap_writel(wrp, wrp->master->spi_w | PWRAP_MAN_CMD_OP_OUTS,
  31. PWRAP_MAN_CMD);
  32. - pwrap_writel(wrp, PWRAP_MAN_CMD_SPI_WRITE | PWRAP_MAN_CMD_OP_CSH,
  33. + pwrap_writel(wrp, wrp->master->spi_w | PWRAP_MAN_CMD_OP_CSH,
  34. PWRAP_MAN_CMD);
  35. for (i = 0; i < 4; i++)
  36. - pwrap_writel(wrp, PWRAP_MAN_CMD_SPI_WRITE | PWRAP_MAN_CMD_OP_OUTS,
  37. + pwrap_writel(wrp, wrp->master->spi_w | PWRAP_MAN_CMD_OP_OUTS,
  38. PWRAP_MAN_CMD);
  39. ret = pwrap_wait_for_state(wrp, pwrap_is_sync_idle);
  40. @@ -827,6 +828,7 @@ static struct pmic_wrapper_type pwrap_mt
  41. .type = PWRAP_MT8135,
  42. .arb_en_all = 0x1ff,
  43. .int_en_all = ~(BIT(31) | BIT(1)),
  44. + .spi_w = PWRAP_MAN_CMD_SPI_WRITE,
  45. .init_reg_clock = pwrap_mt8135_init_reg_clock,
  46. .init_soc_specific = pwrap_mt8135_init_soc_specific,
  47. };
  48. @@ -836,6 +838,7 @@ static struct pmic_wrapper_type pwrap_mt
  49. .type = PWRAP_MT8173,
  50. .arb_en_all = 0x3f,
  51. .int_en_all = ~(BIT(31) | BIT(1)),
  52. + .spi_w = PWRAP_MAN_CMD_SPI_WRITE,
  53. .init_reg_clock = pwrap_mt8173_init_reg_clock,
  54. .init_soc_specific = pwrap_mt8173_init_soc_specific,
  55. };