linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Julien Masson <jmasson@baylibre.com>
To: Neil Armstrong <narmstrong@baylibre.com>
Cc: linux-arm-kernel@lists.infradead.org,
	linux-amlogic@lists.infradead.org,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	Julien Masson <jmasson@baylibre.com>
Subject: [PATCH 3/9] drm: meson: drv: use macro when initializing vpu
Date: Mon, 24 Jun 2019 16:48:27 +0200	[thread overview]
Message-ID: <86v9wv82f1.fsf@baylibre.com> (raw)
In-Reply-To: 86zhm782g5.fsf@baylibre.com

This patch add new macro which is used to set WRARB/RDARB mode of
the VPU.

Signed-off-by: Julien Masson <jmasson@baylibre.com>
---
 drivers/gpu/drm/meson/meson_drv.c       | 26 +++++++++++++++++++++----
 drivers/gpu/drm/meson/meson_registers.h |  1 +
 2 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c
index 2310c96fff46..50096697adc3 100644
--- a/drivers/gpu/drm/meson/meson_drv.c
+++ b/drivers/gpu/drm/meson/meson_drv.c
@@ -149,10 +149,28 @@ static struct regmap_config meson_regmap_config = {
 
 static void meson_vpu_init(struct meson_drm *priv)
 {
-	writel_relaxed(0x210000, priv->io_base + _REG(VPU_RDARB_MODE_L1C1));
-	writel_relaxed(0x10000, priv->io_base + _REG(VPU_RDARB_MODE_L1C2));
-	writel_relaxed(0x900000, priv->io_base + _REG(VPU_RDARB_MODE_L2C1));
-	writel_relaxed(0x20000, priv->io_base + _REG(VPU_WRARB_MODE_L2C1));
+	u32 value;
+
+	/*
+	 * Slave dc0 and dc5 connected to master port 1.
+	 * By default other slaves are connected to master port 0.
+	 */
+	value = VPU_RDARB_SLAVE_TO_MASTER_PORT(0, 1) |
+		VPU_RDARB_SLAVE_TO_MASTER_PORT(5, 1);
+	writel_relaxed(value, priv->io_base + _REG(VPU_RDARB_MODE_L1C1));
+
+	/* Slave dc0 connected to master port 1 */
+	value = VPU_RDARB_SLAVE_TO_MASTER_PORT(0, 1);
+	writel_relaxed(value, priv->io_base + _REG(VPU_RDARB_MODE_L1C2));
+
+	/* Slave dc4 and dc7 connected to master port 1 */
+	value = VPU_RDARB_SLAVE_TO_MASTER_PORT(4, 1) |
+		VPU_RDARB_SLAVE_TO_MASTER_PORT(7, 1);
+	writel_relaxed(value, priv->io_base + _REG(VPU_RDARB_MODE_L2C1));
+
+	/* Slave dc1 connected to master port 1 */
+	value = VPU_RDARB_SLAVE_TO_MASTER_PORT(1, 1);
+	writel_relaxed(value, priv->io_base + _REG(VPU_WRARB_MODE_L2C1));
 }
 
 static void meson_remove_framebuffers(void)
diff --git a/drivers/gpu/drm/meson/meson_registers.h b/drivers/gpu/drm/meson/meson_registers.h
index 55f5fe21ff5e..a9db49e5bdd6 100644
--- a/drivers/gpu/drm/meson/meson_registers.h
+++ b/drivers/gpu/drm/meson/meson_registers.h
@@ -1496,6 +1496,7 @@
 #define VPU_RDARB_MODE_L1C2 0x2799
 #define VPU_RDARB_MODE_L2C1 0x279d
 #define VPU_WRARB_MODE_L2C1 0x27a2
+#define		VPU_RDARB_SLAVE_TO_MASTER_PORT(dc, port) (port << (16 + dc))
 
 /* osd super scale */
 #define OSDSR_HV_SIZEIN 0x3130
-- 
2.17.1


  parent reply	other threads:[~2019-06-24 14:48 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-24 14:20 [PATCH 0/9] drm: meson: global clean-up (use proper macros, update comments ...) Julien Masson
2019-06-24 14:47 ` [PATCH 1/9] drm: meson: mask value when writing bits relaxed Julien Masson
2019-06-24 14:48 ` [PATCH 2/9] drm: meson: crtc: use proper macros instead of magic constants Julien Masson
2019-06-24 14:48 ` Julien Masson [this message]
2019-06-24 14:48 ` [PATCH 4/9] drm: meson: vpp: " Julien Masson
2019-06-24 23:15   ` Kevin Hilman
2019-08-08 14:09     ` Neil Armstrong
2019-06-24 14:48 ` [PATCH 5/9] drm: meson: viu: " Julien Masson
2019-06-24 14:48 ` [PATCH 6/9] drm: meson: venc: " Julien Masson
2019-06-24 14:48 ` [PATCH 7/9] drm: meson: global clean-up Julien Masson
2019-06-24 14:49 ` [PATCH 8/9] drm: meson: add macro used to enable HDMI PLL Julien Masson
2019-06-24 23:20   ` Kevin Hilman
2019-08-08 14:10     ` Neil Armstrong
2019-06-24 14:49 ` [PATCH 9/9] drm: meson: venc: set the correct macrovision max amplitude value Julien Masson
2019-06-24 23:24 ` [PATCH 0/9] drm: meson: global clean-up (use proper macros, update comments ...) Kevin Hilman
2019-08-08 14:12   ` Neil Armstrong
2019-08-09  9:29     ` Neil Armstrong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86v9wv82f1.fsf@baylibre.com \
    --to=jmasson@baylibre.com \
    --cc=86zhm782g5.fsf@baylibre.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=narmstrong@baylibre.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).