This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/AM3352: RGMII connection to Marvell switch

Part Number: AM3352
Other Parts Discussed in Thread: TPS65217

Tool/software: Linux

Hi, 

I am not using the Sitara SDK kernel but the yocto kernel version 4.9.0

I am trying to get the Marvell 88e6096, gigabit switch with integrated phy, working with the am3352. The media interface  is RGMII MAC-PHY configuration. I know that the am335x mdio interface is only designed to work with the standard phy register set so it is not possible to use dvinci mdio with the cpsw driver. 

So far i am using gpio bit banged from u-boot and I can set the switch up so that there is a link on one of the switch ports.

Now on the linux side I am trying to configure the MAC as "fixed-link". I can see that the cpsw driver can accept this mode and it successfully reads in the  fixed mode parameters. On boot I can see that the fixed link parameters have been acknowledged. Now i was expecting the RGMII interface to be enabled but there is no TCLK signal output from the processor. There is a clock from the switch on the RCLK signal. 

So I assumed that with "fixed-link" enabled the cpsw regsters would be setup by the cpsw driver and the interface would at least be active. I realise there will be further cpsw register configuration but I would still expect the interface to be enabled. 

I have also read something about needing a dummy mdio address for the cpsw driver but I do not understand this and the cpsw driver does not complain about not having one.

Has anyone else used  fixed-link with the cpsw driver successfully? 

I have found other forum threads and it sounds like people have managed this using the old board config file but can't find an example of someone who has done this using the device tree.

Please see bellow for dmesg output and device tree.

Thanks in advance!

On boot I get the following output:

[ 1.097745] pinctrl-single 44e10800.pinmux: could not add functions for cpsw_default 4294965524x
[ 1.121621] cpsw 4a100000.ethernet: Detected MACID = a0:f6:fd:37:ff:bb


[12:53]
[ OK ] Started Network Service.
[ 13.220735] net eth0: initializing cpsw version 1.12 (0)
[ OK ] Listening on Load/Save RF Kill Switch Status /dev/rfkill Watch.
[ OK ] Reached target Network.
[ 13.350236] Generic PHY fixed-0:00: attached PHY driver [Generic PHY] (mii_bus:phy_addr=fixed-0:00, irq=-1)
[ OK ] Started strongSwan IPsec IKEv1/IKEv2 daemon using ipsec.conf.
Starting Enable and configure wl18xx bluetooth stack...
[ 13.582715] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
Starting Lightning Fast Webserver With Light System Requirements...
Starting Permit User Sessions...
Starting Network Name Resolution...
Starting Simple Network Management Protocol (SNMP) Daemon....
[ OK ] Started Lightning Fast Webserver With Light System Requirements.
[ OK ] Started Permit User Sessions.
[ 14.480244] cpsw 4a100000.ethernet eth0: Link is Up - 1Gbps/Full - flow control off
[ 14.488035] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready

and from ethtool:

root@am335x-evm:~# ethtool eth0
Settings for eth0:
Supported ports: [ TP AUI BNC MII FIBRE ]
Supported link modes: 1000baseT/Half 1000baseT/Full
Supported pause frame use: No
Supports auto-negotiation: Yes
Advertised link modes: 1000baseT/Half 1000baseT/Full
Advertised pause frame use: No
Advertised auto-negotiation: Yes
Link partner advertised link modes: 1000baseT/Full
Link partner advertised pause frame use: No
Link partner advertised auto-negotiation: No
Speed: 1000Mb/s
Duplex: Full
Port: MII
PHYAD: 0
Transceiver: external
Auto-negotiation: on
Supports Wake-on: d
Wake-on: d
Current message level: 0x00000000 (0)

Link detected: yes

My device tree:

/*
* Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/

#include "am33xx.dtsi"

/ {
cpus {
cpu@0 {
cpu0-supply = <&dcdc3_reg>;
};
};

memory@80000000 {
device_type = "memory";
reg = <0x80000000 0x10000000>; /* 256 MB */
};

chosen {
stdout-path = &uart0;
};


vmmcsd_fixed: fixedregulator0 {
compatible = "regulator-fixed";
regulator-name = "vmmcsd_fixed";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
};
};


&am33xx_pinmux {
pinctrl-names = "default";
// pinctrl-0 = <&clkout2_pin>;

i2c0_pins: pinmux_i2c0_pins {
pinctrl-single,pins = <
AM33XX_IOPAD(0x988, PIN_INPUT_PULLUP | MUX_MODE0) /* i2c0_sda.i2c0_sda */
AM33XX_IOPAD(0x98c, PIN_INPUT_PULLUP | MUX_MODE0) /* i2c0_scl.i2c0_scl */
>;
};

uart0_pins: pinmux_uart0_pins {
pinctrl-single,pins = <
AM33XX_IOPAD(0x970, PIN_INPUT_PULLUP | MUX_MODE0) /* uart0_rxd.uart0_rxd */
AM33XX_IOPAD(0x974, PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* uart0_txd.uart0_txd */
>;
};

spi0_pins: pinmux_spi0_pins {
pinctrl-single,pins = <
AM33XX_IOPAD(0x150, PIN_INPUT | MUX_MODE0 ) // (A18) spi0_sclk.spi0_sclk
AM33XX_IOPAD(0x154, PIN_INPUT | MUX_MODE0 ) // (B18) spi0_d0.spi0_d0
AM33XX_IOPAD(0x158, PIN_INPUT | MUX_MODE0 ) // (B17) spi0_d1.spi0_d1
AM33XX_IOPAD(0x15c, PIN_INPUT_PULLUP | MUX_MODE0 ) // (A17) spi0_cs0.spi0_cs0
AM33XX_IOPAD(0x160, PIN_INPUT_PULLUP | MUX_MODE0 ) // (B16) spi0_cs1.spi0_cs1
>;
};


cpsw_default: cpsw_default {
pinctrl-single,pins = <
/* Slave 1 */
AM33XX_IOPAD(0x114, PIN_OUTPUT | MUX_MODE2 ) // (K17) gmii1_txen.rgmii1_tctl
AM33XX_IOPAD(0x118, PIN_INPUT | MUX_MODE2 ) // (L19) gmii1_rxdv.rgmii1_rctl
AM33XX_IOPAD(0x12c, PIN_OUTPUT | MUX_MODE2 ) // (N19) gmii1_txclk.rgmii1_tclk
AM33XX_IOPAD(0x130, PIN_INPUT | MUX_MODE2 ) // (M19) gmii1_rxclk.rgmii1_rclk
AM33XX_IOPAD(0x128, PIN_OUTPUT | MUX_MODE2 ) // (L18) gmii1_txd0.rgmii1_td0
AM33XX_IOPAD(0x124, PIN_OUTPUT | MUX_MODE2 ) // (M18) gmii1_txd1.rgmii1_td1
AM33XX_IOPAD(0x120, PIN_OUTPUT | MUX_MODE2 ) // (N18) gmii1_txd2.rgmii1_td2
AM33XX_IOPAD(0x11c, PIN_OUTPUT | MUX_MODE2 ) // (M17) gmii1_txd3.rgmii1_td3
AM33XX_IOPAD(0x140, PIN_INPUT | MUX_MODE2 ) // (P18) gmii1_rxd0.rgmii1_rd0
AM33XX_IOPAD(0x13c, PIN_INPUT | MUX_MODE2 ) // (P19) gmii1_rxd1.rgmii1_rd1
AM33XX_IOPAD(0x138, PIN_INPUT | MUX_MODE2 ) // (N16) gmii1_rxd2.rgmii1_rd2
AM33XX_IOPAD(0x134, PIN_INPUT | MUX_MODE2 ) // (N17) gmii1_rxd3.rgmii1_rd3
>;
};


davinci_mdio_default: davinci_mdio_default {
pinctrl-single,pins = <
/* MDIO */
AM33XX_IOPAD(0x948, PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE7) /* mdio_data.mdio_data */
AM33XX_IOPAD(0x94c, PIN_OUTPUT_PULLUP | MUX_MODE7) /* mdio_clk.mdio_clk */
>;
};

mmc_pins: pinmux_emmc_pins {
pinctrl-single,pins = <
AM33XX_IOPAD(0x100, PIN_INPUT | MUX_MODE0 ) // (G19) mmc0_clk.mmc0_clk
AM33XX_IOPAD(0x104, PIN_OUTPUT | MUX_MODE0 ) // (G17) mmc0_cmd.mmc0_cmd
AM33XX_IOPAD(0xfc, PIN_INPUT | MUX_MODE0 ) // (G18) mmc0_dat0.mmc0_dat0
AM33XX_IOPAD(0xf8, PIN_INPUT | MUX_MODE0 ) // (H17) mmc0_dat1.mmc0_dat1
AM33XX_IOPAD(0xf4, PIN_INPUT | MUX_MODE0 ) // (H18) mmc0_dat2.mmc0_dat2
AM33XX_IOPAD(0xf0, PIN_INPUT | MUX_MODE0 ) // (H19) mmc0_dat3.mmc0_dat3
>;
};


};

&uart0 {
pinctrl-names = "default";
pinctrl-0 = <&uart0_pins>;

status = "okay";
};

&spi0 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&spi0_pins>;
};

