fdu / STM32F746G-disco_Buildroot

28 stars 28 forks source link

ethernet #1

Open trnila opened 6 years ago

trnila commented 6 years ago

Hello, I am trying to get ethernet working, but I have some issue with the following device tree configuration.

#include <dt-bindings/pinctrl/stm32f746-pinfunc.h>
#include "stm32f746-disco.dts"
/ {
    reserved-memory {
        #address-cells = <1>;
        #size-cells = <1>;
        ranges;

        linux,dma {
            compatible = "shared-dma-pool";
            linux,dma-default;
            no-map;
            reg = <0x20010000 0x3bfff>; /* sram1 240kb */
        };
    };

    soc {
        mac: ethernet@40028000 {
            compatible = "st,stm32-dwmac", "snps,dwmac-3.50a", "snps,dwmac";
            reg = <0x40028000 0x8000>;
            reg-names = "stmmaceth";

            resets = <&rcc STM32F7_AHB1_RESET(ETHMAC)>;
            reset-names = "stmmaceth";

            clocks = <&rcc 0 STM32F7_AHB1_CLOCK(ETHMAC)>,
                 <&rcc 0 STM32F7_AHB1_CLOCK(ETHMACTX)>,
                 <&rcc 0 STM32F7_AHB1_CLOCK(ETHMACRX)>;
            clock-names = "stmmaceth", "mac-clk-tx", "mac-clk-rx";

            interrupts = <61>, <62>;
            interrupt-names = "macirq", "eth_wake_irq";

            dma-ranges;
            st,syscon = <&syscfg 0x4>;

            pinctrl-0 = <&ethernet_rmii>;
            phy-mode = "rmii";
            phy-handle = <&phy0>;

            status = "okay";

            mdio0 {
                #address-cells = <1>;
                #size-cells = <0>;
                compatible = "snps,dwmac-mdio";
                phy0: ethernet-phy@0 {
                    reg = <0>;
                };
            };
        };
    };
};

&pinctrl {
    ethernet_rmii: rmii@0 {
          pins {
              pinmux = <STM32F746_PG13_FUNC_ETH_MII_TXD0_ETH_RMII_TXD0>,
                 <STM32F746_PG14_FUNC_ETH_MII_TXD1_ETH_RMII_TXD1>,
                 <STM32F746_PG11_FUNC_ETH_MII_TX_EN_ETH_RMII_TX_EN>,
                 <STM32F746_PA2_FUNC_ETH_MDIO>,
                 <STM32F746_PC1_FUNC_ETH_MDC>,
                 <STM32F746_PA1_FUNC_ETH_MII_RX_CLK_ETH_RMII_REF_CLK>,
                 <STM32F746_PA7_FUNC_ETH_MII_RX_DV_ETH_RMII_CRS_DV>,
                 <STM32F746_PC4_FUNC_ETH_MII_RXD0_ETH_RMII_RXD0>,
                 <STM32F746_PC5_FUNC_ETH_MII_RXD1_ETH_RMII_RXD1>;
              slew-rate = <2>;
          };
    };
};

&dma1 {
    status = "okay";
};
&dma2 {
    status = "okay";
};
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.15.7 (daniel@ntb) (gcc version 6.3.0 (Buildroot 2017.02.9)) #100 PREEMPT Sun Mar 18 15:35:07 CET 2018
[    0.000000] CPU: ARMv7-M [410fc271] revision 1 (ARMv7M), cr=00000000
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, PIPT instruction cache
[    0.000000] OF: fdt: Machine model: STMicroelectronics STM32F746-DISCO board
[    0.000000] debug: ignoring loglevel setting.
[    0.000000] Reserved memory: created DMA memory pool at 0x20010000, size 0 MiB
[    0.000000] OF: reserved mem: initialized node linux,dma, compatible id shared-dma-pool
[    0.000000] On node 0 totalpages: 2048
[    0.000000]   Normal zone: 16 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 2048 pages, LIFO batch:0
[    0.000000] random: fast init done
[    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[    0.000000] pcpu-alloc: [0] 0
[    0.000000] Built 1 zonelists, mobility grouping off.  Total pages: 2032
[    0.000000] Kernel command line: console=ttyS0,115200 earlyprintk consoleblank=0 ignore_loglevel panic=3
[    0.000000] Dentry cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.000000] Inode-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.000000] Memory: 5036K/8192K available (1778K kernel code, 136K rwdata, 556K rodata, 276K init, 134K bss, 3156K reserved, 0K cma-reserved)
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0x00000000 - 0x00001000   (   4 kB)
[    0.000000]     fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
[    0.000000]     vmalloc : 0x00000000 - 0xffffffff   (4095 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xc0800000   (   8 MB)
[    0.000000]       .text : 0x(ptrval) - 0x(ptrval)   (1779 kB)
[    0.000000]       .init : 0x(ptrval) - 0x(ptrval)   ( 276 kB)
[    0.000000]       .data : 0x(ptrval) - 0x(ptrval)   ( 137 kB)
[    0.000000]        .bss : 0x(ptrval) - 0x(ptrval)   ( 135 kB)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] Preemptible hierarchical RCU implementation.
[    0.000000]  Tasks RCU enabled.
[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[    0.000000] interrupt-controller@40013c00: bank0, External IRQs available:0xffffff
[    0.000000] clocksource: arm_system_timer: mask: 0xffffff max_cycles: 0xffffff, max_idle_ns: 298634427 ns
[    0.000000] ARM System timer initialized as clocksource
[    0.000000] /soc/timer@40000c00: STM32 clockevent driver initialized (32 bits)
[    0.000000] sched_clock: 32 bits at 100 Hz, resolution 10000000ns, wraps every 21474836475000000ns
[    0.050000] Calibrating delay loop... 393.21 BogoMIPS (lpj=1966080)
[    0.050000] pid_max: default: 4096 minimum: 301
[    0.050000] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.050000] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.050000] Hierarchical SRCU implementation.
[    0.060000] devtmpfs: initialized
[    0.100000] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.100000] pinctrl core: initialized pinctrl subsystem
[    0.100000] DMA: default coherent area is set
[    0.100000] NET: Registered protocol family 16
[    0.130000] stm32f746-pinctrl soc:pin-controller: GPIOA bank added
[    0.130000] stm32f746-pinctrl soc:pin-controller: GPIOB bank added
[    0.130000] stm32f746-pinctrl soc:pin-controller: GPIOC bank added
[    0.140000] stm32f746-pinctrl soc:pin-controller: GPIOD bank added
[    0.140000] stm32f746-pinctrl soc:pin-controller: GPIOE bank added
[    0.140000] stm32f746-pinctrl soc:pin-controller: GPIOF bank added
[    0.140000] stm32f746-pinctrl soc:pin-controller: GPIOG bank added
[    0.150000] stm32f746-pinctrl soc:pin-controller: GPIOH bank added
[    0.150000] stm32f746-pinctrl soc:pin-controller: GPIOI bank added
[    0.150000] stm32f746-pinctrl soc:pin-controller: GPIOJ bank added
[    0.150000] stm32f746-pinctrl soc:pin-controller: GPIOK bank added
[    0.150000] stm32f746-pinctrl soc:pin-controller: Pinctrl STM32 initialized
[    0.210000] stm32-dma 40026000.dma: STM32 DMA driver registered
[    0.220000] stm32-dma 40026400.dma: STM32 DMA driver registered
[    0.230000] clocksource: Switched to clocksource arm_system_timer
[    0.240000] NET: Registered protocol family 2
[    0.240000] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.240000] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.240000] TCP: Hash tables configured (established 1024 bind 1024)
[    0.240000] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.240000] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.370000] workingset: timestamp_bits=30 max_order=11 bucket_order=0
[    0.420000] io scheduler noop registered (default)
[    0.420000] io scheduler mq-deadline registered
[    0.420000] io scheduler kyber registered
[    0.430000] STM32 USART driver initialized
[    0.430000] 40011000.serial: ttyS0 at MMIO 0x40011000 (irq = 31, base_baud = 6250000) is a stm32-usart
[    0.890000] console [ttyS0] enabled
[    0.890000] stm32-usart 40011000.serial: rx dma alloc failed
[    0.890000] stm32-usart 40011000.serial: interrupt mode used for rx (no dma)
[    0.910000] stm32-usart 40011000.serial: tx dma alloc failed
[    0.910000] stm32-usart 40011000.serial: interrupt mode used for tx (no dma)
[    0.920000] libphy: Fixed MDIO Bus: probed
[    0.930000] stm32-dwmac 40028000.ethernet: PTP uses main clock
[    0.940000] stmmac - user ID: 0x10, Synopsys ID: 0x35
[    0.940000] stm32-dwmac 40028000.ethernet: Ring mode enabled
[    0.940000] stm32-dwmac 40028000.ethernet: DMA HW capability register supported
[    0.960000] stm32-dwmac 40028000.ethernet: Enhanced/Alternate descriptors
[    0.960000] stm32-dwmac 40028000.ethernet: Enabled extended descriptors
[    0.960000] stm32-dwmac 40028000.ethernet: RX Checksum Offload Engine supported
[    0.980000] stm32-dwmac 40028000.ethernet: COE Type 2
[    0.980000] stm32-dwmac 40028000.ethernet: TX Checksum insertion supported
[    0.990000] stm32-dwmac 40028000.ethernet: Wake-Up On Lan supported
[    1.000000] stm32-dwmac 40028000.ethernet: Enable RX Mitigation via HW Watchdog Timer
[    1.000000] libphy: stmmac: probed
[    1.300000] i2c /dev entries driver
[    1.310000] NET: Registered protocol family 10
[    1.330000] Segment Routing with IPv6
[    1.330000] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[    1.340000] hctosys: unable to open rtc device (rtc0)
[    1.360000] Freeing unused kernel memory: 276K
[    1.360000] This architecture does not have kernel memory protection.
Initializing random number generator... urandom start: failed.

