how to best ioremap() the ranges part of a "simple-bus" device?

rpjday at crashcourse.ca rpjday at crashcourse.ca
Tue Jul 31 10:24:49 EDT 2018


   another (i suspect) fairly simple question, i've just never had the occasion
to mess around in this part of the code.

   if i have a device tree source file containing the snippet:

         slave0: slave0-fubar at 90000000 {
                 compatible = "simple-bus";
                 ranges = <0x0 0x90000000 0x10000000>;
                 #address-cells = <1>;
                 #size-cells = <1>;
         };

         slave1: slave1-fubar at a0000000 {
                 compatible = "simple-bus";
                 ranges = <0x0 0xa0000000 0x10000000>;
                 #address-cells = <1>;
                 #size-cells = <1>;
         };

those two ranges actually represent physical addresses within
an FPGA and, when certain events occur, i want some driver code to
read/write some registers in slave0's address space, so obviously
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?

   oh, and a pointer to a good example in the current kernel source
would, of course, be useful.

rday




More information about the Kernelnewbies mailing list