* [PATCH 01/13] serial: mcf: convert to use proper platform resources
2025-02-18 12:46 [PATCH 00/13] m68k: coldfire: proof-of-concept devicetree Greg Ungerer
@ 2025-02-18 12:46 ` Greg Ungerer
2025-02-18 12:46 ` [PATCH 02/13] serial: mcf: add devicetree support Greg Ungerer
` (11 subsequent siblings)
12 siblings, 0 replies; 22+ messages in thread
From: Greg Ungerer @ 2025-02-18 12:46 UTC (permalink / raw)
To: linux-m68k; +Cc: Greg Ungerer
The ColdFire SoC device setup code supplies a non-standard array of
hardware address information (memory address and IRQ) for initializing
the UARTS - which it does as a single blob. The mcf serial probe
function processes the whole set in one go from a single platform entry.
Convert this setup to use the proper resource structures, with one for
each UART present on a platform. Modify the probe function to process
a single platform device per call, and use the proper platform resource
API to get the memory and IRQ addresses. This results in the proper
entries now being present in /proc/iomem.
Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
---
arch/m68k/coldfire/device.c | 221 +++++++++++++++++++++++++++-----
arch/m68k/include/asm/mcfuart.h | 12 +-
drivers/tty/serial/mcf.c | 49 +++----
3 files changed, 218 insertions(+), 64 deletions(-)
diff --git a/arch/m68k/coldfire/device.c b/arch/m68k/coldfire/device.c
index b6958ec2a220..8d7cec28f4d9 100644
--- a/arch/m68k/coldfire/device.c
+++ b/arch/m68k/coldfire/device.c
@@ -1,7 +1,7 @@
/*
* device.c -- common ColdFire SoC device support
*
- * (C) Copyright 2011, Greg Ungerer <gerg@uclinux.org>
+ * (C) Copyright 2011,2025 Greg Ungerer <gerg@linux-m68k.org>
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file COPYING in the main directory of this archive
@@ -18,8 +18,8 @@
#include <asm/traps.h>
#include <asm/coldfire.h>
#include <asm/mcfsim.h>
-#include <asm/mcfuart.h>
#include <asm/mcfqspi.h>
+#include <linux/platform_device.h>
#include <linux/platform_data/edma.h>
#include <linux/platform_data/dma-mcf-edma.h>
#include <linux/platform_data/mmc-esdhc-mcf.h>
@@ -27,71 +27,205 @@
/*
* All current ColdFire parts contain from 2, 3, 4 or 10 UARTS.
*/
-static struct mcf_platform_uart mcf_uart_platform_data[] = {
+static struct resource mcf_uart0_resources[] = {
{
- .mapbase = MCFUART_BASE0,
- .irq = MCF_IRQ_UART0,
+ .start = MCFUART_BASE0,
+ .end = MCFUART_BASE0 + 0x80 - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .start = MCF_IRQ_UART0,
+ .end = MCF_IRQ_UART0,
+ .flags = IORESOURCE_IRQ,
},
+};
+static struct platform_device mcf_uart0 = {
+ .name = "mcfuart",
+ .id = 0,
+ .num_resources = ARRAY_SIZE(mcf_uart0_resources),
+ .resource = mcf_uart0_resources,
+};
+
+#ifdef MCFUART_BASE1
+static struct resource mcf_uart1_resources[] = {
{
- .mapbase = MCFUART_BASE1,
- .irq = MCF_IRQ_UART1,
+ .start = MCFUART_BASE1,
+ .end = MCFUART_BASE1 + 0x80 - 1,
+ .flags = IORESOURCE_MEM,
},
+ {
+ .start = MCF_IRQ_UART1,
+ .end = MCF_IRQ_UART1,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+static struct platform_device mcf_uart1 = {
+ .name = "mcfuart",
+ .id = 1,
+ .num_resources = ARRAY_SIZE(mcf_uart1_resources),
+ .resource = mcf_uart1_resources,
+};
+#endif
#ifdef MCFUART_BASE2
+static struct resource mcf_uart2_resources[] = {
{
- .mapbase = MCFUART_BASE2,
- .irq = MCF_IRQ_UART2,
+ .start = MCFUART_BASE2,
+ .end = MCFUART_BASE2 + 0x80 - 1,
+ .flags = IORESOURCE_MEM,
},
+ {
+ .start = MCF_IRQ_UART2,
+ .end = MCF_IRQ_UART2,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+static struct platform_device mcf_uart2 = {
+ .name = "mcfuart",
+ .id = 2,
+ .num_resources = ARRAY_SIZE(mcf_uart2_resources),
+ .resource = mcf_uart2_resources,
+};
#endif
#ifdef MCFUART_BASE3
+static struct resource mcf_uart3_resources[] = {
+ {
+ .start = MCFUART_BASE3,
+ .end = MCFUART_BASE3 + 0x80 - 1,
+ .flags = IORESOURCE_MEM,
+ },
{
- .mapbase = MCFUART_BASE3,
- .irq = MCF_IRQ_UART3,
+ .start = MCF_IRQ_UART3,
+ .end = MCF_IRQ_UART3,
+ .flags = IORESOURCE_IRQ,
},
+};
+static struct platform_device mcf_uart3 = {
+ .name = "mcfuart",
+ .id = 3,
+ .num_resources = ARRAY_SIZE(mcf_uart3_resources),
+ .resource = mcf_uart3_resources,
+};
#endif
#ifdef MCFUART_BASE4
+static struct resource mcf_uart4_resources[] = {
{
- .mapbase = MCFUART_BASE4,
- .irq = MCF_IRQ_UART4,
+ .start = MCFUART_BASE4,
+ .end = MCFUART_BASE4 + 0x80 - 1,
+ .flags = IORESOURCE_MEM,
},
+ {
+ .start = MCF_IRQ_UART4,
+ .end = MCF_IRQ_UART4,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+static struct platform_device mcf_uart4 = {
+ .name = "mcfuart",
+ .id = 4,
+ .num_resources = ARRAY_SIZE(mcf_uart4_resources),
+ .resource = mcf_uart4_resources,
+};
#endif
#ifdef MCFUART_BASE5
+static struct resource mcf_uart5_resources[] = {
{
- .mapbase = MCFUART_BASE5,
- .irq = MCF_IRQ_UART5,
+ .start = MCFUART_BASE5,
+ .end = MCFUART_BASE5 + 0x80 - 1,
+ .flags = IORESOURCE_MEM,
},
+ {
+ .start = MCF_IRQ_UART5,
+ .end = MCF_IRQ_UART5,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+static struct platform_device mcf_uart5 = {
+ .name = "mcfuart",
+ .id = 5,
+ .num_resources = ARRAY_SIZE(mcf_uart5_resources),
+ .resource = mcf_uart5_resources,
+};
#endif
#ifdef MCFUART_BASE6
+static struct resource mcf_uart6_resources[] = {
{
- .mapbase = MCFUART_BASE6,
- .irq = MCF_IRQ_UART6,
+ .start = MCFUART_BASE6,
+ .end = MCFUART_BASE6 + 0x80 - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .start = MCF_IRQ_UART6,
+ .end = MCF_IRQ_UART6,
+ .flags = IORESOURCE_IRQ,
},
+};
+static struct platform_device mcf_uart6 = {
+ .name = "mcfuart",
+ .id = 6,
+ .num_resources = ARRAY_SIZE(mcf_uart6_resources),
+ .resource = mcf_uart6_resources,
+};
#endif
#ifdef MCFUART_BASE7
+static struct resource mcf_uart7_resources[] = {
+ {
+ .start = MCFUART_BASE7,
+ .end = MCFUART_BASE7 + 0x80 - 1,
+ .flags = IORESOURCE_MEM,
+ },
{
- .mapbase = MCFUART_BASE7,
- .irq = MCF_IRQ_UART7,
+ .start = MCF_IRQ_UART7,
+ .end = MCF_IRQ_UART7,
+ .flags = IORESOURCE_IRQ,
},
+};
+static struct platform_device mcf_uart7 = {
+ .name = "mcfuart",
+ .id = 7,
+ .num_resources = ARRAY_SIZE(mcf_uart7_resources),
+ .resource = mcf_uart7_resources,
+};
#endif
#ifdef MCFUART_BASE8
+static struct resource mcf_uart8_resources[] = {
+ {
+ .start = MCFUART_BASE8,
+ .end = MCFUART_BASE8 + 0x80 - 1,
+ .flags = IORESOURCE_MEM,
+ },
{
- .mapbase = MCFUART_BASE8,
- .irq = MCF_IRQ_UART8,
+ .start = MCF_IRQ_UART8,
+ .end = MCF_IRQ_UART8,
+ .flags = IORESOURCE_IRQ,
},
+};
+static struct platform_device mcf_uart8 = {
+ .name = "mcfuart",
+ .id = 8,
+ .num_resources = ARRAY_SIZE(mcf_uart8_resources),
+ .resource = mcf_uart8_resources,
+};
#endif
#ifdef MCFUART_BASE9
+static struct resource mcf_uart9_resources[] = {
{
- .mapbase = MCFUART_BASE9,
- .irq = MCF_IRQ_UART9,
+ .start = MCFUART_BASE9,
+ .end = MCFUART_BASE9 + 0x80 - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .start = MCF_IRQ_UART9,
+ .end = MCF_IRQ_UART9,
+ .flags = IORESOURCE_IRQ,
},
-#endif
- { },
};
-
-static struct platform_device mcf_uart = {
+static struct platform_device mcf_uart9 = {
.name = "mcfuart",
- .id = 0,
- .dev.platform_data = mcf_uart_platform_data,
+ .id = 9,
+ .num_resources = ARRAY_SIZE(mcf_uart9_resources),
+ .resource = mcf_uart9_resources,
};
+#endif
#ifdef MCFFEC_BASE0
@@ -623,7 +757,34 @@ static struct platform_device mcf_flexcan0 = {
#endif /* MCFFLEXCAN_SIZE */
static struct platform_device *mcf_devices[] __initdata = {
- &mcf_uart,
+ &mcf_uart0,
+#ifdef MCFUART_BASE1
+ &mcf_uart1,
+#endif
+#ifdef MCFUART_BASE2
+ &mcf_uart2,
+#endif
+#ifdef MCFUART_BASE3
+ &mcf_uart3,
+#endif
+#ifdef MCFUART_BASE4
+ &mcf_uart4,
+#endif
+#ifdef MCFUART_BASE5
+ &mcf_uart5,
+#endif
+#ifdef MCFUART_BASE6
+ &mcf_uart6,
+#endif
+#ifdef MCFUART_BASE7
+ &mcf_uart7,
+#endif
+#ifdef MCFUART_BASE8
+ &mcf_uart8,
+#endif
+#ifdef MCFUART_BASE9
+ &mcf_uart9,
+#endif
#ifdef MCFFEC_BASE0
&mcf_fec0,
#endif
diff --git a/arch/m68k/include/asm/mcfuart.h b/arch/m68k/include/asm/mcfuart.h
index a1f35352f328..8bf626af3817 100644
--- a/arch/m68k/include/asm/mcfuart.h
+++ b/arch/m68k/include/asm/mcfuart.h
@@ -4,7 +4,7 @@
/*
* mcfuart.h -- ColdFire internal UART support defines.
*
- * (C) Copyright 1999-2003, Greg Ungerer (gerg@snapgear.com)
+ * (C) Copyright 1999-2003, 2025 Greg Ungerer (gerg@linux-m68k.org)
* (C) Copyright 2000, Lineo Inc. (www.lineo.com)
*/
@@ -13,16 +13,6 @@
#define mcfuart_h
/****************************************************************************/
-#include <linux/serial_core.h>
-#include <linux/platform_device.h>
-
-struct mcf_platform_uart {
- unsigned long mapbase; /* Physical address base */
- void __iomem *membase; /* Virtual address if mapped */
- unsigned int irq; /* Interrupt vector */
- unsigned int uartclk; /* UART clock rate */
-};
-
/*
* Define the ColdFire UART register set addresses.
*/
diff --git a/drivers/tty/serial/mcf.c b/drivers/tty/serial/mcf.c
index 93e7dda4d39a..fd8cf3399855 100644
--- a/drivers/tty/serial/mcf.c
+++ b/drivers/tty/serial/mcf.c
@@ -4,7 +4,7 @@
/*
* mcf.c -- Freescale ColdFire UART driver
*
- * (C) Copyright 2003-2007, Greg Ungerer <gerg@uclinux.org>
+ * (C) Copyright 2003-2007,2025 Greg Ungerer <gerg@linux-m68k.org>
*/
/****************************************************************************/
@@ -570,31 +570,34 @@ static struct uart_driver mcf_driver = {
static int mcf_probe(struct platform_device *pdev)
{
- struct mcf_platform_uart *platp = dev_get_platdata(&pdev->dev);
struct uart_port *port;
- int i;
+ struct resource *res;
- for (i = 0; ((i < MCF_MAXPORTS) && (platp[i].mapbase)); i++) {
- port = &mcf_ports[i].port;
+ if (pdev->id >= MCF_MAXPORTS)
+ return -ENODEV;
+ port = &mcf_ports[pdev->id].port;
- port->line = i;
- port->type = PORT_MCF;
- port->mapbase = platp[i].mapbase;
- port->membase = (platp[i].membase) ? platp[i].membase :
- (unsigned char __iomem *) platp[i].mapbase;
- port->dev = &pdev->dev;
- port->iotype = SERIAL_IO_MEM;
- port->irq = platp[i].irq;
- port->uartclk = MCF_BUSCLK;
- port->ops = &mcf_uart_ops;
- port->flags = UPF_BOOT_AUTOCONF;
- port->rs485_config = mcf_config_rs485;
- port->rs485_supported = mcf_rs485_supported;
- port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_MCF_CONSOLE);
-
- uart_add_one_port(&mcf_driver, port);
- }
+ port->membase = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
+ if (IS_ERR(port->membase))
+ return PTR_ERR(port->membase);
+ port->mapbase = res->start;
+
+ port->irq = platform_get_irq(pdev, 0);
+ if (port->irq < 0)
+ return port->irq;
+ port->line = pdev->id;
+ port->type = PORT_MCF;
+ port->dev = &pdev->dev;
+ port->iotype = SERIAL_IO_MEM;
+ port->uartclk = MCF_BUSCLK;
+ port->ops = &mcf_uart_ops;
+ port->flags = UPF_BOOT_AUTOCONF;
+ port->rs485_config = mcf_config_rs485;
+ port->rs485_supported = mcf_rs485_supported;
+ port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_MCF_CONSOLE);
+
+ uart_add_one_port(&mcf_driver, port);
return 0;
}
@@ -654,7 +657,7 @@ static void __exit mcf_exit(void)
module_init(mcf_init);
module_exit(mcf_exit);
-MODULE_AUTHOR("Greg Ungerer <gerg@uclinux.org>");
+MODULE_AUTHOR("Greg Ungerer <gerg@linux-m68k.org>");
MODULE_DESCRIPTION("Freescale ColdFire UART driver");
MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:mcfuart");
--
2.43.0
^ permalink raw reply related [flat|nested] 22+ messages in thread* [PATCH 02/13] serial: mcf: add devicetree support
2025-02-18 12:46 [PATCH 00/13] m68k: coldfire: proof-of-concept devicetree Greg Ungerer
2025-02-18 12:46 ` [PATCH 01/13] serial: mcf: convert to use proper platform resources Greg Ungerer
@ 2025-02-18 12:46 ` Greg Ungerer
2025-02-18 12:46 ` [PATCH 03/13] net: fec: add device tree support for ColdFire FEC Greg Ungerer
` (10 subsequent siblings)
12 siblings, 0 replies; 22+ messages in thread
From: Greg Ungerer @ 2025-02-18 12:46 UTC (permalink / raw)
To: linux-m68k; +Cc: Greg Ungerer
Add basic support for probing the ColdFire UARTS via a devicetree.
Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
---
drivers/tty/serial/mcf.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/tty/serial/mcf.c b/drivers/tty/serial/mcf.c
index fd8cf3399855..d83f05d9e150 100644
--- a/drivers/tty/serial/mcf.c
+++ b/drivers/tty/serial/mcf.c
@@ -21,6 +21,7 @@
#include <linux/io.h>
#include <linux/uaccess.h>
#include <linux/platform_device.h>
+#include <linux/of.h>
#include <asm/coldfire.h>
#include <asm/mcfsim.h>
#include <asm/mcfuart.h>
@@ -463,6 +464,7 @@ static const struct uart_ops mcf_uart_ops = {
};
static struct mcf_uart mcf_ports[10];
+static int mcf_numports;
#define MCF_MAXPORTS ARRAY_SIZE(mcf_ports)
@@ -573,6 +575,8 @@ static int mcf_probe(struct platform_device *pdev)
struct uart_port *port;
struct resource *res;
+ if (pdev->id == -1)
+ pdev->id = mcf_numports;
if (pdev->id >= MCF_MAXPORTS)
return -ENODEV;
port = &mcf_ports[pdev->id].port;
@@ -598,6 +602,8 @@ static int mcf_probe(struct platform_device *pdev)
port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_MCF_CONSOLE);
uart_add_one_port(&mcf_driver, port);
+
+ mcf_numports++;
return 0;
}
@@ -617,11 +623,17 @@ static void mcf_remove(struct platform_device *pdev)
/****************************************************************************/
+static const struct of_device_id mcf_uart_dt_ids[] = {
+ { .compatible = "fsl,mcfuart", },
+ { }
+};
+
static struct platform_driver mcf_platform_driver = {
.probe = mcf_probe,
.remove = mcf_remove,
.driver = {
.name = "mcfuart",
+ .of_match_table = mcf_uart_dt_ids,
},
};
--
2.43.0
^ permalink raw reply related [flat|nested] 22+ messages in thread* [PATCH 03/13] net: fec: add device tree support for ColdFire FEC
2025-02-18 12:46 [PATCH 00/13] m68k: coldfire: proof-of-concept devicetree Greg Ungerer
2025-02-18 12:46 ` [PATCH 01/13] serial: mcf: convert to use proper platform resources Greg Ungerer
2025-02-18 12:46 ` [PATCH 02/13] serial: mcf: add devicetree support Greg Ungerer
@ 2025-02-18 12:46 ` Greg Ungerer
2025-02-19 7:05 ` Krzysztof Kozlowski
2025-02-18 12:46 ` [PATCH 04/13] m68k: coldfire: enable common clock framework Greg Ungerer
` (9 subsequent siblings)
12 siblings, 1 reply; 22+ messages in thread
From: Greg Ungerer @ 2025-02-18 12:46 UTC (permalink / raw)
To: linux-m68k; +Cc: Greg Ungerer
The FEC hardware module used in most Freescale ColdFire SoC parts is a
simpler version of that used on the iMX family of parts. Add a devicetree
compatible entry they can use.
Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
---
Documentation/devicetree/bindings/net/fsl,fec.yaml | 1 +
drivers/net/ethernet/freescale/fec_main.c | 5 +++++
2 files changed, 6 insertions(+)
diff --git a/Documentation/devicetree/bindings/net/fsl,fec.yaml b/Documentation/devicetree/bindings/net/fsl,fec.yaml
index 24e863fdbdab..33f73057903a 100644
--- a/Documentation/devicetree/bindings/net/fsl,fec.yaml
+++ b/Documentation/devicetree/bindings/net/fsl,fec.yaml
@@ -24,6 +24,7 @@ properties:
- fsl,imx6q-fec
- fsl,mvf600-fec
- fsl,s32v234-fec
+ - fsl,m5208-fec
- items:
- enum:
- fsl,imx53-fec
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index f7c4ce8e9a26..a0a13afe5b7c 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -179,6 +179,10 @@ static const struct fec_devinfo fec_s32v234_info = {
FEC_QUIRK_HAS_MDIO_C45,
};
+static const struct fec_devinfo fec_m5208_info = {
+ .quirks = FEC_QUIRK_MIB_CLEAR | FEC_QUIRK_HAS_FRREG,
+};
+
static struct platform_device_id fec_devtype[] = {
{
/* keep it for coldfire */
@@ -201,6 +205,7 @@ static const struct of_device_id fec_dt_ids[] = {
{ .compatible = "fsl,imx8mq-fec", .data = &fec_imx8mq_info, },
{ .compatible = "fsl,imx8qm-fec", .data = &fec_imx8qm_info, },
{ .compatible = "fsl,s32v234-fec", .data = &fec_s32v234_info, },
+ { .compatible = "fsl,m5208-fec", .data = &fec_m5208_info, },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(of, fec_dt_ids);
--
2.43.0
^ permalink raw reply related [flat|nested] 22+ messages in thread* Re: [PATCH 03/13] net: fec: add device tree support for ColdFire FEC
2025-02-18 12:46 ` [PATCH 03/13] net: fec: add device tree support for ColdFire FEC Greg Ungerer
@ 2025-02-19 7:05 ` Krzysztof Kozlowski
2025-02-19 13:25 ` Greg Ungerer
0 siblings, 1 reply; 22+ messages in thread
From: Krzysztof Kozlowski @ 2025-02-19 7:05 UTC (permalink / raw)
To: Greg Ungerer, linux-m68k
On 18/02/2025 13:46, Greg Ungerer wrote:
> The FEC hardware module used in most Freescale ColdFire SoC parts is a
> simpler version of that used on the iMX family of parts. Add a devicetree
> compatible entry they can use.
>
> Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
> ---
> Documentation/devicetree/bindings/net/fsl,fec.yaml | 1 +
Please run scripts/checkpatch.pl and fix reported warnings. After that,
run also `scripts/checkpatch.pl --strict` and (probably) fix more
warnings. Some warnings can be ignored, especially from --strict run,
but the code here looks like it needs a fix. Feel free to get in touch
if the warning is not clear.
<form letter>
Please use scripts/get_maintainers.pl to get a list of necessary people
and lists to CC. It might happen, that command when run on an older
kernel, gives you outdated entries. Therefore please be sure you base
your patches on recent Linux kernel.
Tools like b4 or scripts/get_maintainer.pl provide you proper list of
people, so fix your workflow. Tools might also fail if you work on some
ancient tree (don't, instead use mainline) or work on fork of kernel
(don't, instead use mainline). Just use b4 and everything should be
fine, although remember about `b4 prep --auto-to-cc` if you added new
patches to the patchset.
You missed at least devicetree list (maybe more), so this won't be
tested by automated tooling. Performing review on untested code might be
a waste of time.
Please kindly resend and include all necessary To/Cc entries.
</form letter>
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 03/13] net: fec: add device tree support for ColdFire FEC
2025-02-19 7:05 ` Krzysztof Kozlowski
@ 2025-02-19 13:25 ` Greg Ungerer
0 siblings, 0 replies; 22+ messages in thread
From: Greg Ungerer @ 2025-02-19 13:25 UTC (permalink / raw)
To: Krzysztof Kozlowski, linux-m68k
On 19/2/25 17:05, Krzysztof Kozlowski wrote:
> On 18/02/2025 13:46, Greg Ungerer wrote:
>> The FEC hardware module used in most Freescale ColdFire SoC parts is a
>> simpler version of that used on the iMX family of parts. Add a devicetree
>> compatible entry they can use.
>>
>> Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
>> ---
>> Documentation/devicetree/bindings/net/fsl,fec.yaml | 1 +
>
> Please run scripts/checkpatch.pl and fix reported warnings. After that,
> run also `scripts/checkpatch.pl --strict` and (probably) fix more
I did. I chose to ignore the documentation and frivolous formatting
warnings for now. See cover letter for reasoning.
Regards
Greg
> warnings. Some warnings can be ignored, especially from --strict run,
> but the code here looks like it needs a fix. Feel free to get in touch
> if the warning is not clear.
>
>
> <form letter>
> Please use scripts/get_maintainers.pl to get a list of necessary people
> and lists to CC. It might happen, that command when run on an older
> kernel, gives you outdated entries. Therefore please be sure you base
> your patches on recent Linux kernel.
>
> Tools like b4 or scripts/get_maintainer.pl provide you proper list of
> people, so fix your workflow. Tools might also fail if you work on some
> ancient tree (don't, instead use mainline) or work on fork of kernel
> (don't, instead use mainline). Just use b4 and everything should be
> fine, although remember about `b4 prep --auto-to-cc` if you added new
> patches to the patchset.
>
> You missed at least devicetree list (maybe more), so this won't be
> tested by automated tooling. Performing review on untested code might be
> a waste of time.
>
> Please kindly resend and include all necessary To/Cc entries.
> </form letter>
>
> Best regards,
> Krzysztof
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 04/13] m68k: coldfire: enable common clock framework
2025-02-18 12:46 [PATCH 00/13] m68k: coldfire: proof-of-concept devicetree Greg Ungerer
` (2 preceding siblings ...)
2025-02-18 12:46 ` [PATCH 03/13] net: fec: add device tree support for ColdFire FEC Greg Ungerer
@ 2025-02-18 12:46 ` Greg Ungerer
2025-02-18 12:46 ` [PATCH 05/13] m68k: coldfire: support devicetree binding for intc-simr Greg Ungerer
` (8 subsequent siblings)
12 siblings, 0 replies; 22+ messages in thread
From: Greg Ungerer @ 2025-02-18 12:46 UTC (permalink / raw)
To: linux-m68k; +Cc: Greg Ungerer
Enable the ColdFire clock driver code to use the common clock framework.
This is not an actual conversion of the code proper. It is a work around
to allow defining clock bindings in a devicetree for ColdFire targets.
It is enough to allow the use of "fixed" clocks, which for many ColdFire
targets is enough for a simple devicetree setup.
A full conversion to the common clock framework and use of the generic
clk struct is still needed to complete this work.
Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
---
arch/m68k/Kconfig.cpu | 2 +-
arch/m68k/coldfire/clk.c | 8 ++++++--
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/arch/m68k/Kconfig.cpu b/arch/m68k/Kconfig.cpu
index c9a7e602d8a4..50ecb16d0a1f 100644
--- a/arch/m68k/Kconfig.cpu
+++ b/arch/m68k/Kconfig.cpu
@@ -30,7 +30,7 @@ config COLDFIRE
select CPU_HAS_NO_MULDIV64
select GENERIC_CSUM
select GPIOLIB
- select HAVE_LEGACY_CLK
+ select COMMON_CLK
select HAVE_PAGE_SIZE_8KB if !MMU
config SUN3
diff --git a/arch/m68k/coldfire/clk.c b/arch/m68k/coldfire/clk.c
index d03b6c4aa86b..bb4c0a2a8a61 100644
--- a/arch/m68k/coldfire/clk.c
+++ b/arch/m68k/coldfire/clk.c
@@ -20,8 +20,6 @@
#include <asm/mcfsim.h>
#include <asm/mcfclk.h>
-static DEFINE_SPINLOCK(clk_lock);
-
#ifdef MCFPM_PPMCR0
/*
* For more advanced ColdFire parts that have clocks that can be enabled
@@ -73,6 +71,10 @@ struct clk_ops clk_ops1 = {
#endif /* MCFPM_PPMCR1 */
#endif /* MCFPM_PPMCR0 */
+#ifndef CONFIG_COMMON_CLK
+
+static DEFINE_SPINLOCK(clk_lock);
+
int clk_enable(struct clk *clk)
{
unsigned long flags;
@@ -141,4 +143,6 @@ struct clk *clk_get_parent(struct clk *clk)
}
EXPORT_SYMBOL(clk_get_parent);
+#endif /* !CONFIG_COMMON_CLK */
+
/***************************************************************************/
--
2.43.0
^ permalink raw reply related [flat|nested] 22+ messages in thread* [PATCH 05/13] m68k: coldfire: support devicetree binding for intc-simr
2025-02-18 12:46 [PATCH 00/13] m68k: coldfire: proof-of-concept devicetree Greg Ungerer
` (3 preceding siblings ...)
2025-02-18 12:46 ` [PATCH 04/13] m68k: coldfire: enable common clock framework Greg Ungerer
@ 2025-02-18 12:46 ` Greg Ungerer
2025-02-18 12:46 ` [PATCH 06/13] m68k: coldfire: support devicetree binding for intc controller Greg Ungerer
` (7 subsequent siblings)
12 siblings, 0 replies; 22+ messages in thread
From: Greg Ungerer @ 2025-02-18 12:46 UTC (permalink / raw)
To: linux-m68k; +Cc: Greg Ungerer
Add code support to the ColdFire intc-simr interrupt controller so that
it can be mapped via a devicetree binding.
This is implemented by adding IRQCHIP and IRQ_DOMAIN support. This first
version does not completely setup the interrupt controller using the IO
mapping binding passed in via the devicetree. Furture changes will add
that.
Devicetree support is not yet enabled for ColdFire targets so this
interrupt controller code still supports the legacy setup for now.
Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
---
arch/m68k/coldfire/intc-simr.c | 61 +++++++++++++++++++++++++++++-----
1 file changed, 52 insertions(+), 9 deletions(-)
diff --git a/arch/m68k/coldfire/intc-simr.c b/arch/m68k/coldfire/intc-simr.c
index f7c2c41b3156..bdc6dfac68f5 100644
--- a/arch/m68k/coldfire/intc-simr.c
+++ b/arch/m68k/coldfire/intc-simr.c
@@ -14,8 +14,11 @@
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/interrupt.h>
-#include <linux/irq.h>
#include <linux/io.h>
+#include <linux/irq.h>
+#include <linux/irqchip.h>
+#include <linux/of.h>
+#include <linux/of_irq.h>
#include <asm/coldfire.h>
#include <asm/mcfsim.h>
#include <asm/traps.h>
@@ -66,7 +69,7 @@ static inline unsigned int irq2ebit(unsigned int irq)
static void intc_irq_mask(struct irq_data *d)
{
- unsigned int irq = d->irq - MCFINT_VECBASE;
+ unsigned int irq = d->hwirq - MCFINT_VECBASE;
if (MCFINTC2_SIMR && (irq > 127))
__raw_writeb(irq - 128, MCFINTC2_SIMR);
@@ -78,7 +81,7 @@ static void intc_irq_mask(struct irq_data *d)
static void intc_irq_unmask(struct irq_data *d)
{
- unsigned int irq = d->irq - MCFINT_VECBASE;
+ unsigned int irq = d->hwirq - MCFINT_VECBASE;
if (MCFINTC2_CIMR && (irq > 127))
__raw_writeb(irq - 128, MCFINTC2_CIMR);
@@ -90,14 +93,16 @@ static void intc_irq_unmask(struct irq_data *d)
static void intc_irq_ack(struct irq_data *d)
{
- unsigned int ebit = irq2ebit(d->irq);
+ unsigned int irq = d->hwirq;
+ unsigned int ebit;
+ ebit = irq2ebit(irq);
__raw_writeb(0x1 << ebit, MCFEPORT_EPFR);
}
static unsigned int intc_irq_startup(struct irq_data *d)
{
- unsigned int irq = d->irq;
+ unsigned int irq = d->hwirq;
if ((irq >= EINT1) && (irq <= EINT7)) {
unsigned int ebit = irq2ebit(irq);
@@ -128,7 +133,7 @@ static unsigned int intc_irq_startup(struct irq_data *d)
static int intc_irq_set_type(struct irq_data *d, unsigned int type)
{
- unsigned int ebit, irq = d->irq;
+ unsigned int ebit, irq = d->hwirq;
u16 pa, tb;
switch (type) {
@@ -176,8 +181,6 @@ static struct irq_chip intc_irq_chip_edge_port = {
void __init init_IRQ(void)
{
- int irq, eirq;
-
/* Mask all interrupt sources */
__raw_writeb(0xff, MCFINTC0_SIMR);
if (MCFINTC1_SIMR)
@@ -185,8 +188,14 @@ void __init init_IRQ(void)
if (MCFINTC2_SIMR)
__raw_writeb(0xff, MCFINTC2_SIMR);
+#ifdef CONFIG_IRQCHIP
+ irqchip_init();
+#else
+ int irq, eirq;
+
eirq = MCFINT_VECBASE + 64 + (MCFINTC1_ICR0 ? 64 : 0) +
- (MCFINTC2_ICR0 ? 64 : 0);
+ (MCFINTC2_ICR0 ? 64 : 0);
+
for (irq = MCFINT_VECBASE; (irq < eirq); irq++) {
if ((irq >= EINT1) && (irq <= EINT7))
irq_set_chip(irq, &intc_irq_chip_edge_port);
@@ -195,5 +204,39 @@ void __init init_IRQ(void)
irq_set_irq_type(irq, IRQ_TYPE_LEVEL_HIGH);
irq_set_handler(irq, handle_level_irq);
}
+#endif
+}
+
+#ifdef CONFIG_IRQ_DOMAIN
+static int intc_domain_map(struct irq_domain *d,
+ unsigned int irq,
+ irq_hw_number_t hw)
+{
+ if ((irq >= EINT1) && (irq <= EINT7))
+ irq_set_chip_and_handler(irq, &intc_irq_chip_edge_port, handle_level_irq);
+ else
+ irq_set_chip_and_handler(irq, &intc_irq_chip, handle_level_irq);
+ return 0;
+}
+
+static const struct irq_domain_ops intc_irqdomain_ops = {
+ .map = intc_domain_map,
+};
+
+static int __init intc_of_init(struct device_node *np,
+ struct device_node *parent)
+{
+ const unsigned int num = MCFINT_VECBASE + 64 + (MCFINTC1_ICR0 ? 64 : 0) + (MCFINTC2_ICR0 ? 64 : 0);
+ struct irq_domain *domain;
+ int irq;
+
+ domain = irq_domain_add_linear(np, num, &intc_irqdomain_ops, NULL);
+
+ for (irq = MCFINT_VECBASE; irq < num; irq++)
+ irq_create_mapping(domain, irq);
+
+ return 0;
}
+IRQCHIP_DECLARE(intc_simr, "fsl,intc-simr", intc_of_init);
+#endif /* CONFIG_IRQ_DOMAIN */
--
2.43.0
^ permalink raw reply related [flat|nested] 22+ messages in thread* [PATCH 06/13] m68k: coldfire: support devicetree binding for intc controller
2025-02-18 12:46 [PATCH 00/13] m68k: coldfire: proof-of-concept devicetree Greg Ungerer
` (4 preceding siblings ...)
2025-02-18 12:46 ` [PATCH 05/13] m68k: coldfire: support devicetree binding for intc-simr Greg Ungerer
@ 2025-02-18 12:46 ` Greg Ungerer
2025-02-18 12:46 ` [PATCH 07/13] m68k: coldfire: support devicetree binding for intc-2 controller Greg Ungerer
` (6 subsequent siblings)
12 siblings, 0 replies; 22+ messages in thread
From: Greg Ungerer @ 2025-02-18 12:46 UTC (permalink / raw)
To: linux-m68k; +Cc: Greg Ungerer
Add code support to the ColdFire intc-simr interrupt controller so that
it can be mapped via a devicetree binding.
This is implemented by adding IRQCHIP and IRQ_DOMAIN support. This first
version does not completely setup the interrupt controller using the IO
mapping binding passed in via the devicetree. Furture changes will add
that.
Devicetree support is not yet enabled for ColdFire targets so this
interrupt controller code still supports the legacy setup for now.
Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
---
arch/m68k/coldfire/intc.c | 50 +++++++++++++++++++++++++++++++++------
1 file changed, 43 insertions(+), 7 deletions(-)
diff --git a/arch/m68k/coldfire/intc.c b/arch/m68k/coldfire/intc.c
index b434371e2b99..1b7f23a425d7 100644
--- a/arch/m68k/coldfire/intc.c
+++ b/arch/m68k/coldfire/intc.c
@@ -12,8 +12,11 @@
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/interrupt.h>
-#include <linux/irq.h>
#include <linux/io.h>
+#include <linux/irq.h>
+#include <linux/irqchip.h>
+#include <linux/of.h>
+#include <linux/of_irq.h>
#include <asm/traps.h>
#include <asm/coldfire.h>
#include <asm/mcfsim.h>
@@ -113,14 +116,14 @@ void mcf_autovector(int irq)
static void intc_irq_mask(struct irq_data *d)
{
- if (mcf_irq2imr[d->irq])
- mcf_setimr(mcf_irq2imr[d->irq]);
+ if (mcf_irq2imr[d->hwirq])
+ mcf_setimr(mcf_irq2imr[d->hwirq]);
}
static void intc_irq_unmask(struct irq_data *d)
{
- if (mcf_irq2imr[d->irq])
- mcf_clrimr(mcf_irq2imr[d->irq]);
+ if (mcf_irq2imr[d->hwirq])
+ mcf_clrimr(mcf_irq2imr[d->hwirq]);
}
static int intc_irq_set_type(struct irq_data *d, unsigned int type)
@@ -137,14 +140,47 @@ static struct irq_chip intc_irq_chip = {
void __init init_IRQ(void)
{
- int irq;
-
mcf_maskimr(0xffffffff);
+#ifdef CONFIG_IRQCHIP
+ irqchip_init();
+#else
+ int irq;
for (irq = 0; (irq < NR_IRQS); irq++) {
irq_set_chip(irq, &intc_irq_chip);
irq_set_irq_type(irq, IRQ_TYPE_LEVEL_HIGH);
irq_set_handler(irq, handle_level_irq);
}
+#endif
+}
+
+#ifdef CONFIG_IRQ_DOMAIN
+static int intc_domain_map(struct irq_domain *d,
+ unsigned int irq,
+ irq_hw_number_t hw)
+{
+ irq_set_chip_and_handler(irq, &intc_irq_chip, handle_level_irq);
+ return 0;
+}
+
+static const struct irq_domain_ops intc_irqdomain_ops = {
+ .map = intc_domain_map,
+};
+
+static int __init intc_of_init(struct device_node *np,
+ struct device_node *parent)
+{
+ const unsigned int num = MCFINT_VECBASE + 64;
+ struct irq_domain *domain;
+ int irq;
+
+ domain = irq_domain_add_linear(np, num, &intc_irqdomain_ops, NULL);
+
+ for (irq = MCFINT_VECBASE; irq < num; irq++)
+ irq_create_mapping(domain, irq);
+
+ return 0;
}
+IRQCHIP_DECLARE(intc, "fsl,intc", intc_of_init);
+#endif /* CONFIG_IRQ_DOMAIN */
--
2.43.0
^ permalink raw reply related [flat|nested] 22+ messages in thread* [PATCH 07/13] m68k: coldfire: support devicetree binding for intc-2 controller
2025-02-18 12:46 [PATCH 00/13] m68k: coldfire: proof-of-concept devicetree Greg Ungerer
` (5 preceding siblings ...)
2025-02-18 12:46 ` [PATCH 06/13] m68k: coldfire: support devicetree binding for intc controller Greg Ungerer
@ 2025-02-18 12:46 ` Greg Ungerer
2025-02-18 12:46 ` [PATCH 08/13] m68k: coldfire: add devicetree for mcf5208-evb platform Greg Ungerer
` (5 subsequent siblings)
12 siblings, 0 replies; 22+ messages in thread
From: Greg Ungerer @ 2025-02-18 12:46 UTC (permalink / raw)
To: linux-m68k; +Cc: Greg Ungerer
Add code support to the ColdFire intc-2 interrupt controller so that
it can be mapped via a devicetree binding.
This is implemented by adding IRQCHIP and IRQ_DOMAIN support. This first
version does not completely setup the interrupt controller using the IO
mapping binding passed in via the devicetree. Future changes will add
that.
Devicetree support is not yet enabled for ColdFire targets so this
interrupt controller code still supports the legacy setup for now.
Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
---
arch/m68k/coldfire/intc-2.c | 59 ++++++++++++++++++++++++++++++-------
1 file changed, 49 insertions(+), 10 deletions(-)
diff --git a/arch/m68k/coldfire/intc-2.c b/arch/m68k/coldfire/intc-2.c
index f74f0e473119..ac29106dc166 100644
--- a/arch/m68k/coldfire/intc-2.c
+++ b/arch/m68k/coldfire/intc-2.c
@@ -21,8 +21,11 @@
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/interrupt.h>
-#include <linux/irq.h>
#include <linux/io.h>
+#include <linux/irq.h>
+#include <linux/irqchip.h>
+#include <linux/of.h>
+#include <linux/of_irq.h>
#include <asm/coldfire.h>
#include <asm/mcfsim.h>
#include <asm/traps.h>
@@ -49,7 +52,7 @@
static void intc_irq_mask(struct irq_data *d)
{
- unsigned int irq = d->irq - MCFINT_VECBASE;
+ unsigned int irq = d->hwirq - MCFINT_VECBASE;
unsigned long imraddr;
u32 val, imrbit;
@@ -67,7 +70,7 @@ static void intc_irq_mask(struct irq_data *d)
static void intc_irq_unmask(struct irq_data *d)
{
- unsigned int irq = d->irq - MCFINT_VECBASE;
+ unsigned int irq = d->hwirq - MCFINT_VECBASE;
unsigned long imraddr;
u32 val, imrbit;
@@ -95,7 +98,7 @@ static void intc_irq_unmask(struct irq_data *d)
*/
static void intc_irq_ack(struct irq_data *d)
{
- unsigned int irq = d->irq;
+ unsigned int irq = d->hwirq;
__raw_writeb(0x1 << (irq - EINT0), MCFEPORT_EPFR);
}
@@ -111,7 +114,7 @@ static u8 intc_intpri = MCFSIM_ICR_LEVEL(6) | MCFSIM_ICR_PRI(6);
static unsigned int intc_irq_startup(struct irq_data *d)
{
- unsigned int irq = d->irq - MCFINT_VECBASE;
+ unsigned int irq = d->hwirq - MCFINT_VECBASE;
unsigned long icraddr;
#ifdef MCFICM_INTC1
@@ -123,7 +126,7 @@ static unsigned int intc_irq_startup(struct irq_data *d)
if (__raw_readb(icraddr) == 0)
__raw_writeb(intc_intpri--, icraddr);
- irq = d->irq;
+ irq = d->hwirq;
if ((irq >= EINT1) && (irq <= EINT7)) {
u8 v;
@@ -144,7 +147,7 @@ static unsigned int intc_irq_startup(struct irq_data *d)
static int intc_irq_set_type(struct irq_data *d, unsigned int type)
{
- unsigned int irq = d->irq;
+ unsigned int irq = d->hwirq;
u16 pa, tb;
switch (type) {
@@ -192,21 +195,57 @@ static struct irq_chip intc_irq_chip_edge_port = {
void __init init_IRQ(void)
{
- int irq;
-
/* Mask all interrupt sources */
__raw_writel(0x1, MCFICM_INTC0 + MCFINTC_IMRL);
#ifdef MCFICM_INTC1
__raw_writel(0x1, MCFICM_INTC1 + MCFINTC_IMRL);
#endif
+#ifdef CONFIG_IRQCHIP
+ irqchip_init();
+#else
+ int irq;
for (irq = MCFINT_VECBASE; (irq < MCFINT_VECBASE + NR_VECS); irq++) {
- if ((irq >= EINT1) && (irq <=EINT7))
+ if ((irq >= EINT1) && (irq <= EINT7))
irq_set_chip(irq, &intc_irq_chip_edge_port);
else
irq_set_chip(irq, &intc_irq_chip);
irq_set_irq_type(irq, IRQ_TYPE_LEVEL_HIGH);
irq_set_handler(irq, handle_level_irq);
}
+#endif
+}
+
+#ifdef CONFIG_IRQ_DOMAIN
+static int intc_domain_map(struct irq_domain *d,
+ unsigned int irq,
+ irq_hw_number_t hw)
+{
+ if ((irq >= EINT1) && (irq <= EINT7))
+ irq_set_chip_and_handler(irq, &intc_irq_chip_edge_port, handle_level_irq);
+ else
+ irq_set_chip_and_handler(irq, &intc_irq_chip, handle_level_irq);
+ return 0;
+}
+
+static const struct irq_domain_ops intc_irqdomain_ops = {
+ .map = intc_domain_map,
+};
+
+static int __init intc_of_init(struct device_node *np,
+ struct device_node *parent)
+{
+ const unsigned int num = MCFINT_VECBASE + NR_IRQS;
+ struct irq_domain *domain;
+ int irq;
+
+ domain = irq_domain_add_linear(np, num, &intc_irqdomain_ops, NULL);
+
+ for (irq = MCFINT_VECBASE; irq < num; irq++)
+ irq_create_mapping(domain, irq);
+
+ return 0;
}
+IRQCHIP_DECLARE(intc, "fsl,intc-2", intc_of_init);
+#endif /* CONFIG_IRQ_DOMAIN */
--
2.43.0
^ permalink raw reply related [flat|nested] 22+ messages in thread* [PATCH 08/13] m68k: coldfire: add devicetree for mcf5208-evb platform
2025-02-18 12:46 [PATCH 00/13] m68k: coldfire: proof-of-concept devicetree Greg Ungerer
` (6 preceding siblings ...)
2025-02-18 12:46 ` [PATCH 07/13] m68k: coldfire: support devicetree binding for intc-2 controller Greg Ungerer
@ 2025-02-18 12:46 ` Greg Ungerer
2025-02-18 12:46 ` [PATCH 09/13] m68k: coldfire: add devicetree for mcf5475-evb platform Greg Ungerer
` (4 subsequent siblings)
12 siblings, 0 replies; 22+ messages in thread
From: Greg Ungerer @ 2025-02-18 12:46 UTC (permalink / raw)
To: linux-m68k; +Cc: Greg Ungerer
Add a simple devicetree to support the Freescale MCF5208-EVB platform.
Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
---
arch/m68k/boot/dts/Makefile | 4 +++
arch/m68k/boot/dts/mcf5208evb.dts | 57 +++++++++++++++++++++++++++++++
2 files changed, 61 insertions(+)
create mode 100644 arch/m68k/boot/dts/Makefile
create mode 100644 arch/m68k/boot/dts/mcf5208evb.dts
diff --git a/arch/m68k/boot/dts/Makefile b/arch/m68k/boot/dts/Makefile
new file mode 100644
index 000000000000..d69e37b48558
--- /dev/null
+++ b/arch/m68k/boot/dts/Makefile
@@ -0,0 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0
+
+dtb-y += mcf5208evb.dtb
+
diff --git a/arch/m68k/boot/dts/mcf5208evb.dts b/arch/m68k/boot/dts/mcf5208evb.dts
new file mode 100644
index 000000000000..b6c32779b495
--- /dev/null
+++ b/arch/m68k/boot/dts/mcf5208evb.dts
@@ -0,0 +1,57 @@
+// SPDX-License-Identifier: GPL-2.0
+/dts-v1/;
+
+/ {
+ model = "Freescale MCF5208EVB";
+ compatible = "mcf5208evb";
+ #address-cells = <1>;
+ #size-cells = <1>;
+ interrupt-parent = <&intc_simr>;
+
+ coreclk: clock-166000000 {
+ #clock-cells = <0>;
+ compatible = "fixed-clock";
+ clock-frequency = <166000000>;
+ };
+
+ intc_simr: interrupt-controller@fc048000 {
+ compatible = "fsl,intc-simr";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ reg = <0xfc048000 0x80>;
+ };
+
+ uart0: serial@fc060000 {
+ compatible = "fsl,mcfuart";
+ reg = <0xfc060000 0x80>;
+ interrupts = <90>;
+ clocks = <&coreclk>;
+ status = "okay";
+ };
+
+ uart1: serial@fc064000 {
+ compatible = "fsl,mcfuart";
+ reg = <0xfc064000 0x80>;
+ interrupts = <91>;
+ clocks = <&coreclk>;
+ status = "okay";
+ };
+
+ uart2: serial@fc068000 {
+ compatible = "fsl,mcfuart";
+ reg = <0xfc068000 0x80>;
+ interrupts = <92>;
+ clocks = <&coreclk>;
+ status = "okay";
+ };
+
+ fec: ethernet@fc030000 {
+ compatible = "fsl,m5208-fec";
+ reg = <0xfc030000 0x800>;
+ interrupts = <100>, <104>, <106>;
+ interrupt-names = "int0", "int1", "int2";
+ clocks = <&coreclk>, <&coreclk>;
+ clock-names = "ipg", "ahb";
+ status = "okay";
+ };
+};
--
2.43.0
^ permalink raw reply related [flat|nested] 22+ messages in thread* [PATCH 09/13] m68k: coldfire: add devicetree for mcf5475-evb platform
2025-02-18 12:46 [PATCH 00/13] m68k: coldfire: proof-of-concept devicetree Greg Ungerer
` (7 preceding siblings ...)
2025-02-18 12:46 ` [PATCH 08/13] m68k: coldfire: add devicetree for mcf5208-evb platform Greg Ungerer
@ 2025-02-18 12:46 ` Greg Ungerer
2025-02-19 7:06 ` Krzysztof Kozlowski
2025-02-18 12:46 ` [PATCH 10/13] m68k: implement an embedded devicetree for nonmmu Greg Ungerer
` (3 subsequent siblings)
12 siblings, 1 reply; 22+ messages in thread
From: Greg Ungerer @ 2025-02-18 12:46 UTC (permalink / raw)
To: linux-m68k; +Cc: Greg Ungerer
Add a simple devicetree to support the Freescale MCF5475-EVB platform.
Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
---
arch/m68k/boot/dts/Makefile | 1 +
arch/m68k/boot/dts/mcf5475evb.dts | 55 +++++++++++++++++++++++++++++++
2 files changed, 56 insertions(+)
create mode 100644 arch/m68k/boot/dts/mcf5475evb.dts
diff --git a/arch/m68k/boot/dts/Makefile b/arch/m68k/boot/dts/Makefile
index d69e37b48558..f0e9643e6b71 100644
--- a/arch/m68k/boot/dts/Makefile
+++ b/arch/m68k/boot/dts/Makefile
@@ -1,4 +1,5 @@
# SPDX-License-Identifier: GPL-2.0
dtb-y += mcf5208evb.dtb
+dtb-y += mcf5475evb.dtb
diff --git a/arch/m68k/boot/dts/mcf5475evb.dts b/arch/m68k/boot/dts/mcf5475evb.dts
new file mode 100644
index 000000000000..247a938bfafd
--- /dev/null
+++ b/arch/m68k/boot/dts/mcf5475evb.dts
@@ -0,0 +1,55 @@
+// SPDX-License-Identifier: GPL-2.0
+/dts-v1/;
+
+/ {
+ model = "Freescale MCF5475EVB";
+ compatible = "mcf5475evb";
+ #address-cells = <1>;
+ #size-cells = <1>;
+ interrupt-parent = <&intc>;
+
+ coreclk: clock-266000000 {
+ #clock-cells = <0>;
+ compatible = "fixed-clock";
+ clock-frequency = <266000000>;
+ };
+
+ intc: interrupt-controller@ff000700 {
+ compatible = "fsl,intc-2";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ reg = <0xff000700 0x80>;
+ };
+
+ uart0: serial@ff008600 {
+ compatible = "fsl,mcfuart";
+ reg = <0xff008600 0x80>;
+ interrupts = <99>;
+ clocks = <&coreclk>;
+ status = "okay";
+ };
+
+ uart1: serial@ff008700 {
+ compatible = "fsl,mcfuart";
+ reg = <0xff008700 0x80>;
+ interrupts = <98>;
+ clocks = <&coreclk>;
+ status = "okay";
+ };
+
+ uart2: serial@ff008800 {
+ compatible = "fsl,mcfuart";
+ reg = <0xff008800 0x80>;
+ interrupts = <97>;
+ clocks = <&coreclk>;
+ status = "okay";
+ };
+
+ uart3: serial@ff008900 {
+ compatible = "fsl,mcfuart";
+ reg = <0xff008900 0x80>;
+ interrupts = <96>;
+ clocks = <&coreclk>;
+ status = "okay";
+ };
+};
--
2.43.0
^ permalink raw reply related [flat|nested] 22+ messages in thread* Re: [PATCH 09/13] m68k: coldfire: add devicetree for mcf5475-evb platform
2025-02-18 12:46 ` [PATCH 09/13] m68k: coldfire: add devicetree for mcf5475-evb platform Greg Ungerer
@ 2025-02-19 7:06 ` Krzysztof Kozlowski
2025-02-19 8:23 ` Greg Ungerer
0 siblings, 1 reply; 22+ messages in thread
From: Krzysztof Kozlowski @ 2025-02-19 7:06 UTC (permalink / raw)
To: Greg Ungerer, linux-m68k
On 18/02/2025 13:46, Greg Ungerer wrote:
> Add a simple devicetree to support the Freescale MCF5475-EVB platform.
>
> Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
> ---
> arch/m68k/boot/dts/Makefile | 1 +
> arch/m68k/boot/dts/mcf5475evb.dts | 55 +++++++++++++++++++++++++++++++
> 2 files changed, 56 insertions(+)
> create mode 100644 arch/m68k/boot/dts/mcf5475evb.dts
>
> diff --git a/arch/m68k/boot/dts/Makefile b/arch/m68k/boot/dts/Makefile
> index d69e37b48558..f0e9643e6b71 100644
> --- a/arch/m68k/boot/dts/Makefile
> +++ b/arch/m68k/boot/dts/Makefile
> @@ -1,4 +1,5 @@
> # SPDX-License-Identifier: GPL-2.0
>
> dtb-y += mcf5208evb.dtb
> +dtb-y += mcf5475evb.dtb
>
> diff --git a/arch/m68k/boot/dts/mcf5475evb.dts b/arch/m68k/boot/dts/mcf5475evb.dts
> new file mode 100644
> index 000000000000..247a938bfafd
> --- /dev/null
> +++ b/arch/m68k/boot/dts/mcf5475evb.dts
> @@ -0,0 +1,55 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/dts-v1/;
> +
> +/ {
> + model = "Freescale MCF5475EVB";
> + compatible = "mcf5475evb";
Incorrect format.
Please run scripts/checkpatch.pl and fix reported warnings. After that,
run also `scripts/checkpatch.pl --strict` and (probably) fix more
warnings. Some warnings can be ignored, especially from --strict run,
but the code here looks like it needs a fix. Feel free to get in touch
if the warning is not clear.
> + #address-cells = <1>;
> + #size-cells = <1>;
> + interrupt-parent = <&intc>;
> +
> + coreclk: clock-266000000 {
> + #clock-cells = <0>;
> + compatible = "fixed-clock";
> + clock-frequency = <266000000>;
> + };
> +
> + intc: interrupt-controller@ff000700 {
> + compatible = "fsl,intc-2";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + reg = <0xff000700 0x80>;
> + };
> +
> + uart0: serial@ff008600 {
> + compatible = "fsl,mcfuart";
> + reg = <0xff008600 0x80>;
> + interrupts = <99>;
> + clocks = <&coreclk>;
> + status = "okay";
Did you disable it anywhere?
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 22+ messages in thread* Re: [PATCH 09/13] m68k: coldfire: add devicetree for mcf5475-evb platform
2025-02-19 7:06 ` Krzysztof Kozlowski
@ 2025-02-19 8:23 ` Greg Ungerer
2025-02-19 8:26 ` Krzysztof Kozlowski
0 siblings, 1 reply; 22+ messages in thread
From: Greg Ungerer @ 2025-02-19 8:23 UTC (permalink / raw)
To: Krzysztof Kozlowski, linux-m68k
Hi Krzysztof,
On 19/2/25 17:06, Krzysztof Kozlowski wrote:
> On 18/02/2025 13:46, Greg Ungerer wrote:
>> Add a simple devicetree to support the Freescale MCF5475-EVB platform.
>>
>> Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
>> ---
>> arch/m68k/boot/dts/Makefile | 1 +
>> arch/m68k/boot/dts/mcf5475evb.dts | 55 +++++++++++++++++++++++++++++++
>> 2 files changed, 56 insertions(+)
>> create mode 100644 arch/m68k/boot/dts/mcf5475evb.dts
>>
>> diff --git a/arch/m68k/boot/dts/Makefile b/arch/m68k/boot/dts/Makefile
>> index d69e37b48558..f0e9643e6b71 100644
>> --- a/arch/m68k/boot/dts/Makefile
>> +++ b/arch/m68k/boot/dts/Makefile
>> @@ -1,4 +1,5 @@
>> # SPDX-License-Identifier: GPL-2.0
>>
>> dtb-y += mcf5208evb.dtb
>> +dtb-y += mcf5475evb.dtb
>>
>> diff --git a/arch/m68k/boot/dts/mcf5475evb.dts b/arch/m68k/boot/dts/mcf5475evb.dts
>> new file mode 100644
>> index 000000000000..247a938bfafd
>> --- /dev/null
>> +++ b/arch/m68k/boot/dts/mcf5475evb.dts
>> @@ -0,0 +1,55 @@
>> +// SPDX-License-Identifier: GPL-2.0
>> +/dts-v1/;
>> +
>> +/ {
>> + model = "Freescale MCF5475EVB";
>> + compatible = "mcf5475evb";
>
> Incorrect format.
>
> Please run scripts/checkpatch.pl and fix reported warnings. After that,
> run also `scripts/checkpatch.pl --strict` and (probably) fix more
> warnings. Some warnings can be ignored, especially from --strict run,
> but the code here looks like it needs a fix. Feel free to get in touch
> if the warning is not clear.
If that is an incorrect format then checkpatch is not reporting it.
Checkpatch here (even --strict) only reports that it is undocumented:
WARNING: DT compatible string "mcf5475evb" appears un-documented -- check ./Documentation/devicetree/bindings/
#36: FILE: arch/m68k/boot/dts/mcf5475evb.dts:6:
+ compatible = "mcf5475evb";
Which I totally expect at this point. As pointed out in the cover letter this
work is very much an incomplete proof-of-concept still. Much work still to do here.
>> + #address-cells = <1>;
>> + #size-cells = <1>;
>> + interrupt-parent = <&intc>;
>> +
>> + coreclk: clock-266000000 {
>> + #clock-cells = <0>;
>> + compatible = "fixed-clock";
>> + clock-frequency = <266000000>;
>> + };
>> +
>> + intc: interrupt-controller@ff000700 {
>> + compatible = "fsl,intc-2";
>> + interrupt-controller;
>> + #interrupt-cells = <1>;
>> + reg = <0xff000700 0x80>;
>> + };
>> +
>> + uart0: serial@ff008600 {
>> + compatible = "fsl,mcfuart";
>> + reg = <0xff008600 0x80>;
>> + interrupts = <99>;
>> + clocks = <&coreclk>;
>> + status = "okay";
>
> Did you disable it anywhere?
No.
Regards
Greg
^ permalink raw reply [flat|nested] 22+ messages in thread* Re: [PATCH 09/13] m68k: coldfire: add devicetree for mcf5475-evb platform
2025-02-19 8:23 ` Greg Ungerer
@ 2025-02-19 8:26 ` Krzysztof Kozlowski
2025-02-19 21:58 ` Greg Ungerer
0 siblings, 1 reply; 22+ messages in thread
From: Krzysztof Kozlowski @ 2025-02-19 8:26 UTC (permalink / raw)
To: Greg Ungerer, linux-m68k
On 19/02/2025 09:23, Greg Ungerer wrote:
> Hi Krzysztof,
>
> On 19/2/25 17:06, Krzysztof Kozlowski wrote:
>> On 18/02/2025 13:46, Greg Ungerer wrote:
>>> Add a simple devicetree to support the Freescale MCF5475-EVB platform.
>>>
>>> Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
>>> ---
>>> arch/m68k/boot/dts/Makefile | 1 +
>>> arch/m68k/boot/dts/mcf5475evb.dts | 55 +++++++++++++++++++++++++++++++
>>> 2 files changed, 56 insertions(+)
>>> create mode 100644 arch/m68k/boot/dts/mcf5475evb.dts
>>>
>>> diff --git a/arch/m68k/boot/dts/Makefile b/arch/m68k/boot/dts/Makefile
>>> index d69e37b48558..f0e9643e6b71 100644
>>> --- a/arch/m68k/boot/dts/Makefile
>>> +++ b/arch/m68k/boot/dts/Makefile
>>> @@ -1,4 +1,5 @@
>>> # SPDX-License-Identifier: GPL-2.0
>>>
>>> dtb-y += mcf5208evb.dtb
>>> +dtb-y += mcf5475evb.dtb
>>>
>>> diff --git a/arch/m68k/boot/dts/mcf5475evb.dts b/arch/m68k/boot/dts/mcf5475evb.dts
>>> new file mode 100644
>>> index 000000000000..247a938bfafd
>>> --- /dev/null
>>> +++ b/arch/m68k/boot/dts/mcf5475evb.dts
>>> @@ -0,0 +1,55 @@
>>> +// SPDX-License-Identifier: GPL-2.0
>>> +/dts-v1/;
>>> +
>>> +/ {
>>> + model = "Freescale MCF5475EVB";
>>> + compatible = "mcf5475evb";
>>
>> Incorrect format.
>>
>> Please run scripts/checkpatch.pl and fix reported warnings. After that,
>> run also `scripts/checkpatch.pl --strict` and (probably) fix more
>> warnings. Some warnings can be ignored, especially from --strict run,
>> but the code here looks like it needs a fix. Feel free to get in touch
>> if the warning is not clear.
>
> If that is an incorrect format then checkpatch is not reporting it.
There are two issues here.
1. Incorrect format: see DT spec or any other example.
2. Below checkpatch warning.
>
> Checkpatch here (even --strict) only reports that it is undocumented:
>
> WARNING: DT compatible string "mcf5475evb" appears un-documented -- check ./Documentation/devicetree/bindings/
> #36: FILE: arch/m68k/boot/dts/mcf5475evb.dts:6:
> + compatible = "mcf5475evb";
>
> Which I totally expect at this point. As pointed out in the cover letter this
> work is very much an incomplete proof-of-concept still. Much work still to do here.
Patch should be marked as RFC with that explanation in cover letter, so
you won't get such review comments.
>>> + #address-cells = <1>;
>>> + #size-cells = <1>;
>>> + interrupt-parent = <&intc>;
>>> +
>>> + coreclk: clock-266000000 {
>>> + #clock-cells = <0>;
>>> + compatible = "fixed-clock";
>>> + clock-frequency = <266000000>;
>>> + };
>>> +
>>> + intc: interrupt-controller@ff000700 {
>>> + compatible = "fsl,intc-2";
>>> + interrupt-controller;
>>> + #interrupt-cells = <1>;
>>> + reg = <0xff000700 0x80>;
>>> + };
>>> +
>>> + uart0: serial@ff008600 {
>>> + compatible = "fsl,mcfuart";
>>> + reg = <0xff008600 0x80>;
>>> + interrupts = <99>;
>>> + clocks = <&coreclk>;
>>> + status = "okay";
>>
>> Did you disable it anywhere?
>
> No.
So no need for that status.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 22+ messages in thread* Re: [PATCH 09/13] m68k: coldfire: add devicetree for mcf5475-evb platform
2025-02-19 8:26 ` Krzysztof Kozlowski
@ 2025-02-19 21:58 ` Greg Ungerer
0 siblings, 0 replies; 22+ messages in thread
From: Greg Ungerer @ 2025-02-19 21:58 UTC (permalink / raw)
To: Krzysztof Kozlowski, linux-m68k
On 19/2/25 18:26, Krzysztof Kozlowski wrote:
> On 19/02/2025 09:23, Greg Ungerer wrote:
>> Hi Krzysztof,
>>
>> On 19/2/25 17:06, Krzysztof Kozlowski wrote:
>>> On 18/02/2025 13:46, Greg Ungerer wrote:
>>>> Add a simple devicetree to support the Freescale MCF5475-EVB platform.
>>>>
>>>> Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
>>>> ---
>>>> arch/m68k/boot/dts/Makefile | 1 +
>>>> arch/m68k/boot/dts/mcf5475evb.dts | 55 +++++++++++++++++++++++++++++++
>>>> 2 files changed, 56 insertions(+)
>>>> create mode 100644 arch/m68k/boot/dts/mcf5475evb.dts
>>>>
>>>> diff --git a/arch/m68k/boot/dts/Makefile b/arch/m68k/boot/dts/Makefile
>>>> index d69e37b48558..f0e9643e6b71 100644
>>>> --- a/arch/m68k/boot/dts/Makefile
>>>> +++ b/arch/m68k/boot/dts/Makefile
>>>> @@ -1,4 +1,5 @@
>>>> # SPDX-License-Identifier: GPL-2.0
>>>>
>>>> dtb-y += mcf5208evb.dtb
>>>> +dtb-y += mcf5475evb.dtb
>>>>
>>>> diff --git a/arch/m68k/boot/dts/mcf5475evb.dts b/arch/m68k/boot/dts/mcf5475evb.dts
>>>> new file mode 100644
>>>> index 000000000000..247a938bfafd
>>>> --- /dev/null
>>>> +++ b/arch/m68k/boot/dts/mcf5475evb.dts
>>>> @@ -0,0 +1,55 @@
>>>> +// SPDX-License-Identifier: GPL-2.0
>>>> +/dts-v1/;
>>>> +
>>>> +/ {
>>>> + model = "Freescale MCF5475EVB";
>>>> + compatible = "mcf5475evb";
>>>
>>> Incorrect format.
>>>
>>> Please run scripts/checkpatch.pl and fix reported warnings. After that,
>>> run also `scripts/checkpatch.pl --strict` and (probably) fix more
>>> warnings. Some warnings can be ignored, especially from --strict run,
>>> but the code here looks like it needs a fix. Feel free to get in touch
>>> if the warning is not clear.
>>
>> If that is an incorrect format then checkpatch is not reporting it.
>
> There are two issues here.
> 1. Incorrect format: see DT spec or any other example.
> 2. Below checkpatch warning.
Fixed in next version.
Thanks
Greg
>>
>> Checkpatch here (even --strict) only reports that it is undocumented:
>>
>> WARNING: DT compatible string "mcf5475evb" appears un-documented -- check ./Documentation/devicetree/bindings/
>> #36: FILE: arch/m68k/boot/dts/mcf5475evb.dts:6:
>> + compatible = "mcf5475evb";
>>
>> Which I totally expect at this point. As pointed out in the cover letter this
>> work is very much an incomplete proof-of-concept still. Much work still to do here.
>
>
> Patch should be marked as RFC with that explanation in cover letter, so
> you won't get such review comments.
>
>>>> + #address-cells = <1>;
>>>> + #size-cells = <1>;
>>>> + interrupt-parent = <&intc>;
>>>> +
>>>> + coreclk: clock-266000000 {
>>>> + #clock-cells = <0>;
>>>> + compatible = "fixed-clock";
>>>> + clock-frequency = <266000000>;
>>>> + };
>>>> +
>>>> + intc: interrupt-controller@ff000700 {
>>>> + compatible = "fsl,intc-2";
>>>> + interrupt-controller;
>>>> + #interrupt-cells = <1>;
>>>> + reg = <0xff000700 0x80>;
>>>> + };
>>>> +
>>>> + uart0: serial@ff008600 {
>>>> + compatible = "fsl,mcfuart";
>>>> + reg = <0xff008600 0x80>;
>>>> + interrupts = <99>;
>>>> + clocks = <&coreclk>;
>>>> + status = "okay";
>>>
>>> Did you disable it anywhere?
>>
>> No.
>
>
> So no need for that status.
>
> Best regards,
> Krzysztof
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 10/13] m68k: implement an embedded devicetree for nonmmu
2025-02-18 12:46 [PATCH 00/13] m68k: coldfire: proof-of-concept devicetree Greg Ungerer
` (8 preceding siblings ...)
2025-02-18 12:46 ` [PATCH 09/13] m68k: coldfire: add devicetree for mcf5475-evb platform Greg Ungerer
@ 2025-02-18 12:46 ` Greg Ungerer
2025-02-20 14:06 ` Geert Uytterhoeven
2025-02-18 12:46 ` [PATCH 11/13] m68k: implement an embedded devicetree for mm targets Greg Ungerer
` (2 subsequent siblings)
12 siblings, 1 reply; 22+ messages in thread
From: Greg Ungerer @ 2025-02-18 12:46 UTC (permalink / raw)
To: linux-m68k; +Cc: Greg Ungerer
If there is no capability for the boot loader to specify a devicetree
blob then this option allows for it to be embedded within the linux
kernel binary itself. This change specifically adds this embedding
support for the m68knommu targets.
Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
---
arch/m68k/Kconfig.devices | 11 ++++++++++
arch/m68k/kernel/Makefile | 1 +
arch/m68k/kernel/embedded_dtb.S | 19 +++++++++++++++++
arch/m68k/kernel/setup_no.c | 33 ++++++++++++++++++++++++++++++
arch/m68k/kernel/vmlinux-nommu.lds | 9 ++++++++
5 files changed, 73 insertions(+)
create mode 100644 arch/m68k/kernel/embedded_dtb.S
diff --git a/arch/m68k/Kconfig.devices b/arch/m68k/Kconfig.devices
index e6e3efac1840..ea0bce4db639 100644
--- a/arch/m68k/Kconfig.devices
+++ b/arch/m68k/Kconfig.devices
@@ -144,3 +144,14 @@ config SERIAL_CONSOLE
endmenu
endif
+
+config EMBEDDED_DTB
+ bool "Embedded devicetree ELF section"
+ help
+ If there is no capability for the boot loader to specify a
+ devicetree (DTB) then this option allows for it to be embedbed
+ within the linux binary itself. Typically you can do this with
+ something like this:
+
+ objcopy --update-section .embedded_dtb=<filename>.dtb vmlinux
+
diff --git a/arch/m68k/kernel/Makefile b/arch/m68k/kernel/Makefile
index 6c732ed3998b..04627f13efb6 100644
--- a/arch/m68k/kernel/Makefile
+++ b/arch/m68k/kernel/Makefile
@@ -20,6 +20,7 @@ obj-$(CONFIG_M68K_NONCOHERENT_DMA) += dma.o
obj-$(CONFIG_KEXEC_CORE) += machine_kexec.o relocate_kernel.o
obj-$(CONFIG_BOOTINFO_PROC) += bootinfo_proc.o
obj-$(CONFIG_UBOOT) += uboot.o
+obj-$(CONFIG_EMBEDDED_DTB) += embedded_dtb.o
obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
diff --git a/arch/m68k/kernel/embedded_dtb.S b/arch/m68k/kernel/embedded_dtb.S
new file mode 100644
index 000000000000..389a63f52770
--- /dev/null
+++ b/arch/m68k/kernel/embedded_dtb.S
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#include <linux/linkage.h>
+#include <asm/page.h>
+
+/*
+ * If we have a single configured platform then include that fdt now.
+ * Otherwise leave some space so it can be inserted later.
+ */
+.section ".embedded_dtb","aw"
+.balign PAGE_SIZE
+
+#if defined(CONFIG_M520x)
+.incbin "arch/m68k/boot/dts/mcf5208evb.dtb"
+#elif defined(CONFIG_M547x)
+.incbin "arch/m68k/boot/dts/mcf5475evb.dtb"
+#else
+.skip PAGE_SIZE,0
+#endif
diff --git a/arch/m68k/kernel/setup_no.c b/arch/m68k/kernel/setup_no.c
index c926da9d5ec2..50f972c91caa 100644
--- a/arch/m68k/kernel/setup_no.c
+++ b/arch/m68k/kernel/setup_no.c
@@ -33,6 +33,8 @@
#include <linux/initrd.h>
#include <linux/root_dev.h>
#include <linux/rtc.h>
+#include <linux/of.h>
+#include <linux/of_fdt.h>
#include <asm/setup.h>
#include <asm/bootinfo.h>
@@ -70,6 +72,32 @@ void (*mach_halt)(void);
#define CPU_NAME "UNKNOWN"
#endif
+#ifdef CONFIG_EMBEDDED_DTB
+static void __init m68k_setup_fdt(void)
+{
+ extern void *embedded_dtb;
+ phys_addr_t fdt = (phys_addr_t) &embedded_dtb;
+
+ pr_info("m68k generic DT machine support, FDT blob at 0x%08x\n", fdt);
+ if (!early_init_dt_verify(__va(fdt), fdt)) {
+ pr_err("FDT blob is bad?!\n");
+ return;
+ }
+ early_init_dt_scan_nodes();
+ unflatten_device_tree();
+}
+
+static void __init m68k_dtb_model(void)
+{
+ const char *model;
+ model = of_flat_dt_get_machine_name();
+ if (model)
+ pr_info("DTB reports model \"%s\"\n", model);
+ else
+ pr_warn("DTB has no model type?\n");
+}
+#endif /* CONFIG_EMBEDDED_DTB */
+
/*
* Different cores have different instruction execution timings.
* The old/traditional 68000 cores are basically all the same, at 16.
@@ -166,6 +194,11 @@ void __init setup_arch(char **cmdline_p)
* Get kmalloc into gear.
*/
paging_init();
+
+#ifdef CONFIG_EMBEDDED_DTB
+ m68k_setup_fdt();
+ m68k_dtb_model();
+#endif
}
/*
diff --git a/arch/m68k/kernel/vmlinux-nommu.lds b/arch/m68k/kernel/vmlinux-nommu.lds
index 2624fc18c131..1be3bfe31ba4 100644
--- a/arch/m68k/kernel/vmlinux-nommu.lds
+++ b/arch/m68k/kernel/vmlinux-nommu.lds
@@ -70,6 +70,15 @@ SECTIONS {
INIT_TEXT_SECTION(PAGE_SIZE)
INIT_DATA_SECTION(16)
PERCPU_SECTION(16)
+
+#ifdef CONFIG_EMBEDDED_DTB
+ STRUCT_ALIGN();
+ .embedded_dtb : {
+ embedded_dtb = .;
+ *(.embedded_dtb)
+ KEEP(*(.embedded_dtb))
+ }
+#endif
.m68k_fixup : {
__start_fixup = .;
*(.m68k_fixup)
--
2.43.0
^ permalink raw reply related [flat|nested] 22+ messages in thread* Re: [PATCH 10/13] m68k: implement an embedded devicetree for nonmmu
2025-02-18 12:46 ` [PATCH 10/13] m68k: implement an embedded devicetree for nonmmu Greg Ungerer
@ 2025-02-20 14:06 ` Geert Uytterhoeven
2025-02-23 14:25 ` Greg Ungerer
0 siblings, 1 reply; 22+ messages in thread
From: Geert Uytterhoeven @ 2025-02-20 14:06 UTC (permalink / raw)
To: Greg Ungerer; +Cc: linux-m68k
Hi Greg,
On Tue, 18 Feb 2025 at 13:54, Greg Ungerer <gerg@linux-m68k.org> wrote:
> If there is no capability for the boot loader to specify a devicetree
> blob then this option allows for it to be embedded within the linux
> kernel binary itself. This change specifically adds this embedding
> support for the m68knommu targets.
>
> Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
Thanks for your patch!
> --- a/arch/m68k/Kconfig.devices
> +++ b/arch/m68k/Kconfig.devices
> @@ -144,3 +144,14 @@ config SERIAL_CONSOLE
> endmenu
>
> endif
> +
> +config EMBEDDED_DTB
BUILTIN_DTB
> + bool "Embedded devicetree ELF section"
select GENERIC_BUILTIN_DTB
> + help
> + If there is no capability for the boot loader to specify a
> + devicetree (DTB) then this option allows for it to be embedbed
> + within the linux binary itself. Typically you can do this with
> + something like this:
> +
> + objcopy --update-section .embedded_dtb=<filename>.dtb vmlinux
> +
> --- a/arch/m68k/kernel/vmlinux-nommu.lds
> +++ b/arch/m68k/kernel/vmlinux-nommu.lds
> @@ -70,6 +70,15 @@ SECTIONS {
> INIT_TEXT_SECTION(PAGE_SIZE)
> INIT_DATA_SECTION(16)
> PERCPU_SECTION(16)
> +
> +#ifdef CONFIG_EMBEDDED_DTB
> + STRUCT_ALIGN();
> + .embedded_dtb : {
> + embedded_dtb = .;
> + *(.embedded_dtb)
> + KEEP(*(.embedded_dtb))
> + }
> +#endif
> .m68k_fixup : {
> __start_fixup = .;
> *(.m68k_fixup)
Please use the existing DTB support in include/asm-generic/vmlinux.lds.h.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 22+ messages in thread* Re: [PATCH 10/13] m68k: implement an embedded devicetree for nonmmu
2025-02-20 14:06 ` Geert Uytterhoeven
@ 2025-02-23 14:25 ` Greg Ungerer
0 siblings, 0 replies; 22+ messages in thread
From: Greg Ungerer @ 2025-02-23 14:25 UTC (permalink / raw)
To: Geert Uytterhoeven; +Cc: linux-m68k
Hi Geert,
On 21/2/25 00:06, Geert Uytterhoeven wrote:
> Hi Greg,
>
> On Tue, 18 Feb 2025 at 13:54, Greg Ungerer <gerg@linux-m68k.org> wrote:
>> If there is no capability for the boot loader to specify a devicetree
>> blob then this option allows for it to be embedded within the linux
>> kernel binary itself. This change specifically adds this embedding
>> support for the m68knommu targets.
>>
>> Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
>
> Thanks for your patch!
>
>> --- a/arch/m68k/Kconfig.devices
>> +++ b/arch/m68k/Kconfig.devices
>> @@ -144,3 +144,14 @@ config SERIAL_CONSOLE
>> endmenu
>>
>> endif
>> +
>> +config EMBEDDED_DTB
>
> BUILTIN_DTB
>
>> + bool "Embedded devicetree ELF section"
>
> select GENERIC_BUILTIN_DTB
>
>> + help
>> + If there is no capability for the boot loader to specify a
>> + devicetree (DTB) then this option allows for it to be embedbed
>> + within the linux binary itself. Typically you can do this with
>> + something like this:
>> +
>> + objcopy --update-section .embedded_dtb=<filename>.dtb vmlinux
>> +
>
>> --- a/arch/m68k/kernel/vmlinux-nommu.lds
>> +++ b/arch/m68k/kernel/vmlinux-nommu.lds
>> @@ -70,6 +70,15 @@ SECTIONS {
>> INIT_TEXT_SECTION(PAGE_SIZE)
>> INIT_DATA_SECTION(16)
>> PERCPU_SECTION(16)
>> +
>> +#ifdef CONFIG_EMBEDDED_DTB
>> + STRUCT_ALIGN();
>> + .embedded_dtb : {
>> + embedded_dtb = .;
>> + *(.embedded_dtb)
>> + KEEP(*(.embedded_dtb))
>> + }
>> +#endif
>> .m68k_fixup : {
>> __start_fixup = .;
>> *(.m68k_fixup)
>
> Please use the existing DTB support in include/asm-generic/vmlinux.lds.h.
Oh yes, that is much better. Using CONFIG_BUILTIN_DTB_NAME simplifies
it all a lot more too. Will use that in the next version.
Thanks
Greg
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 11/13] m68k: implement an embedded devicetree for mm targets
2025-02-18 12:46 [PATCH 00/13] m68k: coldfire: proof-of-concept devicetree Greg Ungerer
` (9 preceding siblings ...)
2025-02-18 12:46 ` [PATCH 10/13] m68k: implement an embedded devicetree for nonmmu Greg Ungerer
@ 2025-02-18 12:46 ` Greg Ungerer
2025-02-18 12:46 ` [PATCH 12/13] m68k: coldfire: disable platform device tree entries Greg Ungerer
2025-02-18 12:46 ` [PATCH 13/13] m68k: coldfire: enable devicetree use Greg Ungerer
12 siblings, 0 replies; 22+ messages in thread
From: Greg Ungerer @ 2025-02-18 12:46 UTC (permalink / raw)
To: linux-m68k; +Cc: Greg Ungerer
Add code to support using an embedded DTB for all m68k mm targets as well
as the nommu ones.
Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
---
arch/m68k/kernel/setup_mm.c | 33 ++++++++++++++++++++++++++++++++
arch/m68k/kernel/vmlinux-std.lds | 10 ++++++++++
2 files changed, 43 insertions(+)
diff --git a/arch/m68k/kernel/setup_mm.c b/arch/m68k/kernel/setup_mm.c
index 15c1a595a1de..ef871a78eb78 100644
--- a/arch/m68k/kernel/setup_mm.c
+++ b/arch/m68k/kernel/setup_mm.c
@@ -27,6 +27,8 @@
#include <linux/nvram.h>
#include <linux/initrd.h>
#include <linux/random.h>
+#include <linux/of.h>
+#include <linux/of_fdt.h>
#include <asm/bootinfo.h>
#include <asm/byteorder.h>
@@ -204,6 +206,32 @@ static void __init m68k_parse_bootinfo(const struct bi_record *record)
#endif
}
+#ifdef CONFIG_EMBEDDED_DTB
+static void __init m68k_setup_fdt(void)
+{
+ extern void *embedded_dtb;
+ phys_addr_t fdt = (phys_addr_t) &embedded_dtb;
+
+ pr_info("m68k generic DT machine support, FDT blob at 0x%08x\n", fdt);
+ if (!early_init_dt_verify(__va(fdt), fdt)) {
+ pr_err("FDT blob is bad?!\n");
+ return;
+ }
+ early_init_dt_scan_nodes();
+ unflatten_device_tree();
+}
+
+static void __init m68k_dtb_model(void)
+{
+ const char *model;
+ model = of_flat_dt_get_machine_name();
+ if (model)
+ pr_info("DTB reports model \"%s\"\n", model);
+ else
+ pr_warn("DTB has no model type?\n");
+}
+#endif /* CONFIG_EMBEDDED_DTB */
+
void __init setup_arch(char **cmdline_p)
{
/* The bootinfo is located right after the kernel */
@@ -334,6 +362,11 @@ void __init setup_arch(char **cmdline_p)
paging_init();
+#ifdef CONFIG_EMBEDDED_DTB
+ m68k_setup_fdt();
+ m68k_dtb_model();
+#endif
+
if (IS_ENABLED(CONFIG_BLK_DEV_INITRD) && m68k_ramdisk.size) {
initrd_start = (unsigned long)phys_to_virt(m68k_ramdisk.addr);
initrd_end = initrd_start + m68k_ramdisk.size;
diff --git a/arch/m68k/kernel/vmlinux-std.lds b/arch/m68k/kernel/vmlinux-std.lds
index 1ccdd04ae462..45389a9a2356 100644
--- a/arch/m68k/kernel/vmlinux-std.lds
+++ b/arch/m68k/kernel/vmlinux-std.lds
@@ -43,6 +43,16 @@ SECTIONS
__init_begin = .;
INIT_TEXT_SECTION(PAGE_SIZE) :data
INIT_DATA_SECTION(16)
+
+#ifdef CONFIG_EMBEDDED_DTB
+ STRUCT_ALIGN();
+ .embedded_dtb : {
+ embedded_dtb = .;
+ *(.embedded_dtb)
+ KEEP(*(.embedded_dtb))
+ }
+#endif
+
.m68k_fixup : {
__start_fixup = .;
*(.m68k_fixup)
--
2.43.0
^ permalink raw reply related [flat|nested] 22+ messages in thread* [PATCH 12/13] m68k: coldfire: disable platform device tree entries
2025-02-18 12:46 [PATCH 00/13] m68k: coldfire: proof-of-concept devicetree Greg Ungerer
` (10 preceding siblings ...)
2025-02-18 12:46 ` [PATCH 11/13] m68k: implement an embedded devicetree for mm targets Greg Ungerer
@ 2025-02-18 12:46 ` Greg Ungerer
2025-02-18 12:46 ` [PATCH 13/13] m68k: coldfire: enable devicetree use Greg Ungerer
12 siblings, 0 replies; 22+ messages in thread
From: Greg Ungerer @ 2025-02-18 12:46 UTC (permalink / raw)
To: linux-m68k; +Cc: Greg Ungerer
If devicetree is enabled for ColdFire platforms then remove the devices
that are supported by a devicetree from the platform device table.
This is done conditionally for now, until a full conversion to use of
devicetree has been completed. Specifically the ColdFire UART and the
FEC ethernet module can currently be supported by devicetree entries.
Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
---
arch/m68k/coldfire/device.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/m68k/coldfire/device.c b/arch/m68k/coldfire/device.c
index 8d7cec28f4d9..e802496d9852 100644
--- a/arch/m68k/coldfire/device.c
+++ b/arch/m68k/coldfire/device.c
@@ -24,6 +24,7 @@
#include <linux/platform_data/dma-mcf-edma.h>
#include <linux/platform_data/mmc-esdhc-mcf.h>
+#ifndef CONFIG_OF
/*
* All current ColdFire parts contain from 2, 3, 4 or 10 UARTS.
*/
@@ -317,6 +318,7 @@ static struct platform_device mcf_fec1 = {
}
};
#endif /* MCFFEC_BASE1 */
+#endif /* !CONFIG_OF */
#if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI)
/*
@@ -757,6 +759,7 @@ static struct platform_device mcf_flexcan0 = {
#endif /* MCFFLEXCAN_SIZE */
static struct platform_device *mcf_devices[] __initdata = {
+#ifndef CONFIG_OF
&mcf_uart0,
#ifdef MCFUART_BASE1
&mcf_uart1,
@@ -791,6 +794,7 @@ static struct platform_device *mcf_devices[] __initdata = {
#ifdef MCFFEC_BASE1
&mcf_fec1,
#endif
+#endif /* !CONFIG_OF */
#if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI)
&mcf_qspi,
#endif
--
2.43.0
^ permalink raw reply related [flat|nested] 22+ messages in thread* [PATCH 13/13] m68k: coldfire: enable devicetree use
2025-02-18 12:46 [PATCH 00/13] m68k: coldfire: proof-of-concept devicetree Greg Ungerer
` (11 preceding siblings ...)
2025-02-18 12:46 ` [PATCH 12/13] m68k: coldfire: disable platform device tree entries Greg Ungerer
@ 2025-02-18 12:46 ` Greg Ungerer
12 siblings, 0 replies; 22+ messages in thread
From: Greg Ungerer @ 2025-02-18 12:46 UTC (permalink / raw)
To: linux-m68k; +Cc: Greg Ungerer
With minimal devicetree support in place enable the devicetree kernel
configuration options to use it on ColdFire platforms.
This is purely a proof-of-concept change. It is enough to use basic
devicetrees on the MCF5208EVB and M5475EVB platforms.
Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
---
arch/m68k/Kconfig | 2 ++
arch/m68k/Kconfig.cpu | 1 +
2 files changed, 3 insertions(+)
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index b2ed0308c0ea..be87aef84373 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -41,6 +41,8 @@ config M68K
select OLD_SIGSUSPEND3
select UACCESS_MEMCPY if !MMU
select ZONE_DMA
+ select OF if COLDFIRE
+ select OF_EARLY_FLATTREE if COLDFIRE
config CPU_BIG_ENDIAN
def_bool y
diff --git a/arch/m68k/Kconfig.cpu b/arch/m68k/Kconfig.cpu
index 50ecb16d0a1f..e2dce38607cf 100644
--- a/arch/m68k/Kconfig.cpu
+++ b/arch/m68k/Kconfig.cpu
@@ -31,6 +31,7 @@ config COLDFIRE
select GENERIC_CSUM
select GPIOLIB
select COMMON_CLK
+ select IRQ_DOMAIN
select HAVE_PAGE_SIZE_8KB if !MMU
config SUN3
--
2.43.0
^ permalink raw reply related [flat|nested] 22+ messages in thread