When I try to bring ethernet up, it fails on resetting ethernet's dma (https://github.com/torvalds/linux/blob/b9849860675f925da0380f4ea76c3f5041909737/drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c#L35). Bit 0 SR of register ETH_DMABMR is never cleared, so reset haven't completed (even when I increased timeout slightly).

~ # ifconfig eth0 up
[   83.410000] stm32-dwmac 40028000.ethernet eth0: device MAC address 46:12:3a:b2:7f:dd
[   83.560000] Generic PHY stmmac-0:00: attached PHY driver [Generic PHY] (mii_bus:phy_addr=stmmac-0:00, irq=POLL)
[   84.580000] stm32-dwmac 40028000.ethernet: Failed to reset the dma
[   84.580000] stm32-dwmac 40028000.ethernet eth0: stmmac_hw_setup: DMA engine initialization failed
[   84.590000] stm32-dwmac 40028000.ethernet eth0: stmmac_open: Hw setup failed
ifconfig: SIOCSIFFLAGS: Device or resource busy

Do you see any problem? Thank you

cfriedt commented 5 years ago

Ok - I am duplicating this problem now. But my stm32f746-disco.dtsi is

{noformat}

include "skeleton.dtsi"

include "armv7-m.dtsi"

include <dt-bindings/pinctrl/stm32-pinfunc.h>

include <dt-bindings/clock/stm32fx-clock.h>

include <dt-bindings/mfd/stm32f7-rcc.h>

