LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 08-12-2018, 06:19 AM   #1
tdrs
LQ Newbie
 
Registered: Aug 2018
Posts: 1

Rep: Reputation: Disabled
how to loop over multiple registers in linux device tree node?


I implemented a generic driver, in the driver I just want to go over each registered device and do something.
my driver is generic so I don't want to know anything in advance about the devices.

I have some device tree nodes:

uart0: uart@1000000 {
compatible = "generic-driver";
reg = <0x1000000 0x1000>,<0x1001000 0x1000>,<0x1002000 0x1000>;
};

uart1: uart@2000000 {
compatible = "generic-driver";
reg = <0x2000000 0x1000>,<0x2001000 0x1000>,<0x2002000 0x1000>;
};

in the driver I know how to get first offset and size with platform_get_resource, but what if I have multiple ranges?
I saw an option to get it by add reg-names:

reg = <0x2000000 0x1000>,<0x2001000 0x1000>,<0x2002000 0x1000>;
reg-names = "uart0_0","urat0_1","uart0_2";
so in the driver I can use platform_get_resource_byname, but there I need to know in the driver the regs names in advance - but it'll be no more generic - unwanted!!

so my question is, is there a way to loop over these regs without early information in the driver?

Thanks in advance!!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Emulate Multiple Virtual port / Multiple device node by SW for single device driver (SSI) jegadezz Linux - General 0 11-14-2017 09:44 AM
how to get every node called for out of a binary tree? BW-userx Programming 8 09-09-2017 04:35 PM
device tree node failed to get resource vivek thullimalli Linux - Newbie 0 08-27-2017 09:55 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 04:51 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration