]> git.baikalelectronics.ru Git - kernel.git/commit
mailbox: sprd: Introduce refcnt when clients requests/free channels
authorOrson Zhai <orson.zhai@unisoc.com>
Fri, 19 Mar 2021 06:15:35 +0000 (14:15 +0800)
committerJassi Brar <jaswinder.singh@linaro.org>
Wed, 14 Apr 2021 01:07:36 +0000 (20:07 -0500)
commitc996f460c115051c27e3a2636d349fb7216a3c9b
treef0eef478843d37166e380b32c061c0904f6aea86
parent48d83c82bc9c6c84d07be162a35ee82145daff32
mailbox: sprd: Introduce refcnt when clients requests/free channels

Unisoc mailbox has no way to be enabled/disabled for any single channel.
They can only be set to startup or shutdown as a whole device at same time.

Add a variable to count references to avoid mailbox FIFO being reset
unexpectedly when clients are requesting or freeing channels.

Also add a lock to dismiss possible conflicts from register r/w in
different startup or shutdown threads. And fix the crash problem when early
interrupts come from channel which has not been requested by client yet.

Fixes: a9a5685ab086 ("mailbox: sprd: Add Spreadtrum mailbox driver")
Signed-off-by: Orson Zhai <orson.zhai@unisoc.com>
Reviewed-by: Baolin Wang <baolin.wang7@gmail.com>
Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
drivers/mailbox/sprd-mailbox.c