m68k: coldfire: proof-of-concept devicetree
Subsystems (6)
Greg Ungerer
maintainercover m68k: coldfire: proof-of-concept devicetree
Proof of Concept only - not for merging.
The following patch set is a minimal conversion of two ColdFire platforms from using the legacy style platform device configuration to using a devicetree. The two platform types supported here are one each of a full MMU target (M5475EVB) and nommu (M5208EVB).
It takes a few short cuts (that is hacks) to prove it is possible and show how it can be done. The problems and more work required include:
. proper conversion to use clock framework
. proper resource setup for interrupt controllers
. conversion of more ColdFire peripherals to use devicetree . cleanup of changes for sending to appropriate lists/maintainers
--- arch/m68k/Kconfig.cpu | 1 arch/m68k/boot/dts/Makefile | 1 arch/m68k/coldfire/device.c | 4 b/Documentation/devicetree/bindings/net/fsl,fec.yaml | 1 b/arch/m68k/Kconfig | 2 b/arch/m68k/Kconfig.cpu | 2 b/arch/m68k/Kconfig.devices | 11 b/arch/m68k/boot/dts/Makefile | 4 b/arch/m68k/boot/dts/mcf5208evb.dts | 57 ++++ b/arch/m68k/boot/dts/mcf5475evb.dts | 55 ++++ b/arch/m68k/coldfire/clk.c | 8 b/arch/m68k/coldfire/device.c | 221 ++++++++++++++++--- b/arch/m68k/coldfire/intc-2.c | 59 ++++- b/arch/m68k/coldfire/intc-simr.c | 61 ++++- b/arch/m68k/coldfire/intc.c | 50 +++- b/arch/m68k/include/asm/mcfuart.h | 12 - b/arch/m68k/kernel/Makefile | 1 b/arch/m68k/kernel/embedded_dtb.S | 19 + b/arch/m68k/kernel/setup_mm.c | 33 ++ b/arch/m68k/kernel/setup_no.c | 33 ++ b/arch/m68k/kernel/vmlinux-nommu.lds | 9 b/arch/m68k/kernel/vmlinux-std.lds | 10 b/drivers/net/ethernet/freescale/fec_main.c | 5 b/drivers/tty/serial/mcf.c | 49 ++-- drivers/tty/serial/mcf.c | 12 + 25 files changed, 627 insertions(+), 93 deletions(-)
Greg Ungerer
maintainerPATCH 1/13 serial: mcf: convert to use proper platform resources
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.
--- 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(-)
arch/m68k/coldfire/device.c +191 -30
@@ -1,7 +1,7 @@/* * device.c -- common ColdFire SoC device support * -* (C) Copyright 2011, Greg Ungerer <[email protected]> +* (C) Copyright 2011,2025 Greg Ungerer <[email protected]> * * 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
arch/m68k/include/asm/mcfuart.h +1 -11
@@ -4,7 +4,7 @@/* * mcfuart.h -- ColdFire internal UART support defines. * -* (C) Copyright 1999-2003, Greg Ungerer ([email protected]) +* (C) Copyright 1999-2003, 2025 Greg Ungerer ([email protected]) * (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. */
drivers/tty/serial/mcf.c +26 -23
71 lines not on this page · raw message
Signature · 1 line
2.43.0
Greg Ungerer
maintainerPATCH 2/13 serial: mcf: add devicetree support
In reply to Greg UngererAdd basic support for probing the ColdFire UARTS via a devicetree.
--- drivers/tty/serial/mcf.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/tty/serial/mcf.c +12 -0
@@ -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, }, };
Signature · 1 line
2.43.0
Greg Ungerer
maintainerPATCH 3/13 net: fec: add device tree support for ColdFire FEC
In reply to Greg UngererThe 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.
--- Documentation/devicetree/bindings/net/fsl,fec.yaml | 1 + drivers/net/ethernet/freescale/fec_main.c | 5 +++++ 2 files changed, 6 insertions(+)
Documentation/devicetree/bindings/net/fsl,fec.yaml +1 -0
@@ -24,6 +24,7 @@ properties: - fsl,imx6q-fec - fsl,mvf600-fec - fsl,s32v234-fec + - fsl,m5208-fec - items: - enum: - fsl,imx53-fec
drivers/net/ethernet/freescale/fec_main.c +5 -0
@@ -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);
Signature · 1 line
2.43.0
Re: [PATCH 03/13] net: fec: add device tree support for ColdFire FEC
Quoted 7 lines · 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 <[email protected]>--- 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
Greg Ungerer
maintainerRe: [PATCH 03/13] net: fec: add device tree support for ColdFire FEC
Quoted 11 lines · Krzysztof Kozlowski
Quoted 7 lines · 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 <[email protected]>--- Documentation/devicetree/bindings/net/fsl,fec.yaml | 1 +Please run
scripts/checkpatch.pland fix reported warnings. After that, run alsoscripts/checkpatch.pl --strictand (probably) fix more
I did. I chose to ignore the documentation and frivolous formatting warnings for now. See cover letter for reasoning.
Regards
Greg
Quoted 27 lines
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 usescripts/get_maintainers.plto 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.plprovide 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 aboutb4 prep --auto-to-ccif 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
Greg Ungerer
maintainerPATCH 4/13 m68k: coldfire: enable common clock framework
In reply to Greg UngererEnable 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.
--- arch/m68k/Kconfig.cpu | 2 +- arch/m68k/coldfire/clk.c | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-)
arch/m68k/Kconfig.cpu +1 -1
@@ -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
arch/m68k/coldfire/clk.c +6 -2
@@ -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 */ +/***************************************************************************/
Signature · 1 line
2.43.0
Greg Ungerer
maintainerPATCH 5/13 m68k: coldfire: support devicetree binding for intc-simr
In reply to Greg UngererAdd 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.
--- arch/m68k/coldfire/intc-simr.c | 61 +++++++++++++++++++++++++++++----- 1 file changed, 52 insertions(+), 9 deletions(-)
arch/m68k/coldfire/intc-simr.c +52 -9
@@ -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 */
Signature · 1 line
2.43.0
Greg Ungerer
maintainerPATCH 6/13 m68k: coldfire: support devicetree binding for intc controller
In reply to Greg UngererAdd 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.
--- arch/m68k/coldfire/intc.c | 50 +++++++++++++++++++++++++++++++++------ 1 file changed, 43 insertions(+), 7 deletions(-)
arch/m68k/coldfire/intc.c +43 -7
@@ -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 */
Signature · 1 line
2.43.0
Greg Ungerer
maintainerPATCH 7/13 m68k: coldfire: support devicetree binding for intc-2 controller
In reply to Greg UngererAdd 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.
--- arch/m68k/coldfire/intc-2.c | 59 ++++++++++++++++++++++++++++++------- 1 file changed, 49 insertions(+), 10 deletions(-)
arch/m68k/coldfire/intc-2.c +49 -10
@@ -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 */
Signature · 1 line
2.43.0
Greg Ungerer
maintainerPATCH 8/13 m68k: coldfire: add devicetree for mcf5208-evb platform
In reply to Greg UngererAdd a simple devicetree to support the Freescale MCF5208-EVB platform.
--- 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
arch/m68k/boot/dts/Makefile new file +4 -0
@@ -0,0 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0 + +dtb-y += mcf5208evb.dtb +
arch/m68k/boot/dts/mcf5208evb.dts new file +57 -0
57 lines not on this page · raw message
Signature · 1 line
2.43.0
Greg Ungerer
maintainerPATCH 9/13 m68k: coldfire: add devicetree for mcf5475-evb platform
In reply to Greg UngererAdd a simple devicetree to support the Freescale MCF5475-EVB platform.
--- 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
arch/m68k/boot/dts/Makefile +1 -0
@@ -1,4 +1,5 @@ # SPDX-License-Identifier: GPL-2.0 dtb-y += mcf5208evb.dtb +dtb-y += mcf5475evb.dtb
arch/m68k/boot/dts/mcf5475evb.dts new file +55 -0
55 lines not on this page · raw message
Signature · 1 line
2.43.0
Re: [PATCH 09/13] m68k: coldfire: add devicetree for mcf5475-evb platform
Quoted 25 lines · Greg Ungerer
Add a simple devicetree to support the Freescale MCF5475-EVB platform.
Signed-off-by Greg Ungerer <[email protected]>--- 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.dtsarch/m68k/boot/dts/Makefile +1
-0@@ -1,4 +1,5 @@ # SPDX-License-Identifier: GPL-2.0 dtb-y += mcf5208evb.dtb +dtb-y += mcf5475evb.dtbarch/m68k/boot/dts/mcf5475evb.dts new file +0
-0
arch/m68k/boot/dts/mcf5475evb.dts line 6
Quoted 6 lines
arch/m68k/boot/dts/mcf5475evb.dts new file +6
-0@@ -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.
Quoted 13 lines
arch/m68k/boot/dts/mcf5475evb.dts new file +13
-0+ #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;
arch/m68k/boot/dts/mcf5475evb.dts line 29
Quoted 10 lines
arch/m68k/boot/dts/mcf5475evb.dts new file +10
-0+ #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
Greg Ungerer
maintainerRe: [PATCH 09/13] m68k: coldfire: add devicetree for mcf5475-evb platform
Hi Krzysztof,
Quoted 35 lines · Krzysztof Kozlowski
Quoted 25 lines · Greg Ungerer
Add a simple devicetree to support the Freescale MCF5475-EVB platform.
Signed-off-by Greg Ungerer <[email protected]>--- 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.dtsarch/m68k/boot/dts/Makefile +1
-0@@ -1,4 +1,5 @@ # SPDX-License-Identifier: GPL-2.0 dtb-y += mcf5208evb.dtb +dtb-y += mcf5475evb.dtbarch/m68k/boot/dts/mcf5475evb.dts new file +0
-0arch/m68k/boot/dts/mcf5475evb.dts line 6
Quoted 6 lines
arch/m68k/boot/dts/mcf5475evb.dts new file +6
-0@@ -0,0 +1,55 @@ +// SPDX-License-Identifier: GPL-2.0 +/dts-v1/; + +/ { + model = "Freescale MCF5475EVB"; + compatible = "mcf5475evb";Incorrect format.
Quoted 5 lines
Please run
scripts/checkpatch.pland fix reported warnings. After that, run alsoscripts/checkpatch.pl --strictand (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.
Quoted 17 lines
Quoted 17 lines
arch/m68k/boot/dts/mcf5475evb.dts new file +17
-0+ #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>; + }; +
Quoted 8 lines
arch/m68k/boot/dts/mcf5475evb.dts line 29
Quoted 6 lines
arch/m68k/boot/dts/mcf5475evb.dts new file +6
-0+ uart0: serial@ff008600 { + compatible = "fsl,mcfuart"; + reg = <0xff008600 0x80>; + interrupts = <99>; + clocks = <&coreclk>; + status = "okay";Did you disable it anywhere?
No.
Regards
Greg
Re: [PATCH 09/13] m68k: coldfire: add devicetree for mcf5475-evb platform
Quoted 38 lines · Greg Ungerer
Hi Krzysztof,
Quoted 35 lines · Krzysztof Kozlowski
Quoted 25 lines · Greg Ungerer
Add a simple devicetree to support the Freescale MCF5475-EVB platform.
Signed-off-by Greg Ungerer <[email protected]>--- 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.dtsarch/m68k/boot/dts/Makefile +1
-0@@ -1,4 +1,5 @@ # SPDX-License-Identifier: GPL-2.0 dtb-y += mcf5208evb.dtb +dtb-y += mcf5475evb.dtbarch/m68k/boot/dts/mcf5475evb.dts new file +0
-0arch/m68k/boot/dts/mcf5475evb.dts line 6
Quoted 6 lines
arch/m68k/boot/dts/mcf5475evb.dts new file +6
-0@@ -0,0 +1,55 @@ +// SPDX-License-Identifier: GPL-2.0 +/dts-v1/; + +/ { + model = "Freescale MCF5475EVB"; + compatible = "mcf5475evb";Incorrect format.
Quoted 7 lines
Quoted 5 lines
Please run
scripts/checkpatch.pland fix reported warnings. After that, run alsoscripts/checkpatch.pl --strictand (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.
Quoted 9 lines
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.
Quoted 26 lines
Quoted 17 lines
Quoted 17 lines
arch/m68k/boot/dts/mcf5475evb.dts new file +17
-0+ #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>; + }; +Quoted 8 lines
arch/m68k/boot/dts/mcf5475evb.dts line 29
Quoted 6 lines
arch/m68k/boot/dts/mcf5475evb.dts new file +6
-0+ uart0: serial@ff008600 { + compatible = "fsl,mcfuart"; + reg = <0xff008600 0x80>; + interrupts = <99>; + clocks = <&coreclk>; + status = "okay";Did you disable it anywhere?
Quoted 1 line
No.
So no need for that status.
Best regards,
Krzysztof
Greg Ungerer
maintainerRe: [PATCH 09/13] m68k: coldfire: add devicetree for mcf5475-evb platform
Quoted 45 lines · Krzysztof Kozlowski
Quoted 44 lines · Greg Ungerer
Hi Krzysztof,
Quoted 40 lines · Krzysztof Kozlowski
Quoted 25 lines · Greg Ungerer
Add a simple devicetree to support the Freescale MCF5475-EVB platform.
Signed-off-by Greg Ungerer <[email protected]>--- 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.dtsarch/m68k/boot/dts/Makefile +1
-0@@ -1,4 +1,5 @@ # SPDX-License-Identifier: GPL-2.0 dtb-y += mcf5208evb.dtb +dtb-y += mcf5475evb.dtbarch/m68k/boot/dts/mcf5475evb.dts new file +0
-0arch/m68k/boot/dts/mcf5475evb.dts line 6
Quoted 6 lines
arch/m68k/boot/dts/mcf5475evb.dts new file +6
-0@@ -0,0 +1,55 @@ +// SPDX-License-Identifier: GPL-2.0 +/dts-v1/; + +/ { + model = "Freescale MCF5475EVB"; + compatible = "mcf5475evb";Incorrect format.
Please run
scripts/checkpatch.pland fix reported warnings. After that, run alsoscripts/checkpatch.pl --strictand (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.
Quoted 5 lines
Quoted 1 line
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
Quoted 47 lines
Quoted 9 lines
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.
Quoted 26 lines
Quoted 17 lines
Quoted 17 lines
arch/m68k/boot/dts/mcf5475evb.dts new file +17
-0+ #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>; + }; +Quoted 8 lines
arch/m68k/boot/dts/mcf5475evb.dts line 29
Quoted 6 lines
arch/m68k/boot/dts/mcf5475evb.dts new file +6
-0+ uart0: serial@ff008600 { + compatible = "fsl,mcfuart"; + reg = <0xff008600 0x80>; + interrupts = <99>; + clocks = <&coreclk>; + status = "okay";Did you disable it anywhere?
Quoted 1 line
No.
So no need for that status.
Best regards,
Krzysztof
Greg Ungerer
maintainerPATCH 10/13 m68k: implement an embedded devicetree for nonmmu
In reply to Greg UngererIf 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.
--- 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
arch/m68k/Kconfig.devices +11 -0
@@ -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 +
arch/m68k/kernel/Makefile +1 -0
@@ -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
arch/m68k/kernel/embedded_dtb.S new file +19 -0
@@ -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
arch/m68k/kernel/setup_no.c +33 -0
@@ -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 }/*
arch/m68k/kernel/vmlinux-nommu.lds +9 -0
@@ -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)
Signature · 1 line
2.43.0
Geert Uytterhoeven
maintainerRe: [PATCH 10/13] m68k: implement an embedded devicetree for nonmmu
Hi Greg,
Quoted 6 lines · 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 <[email protected]>
Thanks for your patch!
arch/m68k/Kconfig.devices config SERIAL_CONSOLE · line 148
Quoted 8 lines
arch/m68k/Kconfig.devices +2
-0@@ -144,3 +144,14 @@ config SERIAL_CONSOLE endmenu endif + +config EMBEDDED_DTB
BUILTIN_DTB
arch/m68k/Kconfig.devices config SERIAL_CONSOLE · line 149
Quoted 1 line
arch/m68k/Kconfig.devices +1
-0+ bool "Embedded devicetree ELF section"
select GENERIC_BUILTIN_DTB
Quoted 17 lines
arch/m68k/Kconfig.devices +8
-0+ 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 +arch/m68k/kernel/vmlinux-nommu.lds +2
-0@@ -70,6 +70,15 @@ SECTIONS { INIT_TEXT_SECTION(PAGE_SIZE) INIT_DATA_SECTION(16) PERCPU_SECTION(16) + +#ifdef CONFIG_EMBEDDED_DTB
arch/m68k/kernel/vmlinux-nommu.lds SECTIONS { · line 84
Quoted 10 lines
arch/m68k/kernel/vmlinux-nommu.lds +7
-0+ 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
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] 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
Greg Ungerer
maintainerRe: [PATCH 10/13] m68k: implement an embedded devicetree for nonmmu
Hi Geert,
Quoted 48 lines · Geert Uytterhoeven
Hi Greg,
Quoted 6 lines · 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 <[email protected]>Thanks for your patch!
arch/m68k/Kconfig.devices config SERIAL_CONSOLE · line 148
Quoted 8 lines
arch/m68k/Kconfig.devices +2
-0@@ -144,3 +144,14 @@ config SERIAL_CONSOLE endmenu endif + +config EMBEDDED_DTB
BUILTIN_DTBarch/m68k/Kconfig.devices config SERIAL_CONSOLE · line 149
Quoted 1 line
arch/m68k/Kconfig.devices +1
-0+ bool "Embedded devicetree ELF section"select
GENERIC_BUILTIN_DTBQuoted 21 lines
arch/m68k/Kconfig.devices +8
-0+ 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 +arch/m68k/kernel/vmlinux-nommu.lds +6
-0@@ -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)
Quoted 8 lines
arch/m68k/kernel/vmlinux-nommu.lds SECTIONS { · line 84
Quoted 6 lines
arch/m68k/kernel/vmlinux-nommu.lds +3
-0+ 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
Greg Ungerer
maintainerPATCH 11/13 m68k: implement an embedded devicetree for mm targets
In reply to Greg UngererAdd code to support using an embedded DTB for all m68k mm targets as well as the nommu ones.
--- arch/m68k/kernel/setup_mm.c | 33 ++++++++++++++++++++++++++++++++ arch/m68k/kernel/vmlinux-std.lds | 10 ++++++++++ 2 files changed, 43 insertions(+)
arch/m68k/kernel/setup_mm.c +33 -0
@@ -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;
arch/m68k/kernel/vmlinux-std.lds +10 -0
@@ -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)
Signature · 1 line
2.43.0
Greg Ungerer
maintainerPATCH 12/13 m68k: coldfire: disable platform device tree entries
In reply to Greg UngererIf 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.
--- arch/m68k/coldfire/device.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/m68k/coldfire/device.c +4 -0
@@ -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
Signature · 1 line
2.43.0
Greg Ungerer
maintainerPATCH 13/13 m68k: coldfire: enable devicetree use
In reply to Greg UngererWith 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.
--- arch/m68k/Kconfig | 2 ++ arch/m68k/Kconfig.cpu | 1 + 2 files changed, 3 insertions(+)
arch/m68k/Kconfig +2 -0
@@ -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
arch/m68k/Kconfig.cpu +1 -0
@@ -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
Signature · 1 line
2.43.0