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]
Date:   Wed, 5 Jun 2019 13:26:53 -0600
From:   Robert Hancock <hancock@...systems.ca>
To:     Lee Jones <lee.jones@...aro.org>
Cc:     linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] mfd: core: Support multiple OF child devices of the
 same type

On 2019-06-05 12:45 p.m., Lee Jones wrote:
>>>> diff --git a/include/linux/mfd/core.h b/include/linux/mfd/core.h
>>>> index 99c0395..470f6cb 100644
>>>> --- a/include/linux/mfd/core.h
>>>> +++ b/include/linux/mfd/core.h
>>>> @@ -55,6 +55,9 @@ struct mfd_cell {
>>>>  	 */
>>>>  	const char		*of_compatible;
>>>>  
>>>> +	/* Optionally match against a specific device of a given type */
>>>> +	const char		*of_full_name;
>>>> +
>>>
>>> Can you give me an example for when this might be useful?
>>
>> This is an example of some device tree entries for our MFD device:
>>
>>             axi_iic_0: i2c@...00 {
>>                 compatible = "xlnx,xps-iic-2.00.a";
>>                 clocks = <&axi_clk>;
>>                 clock-frequency = <100000>;
>>                 interrupts = <7>;
>>                 #size-cells = <0>;
>>                 #address-cells = <1>;
>>             };
>>
>>             axi_iic_1: i2c@...00 {
>>                 compatible = "xlnx,xps-iic-2.00.a";
>>                 clocks = <&axi_clk>;
>>                 clock-frequency = <100000>;
>>                 interrupts = <8>;
>>                 #size-cells = <0>;
>>                 #address-cells = <1>;
>>             };
>>
>> and the corresponding MFD cells:
>>
>> {
>> 	.name		= "axi_iic_0",
>> 	.of_compatible	= "xlnx,xps-iic-2.00.a",
>> 	.of_full_name	= "i2c@...00",
>> 	.num_resources	= ARRAY_SIZE(dbe_i2c1_resources),
>> 	.resources	= dbe_i2c1_resources
>> },
>> {
>> 	.name		= "axi_iic_1",
>> 	.of_compatible	= "xlnx,xps-iic-2.00.a",
>> 	.of_full_name	= "i2c@...00",
>> 	.num_resources	= ARRAY_SIZE(dbe_i2c2_resources),
>> 	.resources	= dbe_i2c2_resources
>> },
>>
>> Without having the .of_full_name support, both MFD cells ended up
>> wrongly matching against the i2c@...00 device tree node since we just
>> picked the first one where of_compatible matched.
> 
> What is contained in each of their resources?

These are the resource entries for those two devices:

static const struct resource dbe_i2c1_resources[] = {
{
	.start		= 0xc0000,
	.end		= 0xcffff,
	.name		= "xi2c1_regs",
	.flags		= IORESOURCE_MEM,
	.desc		= IORES_DESC_NONE
},
};

static const struct resource dbe_i2c2_resources[] = {
{
	.start		= 0xd0000,
	.end		= 0xdffff,
	.name		= "xi2c2_regs",
	.flags		= IORESOURCE_MEM,
	.desc		= IORES_DESC_NONE
},
};

Ideally the IO memory resource entries would be picked up and mapped
through the device tree as well, as they are with the interrupts, but I
haven't yet found the device tree magic that would allow that to happen
yet, if it's possible. The setup we have has a number of peripherals on
an AXI bus which are behind a PCIe to AXI bridge, and we're using mfd to
instantiate each of those AXI devices under the PCIe device.

-- 
Robert Hancock
Senior Software Developer
SED Systems, a division of Calian Ltd.
Email: hancock@...systems.ca

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