Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++

platform_get_resource fails

Altera_Forum
Honored Contributor II
1,892 Views

Added a custom device driver to GSRD 14.1 

The IP is contained in sopc0: hps_0_bridges: bridge@0xc0000000 

of_match_device - is successful -  

Looking in my: /proc/device-tree/sopc@0/bridge@0xc0000000/serial@0x100040000 

When I do # ] hexdump -C 'compatible' 

I can see my entries that match with the of_match [] of the device driver 

When I do# ] hexdum -C 'reg' 

I see the values in my dev entry  

BUT, the platform_get_resource fails.
0 Kudos
3 Replies
Altera_Forum
Honored Contributor II
1,026 Views

 

--- Quote Start ---  

Added a custom device driver to GSRD 14.1 

The IP is contained in sopc0: hps_0_bridges: bridge@0xc0000000 

of_match_device - is successful -  

Looking in my: /proc/device-tree/sopc@0/bridge@0xc0000000/serial@0x100040000 

When I do # ] hexdump -C 'compatible' 

I can see my entries that match with the of_match [] of the device driver 

When I do# ] hexdum -C 'reg' 

I see the values in my dev entry  

BUT, the platform_get_resource fails. 

--- Quote End ---  

 

 

I had a line missing in my .dts file so I generated another .dtb file and now the driver loads. STILL HAVE A PROBELM - when I use the driver I should see activity on a couple of the Cyclone V Dev kit board HSMC - but the lines aren't toggling. So - WHAT AM I MISSING? I have: 1. generated the .dtb, .rbf and added them to the microSD card. I have cross compiled my device driver and put it on the microSD card and simply done an "insmod myDriver.ko" - I saw that maybe I needed a new preloader image so I created a new on of those.
0 Kudos
Altera_Forum
Honored Contributor II
1,026 Views

REALLY NEED SOME HELP: 

 

1. We put our IP on the FPGA-HPS bridge that the leds are on. 

2. Got/generated all the files via instructions - .rbf, .dtb (and I wasn't sure so did do the preloader-mkpimage.bin) 

I did have to generate a new device tree 

2b. I had to update the zImage because the version magic numbers did not match -- when I did this the led-gpio driver gives the message:  

platform leds.1: Driver leds-gpio request probe deferral -- why? 

 

3. I DID NOT add the driver to the kernel but just cross compiled it and put it on the sd card to manually insert. 

 

When I insert the device driver - I get an error with the: of_address_to_resource  

 

static int touchscreen_drv_probe( struct platform_dev *op) 

 

int rc = 0; 

struct device_node *node = op->dev.of_node; 

struct resource res; 

 

// the of_match_device works --- 

 

rc = (of_address_to_resource( &op->dev.of_node, 0, &res); 

if (rc) 

//fail 

 

 

Where could the disconnect be?
0 Kudos
Altera_Forum
Honored Contributor II
1,026 Views

SOLVED -- used "platform_get_resource" and all is well. Not sure why the "of_address_to _resource" did not work but my device driver works fine.

0 Kudos
Reply