[PATCH v4 2/7] dt-bindings: msm/mdp5: Document optional TBU and TBU_RT clocks

2019-10-31 Thread kholk11
From: AngeloGioacchino Del Regno 

These two clocks aren't present in all versions of the MDP5 HW:
where present, they are needed to enable the Translation Buffer
Unit(s).

Signed-off-by: AngeloGioacchino Del Regno 
---
 Documentation/devicetree/bindings/display/msm/mdp5.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/display/msm/mdp5.txt 
b/Documentation/devicetree/bindings/display/msm/mdp5.txt
index 4e11338548aa..43d11279c925 100644
--- a/Documentation/devicetree/bindings/display/msm/mdp5.txt
+++ b/Documentation/devicetree/bindings/display/msm/mdp5.txt
@@ -76,6 +76,8 @@ Required properties:
 Optional properties:
 - clock-names: the following clocks are optional:
   * "lut"
+  * "tbu"
+  * "tbu_rt"
 
 Example:
 
-- 
2.21.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH v4 7/7] drm/msm/adreno: Add support for Adreno 510 GPU

2019-10-31 Thread kholk11
From: AngeloGioacchino Del Regno 

The Adreno 510 GPU is a stripped version of the Adreno 5xx,
found in low-end SoCs like 8x56 and 8x76, which has 256K of
GMEM, with no GPMU nor ZAP.
Also, since the Adreno 5xx part of this driver seems to be
developed with high-end Adreno GPUs in mind, and since this
is a lower end one, add a comment making clear which GPUs
which support is not implemented yet is not using the GPMU
related hw init code, so that future developers will not go
crazy with that.

By the way, the lower end Adreno GPUs with no GPMU are:
A505/A506/A510 (usually no ZAP firmware)
A508/A509/A512 (usually with ZAP firmware)

Signed-off-by: AngeloGioacchino Del Regno 
---
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c  | 73 +-
 drivers/gpu/drm/msm/adreno/a5xx_power.c|  7 +++
 drivers/gpu/drm/msm/adreno/adreno_device.c | 15 +
 drivers/gpu/drm/msm/adreno/adreno_gpu.h|  5 ++
 4 files changed, 86 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c 
b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
index 7fdc9e2bcaac..b02e2042547f 100644
--- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
@@ -353,6 +353,9 @@ static int a5xx_me_init(struct msm_gpu *gpu)
 * 2D mode 3 draw
 */
OUT_RING(ring, 0x000B);
+   } else if (adreno_is_a510(adreno_gpu)) {
+   /* Workaround for token and syncs */
+   OUT_RING(ring, 0x0001);
} else {
/* No workarounds enabled */
OUT_RING(ring, 0x);
@@ -568,15 +571,24 @@ static int a5xx_hw_init(struct msm_gpu *gpu)
0x0010 + adreno_gpu->gmem - 1);
gpu_write(gpu, REG_A5XX_UCHE_GMEM_RANGE_MAX_HI, 0x);
 
-   gpu_write(gpu, REG_A5XX_CP_MEQ_THRESHOLDS, 0x40);
-   if (adreno_is_a530(adreno_gpu))
-   gpu_write(gpu, REG_A5XX_CP_MERCIU_SIZE, 0x40);
-   if (adreno_is_a540(adreno_gpu))
-   gpu_write(gpu, REG_A5XX_CP_MERCIU_SIZE, 0x400);
-   gpu_write(gpu, REG_A5XX_CP_ROQ_THRESHOLDS_2, 0x8060);
-   gpu_write(gpu, REG_A5XX_CP_ROQ_THRESHOLDS_1, 0x40201B16);
-
-   gpu_write(gpu, REG_A5XX_PC_DBG_ECO_CNTL, (0x400 << 11 | 0x300 << 22));
+   if (adreno_is_a510(adreno_gpu)) {
+   gpu_write(gpu, REG_A5XX_CP_MEQ_THRESHOLDS, 0x20);
+   gpu_write(gpu, REG_A5XX_CP_MERCIU_SIZE, 0x20);
+   gpu_write(gpu, REG_A5XX_CP_ROQ_THRESHOLDS_2, 0x4030);
+   gpu_write(gpu, REG_A5XX_CP_ROQ_THRESHOLDS_1, 0x20100D0A);
+   gpu_write(gpu, REG_A5XX_PC_DBG_ECO_CNTL,
+ (0x200 << 11 | 0x200 << 22));
+   } else {
+   gpu_write(gpu, REG_A5XX_CP_MEQ_THRESHOLDS, 0x40);
+   if (adreno_is_a530(adreno_gpu))
+   gpu_write(gpu, REG_A5XX_CP_MERCIU_SIZE, 0x40);
+   if (adreno_is_a540(adreno_gpu))
+   gpu_write(gpu, REG_A5XX_CP_MERCIU_SIZE, 0x400);
+   gpu_write(gpu, REG_A5XX_CP_ROQ_THRESHOLDS_2, 0x8060);
+   gpu_write(gpu, REG_A5XX_CP_ROQ_THRESHOLDS_1, 0x40201B16);
+   gpu_write(gpu, REG_A5XX_PC_DBG_ECO_CNTL,
+ (0x400 << 11 | 0x300 << 22));
+   }
 
if (adreno_gpu->info->quirks & ADRENO_QUIRK_TWO_PASS_USE_WFI)
gpu_rmw(gpu, REG_A5XX_PC_DBG_ECO_CNTL, 0, (1 << 8));
@@ -589,6 +601,19 @@ static int a5xx_hw_init(struct msm_gpu *gpu)
/* Enable ME/PFP split notification */
gpu_write(gpu, REG_A5XX_RBBM_AHB_CNTL1, 0xA6FF);
 
+   /*
+*  In A5x, CCU can send context_done event of a particular context to
+*  UCHE which ultimately reaches CP even when there is valid
+*  transaction of that context inside CCU. This can let CP to program
+*  config registers, which will make the "valid transaction" inside
+*  CCU to be interpreted differently. This can cause gpu fault. This
+*  bug is fixed in latest A510 revision. To enable this bug fix -
+*  bit[11] of RB_DBG_ECO_CNTL need to be set to 0, default is 1
+*  (disable). For older A510 version this bit is unused.
+*/
+   if (adreno_is_a510(adreno_gpu))
+   gpu_rmw(gpu, REG_A5XX_RB_DBG_ECO_CNTL, (1 << 11), 0);
+
/* Enable HWCG */
a5xx_set_hwcg(gpu, true);
 
@@ -635,7 +660,7 @@ static int a5xx_hw_init(struct msm_gpu *gpu)
/* UCHE */
gpu_write(gpu, REG_A5XX_CP_PROTECT(16), ADRENO_PROTECT_RW(0xE80, 16));
 
-   if (adreno_is_a530(adreno_gpu))
+   if (adreno_is_a530(adreno_gpu) || adreno_is_a510(adreno_gpu))
gpu_write(gpu, REG_A5XX_CP_PROTECT(17),
ADRENO_PROTECT_RW(0x1, 0x8000));
 
@@ -679,7 +704,8 @@ static int a5xx_hw_init(struct msm_gpu *gpu)
 
a5xx_preempt_hw_init(gpu);
 
-   a5xx_gpmu_ucode_init(gpu);
+   if (!adreno_is_a510(adreno_gpu))
+   

[PATCH v4 0/7] DRM/MSM: Add support for MSM8956 and Adreno 510

2019-10-31 Thread kholk11
From: AngeloGioacchino Del Regno 

This patch series enables support for MSM8956/76 and its Adreno 510
GPU on the current DRM driver.

The personal aim is to upstream MSM8956 as much as possible.

This code has been tested on two Sony phones featuring the Qualcomm
MSM8956 SoC.

Changes in v2:
- MDP5: Documented tbu and tbu_rt clocks (Jeffrey)
- Adreno510:
  - Lower case hex where required (Jordan)
  - Direct register writes (Jordan)
  - Used gpu_rmw() where required (Jordan)
  - No mentioning of unsupported A5xx (Jordan)
  - ZAP firmware exclusions not per-model (Rob)

Changes in v3:
- Rebased onto linux-next 20191015
- Renamed MSM8x56 references to MSM8x76 (the reason is that I am
  using the 8976/8x76 name for all the other drivers. Also, the
  8976 and 8956 chips are equal and the only changing part is
  the CPU big cores count)
- Splitted dt-bindings modifications as per request (Sean)

Changes in v4:
- Fixed io_start for the secondary dsi phy on family-b

AngeloGioacchino Del Regno (7):
  drm/msm/mdp5: Add optional TBU and TBU_RT clocks
  dt-bindings: msm/mdp5: Document optional TBU and TBU_RT clocks
  drm/msm/mdp5: Add configuration for msm8x76
  drm/msm/dsi: Add configuration for 28nm PLL on family B
  dt-bindings: msm/dsi: Add 28nm PLL for family B compatible
  drm/msm/dsi: Add configuration for 8x76
  drm/msm/adreno: Add support for Adreno 510 GPU

 .../devicetree/bindings/display/msm/dsi.txt   |  1 +
 .../devicetree/bindings/display/msm/mdp5.txt  |  2 +
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 73 +++---
 drivers/gpu/drm/msm/adreno/a5xx_power.c   |  7 ++
 drivers/gpu/drm/msm/adreno/adreno_device.c| 15 +++
 drivers/gpu/drm/msm/adreno/adreno_gpu.h   |  5 +
 drivers/gpu/drm/msm/disp/mdp5/mdp5_cfg.c  | 98 +++
 drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c  | 10 ++
 drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.h  |  2 +
 drivers/gpu/drm/msm/dsi/dsi_cfg.c | 22 +
 drivers/gpu/drm/msm/dsi/dsi_cfg.h |  1 +
 drivers/gpu/drm/msm/dsi/phy/dsi_phy.c |  2 +
 drivers/gpu/drm/msm/dsi/phy/dsi_phy.h |  1 +
 drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c| 18 
 14 files changed, 243 insertions(+), 14 deletions(-)

-- 
2.21.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH v4 3/7] drm/msm/mdp5: Add configuration for msm8x76

2019-10-31 Thread kholk11
From: AngeloGioacchino Del Regno 

Add the configuration entries for the MDP5 v1.11, found on
MSM8956, MSM8976 and APQ variants.

Signed-off-by: AngeloGioacchino Del Regno 
---
 drivers/gpu/drm/msm/disp/mdp5/mdp5_cfg.c | 98 
 1 file changed, 98 insertions(+)

diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_cfg.c 
b/drivers/gpu/drm/msm/disp/mdp5/mdp5_cfg.c
index 7c9c1ddae821..1f48f64539a2 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_cfg.c
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_cfg.c
@@ -545,6 +545,103 @@ static const struct mdp5_cfg_hw msm8x96_config = {
.max_clk = 41250,
 };
 
