From: Andre Przywara <andre.przywara@arm.com>
To: u-boot@lists.denx.de
Subject: [PATCH v2 11/19] video: sunxi: dw-hdmi: read address from DT node
Date: Tue, 6 Apr 2021 02:09:48 +0100 [thread overview]
Message-ID: <20210406020948.6323a926@slackpad.fritz.box> (raw)
In-Reply-To: <20210306195437.9740-12-jernej.skrabec@siol.net>
On Sat, 6 Mar 2021 20:54:29 +0100
Jernej Skrabec <jernej.skrabec@siol.net> wrote:
> Currently HDMI controller MMIO address is hardcoded. Change that so
> address is read from DT node. That will make adding support for new
> variants a bit easier.
>
> Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Checked the transformations, and it's still working (after fixing the
mux problem with your new patch in your github).
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Thanks,
Andre
> ---
> drivers/video/sunxi/sunxi_dw_hdmi.c | 38 ++++++++++++++++++-----------
> 1 file changed, 24 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/video/sunxi/sunxi_dw_hdmi.c b/drivers/video/sunxi/sunxi_dw_hdmi.c
> index 6f77b2a43b40..0744954fa15f 100644
> --- a/drivers/video/sunxi/sunxi_dw_hdmi.c
> +++ b/drivers/video/sunxi/sunxi_dw_hdmi.c
> @@ -57,10 +57,10 @@ static int sunxi_dw_hdmi_get_divider(uint clock)
> return 1;
> }
>
> -static void sunxi_dw_hdmi_phy_init(void)
> +static void sunxi_dw_hdmi_phy_init(struct dw_hdmi *hdmi)
> {
> struct sunxi_hdmi_phy * const phy =
> - (struct sunxi_hdmi_phy *)(SUNXI_HDMI_BASE + HDMI_PHY_OFFS);
> + (struct sunxi_hdmi_phy *)(hdmi->ioaddr + HDMI_PHY_OFFS);
> unsigned long tmo;
> u32 tmp;
>
> @@ -114,10 +114,10 @@ static void sunxi_dw_hdmi_phy_init(void)
> writel(0x42494E47, &phy->unscramble);
> }
>
> -static void sunxi_dw_hdmi_phy_set(uint clock, int phy_div)
> +static void sunxi_dw_hdmi_phy_set(struct dw_hdmi *hdmi, uint clock, int phy_div)
> {
> struct sunxi_hdmi_phy * const phy =
> - (struct sunxi_hdmi_phy *)(SUNXI_HDMI_BASE + HDMI_PHY_OFFS);
> + (struct sunxi_hdmi_phy *)(hdmi->ioaddr + HDMI_PHY_OFFS);
> int div = sunxi_dw_hdmi_get_divider(clock);
> u32 tmp;
>
> @@ -271,7 +271,7 @@ static int sunxi_dw_hdmi_phy_cfg(struct dw_hdmi *hdmi, uint mpixelclock)
> int phy_div;
>
> sunxi_dw_hdmi_pll_set(mpixelclock / 1000, &phy_div);
> - sunxi_dw_hdmi_phy_set(mpixelclock, phy_div);
> + sunxi_dw_hdmi_phy_set(hdmi, mpixelclock, phy_div);
>
> return 0;
> }
> @@ -292,9 +292,9 @@ static bool sunxi_dw_hdmi_mode_valid(struct udevice *dev,
> static int sunxi_dw_hdmi_enable(struct udevice *dev, int panel_bpp,
> const struct display_timing *edid)
> {
> - struct sunxi_hdmi_phy * const phy =
> - (struct sunxi_hdmi_phy *)(SUNXI_HDMI_BASE + HDMI_PHY_OFFS);
> struct sunxi_dw_hdmi_priv *priv = dev_get_priv(dev);
> + struct sunxi_hdmi_phy * const phy =
> + (struct sunxi_hdmi_phy *)(priv->hdmi.ioaddr + HDMI_PHY_OFFS);
> int ret;
>
> ret = dw_hdmi_enable(&priv->hdmi, edid);
> @@ -316,12 +316,26 @@ static int sunxi_dw_hdmi_enable(struct udevice *dev, int panel_bpp,
> * again or othwerwise BSP driver won't work. Dummy read is
> * needed or otherwise last write doesn't get written correctly.
> */
> - (void)readb(SUNXI_HDMI_BASE);
> + (void)readb(priv->hdmi.ioaddr);
> writel(0, &phy->unscramble);
>
> return 0;
> }
>
> +static int sunxi_dw_hdmi_of_to_plat(struct udevice *dev)
> +{
> + struct sunxi_dw_hdmi_priv *priv = dev_get_priv(dev);
> + struct dw_hdmi *hdmi = &priv->hdmi;
> +
> + hdmi->ioaddr = (ulong)dev_read_addr(dev);
> + hdmi->i2c_clk_high = 0xd8;
> + hdmi->i2c_clk_low = 0xfe;
> + hdmi->reg_io_width = 1;
> + hdmi->phy_set = sunxi_dw_hdmi_phy_cfg;
> +
> + return 0;
> +}
> +
> static int sunxi_dw_hdmi_probe(struct udevice *dev)
> {
> struct display_plat *uc_plat = dev_get_uclass_plat(dev);
> @@ -346,13 +360,8 @@ static int sunxi_dw_hdmi_probe(struct udevice *dev)
> /* Clock on */
> setbits_le32(&ccm->hdmi_clk_cfg, CCM_HDMI_CTRL_GATE);
>
> - sunxi_dw_hdmi_phy_init();
> + sunxi_dw_hdmi_phy_init(&priv->hdmi);
>
> - priv->hdmi.ioaddr = SUNXI_HDMI_BASE;
> - priv->hdmi.i2c_clk_high = 0xd8;
> - priv->hdmi.i2c_clk_low = 0xfe;
> - priv->hdmi.reg_io_width = 1;
> - priv->hdmi.phy_set = sunxi_dw_hdmi_phy_cfg;
> priv->mux = uc_plat->source_id;
>
> ret = dw_hdmi_phy_wait_for_hpd(&priv->hdmi);
> @@ -382,6 +391,7 @@ U_BOOT_DRIVER(sunxi_dw_hdmi) = {
> .id = UCLASS_DISPLAY,
> .of_match = sunxi_dw_hdmi_ids,
> .ops = &sunxi_dw_hdmi_ops,
> + .of_to_plat = sunxi_dw_hdmi_of_to_plat,
> .probe = sunxi_dw_hdmi_probe,
> .priv_auto = sizeof(struct sunxi_dw_hdmi_priv),
> };
next prev parent reply other threads:[~2021-04-06 1:09 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-06 19:54 [PATCH v2 00/19] video: sunxi: rework DE2 driver Jernej Skrabec
2021-03-06 19:54 ` [PATCH v2 01/19] sunxi: video: select dw-hdmi in Kconfig, not Makefile Jernej Skrabec
2021-03-06 19:54 ` [PATCH v2 02/19] video: sunxi: Add mode_valid callback to sunxi_dw_hdmi Jernej Skrabec
2021-03-06 19:54 ` [PATCH v2 03/19] common: edid: check for digital display earlier Jernej Skrabec
2021-03-06 19:54 ` [PATCH v2 04/19] common: edid: extract code for detailed timing search Jernej Skrabec
2021-03-07 1:29 ` Andre Przywara
2021-03-06 19:54 ` [PATCH v2 05/19] common: edid: Search for valid timing in extension block Jernej Skrabec
2021-03-06 19:54 ` [PATCH v2 06/19] video: sunxi: Use DW-HDMI hpd function Jernej Skrabec
2021-03-07 1:30 ` Andre Przywara
2021-03-06 19:54 ` [PATCH v2 07/19] video: sunxi: Remove check for ddc-i2c-bus property Jernej Skrabec
2021-03-06 19:54 ` [PATCH v2 08/19] video: sunxi: Remove TV probe from DE2 Jernej Skrabec
2021-03-07 1:31 ` Andre Przywara
2021-03-06 19:54 ` [PATCH v2 09/19] video: sunxi: de2: switch to public uclass functions Jernej Skrabec
2021-03-07 1:32 ` Andre Przywara
2021-03-07 7:35 ` Jernej Škrabec
2021-03-09 0:40 ` Andre Przywara
2021-03-09 5:35 ` Jernej Škrabec
2021-03-06 19:54 ` [PATCH v2 10/19] video: sunxi: dw-hdmi: probe driver by compatible Jernej Skrabec
2021-03-07 1:33 ` Andre Przywara
2021-03-06 19:54 ` [PATCH v2 11/19] video: sunxi: dw-hdmi: read address from DT node Jernej Skrabec
2021-04-06 1:09 ` Andre Przywara [this message]
2021-03-06 19:54 ` [PATCH v2 12/19] video: sunxi: de2: switch to DT probing Jernej Skrabec
2021-04-06 1:09 ` Andre Przywara
2021-04-06 7:14 ` Simon Glass
2021-03-06 19:54 ` [PATCH v2 13/19] video: sunxi: de2: read address from DT node Jernej Skrabec
2021-04-06 1:10 ` Andre Przywara
2021-03-06 19:54 ` [PATCH v2 14/19] clk: sunxi: Add DE2 and HDMI clocks to H3 and A64 Jernej Skrabec
2021-03-08 8:00 ` Jagan Teki
2021-03-06 19:54 ` [PATCH v2 15/19] clk: sunxi: add DE2 clock driver Jernej Skrabec
2021-03-08 7:59 ` Jagan Teki
2021-03-06 19:54 ` [PATCH v2 16/19] video: sunxi: de2: switch clock setup to DM model Jernej Skrabec
2021-03-08 8:02 ` Jagan Teki
2021-03-06 19:54 ` [PATCH v2 17/19] video: dw-hdmi: modify phy init callback to include full timings Jernej Skrabec
2021-03-06 19:54 ` [PATCH v2 18/19] video: sunxi: Add DW HDMI PHY driver Jernej Skrabec
2021-03-08 7:57 ` Jagan Teki
2021-03-09 5:38 ` Jernej Škrabec
2021-03-06 19:54 ` [PATCH v2 19/19] video: sunxi: dw-hdmi: Use new " Jernej Skrabec
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=20210406020948.6323a926@slackpad.fritz.box \
--to=andre.przywara@arm.com \
--cc=u-boot@lists.denx.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