]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
sh: dma: Fix DMA channel offset calculation
authorArtur Rojek <contact@artur-rojek.eu>
Sat, 27 May 2023 16:44:50 +0000 (18:44 +0200)
committerRoxana Nicolescu <roxana.nicolescu@canonical.com>
Mon, 2 Oct 2023 15:20:02 +0000 (17:20 +0200)
commit9170828b0af210183e6649f43346cef372139d23
tree0332e319ebc08e656ea5404c7a4b973e6b6360ca
parentb871dc5aa91acf3e24ac3a4e850a0ad27bf4d361
sh: dma: Fix DMA channel offset calculation

BugLink: https://bugs.launchpad.net/bugs/2034469
[ Upstream commit e82e47584847129a20b8c9f4a1dcde09374fb0e0 ]

Various SoCs of the SH3, SH4 and SH4A family, which use this driver,
feature a differing number of DMA channels, which can be distributed
between up to two DMAC modules. The existing implementation fails to
correctly accommodate for all those variations, resulting in wrong
channel offset calculations and leading to kernel panics.

Rewrite dma_base_addr() in order to properly calculate channel offsets
in a DMAC module. Fix dmaor_read_reg() and dmaor_write_reg(), so that
the correct DMAC module base is selected for the DMAOR register.

Fixes: 7f47c7189b3e8f19 ("sh: dma: More legacy cpu dma chainsawing.")
Signed-off-by: Artur Rojek <contact@artur-rojek.eu>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Link: https://lore.kernel.org/r/20230527164452.64797-2-contact@artur-rojek.eu
Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
arch/sh/drivers/dma/dma-sh.c