Jump to content

[Armbian build PR] - i2c: mv64xxx: Atomic i2c for 5.15 kernel


Recommended Posts

Posted

Description

This is needed for any PMIC driver. All i2c transfers on pm_power_off must be atomic.

Otherwise we have something like that:

[ 4309.560651] reboot: Power down
[ 4309.563779] ------------[ cut here ]------------
[ 4309.568399] WARNING: CPU: 0 PID: 1 at drivers/i2c/i2c-core.h:41 i2c_smbus_xfer+0xa3/0xa8
[ 4309.576502] No atomic I2C transfer handler for 'i2c-0'
[ 4309.581637] Modules linked in: stm32f0_pmic(OE) xt_connmark nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 xt_mark nft_counter xt_comment xt_addrtype nft_compat nf_tables nfnetlink wireguard curve25519_neon libchacha20poly1305 chacha_neon poly1305_arm libcurve25519_generic ip6_udp_tunnel udp_tunnel sunrpc lz4hc lz4 8189fs cfg80211 sun4i_gpadc_iio industrialio sun8i_a33_mbus sun8i_thermal rfkill binfmt_misc cpufreq_dt evdev zram uio_pdrv_genirq uio ip_tables x_tables autofs4 spidev pwm_sun4i gpio_keys display_connector sr9700 dm9601 usbnet
[ 4309.629084] CPU: 0 PID: 1 Comm: systemd-shutdow Tainted: G           OE     5.15.86-sunxi #trunk
[ 4309.637868] Hardware name: Allwinner sun8i Family
[ 4309.642576] [<c010cd21>] (unwind_backtrace) from [<c01095fd>] (show_stack+0x11/0x14)
[ 4309.650330] [<c01095fd>] (show_stack) from [<c09e3145>] (dump_stack_lvl+0x2b/0x34)
[ 4309.657911] [<c09e3145>] (dump_stack_lvl) from [<c011c439>] (__warn+0xad/0xc0)
[ 4309.665143] [<c011c439>] (__warn) from [<c09dcdf3>] (warn_slowpath_fmt+0x5f/0x7c)
[ 4309.672632] [<c09dcdf3>] (warn_slowpath_fmt) from [<c07aae33>] (i2c_smbus_xfer+0xa3/0xa8)
[ 4309.680814] [<c07aae33>] (i2c_smbus_xfer) from [<c07ab1f3>] (i2c_smbus_write_i2c_block_data+0x4b/0x5c)
[ 4309.690123] [<c07ab1f3>] (i2c_smbus_write_i2c_block_data) from [<bfb04593>] (stm32f0_pmic_do_poweroff+0x57/0xd0 [stm32f0_pmic])
[ 4309.701628] [<bfb04593>] (stm32f0_pmic_do_poweroff [stm32f0_pmic]) from [<c0138fad>] (__do_sys_reboot+0xf5/0x16c)
[ 4309.711899] [<c0138fad>] (__do_sys_reboot) from [<c0100061>] (ret_fast_syscall+0x1/0x52)
[ 4309.719994] Exception stack(0xc1551fa8 to 0xc1551ff0)
[ 4309.725047] 1fa0:                   00000000 00000000 fee1dead 28121969 4321fedc 00000000
[ 4309.733223] 1fc0: 00000000 00000000 00000003 00000058 becb5d44 00000000 becb5a9c 4321fedc
[ 4309.741397] 1fe0: 00000058 becb59ec b6b9ea65 b6b0e616
[ 4309.746446] ---[ end trace cfd14d1670af0e52 ]---
[ 4311.614659] i2c i2c-0: mv64xxx: I2C bus locked, block: 1, time_left: 0
[ 4313.950732] i2c i2c-0: mv64xxx: I2C bus locked, block: 1, time_left: 0
[ 4316.286809] i2c i2c-0: mv64xxx: I2C bus locked, block: 1, time_left: 0
[ 4318.622887] i2c i2c-0: mv64xxx: I2C bus locked, block: 1, time_left: 0
[ 4320.958965] i2c i2c-0: mv64xxx: I2C bus locked, block: 1, time_left: 0

I copied this commits from mainline kernel:

How Has This Been Tested?

To see this bug just poweroff on any board with PMIC and mv64xxx i2c controller. After this fix now works fine.

Checklist:

  • [x] My code follows the style guidelines of this project
  • [x] I have performed a self-review of my own code
  • [x] I have commented my code, particularly in hard-to-understand areas
  • [ ] I have made corresponding changes to the documentation
  • [x] My changes generate no new warnings
  • [x] Any dependent changes have been merged and published in downstream modules

View the full article

<
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines