Add ENC28J60 to custom WP7607 board

hi,

I solved it. I used the driver included in the kernel. Mostly i had HW issues. I added a subnode in the tlmm_pinmux node for interrupt and reset pin:

&soc{ 
	tlmm_pinmux: pinctrl@1000000 {
		enc28j60_int_default: enc28j60_int_default {
			mux {
				pins = "gpio76";
				function = "gpio";
			};
			config {
				pins = "gpio76";
				drive-strength = <16>; /* in mA */
				bias-pull-up;
			};
		};

		enc28j60_rst_default: enc28j60_rst_default {
			mux {
				pins = "gpio58";
				function = "gpio";
			};
			config {
				pins = "gpio58";
				drive-strength = <16>; /* in mA */
				output-high;
			};
		};
	};
};	

Then added to spi_1 node:

&spi_1 {
 	status = "ok";
	eth0: enc28j60@0 {
		#address-cells = <1>;
		#size-cells = <1>;
		compatible = "microchip,enc28j60";
		spi-max-frequency = <5000000>;
		reg = <0>;
		interrupt-parent = <&tlmm_pinmux>;
		interrupts = <76 2>; /*IRQ_TYPE_EDGE_FALLING*/
		pinctrl-names = "enc28j60_int_default";
		pinctrl-0 = <&enc28j60_int_default>;
		enc28j60,duplex_mode=<1>;
	};
 };

Added my own flag for full_duplex mode in the driver (enc28j60,duplex_mode) as the driver starts in half_duplex and there is no way to configure this (wierd?).

I however had troubles with the boot configuration of the reset pin. It should be set to output high but at boot it was set low which made the enc28j60 be in constant reset. I think i have it configured now to boot as output high, but I needed to configure it with at+wiocfg=8,4,1,1 i think. I don’t understand this, maybe the at configuration overrides DTS config at boot or something?

The gpio numberings are the qualcomm pin numbers which don’t corresponds to wp7607 pin numbers. found it in this forum post GPIO Interrupts on WP7702 Module

This should at least be documented somewhere more clearly.

the device tree incompatibility you mentioned does not seem to matter.