Post Go back to editing

Configure SC573 EMAC0 in RMII mode

Category: Software
Product Number: ADSP-SC573
Software Version: Linux Add-in 1.3.1

Problem

Our board has a DP83848 PHY connected to the ADSP-SC573 using the RMII interface. 

Currently the ADSP-SC573 can transmit data to other hosts through Ethernet but it doesn't receive any packet.

¿Could you check is there is something missing in the PHY or in the EMAC driver?

I would like to aggregate that the DP83848M seems to be working OK since I checked with an oscilloscope its RXD1/RXD0 and CRS_DV signals when its connected to a router.

And also I've configure the DP83848M in loopback mode and checked with the oscilloscope that the ADSP-SC573 TXD data is sent back by the DP83848M to the ADSP-SC573.

Software involved

- Software: Linux-add in 1.3.1

- PHY driver was obtained from linux github, drivers/net/phy/dp83848.c

- The emac driver used is stmmac with the following device tree node:

emac0: ethernet@0x3100C000 {
			compatible = "snps,dwmac", "snps,dwmac-3.710";
			reg = <0x3100C000 0x2000>;
			interrupt-parent = <&gic>;
			interrupts = <0 135 0>;
			interrupt-names = "macirq";
			snps,reset-gpio = <&gpd 15 0>;
			snps,reset-active-low;
			snps,reset-delays-us = <0 10000 10000>;
			snps,fixed-burst;
			snps,burst_len = <0x4>; /* BLEN8 */
			snps,pbl = <1>;
			snps,force_thresh_dma_mode;
			phy-mode = "rmii";;
			clock-names = "stmmaceth";
			pinctrl-names = "default";
			pinctrl-0 = <&eth0_default>;
		};

- The pinmuxing is the following

static const unsigned eth0_rmii_pins[] = {
	GPIO_PB7, GPIO_PB8, GPIO_PA11, GPIO_PA10, GPIO_PA13,
	GPIO_PA12, GPIO_PB0, GPIO_PB1, GPIO_PB9,
};

static const unsigned short eth0_rmii_mux[] = {
	P_ETH0_TXD0, P_ETH0_TXD1, P_ETH0_MDC, P_ETH0_MDIO, P_ETH0_RXD0,
	P_ETH0_RXD1, P_ETH0_RXCLK, P_ETH0_CRS, P_ETH0_TXEN,
	0
};

- To put the ADSP-SC573 EMAC0 in RMII mode i modified the buildroot/linux/linux-kernel/arch/arm/mach-sc57x/core.c file to config the PADS_PCFG0.EMACPHYISEL to 0x10

#ifdef CONFIG_DP83848_PHY
	/* select RMII interface */
	if (IS_BUILTIN(CONFIG_PHYLIB)) {
		/* unset b4 & b3 (PADS_PCFG0.EMACPHYISEL) */
		writel((readl(__io_address(REG_PADS0_PCFG0)) & 0xFFFFFFD7),
				__io_address(REG_PADS0_PCFG0));
		/* set b4 (b4,b3 = 1,0 for RMII mode) & set b2 (PADS_PCFG0.EMACRESET)*/
		writel((readl(__io_address(REG_PADS0_PCFG0)) | 0x00000014),
				__io_address(REG_PADS0_PCFG0));
	}
#else
	/* Config as RGMII */
	...
#endif

Hardware involved

- MCU: ADSP-SC573

