Skip to contentSkip to conversation

MIPS: qemu-malta: switch to devicetree

PATCH Applied Antony Pavlov 3 participants 7 messages Sep 3, 2013 – Sep 4, 2013 MIPS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 MIPS: qemu-malta: switch to devicetree

---
 arch/mips/boards/qemu-malta/init.c     | 31 ++-----------------------------
 arch/mips/configs/qemu-malta_defconfig |  1 +
 arch/mips/dts/qemu-malta.dts           | 33 +++++++++++++++++++++++++++++++++
 3 files changed, 36 insertions(+), 29 deletions(-)
arch/mips/boards/qemu-malta/init.c +2 -29
index ddc90dc..4d12495 100644
@@ -17,39 +17,12 @@
  */
 
 #include <common.h>
-#include <types.h>
-#include <driver.h>
 #include <init.h>
-#include <ns16550.h>
-#include <mach/hardware.h>
-#include <partition.h>
-#include <sizes.h>
 
-static int malta_devices_init(void)
+static int malta_core_init(void)
 {
-	add_cfi_flash_device(0, 0x1e000000, SZ_4M, 0);
-
-	devfs_add_partition("nor0", 0x0, SZ_512K, DEVFS_PARTITION_FIXED, "self");
-	devfs_add_partition("nor0", SZ_512K, SZ_64K, DEVFS_PARTITION_FIXED, "env0");
-
-	return 0;
-}
-device_initcall(malta_devices_init);
-
-static struct NS16550_plat serial_plat = {
-	.clock = 1843200, /* no matter for emulated port */
-	.shift = 0,
-};
-
-static int malta_console_init(void)
-{
-	barebox_set_model("qemu malta");
 	barebox_set_hostname("malta");
 
-	/* Register the serial port */
-	add_ns16550_device(DEVICE_ID_DYNAMIC, MALTA_PIIX4_UART0, 8,
-			IORESOURCE_MEM_8BIT, &serial_plat);
-
 	return 0;
 }
-console_initcall(malta_console_init);
+core_initcall(malta_core_init);
arch/mips/configs/qemu-malta_defconfig +1 -0
index 18c840d..1b9ee9a 100644
@@ -54,6 +54,7 @@ CONFIG_NET_PING=y
 CONFIG_NET_NETCONSOLE=y
 CONFIG_NET_RESOLV=y
 CONFIG_OFDEVICE=y
+CONFIG_OF_BAREBOX_DRIVERS=y
 # CONFIG_SPI is not set
 CONFIG_MTD=y
 CONFIG_DRIVER_CFI=y
arch/mips/dts/qemu-malta.dts +33 -0
index c4dcf05..4057729 100644
@@ -6,7 +6,40 @@
 	model = "qemu malta";
 	compatible = "qemu,malta";
 
+	chosen {
+		environment@0 {
+			compatible = "barebox,environment";
+			device-path = &nor0, "partname:barebox-environment";
+		};
+	};
+
 	memory {
 		reg = <0x00000000 0x10000000>;
 	};
+
+	uart0: serial@b00003f8 {
+		compatible = "ns16550a";
+		reg = <0xb00003f8 0x08>;
+		reg-shift = <0>;
+		/* no matter for emulated port */
+		clock-frequency = <1843200>;
+	};
+
+	nor0: flash@be000000 {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		compatible = "cfi-flash";
+		reg = <0xbe000000 0x00400000>;
+
+		partition@0 {
+			label = "barebox";
+			reg = <0 0x80000>;
+			read-only;
+		};
+
+		partition@80000 {
+			label = "barebox-environment";
+			reg = <0x80000 0x10000>;
+		};
+	};
 };
Signature · 7 lines
1.8.4.rc3


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw
Quoted 35 lines · On Tue, 3 Sep 2013 08:33:33 +0400 Antony Pavlov <[email protected]>…
---
 arch/mips/boards/qemu-malta/init.c     | 31 ++-----------------------------
 arch/mips/configs/qemu-malta_defconfig |  1 +
 arch/mips/dts/qemu-malta.dts           | 33 +++++++++++++++++++++++++++++++++
 3 files changed, 36 insertions(+), 29 deletions(-)
