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.

AM3358: PRU Ethernet Issues

Part Number: AM3358
Other Parts Discussed in Thread: AM3359

Hi,

I am doing some initial testing with PRU Ethernet for a custom board. While I'm waiting for the custom PCB, I am using a beaglebone black to test functionality as it shares the same processor (AM3358). I am aware that the beaglebone black does not have PHYs connected to the PRU MII pins. I just want to verify that the driver is able to correctly load and create eth devices in Linux. To that end, I have patched the prueth driver init function to allow PHY-less operation (see attached patch.txt file).

I have read all the documentation about PRU Ethernet and the required device tree settings, kernel config, adding prueth-fw and pru-icss recipes from meta-ti layer to the build, etc, and have applied these changes to my yocto build (morty using ti-linux 4.19). However, when the board boots, the prueth driver complains during the probe about being unable to allocate the ocmcram it uses for passing packets back and forth. I double checked my device tree settings against those for the ICEv2 EVM (which I have running the SDK SD Image and working with PRU Ethernet) and can't find anything different with how the ocmcram is referenced.

I have attached my kernel defconfig, boot log, and device tree. Please let me know if there is anything wrong in any of them that I need to fix.

Regards,

Greg Leonberg

Booting from SD Card
reading recovery
** Unable to read file recovery **
36489 bytes read in 54 ms (659.2 KiB/s)
Loaded /boot/am335x-custom.dtb from mmc 0:2
5379000 bytes read in 523 ms (9.8 MiB/s)
Loaded /boot/zImage from mmc 0:2
## Flattened Device Tree blob at 88000000
   Booting using the fdt blob at 0x88000000
   Loading Device Tree to 8fff4000, end 8ffffe88 ... OK

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.19.94-custom (build_manager@custom_dev) (gcc version 6.2.0 (GCC)) #14 Tue Nov 10 10:35:00 EST 2020
[    0.000000] CPU: ARMv7 Processor [413fc082] revision 2 (ARMv7), cr=10c5387d
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] OF: fdt: Machine model: TI AM335x Custom
[    0.000000] Memory policy: Data cache writeback
[    0.000000] cma: Reserved 16 MiB at 0x9f000000
[    0.000000] CPU: All CPU(s) started in SVC mode.
[    0.000000] AM335X ES2.1 (sgx neon)
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 130048
[    0.000000] Kernel command line: console=ttyO0,115200n8 root=/dev/mmcblk0p2 rootfstype=ext4 ro rootdelay=1 normal
[    0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
[    0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
[    0.000000] Memory: 484576K/524288K available (7330K kernel code, 641K rwdata, 2600K rodata, 372K init, 7423K bss, 23328K reserved, 16384K cma-reserved, 0K highmem)
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
[    0.000000]     vmalloc : 0xe0800000 - 0xff800000   ( 496 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xe0000000   ( 512 MB)
[    0.000000]     pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
[    0.000000]     modules : 0xbf000000 - 0xbfe00000   (  14 MB)
[    0.000000]       .text : 0x(ptrval) - 0x(ptrval)   (7331 kB)
[    0.000000]       .init : 0x(ptrval) - 0x(ptrval)   ( 372 kB)
[    0.000000]       .data : 0x(ptrval) - 0x(ptrval)   ( 642 kB)
[    0.000000]        .bss : 0x(ptrval) - 0x(ptrval)   (7424 kB)
[    0.000000] Running RCU self tests
[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[    0.000000] IRQ: Found an INTC at 0x(ptrval) (revision 5.0) with 128 interrupts
[    0.000000] OMAP clockevent source: timer2 at 24000000 Hz
[    0.000017] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
[    0.000049] clocksource: timer1: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[    0.000099] OMAP clocksource: timer1 at 24000000 Hz
[    0.000468] timer_probe: no matching timers found
[    0.001193] Console: colour dummy device 80x30
[    0.001243] Lock dependency validator: Copyright (c) 2006 Red Hat, Inc., Ingo Molnar
[    0.001258] ... MAX_LOCKDEP_SUBCLASSES:  8
[    0.001272] ... MAX_LOCK_DEPTH:          48
[    0.001286] ... MAX_LOCKDEP_KEYS:        8191
[    0.001300] ... CLASSHASH_SIZE:          4096
[    0.001313] ... MAX_LOCKDEP_ENTRIES:     32768
[    0.001327] ... MAX_LOCKDEP_CHAINS:      65536
[    0.001340] ... CHAINHASH_SIZE:          32768
[    0.001353]  memory used by lock dependency info: 4655 kB
[    0.001367]  per task-struct memory footprint: 1536 bytes
[    0.001443] Calibrating delay loop... 996.14 BogoMIPS (lpj=4980736)
[    0.078602] pid_max: default: 32768 minimum: 301
[    0.078958] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.078981] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.080944] CPU: Testing write buffer coherency: ok
[    0.083112] Setting up static identity map for 0x80008200 - 0x80008260
[    0.086471] devtmpfs: initialized
[    0.110649] random: get_random_u32 called from bucket_table_alloc+0x8c/0x1b0 with crng_init=0
[    0.111005] VFP support v0.3: implementor 41 architecture 3 part 30 variant c rev 3
[    0.111594] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.111669] futex hash table entries: 256 (order: 1, 11264 bytes)
[    0.113175] pinctrl core: initialized pinctrl subsystem
[    0.117282] NET: Registered protocol family 16
[    0.123242] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.178593] l4_wkup_cm:clk:0010:0: failed to disable
[    0.233874] cpuidle: using governor ladder
[    0.233949] cpuidle: using governor menu
[    0.261624] OMAP GPIO hardware version 0.1
[    0.286179] No ATAGs?
[    0.286193] hw-breakpoint: debug architecture 0x4 unsupported.
[    0.393007] edma 49000000.edma: TI EDMA DMA engine driver
[    0.397744] SCSI subsystem initialized
[    0.398711] usbcore: registered new interface driver usbfs
[    0.398956] usbcore: registered new interface driver hub
[    0.399088] usbcore: registered new device driver usb
[    0.401469] omap-mailbox 480c8000.mailbox: omap mailbox rev 0x400
[    0.402188] Advanced Linux Sound Architecture Driver Initialized.
[    0.436910] clocksource: Switched to clocksource timer1
[    0.567275] VFS: Disk quotas dquot_6.6.0
[    0.567401] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[    0.616486] NET: Registered protocol family 2
[    0.618556] tcp_listen_portaddr_hash hash table entries: 256 (order: 1, 10240 bytes)
[    0.618649] TCP established hash table entries: 4096 (order: 2, 16384 bytes)
[    0.618735] TCP bind hash table entries: 4096 (order: 5, 147456 bytes)
[    0.619298] TCP: Hash tables configured (established 4096 bind 4096)
[    0.619663] UDP hash table entries: 256 (order: 2, 20480 bytes)
[    0.619774] UDP-Lite hash table entries: 256 (order: 2, 20480 bytes)
[    0.620151] NET: Registered protocol family 1
[    0.623876] RPC: Registered named UNIX socket transport module.
[    0.623966] RPC: Registered udp transport module.
[    0.623983] RPC: Registered tcp transport module.
[    0.623998] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.625495] hw perfevents: enabled with armv7_cortex_a8 PMU driver, 5 counters available
[    0.629237] Initialise system trusted keyrings
[    0.634338] workingset: timestamp_bits=30 max_order=17 bucket_order=0
[    0.636563] NFS: Registering the id_resolver key type
[    0.636715] Key type id_resolver registered
[    0.636792] Key type id_legacy registered
[    0.636845] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[    0.644002] Key type asymmetric registered
[    0.644145] Asymmetric key parser 'x509' registered
[    0.644308] io scheduler noop registered
[    0.644330] io scheduler deadline registered
[    0.644476] io scheduler cfq registered (default)
[    0.648959] pinctrl-single 44e10800.pinmux: 142 pins, size 568
[    0.652137] wkup_m3_ipc 44e11324.wkup_m3_ipc: could not get rproc handle
[    0.669859] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
[    0.675956] omap_uart 44e09000.serial: no wakeirq for uart0
[    0.676381] 44e09000.serial: ttyO0 at MMIO 0x44e09000 (irq = 30, base_baud = 3000000) is a OMAP UART0
[    1.302082] console [ttyO0] enabled
[    1.341162] brd: module loaded
[    1.362163] loop: module loaded
[    1.367564] mtdoops: mtd device (mtddev=name/number) must be supplied
[    1.384324] libphy: Fixed MDIO Bus: probed
[    1.390070] CAN device driver interface
[    1.466965] davinci_mdio 4a101000.mdio: davinci mdio revision 1.6, bus freq 1000000
[    1.475089] davinci_mdio 4a101000.mdio: detected phy mask fffffffe
[    1.484612] libphy: 4a101000.mdio: probed
[    1.488936] davinci_mdio 4a101000.mdio: phy[0]: device 4a101000.mdio:00, driver SMSC LAN8710/LAN8720
[    1.499840] cpsw 4a100000.ethernet: No slave[1] phy_id, phy-handle, or fixed-link property
[    1.508718] cpsw 4a100000.ethernet: Detected MACID = 38:d2:69:49:c6:7d
[    1.517740] cpsw 4a100000.ethernet: initialized cpsw ale version 1.4
[    1.524412] cpsw 4a100000.ethernet: ALE Table size 1024
[    1.532754] PPP generic driver version 2.4.2
[    1.541415] PPP BSD Compression module registered
[    1.546364] PPP Deflate Compression module registered
[    1.551772] PPP MPPE Compression module registered
[    1.556795] NET: Registered protocol family 24
[    1.561745] usbcore: registered new interface driver rtl8150
[    1.567883] usbcore: registered new interface driver r8152
[    1.573733] usbcore: registered new interface driver asix
[    1.579516] usbcore: registered new interface driver ax88179_178a
[    1.585988] usbcore: registered new interface driver cdc_ether
[    1.592554] usbcore: registered new interface driver smsc75xx
[    1.598771] usbcore: registered new interface driver smsc95xx
[    1.604883] usbcore: registered new interface driver net1080
[    1.610930] usbcore: registered new interface driver cdc_subset
[    1.617257] usbcore: registered new interface driver zaurus
[    1.623222] usbcore: registered new interface driver cdc_ncm
[    1.635698] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    1.642666] ehci-omap: OMAP-EHCI Host Controller driver
[    1.648622] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    1.655342] usbcore: registered new interface driver cdc_acm
[    1.661352] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
[    1.669877] usbcore: registered new interface driver cdc_wdm
[    1.675951] usbcore: registered new interface driver usb-storage
[    1.682517] usbcore: registered new interface driver usbserial_generic
[    1.689818] usbserial: USB Serial support registered for generic
[    1.696313] usbcore: registered new interface driver ftdi_sio
[    1.702485] usbserial: USB Serial support registered for FTDI USB Serial Device
[    1.710246] usbcore: registered new interface driver option
[    1.716163] usbserial: USB Serial support registered for GSM modem (1-port)
[    1.723581] usbcore: registered new interface driver usb_serial_simple
[    1.730555] usbserial: USB Serial support registered for carelink
[    1.737057] usbserial: USB Serial support registered for zio
[    1.743061] usbserial: USB Serial support registered for funsoft
[    1.749466] usbserial: USB Serial support registered for flashloader
[    1.756201] usbserial: USB Serial support registered for google
[    1.762563] usbserial: USB Serial support registered for libtransistor
[    1.769500] usbserial: USB Serial support registered for vivopay
[    1.775862] usbserial: USB Serial support registered for moto_modem
[    1.782526] usbserial: USB Serial support registered for motorola_tetra
[    1.789550] usbserial: USB Serial support registered for novatel_gps
[    1.796266] usbserial: USB Serial support registered for hp4x
[    1.802381] usbserial: USB Serial support registered for suunto
[    1.808679] usbserial: USB Serial support registered for siemens_mpi
[    1.815453] usbcore: registered new interface driver usbtest
[    1.846021] udc-core: couldn't find an available UDC - added [g_audio] to list of pending drivers
[    1.873699] mousedev: PS/2 mouse device common for all mice
[    1.885869] omap_rtc 44e3e000.rtc: registered as rtc0
[    1.891708] i2c /dev entries driver
[    1.895430] Driver for 1-wire Dallas network protocol.
[    1.907154] omap_wdt: OMAP Watchdog Timer Rev 0x01: initial timeout 60 sec
[    1.917534] omap_gpio 44e07000.gpio: Could not set line 6 debounce to 200000 microseconds (-22)
[    1.926645] omap_hsmmc 48060000.mmc: Got CD GPIO
[    1.933105] omap_hsmmc 48060000.mmc: Linked as a consumer to regulator.1
[    1.969651] omap_hsmmc 481d8000.mmc: Linked as a consumer to regulator.1
[    2.005257] ledtrig-cpu: registered to indicate activity on CPUs
[    2.014902] remoteproc remoteproc0: wkup_m3 is available
[    2.022026] remoteproc remoteproc1: 4a334000.pru is available
[    2.028331] pru-rproc 4a334000.pru: PRU rproc node pru@4a334000 probed successfully
[    2.036857] remoteproc remoteproc2: 4a338000.pru is available
[    2.043121] pru-rproc 4a338000.pru: PRU rproc node pru@4a338000 probed successfully
[    2.064256] mmc0: host does not support reading read-only switch, assuming write-enable
[    2.075166] random: fast init done
[    2.080780] mmc0: new high speed SDHC card at address b368
[    2.089940] usbcore: registered new interface driver snd-usb-audio
[    2.097531] oprofile: using arm/armv7
[    2.102128] Initializing XFRM netlink socket
[    2.107106] NET: Registered protocol family 10
[    2.115232] mmcblk0: mmc0:b368 USD   7.47 GiB
[    2.127107] Segment Routing with IPv6
[    2.131108] NET: Registered protocol family 17
[    2.135844] NET: Registered protocol family 15
[    2.140548] can: controller area network core (rev 20170425 abi 9)
[    2.147240] NET: Registered protocol family 29
[    2.151901] can: raw protocol (rev 20170425)
[    2.156529] can: broadcast manager protocol (rev 20170425 t)
[    2.162774] 8021q: 802.1Q VLAN Support v1.8
[    2.167467] Key type dns_resolver registered
[    2.172177] ThumbEE CPU extension supported.
[    2.176653] omap_voltage_late_init: Voltage driver support not added
[    2.186072]  mmcblk0: p1 p2
[    2.196131] Loading compiled-in X.509 certificates
[    2.249476] mmc1: new high speed MMC card at address 0001
[    2.257114] mmcblk1: mmc1:0001 M62704 3.56 GiB
[    2.262371] mmcblk1boot0: mmc1:0001 M62704 partition 1 2.00 MiB
[    2.269130] mmcblk1boot1: mmc1:0001 M62704 partition 2 2.00 MiB
[    2.277858] mmcblk1rpmb: mmc1:0001 M62704 partition 3 512 KiB, chardev (246:0)
[    2.292376]  mmcblk1: p1 p2
[    2.322453] tps65217 0-0024: TPS65217 ID 0xe version 1.2
[    2.328965] omap_i2c 44e0b000.i2c: bus 0 rev0.11 at 400 kHz
[    2.338237] remoteproc remoteproc0: powering up wkup_m3
[    2.344297] remoteproc remoteproc0: Direct firmware load for am335x-pm-firmware.elf failed with error -2
[    2.354464] remoteproc remoteproc0: request_firmware failed: -2
[    2.360740] wkup_m3_ipc 44e11324.wkup_m3_ipc: rproc_boot failed
[    2.368827] hctosys: unable to open rtc device (rtc1)
[    2.375053] ALSA device list:
[    2.378283]   No soundcards found.
[    2.385428] Waiting 1 sec before mounting root device...
[    3.487946] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[    3.496722] VFS: Mounted root (ext4 filesystem) readonly on device 179:2.
[    3.526998] devtmpfs: mounted
[    3.530696] Freeing unused kernel memory: 372K
[    3.535348] This architecture does not have kernel memory protection.
[    3.542133] Run /sbin/init as init process
INIT: version 2.88 booting
Starting udev
[    4.434672] udevd[1026]: starting version 3.2
[    4.460821] random: udevd: uninitialized urandom read (16 bytes read)
[    4.470116] random: udevd: uninitialized urandom read (16 bytes read)
[    4.477105] random: udevd: uninitialized urandom read (16 bytes read)
[    4.544146] udevd[1027]: starting eudev-3.2
[    5.539845] prueth pruss_eth: unable to get SRAM pool
[    6.532180] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
Error opening /dev/fb0: No such file or directory
Populating dev cache
[   13.344063] random: dd: uninitialized urandom read (512 bytes read)
ALSA: Restoring mixer settings...
/usr/sbin/alsactl: load_state:1735: No soundcards found...
Tue Nov 10 15:43:16 UTC 2020
Running postinst /etc/ipk-postinsts/000-keepalived...
update-rc.d: /etc/init.d/run-postinsts exists during rc.d purge (continuing)
 Removing any system startup links for run-postinsts ...
  /etc/rcS.d/S99run-postinsts
[   14.757364] process 1 (init) attempted a POSIX timer syscall while CONFIG_POSIX_TIMERS is not set
INIT: Entering runlevel: 5
Configuring network interfaces... [   15.150222] net eth0: initializing cpsw version 1.12 (0)
[   15.157710] libphy: PHY 4a101000.mdio:01 not found
[   15.162736] net eth0: phy "4a101000.mdio:01" not found on slave 0, err -19
[   15.169978] libphy: PHY  not found
[   15.173543] net eth0: phy "" not found on slave 1, err -19
[   15.183681] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[   15.189879] 8021q: adding VLAN 0 to HW filter on device eth0
eth1: ERROR while getting interface flags: No such device
SIOCSIFADDR: No such device
eth1: ERROR while getting interface flags: No such device
SIOCSIFNETMASK: No such device
SIOCADDRT: No such device
eth2: ERROR while getting interface flags: No such device
[   15.691970] random: dbus-uuidgen: uninitialized urandom read (12 bytes read)
[   15.699635] random: dbus-uuidgen: uninitialized urandom read (8 bytes read)
Starting system message bus: [   16.313780] random: dbus-daemon: uninitialized urandom read (12 bytes read)
dbus.
Starting OpenBSD Secure Shell server: sshd
  generating ssh RSA key...
  generating ssh ECDSA key...
[   21.838232] urandom_read: 2 callbacks suppressed
[   21.838246] random: ssh-keygen: uninitialized urandom read (32 bytes read)
  generating ssh DSA key...
  generating ssh ED25519 key...
done.
Starting rpcbind daemon...done.
Starting watchdog: [  OK  ]
Starting watchdog keepalive daemon: wd_keepalive.
starting statd: done
Starting atd: OK
starting rsyslogd ... done
Starting internet superserver: xinetd.
* starting FTP Server: vsftpd... done.
Starting crond: OK
Starting network management services:pcilib: Cannot open /proc/bus/pci
 snmpd.

custom-yocto (ARM SDK) ARM-SDK-V2.2.1 custom /dev/ttyO0

custom login: [   34.711076] random: crng init done

custom-yocto (ARM SDK) ARM-SDK-V2.2.1 custom /dev/ttyO0

custom login: root
Password:
root@custom:~# rmmod prueth.ko
root@custom:~# find / -name "prueth.ko"
/lib/modules/4.19.94-custom/kernel/drivers/net/ethernet/ti/prueth.ko
root@custom:~# insmod /lib/modules/4.19.94-custom/kernel/drivers/net/ethernet/ti/prueth.ko
[   60.679538] prueth pruss_eth: unable to get SRAM pool
3122.defconfig.txt
/dts-v1/;

#include "am33xx.dtsi"
#include "am335x-bone-common.dtsi"
#include <dt-bindings/display/tda998x.h>

