Modify

Opened 2 years ago

Last modified 2 years ago

#20521 reopened defect

spi transfer error on mt7628 using SPI_CS1

Reported by: summer Owned by: developers
Priority: high Milestone: Chaos Calmer 15.05
Component: kernel Version: Trunk
Keywords: mt7628 spi_cs1 Cc:

Description

we use SPI_CS1 on my device, and do some change in the source

in file drivers/spi/spi-mt7621.c

we change

master->num_chipselect = 1;

to

master->num_chipselect = 2;

and add spidev to my DTS,

by using the command, it show:

root@OpenWrt:/# spidev_test -D /dev/spidev32766.1
spi mode: 0x0[ 196.130000] ------------[ cut here ]------------

bits per word:[ 196.130000] WARNING: CPU: 0 PID: 161 at drivers/spi/spi-mt7621.c:137 mt7621_spi_transfer_one_message+0x158/0x360()

8

max speed: 5[ 196.140000] Modules linked in:00000 Hz (500 KH qcserialz)

pppoe ppp_async option iptable_nat usb_wwan sierra pppox ppp_generic nf_nat_ipv4 nf_conntrack_ipv6 nf_conntrack_ipv4 ipt_REJECT ipt_MASQUERADE xt_time xt_tcpudp xt_state xt_nat xt_multiport xt_mark xt_mac xt_limit xt_id xt_conntrack xt_comment xt_TCPMSS xt_REDIRECT xt_LOG xt_CT usbserial spidev slhc nf_reject_ipv4 nf_nat_masquerade_ipv4 nf_nat_ftp nf_nat nf_log_ipv4 nf_defrag_ipv6 nf_defrag_ipv4 nf_conntrack_rtcache nf_conntrack_ftp nf_conntrack iptable_raw iptable_mangle iptable_filter ip_tables crc_ccitt i2c_gpio i2c_algo_bit i2c_dev i2c_core mt76x8 ralink_eeprom_api ledtrig_usbdev ip6t_REJECT nf_reject_ipv6 nf_log_ipv6 nf_log_common ip6table_raw ip6table_mangle ip6table_filter ip6_tables x_tables ipv6 mmc_block mmc_core leds_gpio ohci_platform ohci_hcd ehci_platform ehci_hcd gpio_button_hotplug usbcore nls_base usb_common

[ 196.220000] CPU: 0 PID: 161 Comm: spi32766 Tainted: G W 3.18.20 #8
[ 196.230000] Stack : 00000000 00000000 00000000 00000000 803441f2 00000042 00000000 801ae398

00000001 8f8c7b88 802a53d0 802fc9c3 000000a1 8034341c 8f900bf8 8f8c7b88
00010000 80309578 00000000 80047400 00000003 80024170 00000089 8f8c7b88
802a88d4 8f979d74 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
...

[ 196.270000] Call Trace:
[ 196.270000] [<800140b4>] show_stack+0x48/0x70
[ 196.270000] [<800242ec>] warn_slowpath_common+0x84/0xb4
[ 196.280000] [<800243a4>] warn_slowpath_null+0x18/0x24
[ 196.290000] [<801ae398>] mt7621_spi_transfer_one_message+0x158/0x360
[ 196.290000] [<801ad4e8>] spi_pump_messages+0x3cc/0x438
[ 196.300000] [<80039b9c>] kthread_worker_fn+0xa8/0xf4
[ 196.300000] [<80039cc0>] kthread+0xd8/0xe4
[ 196.310000] [<80004878>] ret_from_kernel_thread+0x14/0x1c
[ 196.310000]
[ 196.310000] ---[ end trace 828b306131dd7246 ]---
can't send spi message: Input/output error
Aborted

can you help me to solve this problem? thanks

Attachments (2)

WRTNODE2R.dts (1.7 KB) - added by summer 2 years ago.
this is my dts file
spi-mt7621.c (6.9 KB) - added by summer 2 years ago.

