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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130710130116.GC4898@intel.com>
Date:	Wed, 10 Jul 2013 16:01:16 +0300
From:	Mika Westerberg <mika.westerberg@...ux.intel.com>
To:	linux-i2c@...r.kernel.org
Cc:	Wolfram Sang <wsa@...-dreams.de>,
	Christian Ruppert <christian.ruppert@...lis.com>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] i2c-designware: configure *CNT values from ACPI

On Mon, Jul 08, 2013 at 02:45:27PM +0300, Mika Westerberg wrote:
> Some Intel LPSS I2C devices make the *CNT values available from ACPI
> namespace in similar way than the SDA hold value. These values allow
> platform/BIOS to specify the most accurate *CNT values for the device
> driver to use.
> 
> So change the ACPI part of the driver to use these values if they exists
> and otherwise use the default method based solely on the input clock speed.
> 
> Signed-off-by: Mika Westerberg <mika.westerberg@...ux.intel.com>
> ---
> This applies on top of following patch which is not yet in i2c tree:
> 
> http://permalink.gmane.org/gmane.linux.drivers.i2c/15754
> 
>  drivers/i2c/busses/i2c-designware-platdrv.c | 25 +++++++++++++++++++++----
>  1 file changed, 21 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
> index c7cfdac..a1488df 100644
> --- a/drivers/i2c/busses/i2c-designware-platdrv.c
> +++ b/drivers/i2c/busses/i2c-designware-platdrv.c
> @@ -59,7 +59,6 @@ static int dw_i2c_acpi_configure(struct platform_device *pdev)
>  	struct dw_i2c_dev *dev = platform_get_drvdata(pdev);
>  	struct acpi_buffer buf = { ACPI_ALLOCATE_BUFFER };
>  	acpi_handle handle = ACPI_HANDLE(&pdev->dev);
> -	acpi_string name;
>  
>  	if (!handle)
>  		return -ENODEV;
> @@ -68,14 +67,32 @@ static int dw_i2c_acpi_configure(struct platform_device *pdev)
>  	dev->tx_fifo_depth = 32;
>  	dev->rx_fifo_depth = 32;
>  
> -	name = dev->master_cfg & DW_IC_CON_SPEED_FAST ? "FMCN" : "SSCN";
> -	if (ACPI_SUCCESS(acpi_evaluate_object(handle, name, NULL, &buf))) {
> +	/* Standard speed configuration */
> +	if (ACPI_SUCCESS(acpi_evaluate_object(handle, "SSCN", NULL, &buf))) {
>  		union acpi_object *obj = (union acpi_object *)buf.pointer;
>  
>  		if (obj->type == ACPI_TYPE_PACKAGE && obj->package.count == 3) {
>  			const union acpi_object *objs = obj->package.elements;
>  
> -			dev->sda_hold_time = (u32)objs[2].integer.value;
> +			dev->ss_hcnt = (u16)objs[0].integer.value;
> +			dev->ss_lcnt = (u16)objs[1].integer.value;
> +			if (!(dev->master_cfg & DW_IC_CON_SPEED_FAST))
> +				dev->sda_hold_time = (u32)objs[2].integer.value;
> +		}
> +
> +		kfree(buf.pointer);
> +	}
> +	/* Fast speed configuration */
> +	if (ACPI_SUCCESS(acpi_evaluate_object(handle, "FMCN", NULL, &buf))) {

There is a problem with the above as it reuses buf from the previous call.
I'll post a new revision of the patches with this fixed.

> +		union acpi_object *obj = (union acpi_object *)buf.pointer;
> +
> +		if (obj->type == ACPI_TYPE_PACKAGE && obj->package.count == 3) {
> +			const union acpi_object *objs = obj->package.elements;
> +
> +			dev->fs_hcnt = (u16)objs[0].integer.value;
> +			dev->fs_lcnt = (u16)objs[1].integer.value;
> +			if (dev->master_cfg & DW_IC_CON_SPEED_FAST)
> +				dev->sda_hold_time = (u32)objs[2].integer.value;
>  		}
>  
>  		kfree(buf.pointer);
> -- 
> 1.8.3.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