- PHY: DP83848M (It hasn't the PWR_DOWN/INT pin) 

- The connections are the RMII described in the SC573 HRM

DP83848M ADSP-SC573
MDIO PA_ 10/ETH0_MDIO
MDC PA_11/ETH0_MDC
RXD_0/PHYAD1 PA_13/ETH0_RXD0
RXD_1/PHYAD2 PA_12/ETH0_RXD1
CRS/CRS_DV/LED_CFG PB_01/ETH0_CRS
TX_EN PB_09/ETH0_TXCTL_TXEN
TXD_0 PB_07/ETH0_TXD0
TXD_1 PB_08/ETH0_TXD1

Also

- The DP83848M X1 and the ADSP-SC573 PB_00/ETH0_RXCLK_REFCLK are connected to a 50MHz oscilator.

- The DP83848M RESET_N pin is connected to the ADSP-SC573 PD_15 pin.

- The DP83848M is boostrapped to  work in RMII mode.

Thanks in advance for your time, any extra information you may need please ask.

Best regards,

Luca Guazzaroni

  • Hi Luca,

    I'm working on your query, Thanks for sharing the details

    will check from my side and get back to you.

    Thanks,

    Prasanth R

  • Thanks, Prasanth. 

    Looking forward to hearing from you soon. 

    If you need any more info or tests from our end please let us know. 

  • Hi Luca,

    After exploring the details, I could see the DP83867 was replaced with DP83848, is this custom hardware?

    1.kindly share the schematic of the custom board to check the pin connections, 

    2. Are you modifying the sc573*.dts file or Do you have your own DTS file, kindly share the complete DTS file.

    Do you see the loopback was working fine and issue only with receiving packets? I suspect it might be an hardware pin issue, 

    I will check further and consult with the engineering team for further modification if needed. kindly share the complete files.

    Thanks,

    Prasanth R

  • Hi Prasanth, thanks for your fast response.

    1. As you noticed, we are using custom Hardware. These are the schematics related to the PHY

    ADSP-SC573 EMAC

    ADSP-SC573 PHY reset

    DP83848M

    2. We have or own DTS file which includes  sc573*.dtsi. Here are the ones we are using:

    custom.dts

    sc573*.dtsi

    3. Do you see the loopback was working fine and issue only with receiving packets?
    I checked with an oscilloscope that the DP83848's loopback mode was working fine. And also, If I connect another device to our board's ethernet, the packets sent by the SC573 are correctly received by the device

     I suspect it might be an hardware pin issue
    Regarding this hypothesis,
    I configured the RXD0, RXD1 and CRS_DV pins as GPIO inputs to check the connections. And it seems to be working fine.

     #Config RXD1 and RXD0 as GPIO
    PORTA_FER_CLR  |  0x00003000 
    PORTA_INEN_SET |  0x00003000 
    
     #Config CRS_DV as GPIO
    PORTB_FER_CLR | 0x00000002
    PORTB_FER_CLR | 0x00000002
    


    If you think it is necessary, I can repeat this test or another that you suggest to verify that the connections are correct.

    Thanks,

    Luca G

  • Hi Luca,

    Thanks for sharing the details.

    1. phy-handle and the register setting are missing, kindly try to set that and it give a try.

    &emac0 {
    	phy-handle = <&dp83848>;
    	phy-mode = "rmii";
    	pinctrl-names = "default";
    	pinctrl-0 = <&eth0_default>;
    	status = "okay";
    
    	mdio0 {
    		compatible = "snps,dwmac-mdio";
    		#address-cells = <1>;
    		#size-cells = <0>;
    		dp83848: ethernet-phy@1 {
    			reg = <1>;
    		};
    	};
    
    };

    2, I could see the shared dts is missing with the pin muxing details for eth0_default, So I can't verify the pin details

    are you using the primitive method of doing the pin muxing in the driver itself?

    I see SC589 has two phy, one of which is the same dp83848, You can use that as a reference and try to implement the same style of setting in your device tree(dts), which can confirm our settings were good,

    If the issue still exists we can start exploring the others. I believe the pad, impedance values, and other hardware-related things would have been calculated good.

    I believe the above sc589 reference method will surely help. Let me know the progress. 

    I have attached the sc589 dts and dtsi files for reference, You can find those in your kernel source too.

    Thanks,

    Prasanth R

    sc589.zip

  • Hi Prasanth,

    Thanks for your suggestions.

    1. I applied the modifications you suggested on our end and the result is the same. We can set and read the PHY registers through the MDIO interface, and we can successfully transmit through the RMII interface. But we still can't receive packets on the EMAC.

    2. I am attaching the new custom dts file, and as you asked me, the file where the pin configuration is done. Interesting variables are eth0rmiigrp, eth0_rmii_pins, and eth0_rmii_mux.


    3. Could you share with me a link to the kernel source you mentioned? We are using ADI's buildroot instead of ADI's Yocto to compile Linux and the SC589-ezkit files are not available.

    4. On the other hand, I manually set the EMAC_MACCFG.LM bit to put the SC573's EMAC0 in loopback mode, and with that setting, EMAC0 detects RX packets.

     

    dts-and-pin-control.zip


    Thanks 

    Luca G

  • Hi Luca,

    I believe the pin muxing might be an issue, I will check with your shared schematic and get back to you.

    Meanwhile, you can explore the Yocto kernel source, Here is the source link (you can use the release branches)

    https://github.com/analogdevicesinc/lnxdsp-linux/tree/release/yocto-2.1.0

    https://github.com/analogdevicesinc/lnxdsp-linux/blob/develop/yocto-2.1.0/arch/arm/boot/dts/sc589-ezkit.dts

    Thanks,

    Prasanth R

  • Hi Prasanth, 

    Thanks for sharing the Linux source, I will take a look at it while waiting for new updates from your side.

    Thanks!

    Luca G

  • Hi Prasanth,

    I hope you're doing well.
    I was wondering if you might have found so far any clues as to what is missing to make RMII work.

    Best regards

    Luca G.

  • Hi Luca,

    As we didn't see any issue in your setup,

    The only change seen in the SC589 sources for the DP83848 mux setup uses TXCLK whereas yours uses RXCLK, could you try that?

    SC589
    static const unsigned short eth1_mux[] = {
    P_ETH1_CRS, P_ETH1_MDC, P_ETH1_MDIO, P_ETH1_TXCLK, P_ETH1_TXEN,
    P_ETH1_TXD0, P_ETH1_TXD1, P_ETH1_RXD0, P_ETH1_RXD1,
    0
    };
    
    Yours
    
    static const unsigned short eth0_rmii_mux[] = {
    P_ETH0_TXD0, P_ETH0_TXD1, P_ETH0_MDC, P_ETH0_MDIO, P_ETH0_RXD0,
    P_ETH0_RXD1, P_ETH0_RXCLK, P_ETH0_CRS, P_ETH0_TXEN,
    0
    };

    Thanks,

    Prasanth R