Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce SPI broken reset warning (in kernel messages) #29

Closed
greenbreakfast opened this issue Apr 17, 2024 · 1 comment
Closed

Reduce SPI broken reset warning (in kernel messages) #29

greenbreakfast opened this issue Apr 17, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@greenbreakfast
Copy link
Contributor

greenbreakfast commented Apr 17, 2024

Context

OpenWRT 23.05 branch

Motivation

Why are we doing this? What use cases does it support? What problems does it solve? What is the expected outcome?

Goal: Decreasing developer friction

The Omega2+/2S+ features a flash chip that requires a broken-flash-reset flag to be set in the DTS (Device Tree Specification), https://github.com/openwrt/openwrt/blob/openwrt-23.05/target/linux/ramips/dts/mt7628an_onion_omega2p.dts#L9C2-L9C20

(More details on the the broken flash reset issue in this Onion Community post and this Github issue comment)

This broken-flash-reset flag causes the kernel to output a large message during device boot. This message can cause undue confusion - making users think there's an error when this is just a warning message.

Description

A clear and concise description of what you want to happen.
It should be reasonably clear how the improvement would be implemented.

Current behaviour: the bootlog outputs a large warning message like this (from OnionIoT/OpenWRT-Packages#62 (comment)):

[ 0.355272] spi-mt7621 10000b00.spi: sys_freq: 193333333
[ 0.384812] ------------[ cut here ]------------
[ 0.389526] WARNING: CPU: 0 PID: 1 at drivers/mtd/spi-nor/core.c:2863 spi_nor_init+0x17c/0x184
[ 0.398363] enabling reset hack; may not recover from unexpected reboots
[ 0.405180] Modules linked in:
[ 0.408287] CPU: 0 PID: 1 Comm: swapper Not tainted 5.15.150 #0
[ 0.414310] Stack : 00000000 00000000 80c23944 80870000 806c0000 80613540 80c3b280 806b9e03
[ 0.422843] 808733b4 00000001 809c8c7c 80061a48 8060cc5c 00000001 80c23900 b28cf387
[ 0.431370] 00000000 00000000 80613540 80c23798 ffffefff 00000000 00000000 ffffffea
[ 0.439897] 00000000 80c237a4 00000049 806c0298 80870000 00000009 00000000 80378cf4
[ 0.448411] 00000009 809c8c7c 80650000 80e34400 00000018 8033b394 00000000 80870000
[ 0.456933] ...
[ 0.459422] Call Trace:
[ 0.461909] [<8000702c>] show_stack+0x28/0xf0
[ 0.466364] [<80026228>] __warn+0x9c/0x124
[ 0.470547] [<8002633c>] warn_slowpath_fmt+0x8c/0xac
[ 0.475595] [<80378cf4>] spi_nor_init+0x17c/0x184
[ 0.480387] [<80379588>] spi_nor_scan+0x7a4/0xba0
[ 0.485171] [<8037a2c8>] spi_nor_probe+0x94/0x310
[ 0.489963] [<8034c8ac>] really_probe.part.0+0xac/0x354
[ 0.495279] [<8034cde0>] driver_probe_device+0x4c/0x154
[ 0.500599] [<8034d438>] __device_attach_driver+0xd0/0x15c
[ 0.506176] [<8034a524>] bus_for_each_drv+0x70/0xb0
[ 0.511171] [<8034d15c>] __device_attach+0xe0/0x180
[ 0.516130] [<8034b7f8>] bus_probe_device+0xa0/0xbc
[ 0.521096] [<80347f9c>] device_add+0x3e4/0x8e0
[ 0.525709] [<80384bd4>] __spi_add_device+0x90/0x178
[ 0.530773] [<80384d1c>] spi_add_device+0x60/0x9c
[ 0.535556] [<803850e8>] of_register_spi_device+0x21c/0x364
[ 0.541229] [<80385808>] spi_register_controller+0x5d8/0x7dc
[ 0.546981] [<803882d8>] mt7621_spi_probe+0x168/0x220
[ 0.552130] [<8034f18c>] platform_probe+0x50/0xa4
[ 0.556923] [<8034c8ac>] really_probe.part.0+0xac/0x354
[ 0.562242] [<8034cde0>] driver_probe_device+0x4c/0x154
[ 0.567553] [<8034d570>] __driver_attach+0xac/0x1ac
[ 0.572518] [<8034a478>] bus_for_each_dev+0x68/0xa4
[ 0.577482] [<8034bacc>] bus_add_driver+0x150/0x238
[ 0.582450] [<8034deb4>] driver_register+0x98/0x154
[ 0.587409] [<80000638>] do_one_initcall+0x50/0x1b4
[ 0.592377] [<8074a0e0>] kernel_init_freeable+0x1d0/0x26c
[ 0.597875] [<80579600>] kernel_init+0x20/0x108
[ 0.602511] [<80002478>] ret_from_kernel_thread+0x14/0x1c
[ 0.608005]
[ 0.609558] ---[ end trace 542a901b67c5a14f ]---
[ 0.614747] spi-nor spi0.0: w25q256 (32768 Kbytes)
[ 0.619722] 4 fixed-partitions partitions found on MTD device spi0.0
[ 0.626287] OF: Bad cell count for /palmbus@10000000/spi@b00/flash@0/partitions
[ 0.633792] OF: Bad cell count for /palmbus@10000000/spi@b00/flash@0/partitions
[ 0.641739] OF: Bad cell count for /palmbus@10000000/spi@b00/flash@0/partitions
[ 0.649213] OF: Bad cell count for /palmbus@10000000/spi@b00/flash@0/partitions

Desired outcome: a much smaller warning message

Method: apply a patch to reduce the warning to a single line
https://github.com/plan44/plan44-feed/blob/main/p44b-onion/p44build/global-patches/256-prevent-trace-for-broken-flash-reset.diff

Alternatives Considered

N/A

Additional Resources

See @plan44's solution here: https://github.com/plan44/plan44-feed/blob/main/p44b-onion/p44build/global-patches/256-prevent-trace-for-broken-flash-reset.diff
More context here: OnionIoT/OpenWRT-Packages#62 (comment)

Deliverables

  • New patch and changes as needed to the openwrt-23.05 branch of the OnionIoT/openwrt-buildsystem-wrapper repo
  • Screenshots/command line output demonstrating reduced SPI warning in kernel log
@greenbreakfast
Copy link
Contributor Author

greenbreakfast commented Jun 10, 2024

Patch applied in release: https://github.com/OnionIoT/openwrt-buildsystem-wrapper/releases/tag/23.05.3-20240609

Tested firmware (built with imagebuilder from this release) on device and not seeing broken reset warnings:
image

Fix added to Omega2 firmware in OnionIoT/OpenWRT-Packages release 23.05.3-20240610. All future firmware (23.05 and beyond) will include this fix.

Closing this issue. If anyone experiences different behaviour, feel free to reopen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

1 participant