+const struct mdp5_cfg_hw msm8x76_config = {
+   .name = "msm8x76",
+   .mdp = {
+   .count = 1,
+   .caps = MDP_CAP_SMP |
+   MDP_CAP_DSC |
+   MDP_CAP_SRC_SPLIT |
+   0,
+   },
+   .ctl = {
+   .count = 3,
+   .base = { 0x01000, 0x01200, 0x01400 },
+   .flush_hw_mask = 0x,
+   },
+   .smp = {
+   .mmb_count = 10,
+   .mmb_size = 10240,
+   .clients = {
+   [SSPP_VIG0] = 1, [SSPP_VIG1] = 9,
+   [SSPP_DMA0] = 4,
+   [SSPP_RGB0] = 7, [SSPP_RGB1] = 8,
+   },
+   },
+   .pipe_vig = {
+   .count = 2,
+   .base = { 0x04000, 0x06000 },
+   .caps = MDP_PIPE_CAP_HFLIP  |
+   MDP_PIPE_CAP_VFLIP  |
+   MDP_PIPE_CAP_SCALE  |
+   MDP_PIPE_CAP_CSC|
+   MDP_PIPE_CAP_DECIMATION |
+   MDP_PIPE_CAP_SW_PIX_EXT |
+   0,
+   },
+   .pipe_rgb = {
+   .count = 2,
+   .base = { 0x14000, 0x16000 },
+   .caps = MDP_PIPE_CAP_HFLIP  |
+   MDP_PIPE_CAP_VFLIP  |
+   MDP_PIPE_CAP_DECIMATION |
+   MDP_PIPE_CAP_SW_PIX_EXT |
+   0,
+   },
+   .pipe_dma = {
+   .count = 1,
+   .base = { 0x24000 },
+   .caps = MDP_PIPE_CAP_HFLIP  |
+   MDP_PIPE_CAP_VFLIP  |
+   MDP_PIPE_CAP_SW_PIX_EXT |
+   0,
+   },
+   .pipe_cursor = {
+   .count = 1,
+   .base = { 0x440DC },
+   .caps = MDP_PIPE_CAP_HFLIP  |
+   MDP_PIPE_CAP_VFLIP  |
+   MDP_PIPE_CAP_SW_PIX_EXT |
+   MDP_PIPE_CAP_CURSOR |
+   0,
+   },
+   .lm = {
+   .count = 2,
+   .base = { 0x44000, 0x45000 },
+   .instances = {
+   { .id = 0, .pp = 0, .dspp = 0,
+ .caps = MDP_LM_CAP_DISPLAY, },
+   { .id = 1, .pp = -1, .dspp = -1,
+ .caps = MDP_LM_CAP_WB },
+},
+   .nb_stages = 8,
+   .max_width = 2560,
+   .max_height = 0x,
+   },
+   .dspp = {
+   .count = 1,
+   .base = { 0x54000 },
+
+   },
+   .pp = {
+   .count = 3,
+   .base = { 0x7, 0x70800, 0x72000 },
+   },
+   .dsc = {
+   .count = 2,
+   .base = { 0x8, 0x80400 },
+   },
+   .intf = {
+   .base = { 0x6a000, 0x6a800, 0x6b000 },
+   .connect = {
+   [0] = INTF_DISABLED,
+   [1] = INTF_DSI,
+   [2] = INTF_DSI,
+   },
+   },
+   .max_clk = 36000,
+};
+
 static const struct mdp5_cfg_hw msm8917_config = {
.name = "msm8917",
.mdp = {
@@ -745,6 +842,7 @@ static const struct mdp5_cfg_handler cfg_handlers_v1[] = {
{ .revision = 6, .config = { .hw = &msm8x16_config } },
{ .revision = 9, .config = { .hw = &msm8x94_config } },
{ .revision = 7, .config = { .hw = &msm8x96_config } },
+   { .revision = 11, .config = { .hw = &msm8x76_config } },
{ .revision = 15, .config = { .hw = &msm8917_config } },
 };
 
-- 
2.21.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH v4 1/7] drm/msm/mdp5: Add optional TBU and TBU_RT clocks

2019-10-31 Thread kholk11
From: AngeloGioacchino Del Regno 

Some SoCs, like MSM8956/8976 (and APQ variants), do feature these
clocks and we need to enable them in order to get both of the
hw (mdp5/rot) Translation Buffer Units (TBUs) to properly work.

Signed-off-by: AngeloGioacchino Del Regno 
---
 drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 10 ++
 drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.h |  2 ++
 2 files changed, 12 insertions(+)

diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c 
b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
index 5476892a335f..e43ecd4be10a 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
@@ -309,6 +309,10 @@ int mdp5_disable(struct mdp5_kms *mdp5_kms)
mdp5_kms->enable_count--;
WARN_ON(mdp5_kms->enable_count < 0);
 
+   if (mdp5_kms->tbu_rt_clk)
+   clk_disable_unprepare(mdp5_kms->tbu_rt_clk);
+   if (mdp5_kms->tbu_clk)
+   clk_disable_unprepare(mdp5_kms->tbu_clk);
clk_disable_unprepare(mdp5_kms->ahb_clk);
clk_disable_unprepare(mdp5_kms->axi_clk);
clk_disable_unprepare(mdp5_kms->core_clk);
@@ -329,6 +333,10 @@ int mdp5_enable(struct mdp5_kms *mdp5_kms)
clk_prepare_enable(mdp5_kms->core_clk);
if (mdp5_kms->lut_clk)
clk_prepare_enable(mdp5_kms->lut_clk);
+   if (mdp5_kms->tbu_clk)
+   clk_prepare_enable(mdp5_kms->tbu_clk);
+   if (mdp5_kms->tbu_rt_clk)
+   clk_prepare_enable(mdp5_kms->tbu_rt_clk);
 
return 0;
 }
@@ -965,6 +973,8 @@ static int mdp5_init(struct platform_device *pdev, struct 
drm_device *dev)
 
/* optional clocks: */
get_clk(pdev, &mdp5_kms->lut_clk, "lut", false);
+   get_clk(pdev, &mdp5_kms->tbu_clk, "tbu", false);
+   get_clk(pdev, &mdp5_kms->tbu_rt_clk, "tbu_rt", false);
 
/* we need to set a default rate before enabling.  Set a safe
 * rate first, then figure out hw revision, and then set a
diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.h 
b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.h
index d1bf4fdfc815..128866742593 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.h
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.h
@@ -53,6 +53,8 @@ struct mdp5_kms {
struct clk *ahb_clk;
struct clk *core_clk;
struct clk *lut_clk;
+   struct clk *tbu_clk;
+   struct clk *tbu_rt_clk;
struct clk *vsync_clk;
 
/*
-- 
2.21.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH v4 5/7] dt-bindings: msm/dsi: Add 28nm PLL for family B compatible

2019-10-31 Thread kholk11
From: AngeloGioacchino Del Regno 

On family B SoCs, the 28nm PLL has a different iospace address
and that required a new compatible in the driver.

Signed-off-by: AngeloGioacchino Del Regno 
---
 Documentation/devicetree/bindings/display/msm/dsi.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/display/msm/dsi.txt 
b/Documentation/devicetree/bindings/display/msm/dsi.txt
index af95586c898f..d3ba9ee22f38 100644
--- a/Documentation/devicetree/bindings/display/msm/dsi.txt
+++ b/Documentation/devicetree/bindings/display/msm/dsi.txt
@@ -83,6 +83,7 @@ DSI PHY:
 Required properties:
 - compatible: Could be the following
   * "qcom,dsi-phy-28nm-hpm"
+  * "qcom,dsi-phy-28nm-hpm-fam-b"
   * "qcom,dsi-phy-28nm-lp"
   * "qcom,dsi-phy-20nm"
   * "qcom,dsi-phy-28nm-8960"
-- 
2.21.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH v4 4/7] drm/msm/dsi: Add configuration for 28nm PLL on family B

2019-10-31 Thread kholk11
From: AngeloGioacchino Del Regno 

The 28nm PLL has a different iospace on MSM/APQ family B SoCs:
add a new configuration and use it when the DT reports the
"qcom,dsi-phy-28nm-hpm-fam-b" compatible.

Signed-off-by: AngeloGioacchino Del Regno 
---
 drivers/gpu/drm/msm/dsi/phy/dsi_phy.c  |  2 ++
 drivers/gpu/drm/msm/dsi/phy/dsi_phy.h  |  1 +
 drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c | 18 ++
 3 files changed, 21 insertions(+)

diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c 
b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
index aa22c3ae5230..b0cfa67d2a57 100644
--- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
+++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
@@ -483,6 +483,8 @@ static const struct of_device_id dsi_phy_dt_match[] = {
 #ifdef CONFIG_DRM_MSM_DSI_28NM_PHY
{ .compatible = "qcom,dsi-phy-28nm-hpm",
  .data = &dsi_phy_28nm_hpm_cfgs },
+   { .compatible = "qcom,dsi-phy-28nm-hpm-fam-b",
+ .data = &dsi_phy_28nm_hpm_famb_cfgs },
{ .compatible = "qcom,dsi-phy-28nm-lp",
  .data = &dsi_phy_28nm_lp_cfgs },
 #endif
diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.h 
b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.h
index c4069ce6afe6..24b294ed3059 100644
--- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.h
+++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.h
@@ -40,6 +40,7 @@ struct msm_dsi_phy_cfg {
 };
 
 extern const struct msm_dsi_phy_cfg dsi_phy_28nm_hpm_cfgs;
+extern const struct msm_dsi_phy_cfg dsi_phy_28nm_hpm_famb_cfgs;
 extern const struct msm_dsi_phy_cfg dsi_phy_28nm_lp_cfgs;
 extern const struct msm_dsi_phy_cfg dsi_phy_20nm_cfgs;
 extern const struct msm_dsi_phy_cfg dsi_phy_28nm_8960_cfgs;
diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c 
b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c
index b3f678f6c2aa..66506ea86dd6 100644
--- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c
+++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c
@@ -142,6 +142,24 @@ const struct msm_dsi_phy_cfg dsi_phy_28nm_hpm_cfgs = {
.num_dsi_phy = 2,
 };
 
+const struct msm_dsi_phy_cfg dsi_phy_28nm_hpm_famb_cfgs = {
+   .type = MSM_DSI_PHY_28NM_HPM,
+   .src_pll_truthtable = { {true, true}, {false, true} },
+   .reg_cfg = {
+   .num = 1,
+   .regs = {
+   {"vddio", 10, 100},
+   },
+   },
+   .ops = {
+   .enable = dsi_28nm_phy_enable,
+   .disable = dsi_28nm_phy_disable,
+   .init = msm_dsi_phy_init_common,
+   },
+   .io_start = { 0x1a94400, 0x1a96400 },
+   .num_dsi_phy = 2,
+};
+
 const struct msm_dsi_phy_cfg dsi_phy_28nm_lp_cfgs = {
.type = MSM_DSI_PHY_28NM_LP,
.src_pll_truthtable = { {true, true}, {true, true} },
-- 
2.21.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH v4 6/7] drm/msm/dsi: Add configuration for 8x76

2019-10-31 Thread kholk11
From: AngeloGioacchino Del Regno 

MSM8976, MSM8976 and APQ variants have DSI version 3:10040002
(DSI 6G V1.4.2), featuring two DSIs.
They need three clocks (mdp_core, iface, bus), one GDSC and
two vregs, VDDA at 1.2V and VDDIO at 1.8V.

Signed-off-by: AngeloGioacchino Del Regno 
---
 drivers/gpu/drm/msm/dsi/dsi_cfg.c | 22 ++
 drivers/gpu/drm/msm/dsi/dsi_cfg.h |  1 +
 2 files changed, 23 insertions(+)

diff --git a/drivers/gpu/drm/msm/dsi/dsi_cfg.c 
b/drivers/gpu/drm/msm/dsi/dsi_cfg.c
index e74dc8cc904b..86ad3fdf207d 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_cfg.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_cfg.c
@@ -66,6 +66,26 @@ static const struct msm_dsi_config msm8916_dsi_cfg = {
.num_dsi = 1,
 };
 
+static const char * const dsi_8976_bus_clk_names[] = {
+   "mdp_core", "iface", "bus",
+};
+
+static const struct msm_dsi_config msm8976_dsi_cfg = {
+   .io_offset = DSI_6G_REG_SHIFT,
+   .reg_cfg = {
+   .num = 3,
+   .regs = {
+   {"gdsc", -1, -1},
+   {"vdda", 10, 100},  /* 1.2 V */
+   {"vddio", 10, 100}, /* 1.8 V */
+   },
+   },
+   .bus_clk_names = dsi_8976_bus_clk_names,
+   .num_bus_clks = ARRAY_SIZE(dsi_8976_bus_clk_names),
+   .io_start = { 0x1a94000, 0x1a96000 },
+   .num_dsi = 2,
+};
+
 static const struct msm_dsi_config msm8994_dsi_cfg = {
.io_offset = DSI_6G_REG_SHIFT,
.reg_cfg = {
@@ -197,6 +217,8 @@ static const struct msm_dsi_cfg_handler dsi_cfg_handlers[] 
= {
&msm8916_dsi_cfg, &msm_dsi_6g_host_ops},
{MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_4_1,
&msm8996_dsi_cfg, &msm_dsi_6g_host_ops},
+   {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_4_2,
+   &msm8976_dsi_cfg, &msm_dsi_6g_host_ops},
{MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V2_2_0,
&msm8998_dsi_cfg, &msm_dsi_6g_v2_host_ops},
{MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V2_2_1,
diff --git a/drivers/gpu/drm/msm/dsi/dsi_cfg.h 
b/drivers/gpu/drm/msm/dsi/dsi_cfg.h
index e2b7a7dfbe49..50a37ceb6a25 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_cfg.h
+++ b/drivers/gpu/drm/msm/dsi/dsi_cfg.h
@@ -17,6 +17,7 @@
 #define MSM_DSI_6G_VER_MINOR_V1_3  0x1003
 #define MSM_DSI_6G_VER_MINOR_V1_3_10x10030001
 #define MSM_DSI_6G_VER_MINOR_V1_4_10x10040001
+#define MSM_DSI_6G_VER_MINOR_V1_4_20x10040002
 #define MSM_DSI_6G_VER_MINOR_V2_2_00x2000
 #define MSM_DSI_6G_VER_MINOR_V2_2_10x20020001
 
-- 
2.21.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[RESEND, v4, 2/7] dt-bindings: msm/mdp5: Document optional TBU and TBU_RT clocks

2019-11-06 Thread kholk11
From: AngeloGioacchino Del Regno 

These two clocks aren't present in all versions of the MDP5 HW:
where present, they are needed to enable the Translation Buffer
Unit(s).

Signed-off-by: AngeloGioacchino Del Regno 
Acked-by: Rob Herring 
---
 Documentation/devicetree/bindings/display/msm/mdp5.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/display/msm/mdp5.txt 
b/Documentation/devicetree/bindings/display/msm/mdp5.txt
index 4e11338548aa..43d11279c925 100644
--- a/Documentation/devicetree/bindings/display/msm/mdp5.txt
+++ b/Documentation/devicetree/bindings/display/msm/mdp5.txt
@@ -76,6 +76,8 @@ Required properties:
 Optional properties:
 - clock-names: the following clocks are optional:
   * "lut"
+  * "tbu"
+  * "tbu_rt"
 
 Example:
 
-- 
2.21.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH v3 2/7] dt-bindings: msm/mdp5: Document optional TBU and TBU_RT clocks

2019-10-15 Thread kholk11
From: AngeloGioacchino Del Regno 

These two clocks aren't present in all versions of the MDP5 HW:
where present, they are needed to enable the Translation Buffer
Unit(s).

Signed-off-by: AngeloGioacchino Del Regno 
---
 Documentation/devicetree/bindings/display/msm/mdp5.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/display/msm/mdp5.txt 
b/Documentation/devicetree/bindings/display/msm/mdp5.txt
index 4e11338548aa..43d11279c925 100644
--- a/Documentation/devicetree/bindings/display/msm/mdp5.txt
+++ b/Documentation/devicetree/bindings/display/msm/mdp5.txt
@@ -76,6 +76,8 @@ Required properties:
 Optional properties:
 - clock-names: the following clocks are optional:
   * "lut"
+  * "tbu"
+  * "tbu_rt"
 
 Example:
 
-- 
2.21.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH v3 0/7] DRM/MSM: Add support for MSM8956 and Adreno 510

2019-10-15 Thread kholk11
From: AngeloGioacchino Del Regno 

This patch series enables support for MSM8956/76 and its Adreno 510
GPU on the current DRM driver.

The personal aim is to upstream MSM8956 as much as possible.

This code has been tested on two Sony phones featuring the Qualcomm
MSM8956 SoC.

Changes in v2:
- MDP5: Documented tbu and tbu_rt clocks (Jeffrey)
- Adreno510:
  - Lower case hex where required (Jordan)
  - Direct register writes (Jordan)
  - Used gpu_rmw() where required (Jordan)
  - No mentioning of unsupported A5xx (Jordan)
  - ZAP firmware exclusions not per-model (Rob)

Changes in v3:
- Rebased onto linux-next 20191015
- Renamed MSM8x56 references to MSM8x76 (the reason is that I am
  using the 8976/8x76 name for all the other drivers. Also, the
  8976 and 8956 chips are equal and the only changing part is
  the CPU big cores count)
- Splitted dt-bindings modifications as per request (Sean)

AngeloGioacchino Del Regno (4):
  drm/msm/mdp5: Add optional TBU and TBU_RT clocks
  dt-bindings: msm/mdp5: Document optional TBU and TBU_RT clocks
  drm/msm/mdp5: Add configuration for msm8x76
  drm/msm/dsi: Add configuration for 28nm PLL on family B
  dt-bindings: msm/dsi: Add 28nm PLL for family B compatible
  drm/msm/dsi: Add configuration for 8x76
  drm/msm/adreno: Add support for Adreno 510 GPU

 .../devicetree/bindings/display/msm/dsi.txt   |  1 +
 .../devicetree/bindings/display/msm/mdp5.txt  |  2 +
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 73 +++---
 drivers/gpu/drm/msm/adreno/a5xx_power.c   |  7 ++
 drivers/gpu/drm/msm/adreno/adreno_device.c| 15 +++
 drivers/gpu/drm/msm/adreno/adreno_gpu.h   |  5 +
 drivers/gpu/drm/msm/disp/mdp5/mdp5_cfg.c  | 98 +++
 drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c  | 10 ++
 drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.h  |  2 +
 drivers/gpu/drm/msm/dsi/dsi_cfg.c | 22 +
 drivers/gpu/drm/msm/dsi/dsi_cfg.h |  1 +
 drivers/gpu/drm/msm/dsi/phy/dsi_phy.c |  2 +
 drivers/gpu/drm/msm/dsi/phy/dsi_phy.h |  1 +
 drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c| 18 
 14 files changed, 243 insertions(+), 14 deletions(-)

-- 
2.21.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH v3 7/7] drm/msm/adreno: Add support for Adreno 510 GPU

