From: Paul Cercueil <paul@crapouillou.net>
To: "H. Nikolaus Schaller" <hns@goldelico.com>
Cc: Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
Geert Uytterhoeven <geert+renesas@glider.be>,
Kees Cook <keescook@chromium.org>,
"Eric W. Biederman" <ebiederm@xmission.com>,
Miquel Raynal <miquel.raynal@bootlin.com>,
David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
Neil Armstrong <narmstrong@baylibre.com>,
Robert Foss <robert.foss@linaro.org>,
Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Ezequiel Garcia <ezequiel@collabora.com>,
Harry Wentland <harry.wentland@amd.com>,
Sam Ravnborg <sam@ravnborg.org>,
Maxime Ripard <maxime@cerno.tech>,
Hans Verkuil <hverkuil-cisco@xs4all.nl>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>, Paul Boddie <paul@boddie.org.uk>,
devicetree@vger.kernel.org, linux-mips@vger.kernel.org,
linux-kernel@vger.kernel.org, letux-kernel@openphoenux.org,
Jonas Karlman <jonas@kwiboo.se>,
dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v6 1/8] drm/ingenic: prepare ingenic drm for later addition of JZ4780
Date: Mon, 15 Nov 2021 19:09:07 +0000 [thread overview]
Message-ID: <7VNM2R.1CHJIFHQDLSS@crapouillou.net> (raw)
In-Reply-To: <122791473d61add6992310cec267ffde2607a2df.1636573413.git.hns@goldelico.com>
Hi Nikolaus,
I will look at the patches in depth in the coming days.
Le mer., nov. 10 2021 at 20:43:26 +0100, H. Nikolaus Schaller
<hns@goldelico.com> a écrit :
> This changes the way the regmap is allocated to prepare for the
> later addition of the JZ4780 which has more registers and bits
> than the others.
>
> Therefore we make the regmap as big as the reg property in
> the device tree tells.
>
> Suggested-by: Paul Cercueil <paul@crapouillou.net>
> Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
> ---
> drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> index 462bc0f35f1bf..4abfe5b094174 100644
> --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> @@ -173,7 +173,6 @@ static const struct regmap_config
> ingenic_drm_regmap_config = {
> .val_bits = 32,
> .reg_stride = 4,
>
> - .max_register = JZ_REG_LCD_SIZE1,
> .writeable_reg = ingenic_drm_writeable_reg,
> };
>
> @@ -1011,6 +1010,8 @@ static int ingenic_drm_bind(struct device *dev,
> bool has_components)
> struct ingenic_drm_bridge *ib;
> struct drm_device *drm;
> void __iomem *base;
> + struct resource *res;
> + struct regmap_config regmap_config;
> long parent_rate;
> unsigned int i, clone_mask = 0;
> int ret, irq;
> @@ -1056,14 +1057,16 @@ static int ingenic_drm_bind(struct device
> *dev, bool has_components)
> drm->mode_config.funcs = &ingenic_drm_mode_config_funcs;
> drm->mode_config.helper_private = &ingenic_drm_mode_config_helpers;
>
> - base = devm_platform_ioremap_resource(pdev, 0);
> + base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
> if (IS_ERR(base)) {
> dev_err(dev, "Failed to get memory resource\n");
> return PTR_ERR(base);
> }
>
> + regmap_config = ingenic_drm_regmap_config;
> + regmap_config.max_register = res->end - res->start - 4;
Just a quick feedback here: I just tested and it's actually just
(res->end - res->start), otherwise the last register of the memory area
set in DT is inaccessible.
Cheers,
-Paul
> priv->map = devm_regmap_init_mmio(dev, base,
> - &ingenic_drm_regmap_config);
> + ®map_config);
> if (IS_ERR(priv->map)) {
> dev_err(dev, "Failed to create regmap\n");
> return PTR_ERR(priv->map);
> --
> 2.33.0
>
next prev parent reply other threads:[~2021-11-16 1:22 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-10 19:43 [PATCH v6 0/8] MIPS: JZ4780 and CI20 HDMI H. Nikolaus Schaller
2021-11-10 19:43 ` [PATCH v6 1/8] drm/ingenic: prepare ingenic drm for later addition of JZ4780 H. Nikolaus Schaller
2021-11-15 19:09 ` Paul Cercueil [this message]
2021-11-10 19:43 ` [PATCH v6 2/8] drm/ingenic: Add support for JZ4780 and HDMI output H. Nikolaus Schaller
2021-11-10 19:43 ` [PATCH v6 3/8] dt-bindings: display: Add ingenic,jz4780-dw-hdmi DT Schema H. Nikolaus Schaller
2021-11-11 14:57 ` Rob Herring
2021-11-12 14:47 ` Rob Herring
2021-11-10 19:43 ` [PATCH v6 4/8] drm/ingenic: Add dw-hdmi driver for jz4780 H. Nikolaus Schaller
2021-11-10 19:43 ` [PATCH v6 5/8] MIPS: DTS: jz4780: Account for Synopsys HDMI driver and LCD controllers H. Nikolaus Schaller
2021-11-15 19:11 ` Paul Cercueil
2021-11-10 19:43 ` [PATCH v6 6/8] MIPS: DTS: CI20: Add DT nodes for HDMI setup H. Nikolaus Schaller
2021-11-15 19:16 ` Paul Cercueil
2021-11-10 19:43 ` [PATCH v6 7/8] MIPS: defconfig: CI20: configure for DRM_DW_HDMI_JZ4780 H. Nikolaus Schaller
2021-11-10 19:43 ` [PATCH v6 8/8] [RFC] MIPS: DTS: Ingenic: adjust register size to available registers H. Nikolaus Schaller
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=7VNM2R.1CHJIFHQDLSS@crapouillou.net \
--to=paul@crapouillou.net \
--cc=Laurent.pinchart@ideasonboard.com \
--cc=airlied@linux.ie \
--cc=broonie@kernel.org \
--cc=daniel@ffwll.ch \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=ebiederm@xmission.com \
--cc=ezequiel@collabora.com \
--cc=geert+renesas@glider.be \
--cc=harry.wentland@amd.com \
--cc=hns@goldelico.com \
--cc=hverkuil-cisco@xs4all.nl \
--cc=jernej.skrabec@gmail.com \
--cc=jonas@kwiboo.se \
--cc=keescook@chromium.org \
--cc=letux-kernel@openphoenux.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=maxime@cerno.tech \
--cc=miquel.raynal@bootlin.com \
--cc=narmstrong@baylibre.com \
--cc=paul@boddie.org.uk \
--cc=robert.foss@linaro.org \
--cc=robh+dt@kernel.org \
--cc=sam@ravnborg.org \
--cc=tsbogend@alpha.franken.de \
/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