Custom board with AT91SAM9260 uC and Micrel switch KSZ8893MBL

This forum is for users of Microchip MPUs and who are interested in using Linux OS.

Moderator: nferre

mbonaldi
Posts: 1
Joined: Mon Dec 03, 2018 4:50 pm

Custom board with AT91SAM9260 uC and Micrel switch KSZ8893MBL

Mon Dec 03, 2018 5:49 pm

Hi everybody,
I am new to this forum and I am glad to be here.

I have compiled Linux Kernel linux-at91-linux4sam_6.0 for my target uC at91sam9260. In my custom board the uC is connected via MDIO to Micrel switch KSZ8893MBL and no directly to PHY. The switch has 3 ports:
0 --> connected to at91sam9260
1 --> not used
2 --> connected to PHY.
Before I used an older Linux version and ethernet worked fine; but now I have to use the device tree. My aim is to explain to kernel that there is no direct PHY, and to carry to this new environment the patches I did in kernel 2.6.39.4.
I am new to device tree usage, so I am here to ask if I am doing well (of course, ethernet does not work and that's why I'm here).

This was my patch on the old kernel in file board-sam9260ek.c

Code: Select all

/*
 * MACB Ethernet device
 */
static struct at91_eth_data __initdata ek_macb_data = {
	.phy_irq_pin	= AT91_PIN_PA7,
	/* .phy_mask       = (~(0x00000004)), */ 	/* This was the EK code */
	.phy_mask       = (~(0x00000008)),               /* Enable only port "3" of switch ethernet */
	.is_rmii	= 0,
};
And this is my new device tree

Code: Select all

macb0: ethernet@fffc4000 {
				phy-mode = "mii";
				status = "okay";
				phy-handle = &port2; 
			};


mdio {
	compatible="mdio";
	#address-cells = <1>;
	#size-cells = <0>;

        switch: switch@0 {
		compatible = "micrel,ks8995ma";
		phy-mode = "mii";
	    	reg = <0>;

	    	ports{
			#address-cells = <1>;
			#size-cells = <0>;
			port0: port@0 {
			       reg = <0>;
			       status = "okay";
			       ethernet = <&macb0>;
			};
			port1: port@1 {
			       reg = <1>;
			       status = "disabled";
			};
			port2: port@2{
			       reg = <2>;
			       status = "okay";
			       fixed-link{
					speed = <100>;
					full-duplex;
			       };
			};
	    	};
	    };

};
My questions are:
1) Is the device tree representation well posed?
2) How can I describe the .phy_irq_pin and .phy_mask parameters in this new environment, i.e. which parameters in the switch node may I set?

Note: I have set switch compatibility to "micrel,ks8995ma" because this is the only switch I could choose in menuconfig, my aim was to bind the driver but it failes since dmesg gives
Generic PHY fffc4000.ethernet-ffffffff:00: attached PHY driver [Generic PHY] (mii_bus:phy_addr=fffc4000.ethernet-ffffffff:00, irq=POLL)
macb fffc4000.ethernet eth0: Cadence MACB rev 0x0001010c at 0xfffc4000 irq 28 (3a:1f:34:08:54:18)
While with older kernel I had
eth0: Atmel MACB at 0xfffc4000 irq 21 (3a:1f:34:08:54:18)
eth0: attached PHY driver [Generic PHY] (mii_bus:phy_addr=ffffffff:03, irq=-1)

Thanks everybody!
Marta
blue_z
Location: USA
Posts: 1785
Joined: Thu Apr 19, 2007 10:15 pm

Re: Custom board with AT91SAM9260 uC and Micrel switch KSZ8893MBL

Wed Dec 05, 2018 2:09 am

mbonaldi wrote: 1) Is the device tree representation well posed?
(You mean composed or written?)
Did you (improperly) modify a .dtsi file or do you have a .dts file for your board?
I can only comment on your compatible string.
mbonaldi wrote: Note: I have set switch compatibility to "micrel,ks8995ma" because this is the only switch I could choose in menuconfig, my aim was to bind the driver but it failes since dmesg gives ...
(1) What driver you select through menuconfig only specifies that it be built (i.e compiled). There's no "binding".
(2) You do not select a driver just because it has the same manufacturer or similar part number. You have to select a driver that actually supports the device that you have.

mbonaldi wrote: 2) How can I describe the .phy_irq_pin and .phy_mask parameters in this new environment, i.e. which parameters in the switch node may I set?
If there actually is a Linux driver for the KSZ8893MBL, and it supports configuration by Device Tree, then there would be a bindings document.

Regards

Return to “LINUX”

Who is online

Users browsing this forum: No registered users and 5 guests