2019-10-15 Thread kholk11
From: AngeloGioacchino Del Regno 

The Adreno 510 GPU is a stripped version of the Adreno 5xx,
found in low-end SoCs like 8x56 and 8x76, which has 256K of
GMEM, with no GPMU nor ZAP.
Also, since the Adreno 5xx part of this driver seems to be
developed with high-end Adreno GPUs in mind, and since this
is a lower end one, add a comment making clear which GPUs
which support is not implemented yet is not using the GPMU
related hw init code, so that future developers will not go
crazy with that.

By the way, the lower end Adreno GPUs with no GPMU are:
A505/A506/A510 (usually no ZAP firmware)
A508/A509/A512 (usually with ZAP firmware)

Signed-off-by: AngeloGioacchino Del Regno 
---
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c  | 73 +-
 drivers/gpu/drm/msm/adreno/a5xx_power.c|  7 +++
 drivers/gpu/drm/msm/adreno/adreno_device.c | 15 +
 drivers/gpu/drm/msm/adreno/adreno_gpu.h|  5 ++
 4 files changed, 86 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c 
b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
index 7fdc9e2bcaac..b02e2042547f 100644
--- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
@@ -353,6 +353,9 @@ static int a5xx_me_init(struct msm_gpu *gpu)
 * 2D mode 3 draw
 */
OUT_RING(ring, 0x000B);
+   } else if (adreno_is_a510(adreno_gpu)) {
+   /* Workaround for token and syncs */
+   OUT_RING(ring, 0x0001);
} else {
/* No workarounds enabled */
OUT_RING(ring, 0x);
@@ -568,15 +571,24 @@ static int a5xx_hw_init(struct msm_gpu *gpu)
0x0010 + adreno_gpu->gmem - 1);
gpu_write(gpu, REG_A5XX_UCHE_GMEM_RANGE_MAX_HI, 0x);
 
-   gpu_write(gpu, REG_A5XX_CP_MEQ_THRESHOLDS, 0x40);
-   if (adreno_is_a530(adreno_gpu))
-   gpu_write(gpu, REG_A5XX_CP_MERCIU_SIZE, 0x40);
-   if (adreno_is_a540(adreno_gpu))
-   gpu_write(gpu, REG_A5XX_CP_MERCIU_SIZE, 0x400);
-   gpu_write(gpu, REG_A5XX_CP_ROQ_THRESHOLDS_2, 0x8060);
-   gpu_write(gpu, REG_A5XX_CP_ROQ_THRESHOLDS_1, 0x40201B16);
-
-   gpu_write(gpu, REG_A5XX_PC_DBG_ECO_CNTL, (0x400 << 11 | 0x300 << 22));
+   if (adreno_is_a510(adreno_gpu)) {
+   gpu_write(gpu, REG_A5XX_CP_MEQ_THRESHOLDS, 0x20);
+   gpu_write(gpu, REG_A5XX_CP_MERCIU_SIZE, 0x20);
+   gpu_write(gpu, REG_A5XX_CP_ROQ_THRESHOLDS_2, 0x4030);
+   gpu_write(gpu, REG_A5XX_CP_ROQ_THRESHOLDS_1, 0x20100D0A);
+   gpu_write(gpu, REG_A5XX_PC_DBG_ECO_CNTL,
+ (0x200 << 11 | 0x200 << 22));
+   } else {
+   gpu_write(gpu, REG_A5XX_CP_MEQ_THRESHOLDS, 0x40);
+   if (adreno_is_a530(adreno_gpu))
+   gpu_write(gpu, REG_A5XX_CP_MERCIU_SIZE, 0x40);
+   if (adreno_is_a540(adreno_gpu))
+   gpu_write(gpu, REG_A5XX_CP_MERCIU_SIZE, 0x400);
+   gpu_write(gpu, REG_A5XX_CP_ROQ_THRESHOLDS_2, 0x8060);
+   gpu_write(gpu, REG_A5XX_CP_ROQ_THRESHOLDS_1, 0x40201B16);
+   gpu_write(gpu, REG_A5XX_PC_DBG_ECO_CNTL,
+ (0x400 << 11 | 0x300 << 22));
+   }
 
if (adreno_gpu->info->quirks & ADRENO_QUIRK_TWO_PASS_USE_WFI)
gpu_rmw(gpu, REG_A5XX_PC_DBG_ECO_CNTL, 0, (1 << 8));
@@ -589,6 +601,19 @@ static int a5xx_hw_init(struct msm_gpu *gpu)
/* Enable ME/PFP split notification */
gpu_write(gpu, REG_A5XX_RBBM_AHB_CNTL1, 0xA6FF);
 
+   /*
+*  In A5x, CCU can send context_done event of a particular context to
+*  UCHE which ultimately reaches CP even when there is valid
+*  transaction of that context inside CCU. This can let CP to program
+*  config registers, which will make the "valid transaction" inside
+*  CCU to be interpreted differently. This can cause gpu fault. This
+*  bug is fixed in latest A510 revision. To enable this bug fix -
+*  bit[11] of RB_DBG_ECO_CNTL need to be set to 0, default is 1
+*  (disable). For older A510 version this bit is unused.
+*/
+   if (adreno_is_a510(adreno_gpu))
+   gpu_rmw(gpu, REG_A5XX_RB_DBG_ECO_CNTL, (1 << 11), 0);
+
/* Enable HWCG */
a5xx_set_hwcg(gpu, true);
 
@@ -635,7 +660,7 @@ static int a5xx_hw_init(struct msm_gpu *gpu)
/* UCHE */
gpu_write(gpu, REG_A5XX_CP_PROTECT(16), ADRENO_PROTECT_RW(0xE80, 16));
 
-   if (adreno_is_a530(adreno_gpu))
+   if (adreno_is_a530(adreno_gpu) || adreno_is_a510(adreno_gpu))
gpu_write(gpu, REG_A5XX_CP_PROTECT(17),
ADRENO_PROTECT_RW(0x1, 0x8000));
 
@@ -679,7 +704,8 @@ static int a5xx_hw_init(struct msm_gpu *gpu)
 
a5xx_preempt_hw_init(gpu);
 
-   a5xx_gpmu_ucode_init(gpu);
+   if (!adreno_is_a510(adreno_gpu))
+   

[PATCH v3 6/7] drm/msm/dsi: Add configuration for 8x76

2019-10-15 Thread kholk11
From: AngeloGioacchino Del Regno 

MSM8976, MSM8976 and APQ variants have DSI version 3:10040002
(DSI 6G V1.4.2), featuring two DSIs.
They need three clocks (mdp_core, iface, bus), one GDSC and
two vregs, VDDA at 1.2V and VDDIO at 1.8V.

Signed-off-by: AngeloGioacchino Del Regno 
---
 drivers/gpu/drm/msm/dsi/dsi_cfg.c | 22 ++
 drivers/gpu/drm/msm/dsi/dsi_cfg.h |  1 +
 2 files changed, 23 insertions(+)

