diff mbox

[U-Boot,v2,4/5] MIPS: add initial infrastructure for device-tree files

Message ID 1450564990-17333-1-git-send-email-daniel.schwierzeck@gmail.com
State Superseded
Delegated to: Daniel Schwierzeck
Headers show

Commit Message

Daniel Schwierzeck Dec. 19, 2015, 10:43 p.m. UTC
Prepare sub-folder for device-tree files. Make support for
device-tree on MIPS available in Kbuild/Kconfig.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Purna Chandra Mandal <purna.mandal@microchip.com>


---

Changes in v2:
- add arch/mips/dts to clean list in dts/Makefile
- keep section .dtb during link in case of CONFIG_OF_EMBED

 arch/Kconfig                |  1 +
 arch/mips/config.mk         |  2 +-
 arch/mips/dts/.gitignore    |  1 +
 arch/mips/dts/Makefile      | 16 ++++++++++++++++
 arch/mips/dts/skeleton.dtsi | 23 +++++++++++++++++++++++
 dts/Makefile                |  2 +-
 6 files changed, 43 insertions(+), 2 deletions(-)
 create mode 100644 arch/mips/dts/.gitignore
 create mode 100644 arch/mips/dts/Makefile
 create mode 100644 arch/mips/dts/skeleton.dtsi

Comments

Purna Chandra Mandal Jan. 11, 2016, 11:25 a.m. UTC | #1
On 12/20/2015 04:13 AM, Daniel Schwierzeck wrote:
> Prepare sub-folder for device-tree files. Make support for
> device-tree on MIPS available in Kbuild/Kconfig.
>
> Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
> Signed-off-by: Purna Chandra Mandal <purna.mandal@microchip.com>
>
>
> ---
>
> Changes in v2:
> - add arch/mips/dts to clean list in dts/Makefile
> - keep section .dtb during link in case of CONFIG_OF_EMBED
>
>  arch/Kconfig                |  1 +
>  arch/mips/config.mk         |  2 +-
>  arch/mips/dts/.gitignore    |  1 +
>  arch/mips/dts/Makefile      | 16 ++++++++++++++++
>  arch/mips/dts/skeleton.dtsi | 23 +++++++++++++++++++++++
>  dts/Makefile                |  2 +-
>  6 files changed, 43 insertions(+), 2 deletions(-)
>  create mode 100644 arch/mips/dts/.gitignore
>  create mode 100644 arch/mips/dts/Makefile
>  create mode 100644 arch/mips/dts/skeleton.dtsi
>
> diff --git a/arch/Kconfig b/arch/Kconfig
> index 1709d40..ec12013 100644
> --- a/arch/Kconfig
> +++ b/arch/Kconfig
> @@ -55,6 +55,7 @@ config MIPS
>  	select HAVE_PRIVATE_LIBGCC
>  	select HAVE_GENERIC_BOARD
>  	select SYS_GENERIC_BOARD
> +	select SUPPORT_OF_CONTROL
>  
>  config NDS32
>  	bool "NDS32 architecture"
> diff --git a/arch/mips/config.mk b/arch/mips/config.mk
> index 415ec8a..3ebc202 100644
> --- a/arch/mips/config.mk
> +++ b/arch/mips/config.mk
> @@ -71,7 +71,7 @@ else
>  PF_ABICALLS			:= -mabicalls
>  PF_PIC				:= -fpic
>  PF_PIE				:= -pie
> -PF_OBJCOPY			:= -j .got -j .u_boot_list -j .rel.dyn -j .padding
> +PF_OBJCOPY			:= -j .got -j .u_boot_list -j .rel.dyn -j .padding -j .dtb
>  endif
>  

There is no section called '.dtb' in U-boot linker script, instead one generated by build script is named '.dtb.init.rodata'.
Unless we add '-j .dtb.init.rodata' device-tree blob will not be copied to binary.

>  PLATFORM_CPPFLAGS		+= -G 0 $(PF_ABICALLS) $(PF_PIC)
> diff --git a/arch/mips/dts/.gitignore b/arch/mips/dts/.gitignore
> new file mode 100644
> index 0000000..b60ed20
> --- /dev/null
> +++ b/arch/mips/dts/.gitignore
> @@ -0,0 +1 @@
> +*.dtb
> diff --git a/arch/mips/dts/Makefile b/arch/mips/dts/Makefile
> new file mode 100644
> index 0000000..47b6eb5
> --- /dev/null
> +++ b/arch/mips/dts/Makefile
> @@ -0,0 +1,16 @@
> +#
> +# SPDX-License-Identifier:	GPL-2.0+
> +#
> +
> +dtb-y +=
> +
> +targets += $(dtb-y)
> +
> +# Add any required device tree compiler flags here
> +DTC_FLAGS +=
> +
> +PHONY += dtbs
> +dtbs: $(addprefix $(obj)/, $(dtb-y))
> +	@:
> +
> +clean-files := *.dtb
> diff --git a/arch/mips/dts/skeleton.dtsi b/arch/mips/dts/skeleton.dtsi
> new file mode 100644
> index 0000000..24ee6c3
> --- /dev/null
> +++ b/arch/mips/dts/skeleton.dtsi
> @@ -0,0 +1,23 @@
> +/*
> + * Skeleton device tree; the bare minimum needed to boot; just include and
> + * add a compatible value.  The bootloader will typically populate the memory
> + * node.
> + *
> + * SPDX-License-Identifier:	GPL-2.0+
> + */
> +
> +/ {
> +	#address-cells = <1>;
> +	#size-cells = <1>;
> +
> +	chosen {
> +	};
> +
> +	aliases {
> +	};
> +
> +	memory {
> +		device_type = "memory";
> +		reg = <0 0>;
> +	};
> +};
> diff --git a/dts/Makefile b/dts/Makefile
> index d3122aa..c4ac153 100644
> --- a/dts/Makefile
> +++ b/dts/Makefile
> @@ -45,4 +45,4 @@ dtbs: $(obj)/dt.dtb
>  clean-files := dt.dtb.S
>  
>  # Let clean descend into dts directories
> -subdir- += ../arch/arm/dts ../arch/microblaze/dts ../arch/sandbox/dts ../arch/x86/dts
> +subdir- += ../arch/arm/dts ../arch/microblaze/dts ../arch/mips/dts ../arch/sandbox/dts ../arch/x86/dts
Daniel Schwierzeck Jan. 11, 2016, 4:40 p.m. UTC | #2
Am Montag, den 11.01.2016, 16:55 +0530 schrieb Purna Chandra Mandal:
> On 12/20/2015 04:13 AM, Daniel Schwierzeck wrote:
> > Prepare sub-folder for device-tree files. Make support for
> > device-tree on MIPS available in Kbuild/Kconfig.
> > 
> > Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
> > Signed-off-by: Purna Chandra Mandal <purna.mandal@microchip.com>
> > 
> > 
> > ---
> > 
> > Changes in v2:
> > - add arch/mips/dts to clean list in dts/Makefile
> > - keep section .dtb during link in case of CONFIG_OF_EMBED
> > 
> >  arch/Kconfig                |  1 +
> >  arch/mips/config.mk         |  2 +-
> >  arch/mips/dts/.gitignore    |  1 +
> >  arch/mips/dts/Makefile      | 16 ++++++++++++++++
> >  arch/mips/dts/skeleton.dtsi | 23 +++++++++++++++++++++++
> >  dts/Makefile                |  2 +-
> >  6 files changed, 43 insertions(+), 2 deletions(-)
> >  create mode 100644 arch/mips/dts/.gitignore
> >  create mode 100644 arch/mips/dts/Makefile
> >  create mode 100644 arch/mips/dts/skeleton.dtsi
> > 
> > diff --git a/arch/Kconfig b/arch/Kconfig
> > index 1709d40..ec12013 100644
> > --- a/arch/Kconfig
> > +++ b/arch/Kconfig
> > @@ -55,6 +55,7 @@ config MIPS
> >  	select HAVE_PRIVATE_LIBGCC
> >  	select HAVE_GENERIC_BOARD
> >  	select SYS_GENERIC_BOARD
> > +	select SUPPORT_OF_CONTROL
> >  
> >  config NDS32
> >  	bool "NDS32 architecture"
> > diff --git a/arch/mips/config.mk b/arch/mips/config.mk
> > index 415ec8a..3ebc202 100644
> > --- a/arch/mips/config.mk
> > +++ b/arch/mips/config.mk
> > @@ -71,7 +71,7 @@ else
> >  PF_ABICALLS			:= -mabicalls
> >  PF_PIC				:= -fpic
> >  PF_PIE				:= -pie
> > -PF_OBJCOPY			:= -j .got -j .u_boot_list -j
> > .rel.dyn -j .padding
> > +PF_OBJCOPY			:= -j .got -j .u_boot_list -j
> > .rel.dyn -j .padding -j .dtb
> >  endif
> >  
> 
> There is no section called '.dtb' in U-boot linker script, instead
> one generated by build script is named '.dtb.init.rodata'.
> Unless we add '-j .dtb.init.rodata' device-tree blob will not be
> copied to binary.

you are right. My thought was that all sub-sections are picked up by
objcopy. It works if I put a .dtb section to the linker script. I will
change to '-j .dtb.init.rodata', ARM does it in the same way.