Download all attachments as: .zip

Change History (6)

Changed 2 years ago by summer

this is my dts file

Changed 2 years ago by summer

comment:1 Changed 2 years ago by blogic

  • Resolution set to fixed
  • Status changed from new to closed

i just pushed a patch that fixes the issue. i will push a second one during the day that makes cs1 use full duplex rather than half duplex

comment:2 Changed 2 years ago by summer

the spi problem haven't fixed , i use the newest version of trunk and test it using spidev-test -D /dev/spidev32766.1 ,the CS1 not work, and the kernel show this WARNING

[72912.130000] ------------[ cut here ]------------
[72912.130000] WARNING: CPU: 0 PID: 162 at drivers/spi/spi-mt7621.c:290 mt7621_spi_transfer_one_message+0x268/0x614()
[72912.140000] Modules linked in: pppoe ppp_async iptable_nat pppox ppp_generic nf_nat_ipv4 nf_conntrack_ipv6 nf_conntrack_ipv4 ipt_REJECT ipt_MASQUERADE xt_time xt_tcpudp xt_state xt_nat xt_multiport xt_mark xt_mac xt_limit xt_id xt_conntrack xt_comment xt_TCPMSS xt_REDIRECT xt_LOG xt_CT spidev slhc nf_reject_ipv4 nf_nat_masquerade_ipv4 nf_nat_ftp nf_nat nf_log_ipv4 nf_defrag_ipv6 nf_defrag_ipv4 nf_conntrack_rtcache nf_conntrack_ftp nf_conntrack iptable_raw iptable_mangle iptable_filter ip_tables crc_ccitt mt76x8 ralink_eeprom_api ledtrig_usbdev ip6t_REJECT nf_reject_ipv6 nf_log_ipv6 nf_log_common ip6table_raw ip6table_mangle ip6table_filter ip6_tables x_tables vfat fat autofs4 ipv6 usb_storage leds_gpio ohci_platform ohci_hcd ehci_platform ehci_hcd sd_mod scsi_mod gpio_button_hotplug ext4 jbd2 mbcache usbcore nls_base usb_common crc16 crypto_hash
[72912.220000] CPU: 0 PID: 162 Comm: spi32766 Tainted: G W 3.18.20 #5
[72912.230000] Stack : 00000000 00000000 00000000 00000000 803441f2 00000042 00000000 801ae540
[72912.230000] 00000001 0007a120 802a63f8 802fe9c3 000000a2 8034341c 8f900720 0007a120
[72912.230000] 00000026 00010000 00000000 80047408 00000003 80024178 00000122 0007a120
[72912.230000] 802a98fc 8f979d74 00000000 00000000 00000000 00000000 00000000 00000000
[72912.230000] 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[72912.230000] ...
[72912.260000] Call Trace:
[72912.260000] [<800140b4>] show_stack+0x48/0x70
[72912.270000] [<800242f4>] warn_slowpath_common+0x84/0xb4
[72912.270000] [<800243ac>] warn_slowpath_null+0x18/0x24
[72912.280000] [<801ae540>] mt7621_spi_transfer_one_message+0x268/0x614
[72912.290000] [<801ad3a4>] spi_pump_messages+0x3cc/0x438
[72912.290000] [<80039ba4>] kthread_worker_fn+0xa8/0xf4
[72912.300000] [<80039cc8>] kthread+0xd8/0xe4
[72912.300000] [<80004878>] ret_from_kernel_thread+0x14/0x1c
[72912.310000]
[72912.310000] ---[ end trace 38d485dbb2e61c46 ]---

comment:3 Changed 2 years ago by anonymous

  • Resolution fixed deleted
  • Status changed from closed to reopened

comment:4 Changed 2 years ago by dogratian

The spidev_test is transmitting a 38 bytes array, that is too large. The spi-mt7621.c will reject when Tx length > 16 (full duplex).

Add Comment

Modify Ticket

Action
as reopened .
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.