serial: cpm_uart: Refactor cpm_uart_[un]map_pram()
authorChristophe Leroy <christophe.leroy@csgroup.eu>
Thu, 3 Aug 2023 13:56:49 +0000 (15:56 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 4 Aug 2023 13:08:30 +0000 (15:08 +0200)
commit8d1bd031ba152115461b3326eb3bdf7ca1f9bb3d
tree28ee175b98df4b60d5e9eb7b39c61e1e4d3922de
parent86f0a9c8e3de2341e5d1150a3d0dfae72de38a4a
serial: cpm_uart: Refactor cpm_uart_[un]map_pram()

cpm_uart_map_pram() and cpm_uart_unmap_pram() are very
similar for CPM1 and CPM2.

On CPM1 cpm_uart_map_pram() uses of_iomap() while CPM2 uses
of_address_to_resource()/ioremap(). CPM2 version will also
work on CPM1.

On CPM2 cpm_uart_map_pram() and cpm_uart_unmap_pram() has a special
handling for SMC. Just gate it by an IS_ENABLED(CONFIG_CPM2).

So move the CPM2 version into cpm_uart_core.c which is the only
user of those two fonctions and refactor to also handle CPM1 as
mentionned above.

PROFF_SMC_SIZE is only defined for SMC2 and used only there. To make
it simple, just use the numerical value 64, this is the only place
it is used and anyway there's already the same numerical value for
the alignment.

Use cpm_muram_alloc() instead of cpm_dpalloc() macro.

Then cpm_uart_cpm1.c and cpm_uart_cpm2.c are now empty and go away.

Replace printk(KERN_WARN by pr_warn( to make checkpatch happier.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Link: https://lore.kernel.org/r/44a266106c421319aa8e700c2db52d5dcd652c0f.1691068700.git.christophe.leroy@csgroup.eu
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/cpm_uart/Makefile
drivers/tty/serial/cpm_uart/cpm_uart.h
drivers/tty/serial/cpm_uart/cpm_uart_core.c
drivers/tty/serial/cpm_uart/cpm_uart_cpm1.c [deleted file]
drivers/tty/serial/cpm_uart/cpm_uart_cpm2.c [deleted file]