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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Tue, 9 Mar 2021 17:43:30 +0530
From:   Kishon Vijay Abraham I <kishon@...com>
To:     Vinod Koul <vkoul@...nel.org>
CC:     Rob Herring <robh+dt@...nel.org>,
        Philipp Zabel <p.zabel@...gutronix.de>,
        Swapnil Kashinath Jakhade <sjakhade@...ence.com>,
        Milind Parab <mparab@...ence.com>,
        Yuti Suresh Amonkar <yamonkar@...ence.com>,
        <linux-kernel@...r.kernel.org>, <devicetree@...r.kernel.org>
Subject: Re: [PATCH 3/9] phy: ti: j721e-wiz: Don't configure wiz if its
 already configured

Hi Vinod,

On 16/11/20 1:00 pm, Vinod Koul wrote:
> On 03-11-20, 09:25, Kishon Vijay Abraham I wrote:
>> From: Faiz Abbas <faiz_abbas@...com>
>>
>> Serdes lanes might be shared between multiple cores in some usecases
>> and its not possible to lock PLLs for both the lanes independently
>> by the two cores. This requires a bootloader to configure both the
>> lanes at early boot time.
>>
>> To handle this case, skip all configuration if any of the lanes has
>> already been enabled.
>>
>> While we are here, also fix the wiz_init() to be called before the
>> of_platform_device_create() call.
> 
> Let's do two patches for these two issues :-)
> 
> Other than that, change lgtm, with exception of minor nit
> 
>> Signed-off-by: Faiz Abbas <faiz_abbas@...com>
>> Signed-off-by: Kishon Vijay Abraham I <kishon@...com>
>> ---
>>  drivers/phy/ti/phy-j721e-wiz.c | 36 +++++++++++++++++++++-------------
>>  1 file changed, 22 insertions(+), 14 deletions(-)
>>
>> diff --git a/drivers/phy/ti/phy-j721e-wiz.c b/drivers/phy/ti/phy-j721e-wiz.c
>> index d57d29382ce4..9786e8aec252 100644
>> --- a/drivers/phy/ti/phy-j721e-wiz.c
>> +++ b/drivers/phy/ti/phy-j721e-wiz.c
>> @@ -816,13 +816,14 @@ static int wiz_probe(struct platform_device *pdev)
>>  	struct device *dev = &pdev->dev;
>>  	struct device_node *node = dev->of_node;
>>  	struct platform_device *serdes_pdev;
>> +	bool already_configured = false;
>>  	struct device_node *child_node;
>>  	struct regmap *regmap;
>>  	struct resource res;
>>  	void __iomem *base;
>>  	struct wiz *wiz;
>>  	u32 num_lanes;
>> -	int ret;
>> +	int ret, val, i;
>>  
>>  	wiz = devm_kzalloc(dev, sizeof(*wiz), GFP_KERNEL);
>>  	if (!wiz)
>> @@ -944,10 +945,26 @@ static int wiz_probe(struct platform_device *pdev)
>>  		goto err_get_sync;
>>  	}
>>  
>> -	ret = wiz_clock_init(wiz, node);
>> -	if (ret < 0) {
>> -		dev_warn(dev, "Failed to initialize clocks\n");
>> -		goto err_get_sync;
>> +	for (i = 0; i < wiz->num_lanes; i++) {
>> +		regmap_field_read(wiz->p_enable[i], &val);
>> +		if (val & (P_ENABLE | P_ENABLE_FORCE)) {
>> +			already_configured = true;
>> +			break;
>> +		}
>> +	}
>> +
>> +	if (!already_configured) {
> 
> do you really need this variable and check, why not move the below into
> precceding block and do wiz_clock_init() and wiz_init() inside the
> if condition and drop the variable

Don't see a clean way to do it in the preceding block. So we have "N"
lanes and even if any one of the lanes is already configured, the
following block has to be executed once.

Thanks
Kishon

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