Причина зависания терминала на этих платах (на примере 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 В