devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lucas Stach <l.stach@pengutronix.de>
To: Marek Vasut <marex@denx.de>, Shawn Guo <shawnguo@kernel.org>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>
Cc: Fabio Estevam <festevam@gmail.com>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	NXP Linux Team <linux-imx@nxp.com>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Paul Elder <paul.elder@ideasonboard.com>,
	devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v4 02/11] soc: imx: add i.MX8MP HSIO blk-ctrl
Date: Thu, 07 Apr 2022 11:12:32 +0200	[thread overview]
Message-ID: <e60a4bcad472411a8f82546b57d8d375ed8cbda8.camel@pengutronix.de> (raw)
In-Reply-To: <e99520af-7b32-f1a4-7ebc-eb66611b850f@denx.de>

Am Donnerstag, dem 07.04.2022 um 01:43 +0200 schrieb Marek Vasut:
> On 4/6/22 17:33, Lucas Stach wrote:
> 
> [...]
> 
> > +static const struct imx8mp_blk_ctrl_data imx8mp_hsio_blk_ctl_dev_data = {
> > +	.max_reg = 0x24,
> 
> Doesn't the HSIO_BLK_CTL go up to 0x10c ?

Technically yes, but there is already a driver for the USB glue
(fsl,imx8mp-dwc3) that occupies the USB registers at and above 0x100.
 
> 
> > +	.power_on = imx8mp_hsio_blk_ctrl_power_on,
> > +	.power_off = imx8mp_hsio_blk_ctrl_power_off,
> > +	.power_notifier_fn = imx8mp_hsio_power_notifier,
> > +	.domains = imx8mp_hsio_domain_data,
> > +	.num_domains = ARRAY_SIZE(imx8mp_hsio_domain_data),
> > +};
> > +
> > +static int imx8mp_blk_ctrl_power_on(struct generic_pm_domain *genpd)
> > +{
> > +	struct imx8mp_blk_ctrl_domain *domain = to_imx8mp_blk_ctrl_domain(genpd);
> > +	const struct imx8mp_blk_ctrl_domain_data *data = domain->data;
> > +	struct imx8mp_blk_ctrl *bc = domain->bc;
> > +	int ret;
> > +
> > +	/* make sure bus domain is awake */
> > +	ret = pm_runtime_resume_and_get(bc->bus_power_dev);
> > +	if (ret < 0) {
> > +		dev_err(bc->dev, "failed to power up bus domain\n");
> > +		return ret;
> > +	}
> > +
> > +	/* enable upstream clocks */
> > +	ret = clk_bulk_prepare_enable(data->num_clks, domain->clks);;
> > +	if (ret) {
> > +		dev_err(bc->dev, "failed to enable clocks\n");
> > +		goto bus_put;
> > +	}
> > +
> > +	/* domain specific blk-ctrl manipulation */
> > +	bc->power_on(bc, domain);
> 
> Would it make sense to add error checking ?
> 
I don't expect those functions to do any more than a bit of blk-ctrl
MMIO register poking. If that fails you are in much more trouble than
what you can reasonably fix with some error checking.

Regards,
Lucas

> > +	/* power up upstream GPC domain */
> > +	ret = pm_runtime_resume_and_get(domain->power_dev);
> > +	if (ret < 0) {
> > +		dev_err(bc->dev, "failed to power up peripheral domain\n");
> > +		goto clk_disable;
> > +	}
> > +
> > +	clk_bulk_disable_unprepare(data->num_clks, domain->clks);
> > +
> > +	return 0;
> > +
> > +clk_disable:
> > +	clk_bulk_disable_unprepare(data->num_clks, domain->clks);
> > +bus_put:
> > +	pm_runtime_put(bc->bus_power_dev);
> > +
> > +	return ret;
> > +}
> 
> [...]



  reply	other threads:[~2022-04-07  9:13 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-06 15:33 [PATCH v4 00/11] consolidated i.MX8MP HSIO/MEDIA/HDMI blk-ctrl series Lucas Stach
2022-04-06 15:33 ` [PATCH v4 01/11] soc: imx: imx8m-blk-ctrl: set power device name Lucas Stach
2022-04-25 21:28   ` Laurent Pinchart
2022-04-06 15:33 ` [PATCH v4 02/11] soc: imx: add i.MX8MP HSIO blk-ctrl Lucas Stach
2022-04-06 23:43   ` Marek Vasut
2022-04-07  9:12     ` Lucas Stach [this message]
2022-04-10 22:11       ` Marek Vasut
2022-04-11 16:46         ` Lucas Stach
2022-04-11 22:25           ` Marek Vasut
2022-04-06 15:33 ` [PATCH v4 03/11] dt-bindings: soc: Add i.MX8MP media block control DT bindings Lucas Stach
2022-05-09 12:39   ` Rob Herring
2022-05-10 19:59     ` Laurent Pinchart
2022-04-06 15:33 ` [PATCH v4 04/11] soc: imx: imx8m-blk-ctrl: Add i.MX8MP media blk-ctrl Lucas Stach
2022-04-06 15:33 ` [PATCH v4 05/11] dt-bindings: power: imx8mp: add defines for HDMI blk-ctrl domains Lucas Stach
2022-04-13 18:35   ` Rob Herring
2022-04-06 15:33 ` [PATCH v4 06/11] dt-bindings: soc: add binding for i.MX8MP HDMI blk-ctrl Lucas Stach
2022-04-13 18:37   ` Rob Herring
2022-04-06 15:33 ` [PATCH v4 07/11] soc: imx: add " Lucas Stach
2022-04-06 23:56   ` Marek Vasut
2022-04-06 15:33 ` [PATCH v4 08/11] arm64: dts: imx8mp: add HSIO power-domains Lucas Stach
2022-04-06 15:34 ` [PATCH v4 09/11] arm64: dts: imx8mp: Add MEDIAMIX power domains Lucas Stach
2022-04-06 15:34 ` [PATCH v4 10/11] arm64: dts: imx8mp: Add MEDIA_BLK_CTRL Lucas Stach
2022-04-06 15:34 ` [PATCH v4 11/11] arm64: dts: imx8mp: add HDMI power-domains Lucas Stach
2022-05-04  8:27 ` [PATCH v4 00/11] consolidated i.MX8MP HSIO/MEDIA/HDMI blk-ctrl series Lucas Stach
2022-05-04  8:48   ` Laurent Pinchart
2022-05-04  8:56     ` Lucas Stach
2022-05-04 10:08       ` Laurent Pinchart
2022-05-04 10:19         ` Marek Vasut
2022-05-05  1:38 ` Shawn Guo

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=e60a4bcad472411a8f82546b57d8d375ed8cbda8.camel@pengutronix.de \
    --to=l.stach@pengutronix.de \
    --cc=devicetree@vger.kernel.org \
    --cc=festevam@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=krzk+dt@kernel.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=marex@denx.de \
    --cc=paul.elder@ideasonboard.com \
    --cc=robh+dt@kernel.org \
    --cc=shawnguo@kernel.org \
    /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).