ousan
Posts: 11
Joined: Mon Aug 06, 2018 7:33 am

Add new driver

Mon Aug 06, 2018 7:54 am

Hello Dear All,

I have linux experiences however I am new on Device tree. I want to add module to kernel and I have lots of research. I could not get clearly how I add driver to kernel.

In below link, there is the source code of what I want to add as driver. It seems, the driver is in linux kernel mainline. I can see the related driver when I open menuconfig. But I could not enable this module. How can I enable this module?

https://github.com/qca/qca7000

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 20274
Joined: Sat Jul 30, 2011 7:41 pm

Re: Add new driver

Mon Aug 06, 2018 8:40 am

So, when you run menuconfig, you can see the driver, but when you press space, you don't get an <*>x or an <M>?

Which driver is it?
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Please direct all questions to the forum, I do not do support via PM.

ousan
Posts: 11
Joined: Mon Aug 06, 2018 7:33 am

Re: Add new driver

Mon Aug 06, 2018 11:51 am

Actually, there is just explanation about the location of the driver when I search the kernel configuration by pressing "/" character.
Driver is qca7000. When I search the driver in menuconfig, it seems the driver is located on Device Drivers -> Network Device Support -> Ethernet Driver Support -> Qualcomm Devices.

However there is no QCA7000 device under Qualcomm Devices.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 20274
Joined: Sat Jul 30, 2011 7:41 pm

Re: Add new driver

Mon Aug 06, 2018 12:28 pm

Selecting the QCA7000 UART or SPI support seems to bring it in as a module.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Please direct all questions to the forum, I do not do support via PM.

ousan
Posts: 11
Joined: Mon Aug 06, 2018 7:33 am

Re: Add new driver

Mon Aug 06, 2018 12:32 pm

So, Should I try to write a dts file?

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 20274
Joined: Sat Jul 30, 2011 7:41 pm

Re: Add new driver

Mon Aug 06, 2018 1:26 pm

You need to revbuild the kernel with those settings added. Not sure if you need any DT changes.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Please direct all questions to the forum, I do not do support via PM.

ousan
Posts: 11
Joined: Mon Aug 06, 2018 7:33 am

Re: Add new driver

Mon Aug 06, 2018 1:52 pm

So, if we assume we have to add a dts file, how can I do it? And also there is an explanation about adding the driver to device tree.

https://elixir.bootlin.com/linux/v4.17. ... ca7000.txt

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 20274
Joined: Sat Jul 30, 2011 7:41 pm

Re: Add new driver

Mon Aug 06, 2018 2:41 pm

Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Please direct all questions to the forum, I do not do support via PM.

ousan
Posts: 11
Joined: Mon Aug 06, 2018 7:33 am

Re: Add new driver

Tue Aug 07, 2018 2:20 pm

Thank you for your sharing.

ousan
Posts: 11
Joined: Mon Aug 06, 2018 7:33 am

Re: Add new driver

Fri Aug 10, 2018 6:17 pm

I've found the overlay for qca7000 for raspberry pi in the (https://github.com/raspberrypi/linux/bl ... verlay.dts) link. It is already written.

And in "/boot/overlays/" there is qca7000.dtbo file. When I open it with fdtdump, it prints:

/dts-v1/;
// magic: 0xd00dfeed
// totalsize: 0x523 (1315)
// off_dt_struct: 0x38
// off_dt_strings: 0x454
// off_mem_rsvmap: 0x28
// version: 17
// last_comp_version: 16
// boot_cpuid_phys: 0x0
// size_dt_strings: 0xcf
// size_dt_struct: 0x41c

/ {
compatible = "brcm,bcm2708";
[email protected] {
target = <0xdeadbeef>;
__overlay__ {
#address-cells = <0x00000001>;
#size-cells = <0x00000000>;
status = "okay";
[email protected] {
status = "disabled";
};
[email protected] {
compatible = "qca,qca7000";
reg = <0x00000000>;
pinctrl-names = "default";
pinctrl-0 = <0x00000001>;
interrupt-parent = <0xdeadbeef>;
interrupts = <0x00000017 0x00000001>;
spi-max-frequency = <0x00b71b00>;
status = "okay";
phandle = <0x00000002>;
};
};
};
[email protected] {
target = <0xdeadbeef>;
__overlay__ {
eth1_pins {
brcm,pins = <0x00000017>;
brcm,function = <0x00000000>;
brcm,pull = <0x00000000>;
phandle = <0x00000001>;
};
};
};
__overrides__ {
int_pin = [00 00 00 02 69 6e 74 65 72 72 75 70 74 73 3a 30 00 00 00 00 01 62 72 63 6d 2c 70 69 6e 73 3a 30 00];
speed = <0x00000002 0x7370692d 0x6d61782d 0x66726571 0x75656e63 0x793a3000>;
};
__symbols__ {
eth1 = "/[email protected]/__overlay__/[email protected]";
eth1_pins = "/[email protected]/__overlay__/eth1_pins";
};
__local_fixups__ {
[email protected] {
__overlay__ {
[email protected] {
pinctrl-0 = <0x00000000>;
};
};
};
__overrides__ {
int_pin = <0x00000000 0x00000011>;
speed = <0x00000000>;
};
};
__fixups__ {
spi0 = "/[email protected]:target:0";
gpio = "/[email protected]/__overlay__/[email protected]:interrupt-parent:0", "/[email protected]:target:0";
};
};


I enable this overlay by typing "dtoverlay=qca7000" in /boot/config.txt as below:
# Uncomment this to enable the lirc-rpi module
#dtoverlay=lirc-rpi
dtoverlay=qca7000

Then I reboot the device. At the moment, I have 2 questions.

1) Do I need to resolve __fixups__ and __local_fixups__? If so, how?
2) How can I understand whether this module enabled or not? Do I need to do more things to use this driver?

Btw, when I print "sudo vcdbg log msg" I see below log,

001666.749: No kernel trailer - assuming DT-capable
001666.778: brfs: File read: 4579248 bytes
001671.744: brfs: File read: /mfs/sd/bcm2710-rpi-3-b.dtb
001671.769: Loading 'bcm2710-rpi-3-b.dtb' to 0x465fb0 size 0x44d8
001777.703: brfs: File read: 17624 bytes
001781.238: brfs: File read: /mfs/sd/config.txt
001781.768: dtparam: spi=on
001789.399: brfs: File read: 1667 bytes
001804.557: brfs: File read: /mfs/sd/overlays/qca7000.dtbo
001812.863: Loaded overlay 'qca7000'
001812.935: dtparam: audio=on

ousan
Posts: 11
Joined: Mon Aug 06, 2018 7:33 am

Re: Add new driver

Tue Aug 21, 2018 2:59 pm

Hello again,

I solved the problem just enable qca7000 overlay by updating /boot/config.txt

the qca7000 driver is already written and prepared to use.

Thank you for all reply

Return to “Device Tree”

Who is online

Users browsing this forum: No registered users and 1 guest