lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YzFxJUhypKHkSGgy@aptenodytes>
Date:   Mon, 26 Sep 2022 11:30:13 +0200
From:   Paul Kocialkowski <paul.kocialkowski@...tlin.com>
To:     Samuel Holland <samuel@...lland.org>
Cc:     Kishon Vijay Abraham I <kishon@...com>,
        Vinod Koul <vkoul@...nel.org>, Chen-Yu Tsai <wens@...e.org>,
        Jernej Skrabec <jernej.skrabec@...il.com>,
        Maxime Ripard <mripard@...nel.org>,
        Jagan Teki <jagan@...rulasolutions.com>,
        Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
        Maxime Ripard <maxime@...no.tech>,
        Rob Herring <robh+dt@...nel.org>, devicetree@...r.kernel.org,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
        linux-phy@...ts.infradead.org, linux-sunxi@...ts.linux.dev
Subject: Re: [PATCH 5/8] phy: allwinner: phy-sun6i-mipi-dphy: Make RX support
 optional

Hi Samuel,

On Fri 12 Aug 22, 02:56, Samuel Holland wrote:
> While all variants of the DPHY likely support RX mode, the new variant
> in the A100 is not used in this direction by the BSP, and it has some
> analog register changes, so its RX power-on sequence is unknown. To be
> safe, limit RX support to variants where the power-on sequence is known.

Coming back to this series, with some minor cosmetic suggestions.

> Signed-off-by: Samuel Holland <samuel@...lland.org>
> ---
> 
>  drivers/phy/allwinner/phy-sun6i-mipi-dphy.c | 25 +++++++++++++++++++--
>  1 file changed, 23 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/phy/allwinner/phy-sun6i-mipi-dphy.c b/drivers/phy/allwinner/phy-sun6i-mipi-dphy.c
> index 3900f1650851..625c6e1e9990 100644
> --- a/drivers/phy/allwinner/phy-sun6i-mipi-dphy.c
> +++ b/drivers/phy/allwinner/phy-sun6i-mipi-dphy.c
> @@ -114,6 +114,10 @@ enum sun6i_dphy_direction {
>  	SUN6I_DPHY_DIRECTION_RX,
>  };
>  
> +struct sun6i_dphy_variant {
> +	bool	supports_rx;

Since you're introducing a "tx_power_on" field later on, it would be more
consistent to call this one "rx_supported".

> +};
> +
>  struct sun6i_dphy {
>  	struct clk				*bus_clk;
>  	struct clk				*mod_clk;
> @@ -123,6 +127,7 @@ struct sun6i_dphy {
>  	struct phy				*phy;
>  	struct phy_configure_opts_mipi_dphy	config;
>  
> +	const struct sun6i_dphy_variant		*variant;
>  	enum sun6i_dphy_direction		direction;
>  };
>  
> @@ -409,6 +414,10 @@ static int sun6i_dphy_probe(struct platform_device *pdev)
>  	if (!dphy)
>  		return -ENOMEM;
>  
> +	dphy->variant = device_get_match_data(&pdev->dev);
> +	if (!dphy->variant)
> +		return -EINVAL;
> +
>  	regs = devm_platform_ioremap_resource(pdev, 0);
>  	if (IS_ERR(regs)) {
>  		dev_err(&pdev->dev, "Couldn't map the DPHY encoder registers\n");
> @@ -445,8 +454,13 @@ static int sun6i_dphy_probe(struct platform_device *pdev)
>  	ret = of_property_read_string(pdev->dev.of_node, "allwinner,direction",
>  				      &direction);
>  
> -	if (!ret && !strncmp(direction, "rx", 2))
> +	if (!ret && !strncmp(direction, "rx", 2)) {
> +		if (!dphy->variant->supports_rx) {
> +			dev_err(&pdev->dev, "RX not supported on this variant\n");
> +			return -EOPNOTSUPP;
> +		}

Maybe add a blank line here for readability.

Looks good to me otherwise!

Paul

>  		dphy->direction = SUN6I_DPHY_DIRECTION_RX;
> +	}
>  
>  	phy_set_drvdata(dphy->phy, dphy);
>  	phy_provider = devm_of_phy_provider_register(&pdev->dev, of_phy_simple_xlate);
> @@ -454,8 +468,15 @@ static int sun6i_dphy_probe(struct platform_device *pdev)
>  	return PTR_ERR_OR_ZERO(phy_provider);
>  }
>  
> +static const struct sun6i_dphy_variant sun6i_a31_mipi_dphy_variant = {
> +	.supports_rx	= true,
> +};
> +
>  static const struct of_device_id sun6i_dphy_of_table[] = {
> -	{ .compatible = "allwinner,sun6i-a31-mipi-dphy" },
> +	{
> +		.compatible	= "allwinner,sun6i-a31-mipi-dphy",
> +		.data		= &sun6i_a31_mipi_dphy_variant,
> +	},
>  	{ }
>  };
>  MODULE_DEVICE_TABLE(of, sun6i_dphy_of_table);
> -- 
> 2.35.1
> 

-- 
Paul Kocialkowski, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com

Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