From 56f393a8ac185e24c6799a0979235166eb912956 Mon Sep 17 00:00:00 2001 From: John Klug Date: Thu, 15 Oct 2020 15:39:08 -0500 Subject: atmel-mci patch for Linux --- .../linux-4.9-atmel-mci-end.patch | 56 ++++++++++++++++++++++ recipes-kernel/linux/linux-at91_4.9.87.bb | 1 + 2 files changed, 57 insertions(+) create mode 100644 recipes-kernel/linux/linux-at91-4.9.87/linux-4.9-atmel-mci-end.patch diff --git a/recipes-kernel/linux/linux-at91-4.9.87/linux-4.9-atmel-mci-end.patch b/recipes-kernel/linux/linux-at91-4.9.87/linux-4.9-atmel-mci-end.patch new file mode 100644 index 0000000..f775066 --- /dev/null +++ b/recipes-kernel/linux/linux-at91-4.9.87/linux-4.9-atmel-mci-end.patch @@ -0,0 +1,56 @@ +Upstream commit ae460c115b7aa50c9a36cf78fced07b27962c9d0 ] + +On our AT91SAM9260 board we use the same sdio bus for wifi and for the +sd card slot. This caused the atmel-mci to give the following splat on +the serial console: + + ------------[ cut here ]------------ + WARNING: CPU: 0 PID: 538 at drivers/mmc/host/atmel-mci.c:859 atmci_send_command+0x24/0x44 + Modules linked in: + CPU: 0 PID: 538 Comm: mmcqd/0 Not tainted 4.14.76 #14 + Hardware name: Atmel AT91SAM9 + [] (unwind_backtrace) from [] (show_stack+0x10/0x14) + [] (show_stack) from [] (__warn+0xd8/0xf4) + [] (__warn) from [] (warn_slowpath_null+0x1c/0x24) + [] (warn_slowpath_null) from [] (atmci_send_command+0x24/0x44) + [] (atmci_send_command) from [] (atmci_start_request+0x1f4/0x2dc) + [] (atmci_start_request) from [] (atmci_request+0xf0/0x164) + [] (atmci_request) from [] (mmc_start_request+0x280/0x2d0) + [] (mmc_start_request) from [] (mmc_start_areq+0x230/0x330) + [] (mmc_start_areq) from [] (mmc_blk_issue_rw_rq+0xc4/0x310) + [] (mmc_blk_issue_rw_rq) from [] (mmc_blk_issue_rq+0x118/0x5ac) + [] (mmc_blk_issue_rq) from [] (mmc_queue_thread+0xc4/0x118) + [] (mmc_queue_thread) from [] (kthread+0x100/0x118) + [] (kthread) from [] (ret_from_fork+0x14/0x34) + ---[ end trace 594371ddfa284bd6 ]--- + +This is: + WARN_ON(host->cmd); + +This was fixed on our board by letting atmci_request_end determine what +state we are in. Instead of unconditionally setting it to STATE_IDLE on +STATE_END_REQUEST. + +Signed-off-by: Jonas Danielsson +Signed-off-by: Ulf Hansson +Signed-off-by: Sasha Levin d +============================================================================== +diff -Naru orig/drivers/mmc/host/atmel-mci.c new/drivers/mmc/host/atmel-mci.c +--- orig/drivers/mmc/host/atmel-mci.c 2020-09-30 11:23:25.946826212 -0500 ++++ new/drivers/mmc/host/atmel-mci.c 2020-09-30 11:22:37.358827650 -0500 +@@ -1984,13 +1984,14 @@ + } + + atmci_request_end(host, host->mrq); +- state = STATE_IDLE; ++ goto unlock; /* atmci_request_end() sets host->state */ + break; + } + } while (state != prev_state); + + host->state = state; + ++unlock: + spin_unlock(&host->lock); + } + diff --git a/recipes-kernel/linux/linux-at91_4.9.87.bb b/recipes-kernel/linux/linux-at91_4.9.87.bb index 62fb94b..c4ae06b 100644 --- a/recipes-kernel/linux/linux-at91_4.9.87.bb +++ b/recipes-kernel/linux/linux-at91_4.9.87.bb @@ -50,6 +50,7 @@ COMMON_PATCHES = " \ file://0001-linux-4.9-quectel_qmi_wwan_support.patch \ file://0002-linux-4.9-telit_print_qmi_wwan.patch \ file://make-kernel-reproducible.patch \ + file://linux-4.9-atmel-mci-end.patch \ file://i2c-at91.conf \ " -- cgit v1.2.3