question on format of unit addresses

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi

I have a 11-port ethernet switch, with ports numbered 0-10, and the
cpu-facing port being port 10. I was under the impression that unit
addresses were supposed to be in hex (but with no 0x prefix), so I wrote

	port@a {
		reg = <10>;
		label = "cpu";
                ...

But the schema check fails, because dsa.yaml specifies

        patternProperties:
          "^(ethernet-)?port@[0-9]+$":
            description: Ethernet switch ports

So I can fix that by naming the node port@10, but then I thought I'd get
another complaint that 16 != 10. I don't; the only check I can see in
dtc about node address v reg is a check that if there's a node address
there should also be a reg (or ranges) and vice versa, but there doesn't
seem to be anything that compares the numerical values in either dtc or
dt-validate.

I haven't been able to find documentation on how exactly the node
address is interpreted (if at all, other than as a suffix to distinguish
it from other nodes at the same level). The closest is
https://devicetree-specification.readthedocs.io/en/stable/devicetree-basics.html#node-names
which says

   The unit-address component of the name is specific to the bus type on
   which the node sits. It consists of one or more ASCII characters from
   the set of characters in Table 2.1. The unit-address must match the
   first address specified in the reg property of the node.

but "match" is not really defined.

Can someone clarify what the rules actually are? Something like

- stick to all node addresses being either hex or decimal

- when the binding only allows decimal digits, use that

- in cases where the reg property is most naturally specified in decimal
  (such as smallish-but-maybe-larger-than-9 indexes such as for ethernet
  ports or SPI chip selects), use decimal in both the reg and node
  address

?

Rasmus




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux