linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] mips: mscc: build FIT image for Ocelot
@ 2018-06-26 11:57 Alexandre Belloni
  2018-06-26 11:57 ` [PATCH v2 2/2] mips: generic: allow not building DTB in Alexandre Belloni
  0 siblings, 1 reply; 4+ messages in thread
From: Alexandre Belloni @ 2018-06-26 11:57 UTC (permalink / raw)
  To: James Hogan, Ralf Baechle
  Cc: Paul Burton, linux-mips, linux-kernel, Alexandre Belloni

Ocelot now has a u-boot port, allow building FIT images instead of relying
on the legacy detection and builtin DTB.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Reviewed-by: James Hogan <jhogan@kernel.org>
---
Changes in v2:
 - require -> requires

 arch/mips/boot/dts/mscc/Makefile            |  2 +-
 arch/mips/generic/Kconfig                   | 12 +++++++++--
 arch/mips/generic/Platform                  |  1 +
 arch/mips/generic/board-ocelot_pcb123.its.S | 23 +++++++++++++++++++++
 4 files changed, 35 insertions(+), 3 deletions(-)
 create mode 100644 arch/mips/generic/board-ocelot_pcb123.its.S

diff --git a/arch/mips/boot/dts/mscc/Makefile b/arch/mips/boot/dts/mscc/Makefile
index 3c6aed9f5439..9a9bb7ea0503 100644
--- a/arch/mips/boot/dts/mscc/Makefile
+++ b/arch/mips/boot/dts/mscc/Makefile
@@ -1,3 +1,3 @@
-dtb-$(CONFIG_LEGACY_BOARD_OCELOT)	+= ocelot_pcb123.dtb
+dtb-$(CONFIG_MSCC_OCELOT)	+= ocelot_pcb123.dtb
 
 obj-$(CONFIG_BUILTIN_DTB)	+= $(addsuffix .o, $(dtb-y))
diff --git a/arch/mips/generic/Kconfig b/arch/mips/generic/Kconfig
index ba9b2c8cce68..08e33c6b2539 100644
--- a/arch/mips/generic/Kconfig
+++ b/arch/mips/generic/Kconfig
@@ -35,13 +35,13 @@ config LEGACY_BOARD_OCELOT
 	depends on LEGACY_BOARD_SEAD3=n
 	select LEGACY_BOARDS
 	select MSCC_OCELOT
+	select SYS_HAS_EARLY_PRINTK
+	select USE_GENERIC_EARLY_PRINTK_8250
 
 config MSCC_OCELOT
 	bool
 	select GPIOLIB
 	select MSCC_OCELOT_IRQ
-	select SYS_HAS_EARLY_PRINTK
-	select USE_GENERIC_EARLY_PRINTK_8250
 
 comment "FIT/UHI Boards"
 
@@ -65,6 +65,14 @@ config FIT_IMAGE_FDT_XILFPGA
 	  Enable this to include the FDT for the MIPSfpga platform
 	  from Imagination Technologies in the FIT kernel image.
 
+config FIT_IMAGE_FDT_OCELOT_PCB123
+	bool "Include FDT for Microsemi Ocelot PCB123"
+	select MSCC_OCELOT
+	help
+	  Enable this to include the FDT for the Ocelot PCB123 platform
+	  from Microsemi in the FIT kernel image.
+	  This requires u-boot on the platform.
+
 config VIRT_BOARD_RANCHU
 	bool "Support Ranchu platform for Android emulator"
 	help
diff --git a/arch/mips/generic/Platform b/arch/mips/generic/Platform
index 0dd0d5d460a5..879cb80396c8 100644
--- a/arch/mips/generic/Platform
+++ b/arch/mips/generic/Platform
@@ -16,4 +16,5 @@ all-$(CONFIG_MIPS_GENERIC)	:= vmlinux.gz.itb
 its-y					:= vmlinux.its.S
 its-$(CONFIG_FIT_IMAGE_FDT_BOSTON)	+= board-boston.its.S
 its-$(CONFIG_FIT_IMAGE_FDT_NI169445)	+= board-ni169445.its.S
+its-$(CONFIG_FIT_IMAGE_FDT_OCELOT_PCB123) += board-ocelot_pcb123.its.S
 its-$(CONFIG_FIT_IMAGE_FDT_XILFPGA)	+= board-xilfpga.its.S
diff --git a/arch/mips/generic/board-ocelot_pcb123.its.S b/arch/mips/generic/board-ocelot_pcb123.its.S
new file mode 100644
index 000000000000..5a7d5e1c878a
--- /dev/null
+++ b/arch/mips/generic/board-ocelot_pcb123.its.S
@@ -0,0 +1,23 @@
+/* SPDX-License-Identifier: (GPL-2.0 OR MIT) */
+/ {
+	images {
+		fdt@ocelot_pcb123 {
+			description = "MSCC Ocelot PCB123 Device Tree";
+			data = /incbin/("boot/dts/mscc/ocelot_pcb123.dtb");
+			type = "flat_dt";
+			arch = "mips";
+			compression = "none";
+			hash@0 {
+				algo = "sha1";
+			};
+		};
+	};
+
+	configurations {
+		conf@ocelot_pcb123 {
+			description = "Ocelot Linux kernel";
+			kernel = "kernel@0";
+			fdt = "fdt@ocelot_pcb123";
+		};
+	};
+};
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2 2/2] mips: generic: allow not building DTB in
  2018-06-26 11:57 [PATCH v2 1/2] mips: mscc: build FIT image for Ocelot Alexandre Belloni
@ 2018-06-26 11:57 ` Alexandre Belloni
  2018-06-26 14:07   ` Alexandre Belloni
  0 siblings, 1 reply; 4+ messages in thread
From: Alexandre Belloni @ 2018-06-26 11:57 UTC (permalink / raw)
  To: James Hogan, Ralf Baechle
  Cc: Paul Burton, linux-mips, linux-kernel, Alexandre Belloni

Allow not building any DTB in the generic kernel so it gets smaller. This
is necessary for ocelot because it can be built as a legacy platform that
needs a built-in DTB and it can also handle a separate DTB once it is
updated with a more modern bootloader. In the latter case, it is preferable
to not include any DTB in the kernel image so it is smaller.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
Changes in v2:
 - rebased on v4.18-rc1

 arch/mips/Kconfig               | 1 -
 arch/mips/Makefile              | 2 +-
 arch/mips/generic/Kconfig       | 1 +
 arch/mips/generic/vmlinux.its.S | 2 ++
 4 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 3f9deec70b92..2cc43f51fa6f 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -85,7 +85,6 @@ choice
 config MIPS_GENERIC
 	bool "Generic board-agnostic MIPS kernel"
 	select BOOT_RAW
-	select BUILTIN_DTB
 	select CEVT_R4K
 	select CLKSRC_MIPS_GIC
 	select COMMON_CLK
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index e2122cca4ae2..5c5d491d736e 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -401,7 +401,7 @@ endif
 CLEAN_FILES += vmlinux.32 vmlinux.64
 
 # device-trees
-core-$(CONFIG_BUILTIN_DTB) += arch/mips/boot/dts/
+core-y += arch/mips/boot/dts/
 
 %.dtb %.dtb.S %.dtb.o: | scripts
 	$(Q)$(MAKE) $(build)=arch/mips/boot/dts arch/mips/boot/dts/$@
diff --git a/arch/mips/generic/Kconfig b/arch/mips/generic/Kconfig
index 08e33c6b2539..13692b84928e 100644
--- a/arch/mips/generic/Kconfig
+++ b/arch/mips/generic/Kconfig
@@ -3,6 +3,7 @@ if MIPS_GENERIC
 
 config LEGACY_BOARDS
 	bool
+	select BUILTIN_DTB
 	help
 	  Select this from your board if the board must use a legacy, non-UHI,
 	  boot protocol. This will cause the kernel to scan through the list of
diff --git a/arch/mips/generic/vmlinux.its.S b/arch/mips/generic/vmlinux.its.S
index 1a08438fd893..9c954f2ae561 100644
--- a/arch/mips/generic/vmlinux.its.S
+++ b/arch/mips/generic/vmlinux.its.S
@@ -21,6 +21,7 @@
 		};
 	};
 
+#if IS_ENABLED(CONFIG_BUILTIN_DTB)
 	configurations {
 		default = "conf@default";
 
@@ -29,4 +30,5 @@
 			kernel = "kernel@0";
 		};
 	};
+#endif
 };
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 2/2] mips: generic: allow not building DTB in
  2018-06-26 11:57 ` [PATCH v2 2/2] mips: generic: allow not building DTB in Alexandre Belloni
@ 2018-06-26 14:07   ` Alexandre Belloni
  2018-06-27 16:01     ` Paul Burton
  0 siblings, 1 reply; 4+ messages in thread
From: Alexandre Belloni @ 2018-06-26 14:07 UTC (permalink / raw)
  To: James Hogan, Ralf Baechle; +Cc: Paul Burton, linux-mips, linux-kernel

On 26/06/2018 13:57:12+0200, Alexandre Belloni wrote:
> Allow not building any DTB in the generic kernel so it gets smaller. This
> is necessary for ocelot because it can be built as a legacy platform that
> needs a built-in DTB and it can also handle a separate DTB once it is
> updated with a more modern bootloader. In the latter case, it is preferable
> to not include any DTB in the kernel image so it is smaller.
> 
> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
> ---
> Changes in v2:
>  - rebased on v4.18-rc1
> 

Note that while the first patch can probably be applied as-is (it only
affects Ocelot). this one still needs to be refined. It seems to be
causing build issues with some defconfig.

>  arch/mips/Kconfig               | 1 -
>  arch/mips/Makefile              | 2 +-
>  arch/mips/generic/Kconfig       | 1 +
>  arch/mips/generic/vmlinux.its.S | 2 ++
>  4 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
> index 3f9deec70b92..2cc43f51fa6f 100644
> --- a/arch/mips/Kconfig
> +++ b/arch/mips/Kconfig
> @@ -85,7 +85,6 @@ choice
>  config MIPS_GENERIC
>  	bool "Generic board-agnostic MIPS kernel"
>  	select BOOT_RAW
> -	select BUILTIN_DTB
>  	select CEVT_R4K
>  	select CLKSRC_MIPS_GIC
>  	select COMMON_CLK
> diff --git a/arch/mips/Makefile b/arch/mips/Makefile
> index e2122cca4ae2..5c5d491d736e 100644
> --- a/arch/mips/Makefile
> +++ b/arch/mips/Makefile
> @@ -401,7 +401,7 @@ endif
>  CLEAN_FILES += vmlinux.32 vmlinux.64
>  
>  # device-trees
> -core-$(CONFIG_BUILTIN_DTB) += arch/mips/boot/dts/
> +core-y += arch/mips/boot/dts/
>  
>  %.dtb %.dtb.S %.dtb.o: | scripts
>  	$(Q)$(MAKE) $(build)=arch/mips/boot/dts arch/mips/boot/dts/$@
> diff --git a/arch/mips/generic/Kconfig b/arch/mips/generic/Kconfig
> index 08e33c6b2539..13692b84928e 100644
> --- a/arch/mips/generic/Kconfig
> +++ b/arch/mips/generic/Kconfig
> @@ -3,6 +3,7 @@ if MIPS_GENERIC
>  
>  config LEGACY_BOARDS
>  	bool
> +	select BUILTIN_DTB
>  	help
>  	  Select this from your board if the board must use a legacy, non-UHI,
>  	  boot protocol. This will cause the kernel to scan through the list of
> diff --git a/arch/mips/generic/vmlinux.its.S b/arch/mips/generic/vmlinux.its.S
> index 1a08438fd893..9c954f2ae561 100644
> --- a/arch/mips/generic/vmlinux.its.S
> +++ b/arch/mips/generic/vmlinux.its.S
> @@ -21,6 +21,7 @@
>  		};
>  	};
>  
> +#if IS_ENABLED(CONFIG_BUILTIN_DTB)

