raspberrypi / linux

Kernel source tree for Raspberry Pi-provided kernel builds. Issues unrelated to the linux kernel should be posted on the community forum at https://forums.raspberrypi.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

call trace of MCP2518 driver

tzeng015 opened this issue · comments

Describe the bug

hi all
pltaform : imx8mm
Linux version : 5.10

I am in troubled in mcp251xfd-core.c of kernel driver. When I setting the data , it is alwayse call trace.

I traced the mcp251xfd-core.c and I find the problem is mcp251xfd_irq. Please see the attach file.

static irqreturn_t mcp251xfd_irq(int irq, void *dev_id)
{
struct mcp251xfd_priv *priv = dev_id;
irqreturn_t handled = IRQ_NONE;
int err;
int val;

if (priv->rx_int)
	do {
		int rx_pending;

		rx_pending = gpiod_get_value_cansleep(priv->rx_int);
		if (!rx_pending)
			break;

		err = mcp251xfd_handle(priv, rxif);
		if (err)
			goto out_fail;

		handled = IRQ_HANDLED;
	} while (1);

do {
	u32 intf_pending, intf_pending_clearable;
	bool set_normal_mode = false;

	err = regmap_bulk_read(priv->map_reg, MCP251XFD_REG_INT,
			       &priv->regs_status,
			       sizeof(priv->regs_status) /
			       sizeof(u32));
	if (err)
		goto out_fail;

	intf_pending = FIELD_GET(MCP251XFD_REG_INT_IF_MASK,
				 priv->regs_status.intf) &
		FIELD_GET(MCP251XFD_REG_INT_IE_MASK,
			  priv->regs_status.intf);

	if (!(intf_pending)) 
		return handled;

}

I find the this
(1) handled = IRQ_NONE;
(2) intf_pending = 0
(3) if (!(intf_pending))
return handled;
handled = IRQ_NONE so this is the call trace reaseon.

Summary : Can you help me why intf_pending is 0. I already seeting the INT register but it doesn't any chanage of low bit in interrupt function
.
Please help me .
thank you

tzeng015

Steps to reproduce the behaviour

Step 1 : ip link set up can0 type can bitrate 500000
root@a100:/# ip link set up can0 type can bitrate 500000
[ 43.803752] INT NO read RXIF int read data 1118 Before GPIO0 val 3030003
[ 43.810586] INT NO read RXIF int read data 1118 After GPIO0 val 3030002
[ 43.817641] 1124 int read 1125 After GPIO val 73030042
[ 43.823766] mcp251xfd_chip_interrupts_enable val to MCP251XFD_REG_INT 1125 FULL ff1f0000
[ 43.833612] IPv6: ADDRCONF(NETDEV_CHANGE): can0: link becomes ready
root@a100:/# [ 46.340849] irq 182: nobody cared (try booting with the "irqpoll" option)
[ 46.347649] CPU: 0 PID: 168 Comm: spi0 Not tainted 5.10.72-lts-5.10.y+g22ec7e8cbace #1
[ 46.355564] Hardware name: FSL i.MX8MM EVK board (DT)
[ 46.360615] Call trace:
[ 46.363069] dump_backtrace+0x0/0x1a0
[ 46.366732] show_stack+0x18/0x70
[ 46.370050] dump_stack+0xd0/0x12c
[ 46.373452] __report_bad_irq+0x4c/0xdc
[ 46.377289] note_interrupt+0x2d8/0x39c
[ 46.381125] handle_irq_event+0xd8/0x150
[ 46.385048] handle_level_irq+0xc0/0x1b0
[ 46.388970] generic_handle_irq+0x30/0x50
[ 46.392981] mxc_gpio_irq_handler+0x50/0x140
[ 46.397251] mx3_gpio_irq_handler+0x80/0xf0
[ 46.401435] __handle_domain_irq+0x7c/0xe0
[ 46.405532] gic_handle_irq+0xc0/0x140
[ 46.409281] el1_irq+0xcc/0x180
[ 46.412423] _raw_spin_unlock_irq+0x14/0x50
[ 46.416606] __schedule+0x260/0x6d0
[ 46.420094] schedule+0x70/0x104
[ 46.423323] kthread_worker_fn+0x100/0x18c
[ 46.427417] kthread+0x154/0x160
[ 46.430645] ret_from_fork+0x10/0x30
[ 46.434219] handlers:
[ 46.436493] [<000000002e7cb574>] irq_default_primary_handler threaded [<00000000745389ea>] mcp251xfd_irq [mcp251xfd]
[ 46.447024] Disabling IRQ #182

Device (s)

Other

System

OS : Yocto
Linux version : 5.10

Logs

root@a100:/# ip link set up can0 type can bitrate 500000
[ 43.803752] INT NO read RXIF int read data 1118 Before GPIO0 val 3030003
[ 43.810586] INT NO read RXIF int read data 1118 After GPIO0 val 3030002
[ 43.817641] 1124 int read 1125 After GPIO val 73030042
[ 43.823766] mcp251xfd_chip_interrupts_enable val to MCP251XFD_REG_INT 1125 FULL ff1f0000
[ 43.833612] IPv6: ADDRCONF(NETDEV_CHANGE): can0: link becomes ready
root@a100:/# [ 46.340849] irq 182: nobody cared (try booting with the "irqpoll" option)
[ 46.347649] CPU: 0 PID: 168 Comm: spi0 Not tainted 5.10.72-lts-5.10.y+g22ec7e8cbace #1
[ 46.355564] Hardware name: FSL i.MX8MM EVK board (DT)
[ 46.360615] Call trace:
[ 46.363069] dump_backtrace+0x0/0x1a0
[ 46.366732] show_stack+0x18/0x70
[ 46.370050] dump_stack+0xd0/0x12c
[ 46.373452] __report_bad_irq+0x4c/0xdc
[ 46.377289] note_interrupt+0x2d8/0x39c
[ 46.381125] handle_irq_event+0xd8/0x150
[ 46.385048] handle_level_irq+0xc0/0x1b0
[ 46.388970] generic_handle_irq+0x30/0x50
[ 46.392981] mxc_gpio_irq_handler+0x50/0x140
[ 46.397251] mx3_gpio_irq_handler+0x80/0xf0
[ 46.401435] __handle_domain_irq+0x7c/0xe0
[ 46.405532] gic_handle_irq+0xc0/0x140
[ 46.409281] el1_irq+0xcc/0x180
[ 46.412423] _raw_spin_unlock_irq+0x14/0x50
[ 46.416606] __schedule+0x260/0x6d0
[ 46.420094] schedule+0x70/0x104
[ 46.423323] kthread_worker_fn+0x100/0x18c
[ 46.427417] kthread+0x154/0x160
[ 46.430645] ret_from_fork+0x10/0x30
[ 46.434219] handlers:
[ 46.436493] [<000000002e7cb574>] irq_default_primary_handler threaded [<00000000745389ea>] mcp251xfd_irq [mcp251xfd]
[ 46.447024] Disabling IRQ #182

Broadcast message from systemd-journald@a100 (Wed 2021-03-24 10:26:01 UTC):

kernel[364]: [ 46.447024] Disabling IRQ #182

root@a100:/# cat proc/interrupts
CPU0 CPU1 CPU2 CPU3
9: 0 0 0 0 GICv3 25 Level vgic
11: 2601 2030 1576 1614 GICv3 30 Level arch_timer
12: 0 0 0 0 GICv3 27 Level kvm guest vtimer
14: 365 540 411 424 GICv3 79 Level timer@306a0000
15: 0 0 0 0 GICv3 23 Level arm-pmu
20: 0 0 0 0 GICv3 128 Level sai
21: 0 0 0 0 GICv3 82 Level sai
22: 0 0 0 0 GICv3 122 Level sai
23: 0 0 0 0 GICv3 141 Level micfil
24: 0 0 0 0 GICv3 142 Level micfil
25: 0 0 0 0 GICv3 76 Level micfil
26: 0 0 0 0 GICv3 77 Level micfil
37: 0 0 0 0 GICv3 110 Level 30280000.watchdog
38: 0 0 0 0 GICv3 135 Level sdma
39: 0 0 0 0 GICv3 66 Level sdma
40: 0 0 0 0 GICv3 52 Level caam-snvs
41: 0 0 0 0 GICv3 51 Level rtc alarm
42: 0 0 0 0 GICv3 36 Level 30370000.snvs:snvs-powerkey
44: 103537 0 0 0 GICv3 63 Level 30820000.spi
45: 14 0 0 0 GICv3 64 Level 30830000.spi
46: 0 0 0 0 GICv3 58 Level 30860000.serial
47: 657 0 0 0 GICv3 59 Level 30890000.serial
49: 457 0 0 0 GICv3 67 Level 30a20000.i2c
50: 0 0 0 0 GICv3 68 Level 30a30000.i2c
51: 58 0 0 0 GICv3 69 Level 30a40000.i2c
52: 0 0 0 0 GICv3 70 Level 30a50000.i2c
54: 52 0 0 0 GICv3 54 Level mmc0
55: 0 0 0 0 GICv3 55 Level mmc1
56: 4498 0 0 0 GICv3 56 Level mmc2
57: 8 0 0 0 GICv3 34 Level sdma
58: 0 0 0 0 GICv3 150 Level 30be0000.ethernet
59: 0 0 0 0 GICv3 151 Level 30be0000.ethernet
60: 0 0 0 0 GICv3 152 Level 30be0000.ethernet
61: 0 0 0 0 GICv3 153 Level 30be0000.ethernet
62: 0 0 0 0 GICv3 37 Level imx-lcdif-crtc.0
63: 0 0 0 0 GICv3 50 Level 32e10000.mipi_dsi
66: 0 0 0 0 GICv3 130 Level imx8_ddr_perf_pmu
67: 0 0 0 0 GICv3 62 Level hx280enc
68: 0 0 0 0 GICv3 39 Level hantrodec
69: 0 0 0 0 GICv3 40 Level hantrodec
70: 0 0 0 0 GICv3 35 Level galcore:0
71: 0 0 0 0 GICv3 57 Level galcore:2d
75: 0 0 0 0 gpio-mxc 3 Edge bd718xx-irq
85: 0 0 0 0 gpio-mxc 13 Edge gpio-ir-recv-irq
87: 0 0 0 0 gpio-mxc 15 Edge 30b50000.mmc cd
182: 100001 0 0 0 gpio-mxc 14 Level spi0.0
234: 0 0 0 0 PCI-MSI 0 Edge PCIe PME
235: 0 0 0 0 PCI-MSI 524288 Edge eth1
236: 27 0 0 0 PCI-MSI 524289 Edge eth1-TxRx-0
237: 27 0 0 0 PCI-MSI 524290 Edge eth1-TxRx-1
238: 27 0 0 0 PCI-MSI 524291 Edge eth1-TxRx-2
239: 27 0 0 0 PCI-MSI 524292 Edge eth1-TxRx-3
240: 0 0 0 0 GICv3 137 Level fsl-jr0
241: 15 0 0 0 GICv3 138 Level 30902000.jr
242: 0 0 0 0 GICv3 146 Level 30903000.jr
IPI0: 101392 172432 2142 2174 Rescheduling interrupts
IPI1: 226 29753 424 134 Function call interrupts
IPI2: 0 0 0 0 CPU stop interrupts
IPI3: 0 0 0 0 CPU stop (for crash dump) interrupts
IPI4: 14 57 58 195 Timer broadcast interrupts
IPI5: 603 595 318 223 IRQ work interrupts
IPI6: 0 0 0 0 CPU wake-up interrupts
Err: 0
root@a100:/#

Additional context

No response

[ 43.803752] INT NO read RXIF int read data 1118 Before GPIO0 val 3030003
[ 43.810586] INT NO read RXIF int read data 1118 After GPIO0 val 3030002
[ 43.817641] 1124 int read 1125 After GPIO val 73030042
[ 43.823766] mcp251xfd_chip_interrupts_enable val to MCP251XFD_REG_INT 1125 FULL ff1f0000

Those aren't standard error messages from the kernel - somebody has added them to debug a problem.

[ 46.355564] Hardware name: FSL i.MX8MM EVK board (DT)

That's not one of ours.

If you're running a non-Raspberry Pi kernel on a non-Raspberry Pi board, you've come to the wrong place.