/ { reserved-memory {

address-cells = <1>;

    #size-cells = <1>;
    ranges;

    linux,dma {
        compatible = "shared-dma-pool";
        linux,dma-default;
        no-map;
        reg = <0x20010000 0x3bfff>; /* sram1 240kb */
    };
};
clocks {
    clk_hse: clk-hse {
        #clock-cells = <0>;
        compatible = "fixed-clock";
        clock-frequency = <0>;
    };

    clk-lse {
        #clock-cells = <0>;
        compatible = "fixed-clock";
        clock-frequency = <32768>;
    };

    clk-lsi {
        #clock-cells = <0>;
        compatible = "fixed-clock";
        clock-frequency = <32000>;
    };

    clk_i2s_ckin: clk-i2s-ckin {
        #clock-cells = <0>;
        compatible = "fixed-clock";
        clock-frequency = <48000000>;
    };
};

soc {
    mac: ethernet@40028000 {
        compatible = "st,stm32-dwmac", "snps,dwmac-3.50a", "snps,dwmac";
        reg = <0x40028000 0x8000>;
        reg-names = "stmmaceth";

        resets = <&rcc STM32F7_AHB1_RESET(ETHMAC)>;
        reset-names = "stmmaceth";

        clocks = <&rcc 0 STM32F7_AHB1_CLOCK(ETHMAC)>,
             <&rcc 0 STM32F7_AHB1_CLOCK(ETHMACTX)>,
             <&rcc 0 STM32F7_AHB1_CLOCK(ETHMACRX)>;
        clock-names = "stmmaceth", "mac-clk-tx", "mac-clk-rx";

        interrupts = <61>, <62>;
        interrupt-names = "macirq", "eth_wake_irq";
        dma-ranges;
        st,syscon = <&syscfg 0x4>;

        pinctrl-0 = <&ethernet_rmii>;
        phy-mode = "rmii";
        phy-handle = <&phy0>;

        status = "okay";

        mdio0 {
            #address-cells = <1>;
            #size-cells = <0>;
            compatible = "snps,dwmac-mdio";
            phy0: ethernet-phy@0 {
                reg = <0>;
            };
        };
    };

    timer2: timer@40000000 {
        compatible = "st,stm32-timer";
        reg = <0x40000000 0x400>;
        interrupts = <28>;
        clocks = <&rcc 0 STM32F7_APB1_CLOCK(TIM2)>;
        status = "disabled";
    };

    timers2: timers@40000000 {
        #address-cells = <1>;
        #size-cells = <0>;
        compatible = "st,stm32-timers";
        reg = <0x40000000 0x400>;
        clocks = <&rcc 0 STM32F7_APB1_CLOCK(TIM2)>;
        clock-names = "int";
        status = "disabled";

        pwm {
            compatible = "st,stm32-pwm";
            status = "disabled";
        };

        timer@1 {
            compatible = "st,stm32-timer-trigger";
            reg = <1>;
            status = "disabled";
        };
    };

    timer3: timer@40000400 {
        compatible = "st,stm32-timer";
        reg = <0x40000400 0x400>;
        interrupts = <29>;
        clocks = <&rcc 0 STM32F7_APB1_CLOCK(TIM3)>;
        status = "disabled";
    };

    timers3: timers@40000400 {
        #address-cells = <1>;
        #size-cells = <0>;
        compatible = "st,stm32-timers";
        reg = <0x40000400 0x400>;
        clocks = <&rcc 0 STM32F7_APB1_CLOCK(TIM3)>;
        clock-names = "int";
        status = "disabled";

        pwm {
            compatible = "st,stm32-pwm";
            status = "disabled";
        };

        timer@2 {
            compatible = "st,stm32-timer-trigger";
            reg = <2>;
            status = "disabled";
        };
    };

    timer4: timer@40000800 {
        compatible = "st,stm32-timer";
        reg = <0x40000800 0x400>;
        interrupts = <30>;
        clocks = <&rcc 0 STM32F7_APB1_CLOCK(TIM4)>;
        status = "disabled";
    };

    timers4: timers@40000800 {
        #address-cells = <1>;
        #size-cells = <0>;
        compatible = "st,stm32-timers";
        reg = <0x40000800 0x400>;
        clocks = <&rcc 0 STM32F7_APB1_CLOCK(TIM4)>;
        clock-names = "int";
        status = "disabled";

        pwm {
            compatible = "st,stm32-pwm";
            status = "disabled";
        };

        timer@3 {
            compatible = "st,stm32-timer-trigger";
            reg = <3>;
            status = "disabled";
        };
    };

    timer5: timer@40000c00 {
        compatible = "st,stm32-timer";
        reg = <0x40000c00 0x400>;
        interrupts = <50>;
        clocks = <&rcc 0 STM32F7_APB1_CLOCK(TIM5)>;
    };

    timers5: timers@40000c00 {
        #address-cells = <1>;
        #size-cells = <0>;
        compatible = "st,stm32-timers";
        reg = <0x40000C00 0x400>;
        clocks = <&rcc 0 STM32F7_APB1_CLOCK(TIM5)>;
        clock-names = "int";
        status = "disabled";

        pwm {
            compatible = "st,stm32-pwm";
            status = "disabled";
        };

        timer@4 {
            compatible = "st,stm32-timer-trigger";
            reg = <4>;
            status = "disabled";
        };
    };

    timer6: timer@40001000 {
        compatible = "st,stm32-timer";
        reg = <0x40001000 0x400>;
        interrupts = <54>;
        clocks = <&rcc 0 STM32F7_APB1_CLOCK(TIM6)>;
        status = "disabled";
    };

    timers6: timers@40001000 {
        #address-cells = <1>;
        #size-cells = <0>;
        compatible = "st,stm32-timers";
        reg = <0x40001000 0x400>;
        clocks = <&rcc 0 STM32F7_APB1_CLOCK(TIM6)>;
        clock-names = "int";
        status = "disabled";

        timer@5 {
            compatible = "st,stm32-timer-trigger";
            reg = <5>;
            status = "disabled";
        };
    };

    timer7: timer@40001400 {
        compatible = "st,stm32-timer";
        reg = <0x40001400 0x400>;
        interrupts = <55>;
        clocks = <&rcc 0 STM32F7_APB1_CLOCK(TIM7)>;
        status = "disabled";
    };

    timers7: timers@40001400 {
        #address-cells = <1>;
        #size-cells = <0>;
        compatible = "st,stm32-timers";
        reg = <0x40001400 0x400>;
        clocks = <&rcc 0 STM32F7_APB1_CLOCK(TIM7)>;
        clock-names = "int";
        status = "disabled";

        timer@6 {
            compatible = "st,stm32-timer-trigger";
            reg = <6>;
            status = "disabled";
        };
    };

    timers12: timers@40001800 {
        #address-cells = <1>;
        #size-cells = <0>;
        compatible = "st,stm32-timers";
        reg = <0x40001800 0x400>;
        clocks = <&rcc 0 STM32F7_APB1_CLOCK(TIM12)>;
        clock-names = "int";
        status = "disabled";

        pwm {
            compatible = "st,stm32-pwm";
            status = "disabled";
        };

        timer@11 {
            compatible = "st,stm32-timer-trigger";
            reg = <11>;
            status = "disabled";
        };
    };

    timers13: timers@40001c00 {
        #address-cells = <1>;
        #size-cells = <0>;
        compatible = "st,stm32-timers";
        reg = <0x40001C00 0x400>;
        clocks = <&rcc 0 STM32F7_APB1_CLOCK(TIM13)>;
        clock-names = "int";
        status = "disabled";

        pwm {
            compatible = "st,stm32-pwm";
            status = "disabled";
        };
    };

    timers14: timers@40002000 {
        #address-cells = <1>;
        #size-cells = <0>;
        compatible = "st,stm32-timers";
        reg = <0x40002000 0x400>;
        clocks = <&rcc 0 STM32F7_APB1_CLOCK(TIM14)>;
        clock-names = "int";
        status = "disabled";

        pwm {
            compatible = "st,stm32-pwm";
            status = "disabled";
        };
    };

    rtc: rtc@40002800 {
        compatible = "st,stm32-rtc";
        reg = <0x40002800 0x400>;
        clocks = <&rcc 1 CLK_RTC>;
        clock-names = "ck_rtc";
        assigned-clocks = <&rcc 1 CLK_RTC>;
        assigned-clock-parents = <&rcc 1 CLK_LSE>;
        interrupt-parent = <&exti>;
        interrupts = <17 1>;
        interrupt-names = "alarm";
        st,syscfg = <&pwrcfg>;
        status = "disabled";
    };

    usart2: serial@40004400 {
        compatible = "st,stm32f7-uart";
        reg = <0x40004400 0x400>;
        interrupts = <38>;
        clocks = <&rcc 1 CLK_USART2>;
        status = "disabled";
    };

    usart3: serial@40004800 {
        compatible = "st,stm32f7-uart";
        reg = <0x40004800 0x400>;
        interrupts = <39>;
        clocks = <&rcc 1 CLK_USART3>;
        status = "disabled";
    };

    usart4: serial@40004c00 {
        compatible = "st,stm32f7-uart";
        reg = <0x40004c00 0x400>;
        interrupts = <52>;
        clocks = <&rcc 1 CLK_UART4>;
        status = "disabled";
    };

    usart5: serial@40005000 {
        compatible = "st,stm32f7-uart";
        reg = <0x40005000 0x400>;
        interrupts = <53>;
        clocks = <&rcc 1 CLK_UART5>;
        status = "disabled";
    };

    i2c1: i2c@40005400 {
        compatible = "st,stm32f7-i2c";
        reg = <0x40005400 0x400>;
        interrupts = <31>,
                 <32>;
        resets = <&rcc STM32F7_APB1_RESET(I2C1)>;
        clocks = <&rcc 1 CLK_I2C1>;
        #address-cells = <1>;
        #size-cells = <0>;
        status = "disabled";
    };

    cec: cec@40006c00 {
        compatible = "st,stm32-cec";
        reg = <0x40006C00 0x400>;
        interrupts = <94>;
        clocks = <&rcc 0 STM32F7_APB1_CLOCK(CEC)>, <&rcc 1 CLK_HDMI_CEC>;
        clock-names = "cec", "hdmi-cec";
        status = "disabled";
    };

    usart7: serial@40007800 {
        compatible = "st,stm32f7-uart";
        reg = <0x40007800 0x400>;
        interrupts = <82>;
        clocks = <&rcc 1 CLK_UART7>;
        status = "disabled";
    };

    usart8: serial@40007c00 {
        compatible = "st,stm32f7-uart";
        reg = <0x40007c00 0x400>;
        interrupts = <83>;
        clocks = <&rcc 1 CLK_UART8>;
        status = "disabled";
    };

    timers1: timers@40010000 {
        #address-cells = <1>;
        #size-cells = <0>;
        compatible = "st,stm32-timers";
        reg = <0x40010000 0x400>;
        clocks = <&rcc 0 STM32F7_APB2_CLOCK(TIM1)>;
        clock-names = "int";
        status = "disabled";

        pwm {
            compatible = "st,stm32-pwm";
            status = "disabled";
        };

        timer@0 {
            compatible = "st,stm32-timer-trigger";
            reg = <0>;
            status = "disabled";
        };
    };

    timers8: timers@40010400 {
        #address-cells = <1>;
        #size-cells = <0>;
        compatible = "st,stm32-timers";
        reg = <0x40010400 0x400>;
        clocks = <&rcc 0 STM32F7_APB2_CLOCK(TIM8)>;
        clock-names = "int";
        status = "disabled";

        pwm {
            compatible = "st,stm32-pwm";
            status = "disabled";
        };

        timer@7 {
            compatible = "st,stm32-timer-trigger";
            reg = <7>;
            status = "disabled";
        };
    };

    usart1: serial@40011000 {
        compatible = "st,stm32f7-uart";
        reg = <0x40011000 0x400>;
        interrupts = <37>;
        clocks = <&rcc 1 CLK_USART1>;
        status = "disabled";
    };

    usart6: serial@40011400 {
        compatible = "st,stm32f7-uart";
        reg = <0x40011400 0x400>;
        interrupts = <71>;
        clocks = <&rcc 1 CLK_USART6>;
        status = "disabled";
    };

    syscfg: system-config@40013800 {
        compatible = "syscon";
        reg = <0x40013800 0x400>;
    };

    exti: interrupt-controller@40013c00 {
        compatible = "st,stm32-exti";
        interrupt-controller;
        #interrupt-cells = <2>;
        reg = <0x40013C00 0x400>;
        interrupts = <1>, <2>, <3>, <6>, <7>, <8>, <9>, <10>, <23>, <40>, <41>, <42>, <62>, <76>;
    };

    timers9: timers@40014000 {
        #address-cells = <1>;
        #size-cells = <0>;
        compatible = "st,stm32-timers";
        reg = <0x40014000 0x400>;
        clocks = <&rcc 0 STM32F7_APB2_CLOCK(TIM9)>;
        clock-names = "int";
        status = "disabled";

        pwm {
            compatible = "st,stm32-pwm";
            status = "disabled";
        };

        timer@8 {
            compatible = "st,stm32-timer-trigger";
            reg = <8>;
            status = "disabled";
        };
    };

    timers10: timers@40014400 {
        #address-cells = <1>;
        #size-cells = <0>;
        compatible = "st,stm32-timers";
        reg = <0x40014400 0x400>;
        clocks = <&rcc 0 STM32F7_APB2_CLOCK(TIM10)>;
        clock-names = "int";
        status = "disabled";

        pwm {
            compatible = "st,stm32-pwm";
            status = "disabled";
        };
    };

    timers11: timers@40014800 {
        #address-cells = <1>;
        #size-cells = <0>;
        compatible = "st,stm32-timers";
        reg = <0x40014800 0x400>;
        clocks = <&rcc 0 STM32F7_APB2_CLOCK(TIM11)>;
        clock-names = "int";
        status = "disabled";

        pwm {
            compatible = "st,stm32-pwm";
            status = "disabled";
        };
    };

    pwrcfg: power-config@40007000 {
        compatible = "syscon";
        reg = <0x40007000 0x400>;
    };

    pin-controller {
        #address-cells = <1>;
        #size-cells = <1>;
        compatible = "st,stm32f746-pinctrl";
        ranges = <0 0x40020000 0x3000>;
        interrupt-parent = <&exti>;
        st,syscfg = <&syscfg 0x8>;
        pins-are-numbered;

        gpioa: gpio@40020000 {
            gpio-controller;
            #gpio-cells = <2>;
            interrupt-controller;
            #interrupt-cells = <2>;
            reg = <0x0 0x400>;
            clocks = <&rcc 0 STM32F7_AHB1_CLOCK(GPIOA)>;
            st,bank-name = "GPIOA";
        };

        gpiob: gpio@40020400 {
            gpio-controller;
            #gpio-cells = <2>;
            interrupt-controller;
            #interrupt-cells = <2>;
            reg = <0x400 0x400>;
            clocks = <&rcc 0 STM32F7_AHB1_CLOCK(GPIOB)>;
            st,bank-name = "GPIOB";
        };

        gpioc: gpio@40020800 {
            gpio-controller;
            #gpio-cells = <2>;
            interrupt-controller;
            #interrupt-cells = <2>;
            reg = <0x800 0x400>;
            clocks = <&rcc 0 STM32F7_AHB1_CLOCK(GPIOC)>;
            st,bank-name = "GPIOC";
        };

        gpiod: gpio@40020c00 {
            gpio-controller;
            #gpio-cells = <2>;
            interrupt-controller;
            #interrupt-cells = <2>;
            reg = <0xc00 0x400>;
            clocks = <&rcc 0 STM32F7_AHB1_CLOCK(GPIOD)>;
            st,bank-name = "GPIOD";
        };

        gpioe: gpio@40021000 {
            gpio-controller;
            #gpio-cells = <2>;
            interrupt-controller;
            #interrupt-cells = <2>;
            reg = <0x1000 0x400>;
            clocks = <&rcc 0 STM32F7_AHB1_CLOCK(GPIOE)>;
            st,bank-name = "GPIOE";
        };

        gpiof: gpio@40021400 {
            gpio-controller;
            #gpio-cells = <2>;
            interrupt-controller;
            #interrupt-cells = <2>;
            reg = <0x1400 0x400>;
            clocks = <&rcc 0 STM32F7_AHB1_CLOCK(GPIOF)>;
            st,bank-name = "GPIOF";
        };

        gpiog: gpio@40021800 {
            gpio-controller;
            #gpio-cells = <2>;
            interrupt-controller;
            #interrupt-cells = <2>;
            reg = <0x1800 0x400>;
            clocks = <&rcc 0 STM32F7_AHB1_CLOCK(GPIOG)>;
            st,bank-name = "GPIOG";
        };

        gpioh: gpio@40021c00 {
            gpio-controller;
            #gpio-cells = <2>;
            interrupt-controller;
            #interrupt-cells = <2>;
            reg = <0x1c00 0x400>;
            clocks = <&rcc 0 STM32F7_AHB1_CLOCK(GPIOH)>;
            st,bank-name = "GPIOH";
        };

        gpioi: gpio@40022000 {
            gpio-controller;
            #gpio-cells = <2>;
            interrupt-controller;
            #interrupt-cells = <2>;
            reg = <0x2000 0x400>;
            clocks = <&rcc 0 STM32F7_AHB1_CLOCK(GPIOI)>;
            st,bank-name = "GPIOI";
        };

        gpioj: gpio@40022400 {
            gpio-controller;
            #gpio-cells = <2>;
            interrupt-controller;
            #interrupt-cells = <2>;
            reg = <0x2400 0x400>;
            clocks = <&rcc 0 STM32F7_AHB1_CLOCK(GPIOJ)>;
            st,bank-name = "GPIOJ";
        };

        gpiok: gpio@40022800 {
            gpio-controller;
            #gpio-cells = <2>;
            interrupt-controller;
            #interrupt-cells = <2>;
            reg = <0x2800 0x400>;
            clocks = <&rcc 0 STM32F7_AHB1_CLOCK(GPIOK)>;
            st,bank-name = "GPIOK";
        };

        cec_pins_a: cec@0 {
            pins {
                pinmux = <STM32_PINMUX('A', 15, AF4)>; /* HDMI CEC */
                slew-rate = <0>;
                drive-open-drain;
                bias-disable;
            };
        };

        usart1_pins_a: usart1@0 {
            pins1 {
                pinmux = <STM32_PINMUX('A', 9, AF7)>; /* USART1_TX */
                bias-disable;
                drive-push-pull;
                slew-rate = <0>;
            };
            pins2 {
                pinmux = <STM32_PINMUX('A', 10, AF7)>; /* USART1_RX */
                bias-disable;
            };
        };

        usart1_pins_b: usart1@1 {
            pins1 {
                pinmux = <STM32_PINMUX('A', 9, AF7)>; /* USART1_TX */
                bias-disable;
                drive-push-pull;
                slew-rate = <0>;
            };
            pins2 {
                pinmux = <STM32_PINMUX('B', 7, AF7)>; /* USART1_RX */
                bias-disable;
            };
        };

        i2c1_pins_b: i2c1@0 {
            pins {
                pinmux = <STM32_PINMUX('B', 9, AF4)>, /* I2C1 SDA */
                     <STM32_PINMUX('B', 8, AF4)>; /* I2C1 SCL */
                bias-disable;
                drive-open-drain;
                slew-rate = <0>;
            };
        };

        usbotg_hs_pins_a: usbotg-hs@0 {
            pins {
                pinmux = <STM32_PINMUX('H', 4, AF10)>, /* OTG_HS_ULPI_NXT */
                     <STM32_PINMUX('I', 11, AF10)>, /* OTG_HS_ULPI_DIR */
                     <STM32_PINMUX('C', 0, AF10)>, /* OTG_HS_ULPI_STP */
                     <STM32_PINMUX('A', 5, AF10)>, /* OTG_HS_ULPI_CK */
                     <STM32_PINMUX('A', 3, AF10)>, /* OTG_HS_ULPI_D0 */
                     <STM32_PINMUX('B', 0, AF10)>, /* OTG_HS_ULPI_D1 */
                     <STM32_PINMUX('B', 1, AF10)>, /* OTG_HS_ULPI_D2 */
                     <STM32_PINMUX('B', 10, AF10)>, /* OTG_HS_ULPI_D3 */
                     <STM32_PINMUX('B', 11, AF10)>, /* OTG_HS_ULPI_D4 */
                     <STM32_PINMUX('B', 12, AF10)>, /* OTG_HS_ULPI_D5 */
                     <STM32_PINMUX('B', 13, AF10)>, /* OTG_HS_ULPI_D6 */
                     <STM32_PINMUX('B', 5, AF10)>; /* OTG_HS_ULPI_D7 */
                bias-disable;
                drive-push-pull;
                slew-rate = <2>;
            };
        };

        usbotg_hs_pins_b: usbotg-hs@1 {
            pins {
                pinmux = <STM32_PINMUX('H', 4, AF10)>, /* OTG_HS_ULPI_NXT */
                     <STM32_PINMUX('C', 2, AF10)>, /* OTG_HS_ULPI_DIR */
                     <STM32_PINMUX('C', 0, AF10)>, /* OTG_HS_ULPI_STP */
                     <STM32_PINMUX('A', 5, AF10)>, /* OTG_HS_ULPI_CK */
                     <STM32_PINMUX('A', 3, AF10)>, /* OTG_HS_ULPI_D0 */
                     <STM32_PINMUX('B', 0, AF10)>, /* OTG_HS_ULPI_D1 */
                     <STM32_PINMUX('B', 1, AF10)>, /* OTG_HS_ULPI_D2 */
                     <STM32_PINMUX('B', 10, AF10)>, /* OTG_HS_ULPI_D3 */
                     <STM32_PINMUX('B', 11, AF10)>, /* OTG_HS_ULPI_D4 */
                     <STM32_PINMUX('B', 12, AF10)>, /* OTG_HS_ULPI_D5 */
                     <STM32_PINMUX('B', 13, AF10)>, /* OTG_HS_ULPI_D6 */
                     <STM32_PINMUX('B', 5, AF10)>; /* OTG_HS_ULPI_D7 */
                bias-disable;
                drive-push-pull;
                slew-rate = <2>;
            };
        };

        usbotg_fs_pins_a: usbotg-fs@0 {
            pins {
                pinmux = <STM32_PINMUX('A', 10, AF10)>, /* OTG_FS_ID */
                     <STM32_PINMUX('A', 11, AF10)>, /* OTG_FS_DM */
                     <STM32_PINMUX('A', 12, AF10)>; /* OTG_FS_DP */
                bias-disable;
                drive-push-pull;
                slew-rate = <2>;
            };
        };

        ethernet_rmii: rmii@0 {
              pins {
                  pinmux = <STM32_PINMUX('G', 13, AF11)>, /* ETH_RMII_TXD0 */
                       <STM32_PINMUX('G', 14, AF11)>, /* ETH_RMII_TXD1 */
                       <STM32_PINMUX('G', 11, AF11)>, /* ETH_RMII_TX_EN */
                       <STM32_PINMUX('A',  2, AF11)>, /* ETH_MDIO */
                       <STM32_PINMUX('C',  1, AF11)>, /* ETH_MDC */
                       <STM32_PINMUX('A',  1, AF11)>, /* ETH_RMII_REF_CLK */
                       <STM32_PINMUX('A',  7, AF11)>, /* ETH_RMII_CRS_DV */
                       <STM32_PINMUX('C',  4, AF11)>, /* ETH_RMII_RXD0 */
                       <STM32_PINMUX('C',  5, AF11)>; /* ETH_RMII_RXD1 */

/* pinmux = ,

, , , , , , , ; */ slew-rate = <2>; }; }; }; crc: crc@40023000 { compatible = "st,stm32f7-crc"; reg = <0x40023000 0x400>; clocks = <&rcc 0 12>; status = "disabled"; }; rcc: rcc@40023800 { #reset-cells = <1>; #clock-cells = <2>; compatible = "st,stm32f746-rcc", "st,stm32-rcc"; reg = <0x40023800 0x400>; clocks = <&clk_hse>, <&clk_i2s_ckin>; st,syscfg = <&pwrcfg>; assigned-clocks = <&rcc 1 CLK_HSE_RTC>; assigned-clock-rates = <1000000>; }; dma1: dma@40026000 { compatible = "st,stm32-dma"; reg = <0x40026000 0x400>; interrupts = <11>, <12>, <13>, <14>, <15>, <16>, <17>, <47>; clocks = <&rcc 0 STM32F7_AHB1_CLOCK(DMA1)>; #dma-cells = <4>; status = "okay"; }; dma2: dma@40026400 { compatible = "st,stm32-dma"; reg = <0x40026400 0x400>; interrupts = <56>, <57>, <58>, <59>, <60>, <68>, <69>, <70>; clocks = <&rcc 0 STM32F7_AHB1_CLOCK(DMA2)>; #dma-cells = <4>; st,mem2mem; status = "okay"; }; usbotg_hs: usb@40040000 { compatible = "st,stm32f7-hsotg"; reg = <0x40040000 0x40000>; interrupts = <77>; clocks = <&rcc 0 STM32F7_AHB1_CLOCK(OTGHS)>; clock-names = "otg"; status = "disabled"; }; usbotg_fs: usb@50000000 { compatible = "st,stm32f4x9-fsotg"; reg = <0x50000000 0x40000>; interrupts = <67>; clocks = <&rcc 0 STM32F7_AHB2_CLOCK(OTGFS)>; clock-names = "otg"; status = "disabled"; }; }; }; &systick { clocks = <&rcc 1 0>; status = "okay"; }; {noformat}
cfriedt commented 5 years ago

making some progress here

https://github.com/torvalds/linux/compare/master...cfriedt:cfriedt/stm32/get-ethernet-working?expand=1

~ # ifconfig eth0 up 192.168.1.250
[   11.365572] stm32-dwmac 40028000.ethernet eth0: device MAC address 92:27:a9:78:7e:e1
[   11.376138] Generic PHY stmmac-0:00: attached PHY driver [Generic PHY] (mii_bus:phy_addr=stmmac-0:00, irq=POLL)
[   11.407535] stm32-dwmac 40028000.ethernet eth0: No Safety Features support found
[   11.415266] stm32-dwmac 40028000.ethernet eth0: IEEE 1588-2008 Advanced Timestamp supported
[   11.426347] stm32-dwmac 40028000.ethernet eth0: registered PTP clock
[   11.434405] stmmac: (ptrval) <= 0041848c ETH_MACCR
[   11.439460] stmmac: (ptrval) <= 00000010 ETH_MACMIIAR
[   11.444527] stmmac: (ptrval) <= 00003100 ETH_MACMIIDR
[   11.449848] stmmac: (ptrval) <= 00000200 ETH_MACIMR
[   11.454745] stmmac: (ptrval) <= 8000e17e ETH_MACA0HR
[   11.459976] stmmac: (ptrval) <= 78a92792 ETH_MACA0LR
[   11.464950] stmmac: (ptrval) <= 00000024 ETH_MMCCR
[   11.470008] stmmac: (ptrval) <= 00ffffff ETH_MMCRIMR
[   11.474987] stmmac: (ptrval) <= 01ffffff ETH_MMCTIMR
[   11.480229] stmmac: (ptrval) <= 20010000 ETH_DMARDLAR
[   11.485294] stmmac: (ptrval) <= 20014000 ETH_DMATDLAR
[   11.490616] stmmac: (ptrval) <= 02202006 ETH_DMAOMR
[   11.495507] stmmac: (ptrval) <= 0001a061 ETH_DMAIER
[   11.503339] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
~ # [   12.491707] stm32-dwmac 40028000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx
[   12.500698] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[   18.409153] ------------[ cut here ]------------
[   18.413906] WARNING: CPU: 0 PID: 0 at net/sched/sch_generic.c:461 dev_watchdog+0xfd/0x19c
[   18.422102] NETDEV WATCHDOG: eth0 (stm32-dwmac): transmit queue 0 timed out
[   18.429135] CPU: 0 PID: 0 Comm: swapper Not tainted 4.19.0 #33
[   18.434961] Hardware name: STM32 (Device Tree Support)
[   18.440295] [<c000c0c9>] (unwind_backtrace) from [<c000b223>] (show_stack+0xb/0xc)
[   18.448044] [<c000b223>] (show_stack) from [<c000eb0f>] (__warn+0x87/0xa0)
[   18.455093] [<c000eb0f>] (__warn) from [<c000eb4f>] (warn_slowpath_fmt+0x27/0x40)
[   18.462773] [<c000eb4f>] (warn_slowpath_fmt) from [<c01a450d>] (dev_watchdog+0xfd/0x19c)
[   18.471064] [<c01a450d>] (dev_watchdog) from [<c0037b49>] (call_timer_fn+0xf/0x56)
[   18.478821] [<c0037b49>] (call_timer_fn) from [<c0037ccb>] (expire_timers+0x7b/0x7e)
[   18.486758] [<c0037ccb>] (expire_timers) from [<c0037ecd>] (run_timer_softirq+0xf5/0x140)
[   18.495125] [<c0037ecd>] (run_timer_softirq) from [<c000994d>] (__do_softirq+0xf5/0x14c)
[   18.503402] [<c000994d>] (__do_softirq) from [<c001098d>] (irq_exit+0x3d/0x80)
[   18.510812] [<c001098d>] (irq_exit) from [<c002be75>] (__handle_domain_irq+0x47/0x6a)
[   18.518830] [<c002be75>] (__handle_domain_irq) from [<c000ba83>] (__irq_entry+0x53/0x84)
[   18.526947] ---[ end trace 0eb52e36aeb5afb5 ]---
cfriedt commented 5 years ago

This patch works for me stm32f746-disco-get-ethernet-working.diff.gz

pretty version is linked here on GitHub

Note: DMA is not working on the i2c or uart devices. Probably more devicetree entries needed.

cfriedt commented 5 years ago
$ ping -c 100 192.168.1.250
PING 192.168.1.250 (192.168.1.250) 56(84) bytes of data.
64 bytes from 192.168.1.250: icmp_seq=1 ttl=64 time=6.61 ms
...
64 bytes from 192.168.1.250: icmp_seq=100 ttl=64 time=4.92 ms

--- 192.168.1.250 ping statistics ---
100 packets transmitted, 100 received, 0% packet loss, time 99162ms
rtt min/avg/max/mdev = 1.710/4.397/10.945/1.265 ms
cfriedt commented 5 years ago

Also, because you did not mention this way of configuring kernel to set up Ethernet in this thread, so I made the settings myself in the kernel, which, of course, do not know if it is enough or not.

Strange.

After applying these patches, I rebuilt my kernel with make ARCH=arm CROSS_COMPILE=arm-none-eabi- stm32_defconfig make ARCH=arm CROSS_COMPILE=arm-none-eabi-

and have not had any issues (although dma still does not work with uart / i2c)

You have console access on ttySTM0, right?

cfriedt commented 5 years ago

Sorry - my bad - I should have clarified that the STM32 will boot linux and use ttySTM0 as the console.

My exact config is here.

linux-stm32f746.config.txt

Other than that, everything else should be in the branch

https://github.com/cfriedt/linux/compare/branch-v4.20...cfriedt:cfriedt/stm32f746-disco/get-ethernet-working

Note, the part that says

 I've noticed that U-Boot bootargs trump these
         * I suggest adding the following to your U-Boot .config
         * CONFIG_BOOTARGS="console=ttySTM0,115200n8"
sadegh916 commented 4 years ago

Can somebody help me step by step to enable ethernet for this board?

rodrigo455 commented 3 years ago

I was able to overcome this problem with the following patch:

 drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c
index 9e6db16af..63d6f388b 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c
@@ -22,7 +22,9 @@

 #include "stmmac_platform.h"

-#define MII_PHY_SEL_MASK   BIT(23)
+#define STM32_SYSCFG_PMC_ETHMODE_MASK      (0x3 << 23)
+#define STM32_SYSCFG_PMC_ETHMODE_MII       (0x0 << 23)
+#define STM32_SYSCFG_PMC_ETHMODE_RMII      (0x1 << 23)

 struct stm32_dwmac {
    struct clk *clk_tx;
@@ -39,8 +41,8 @@ static int stm32_dwmac_init(struct plat_stmmacenet_data *plat_dat)
    u32 val;
    int ret;

-   val = (plat_dat->interface == PHY_INTERFACE_MODE_MII) ? 0 : 1;
-   ret = regmap_update_bits(dwmac->regmap, reg, MII_PHY_SEL_MASK, val);
+   val = (plat_dat->interface == PHY_INTERFACE_MODE_MII) ? STM32_SYSCFG_PMC_ETHMODE_MII : STM32_SYSCFG_PMC_ETHMODE_RMII;
+   ret = regmap_update_bits(dwmac->regmap, reg, STM32_SYSCFG_PMC_ETHMODE_MASK, val);
    if (ret)
        return ret;

-- 
mbasilSB commented 1 year ago

Hi, I applied both patches, @cfriedt and @rodrigo455, with the configuration of @cfriedt , and got stuck in the following part in both of them: _~ # ifconfig eth0 up 192.168.0.123 [ 50.320000] stm32-dwmac 40028000.ethernet eth0: device MAC address b2:09:eb:cc:42:88 [ 50.530000] Generic PHY stmmac-0:00: attached PHY driver [Generic PHY] (mii_bus:phy_addr=stmmac-0:00, irq=POLL) [ 50.550000] stm32-dwmac 40028000.ethernet eth0: IEEE 1588-2008 Advanced Timestamp supported [ 50.560000] stm32-dwmac 40028000.ethernet eth0: registered PTP clock [ 50.560000] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready ~ # [ 52.010000] stm32-dwmac 40028000.ethernet eth0: Link is Up - 100Mbps/Full - flow control off [ 52.010000] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready [ 57.440000] ------------[ cut here ]------------ [ 57.440000] WARNING: CPU: 0 PID: 0 at net/sched/sch_generic.c:323 dev_watchdog+0xfd/0x19c [ 57.440000] NETDEV WATCHDOG: eth0 (stm32-dwmac): transmit queue 0 timed out [ 57.440000] CPU: 0 PID: 0 Comm: swapper Not tainted 4.15.7 #2 [ 57.440000] Hardware name: STM32 (Device Tree Support) [ 57.440000] [] (unwind_backtrace) from [] (show_stack+0xb/0xc) [ 57.440000] [] (show_stack) from [] (warn+0x87/0xa0) [ 57.440000] [] (warn) from [] (warn_slowpath_fmt+0x1f/0x28) [ 57.440000] [] (warn_slowpath_fmt) from [] (dev_watchdog+0xfd/0x19c) [ 57.440000] [] (dev_watchdog) from [] (call_timer_fn+0xf/0x56) [ 57.440000] [] (call_timer_fn) from [] (expire_timers+0x7b/0x7e) [ 57.440000] [] (expire_timers) from [] (run_timer_softirq+0xdf/0x11e) [ 57.440000] [] (run_timer_softirq) from [] (do_softirq+0xf3/0x14c) [ 57.440000] [] (__do_softirq) from [] (irq_exit+0x6b/0x7c) [ 57.440000] [] (irq_exit) from [] (handle_domain_irq+0x47/0x6a) [ 57.440000] [] (handle_domain_irq) from [] (irq_entry+0x53/0x84) [ 57.440000] [] (__irqentry) from [<00000006>] (0x6) [ 57.440000] ---[ end trace 110a9d61914add72 ]---**

if after this if I try ifconfig or ping I get the following error output:

~ # ifconfig [ 199.390000] ifconfig: page allocation failure: order:7, mode:0x14000c0(GFP_KERNEL), nodemask=(null) [ 199.390000] CPU: 0 PID: 57 Comm: ifconfig Tainted: G W 4.15.7 #2 [ 199.390000] Hardware name: STM32 (Device Tree Support) [ 199.390000] [] (unwind_backtrace) from [] (show_stack+0xb/0xc) [ 199.390000] [] (show_stack) from [] (warn_alloc+0x51/0xce) [ 199.390000] [] (warn_alloc) from [] (alloc_pages_nodemask+0x391/0x564) [ 199.390000] [] (alloc_pages_nodemask) from [] (get_free_pages+0xb/0x20) [ 199.390000] [] (get_free_pages) from [] (alloc_pages_exact+0x19/0x22) [ 199.390000] [] (alloc_pages_exact) from [] (do_mmap+0x41d/0x5be) [ 199.390000] [] (do_mmap) from [] (vm_mmap_pgoff+0x4b/0x60) [ 199.390000] [] (vm_mmap_pgoff) from [] (load_flat_file+0x375/0x552) [ 199.390000] [] (load_flat_file) from [] (load_flat_binary+0x49/0x2a6) [ 199.390000] [] (load_flat_binary) from [] (search_binary_handler+0x57/0xe4) [ 199.390000] [] (search_binary_handler) from [] (do_execveat_common+0x253/0x368) [ 199.390000] [] (do_execveat_common) from [] (do_execve+0x15/0x1a) [ 199.390000] [] (do_execve) from [] (ret_fast_syscall+0x1/0x58) [ 199.390000] warn_alloc_show_mem: 1 callbacks suppressed [ 199.390000] Mem-Info: [ 199.390000] active_anon:0 inactive_anon:0 isolated_anon:0 [ 199.390000] active_file:0 inactive_file:0 isolated_file:0 [ 199.390000] unevictable:172 dirty:0 writeback:0 unstable:0 [ 199.390000] slab_reclaimable:32 slab_unreclaimable:563 [ 199.390000] mapped:0 shmem:0 pagetables:0 bounce:0 [ 199.390000] free:249 free_pcp:0 free_cma:0 [ 199.390000] Node 0 active_anon:0kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:688kB isolated(anon):0kB isolated(file):0kB mapped:0kB dirty:0kB writeback:0kB shmem:0kB writeback_tmp:0kB unstable:0kB all_unreclaimable? no [ 199.390000] Normal free:996kB min:272kB low:340kB high:408kB active_anon:0kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:688kB writepending:0kB present:8192kB managed:4964kB mlocked:0kB kernel_stack:200kB pagetables:0kB bounce:0kB free_pcp:0kB local_pcp:0kB free_cma:0kB [ 199.390000] lowmem_reserve[]: 0 0 [ 199.390000] Normal: 14kB (U) 08kB 216kB (U) 032kB 164kB (U) 1128kB (U) 3256kB (U) 0512kB 01024kB 02048kB 04096kB = 996kB [ 199.390000] 173 total pagecache pages [ 199.390000] 2048 pages RAM [ 199.390000] 0 pages HighMem/MovableOnly [ 199.390000] 807 pages reserved [ 199.390000] nommu: Allocation of length 286720 from process 57 (ifconfig) failed [ 199.390000] active_anon:0 inactive_anon:0 isolated_anon:0 [ 199.390000] active_file:0 inactive_file:0 isolated_file:0 [ 199.390000] unevictable:172 dirty:0 writeback:0 unstable:0 [ 199.390000] slab_reclaimable:32 slab_unreclaimable:563 [ 199.390000] mapped:0 shmem:0 pagetables:0 bounce:0 [ 199.390000] free:249 free_pcp:0 free_cma:0 [ 199.390000] Node 0 active_anon:0kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:688kB isolated(anon):0kB isolated(file):0kB mapped:0kB dirty:0kB writeback:0kB shmem:0kB writeback_tmp:0kB unstable:0kB all_unreclaimable? no [ 199.390000] Normal free:996kB min:272kB low:340kB high:408kB active_anon:0kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:688kB writepending:0kB present:8192kB managed:4964kB mlocked:0kB kernel_stack:200kB pagetables:0kB bounce:0kB free_pcp:0kB local_pcp:0kB free_cma:0kB [ 199.390000] lowmem_reserve[]: 0 0 [ 199.390000] Normal: 14kB (U) 08kB 216kB (U) 032kB 164kB (U) 1128kB (U) 3256kB (U) 0512kB 01024kB 02048kB 04096kB = 996kB [ 199.390000] 173 total pagecache pages [ 199.390000] binfmt_flat: Unable to allocate RAM for process text/data, errno -12 SEGV

Does anyone have a hint on why am I getting this error applying the exact same configuration and patches?

Thanks in advance

cfriedt commented 1 year ago

It looks like the defines added in the above patch ate likely bogus. They define those symbols to nothing..

mbasilSB commented 1 year ago

Thanks for the fast reply @cfriedt , I'm not sure I understood what yo mean, since I took the exact same configuration and version as yours and used your patch, I don't know what I may have done wrong in the process, do you have any hint about it or any possible solution? Thanks

cfriedt commented 1 year ago

Thanks for the fast reply @cfriedt , I'm not sure I understood what yo mean, since I took the exact same configuration and version as yours and used your patch, I don't know what I may have done wrong in the process, do you have any hint about it or any possible solution? Thanks

There is a patch listed above that someone claimed resolved their DMA issue. It is not mine. That's what I was referring to.

In terms of what you've done wrong, I have no idea. It's possible that source code has evolved since then. My comments applied to things 4 years ago but might be out of date now.

You may need to debug the issue yourself.