Thinking more about that, the conf@default configuration should probably
not be removed if the platform is not using DT at all. Are there still
MIPS platforms without DT support?

>  	configurations {
>  		default = "conf@default";
>  
> @@ -29,4 +30,5 @@
>  			kernel = "kernel@0";
>  		};
>  	};
> +#endif
>  };
> -- 
> 2.18.0
> 

-- 
Alexandre Belloni, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 2/2] mips: generic: allow not building DTB in
  2018-06-26 14:07   ` Alexandre Belloni
@ 2018-06-27 16:01     ` Paul Burton
  0 siblings, 0 replies; 4+ messages in thread
From: Paul Burton @ 2018-06-27 16:01 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: James Hogan, Ralf Baechle, Paul Burton, linux-mips, linux-kernel

Hi Alexandre,

On Tue, Jun 26, 2018 at 04:07:43PM +0200, Alexandre Belloni wrote:
> > diff --git a/arch/mips/generic/vmlinux.its.S b/arch/mips/generic/vmlinux.its.S
> > index 1a08438fd893..9c954f2ae561 100644
> > --- a/arch/mips/generic/vmlinux.its.S
> > +++ b/arch/mips/generic/vmlinux.its.S
> > @@ -21,6 +21,7 @@
> >  		};
> >  	};
> >  
> > +#if IS_ENABLED(CONFIG_BUILTIN_DTB)
> 
> Thinking more about that, the conf@default configuration should probably
> not be removed if the platform is not using DT at all. Are there still
> MIPS platforms without DT support?

There are, but not ones that are supported by the generic platform so we
don't need to worry about those here. We basically have 2 cases to
consider:

  1) FDT as an image within the FIT.

  2) FDT embedded within the kernel binary, ie. legacy boards like
     SEAD-3 (& Malta when I get its port to generic upstreamed).

Case 2 is where conf@default is most useful, since it allows the FIT
image to be loaded (presuming the board has a new enough bootloader)
without the bootloader knowing anything about the FDT. Legacy boards
with the DT built into the kernel then figure out which to use based on
the detect function given in their struct mips_machine.

So I think the most natural #ifdef here might be on
CONFIG_LEGACY_BOARDS, since it would be a little easier to understand at
a glance where the configuration is useful.

Thanks,
    Paul

> >  	configurations {
> >  		default = "conf@default";
> >  
> > @@ -29,4 +30,5 @@
> >  			kernel = "kernel@0";
> >  		};
> >  	};
> > +#endif
> >  };

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-06-27 16:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-26 11:57 [PATCH v2 1/2] mips: mscc: build FIT image for Ocelot Alexandre Belloni
2018-06-26 11:57 ` [PATCH v2 2/2] mips: generic: allow not building DTB in Alexandre Belloni
2018-06-26 14:07   ` Alexandre Belloni
2018-06-27 16:01     ` Paul Burton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).