diff --git a/drivers/gpu/drm/msm/dsi/dsi_cfg.c 
b/drivers/gpu/drm/msm/dsi/dsi_cfg.c
index e74dc8cc904b..8364c2dc3f37 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_cfg.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_cfg.c
@@ -66,6 +66,26 @@ static const struct msm_dsi_config msm8916_dsi_cfg = {
.num_dsi = 1,
 };
 
+static const char * const dsi_8976_bus_clk_names[] = {
+   "mdp_core", "iface", "bus",
+};
+
+static const struct msm_dsi_config msm8976_dsi_cfg = {
+   .io_offset = DSI_6G_REG_SHIFT,
+   .reg_cfg = {
+   .num = 3,
+   .regs = {
+   {"gdsc", -1, -1},
+   {"vdda", 10, 100},  /* 1.2 V */
+   {"vddio", 10, 100}, /* 1.8 V */
+   },
+   },
+   .bus_clk_names = dsi_8976_bus_clk_names,
+   .num_bus_clks = ARRAY_SIZE(dsi_8976_bus_clk_names),
+   .io_start = { 0x1a94000, 0x1a96000 },
+   .num_dsi = 2,
+};
+
 static const struct msm_dsi_config msm8994_dsi_cfg = {
.io_offset = DSI_6G_REG_SHIFT,
.reg_cfg = {
@@ -197,6 +217,8 @@ static const struct msm_dsi_cfg_handler dsi_cfg_handlers[] 
= {
&msm8916_dsi_cfg, &msm_dsi_6g_host_ops},
{MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_4_1,
&msm8996_dsi_cfg, &msm_dsi_6g_host_ops},
+   {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_4_2,
+   &msm8976_dsi_cfg, &msm_dsi_6g_host_ops},
{MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V2_2_0,
&msm8998_dsi_cfg, &msm_dsi_6g_v2_host_ops},
{MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V2_2_1,
diff --git a/drivers/gpu/drm/msm/dsi/dsi_cfg.h 
b/drivers/gpu/drm/msm/dsi/dsi_cfg.h
index e2b7a7dfbe49..50a37ceb6a25 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_cfg.h
+++ b/drivers/gpu/drm/msm/dsi/dsi_cfg.h
@@ -17,6 +17,7 @@
 #define MSM_DSI_6G_VER_MINOR_V1_3  0x1003
 #define MSM_DSI_6G_VER_MINOR_V1_3_10x10030001
 #define MSM_DSI_6G_VER_MINOR_V1_4_10x10040001
+#define MSM_DSI_6G_VER_MINOR_V1_4_20x10040002
 #define MSM_DSI_6G_VER_MINOR_V2_2_00x2000
 #define MSM_DSI_6G_VER_MINOR_V2_2_10x20020001
 
-- 
2.21.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH v3 4/7] drm/msm/dsi: Add configuration for 28nm PLL on family B

2019-10-15 Thread kholk11
From: AngeloGioacchino Del Regno 

The 28nm PLL has a different iospace on MSM/APQ family B SoCs:
add a new configuration and use it when the DT reports the
"qcom,dsi-phy-28nm-hpm-fam-b" compatible.

Signed-off-by: AngeloGioacchino Del Regno 
---
 drivers/gpu/drm/msm/dsi/phy/dsi_phy.c  |  2 ++
 drivers/gpu/drm/msm/dsi/phy/dsi_phy.h  |  1 +
 drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c | 18 ++
 3 files changed, 21 insertions(+)

diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c 
b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
index aa22c3ae5230..b0cfa67d2a57 100644
--- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
+++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
@@ -483,6 +483,8 @@ static const struct of_device_id dsi_phy_dt_match[] = {
 #ifdef CONFIG_DRM_MSM_DSI_28NM_PHY
{ .compatible = "qcom,dsi-phy-28nm-hpm",
  .data = &dsi_phy_28nm_hpm_cfgs },
+   { .compatible = "qcom,dsi-phy-28nm-hpm-fam-b",
+ .data = &dsi_phy_28nm_hpm_famb_cfgs },
{ .compatible = "qcom,dsi-phy-28nm-lp",
  .data = &dsi_phy_28nm_lp_cfgs },
 #endif
diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.h 
b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.h
index c4069ce6afe6..24b294ed3059 100644
--- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.h
+++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.h
@@ -40,6 +40,7 @@ struct msm_dsi_phy_cfg {
 };
 
 extern const struct msm_dsi_phy_cfg dsi_phy_28nm_hpm_cfgs;
+extern const struct msm_dsi_phy_cfg dsi_phy_28nm_hpm_famb_cfgs;
 extern const struct msm_dsi_phy_cfg dsi_phy_28nm_lp_cfgs;
 extern const struct msm_dsi_phy_cfg dsi_phy_20nm_cfgs;
 extern const struct msm_dsi_phy_cfg dsi_phy_28nm_8960_cfgs;
diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c 
b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c
index b3f678f6c2aa..3b9300545e16 100644
--- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c
+++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c
@@ -142,6 +142,24 @@ const struct msm_dsi_phy_cfg dsi_phy_28nm_hpm_cfgs = {
.num_dsi_phy = 2,
 };
 
+const struct msm_dsi_phy_cfg dsi_phy_28nm_hpm_famb_cfgs = {
+   .type = MSM_DSI_PHY_28NM_HPM,
+   .src_pll_truthtable = { {true, true}, {false, true} },
+   .reg_cfg = {
+   .num = 1,
+   .regs = {
+   {"vddio", 10, 100},
+   },
+   },
+   .ops = {
+   .enable = dsi_28nm_phy_enable,
+   .disable = dsi_28nm_phy_disable,
+   .init = msm_dsi_phy_init_common,
+   },
+   .io_start = { 0x1a94400, 0x1a94800 },
+   .num_dsi_phy = 2,
+};
+
 const struct msm_dsi_phy_cfg dsi_phy_28nm_lp_cfgs = {
.type = MSM_DSI_PHY_28NM_LP,
.src_pll_truthtable = { {true, true}, {true, true} },
-- 
2.21.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH v3 3/7] drm/msm/mdp5: Add configuration for msm8x76

2019-10-15 Thread kholk11
From: AngeloGioacchino Del Regno 

Add the configuration entries for the MDP5 v1.11, found on
MSM8956, MSM8976 and APQ variants.

Signed-off-by: AngeloGioacchino Del Regno 
---
 drivers/gpu/drm/msm/disp/mdp5/mdp5_cfg.c | 98 
 1 file changed, 98 insertions(+)

diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_cfg.c 
b/drivers/gpu/drm/msm/disp/mdp5/mdp5_cfg.c
index 7c9c1ddae821..1f48f64539a2 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_cfg.c
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_cfg.c
@@ -545,6 +545,103 @@ static const struct mdp5_cfg_hw msm8x96_config = {
.max_clk = 41250,
 };
 
+const struct mdp5_cfg_hw msm8x76_config = {
+   .name = "msm8x76",
+   .mdp = {
+   .count = 1,
+   .caps = MDP_CAP_SMP |
+   MDP_CAP_DSC |
+   MDP_CAP_SRC_SPLIT |
+   0,
+   },
+   .ctl = {
+   .count = 3,
+   .base = { 0x01000, 0x01200, 0x01400 },
+   .flush_hw_mask = 0x,
+   },
+   .smp = {
+   .mmb_count = 10,
+   .mmb_size = 10240,
+   .clients = {
+   [SSPP_VIG0] = 1, [SSPP_VIG1] = 9,
+   [SSPP_DMA0] = 4,
+   [SSPP_RGB0] = 7, [SSPP_RGB1] = 8,
+   },
+   },
+   .pipe_vig = {
+   .count = 2,
+   .base = { 0x04000, 0x06000 },
+   .caps = MDP_PIPE_CAP_HFLIP  |
+   MDP_PIPE_CAP_VFLIP  |
+   MDP_PIPE_CAP_SCALE  |
+   MDP_PIPE_CAP_CSC|
+   MDP_PIPE_CAP_DECIMATION |
+   MDP_PIPE_CAP_SW_PIX_EXT |
+   0,
+   },
+   .pipe_rgb = {
+   .count = 2,
+   .base = { 0x14000, 0x16000 },
+   .caps = MDP_PIPE_CAP_HFLIP  |
+   MDP_PIPE_CAP_VFLIP  |
+   MDP_PIPE_CAP_DECIMATION |
+   MDP_PIPE_CAP_SW_PIX_EXT |
+   0,
+   },
+   .pipe_dma = {
+   .count = 1,
+   .base = { 0x24000 },
+   .caps = MDP_PIPE_CAP_HFLIP  |
+   MDP_PIPE_CAP_VFLIP  |
+   MDP_PIPE_CAP_SW_PIX_EXT |
+   0,
+   },
+   .pipe_cursor = {
+   .count = 1,
+   .base = { 0x440DC },
+   .caps = MDP_PIPE_CAP_HFLIP  |
+   MDP_PIPE_CAP_VFLIP  |
+   MDP_PIPE_CAP_SW_PIX_EXT |
+   MDP_PIPE_CAP_CURSOR |
+   0,
+   },
+   .lm = {
+   .count = 2,
+   .base = { 0x44000, 0x45000 },
+   .instances = {
+   { .id = 0, .pp = 0, .dspp = 0,
+ .caps = MDP_LM_CAP_DISPLAY, },
+   { .id = 1, .pp = -1, .dspp = -1,
+ .caps = MDP_LM_CAP_WB },
+},
+   .nb_stages = 8,
+   .max_width = 2560,
+   .max_height = 0x,
+   },
+   .dspp = {
+   .count = 1,
+   .base = { 0x54000 },
+
+   },
+   .pp = {
+   .count = 3,
+   .base = { 0x7, 0x70800, 0x72000 },
+   },
+   .dsc = {
+   .count = 2,
+   .base = { 0x8, 0x80400 },
+   },
+   .intf = {
+   .base = { 0x6a000, 0x6a800, 0x6b000 },
+   .connect = {
+   [0] = INTF_DISABLED,
+   [1] = INTF_DSI,
+   [2] = INTF_DSI,
+   },
+   },
+   .max_clk = 36000,
+};
+
 static const struct mdp5_cfg_hw msm8917_config = {
.name = "msm8917",
.mdp = {
@@ -745,6 +842,7 @@ static const struct mdp5_cfg_handler cfg_handlers_v1[] = {
{ .revision = 6, .config = { .hw = &msm8x16_config } },
{ .revision = 9, .config = { .hw = &msm8x94_config } },
{ .revision = 7, .config = { .hw = &msm8x96_config } },
+   { .revision = 11, .config = { .hw = &msm8x76_config } },
{ .revision = 15, .config = { .hw = &msm8917_config } },
 };
 
-- 
2.21.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH v3 5/7] dt-bindings: msm/dsi: Add 28nm PLL for family B compatible

2019-10-15 Thread kholk11
From: AngeloGioacchino Del Regno 

On family B SoCs, the 28nm PLL has a different iospace address
and that required a new compatible in the driver.

Signed-off-by: AngeloGioacchino Del Regno 
---
 Documentation/devicetree/bindings/display/msm/dsi.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/display/msm/dsi.txt 
b/Documentation/devicetree/bindings/display/msm/dsi.txt
index af95586c898f..d3ba9ee22f38 100644
--- a/Documentation/devicetree/bindings/display/msm/dsi.txt
+++ b/Documentation/devicetree/bindings/display/msm/dsi.txt
@@ -83,6 +83,7 @@ DSI PHY:
 Required properties:
 - compatible: Could be the following
   * "qcom,dsi-phy-28nm-hpm"
+  * "qcom,dsi-phy-28nm-hpm-fam-b"
   * "qcom,dsi-phy-28nm-lp"
   * "qcom,dsi-phy-20nm"
   * "qcom,dsi-phy-28nm-8960"
-- 
2.21.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH v3 1/7] drm/msm/mdp5: Add optional TBU and TBU_RT clocks

2019-10-15 Thread kholk11
From: AngeloGioacchino Del Regno 

Some SoCs, like MSM8956/8976 (and APQ variants), do feature these
clocks and we need to enable them in order to get both of the
hw (mdp5/rot) Translation Buffer Units (TBUs) to properly work.

Signed-off-by: AngeloGioacchino Del Regno 
---
 drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 10 ++
 drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.h |  2 ++
 2 files changed, 12 insertions(+)

diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c 
b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
index 5476892a335f..e43ecd4be10a 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
@@ -309,6 +309,10 @@ int mdp5_disable(struct mdp5_kms *mdp5_kms)
mdp5_kms->enable_count--;
WARN_ON(mdp5_kms->enable_count < 0);
 
+   if (mdp5_kms->tbu_rt_clk)
+   clk_disable_unprepare(mdp5_kms->tbu_rt_clk);
+   if (mdp5_kms->tbu_clk)
+   clk_disable_unprepare(mdp5_kms->tbu_clk);
clk_disable_unprepare(mdp5_kms->ahb_clk);
clk_disable_unprepare(mdp5_kms->axi_clk);
clk_disable_unprepare(mdp5_kms->core_clk);
@@ -329,6 +333,10 @@ int mdp5_enable(struct mdp5_kms *mdp5_kms)
clk_prepare_enable(mdp5_kms->core_clk);
if (mdp5_kms->lut_clk)
clk_prepare_enable(mdp5_kms->lut_clk);
+   if (mdp5_kms->tbu_clk)
+   clk_prepare_enable(mdp5_kms->tbu_clk);
+   if (mdp5_kms->tbu_rt_clk)
+   clk_prepare_enable(mdp5_kms->tbu_rt_clk);
 
return 0;
 }
@@ -965,6 +973,8 @@ static int mdp5_init(struct platform_device *pdev, struct 
drm_device *dev)
 
/* optional clocks: */
get_clk(pdev, &mdp5_kms->lut_clk, "lut", false);
+   get_clk(pdev, &mdp5_kms->tbu_clk, "tbu", false);
+   get_clk(pdev, &mdp5_kms->tbu_rt_clk, "tbu_rt", false);
 
/* we need to set a default rate before enabling.  Set a safe
 * rate first, then figure out hw revision, and then set a
diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.h 
b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.h
index d1bf4fdfc815..128866742593 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.h
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.h
@@ -53,6 +53,8 @@ struct mdp5_kms {
struct clk *ahb_clk;
struct clk *core_clk;
struct clk *lut_clk;
+   struct clk *tbu_clk;
+   struct clk *tbu_rt_clk;
struct clk *vsync_clk;
 
/*
-- 
2.21.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH 3/5] drm/msm/dsi: Add configuration for 28nm PLL on family B

2019-09-22 Thread kholk11
From: "Angelo G. Del Regno" 

The 28nm PLL has a different iospace on MSM/APQ family B SoCs:
add a new configuration and use it when the DT reports the
"qcom,dsi-phy-28nm-hpm-fam-b" compatible.

Signed-off-by: Angelo G. Del Regno 
---
 .../devicetree/bindings/display/msm/dsi.txt|  1 +
 drivers/gpu/drm/msm/dsi/phy/dsi_phy.c  |  2 ++
 drivers/gpu/drm/msm/dsi/phy/dsi_phy.h  |  1 +
 drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c | 18 ++
 4 files changed, 22 insertions(+)

diff --git a/Documentation/devicetree/bindings/display/msm/dsi.txt 
b/Documentation/devicetree/bindings/display/msm/dsi.txt
index af95586c898f..d3ba9ee22f38 100644
--- a/Documentation/devicetree/bindings/display/msm/dsi.txt
+++ b/Documentation/devicetree/bindings/display/msm/dsi.txt
@@ -83,6 +83,7 @@ DSI PHY:
 Required properties:
 - compatible: Could be the following
   * "qcom,dsi-phy-28nm-hpm"
+  * "qcom,dsi-phy-28nm-hpm-fam-b"
   * "qcom,dsi-phy-28nm-lp"
   * "qcom,dsi-phy-20nm"
   * "qcom,dsi-phy-28nm-8960"
diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c 
b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
index 4097eca1b3ef..507c0146a305 100644
--- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
+++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
@@ -481,6 +481,8 @@ static const struct of_device_id dsi_phy_dt_match[] = {
 #ifdef CONFIG_DRM_MSM_DSI_28NM_PHY
{ .compatible = "qcom,dsi-phy-28nm-hpm",
  .data = &dsi_phy_28nm_hpm_cfgs },
+   { .compatible = "qcom,dsi-phy-28nm-hpm-fam-b",
+ .data = &dsi_phy_28nm_hpm_famb_cfgs },
{ .compatible = "qcom,dsi-phy-28nm-lp",
  .data = &dsi_phy_28nm_lp_cfgs },
 #endif
diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.h 
b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.h
index c4069ce6afe6..24b294ed3059 100644
--- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.h
+++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.h
@@ -40,6 +40,7 @@ struct msm_dsi_phy_cfg {
 };
 
 extern const struct msm_dsi_phy_cfg dsi_phy_28nm_hpm_cfgs;
+extern const struct msm_dsi_phy_cfg dsi_phy_28nm_hpm_famb_cfgs;
 extern const struct msm_dsi_phy_cfg dsi_phy_28nm_lp_cfgs;
 extern const struct msm_dsi_phy_cfg dsi_phy_20nm_cfgs;
 extern const struct msm_dsi_phy_cfg dsi_phy_28nm_8960_cfgs;
diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c 
b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c
index b3f678f6c2aa..3b9300545e16 100644
--- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c
+++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c
@@ -142,6 +142,24 @@ const struct msm_dsi_phy_cfg dsi_phy_28nm_hpm_cfgs = {
.num_dsi_phy = 2,
 };
 
+const struct msm_dsi_phy_cfg dsi_phy_28nm_hpm_famb_cfgs = {
+   .type = MSM_DSI_PHY_28NM_HPM,
+   .src_pll_truthtable = { {true, true}, {false, true} },
+   .reg_cfg = {
+   .num = 1,
+   .regs = {
+   {"vddio", 10, 100},
+   },
+   },
+   .ops = {
+   .enable = dsi_28nm_phy_enable,
+   .disable = dsi_28nm_phy_disable,
+   .init = msm_dsi_phy_init_common,
+   },
+   .io_start = { 0x1a94400, 0x1a94800 },
+   .num_dsi_phy = 2,
+};
+
 const struct msm_dsi_phy_cfg dsi_phy_28nm_lp_cfgs = {
.type = MSM_DSI_PHY_28NM_LP,
.src_pll_truthtable = { {true, true}, {true, true} },
-- 
2.21.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH 5/5] drm/msm/adreno: Add support for Adreno 510 GPU

2019-09-22 Thread kholk11
From: "Angelo G. Del Regno" 

The Adreno 510 GPU is a stripped version of the Adreno 5xx,
found in low-end SoCs like 8x56 and 8x76, which has 256K of
GMEM, with no GPMU nor ZAP.
Also, since the Adreno 5xx part of this driver seems to be
developed with high-end Adreno GPUs in mind, and since this
is a lower end one, add a comment making clear which GPUs
which support is not implemented yet is not using the GPMU
related hw init code, so that future developers will not go
crazy with that.

By the way, the lower end Adreno GPUs with no GPMU are:
A505/A506/A510 (no ZAP firmware)
A508/A509/A512 (with ZAP firmware)

Signed-off-by: Angelo G. Del Regno 
---
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c  | 87 +++---
 drivers/gpu/drm/msm/adreno/a5xx_power.c|  7 ++
 drivers/gpu/drm/msm/adreno/adreno_device.c | 15 
 drivers/gpu/drm/msm/adreno/adreno_gpu.h|  5 ++
 4 files changed, 102 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c 
b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
index e9c55d1d6c04..c3814a65ba2d 100644
--- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
@@ -353,6 +353,9 @@ static int a5xx_me_init(struct msm_gpu *gpu)
 * 2D mode 3 draw
 */
OUT_RING(ring, 0x000B);
+   } else if (adreno_is_a510(adreno_gpu)) {
+   /* Workaround for token and syncs */
+   OUT_RING(ring, 0x0001);
} else {
/* No workarounds enabled */
OUT_RING(ring, 0x);
@@ -502,6 +505,8 @@ static int a5xx_zap_shader_init(struct msm_gpu *gpu)
 static int a5xx_hw_init(struct msm_gpu *gpu)
 {
struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu);
+   u32 meq_thresh, merciu_sz, roq_thresh_1, roq_thresh_2, eco_cntl;
+   u32 cur_eco_cnt;
int ret;
 
gpu_write(gpu, REG_A5XX_VBIF_ROUND_ROBIN_QOS_ARB, 0x0003);
@@ -568,15 +573,31 @@ static int a5xx_hw_init(struct msm_gpu *gpu)
0x0010 + adreno_gpu->gmem - 1);
gpu_write(gpu, REG_A5XX_UCHE_GMEM_RANGE_MAX_HI, 0x);
 
-   gpu_write(gpu, REG_A5XX_CP_MEQ_THRESHOLDS, 0x40);
-   if (adreno_is_a530(adreno_gpu))
-   gpu_write(gpu, REG_A5XX_CP_MERCIU_SIZE, 0x40);
+   /* Values for the majority of the models */
+   meq_thresh = 0x40;
+   merciu_sz = 0x40;
+   roq_thresh_2 = 0x8060;
+   roq_thresh_1 = 0x40201B16;
+   eco_cntl = (0x400 << 11 | 0x300 << 22);
+
+   /* model specific overrides */
+   if (adreno_is_a510(adreno_gpu)) {
+   meq_thresh = 0x20;
+   merciu_sz = 0x20;
+   roq_thresh_2 = 0x4030;
+   roq_thresh_1 = 0x20100D0A;
+   eco_cntl = (0x200 << 11 | 0x200 << 22);
+   }
+
if (adreno_is_a540(adreno_gpu))
-   gpu_write(gpu, REG_A5XX_CP_MERCIU_SIZE, 0x400);
-   gpu_write(gpu, REG_A5XX_CP_ROQ_THRESHOLDS_2, 0x8060);
-   gpu_write(gpu, REG_A5XX_CP_ROQ_THRESHOLDS_1, 0x40201B16);
+   merciu_sz = 0x400;
+
+   gpu_write(gpu, REG_A5XX_CP_MEQ_THRESHOLDS, meq_thresh);
+   gpu_write(gpu, REG_A5XX_CP_MERCIU_SIZE, merciu_sz);
+   gpu_write(gpu, REG_A5XX_CP_ROQ_THRESHOLDS_2, roq_thresh_2);
+   gpu_write(gpu, REG_A5XX_CP_ROQ_THRESHOLDS_1, roq_thresh_1);
 
-   gpu_write(gpu, REG_A5XX_PC_DBG_ECO_CNTL, (0x400 << 11 | 0x300 << 22));
+   gpu_write(gpu, REG_A5XX_PC_DBG_ECO_CNTL, eco_cntl);
 
if (adreno_gpu->info->quirks & ADRENO_QUIRK_TWO_PASS_USE_WFI)
gpu_rmw(gpu, REG_A5XX_PC_DBG_ECO_CNTL, 0, (1 << 8));
@@ -589,6 +610,22 @@ static int a5xx_hw_init(struct msm_gpu *gpu)
/* Enable ME/PFP split notification */
gpu_write(gpu, REG_A5XX_RBBM_AHB_CNTL1, 0xA6FF);
 
+   /*
+*  In A5x, CCU can send context_done event of a particular context to
+*  UCHE which ultimately reaches CP even when there is valid
+*  transaction of that context inside CCU. This can let CP to program
+*  config registers, which will make the "valid transaction" inside
+*  CCU to be interpreted differently. This can cause gpu fault. This
+*  bug is fixed in latest A510 revision. To enable this bug fix -
+*  bit[11] of RB_DBG_ECO_CNTL need to be set to 0, default is 1
+*  (disable). For older A510 version this bit is unused.
+*/
+   if (adreno_is_a510(adreno_gpu)) {
+   cur_eco_cnt = gpu_read(gpu, REG_A5XX_RB_DBG_ECO_CNTL);
+   cur_eco_cnt &= ~(1 << 11);
+   gpu_write(gpu, REG_A5XX_RB_DBG_ECO_CNTL, cur_eco_cnt);
+   }
+
/* Enable HWCG */
a5xx_set_hwcg(gpu, true);
 
@@ -635,7 +672,7 @@ static int a5xx_hw_init(struct msm_gpu *gpu)
/* UCHE */
gpu_write(gpu, REG_A5XX_CP_PROTECT(16), ADRENO_PROTECT_RW(0xE80, 16));
 
-   if (adreno_is_a530(adreno_gpu))
+   if (adreno_is_a530(adreno_gpu) || adreno_is_a510

[PATCH 0/5] DRM/MSM: Add support for MSM8956 and Adreno 510

2019-09-22 Thread kholk11
From: AngeloGioacchino Del Regno 

This patch series enables support for MSM8956/76 and its Adreno 510
GPU on the current DRM driver.

The personal aim is to upstream MSM8956 as much as possible.

This code has been tested on two Sony phones featuring the Qualcomm
MSM8956 SoC.

Angelo G. Del Regno (5):
  drm/msm/mdp5: Add optional TBU and TBU_RT clocks
  drm/msm/mdp5: Add configuration for msm8x56
  drm/msm/dsi: Add configuration for 28nm PLL on family B
  drm/msm/dsi: Add configuration for 8x56
  drm/msm/adreno: Add support for Adreno 510 GPU

 .../devicetree/bindings/display/msm/dsi.txt   |  1 +
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 87 +---
 drivers/gpu/drm/msm/adreno/a5xx_power.c   |  7 ++
 drivers/gpu/drm/msm/adreno/adreno_device.c| 15 +++
 drivers/gpu/drm/msm/adreno/adreno_gpu.h   |  5 +
 drivers/gpu/drm/msm/disp/mdp5/mdp5_cfg.c  | 99 +++
 drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c  | 10 ++
 drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.h  |  2 +
 drivers/gpu/drm/msm/dsi/dsi_cfg.c | 22 +
 drivers/gpu/drm/msm/dsi/dsi_cfg.h |  1 +
 drivers/gpu/drm/msm/dsi/phy/dsi_phy.c |  2 +
 drivers/gpu/drm/msm/dsi/phy/dsi_phy.h |  1 +
 drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c| 18 
 13 files changed, 258 insertions(+), 12 deletions(-)

-- 
2.21.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH 4/5] drm/msm/dsi: Add configuration for 8x56

2019-09-22 Thread kholk11
From: "Angelo G. Del Regno" 

MSM8956/APQ8056 has DSI version 3:10040002 (DSI 6G V1.4.2), featuring
two DSIs. It needs three clocks (mdp_core, iface, bus), one GDSC and
two vregs, VDDA at 1.2V and VDDIO at 1.8V.

Signed-off-by: Angelo G. Del Regno 
---
 drivers/gpu/drm/msm/dsi/dsi_cfg.c | 22 ++
 drivers/gpu/drm/msm/dsi/dsi_cfg.h |  1 +
 2 files changed, 23 insertions(+)

diff --git a/drivers/gpu/drm/msm/dsi/dsi_cfg.c 
b/drivers/gpu/drm/msm/dsi/dsi_cfg.c
index b7b7c1a9164a..d585ab7acde2 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_cfg.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_cfg.c
@@ -66,6 +66,26 @@ static const struct msm_dsi_config msm8916_dsi_cfg = {
.num_dsi = 1,
 };
 
+static const char * const dsi_8956_bus_clk_names[] = {
+   "mdp_core", "iface", "bus",
+};
+
+static const struct msm_dsi_config msm8956_dsi_cfg = {
+   .io_offset = DSI_6G_REG_SHIFT,
+   .reg_cfg = {
+   .num = 3,
+   .regs = {
+   {"gdsc", -1, -1},
+   {"vdda", 10, 100},  /* 1.2 V */
+   {"vddio", 10, 100}, /* 1.8 V */
+   },
+   },
+   .bus_clk_names = dsi_8956_bus_clk_names,
+   .num_bus_clks = ARRAY_SIZE(dsi_8956_bus_clk_names),
+   .io_start = { 0x1a94000, 0x1a96000 },
+   .num_dsi = 2,
+};
+
 static const struct msm_dsi_config msm8994_dsi_cfg = {
.io_offset = DSI_6G_REG_SHIFT,
.reg_cfg = {
@@ -197,6 +217,8 @@ static const struct msm_dsi_cfg_handler dsi_cfg_handlers[] 
= {
&msm8916_dsi_cfg, &msm_dsi_6g_host_ops},
{MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_4_1,
&msm8996_dsi_cfg, &msm_dsi_6g_host_ops},
+   {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_4_2,
+   &msm8956_dsi_cfg, &msm_dsi_6g_host_ops},
{MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V2_2_0,
&msm8998_dsi_cfg, &msm_dsi_6g_v2_host_ops},
{MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V2_2_1,
diff --git a/drivers/gpu/drm/msm/dsi/dsi_cfg.h 
b/drivers/gpu/drm/msm/dsi/dsi_cfg.h
index e2b7a7dfbe49..50a37ceb6a25 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_cfg.h
+++ b/drivers/gpu/drm/msm/dsi/dsi_cfg.h
@@ -17,6 +17,7 @@
 #define MSM_DSI_6G_VER_MINOR_V1_3  0x1003
 #define MSM_DSI_6G_VER_MINOR_V1_3_10x10030001
 #define MSM_DSI_6G_VER_MINOR_V1_4_10x10040001
+#define MSM_DSI_6G_VER_MINOR_V1_4_20x10040002
 #define MSM_DSI_6G_VER_MINOR_V2_2_00x2000
 #define MSM_DSI_6G_VER_MINOR_V2_2_10x20020001
 
-- 
2.21.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH 1/5] drm/msm/mdp5: Add optional TBU and TBU_RT clocks

2019-09-22 Thread kholk11
From: "Angelo G. Del Regno" 

Some SoCs, like MSM8956/8976 (and APQ variants), do feature these
clocks and we need to enable them in order to get the hardware to
properly work.

Signed-off-by: Angelo G. Del Regno 
---
 drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 10 ++
 drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.h |  2 ++
 2 files changed, 12 insertions(+)

diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c 
b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
index fec6ef1ae3b9..23be9b95dd7e 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
@@ -293,6 +293,10 @@ int mdp5_disable(struct mdp5_kms *mdp5_kms)
mdp5_kms->enable_count--;
WARN_ON(mdp5_kms->enable_count < 0);
 
+   if (mdp5_kms->tbu_rt_clk)
+   clk_disable_unprepare(mdp5_kms->tbu_rt_clk);
+   if (mdp5_kms->tbu_clk)
+   clk_disable_unprepare(mdp5_kms->tbu_clk);
clk_disable_unprepare(mdp5_kms->ahb_clk);
clk_disable_unprepare(mdp5_kms->axi_clk);
clk_disable_unprepare(mdp5_kms->core_clk);
@@ -313,6 +317,10 @@ int mdp5_enable(struct mdp5_kms *mdp5_kms)
clk_prepare_enable(mdp5_kms->core_clk);
if (mdp5_kms->lut_clk)
clk_prepare_enable(mdp5_kms->lut_clk);
+   if (mdp5_kms->tbu_clk)
+   clk_prepare_enable(mdp5_kms->tbu_clk);
+   if (mdp5_kms->tbu_rt_clk)
+   clk_prepare_enable(mdp5_kms->tbu_rt_clk);
 
return 0;
 }
@@ -948,6 +956,8 @@ static int mdp5_init(struct platform_device *pdev, struct 
drm_device *dev)
 
/* optional clocks: */
get_clk(pdev, &mdp5_kms->lut_clk, "lut", false);
+   get_clk(pdev, &mdp5_kms->tbu_clk, "tbu", false);
+   get_clk(pdev, &mdp5_kms->tbu_rt_clk, "tbu_rt", false);
 
/* we need to set a default rate before enabling.  Set a safe
 * rate first, then figure out hw revision, and then set a
diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.h 
b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.h
index d1bf4fdfc815..128866742593 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.h
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.h
@@ -53,6 +53,8 @@ struct mdp5_kms {
struct clk *ahb_clk;
struct clk *core_clk;
struct clk *lut_clk;
+   struct clk *tbu_clk;
+   struct clk *tbu_rt_clk;
struct clk *vsync_clk;
 
/*
-- 
2.21.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH 2/5] drm/msm/mdp5: Add configuration for msm8x56

2019-09-22 Thread kholk11
From: "Angelo G. Del Regno" 

Add the configuration entries for the MDP5 v1.11, found on MSM8956
and APQ8056.

Signed-off-by: Angelo G. Del Regno 
---
 drivers/gpu/drm/msm/disp/mdp5/mdp5_cfg.c | 99 
 1 file changed, 99 insertions(+)

diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_cfg.c 
b/drivers/gpu/drm/msm/disp/mdp5/mdp5_cfg.c
index dd1daf0e305a..9ff44e7fc7c7 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_cfg.c
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_cfg.c
@@ -545,6 +545,104 @@ const struct mdp5_cfg_hw msm8x96_config = {
.max_clk = 41250,
 };
 
+const struct mdp5_cfg_hw msm8x56_config = {
+   .name = "msm8x56",
+   .mdp = {
+   .count = 1,
+   .caps = MDP_CAP_SMP |
+   MDP_CAP_DSC |
+   MDP_CAP_SRC_SPLIT |
+   0,
+   },
+   .ctl = {
+   .count = 3,
+   .base = { 0x01000, 0x01200, 0x01400 },
+   .flush_hw_mask = 0x,
+   },
+   .smp = {
+   .mmb_count = 10,
+   .mmb_size = 10240,
+   .clients = {
+   [SSPP_VIG0] = 1, [SSPP_VIG1] = 9,
+   [SSPP_DMA0] = 4,
+   [SSPP_RGB0] = 7, [SSPP_RGB1] = 8,
+   },
+   },
+   .pipe_vig = {
+   .count = 2,
+   .base = { 0x04000, 0x06000 },
+   .caps = MDP_PIPE_CAP_HFLIP  |
+   MDP_PIPE_CAP_VFLIP  |
+   MDP_PIPE_CAP_SCALE  |
+   MDP_PIPE_CAP_CSC|
+   MDP_PIPE_CAP_DECIMATION |
+   MDP_PIPE_CAP_SW_PIX_EXT |
+   0,
+   },
+   .pipe_rgb = {
+   .count = 2,
+   .base = { 0x14000, 0x16000 },
+   .caps = MDP_PIPE_CAP_HFLIP  |
+   MDP_PIPE_CAP_VFLIP  |
+   MDP_PIPE_CAP_DECIMATION |
+   MDP_PIPE_CAP_SW_PIX_EXT |
+   0,
+   },
+   .pipe_dma = {
+   .count = 1,
+   .base = { 0x24000 },
+   .caps = MDP_PIPE_CAP_HFLIP  |
+   MDP_PIPE_CAP_VFLIP  |
+   MDP_PIPE_CAP_SW_PIX_EXT |
+   0,
+   },
+   .pipe_cursor = {
+   .count = 1,
+   .base = { 0x440DC },
+   .caps = MDP_PIPE_CAP_HFLIP  |
+   MDP_PIPE_CAP_VFLIP  |
+   MDP_PIPE_CAP_SW_PIX_EXT |
+   MDP_PIPE_CAP_CURSOR |
+   0,
+   },
+
+   .lm = {
+   .count = 2,
+   .base = { 0x44000, 0x45000 },
+   .instances = {
+   { .id = 0, .pp = 0, .dspp = 0,
+ .caps = MDP_LM_CAP_DISPLAY, },
+   { .id = 1, .pp = -1, .dspp = -1,
+ .caps = MDP_LM_CAP_WB },
+},
+   .nb_stages = 8,
+   .max_width = 2560,
+   .max_height = 0x,
+   },
+   .dspp = {
+   .count = 1,
+   .base = { 0x54000 },
+
+   },
+   .pp = {
+   .count = 3,
+   .base = { 0x7, 0x70800, 0x72000 },
+   },
+   .dsc = {
+   .count = 2,
+   .base = { 0x8, 0x80400 },
+   },
+   .intf = {
+   .base = { 0x6a000, 0x6a800, 0x6b000 },
+   .connect = {
+   [0] = INTF_DISABLED,
+   [1] = INTF_DSI,
+   [2] = INTF_DSI,
+   },
+   },
+   .max_clk = 36000,
+};
+
 const struct mdp5_cfg_hw msm8917_config = {
.name = "msm8917",
.mdp = {
@@ -637,6 +735,7 @@ static const struct mdp5_cfg_handler cfg_handlers[] = {
{ .revision = 6, .config = { .hw = &msm8x16_config } },
{ .revision = 9, .config = { .hw = &msm8x94_config } },
{ .revision = 7, .config = { .hw = &msm8x96_config } },
+   { .revision = 11, .config = { .hw = &msm8x56_config } },
{ .revision = 15, .config = { .hw = &msm8917_config } },
 };
 
-- 
2.21.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH v2 4/5] drm/msm/dsi: Add configuration for 8x56

2019-09-27 Thread kholk11
From: "Angelo G. Del Regno" 

MSM8956/APQ8056 has DSI version 3:10040002 (DSI 6G V1.4.2), featuring
two DSIs. It needs three clocks (mdp_core, iface, bus), one GDSC and
two vregs, VDDA at 1.2V and VDDIO at 1.8V.

Signed-off-by: Angelo G. Del Regno 
---
 drivers/gpu/drm/msm/dsi/dsi_cfg.c | 22 ++
 drivers/gpu/drm/msm/dsi/dsi_cfg.h |  1 +
 2 files changed, 23 insertions(+)

diff --git a/drivers/gpu/drm/msm/dsi/dsi_cfg.c 
b/drivers/gpu/drm/msm/dsi/dsi_cfg.c
index b7b7c1a9164a..d585ab7acde2 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_cfg.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_cfg.c
@@ -66,6 +66,26 @@ static const struct msm_dsi_config msm8916_dsi_cfg = {
.num_dsi = 1,
 };
 
+static const char * const dsi_8956_bus_clk_names[] = {
+   "mdp_core", "iface", "bus",
+};
+
+static const struct msm_dsi_config msm8956_dsi_cfg = {
+   .io_offset = DSI_6G_REG_SHIFT,
+   .reg_cfg = {
+   .num = 3,
+   .regs = {
+   {"gdsc", -1, -1},
+   {"vdda", 10, 100},  /* 1.2 V */
+   {"vddio", 10, 100}, /* 1.8 V */
+   },
+   },
+   .bus_clk_names = dsi_8956_bus_clk_names,
+   .num_bus_clks = ARRAY_SIZE(dsi_8956_bus_clk_names),
+   .io_start = { 0x1a94000, 0x1a96000 },
+   .num_dsi = 2,
+};
+
 static const struct msm_dsi_config msm8994_dsi_cfg = {
.io_offset = DSI_6G_REG_SHIFT,
.reg_cfg = {
@@ -197,6 +217,8 @@ static const struct msm_dsi_cfg_handler dsi_cfg_handlers[] 
= {
&msm8916_dsi_cfg, &msm_dsi_6g_host_ops},
{MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_4_1,
&msm8996_dsi_cfg, &msm_dsi_6g_host_ops},
+   {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_4_2,
+   &msm8956_dsi_cfg, &msm_dsi_6g_host_ops},
{MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V2_2_0,
&msm8998_dsi_cfg, &msm_dsi_6g_v2_host_ops},
{MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V2_2_1,
diff --git a/drivers/gpu/drm/msm/dsi/dsi_cfg.h 
b/drivers/gpu/drm/msm/dsi/dsi_cfg.h
index e2b7a7dfbe49..50a37ceb6a25 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_cfg.h
+++ b/drivers/gpu/drm/msm/dsi/dsi_cfg.h
@@ -17,6 +17,7 @@
 #define MSM_DSI_6G_VER_MINOR_V1_3  0x1003
 #define MSM_DSI_6G_VER_MINOR_V1_3_10x10030001
 #define MSM_DSI_6G_VER_MINOR_V1_4_10x10040001
+#define MSM_DSI_6G_VER_MINOR_V1_4_20x10040002
 #define MSM_DSI_6G_VER_MINOR_V2_2_00x2000
 #define MSM_DSI_6G_VER_MINOR_V2_2_10x20020001
 
-- 
2.21.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH v2 5/5] drm/msm/adreno: Add support for Adreno 510 GPU

2019-09-27 Thread kholk11
From: "Angelo G. Del Regno" 

The Adreno 510 GPU is a stripped version of the Adreno 5xx,
found in low-end SoCs like 8x56 and 8x76, which has 256K of
GMEM, with no GPMU nor ZAP.
Also, since the Adreno 5xx part of this driver seems to be
developed with high-end Adreno GPUs in mind, and since this
is a lower end one, add a comment making clear which GPUs
which support is not implemented yet is not using the GPMU
related hw init code, so that future developers will not go
crazy with that.

By the way, the lower end Adreno GPUs with no GPMU are:
A505/A506/A510 (usually no ZAP firmware)
A508/A509/A512 (usually with ZAP firmware)

Signed-off-by: Angelo G. Del Regno 
Signed-off-by: AngeloGioacchino Del Regno 
---
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c  | 73 +-
 drivers/gpu/drm/msm/adreno/a5xx_power.c|  7 +++
 drivers/gpu/drm/msm/adreno/adreno_device.c | 15 +
 drivers/gpu/drm/msm/adreno/adreno_gpu.h|  5 ++
 4 files changed, 86 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c 
b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
index e9c55d1d6c04..e497e08b08f7 100644
--- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
@@ -353,6 +353,9 @@ static int a5xx_me_init(struct msm_gpu *gpu)
 * 2D mode 3 draw
 */
OUT_RING(ring, 0x000B);
+   } else if (adreno_is_a510(adreno_gpu)) {
+   /* Workaround for token and syncs */
+   OUT_RING(ring, 0x0001);
} else {
/* No workarounds enabled */
OUT_RING(ring, 0x);
@@ -568,15 +571,24 @@ static int a5xx_hw_init(struct msm_gpu *gpu)
0x0010 + adreno_gpu->gmem - 1);
gpu_write(gpu, REG_A5XX_UCHE_GMEM_RANGE_MAX_HI, 0x);
 
-   gpu_write(gpu, REG_A5XX_CP_MEQ_THRESHOLDS, 0x40);
-   if (adreno_is_a530(adreno_gpu))
-   gpu_write(gpu, REG_A5XX_CP_MERCIU_SIZE, 0x40);
-   if (adreno_is_a540(adreno_gpu))
-   gpu_write(gpu, REG_A5XX_CP_MERCIU_SIZE, 0x400);
-   gpu_write(gpu, REG_A5XX_CP_ROQ_THRESHOLDS_2, 0x8060);
-   gpu_write(gpu, REG_A5XX_CP_ROQ_THRESHOLDS_1, 0x40201B16);
-
-   gpu_write(gpu, REG_A5XX_PC_DBG_ECO_CNTL, (0x400 << 11 | 0x300 << 22));
+   if (adreno_is_a510(adreno_gpu)) {
+   gpu_write(gpu, REG_A5XX_CP_MEQ_THRESHOLDS, 0x20);
+   gpu_write(gpu, REG_A5XX_CP_MERCIU_SIZE, 0x20);
+   gpu_write(gpu, REG_A5XX_CP_ROQ_THRESHOLDS_2, 0x4030);
+   gpu_write(gpu, REG_A5XX_CP_ROQ_THRESHOLDS_1, 0x20100D0A);
+   gpu_write(gpu, REG_A5XX_PC_DBG_ECO_CNTL,
+ (0x200 << 11 | 0x200 << 22));
+   } else {
+   gpu_write(gpu, REG_A5XX_CP_MEQ_THRESHOLDS, 0x40);
+   if (adreno_is_a530(adreno_gpu))
+   gpu_write(gpu, REG_A5XX_CP_MERCIU_SIZE, 0x40);
+   if (adreno_is_a540(adreno_gpu))
+   gpu_write(gpu, REG_A5XX_CP_MERCIU_SIZE, 0x400);
+   gpu_write(gpu, REG_A5XX_CP_ROQ_THRESHOLDS_2, 0x8060);
+   gpu_write(gpu, REG_A5XX_CP_ROQ_THRESHOLDS_1, 0x40201B16);
+   gpu_write(gpu, REG_A5XX_PC_DBG_ECO_CNTL,
+ (0x400 << 11 | 0x300 << 22));
+   }
 
if (adreno_gpu->info->quirks & ADRENO_QUIRK_TWO_PASS_USE_WFI)
gpu_rmw(gpu, REG_A5XX_PC_DBG_ECO_CNTL, 0, (1 << 8));
@@ -589,6 +601,19 @@ static int a5xx_hw_init(struct msm_gpu *gpu)
/* Enable ME/PFP split notification */
gpu_write(gpu, REG_A5XX_RBBM_AHB_CNTL1, 0xA6FF);
 
+   /*
+*  In A5x, CCU can send context_done event of a particular context to
+*  UCHE which ultimately reaches CP even when there is valid
+*  transaction of that context inside CCU. This can let CP to program
+*  config registers, which will make the "valid transaction" inside
+*  CCU to be interpreted differently. This can cause gpu fault. This
+*  bug is fixed in latest A510 revision. To enable this bug fix -
+*  bit[11] of RB_DBG_ECO_CNTL need to be set to 0, default is 1
+*  (disable). For older A510 version this bit is unused.
+*/
+   if (adreno_is_a510(adreno_gpu))
+   gpu_rmw(gpu, REG_A5XX_RB_DBG_ECO_CNTL, (1 << 11), 0);
+
/* Enable HWCG */
a5xx_set_hwcg(gpu, true);
 
@@ -635,7 +660,7 @@ static int a5xx_hw_init(struct msm_gpu *gpu)
/* UCHE */
gpu_write(gpu, REG_A5XX_CP_PROTECT(16), ADRENO_PROTECT_RW(0xE80, 16));
 
-   if (adreno_is_a530(adreno_gpu))
+   if (adreno_is_a530(adreno_gpu) || adreno_is_a510(adreno_gpu))
gpu_write(gpu, REG_A5XX_CP_PROTECT(17),
ADRENO_PROTECT_RW(0x1, 0x8000));
 
@@ -679,7 +704,8 @@ static int a5xx_hw_init(struct msm_gpu *gpu)
 
a5xx_preempt_hw_init(gpu);
 
-   a5xx_gpmu_ucode_init(gpu);
+   if (!adreno_is_a51

[PATCH v2 0/5] DRM/MSM: Add support for MSM8956 and Adreno 510

2019-09-27 Thread kholk11
From: AngeloGioacchino Del Regno 

This patch series enables support for MSM8956/76 and its Adreno 510
GPU on the current DRM driver.

The personal aim is to upstream MSM8956 as much as possible.

This code has been tested on two Sony phones featuring the Qualcomm
MSM8956 SoC.

Changes in v2:
- MDP5: Documented tbu and tbu_rt clocks (Jeffrey)
- Adreno510:
  - Lower case hex where required (Jordan)
  - Direct register writes (Jordan)
  - Used gpu_rmw() where required (Jordan)
  - No mentioning of unsupported A5xx (Jordan)
  - ZAP firmware exclusions not per-model (Rob)

Angelo G. Del Regno (5):
  drm/msm/mdp5: Add optional TBU and TBU_RT clocks
  drm/msm/mdp5: Add configuration for msm8x56
  drm/msm/dsi: Add configuration for 28nm PLL on family B
  drm/msm/dsi: Add configuration for 8x56
  drm/msm/adreno: Add support for Adreno 510 GPU

 .../devicetree/bindings/display/msm/dsi.txt   |  1 +
 .../devicetree/bindings/display/msm/mdp5.txt  |  2 +
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 73 +++---
 drivers/gpu/drm/msm/adreno/a5xx_power.c   |  7 ++
 drivers/gpu/drm/msm/adreno/adreno_device.c| 15 +++
 drivers/gpu/drm/msm/adreno/adreno_gpu.h   |  5 +
 drivers/gpu/drm/msm/disp/mdp5/mdp5_cfg.c  | 99 +++
 drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c  | 10 ++
 drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.h  |  2 +
 drivers/gpu/drm/msm/dsi/dsi_cfg.c | 22 +
 drivers/gpu/drm/msm/dsi/dsi_cfg.h |  1 +
 drivers/gpu/drm/msm/dsi/phy/dsi_phy.c |  2 +
 drivers/gpu/drm/msm/dsi/phy/dsi_phy.h |  1 +
 drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c| 18 
 14 files changed, 244 insertions(+), 14 deletions(-)

-- 
2.21.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH v2 1/5] drm/msm/mdp5: Add optional TBU and TBU_RT clocks

2019-09-27 Thread kholk11
From: "Angelo G. Del Regno" 

Some SoCs, like MSM8956/8976 (and APQ variants), do feature these
clocks and we need to enable them in order to get the hardware to
properly work.

Signed-off-by: Angelo G. Del Regno 
---
 Documentation/devicetree/bindings/display/msm/mdp5.txt |  2 ++
 drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c   | 10 ++
 drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.h   |  2 ++
 3 files changed, 14 insertions(+)

diff --git a/Documentation/devicetree/bindings/display/msm/mdp5.txt 
b/Documentation/devicetree/bindings/display/msm/mdp5.txt
index 4e11338548aa..43d11279c925 100644
--- a/Documentation/devicetree/bindings/display/msm/mdp5.txt
+++ b/Documentation/devicetree/bindings/display/msm/mdp5.txt
@@ -76,6 +76,8 @@ Required properties:
 Optional properties:
 - clock-names: the following clocks are optional:
   * "lut"
+  * "tbu"
+  * "tbu_rt"
 
 Example:
 
diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c 
b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
index fec6ef1ae3b9..23be9b95dd7e 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
@@ -293,6 +293,10 @@ int mdp5_disable(struct mdp5_kms *mdp5_kms)
mdp5_kms->enable_count--;
WARN_ON(mdp5_kms->enable_count < 0);
 
+   if (mdp5_kms->tbu_rt_clk)
+   clk_disable_unprepare(mdp5_kms->tbu_rt_clk);
+   if (mdp5_kms->tbu_clk)
+   clk_disable_unprepare(mdp5_kms->tbu_clk);
clk_disable_unprepare(mdp5_kms->ahb_clk);
clk_disable_unprepare(mdp5_kms->axi_clk);
clk_disable_unprepare(mdp5_kms->core_clk);
@@ -313,6 +317,10 @@ int mdp5_enable(struct mdp5_kms *mdp5_kms)
clk_prepare_enable(mdp5_kms->core_clk);
if (mdp5_kms->lut_clk)
clk_prepare_enable(mdp5_kms->lut_clk);
+   if (mdp5_kms->tbu_clk)
+   clk_prepare_enable(mdp5_kms->tbu_clk);
+   if (mdp5_kms->tbu_rt_clk)
+   clk_prepare_enable(mdp5_kms->tbu_rt_clk);
 
return 0;
 }