/ {
	model = "TI AM335x Custom";
	compatible = "ti,am335x-bone-black", "ti,am335x-bone", "ti,am33xx", "custom,custom";
        aliases {
		ethernet1 = &pruss_emac0;
                ethernet2 = &pruss_emac1;
	};

        leds {
                pinctrl-names = "default";
                pinctrl-0 = <&my_leds>;
                compatible = "gpio-leds";

                led2 {
                        label = "custom:heartbeat";
                        gpios = <&gpio1 12 GPIO_ACTIVE_HIGH>;
                        linux,default-trigger = "heartbeat";
                        default-state = "off";
                };

                led3 {
                        label = "custom:cpu0";
                        gpios = <&gpio1 13 GPIO_ACTIVE_HIGH>;
                        linux,default-trigger = "cpu0";
                        default-state = "off";
                };

                led4 {
                        label = "custom:mmc0";
                        gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>;
                        linux,default-trigger = "mmc0";
                        default-state = "off";
                };

                led5 {
                        label = "custom:mmc1";
                        gpios = <&gpio1 15 GPIO_ACTIVE_HIGH>;
                        linux,default-trigger = "mmc1";
                        default-state = "off";
                };
        };

	pruss_eth {
                status = "okay";
		compatible = "ti,am3359-prueth";
		prus = <&pru0>, <&pru1>;
                pruss = <&pruss>;
		firmware-name = "ti-pruss/am335x-pru0-prueth-fw.elf",
                                "ti-pruss/am335x-pru1-prueth-fw.elf";
		sram = <&ocmcram>;
                mii-rt = <&pruss_mii_rt>;
                iep = <&pruss_iep>;
		interrupt-parent = <&pruss_intc>;
		pinctrl-0 = <&pruss_eth_default>;
		pinctrl-names = "default";

		pruss_emac0: ethernet-mii0 {
			phy-mode = "mii";
			interrupts = <20>, <22>;
			interrupt-names = "rx", "tx";
			local-mac-address = [ec ec ec ec 00 01];
                        fixed-link {
                                speed = <100>;
                                full-duplex;
                        };
		};

                pruss_emac1: ethernet-mii1 {
			phy-mode = "mii";
			interrupts = <21>, <23>;
			interrupt-names = "rx", "tx";
			local-mac-address = [ec ec ec ec 00 02];
                        fixed-link {
                                speed = <100>;
                                full-duplex;
                        };
		};
        };

};

&pruss_soc_bus {
        status = "okay";
};

&pruss {
        status = "okay";
};

&pru0 {
        status = "okay";
        firmware-name = "am335x-pru0-fw";
};

&pru1 {
        status = "okay";
        firmware-name = "am335x-pru1-fw";
};

&am33xx_pinmux {
        pruss_eth_default: pruss_eth_default {
		pinctrl-single,pins = <
                        AM33XX_IOPAD(0x8A0, PIN_INPUT | MUX_MODE2)  /* LCD_DATA0.pr1_mii_mt0_clk */
                        AM33XX_IOPAD(0x8A4, PIN_OUTPUT | MUX_MODE2) /* LCD_DATA1.pr1_mii0_txen */
                        AM33XX_IOPAD(0x8A8, PIN_OUTPUT | MUX_MODE2) /* LCD_DATA2.pr1_mii0_txd3 */
                        AM33XX_IOPAD(0x8AC, PIN_OUTPUT | MUX_MODE2) /* LCD_DATA3.pr1_mii0_txd2 */
                        AM33XX_IOPAD(0x8B0, PIN_OUTPUT | MUX_MODE2) /* LCD_DATA4.pr1_mii0_txd1 */
                        AM33XX_IOPAD(0x8B4, PIN_OUTPUT | MUX_MODE2) /* LCD_DATA5.pr1_mii0_txd0 */
                        AM33XX_IOPAD(0x8C0, PIN_INPUT | MUX_MODE5)  /* LCD_DATA8.pr1_mii0_rxd3 */
                        AM33XX_IOPAD(0x8C4, PIN_INPUT | MUX_MODE5)  /* LCD_DATA9.pr1_mii0_rxd2 */
                        AM33XX_IOPAD(0x8C8, PIN_INPUT | MUX_MODE5)  /* LCD_DATA10.pr1_mii0_rxd1 */
                        AM33XX_IOPAD(0x8CC, PIN_INPUT | MUX_MODE5)  /* LCD_DATA11.pr1_mii0_rxd0 */
                        AM33XX_IOPAD(0x8D4, PIN_INPUT | MUX_MODE5)  /* LCD_DATA13.pr1_mii0_rxer */
                        AM33XX_IOPAD(0x8D8, PIN_INPUT | MUX_MODE5)  /* LCD_DATA14.pr1_mii_mr0_clk */
                        AM33XX_IOPAD(0x8DC, PIN_INPUT | MUX_MODE5)  /* LCD_DATA15.pr1_mii0_rxdv */
                        AM33XX_IOPAD(0x888, PIN_INPUT | MUX_MODE4)  /* GPMC_CSn3.pr1_mii0_crs */
		>;
        };
};

&am33xx_pinmux {
        my_leds: my_leds {
                pinctrl-single,pins = <
                    AM33XX_IOPAD(0x830, PIN_OUTPUT_PULLDOWN | MUX_MODE7)        /* gpmc_ad12.gpio1_12 */
                    AM33XX_IOPAD(0x834, PIN_OUTPUT_PULLDOWN | MUX_MODE7)	/* gpmc_ad13.gpio1_13 */
                    AM33XX_IOPAD(0x838, PIN_OUTPUT_PULLDOWN | MUX_MODE7)	/* gpmc_ad14.gpio1_14 */
                    AM33XX_IOPAD(0x83c, PIN_OUTPUT_PULLDOWN | MUX_MODE7)	/* gpmc_ad15.gpio1_15 */
                    AM33XX_IOPAD(0x824, PIN_OUTPUT_PULLDOWN | MUX_MODE7)	/* gpmc_ad9.gpio0_23 */
                >;
            };
};

&ldo3_reg {
	regulator-min-microvolt = <1800000>;
	regulator-max-microvolt = <1800000>;
	regulator-always-on;
};

&mmc1 {
	vmmc-supply = <&vmmcsd_fixed>;
};

&mmc2 {
	vmmc-supply = <&vmmcsd_fixed>;
	pinctrl-names = "default";
	pinctrl-0 = <&emmc_pins>;
	bus-width = <8>;
	status = "okay";
};

&lcdc {
	status = "disabled";
};

&usb0_phy {
        status = "disabled";
};

&usb1_phy {
        status = "disabled";
};

&usb0 {
        status = "disabled";
};

&usb1 {
        status = "disabled";
};

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

&am33xx_pinmux {
	spi0_pins: spi0_pins {
		pinctrl-single,pins = <
			0x150 (PIN_INPUT_PULLUP | MUX_MODE0)    /* P9.22, spi0_sclk */
			0x154 (PIN_INPUT_PULLUP | MUX_MODE0)    /* P9.21, spi0_d0 (miso) */
			0x158 (PIN_OUTPUT_PULLUP | MUX_MODE0)   /* P9.18, spi0_d1 (mosi) */
			0x15c (PIN_OUTPUT_PULLUP | MUX_MODE0)   /* P9.17, spi0_cs0 */
                        0x1a4 (PIN_OUTPUT_PULLUP | MUX_MODE7)   /* crypto_nRST */
                        0x1b0 (PIN_INPUT_PULLUP | MUX_MODE7)    /* crypto_int */
		>;
	};
};

&i2c0 {
	clock-frequency = <400000>;
};

&i2c1 {
	clock-frequency = <400000>;
};

&am33xx_pinmux {
        i2c1_pins: i2c1_pins {
		pinctrl-single,pins = <
                        AM33XX_IOPAD(0x980, SLEWCTRL_SLOW | PIN_INPUT_PULLUP | MUX_MODE3) /* UART1_RXD.I2C1_SDA */
                        AM33XX_IOPAD(0x984, SLEWCTRL_SLOW | PIN_INPUT_PULLUP | MUX_MODE3) /* UART1_TXD.I2C1_SCL */
		>;
	};
};

&i2c2 {
	status = "disabled";
};

&rtc {
	system-power-controller;
	status = "okay";
};

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

&cpsw_emac0 {
	phy_id = <&davinci_mdio>, <1>;
	phy-mode = "rgmii";
};

&cpsw_default {
	pinctrl-single,pins = <
                AM33XX_IOPAD(0x910, PIN_INPUT_PULLUP | MUX_MODE2)       /* mii1_rxerr.mii1_rxerr */
                AM33XX_IOPAD(0x914, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* mii1_txen.mii1_txen */
                AM33XX_IOPAD(0x918, PIN_INPUT_PULLUP | MUX_MODE2)       /* mii1_rxdv.mii1_rxdv */
                AM33XX_IOPAD(0x91c, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* mii1_txd3.mii1_txd3 */
                AM33XX_IOPAD(0x920, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* mii1_txd2.mii1_txd2 */
                AM33XX_IOPAD(0x924, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* mii1_txd1.mii1_txd1 */
                AM33XX_IOPAD(0x928, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* mii1_txd0.mii1_txd0 */
                AM33XX_IOPAD(0x92c, PIN_INPUT_PULLUP | MUX_MODE2)       /* mii1_txclk.mii1_txclk */
                AM33XX_IOPAD(0x930, PIN_INPUT_PULLUP | MUX_MODE2)       /* mii1_rxclk.mii1_rxclk */
                AM33XX_IOPAD(0x934, PIN_INPUT_PULLUP | MUX_MODE2)       /* mii1_rxd3.mii1_rxd3 */
                AM33XX_IOPAD(0x938, PIN_INPUT_PULLUP | MUX_MODE2)       /* mii1_rxd2.mii1_rxd2 */
                AM33XX_IOPAD(0x93c, PIN_INPUT_PULLUP | MUX_MODE2)       /* mii1_rxd1.mii1_rxd1 */
                AM33XX_IOPAD(0x940, PIN_INPUT_PULLUP | MUX_MODE2)       /* mii1_rxd0.mii1_rxd0 */
	>;
};

&cpsw_sleep {
	pinctrl-single,pins = <
                AM33XX_IOPAD(0x910, PIN_INPUT_PULLUP | MUX_MODE7)       /* mii1_rxerr.mii1_rxerr */
                AM33XX_IOPAD(0x914, PIN_OUTPUT_PULLDOWN | MUX_MODE7)    /* mii1_txen.mii1_txen */
                AM33XX_IOPAD(0x918, PIN_INPUT_PULLUP | MUX_MODE7)       /* mii1_rxdv.mii1_rxdv */
                AM33XX_IOPAD(0x91c, PIN_OUTPUT_PULLDOWN | MUX_MODE7)    /* mii1_txd3.mii1_txd3 */
                AM33XX_IOPAD(0x920, PIN_OUTPUT_PULLDOWN | MUX_MODE7)    /* mii1_txd2.mii1_txd2 */
                AM33XX_IOPAD(0x924, PIN_OUTPUT_PULLDOWN | MUX_MODE7)    /* mii1_txd1.mii1_txd1 */
                AM33XX_IOPAD(0x928, PIN_OUTPUT_PULLDOWN | MUX_MODE7)    /* mii1_txd0.mii1_txd0 */
                AM33XX_IOPAD(0x92c, PIN_INPUT_PULLUP | MUX_MODE7)       /* mii1_txclk.mii1_txclk */
                AM33XX_IOPAD(0x930, PIN_INPUT_PULLUP | MUX_MODE7)       /* mii1_rxclk.mii1_rxclk */
                AM33XX_IOPAD(0x934, PIN_INPUT_PULLUP | MUX_MODE7)       /* mii1_rxd3.mii1_rxd3 */
                AM33XX_IOPAD(0x938, PIN_INPUT_PULLUP | MUX_MODE7)       /* mii1_rxd2.mii1_rxd2 */
                AM33XX_IOPAD(0x93c, PIN_INPUT_PULLUP | MUX_MODE7)       /* mii1_rxd1.mii1_rxd1 */
                AM33XX_IOPAD(0x940, PIN_INPUT_PULLUP | MUX_MODE7)       /* mii1_rxd0.mii1_rxd0 */
	>;
};
From be9d4375dae150db75ac42c633a35c3b8942c80a Mon Sep 17 00:00:00 2001
From: OpenEmbedded <oe.patch@oe>
Date: Wed, 30 Sep 2020 17:46:07 -0400
Subject: [PATCH] Add support for direct MAC fixed-type property to PRU ICSS
 ethernet

---
 drivers/net/ethernet/ti/prueth.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/drivers/net/ethernet/ti/prueth.c b/drivers/net/ethernet/ti/prueth.c
index be3291a..8f5b355 100644
--- a/drivers/net/ethernet/ti/prueth.c
+++ b/drivers/net/ethernet/ti/prueth.c
@@ -34,6 +34,7 @@
 #include "icss_mii_rt.h"
 #include "icss_switch.h"
 
+#define NO_PHY
 #define PRUETH_MODULE_VERSION "0.2"
 #define PRUETH_MODULE_DESCRIPTION "PRUSS Ethernet driver"
 
@@ -1580,12 +1581,35 @@ static int prueth_netdev_init(struct prueth *prueth,
 	}
 	ether_addr_copy(emac->mac_addr, ndev->dev_addr);
 
+#ifdef NO_PHY
+ 	emac->phy_node = of_parse_phandle(eth_node, "phy-handle", 0);
+ 	if (!emac->phy_node) 
+	{
+ 		if(!of_phy_is_fixed_link(eth_node)) 
+		{
+ 			dev_err(prueth->dev, "couldn't find fixed-link\n");
+ 			ret = -ENODEV;
+ 			goto free;
+ 		}
+ 		if(of_phy_register_fixed_link(eth_node) >= 0)
+		{
+ 			emac->phy_node = of_node_get(eth_node);
+		}
+ 		else 
+		{
+ 			dev_err(prueth->dev, "couldn't register fixed-link\n");
+ 			ret = -ENODEV;
+ 			goto free;
+ 		}
+ 	}
+#else
 	emac->phy_node = of_parse_phandle(eth_node, "phy-handle", 0);
 	if (!emac->phy_node) {
 		dev_err(prueth->dev, "couldn't find phy-handle\n");
 		ret = -ENODEV;
 		goto free;
 	}
+#endif
 
 	emac->phy_if = of_get_phy_mode(eth_node);
 	if (emac->phy_if < 0) {
-- 
1.8.3.1

  • Hello Greg,

    To confirm: Are you saying that you have a ICEv2 EVM board that is running the SDK SD Image and working with PRU Ethernet? That is a much better platform to test PRU Ethernet functionality than trying to hack something on the beaglebone black.

    Regards,

    Nick

  • Hi Nick,

    Yes, I have an ICEv2 EVM running the SDK SD Image working with PRU Ethernet. Since that has a different processor (AM3359) than what I'm developing for (AM3358), I'm only using it as a sanity check and reference point. At the end of the day, my goal is to get the PRU Ethernet driver to initialize on a board with an AM3358. The custom board I'm developing for (and have yet to receive) has a pair of AM3358 with the PRU MII1 pins connected directly as full-duplex with no PHYs in between (yes technically unsupported but I have found one or two examples on the support forum here of people getting direct MAC to work with the PRU). I haven't gotten that far yet in my development since I'm stuck on this "sram pool" issue with the OCMCRAM.

    The patch to the prueth_netdev_init function for direct MAC shouldn't be the issue here though, no? It's failing in the probe function to find the "sram pool" which is the OCMCRAM, before the calls to prueth_netdev_init. I just can't figure out why. I even decompiled the dtb to make sure nothing was being mangled and compared it against the ICEv2 decompiled dtb.

    Regards,

    Greg

  • Hello Greg,

    I do not expect there to be any difference for PRU development between AM3358 and AM3359. However, let me double check with a hardware engineer.

    If PRU development will be the same, I would suggest developing on the AM3359 instead of trying to create a custom driver to run on an AM3358. Note that I cannot support custom driver development on the forums, even if you are modifying a driver that TI developed.

    Regards,

    Nick

  • Hi Nick,

    Okay thanks. Just finding out whether the PRU Ethernet driver supports being used on the AM3358 at all, and if so how in the device tree I need to change to accommodate that (assuming there are PHYs hooked up to the PRU MII1 pins), would answer my question I think. With this sram pool issue I'm beginning to wonder if I'm running up a wall and if it even works on the AM3358 to begin with.

    Thanks,

    Greg

  • Hello Greg,

    The hardware engineer confirmed that PRU Ethernet development will be the same on both AM3358 and AM3359. Certain industrial Ethernet protocols are only available on the AM3359, but that is due to licensing rather than hardware differences. Device tree settings, hardware connections, etc will be the same for both AM3358 and AM3359.

    Regards,

    Nick

  • Hi Nick,

    So can you clarify then if, for a board with AM3358 and an ethernet PHY connected to the PRU MII1 pins, the following defconfig and device tree would successfully load the pru-ethernet driver? And that I wouldn't encounter the "sram pool" issue in the driver probe?

    Also, can you clarify, for an unpatched pru ethernet driver, if a lack of connected PHY (but still specified in the device tree) would case the "sram pool" issue? I don't understand how the OCMCRAM is related in any way whatsoever to MDIO PHY access.

    Thanks,

    Greg

    5531.defconfig.txt

    /dts-v1/;
    
    #include "am33xx.dtsi"
    #include "am335x-bone-common.dtsi"
    #include <dt-bindings/display/tda998x.h>
    
    / {
    	model = "TI AM335x Custom";
    	compatible = "ti,am335x-bone-black", "ti,am335x-bone", "ti,am33xx", "custom,custom";
            aliases {
    		ethernet1 = &pruss_emac0;
                    ethernet2 = &pruss_emac1;
    	};
    
            leds {
                    pinctrl-names = "default";
                    pinctrl-0 = <&my_leds>;
                    compatible = "gpio-leds";
    
                    led2 {
                            label = "custom:heartbeat";
                            gpios = <&gpio1 12 GPIO_ACTIVE_HIGH>;
                            linux,default-trigger = "heartbeat";
                            default-state = "off";
                    };
    
                    led3 {
                            label = "custom:cpu0";
                            gpios = <&gpio1 13 GPIO_ACTIVE_HIGH>;
                            linux,default-trigger = "cpu0";
                            default-state = "off";
                    };
    
                    led4 {
                            label = "custom:mmc0";
                            gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>;
                            linux,default-trigger = "mmc0";
                            default-state = "off";
                    };
    
                    led5 {
                            label = "custom:mmc1";
                            gpios = <&gpio1 15 GPIO_ACTIVE_HIGH>;
                            linux,default-trigger = "mmc1";
                            default-state = "off";
                    };
            };
    
    	pruss_eth {
                    status = "okay";
    		compatible = "ti,am3359-prueth";
    		prus = <&pru0>, <&pru1>;
                    pruss = <&pruss>;
    		firmware-name = "ti-pruss/am335x-pru0-prueth-fw.elf",
                                    "ti-pruss/am335x-pru1-prueth-fw.elf";
    		sram = <&ocmcram>;
                    mii-rt = <&pruss_mii_rt>;
                    iep = <&pruss_iep>;
    		interrupt-parent = <&pruss_intc>;
    		pinctrl-0 = <&pruss_eth_default>;
    		pinctrl-names = "default";
    
    		pruss_emac0: ethernet-mii0 {
    			phy-mode = "mii";
                            phy-handle = <&pruss_eth0_phy>;
    			interrupts = <20>, <22>;
    			interrupt-names = "rx", "tx";
    			local-mac-address = [ec ec ec ec 00 01];
    		};
    
                    pruss_emac1: ethernet-mii1 {
    			phy-mode = "mii";
                            phy-handle = <&pruss_eth1_phy>;
    			interrupts = <21>, <23>;
    			interrupt-names = "rx", "tx";
    			local-mac-address = [ec ec ec ec 00 02];
    		};
            };
    
    };
    
    &pruss_soc_bus {
            status = "okay";
    };
    
    &pruss {
            status = "okay";
    };
    
    &pru0 {
            status = "okay";
            firmware-name = "am335x-pru0-fw";
    };
    
    &pru1 {
            status = "okay";
            firmware-name = "am335x-pru1-fw";
    };
    
    &pruss_mdio {
    	pinctrl-0 = <&pruss_mdio_default>;
    	pinctrl-names = "default";
    	reset-gpios = <&gpio2 5 GPIO_ACTIVE_LOW>;
    	reset-delay-us = <2>; // PHY datasheet states 1uS min
    	status = "okay";
    
    	pruss_eth0_phy: ethernet-phy@1 {
    		 reg = <1>;
    	 };
    
    	pruss_eth1_phy: ethernet-phy@3 {
    		 reg = <3>;
    	 };
    };
    
    &am33xx_pinmux {
            pruss_eth_default: pruss_eth_default {
    		pinctrl-single,pins = <
                            AM33XX_IOPAD(0x8A0, PIN_INPUT | MUX_MODE2)  /* LCD_DATA0.pr1_mii_mt0_clk */
                            AM33XX_IOPAD(0x8A4, PIN_OUTPUT | MUX_MODE2) /* LCD_DATA1.pr1_mii0_txen */
                            AM33XX_IOPAD(0x8A8, PIN_OUTPUT | MUX_MODE2) /* LCD_DATA2.pr1_mii0_txd3 */
                            AM33XX_IOPAD(0x8AC, PIN_OUTPUT | MUX_MODE2) /* LCD_DATA3.pr1_mii0_txd2 */
                            AM33XX_IOPAD(0x8B0, PIN_OUTPUT | MUX_MODE2) /* LCD_DATA4.pr1_mii0_txd1 */
                            AM33XX_IOPAD(0x8B4, PIN_OUTPUT | MUX_MODE2) /* LCD_DATA5.pr1_mii0_txd0 */
                            AM33XX_IOPAD(0x8C0, PIN_INPUT | MUX_MODE5)  /* LCD_DATA8.pr1_mii0_rxd3 */
                            AM33XX_IOPAD(0x8C4, PIN_INPUT | MUX_MODE5)  /* LCD_DATA9.pr1_mii0_rxd2 */
                            AM33XX_IOPAD(0x8C8, PIN_INPUT | MUX_MODE5)  /* LCD_DATA10.pr1_mii0_rxd1 */
                            AM33XX_IOPAD(0x8CC, PIN_INPUT | MUX_MODE5)  /* LCD_DATA11.pr1_mii0_rxd0 */
                            AM33XX_IOPAD(0x8D4, PIN_INPUT | MUX_MODE5)  /* LCD_DATA13.pr1_mii0_rxer */
                            AM33XX_IOPAD(0x8D8, PIN_INPUT | MUX_MODE5)  /* LCD_DATA14.pr1_mii_mr0_clk */
                            AM33XX_IOPAD(0x8DC, PIN_INPUT | MUX_MODE5)  /* LCD_DATA15.pr1_mii0_rxdv */
                            AM33XX_IOPAD(0x888, PIN_INPUT | MUX_MODE4)  /* GPMC_CSn3.pr1_mii0_crs */
    		>;
            };
    
            pruss_mdio_default: pruss_mdio_default {
    		pinctrl-single,pins = <
    			AM33XX_IOPAD(0x88c, (PIN_OUTPUT | MUX_MODE5))		/* gpmc_clk.pr1_mdio_mdclk */
    			AM33XX_IOPAD(0x888, (PIN_INPUT  | MUX_MODE5))		/* gpmc_csn3.pr1_mdio_data */
    			AM33XX_IOPAD(0x89c, (PIN_INPUT_PULLUP | MUX_MODE7))	/* gpmc_ben0_cle.gpio2_5 */
    		>;
    	};
    };
    
    &am33xx_pinmux {
            my_leds: my_leds {
                    pinctrl-single,pins = <
                        AM33XX_IOPAD(0x830, PIN_OUTPUT_PULLDOWN | MUX_MODE7)        /* gpmc_ad12.gpio1_12 */
                        AM33XX_IOPAD(0x834, PIN_OUTPUT_PULLDOWN | MUX_MODE7)	/* gpmc_ad13.gpio1_13 */
                        AM33XX_IOPAD(0x838, PIN_OUTPUT_PULLDOWN | MUX_MODE7)	/* gpmc_ad14.gpio1_14 */
                        AM33XX_IOPAD(0x83c, PIN_OUTPUT_PULLDOWN | MUX_MODE7)	/* gpmc_ad15.gpio1_15 */
                        AM33XX_IOPAD(0x824, PIN_OUTPUT_PULLDOWN | MUX_MODE7)	/* gpmc_ad9.gpio0_23 */
                    >;
                };
    };
    
    &ldo3_reg {
    	regulator-min-microvolt = <1800000>;
    	regulator-max-microvolt = <1800000>;
    	regulator-always-on;
    };
    
    &mmc1 {
    	vmmc-supply = <&vmmcsd_fixed>;
    };
    
    &mmc2 {
    	vmmc-supply = <&vmmcsd_fixed>;
    	pinctrl-names = "default";
    	pinctrl-0 = <&emmc_pins>;
    	bus-width = <8>;
    	status = "okay";
    };
    
    &lcdc {
    	status = "disabled";
    };
    
    &usb0_phy {
            status = "disabled";
    };
    
    &usb1_phy {
            status = "disabled";
    };
    
    &usb0 {
            status = "disabled";
    };
    
    &usb1 {
            status = "disabled";
    };
    
    &spi0 {
    	status = "okay";
    	pinctrl-names = "default";
    	pinctrl-0 = <&spi0_pins>;
    };
    
    &am33xx_pinmux {
    	spi0_pins: spi0_pins {
    		pinctrl-single,pins = <
    			0x150 (PIN_INPUT_PULLUP | MUX_MODE0)    /* P9.22, spi0_sclk */
    			0x154 (PIN_INPUT_PULLUP | MUX_MODE0)    /* P9.21, spi0_d0 (miso) */
    			0x158 (PIN_OUTPUT_PULLUP | MUX_MODE0)   /* P9.18, spi0_d1 (mosi) */
    			0x15c (PIN_OUTPUT_PULLUP | MUX_MODE0)   /* P9.17, spi0_cs0 */
                            0x1a4 (PIN_OUTPUT_PULLUP | MUX_MODE7)   /* crypto_nRST */
                            0x1b0 (PIN_INPUT_PULLUP | MUX_MODE7)    /* crypto_int */
    		>;
    	};
    };
    
    &i2c0 {
    	clock-frequency = <400000>;
    };
    
    &i2c1 {
    	clock-frequency = <400000>;
    };
    
    &am33xx_pinmux {
            i2c1_pins: i2c1_pins {
    		pinctrl-single,pins = <
                            AM33XX_IOPAD(0x980, SLEWCTRL_SLOW | PIN_INPUT_PULLUP | MUX_MODE3) /* UART1_RXD.I2C1_SDA */
                            AM33XX_IOPAD(0x984, SLEWCTRL_SLOW | PIN_INPUT_PULLUP | MUX_MODE3) /* UART1_TXD.I2C1_SCL */
    		>;
    	};
    };
    
    &i2c2 {
    	status = "disabled";
    };
    
    &rtc {
    	system-power-controller;
    	status = "okay";
    };
    
    &mac {
    	pinctrl-names = "default", "sleep";
    	pinctrl-0 = <&cpsw_default>;
    	pinctrl-1 = <&cpsw_sleep>;
    	slaves = <2>;
    	active_slave = <0>;
    	status = "okay";
    };
    
    &cpsw_emac0 {
    	phy_id = <&davinci_mdio>, <1>;
    	phy-mode = "rgmii";
    };
    
    &cpsw_default {
    	pinctrl-single,pins = <
                    AM33XX_IOPAD(0x910, PIN_INPUT_PULLUP | MUX_MODE2)       /* mii1_rxerr.mii1_rxerr */
                    AM33XX_IOPAD(0x914, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* mii1_txen.mii1_txen */
                    AM33XX_IOPAD(0x918, PIN_INPUT_PULLUP | MUX_MODE2)       /* mii1_rxdv.mii1_rxdv */
                    AM33XX_IOPAD(0x91c, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* mii1_txd3.mii1_txd3 */
                    AM33XX_IOPAD(0x920, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* mii1_txd2.mii1_txd2 */
                    AM33XX_IOPAD(0x924, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* mii1_txd1.mii1_txd1 */
                    AM33XX_IOPAD(0x928, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* mii1_txd0.mii1_txd0 */
                    AM33XX_IOPAD(0x92c, PIN_INPUT_PULLUP | MUX_MODE2)       /* mii1_txclk.mii1_txclk */
                    AM33XX_IOPAD(0x930, PIN_INPUT_PULLUP | MUX_MODE2)       /* mii1_rxclk.mii1_rxclk */
                    AM33XX_IOPAD(0x934, PIN_INPUT_PULLUP | MUX_MODE2)       /* mii1_rxd3.mii1_rxd3 */
                    AM33XX_IOPAD(0x938, PIN_INPUT_PULLUP | MUX_MODE2)       /* mii1_rxd2.mii1_rxd2 */
                    AM33XX_IOPAD(0x93c, PIN_INPUT_PULLUP | MUX_MODE2)       /* mii1_rxd1.mii1_rxd1 */
                    AM33XX_IOPAD(0x940, PIN_INPUT_PULLUP | MUX_MODE2)       /* mii1_rxd0.mii1_rxd0 */
    	>;
    };
    
    &cpsw_sleep {
    	pinctrl-single,pins = <
                    AM33XX_IOPAD(0x910, PIN_INPUT_PULLUP | MUX_MODE7)       /* mii1_rxerr.mii1_rxerr */
                    AM33XX_IOPAD(0x914, PIN_OUTPUT_PULLDOWN | MUX_MODE7)    /* mii1_txen.mii1_txen */
                    AM33XX_IOPAD(0x918, PIN_INPUT_PULLUP | MUX_MODE7)       /* mii1_rxdv.mii1_rxdv */
                    AM33XX_IOPAD(0x91c, PIN_OUTPUT_PULLDOWN | MUX_MODE7)    /* mii1_txd3.mii1_txd3 */
                    AM33XX_IOPAD(0x920, PIN_OUTPUT_PULLDOWN | MUX_MODE7)    /* mii1_txd2.mii1_txd2 */
                    AM33XX_IOPAD(0x924, PIN_OUTPUT_PULLDOWN | MUX_MODE7)    /* mii1_txd1.mii1_txd1 */
                    AM33XX_IOPAD(0x928, PIN_OUTPUT_PULLDOWN | MUX_MODE7)    /* mii1_txd0.mii1_txd0 */
                    AM33XX_IOPAD(0x92c, PIN_INPUT_PULLUP | MUX_MODE7)       /* mii1_txclk.mii1_txclk */
                    AM33XX_IOPAD(0x930, PIN_INPUT_PULLUP | MUX_MODE7)       /* mii1_rxclk.mii1_rxclk */
                    AM33XX_IOPAD(0x934, PIN_INPUT_PULLUP | MUX_MODE7)       /* mii1_rxd3.mii1_rxd3 */
                    AM33XX_IOPAD(0x938, PIN_INPUT_PULLUP | MUX_MODE7)       /* mii1_rxd2.mii1_rxd2 */
                    AM33XX_IOPAD(0x93c, PIN_INPUT_PULLUP | MUX_MODE7)       /* mii1_rxd1.mii1_rxd1 */
                    AM33XX_IOPAD(0x940, PIN_INPUT_PULLUP | MUX_MODE7)       /* mii1_rxd0.mii1_rxd0 */
    	>;
    };
    

  • Hi,

    See also this thread. What does Matthijs mean when he says PRU Ethernet Driver isn't supported on AM3358?

    Link

    Thanks,

    Greg

  • Hello Greg,

    On your link: I am not sure what Matthijs means. He is not a TI employee so I cannot ask him. He has spent a good deal of time digging into general purpose PRU development, but I am not sure how much PRU Ethernet experience he has. 

    For PRU Ethernet, the network stack is handled in Linux, while the PRU deals with implementing the network protocol. Network traffic must pass from one core to another, so I would not be surprised that SRAM was involved. You are not following an accepted use case, so I cannot say for sure.

    I would NOT specify a PHY in the device tree if you do not have one hooked up to the board. PRU Ethernet does not have any internal loopback development tools like UART, so there is not really any point in trying to develop software without a PHY because you will not be able to test it. Ethernet drivers expect that PHY to exist, and I cannot guarantee driver behavior if you try to run the driver while messing up its initialization process (i.e., if it tries to talk to a nonexistent peripheral).

    Please note that you can enable single EMAC mode by modifying the device tree (and driver, since a single mode bug exists in 4.19) if you will only have one PRU Ethernet port rather than two. Let me know if you need additional guidance there. That can be tested on the ICE board.

    Regards,

    Nick

  • Hi Nick,

    I got pulled away from this but came back on it and was able to get the driver to load, even on a phy-less board using my aforementioned patch. I needed to enable the following kernel config options to get past the SRAM pool issue:

    CONFIG_SRAM=y
    CONFIG_SRAM_EXEC=y
    CONFIG_TI_EMIF=y
    CONFIG_TI_EMIF_SRAM=y
    Sorry if I was being a bit frustrated with my previous comments, I was stuck in that rabbit hole for many weeks and it had worn on me.
    Can you clarify the patch to the driver needed in the 4.19 kernel for operating in single EMAC mode? I can always use ifdown but it's probably better to do it the right way and just have it disabled from the start.
    Thanks,
    Greg
  • Hello Greg,

    General single EMAC information:
    post Single PRU Ethernet MII
    post PRU Ethernet driver error

    Here is the 4.19 single emac driver workaround that another customer figured out:
    post PRU Ethernet driver crashes

    It looks like this will be fixed in the future Linux 5.4 release with patch

    diff --git a/drivers/net/ethernet/ti/prueth.c
    b/drivers/net/ethernet/ti/prueth.c
    index a3b596f746aa..38e8a2507cbf 100644
    --- a/drivers/net/ethernet/ti/prueth.c
    +++ b/drivers/net/ethernet/ti/prueth.c
    @@ -1532,6 +1532,9 @@ static enum hrtimer_restart prueth_timer(struct hrtimer *timer)
    
             for (mac = PRUETH_MAC0; mac <= PRUETH_MAC1; mac++) {
                     emac = prueth->emac[mac];
    +               if (!emac)
    +                       continue;
    +
                     if (!(prueth->emac_configured & BIT(emac->port_id)))
                             break; /* port not enabled */

    Note that commenting out emac_dualemac_set_stats as the other customer did means that ethernet statistics will not persist across port up/downs. In the coming Linux 5.4 code that is addressed by saving & restoring EMAC stats per EMAC instead of both EMACs at once as in Linux 4.19's emac_dualemac_set_stats.

    Regards,

    Nick