Help with Device Tree - possible bug in am33xx.dtsi

Using the new 3.12 mainline kernel and Robert C Nelson’s Ubuntu rootfs I’ve managed to get both CAN devices working. However, it get a warning when the device boots:

c_can_platform 481d0000.d_can: can’t request region for resource [mem 0x44e10644-0x44e10647]

What this is referring to is the fact that in the device tree definitions for each of the two can devices, the same register address is being requested. They are defined in ‘am33xx.dtsi’ as follows:

dcan0: d_can@481cc000 {
compatible = “bosch,d_can”;
ti,hwmods = “d_can0”;
reg = <0x481cc000 0x2000
0x44e10644 0x4>;
interrupts = <52>;
status = “disabled”;
};

dcan1: d_can@481d0000 {
compatible = “bosch,d_can”;
ti,hwmods = “d_can1”;
reg = <0x481d0000 0x2000
0x44e10644 0x4>;
interrupts = <55>;
status = “disabled”;
};

For both items the address ‘0x44e10644 0x4’, referring to the register ‘dcan_raminit’ (Pg 793 of spruh73h.pdf), is being reserved for use. The new devicetree interpreter considers any overlap between device register memory mappings as a problem, hence the message seen on boot.

The register ‘dcan_raminit’ is in fact used by both can devices, so it does make sense for both to have access to it. It appears however, that this register is only used in the d_can driver which does not appear to be in use with this latest kernel release. In any case, both device work flawlessly (as far as I can tell) regardless of the error message.

I thought I’d have a go at tidying this part of the ‘am33xx.dtsi’ devicetree file up a bit to get rid of this message - and this is where my question comes in. I thought I could make a single parent node for d_can with this shared register defined at the top level, and then add the two can devices to it as child nodes. I came up with something like this:

dcan {
#address-cells = <1>;
#size-cells = <1>;
reg = <0x44e10644 0x4>;

dcan0: d_can@481cc000 {
compatible = “bosch,d_can”;
ti,hwmods = “d_can0”;
reg = <0x481cc000 0x2000>;
interrupts = <52>;
status = “disabled”;
};

dcan1: d_can@481d0000 {
compatible = “bosch,d_can”;
ti,hwmods = “d_can1”;
reg = <0x481d0000 0x2000>;
interrupts = <55>;
status = “disabled”;
};
};

I tried various iterations along this line (and modified the am335x-boneblack.dts file with the corresponding 'status = ‘okay’ entries for these devices), all of which would compile fine, and the dvice would boot with no error messages, but for whatever reason the devices would never show up as they had previously.

I was wonder if anyone with a better understanding of devicetree syntax could suggest the correct structure for the parent/child nodes I am trying to create.

Any help or suggestions would be greatly appreciated.

Regards,
Andrew Glen.

I know that this post is quite old and I hope you got it fixed. I use kernel 3.12.10 and I can make the can device up without any problem. However I can’t get any can mesaages from another board which I am %100 sure that it is working properly. I use candump utility to check received packets. I am suspicious about the changes I made in am335x-boneblack.dts file. Here are the lines I added in the file.

dcan0_pins: dcan0_pins {
pinctrl-single,pins = <
0x178 0x12/(SLEWCTRL_FAST | PIN_INPUT_PULLUP | MUX_MODE2)
0x17C 0x32/
(SLEWCTRL_FAST | PIN_INPUT_PULLUP | MUX_MODE2)

;
};

&dcan0 {
#address-cells = <1>;
#size-cells = <0>;
pinctrl-names = “default”;
pinctrl-0 = <&dcan0_pins>;
status = “okay”;
};

This is the node in am33xx.dtsi file,

dcan0: d_can@481cc000 {
compatible = “bosch,d_can”;
ti,hwmods = “d_can0”;
clocks = <&dcan0_fck>;
clock-names = “fck”;
reg = <0x481cc000 0x2000
0x44e10644 0x4>;
interrupts = <52>;
status = “disabled”;
};

Can you share your changes in am335x-boneblack.dts file?

15 Kasım 2013 Cuma 02:45:06 UTC+2 tarihinde AndrewTaneGlen yazdı: