[PATCH] [v2] netdev/phy: add MDIO bus multiplexer driven by a memory-mapped device

Stephen Warren swarren at wwwdotorg.org
Sat Aug 25 04:56:05 EST 2012


On 08/24/2012 12:36 PM, Timur Tabi wrote:
> Stephen Warren wrote:
>> When translating the child node's reg property into the parent's address
>> space, the parent's reg property shouldn't even be used at all; all the
>> mapping is done through the ranges property.
>>
>> I thought the code error-checked for a missing ranges property, but I
>> guess not...
> 
> I don't think 'ranges' is always necessary, because sometimes the child
> nodes have a different address space that's not mapped to the parent.  For
> instance, I2C devices have addresses that are not mapped to the I2C
> controller itself.

In the I2C case, the address spaces are disjoint, so there's never any
mapping between them, so there's no need for ranges.

Any time the child address space is intended to be part of the parent's
address space, I believe ranges is supposed to be specified, perhaps
even mandatory, even if the translation is 1:1.

> Anyway, thanks to Scott for helping me figure this out.  I was missing a
> ranges property:
> 
> 	fpga: board-control at 3,0 {
> 		#address-cells = <1>;
> 		#size-cells = <1>;
> 		compatible = "fsl,p5020ds-fpga", "fsl,fpga-ngpixis";
> 		reg = <3 0 0x30>;
> 		ranges = <0 3 0 0x30>;
> 
> This maps the child address of 0 to the parent address of 3 0.

Yes, that looks reasonable.


More information about the devicetree-discuss mailing list