> 
> >  PLATFORM_CPPFLAGS		+= -G 0 $(PF_ABICALLS) $(PF_PIC)
> > diff --git a/arch/mips/dts/.gitignore b/arch/mips/dts/.gitignore
> > new file mode 100644
> > index 0000000..b60ed20
> > --- /dev/null
> > +++ b/arch/mips/dts/.gitignore
> > @@ -0,0 +1 @@
> > +*.dtb
> > diff --git a/arch/mips/dts/Makefile b/arch/mips/dts/Makefile
> > new file mode 100644
> > index 0000000..47b6eb5
> > --- /dev/null
> > +++ b/arch/mips/dts/Makefile
> > @@ -0,0 +1,16 @@
> > +#
> > +# SPDX-License-Identifier:	GPL-2.0+
> > +#
> > +
> > +dtb-y +=
> > +
> > +targets += $(dtb-y)
> > +
> > +# Add any required device tree compiler flags here
> > +DTC_FLAGS +=
> > +
> > +PHONY += dtbs
> > +dtbs: $(addprefix $(obj)/, $(dtb-y))
> > +	@:
> > +
> > +clean-files := *.dtb
> > diff --git a/arch/mips/dts/skeleton.dtsi
> > b/arch/mips/dts/skeleton.dtsi
> > new file mode 100644
> > index 0000000..24ee6c3
> > --- /dev/null
> > +++ b/arch/mips/dts/skeleton.dtsi
> > @@ -0,0 +1,23 @@
> > +/*
> > + * Skeleton device tree; the bare minimum needed to boot; just
> > include and
> > + * add a compatible value.  The bootloader will typically populate
> > the memory
> > + * node.
> > + *
> > + * SPDX-License-Identifier:	GPL-2.0+
> > + */
> > +
> > +/ {
> > +	#address-cells = <1>;
> > +	#size-cells = <1>;
> > +
> > +	chosen {
> > +	};
> > +
> > +	aliases {
> > +	};
> > +
> > +	memory {
> > +		device_type = "memory";
> > +		reg = <0 0>;
> > +	};
> > +};
> > diff --git a/dts/Makefile b/dts/Makefile
> > index d3122aa..c4ac153 100644
> > --- a/dts/Makefile
> > +++ b/dts/Makefile
> > @@ -45,4 +45,4 @@ dtbs: $(obj)/dt.dtb
> >  clean-files := dt.dtb.S
> >  
> >  # Let clean descend into dts directories
> > -subdir- += ../arch/arm/dts ../arch/microblaze/dts
> > ../arch/sandbox/dts ../arch/x86/dts
> > +subdir- += ../arch/arm/dts ../arch/microblaze/dts ../arch/mips/dts
> > ../arch/sandbox/dts ../arch/x86/dts
>
diff mbox

Patch

diff --git a/arch/Kconfig b/arch/Kconfig
index 1709d40..ec12013 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -55,6 +55,7 @@  config MIPS
 	select HAVE_PRIVATE_LIBGCC
 	select HAVE_GENERIC_BOARD
 	select SYS_GENERIC_BOARD
+	select SUPPORT_OF_CONTROL
 
 config NDS32
 	bool "NDS32 architecture"
diff --git a/arch/mips/config.mk b/arch/mips/config.mk
index 415ec8a..3ebc202 100644
--- a/arch/mips/config.mk
+++ b/arch/mips/config.mk
@@ -71,7 +71,7 @@  else
 PF_ABICALLS			:= -mabicalls
 PF_PIC				:= -fpic
 PF_PIE				:= -pie
-PF_OBJCOPY			:= -j .got -j .u_boot_list -j .rel.dyn -j .padding
+PF_OBJCOPY			:= -j .got -j .u_boot_list -j .rel.dyn -j .padding -j .dtb
 endif
 
 PLATFORM_CPPFLAGS		+= -G 0 $(PF_ABICALLS) $(PF_PIC)
diff --git a/arch/mips/dts/.gitignore b/arch/mips/dts/.gitignore
new file mode 100644
index 0000000..b60ed20
--- /dev/null
+++ b/arch/mips/dts/.gitignore
@@ -0,0 +1 @@ 
+*.dtb
diff --git a/arch/mips/dts/Makefile b/arch/mips/dts/Makefile
new file mode 100644
index 0000000..47b6eb5
--- /dev/null
+++ b/arch/mips/dts/Makefile
@@ -0,0 +1,16 @@ 
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+dtb-y +=
+
+targets += $(dtb-y)
+
+# Add any required device tree compiler flags here
+DTC_FLAGS +=
+
+PHONY += dtbs
+dtbs: $(addprefix $(obj)/, $(dtb-y))
+	@:
+
+clean-files := *.dtb
diff --git a/arch/mips/dts/skeleton.dtsi b/arch/mips/dts/skeleton.dtsi
new file mode 100644
index 0000000..24ee6c3
--- /dev/null
+++ b/arch/mips/dts/skeleton.dtsi
@@ -0,0 +1,23 @@ 
+/*
+ * Skeleton device tree; the bare minimum needed to boot; just include and
+ * add a compatible value.  The bootloader will typically populate the memory
+ * node.
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+/ {
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	chosen {
+	};
+
+	aliases {
+	};
+
+	memory {
+		device_type = "memory";
+		reg = <0 0>;
+	};
+};
diff --git a/dts/Makefile b/dts/Makefile
index d3122aa..c4ac153 100644
--- a/dts/Makefile
+++ b/dts/Makefile
@@ -45,4 +45,4 @@  dtbs: $(obj)/dt.dtb
 clean-files := dt.dtb.S
 
 # Let clean descend into dts directories
-subdir- += ../arch/arm/dts ../arch/microblaze/dts ../arch/sandbox/dts ../arch/x86/dts
+subdir- += ../arch/arm/dts ../arch/microblaze/dts ../arch/mips/dts ../arch/sandbox/dts ../arch/x86/dts