DM9000 on CS5/EBI DTS issue

This forum is for users of Atmel's SAM Series and who are interested in using Linux OS.

Moderator: nferre

lantzvillian
Posts: 4
Joined: Mon Nov 14, 2016 10:21 pm

DM9000 on CS5/EBI DTS issue

Fri Dec 02, 2016 8:20 pm

Hello,

We are struggling with getting the DTS working for a at91sam9g20ek chip using Linux 4.4.30 (more or less vanilla). We have a Davicon dm9000e on CS5, but cannot get the definition right - we are new to DTS.

The chip works in uboot, we are able to set it active and ping. Here is what we have so far and I am absolutely sure it is wrong.

Code: Select all

pinctrl_dm9000: pinctrl_dm9000 {
						atmel,pins =
							<AT91_PIOB 18 AT91_PERIPH_A 0	/* PB18 interrupt : gpio without pullup */
							AT91_PIOC 9 AT91_PERIPH_A 0>;	/* PC9 nCS5*/
					};

smc: smc@5ffffffff0 {
		compatible = "atmel,at91sam9260-smc", "syscon";
		#address-cells = <2>; /* cs, address */
		#size-cells = <1>;
		ranges = <2 0 0x60000000 0x10000000>;
		status=  "okay";
		
		smc,cs = <5>;
		smc,ncs_read_setup = <0>;
		smc,nrd_setup = <2>;
		smc,ncs_write_setup = <0>;
		smc,nwe_setup = <2>;
		smc,ncs_read_pulse = <8>;
		smc,nrd_pulse = <4>;
		smc,ncs_write_pulse = <8>;
		smc,nwe_pulse = <4>;
		smc,read_cycle = <16>;
		smc,write_cycle = <16>;
		smc,tdf_cycles = <1>;
		smc,tdf_optimized = <0>;
		smc,page_size = <0>;
		smc,byte_access_type = <1>;
		smc,bus_width = <1>;
		smc,nwait_mode = <0>;
		smc,read_mode = <1>;
		smc,write_mode = <1>;
		
		extbus@5.0 {
			compatible = "simple-bus";
			#address-cells = <1>;
			#size-cells = <1>;
			ranges = <0 0 0 0x10000000>;
			status = "okay";
			
			
				ethernet@0,0 {
					compatible = "davicom,dm9000";
					#address-cells = <1>;
					#size-cells = <1>;
					reg = <0x60000000 0x2 0x60000004 0x2>;
					interrupt-parent = <&pioB>;
					interrupts = <18 IRQ_TYPE_EDGE_BOTH>;
					local-mac-address = [00 00 00 00 00 00]; 
					pinctrl-names = "default";
					pinctrl-0 = <&pinctrl_dm9000>;
					status = "okay";
				};
			
		};
	}; 
You can read the DTS in /proc/device-tree so at least it was valid enough to be loaded. The dm9000 driver does not even appear to be loading (it isn't present in dmesg). The dm9612 is working fine.

Any assistance would be greatly appreciated.
blue_z
Location: USA
Posts: 1496
Joined: Thu Apr 19, 2007 10:15 pm

Re: DM9000 on CS5/EBI DTS issue

Sat Dec 03, 2016 12:55 am

lantzvillian wrote:The dm9000 driver does not even appear to be loading (it isn't present in dmesg).
"Loading" because it's a loadable module?
The Davicom driver probably isn't invoked because the driver for its DT parent is suspect.
The grep command can find no driver that advertises compatibility for the "atmel,at91sam9260-smc" string.
There is no use of "atmel,at91sam9260-smc" in the Device Tree source (other than your post).
In fact the only occurrence of "atmel,at91sam9260-smc" that grep finds in the kernel source is in Documentation/devicetree/bindings/mfd/atmel-smc.txt

Where did this smc node (and its attribute names) come from? (The generic syscon driver doesn't know how to process these attributes.)
What is the context of this smc node, i.e. where does it fit in within your board's Device Tree?

I could be wrong, but AFAIK there is no support (using Device Tree) for additional peripherals and memories on the Atmel EBI.
See this old thread that mentions a kernel patch.
lantzvillian wrote:The dm9612 is working fine.
What is the significance of this?
What is a "dm9612"? Google turns up nothing relevant for "dm9612" or even "Davicom dm9612".

Regards
lantzvillian
Posts: 4
Joined: Mon Nov 14, 2016 10:21 pm

Re: DM9000 on CS5/EBI DTS issue

Tue Feb 21, 2017 5:01 pm

A quick google fix would have shown that it was a typo. It was a dm9162 which is different from the dm9000.

Regardless, we got it to work with alot of help from some of the developers at Free Electron.

Enable the pin-ctrl:

Code: Select all

	pinctrl@fffff400 {
				mmc0_slot0 {
					pinctrl_board_mmc0_slot0: mmc0_slot0-board {
						atmel,pins =
							<AT91_PIOB 20 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP_DEGLITCH>;	/* PC2 gpio CD pin pull up and deglitch */
					};
					
				};
				ebi {	
					pinctrl_ebi_cs5: ebi-cs5-0 {
						atmel,pins =
							<AT91_PIOC 9 AT91_PERIPH_A 0>;	/* PC9 nCS5*/
					};

				};
				dm9000 {
					pinctrl_dm9000: pinctrl_dm9000 {
						atmel,pins =
							<AT91_PIOB 18 AT91_PERIPH_GPIO 0>;	/* PB18 interrupt : gpio without pullup */
					};
				};
				
			};
Next, enable the SMC and Matrix nodes:

Code: Select all

smc: smc@ffffec00 {
				compatible = "atmel,at91sam9260-smc", "syscon";
				reg = <0xffffec00 0x1000>;
				status = "okay";
			};
			
			matrix: matrix@ffffee00 {
				compatible = "atmel,at91sam9260-matrix", "syscon";
				reg = <0xffffee00 0x200>;
				status = "okay";
			};
And finally the EBI driver, with the dm9000 node within it. Note the EBI driver was a patch that was found online provided by a key maintainer.

Code: Select all

ebi: ebi@10000000 {
			status=  "okay";
			compatible = "atmel,at91sam9260-ebi";
			#address-cells = <2>;
			#size-cells = <1>;
			atmel,smc = <&smc>;
			atmel,matrix = <&matrix>; 
			reg = <0x10000000 0x80000000>;
			ranges = <0x0 0x0 0x10000000 0x10000000
					 0x1 0x0 0x20000000 0x10000000
					 0x2 0x0 0x30000000 0x10000000
					 0x3 0x0 0x40000000 0x10000000
					 0x4 0x0 0x50000000 0x10000000
					 0x5 0x0 0x60000000 0x10000000
					 0x6 0x0 0x70000000 0x10000000
					 0x7 0x0 0x80000000 0x10000000>;
			clocks = <&main>;
			pinctrl-0 = <&pinctrl_ebi_cs5>;
			pinctrl-names = "default";

			ethernet@5,0 {
				compatible = "davicom,dm9000";
				reg = <0x5 0x0 0x2>, <0x5 0x4 0x2>;
				interrupt-parent = <&pioB>;
				interrupts = <18 IRQ_TYPE_EDGE_BOTH>;
				pinctrl-names = "default";
				pinctrl-0 = <&pinctrl_dm9000>;
				davicom,no-eeprom;
				status = "okay";	
			}; // end of dm9000
		};  // end of ebi
I hope this helps someone using a dm9000 on a parallel bus with CS.

Marked as SOLVED.

Return to “Linux”

Who is online

Users browsing this forum: No registered users and 11 guests