Jump to content

Aleksey

Members
  • Posts

    9
  • Joined

  • Last visited

Profile Information

  • Gender
    Male
  • Location
    Ukraine

Contact Methods

  • Github
    https://github.com/AlekseyMamontov

Recent Profile Visitors

824 profile views
  1. It’s strange that your definition didn’t fit , this value is defined https://elixir.bootlin.com/linux/latest/source/include/dt-bindings/interrupt-controller/irq.h#L18 and here https://elixir.bootlin.com/linux/latest/source/include/linux/irq.h#L82 But you can do that))
  2. Just instead of interrupts = <0 7 2>; /* PA7 IRQ_TYPE_EDGE_FALLING */ put the correct value interrupts = <0 7 IRQ_TYPE_LEVEL_LOW>; And everything will work for you including Linux 5.11 Just a Linux 5.5 driver, uses sleep functions in the MCP2515, and the IRQ_TYPE_EDGE_FALLING interrupt cannot be handled.
  3. It seems that in my experiments I got lost in the wrong place) I was led astray mainly by this information. https://github.com/armbian/sunxi-DT-overlays/blob/master/examples/spi-mcp251x.dts With the default driver and with the correct parameters, everything works and the terminal does not freeze, here are the correct DT settings as an example for Nano PI NEO clocks { can0_osc_fixed: can0_osc_fixed { compatible = "fixed-clock"; #clock-cells = <0>; clock-frequency = <8000000>; }; } pio: pinctrl@1c20800 { /* compatible is in per SoC .dtsi file */ reg = <0x01c20800 0x400>; interrupts = <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>; clocks = <&ccu CLK_BUS_PIO>, <&osc24M>, <&rtc 0>; clock-names = "apb", "hosc", "losc"; gpio-controller; #gpio-cells = <3>; interrupt-controller; #interrupt-cells = <3>; ..... can0_pin_irq: can0_pin_irq { pins = "PG8"; function = "irq"; bias-pull-up; }; } spi0: spi@1c68000 { compatible = "allwinner,sun8i-h3-spi"; reg = <0x01c68000 0x1000>; interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>; clocks = <&ccu CLK_BUS_SPI0>, <&ccu CLK_SPI0>; clock-names = "ahb", "mod"; dmas = <&dma 23>, <&dma 23>; dma-names = "rx", "tx"; pinctrl-names = "default"; pinctrl-0 = <&spi0_pins>; resets = <&ccu RST_BUS_SPI0>; status = "okay"; #address-cells = <1>; #size-cells = <0>; can0: can@0 { reg = <0>; compatible = "microchip,mcp2515"; pinctrl-names = "default"; pinctrl-0 = <&can0_pin_irq>; interrupt-parent = <&pio>; interrupts = <6 8 IRQ_TYPE_LEVEL_LOW>; /* This is the correct meaning */ clocks = <&can0_osc_fixed>; spi-max-frequency = <10000000>; gpio-controller; #gpio-cells = <2>; status = "okay"; }; }; If someone was confused by my search for a solution to the problem, I am sorry. If you set IRQ_TYPE_EDGE_FALLING, the terminal will hang. This parameter leads to the terminal freezing when calling functions ret = mcp251x_hw_wake(spi); , and in it functions to disable interrupts disable_irq(spi->irq)
  4. Причина зависания терминала на этих платах (на примере Nanopi NEO) кроется в этой функции при попытке отключить прерывания disable_irq (spi-> irq); Если закомментировать данный вызов, зависаний не произойдет. The reason for the terminal freezing on these boards (as an example of Nanopi NEO) occurs in this function when trying to disable interrupts disable_irq(spi->irq); If you comment out this given call, the hangs do not occur. static int mcp251x_hw_wake(struct spi_device *spi) { u8 value; int ret; /* Force wakeup interrupt to wake device, but don't execute IST */ disable_irq(spi->irq); mcp251x_write_2regs(spi, CANINTE, CANINTE_WAKIE, CANINTF_WAKIF); /* Wait for oscillator startup timer after wake up */ mdelay(MCP251X_OST_DELAY_MS); /* Put device into config mode */ mcp251x_write_reg(spi, CANCTRL, CANCTRL_REQOP_CONF); /* Wait for the device to enter config mode */ ret = mcp251x_read_stat_poll_timeout(spi, value, value == CANCTRL_REQOP_CONF, MCP251X_OST_DELAY_MS * 1000, USEC_PER_SEC); if (ret) { dev_err(&spi->dev, "MCP251x didn't enter in config mode\n"); return ret; } /* Disable and clear pending interrupts */ mcp251x_write_2regs(spi, CANINTE, 0x00, 0x00); enable_irq(spi->irq); return 0; } Настройка платы NanoPI NEO Devicetree Setting up the NanoPI NEO board Devicetree clocks { #address-cells = <1>; #size-cells = <1>; ranges; ... can0_osc_fixed: can0_osc_fixed { compatible = "fixed-clock"; #clock-cells = <0>; clock-frequency = <8000000>; }; } ........................... pio: pinctrl@1c20800 { /* compatible is in per SoC .dtsi file */ reg = <0x01c20800 0x400>; interrupts = <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>; clocks = <&ccu CLK_BUS_PIO>, <&osc24M>, <&rtc 0>; clock-names = "apb", "hosc", "losc"; gpio-controller; #gpio-cells = <3>; interrupt-controller; #interrupt-cells = <3>; ..... can0_pin_irq: can0_pin_irq { pins = "PG8"; function = "irq"; bias-pull-up; }; } spi0: spi@1c68000 { compatible = "allwinner,sun8i-h3-spi"; reg = <0x01c68000 0x1000>; interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>; clocks = <&ccu CLK_BUS_SPI0>, <&ccu CLK_SPI0>; clock-names = "ahb", "mod"; dmas = <&dma 23>, <&dma 23>; dma-names = "rx", "tx"; pinctrl-names = "default"; pinctrl-0 = <&spi0_pins>; resets = <&ccu RST_BUS_SPI0>; status = "okay"; #address-cells = <1>; #size-cells = <0>; can0: can@0 { reg = <0>; compatible = "microchip,mcp2515"; pinctrl-names = "default"; pinctrl-0 = <&can0_pin_irq>; interrupt-parent = <&pio>; interrupts = <6 8 IRQ_TYPE_EDGE_FALLING>; clocks = <&can0_osc_fixed>; spi-max-frequency = <10000000>; gpio-controller; #gpio-cells = <2>; status = "okay"; }; }; Экспериментальный модуль MCP2515 с частотой 8 МГц Experimental module MCP2515 with a frequency of 8 MHz TJA1050 replaced by SN65HVD230 TJA1050 заменен на SN65HVD230 на 3,3 В
  5. Aleksey

    Aleksey

  6. A temporary solution to the problem Calling ret = mcp251x_hw_wake (spi); this subroutine leads to a hang in the terminal on sunxi H3 boards when entering the command ip link set can0 up type can bitrate 500000 or ifconfig can0 up return to call ret = mcp251x_hw_reset (spi); fixes this problem Linux 5.5 - 5.11.2 for sunxi H3 (example Nano Pi NEO,modul MCP2515 8mhz) mcp251x.c
  7. Platform under test NanoPi NEO with MCP2515 8Mhz module spi 0,0 linux 5.4.100 mcp2515 work Сhanges made to the MCP2515 driver led to the fact that when calling commands ip link set can0 up type can bitrate 500000 or ifconfig can0 up to hang the system in a terminal window see foto terminal.
  8. At this point, about everything broke for sunxi H3 https://github.com/torvalds/linux/commit/50ec88120ea16cf8b9aabf8422c364166ce3ee17#diff-55b4d8281f6fd3fe6b7b66da9ae5e9ce818e02b8ac9b23260593fd551c22fdc1 5.4.100 mcp2515 can - work 5.5.rc1 mcp2515 can - not work If you copy the source codes of the mcp2515 driver from linux 5.4.100 to the sources on 5.10.19 and build them in Buildroot, everything will work. checked.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines