From 085782144a0dbf323999e7e25825bdf089639be4 Mon Sep 17 00:00:00 2001 From: Greg Ungerer Date: Mon, 9 Dec 2024 22:23:32 +1000 Subject: [PATCH] m68k: example board defined UART table Example changes that allow a specific ColdFire board to define only the UART devices that it has available and not necessarily all the SoC actually has. Signed-off-by: Greg Ungerer --- arch/m68k/Kconfig.machine | 10 ++++++++++ arch/m68k/coldfire/Makefile | 1 + arch/m68k/coldfire/device.c | 8 ++++++++ arch/m68k/coldfire/jm_54418_board.c | 21 +++++++++++++++++++++ 4 files changed, 40 insertions(+) create mode 100644 arch/m68k/coldfire/jm_54418_board.c diff --git a/arch/m68k/Kconfig.machine b/arch/m68k/Kconfig.machine index de39f23b180e..536b511f6c31 100644 --- a/arch/m68k/Kconfig.machine +++ b/arch/m68k/Kconfig.machine @@ -322,6 +322,16 @@ config MOD5272 help Support for the Netburner MOD-5272 board. +config BOARD_HAS_DEFINED_UARTS + bool + +config JM_54418_BOARD + bool "JM's 54418 based board" + depends on M5441x + select BOARD_HAS_DEFINED_UARTS + help + Support for JM's 54418 based ColdFire platform. + if !MMU || COLDFIRE comment "Machine Options" diff --git a/arch/m68k/coldfire/Makefile b/arch/m68k/coldfire/Makefile index c56bc0dc7f2e..06b9a75a596d 100644 --- a/arch/m68k/coldfire/Makefile +++ b/arch/m68k/coldfire/Makefile @@ -41,6 +41,7 @@ obj-$(CONFIG_FIREBEE) += firebee.o obj-$(CONFIG_MCF8390) += mcf8390.o obj-$(CONFIG_AMCORE) += amcore.o obj-$(CONFIG_STMARK2) += stmark2.o +obj-$(CONFIG_JM_54418_BOARD) += jm_54418_board.o obj-$(CONFIG_PCI) += pci.o diff --git a/arch/m68k/coldfire/device.c b/arch/m68k/coldfire/device.c index b6958ec2a220..f8be795fa9ec 100644 --- a/arch/m68k/coldfire/device.c +++ b/arch/m68k/coldfire/device.c @@ -26,7 +26,14 @@ /* * All current ColdFire parts contain from 2, 3, 4 or 10 UARTS. + * This mapping will create all possible UARTs for a platform. + * Some boards only want to use a more limited set of UARTS, + * in that case the board should use BOARD_HAS_DEFINED_UARTS and + * define their own UART platform data in board specific code. */ +#ifdef BOARD_HAS_DEFINED_UARTS +extern struct mcf_platform_uart mcf_uart_platform_data[]; +#else static struct mcf_platform_uart mcf_uart_platform_data[] = { { .mapbase = MCFUART_BASE0, @@ -86,6 +93,7 @@ static struct mcf_platform_uart mcf_uart_platform_data[] = { #endif { }, }; +#endif /* HAS_BOARD_DEFINED_UARTS */ static struct platform_device mcf_uart = { .name = "mcfuart", diff --git a/arch/m68k/coldfire/jm_54418_board.c b/arch/m68k/coldfire/jm_54418_board.c new file mode 100644 index 000000000000..6a9d03c03f76 --- /dev/null +++ b/arch/m68k/coldfire/jm_54418_board.c @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: GPL-2.0 + +#include +#include +#include +#include +#include +#include + +static struct mcf_platform_uart mcf_uart_platform_data[] = { + { + .mapbase = MCFUART_BASE2, + .irq = MCF_IRQ_UART2, + }, + { + .mapbase = MCFUART_BASE6, + .irq = MCF_IRQ_UART6, + }, + { }, +}; + -- 2.25.1