From mboxrd@z Thu Jan 1 00:00:00 1970 From: lists@kaiser.cx (Martin Kaiser) Date: Wed, 1 Aug 2018 10:34:43 +0200 Subject: how to best ioremap() the ranges part of a "simple-bus" device? In-Reply-To: <20180801075925.vywifrbmpz77mkh2@viti.kaiser.cx> References: <20180731102449.Horde.1z7io_6Z3o-YiVoMcjWtBTc@crashcourse.ca> <20180801075925.vywifrbmpz77mkh2@viti.kaiser.cx> Message-ID: <20180801083443.ii2gq4ev7pzdiaj3@viti.kaiser.cx> To: kernelnewbies@lists.kernelnewbies.org List-Id: kernelnewbies.lists.kernelnewbies.org Thus wrote Martin Kaiser (lists at kaiser.cx): > Thus wrote rpjday at crashcourse.ca (rpjday at crashcourse.ca): > > i'll need to access that device tree entry and effectively ioremap() > > slave0's physical address to a usable virtual address. > > is there a canonical way to do this? short of manually extracting > > the appropriate device tree node and reading that property and calling > > ioremap()? is there a wrapper for that sort of operation, which i > > imagine must be fairly common? > I guess that of_iomap() does what you need here. Oh, I missed your point. You were asking specifically about ranges, of_remap() searches for a reg property. I'm not aware of any generic function to parse ranges. All I found was of_pci_range_to_resource() which is specific to PCI... You could search the dt files for "ranges =", find the corresponding drivers and see how they parse the info. Sorry for the noise, Martin