Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
12 years ago

Porting a custom Hardware device Driver from nonmmu to mmu Advice

Thanks in Advance.

I've got a daughter card with custom hardware and my device driver that was developed on the nonmmu (nios2.h) without "probe function" that I'm updating for the mmu device tree release and a new daughter card on the DE2-115 evaluation board.

I read and learned a bunch from http://uuoc.org/uclinux_nios2_custom_hardware.pdf

My problem is that my "probe" is not getting executed so I don't have a base address or irq for the driver. But my "mod_init" does get executed if I make it a built-in module AND if I make it loadable I can to a modprobe and it is executed.

My *.dts file entry for this hardware is:

NOTE: I made up the "pcm2par" it was unknown - and my device driver matches that "pcm2par"

pcm2par_av_0: unknown@0x09004c0 {

compatible = "pcm2par, pcm2par-1.0";

reg = < 0x09004c0 0x00000010 >;

interrupt-parent = < &cpu >;

interrupts = < 8 >;

}; // end unknown@0x09004c0 (pcm2par_av_0)

so:

1. do i have to use probe? can i just do all of that (of_match_device, platform_get_resource, request_mem_region, ...) in mod_init?

2. is there a place to define custom "pcm2par" for the kernel - is "altr" defined somewhere in the nios2-linux/uclinux-dist ?

1 Reply

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    To answer my own question:

    The entry in the *.dts NEEDS TO REFER TO "ALTR" first.

    pcm2par_av_0: unknown@0x09004c0 {

    compatible = "ALTR, pcm2par-10.1" "ALTR, pcm2par-1.0";

    reg = < 0x09004c0 0x00000010 >;

    interrupt-parent = < &cpu >;

    interrupts = < 8 >;

    }; // end unknown@0x09004c0 (pcm2par_av_0)

    Then all is well and the driver is happy.