arch/mips/boards/qemu-malta/init.c +1 -16
index ddc90dc..4d12495 100644
@@ -17,39 +17,12 @@
  */
 
 #include <common.h>
-#include <types.h>
-#include <driver.h>
 #include <init.h>
-#include <ns16550.h>
-#include <mach/hardware.h>
-#include <partition.h>
-#include <sizes.h>
 
-static int malta_devices_init(void)
+static int malta_core_init(void)
 {
-	add_cfi_flash_device(0, 0x1e000000, SZ_4M, 0);
-
-	devfs_add_partition("nor0", 0x0, SZ_512K, DEVFS_PARTITION_FIXED, "self");
-	devfs_add_partition("nor0", SZ_512K, SZ_64K, DEVFS_PARTITION_FIXED, "env0");
-
-	return 0;
-}
-device_initcall(malta_devices_init);
-

arch/mips/boards/qemu-malta/init.c line 25

Quoted 10 lines
arch/mips/boards/qemu-malta/init.c +0 -8
-static struct NS16550_plat serial_plat = {
-	.clock = 1843200, /* no matter for emulated port */
-	.shift = 0,
-};
-
-static int malta_console_init(void)
-{
-	barebox_set_model("qemu malta");
 	barebox_set_hostname("malta");
 

May be it is reasonable to add hostname support to dts?

The lonely barebox_set_hostname() in the malta board code looks very pathetically :)

Quoted 68 lines
arch/mips/boards/qemu-malta/init.c +1 -5
-	/* Register the serial port */
-	add_ns16550_device(DEVICE_ID_DYNAMIC, MALTA_PIIX4_UART0, 8,
-			IORESOURCE_MEM_8BIT, &serial_plat);
-
 	return 0;
 }
-console_initcall(malta_console_init);
+core_initcall(malta_core_init);
arch/mips/configs/qemu-malta_defconfig +1 -0
index 18c840d..1b9ee9a 100644
@@ -54,6 +54,7 @@ CONFIG_NET_PING=y
 CONFIG_NET_NETCONSOLE=y
 CONFIG_NET_RESOLV=y
 CONFIG_OFDEVICE=y
+CONFIG_OF_BAREBOX_DRIVERS=y
 # CONFIG_SPI is not set
 CONFIG_MTD=y
 CONFIG_DRIVER_CFI=y
arch/mips/dts/qemu-malta.dts +33 -0
index c4dcf05..4057729 100644
@@ -6,7 +6,40 @@
 	model = "qemu malta";
 	compatible = "qemu,malta";
 
+	chosen {
+		environment@0 {
+			compatible = "barebox,environment";
+			device-path = &nor0, "partname:barebox-environment";
+		};
+	};
+
 	memory {
 		reg = <0x00000000 0x10000000>;
 	};
+
+	uart0: serial@b00003f8 {
+		compatible = "ns16550a";
+		reg = <0xb00003f8 0x08>;
+		reg-shift = <0>;
+		/* no matter for emulated port */
+		clock-frequency = <1843200>;
+	};
+
+	nor0: flash@be000000 {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		compatible = "cfi-flash";
+		reg = <0xbe000000 0x00400000>;
+
+		partition@0 {
+			label = "barebox";
+			reg = <0 0x80000>;
+			read-only;
+		};
+
+		partition@80000 {
+			label = "barebox-environment";
+			reg = <0x80000 0x10000>;
+		};
+	};
 };
Signature · 1 line
1.8.4.rc3
Signature · 8 lines
-- 
Best regards,
  Antony Pavlov

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#2 lore raw
Quoted 51 lines · Antony Pavlov
Quoted 35 lines · On Tue, 3 Sep 2013 08:33:33 +0400 Antony Pavlov <[email protected]>…
---
 arch/mips/boards/qemu-malta/init.c     | 31 ++-----------------------------
 arch/mips/configs/qemu-malta_defconfig |  1 +
 arch/mips/dts/qemu-malta.dts           | 33 +++++++++++++++++++++++++++++++++
 3 files changed, 36 insertions(+), 29 deletions(-)
arch/mips/boards/qemu-malta/init.c +1 -16
index ddc90dc..4d12495 100644
@@ -17,39 +17,12 @@
  */
 
 #include <common.h>
-#include <types.h>
-#include <driver.h>
 #include <init.h>
-#include <ns16550.h>
-#include <mach/hardware.h>
-#include <partition.h>
-#include <sizes.h>
 
-static int malta_devices_init(void)
+static int malta_core_init(void)
 {
-	add_cfi_flash_device(0, 0x1e000000, SZ_4M, 0);
-
-	devfs_add_partition("nor0", 0x0, SZ_512K, DEVFS_PARTITION_FIXED, "self");
-	devfs_add_partition("nor0", SZ_512K, SZ_64K, DEVFS_PARTITION_FIXED, "env0");
-
-	return 0;
-}
-device_initcall(malta_devices_init);
-

arch/mips/boards/qemu-malta/init.c line 25

Quoted 10 lines
arch/mips/boards/qemu-malta/init.c +0 -8
-static struct NS16550_plat serial_plat = {
-	.clock = 1843200, /* no matter for emulated port */
-	.shift = 0,
-};
-
-static int malta_console_init(void)
-{
-	barebox_set_model("qemu malta");
 	barebox_set_hostname("malta");
 

May be it is reasonable to add hostname support to dts?

Quoted 1 line

The lonely barebox_set_hostname() in the malta board code looks very pathetically :)

we could use the model propertie for this

Best Regards,
J.

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#3 lore raw
Quoted 15 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 14 lines · Antony Pavlov

On Tue, 3 Sep 2013 08:33:33 +0400

arch/mips/boards/qemu-malta/init.c line 24

Quoted 10 lines
arch/mips/boards/qemu-malta/init.c +0 -8
-static struct NS16550_plat serial_plat = {
-	.clock = 1843200, /* no matter for emulated port */
-	.shift = 0,
-};
-
-static int malta_console_init(void)
-{
-	barebox_set_model("qemu malta");
 	barebox_set_hostname("malta");

May be it is reasonable to add hostname support to dts?

Quoted 3 lines
Quoted 1 line

The lonely barebox_set_hostname() in the malta board code looks very pathetically :)

we could use the model propertie for this

The model property is already used for the verbose name of a board. I described it as:

/*
* The model is the verbose name of a board. It can contain
* whitespaces, uppercase/lowcer letters, digits, ',', '.'
* '-', '_'
*/

Whereas the hostname is without whitespaces, I described it as:

/*
* The hostname is supposed to be the shortname of a board. It should
* contain only lowercase letters, numbers, '-', '_'. No whitespaces
* allowed.
*/

I think it is reasonable to add a hostname property to the devicetree. The last time I thought about this I couldn't really agree with myself how to name it.

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#4 lore raw
Quoted 37 lines · Sascha Hauer
Quoted 15 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 14 lines · Antony Pavlov

On Tue, 3 Sep 2013 08:33:33 +0400

arch/mips/boards/qemu-malta/init.c line 24

Quoted 10 lines
arch/mips/boards/qemu-malta/init.c +0 -8
-static struct NS16550_plat serial_plat = {
-	.clock = 1843200, /* no matter for emulated port */
-	.shift = 0,
-};
-
-static int malta_console_init(void)
-{
-	barebox_set_model("qemu malta");
 	barebox_set_hostname("malta");

May be it is reasonable to add hostname support to dts?

Quoted 3 lines
Quoted 1 line

The lonely barebox_set_hostname() in the malta board code looks very pathetically :)

we could use the model propertie for this

The model property is already used for the verbose name of a board. I described it as:

/*
* The model is the verbose name of a board. It can contain
* whitespaces, uppercase/lowcer letters, digits, ',', '.'
* '-', '_'
*/

Whereas the hostname is without whitespaces, I described it as:

/*
* The hostname is supposed to be the shortname of a board. It should
* contain only lowercase letters, numbers, '-', '_'. No whitespaces
* allowed.
*/

Quoted 3 lines

I think it is reasonable to add a hostname property to the devicetree. The last time I thought about this I couldn't really agree with myself how to name it.

how about use the compatible property?

for me I'll just put
model = "toto toto toto" , "toto_toot_toto";

if no second string create a hotname on the fly by replace the forbidden char by '_'

Best Regards,
J.

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#5 lore raw
Quoted 7 lines · Jean-Christophe PLAGNIOL-VILLARD

how about use the compatible property?

for me I'll just put
model = "toto toto toto" , "toto_toot_toto";

if no second string create a hotname on the fly by replace the forbidden char by '_'

That would be fine aswell. We should probably suggest something on the devicetree discuss list.

BTW according to EPAPR the model property should be "vendor,model". Most ARM dts don't have this layout anyway. Maybe this increases the motivation to change something there.

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Applied
#6 lore raw
In reply to Antony Pavlov
Quoted 1 line · Antony Pavlov

Applied, thanks

Sascha

Quoted 118 lines
---
 arch/mips/boards/qemu-malta/init.c     | 31 ++-----------------------------
 arch/mips/configs/qemu-malta_defconfig |  1 +
 arch/mips/dts/qemu-malta.dts           | 33 +++++++++++++++++++++++++++++++++
 3 files changed, 36 insertions(+), 29 deletions(-)
arch/mips/boards/qemu-malta/init.c +2 -29
index ddc90dc..4d12495 100644
@@ -17,39 +17,12 @@
  */
 
 #include <common.h>
-#include <types.h>
-#include <driver.h>
 #include <init.h>
-#include <ns16550.h>
-#include <mach/hardware.h>
-#include <partition.h>
-#include <sizes.h>
 
-static int malta_devices_init(void)
+static int malta_core_init(void)
 {
-	add_cfi_flash_device(0, 0x1e000000, SZ_4M, 0);
-
-	devfs_add_partition("nor0", 0x0, SZ_512K, DEVFS_PARTITION_FIXED, "self");
-	devfs_add_partition("nor0", SZ_512K, SZ_64K, DEVFS_PARTITION_FIXED, "env0");
-
-	return 0;
-}
-device_initcall(malta_devices_init);
-
-static struct NS16550_plat serial_plat = {
-	.clock = 1843200, /* no matter for emulated port */
-	.shift = 0,
-};
-
-static int malta_console_init(void)
-{
-	barebox_set_model("qemu malta");
 	barebox_set_hostname("malta");
 
-	/* Register the serial port */
-	add_ns16550_device(DEVICE_ID_DYNAMIC, MALTA_PIIX4_UART0, 8,
-			IORESOURCE_MEM_8BIT, &serial_plat);
-
 	return 0;
 }
-console_initcall(malta_console_init);
+core_initcall(malta_core_init);
arch/mips/configs/qemu-malta_defconfig +1 -0
index 18c840d..1b9ee9a 100644
@@ -54,6 +54,7 @@ CONFIG_NET_PING=y
 CONFIG_NET_NETCONSOLE=y
 CONFIG_NET_RESOLV=y
 CONFIG_OFDEVICE=y
+CONFIG_OF_BAREBOX_DRIVERS=y
 # CONFIG_SPI is not set
 CONFIG_MTD=y
 CONFIG_DRIVER_CFI=y
arch/mips/dts/qemu-malta.dts +33 -0
index c4dcf05..4057729 100644
@@ -6,7 +6,40 @@
 	model = "qemu malta";
 	compatible = "qemu,malta";
 
+	chosen {
+		environment@0 {
+			compatible = "barebox,environment";
+			device-path = &nor0, "partname:barebox-environment";
+		};
+	};
+
 	memory {
 		reg = <0x00000000 0x10000000>;
 	};
+
+	uart0: serial@b00003f8 {
+		compatible = "ns16550a";
+		reg = <0xb00003f8 0x08>;
+		reg-shift = <0>;
+		/* no matter for emulated port */
+		clock-frequency = <1843200>;
+	};
+
+	nor0: flash@be000000 {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		compatible = "cfi-flash";
+		reg = <0xbe000000 0x00400000>;
+
+		partition@0 {
+			label = "barebox";
+			reg = <0 0x80000>;
+			read-only;
+		};
+
+		partition@80000 {
+			label = "barebox-environment";
+			reg = <0x80000 0x10000>;
+		};
+	};
 };
Signature · 7 lines
1.8.4.rc3


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox