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: <5714FCBE.3060009@metafoo.de>
Date:	Mon, 18 Apr 2016 17:26:54 +0200
From:	Lars-Peter Clausen <lars@...afoo.de>
To:	Srinivas Pandruvada <srinivas.pandruvada@...ux.intel.com>,
	Mika Westerberg <mika.westerberg@...ux.intel.com>,
	Jean-Michel Hautbois <jhautbois@...il.com>
Cc:	linux-kernel@...r.kernel.org, linux-i2c@...r.kernel.org,
	devicetree@...r.kernel.org, galak@...eaurora.org,
	ijc+devicetree@...lion.org.uk, mark.rutland@....com,
	pawel.moll@....com, robh+dt@...nel.org, wsa@...-dreams.de,
	laurent.pinchart@...asonboard.com,
	Jean-Michel Hautbois <jean-michel.hautbois@...-labs.com>
Subject: Re: [PATCH v2] i2c: Add generic support passing secondary devices
 addresses

On 04/18/2016 05:20 PM, Srinivas Pandruvada wrote:
> On Fri, 2016-04-15 at 11:01 +0300, Mika Westerberg wrote:
>> +Srinivas
>>
>> On Sun, Jan 31, 2016 at 04:33:00PM +0100, Jean-Michel Hautbois wrote:
>>>
>>> Some I2C devices have multiple addresses assigned, for example each
>>> address
>>> corresponding to a different internal register map page of the
>>> device.
>>> So far drivers which need support for this have handled this with a
>>> driver
>>> specific and non-generic implementation, e.g. passing the
>>> additional address
>>> via platform data.
>>>
>>> This patch provides a new helper function called
>>> i2c_new_secondary_device()
>>> which is intended to provide a generic way to get the secondary
>>> address
>>> as well as instantiate a struct i2c_client for the secondary
>>> address.
>>>
>>> The function expects a pointer to the primary i2c_client, a name
>>> for the secondary address and an optional default address. The name
>>> is used
>>> as a handle to specify which secondary address to get.
>>>
>>> The default address is used as a fallback in case no secondary
>>> address
>>> was explicitly specified. In case no secondary address and no
>>> default
>>> address were specified the function returns NULL.
>>>
>>> For now the function only supports look-up of the secondary address
>>> from devicetree, but it can be extended in the future
>>> to for example support board files and/or ACPI.
>> It was not clear to me but does this support more than two addresses?
> 
> In past when we were looking at this for Invensese MPU60XX device, we
> had two I2cSerialBus() entries, but they belong to two different
> devices. The first one for the MPU60XX and second one for another
> device which is a slave for MPU60XX. This slave device can be also be
> reached from master i2c controller, by disabling i2c master capability
> of MPU60XX device.
> So ACPI spec is very vague in specifying what they really meant.
> 
>> For example we might a device with 3 I2cSerialBus() connectors:
>>
>>     Device (CAM1)
>>     {
>>         Method (_CRS, 0, NotSerialized)  // _CRS: Current Resource
>> Settings
>>         {
>>             Name (SBUF, ResourceTemplate ()
>>             {
>>                 ...
>>                 I2cSerialBus (0x0010, ControllerInitiated,
>> 0x00061A80,
>>                     AddressingMode7Bit, "\\_SB.I2C4",
>>                     0x00, ResourceConsumer, ,)
>>                 I2cSerialBus (0x000C, ControllerInitiated,
>> 0x00061A80,
>>                     AddressingMode7Bit, "\\_SB.I2C4",
>>                     0x00, ResourceConsumer, ,)
>>                 I2cSerialBus (0x0054, ControllerInitiated,
>> 0x00061A80,
>>                     AddressingMode7Bit, "\\_SB.I2C4",
>>                     0x00, ResourceConsumer, ,)
>>             })
>>             Return (SBUF) /* \_SB_.I2C4.CAM1._CRS.SBUF */
>>         }
>>         ...
>>
>> Furthermore those do not have names.
> Correct. Better to use indexes. I think Mika also proposed similar API
> in past.

A generic API by indexes wont work. The order between DT and ACPI will most
likely be different. I'd even assume that the order will be different with
ACPI for the same device on different platforms.

If we want to support ACPI over the same interface drivers need to provide a
lookup table that maps a name to the index.

- Lars

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