&usb {
status = "okay";
};

&usb_ctrl_mod {
status = "okay";
};

&usb0_phy {
status = "okay";
};

&usb0 {
status = "okay";
dr_mode = "host";
};

&cppi41dma {
status = "okay";
};

&i2c0 {
pinctrl-names = "default";
pinctrl-0 = <&i2c0_pins>;

status = "okay";
clock-frequency = <400000>;

tps: tps@24 {
reg = <0x24>;
};
};

/include/ "tps65217.dtsi"

&tps {
/*
* Configure pmic to enter OFF-state instead of SLEEP-state ("RTC-only
* mode") at poweroff. Most BeagleBone versions do not support RTC-only
* mode and risk hardware damage if this mode is entered.
*
* For details, see linux-omap mailing list May 2015 thread
* [PATCH] ARM: dts: am335x-bone* enable pmic-shutdown-controller
* In particular, messages:
* www.spinics.net/.../msg118585.html
* www.spinics.net/.../msg118615.html
*
* You can override this later with
* &tps { /delete-property/ ti,pmic-shutdown-controller; }
* if you want to use RTC-only mode and made sure you are not affected
* by the hardware problems. (Tip: double-check by performing a current
* measurement after shutdown: it should be less than 1 mA.)
*/
ti,pmic-shutdown-controller;

regulators {
dcdc1_reg: regulator@0 {
regulator-name = "vdds_ddr_reg";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
regulator-boot-on;
regulator-always-on;
};

dcdc2_reg: regulator@1 {
/* VDD_MPU voltage limits 0.95V - 1.26V with +/-4% tolerance */
regulator-name = "vdd_mpu_core";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-boot-on;
regulator-always-on;
};

dcdc3_reg: regulator@2 {
/* VDD_CORE voltage limits 0.95V - 1.1V with +/-4% tolerance */
regulator-name = "vdd_core";
regulator-min-microvolt = <1125000>;
regulator-max-microvolt = <1125000>;
regulator-boot-on;
regulator-always-on;
};

ldo1_reg: regulator@3 {
regulator-name = "vio,vrtc,vdds";
regulator-always-on;
};

ldo2_reg: regulator@4 {
regulator-name = "vdd_3v3aux";
regulator-always-on;
};

ldo3_reg: regulator@5 {
regulator-name = "vdd_1v8";
regulator-always-on;
};

ldo4_reg: regulator@6 {
regulator-name = "vdd_3v3a";
regulator-always-on;
};
};
};

&cpsw_emac0 {
//phy_id = <&davinci_mdio>, <0x10>;
fixed-link = <0 1 1000 0 0>;
phy-mode = "rgmii-txid";
};

&mac {
slaves = <1>;
pinctrl-names = "default";
//pinctrl-names = "default", "sleep";
pinctrl-0 = <&cpsw_default>;
status = "okay";
};

/*
&davinci_mdio {
pinctrl-names = "default", "sleep";
pinctrl-0 = <&davinci_mdio_default>;
status = "okay";
};
*/


&mmc1 {
status = "okay";
bus-width = <0x4>;
pinctrl-names = "default";
pinctrl-0 = <&mmc_pins>;
};


&aes {
status = "okay";
};

&sham {
status = "okay";
};