On Fri, Nov 12, 2021 at 4:23 PM Rafał Miłecki <zajec5@xxxxxxxxx> wrote: > > On 12.11.2021 23:18, Rob Herring wrote: > > On Tue, Nov 2, 2021 at 10:22 AM Rafał Miłecki <zajec5@xxxxxxxxx> wrote: > >> > >> From: Rafał Miłecki <rafal@xxxxxxxxxx> > >> > >> During my work on MFD binding for Broadcom's TWD block I received > >> comment from Rob saying that "syscon-reboot" should use "reg" property. > >> I'm not sure if my understanding & implementation are correct so I'm > >> sending this RFC. > >> > >> What bothers me is non-standard "reg" property usage. Treating it as a > >> simple (unsigned) integer number means different logic when it comes to > >> ranges. > > > > It shouldn't be. The idea is that 'reg' works like normal. See below. > > > >> Consider this example: > >> > >> timer@400 { > >> compatible = "simple-mfd", "syscon"; > >> reg = <0x400 0x3c>; > >> ranges; > > > > ranges = <0 0x400 0x100>; // Just guessing for size > > > >> > >> #address-cells = <1>; > >> #size-cells = <1>; > >> > >> reboot@434 { > > > > reboot@34 > > > > Just reading 'reg' is fine, but really, Linux should be either getting > > the translated address or have a function to get the offset from the > > parent base. IOW, it should also work if you just changed 'reg' to > > '<0x434 0x4>'. > > Are you aware of anyone working on support for getting translated > address? Do you recall any efforts on implementing such a helper? All the DT address functions give you translated addresses. It's the latter that doesn't exist that I'm aware of offhand. It's just of_address_to_resource() on the child and parent nodes and then calculate the offset. Rob