@@ -948,6 +956,8 @@ static int mdp5_init(struct platform_device *pdev, struct 
drm_device *dev)
 
/* optional clocks: */
get_clk(pdev, &mdp5_kms->lut_clk, "lut", false);
+   get_clk(pdev, &mdp5_kms->tbu_clk, "tbu", false);
+   get_clk(pdev, &mdp5_kms->tbu_rt_clk, "tbu_rt", false);
 
/* we need to set a default rate before enabling.  Set a safe
 * rate first, then figure out hw revision, and then set a
diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.h 
b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.h
index d1bf4fdfc815..128866742593 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.h
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.h
@@ -53,6 +53,8 @@ struct mdp5_kms {
struct clk *ahb_clk;
struct clk *core_clk;
struct clk *lut_clk;
+   struct clk *tbu_clk;
+   struct clk *tbu_rt_clk;
struct clk *vsync_clk;
 
/*
-- 
2.21.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH v2 3/5] drm/msm/dsi: Add configuration for 28nm PLL on family B

2019-09-27 Thread kholk11
From: "Angelo G. Del Regno" 

The 28nm PLL has a different iospace on MSM/APQ family B SoCs:
add a new configuration and use it when the DT reports the
"qcom,dsi-phy-28nm-hpm-fam-b" compatible.

Signed-off-by: Angelo G. Del Regno 
---
 .../devicetree/bindings/display/msm/dsi.txt|  1 +
 drivers/gpu/drm/msm/dsi/phy/dsi_phy.c  |  2 ++
 drivers/gpu/drm/msm/dsi/phy/dsi_phy.h  |  1 +
 drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c | 18 ++
 4 files changed, 22 insertions(+)

diff --git a/Documentation/devicetree/bindings/display/msm/dsi.txt 
b/Documentation/devicetree/bindings/display/msm/dsi.txt
index af95586c898f..d3ba9ee22f38 100644
--- a/Documentation/devicetree/bindings/display/msm/dsi.txt
+++ b/Documentation/devicetree/bindings/display/msm/dsi.txt
@@ -83,6 +83,7 @@ DSI PHY:
 Required properties:
 - compatible: Could be the following
   * "qcom,dsi-phy-28nm-hpm"
+  * "qcom,dsi-phy-28nm-hpm-fam-b"
   * "qcom,dsi-phy-28nm-lp"
   * "qcom,dsi-phy-20nm"
   * "qcom,dsi-phy-28nm-8960"
diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c 
b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
index 4097eca1b3ef..507c0146a305 100644
--- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
+++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
@@ -481,6 +481,8 @@ static const struct of_device_id dsi_phy_dt_match[] = {
 #ifdef CONFIG_DRM_MSM_DSI_28NM_PHY
{ .compatible = "qcom,dsi-phy-28nm-hpm",
  .data = &dsi_phy_28nm_hpm_cfgs },
+   { .compatible = "qcom,dsi-phy-28nm-hpm-fam-b",
+ .data = &dsi_phy_28nm_hpm_famb_cfgs },
{ .compatible = "qcom,dsi-phy-28nm-lp",
  .data = &dsi_phy_28nm_lp_cfgs },
 #endif
diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.h 
b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.h
index c4069ce6afe6..24b294ed3059 100644
--- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.h
+++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.h
@@ -40,6 +40,7 @@ struct msm_dsi_phy_cfg {
 };
 
 extern const struct msm_dsi_phy_cfg dsi_phy_28nm_hpm_cfgs;
+extern const struct msm_dsi_phy_cfg dsi_phy_28nm_hpm_famb_cfgs;
 extern const struct msm_dsi_phy_cfg dsi_phy_28nm_lp_cfgs;
 extern const struct msm_dsi_phy_cfg dsi_phy_20nm_cfgs;
 extern const struct msm_dsi_phy_cfg dsi_phy_28nm_8960_cfgs;
diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c 
b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c
index b3f678f6c2aa..3b9300545e16 100644
--- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c
+++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c
@@ -142,6 +142,24 @@ const struct msm_dsi_phy_cfg dsi_phy_28nm_hpm_cfgs = {
.num_dsi_phy = 2,
 };
 
+const struct msm_dsi_phy_cfg dsi_phy_28nm_hpm_famb_cfgs = {
+   .type = MSM_DSI_PHY_28NM_HPM,
+   .src_pll_truthtable = { {true, true}, {false, true} },
+   .reg_cfg = {
+   .num = 1,
+   .regs = {
+   {"vddio", 10, 100},
+   },
+   },
+   .ops = {
+   .enable = dsi_28nm_phy_enable,
+   .disable = dsi_28nm_phy_disable,
+   .init = msm_dsi_phy_init_common,
+   },
+   .io_start = { 0x1a94400, 0x1a94800 },
+   .num_dsi_phy = 2,
+};
+
 const struct msm_dsi_phy_cfg dsi_phy_28nm_lp_cfgs = {
.type = MSM_DSI_PHY_28NM_LP,
.src_pll_truthtable = { {true, true}, {true, true} },
-- 
2.21.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH v2 2/5] drm/msm/mdp5: Add configuration for msm8x56

2019-09-27 Thread kholk11
From: "Angelo G. Del Regno" 

Add the configuration entries for the MDP5 v1.11, found on MSM8956
and APQ8056.

Signed-off-by: Angelo G. Del Regno 
---
 drivers/gpu/drm/msm/disp/mdp5/mdp5_cfg.c | 99 
 1 file changed, 99 insertions(+)

diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_cfg.c 
b/drivers/gpu/drm/msm/disp/mdp5/mdp5_cfg.c
index dd1daf0e305a..9ff44e7fc7c7 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_cfg.c
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_cfg.c
@@ -545,6 +545,104 @@ const struct mdp5_cfg_hw msm8x96_config = {
.max_clk = 41250,
 };
 
+const struct mdp5_cfg_hw msm8x56_config = {
+   .name = "msm8x56",
+   .mdp = {
+   .count = 1,
+   .caps = MDP_CAP_SMP |
+   MDP_CAP_DSC |
+   MDP_CAP_SRC_SPLIT |
+   0,
+   },
+   .ctl = {
+   .count = 3,
+   .base = { 0x01000, 0x01200, 0x01400 },
+   .flush_hw_mask = 0x,
+   },
+   .smp = {
+   .mmb_count = 10,
+   .mmb_size = 10240,
+   .clients = {
+   [SSPP_VIG0] = 1, [SSPP_VIG1] = 9,
+   [SSPP_DMA0] = 4,
+   [SSPP_RGB0] = 7, [SSPP_RGB1] = 8,
+   },
+   },
+   .pipe_vig = {
+   .count = 2,
+   .base = { 0x04000, 0x06000 },
+   .caps = MDP_PIPE_CAP_HFLIP  |
+   MDP_PIPE_CAP_VFLIP  |
+   MDP_PIPE_CAP_SCALE  |
+   MDP_PIPE_CAP_CSC|
+   MDP_PIPE_CAP_DECIMATION |
+   MDP_PIPE_CAP_SW_PIX_EXT |
+   0,
+   },
+   .pipe_rgb = {
+   .count = 2,
+   .base = { 0x14000, 0x16000 },
+   .caps = MDP_PIPE_CAP_HFLIP  |
+   MDP_PIPE_CAP_VFLIP  |
+   MDP_PIPE_CAP_DECIMATION |
+   MDP_PIPE_CAP_SW_PIX_EXT |
+   0,
+   },
+   .pipe_dma = {
+   .count = 1,
+   .base = { 0x24000 },
+   .caps = MDP_PIPE_CAP_HFLIP  |
+   MDP_PIPE_CAP_VFLIP  |
+   MDP_PIPE_CAP_SW_PIX_EXT |
+   0,
+   },
+   .pipe_cursor = {
+   .count = 1,
+   .base = { 0x440DC },
+   .caps = MDP_PIPE_CAP_HFLIP  |
+   MDP_PIPE_CAP_VFLIP  |
+   MDP_PIPE_CAP_SW_PIX_EXT |
+   MDP_PIPE_CAP_CURSOR |
+   0,
+   },
+
+   .lm = {
+   .count = 2,
+   .base = { 0x44000, 0x45000 },
+   .instances = {
+   { .id = 0, .pp = 0, .dspp = 0,
+ .caps = MDP_LM_CAP_DISPLAY, },
+   { .id = 1, .pp = -1, .dspp = -1,
+ .caps = MDP_LM_CAP_WB },
+},
+   .nb_stages = 8,
+   .max_width = 2560,
+   .max_height = 0x,
+   },
+   .dspp = {
+   .count = 1,
+   .base = { 0x54000 },
+
+   },
+   .pp = {
+   .count = 3,
+   .base = { 0x7, 0x70800, 0x72000 },
+   },
+   .dsc = {
+   .count = 2,
+   .base = { 0x8, 0x80400 },
+   },
+   .intf = {
+   .base = { 0x6a000, 0x6a800, 0x6b000 },
+   .connect = {
+   [0] = INTF_DISABLED,
+   [1] = INTF_DSI,
+   [2] = INTF_DSI,
+   },
+   },
+   .max_clk = 36000,
+};
+
 const struct mdp5_cfg_hw msm8917_config = {
.name = "msm8917",
.mdp = {
@@ -637,6 +735,7 @@ static const struct mdp5_cfg_handler cfg_handlers[] = {
{ .revision = 6, .config = { .hw = &msm8x16_config } },
{ .revision = 9, .config = { .hw = &msm8x94_config } },
{ .revision = 7, .config = { .hw = &msm8x96_config } },
+   { .revision = 11, .config = { .hw = &msm8x56_config } },
{ .revision = 15, .config = { .hw = &msm8917_config } },
 };
 
-- 
2.21.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel