Linux MIPS Architecture development
 help / color / mirror / Atom feed
* [PATCH 0/3] MIPS: OCTEON: Make DT "model" visible in /proc/cpuinfo
@ 2016-02-22 22:22 Aaro Koskinen
  2016-02-22 22:22 ` [PATCH 1/3] MIPS: OCTEON: board_type_to_string: return NULL for unsupported board Aaro Koskinen
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Aaro Koskinen @ 2016-02-22 22:22 UTC (permalink / raw)
  To: Ralf Baechle, David Daney, linux-mips; +Cc: Aaro Koskinen

Hi,

This is a small cosmetic change to get rid of "Unsupported Board" in
/proc/cpuinfo with "pure DT" boards.

E.g. on EdgeRouter Pro this changes system type in /proc/cpuinfo from:

	system type             : Unsupported Board (CN6120p1.1-1000-NSP)

to:

	system type             : ubnt,e200 (CN6120p1.1-1000-NSP)

A.

Aaro Koskinen (3):
  MIPS: OCTEON: board_type_to_string: return NULL for unsupported board
  MIPS: OCTEON: initialize system type string after device tree init
  MIPS: OCTEON: use model string from DTB for unknown board type

 arch/mips/cavium-octeon/setup.c              | 23 +++++++++++++++++------
 arch/mips/include/asm/octeon/cvmx-bootinfo.h |  2 +-
 2 files changed, 18 insertions(+), 7 deletions(-)

-- 
2.4.0

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

* [PATCH 1/3] MIPS: OCTEON: board_type_to_string: return NULL for unsupported board
  2016-02-22 22:22 [PATCH 0/3] MIPS: OCTEON: Make DT "model" visible in /proc/cpuinfo Aaro Koskinen
@ 2016-02-22 22:22 ` Aaro Koskinen
  2016-02-22 22:22 ` [PATCH 2/3] MIPS: OCTEON: initialize system type string after device tree init Aaro Koskinen
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Aaro Koskinen @ 2016-02-22 22:22 UTC (permalink / raw)
  To: Ralf Baechle, David Daney, linux-mips; +Cc: Aaro Koskinen

Return NULL for unsupported board.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
---
 arch/mips/cavium-octeon/setup.c              | 9 +++++++--
 arch/mips/include/asm/octeon/cvmx-bootinfo.h | 2 +-
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/arch/mips/cavium-octeon/setup.c b/arch/mips/cavium-octeon/setup.c
index cd7101f..5be2072 100644
--- a/arch/mips/cavium-octeon/setup.c
+++ b/arch/mips/cavium-octeon/setup.c
@@ -468,9 +468,14 @@ static char __read_mostly octeon_system_type[80];
 
 static int __init init_octeon_system_type(void)
 {
+	char const *board_type;
+
+	board_type = cvmx_board_type_to_string(octeon_bootinfo->board_type);
+	if (board_type == NULL)
+		board_type = "Unsupported Board";
+
 	snprintf(octeon_system_type, sizeof(octeon_system_type), "%s (%s)",
-		cvmx_board_type_to_string(octeon_bootinfo->board_type),
-		octeon_model_get_string(read_c0_prid()));
+		 board_type, octeon_model_get_string(read_c0_prid()));
 
 	return 0;
 }
diff --git a/arch/mips/include/asm/octeon/cvmx-bootinfo.h b/arch/mips/include/asm/octeon/cvmx-bootinfo.h
index d92cf59..a00f903 100644
--- a/arch/mips/include/asm/octeon/cvmx-bootinfo.h
+++ b/arch/mips/include/asm/octeon/cvmx-bootinfo.h
@@ -388,7 +388,7 @@ static inline const char *cvmx_board_type_to_string(enum
 		ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_KONTRON_S1901)
 		ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_PRIVATE_MAX)
 	}
-	return "Unsupported Board";
+	return NULL;
 }
 
 #define ENUM_CHIP_TYPE_CASE(x) \
-- 
2.4.0

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

* [PATCH 2/3] MIPS: OCTEON: initialize system type string after device tree init
  2016-02-22 22:22 [PATCH 0/3] MIPS: OCTEON: Make DT "model" visible in /proc/cpuinfo Aaro Koskinen
  2016-02-22 22:22 ` [PATCH 1/3] MIPS: OCTEON: board_type_to_string: return NULL for unsupported board Aaro Koskinen
@ 2016-02-22 22:22 ` Aaro Koskinen
  2016-02-22 22:22 ` [PATCH 3/3] MIPS: OCTEON: use model string from DTB for unknown board type Aaro Koskinen
  2016-02-23  2:02 ` [PATCH 0/3] MIPS: OCTEON: Make DT "model" visible in /proc/cpuinfo David Daney
  3 siblings, 0 replies; 5+ messages in thread
From: Aaro Koskinen @ 2016-02-22 22:22 UTC (permalink / raw)
  To: Ralf Baechle, David Daney, linux-mips; +Cc: Aaro Koskinen

Initialize system type string after device tree init.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
---
 arch/mips/cavium-octeon/setup.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/mips/cavium-octeon/setup.c b/arch/mips/cavium-octeon/setup.c
index 5be2072..d9fb610 100644
--- a/arch/mips/cavium-octeon/setup.c
+++ b/arch/mips/cavium-octeon/setup.c
@@ -466,7 +466,7 @@ static void octeon_halt(void)
 
 static char __read_mostly octeon_system_type[80];
 
-static int __init init_octeon_system_type(void)
+static void __init init_octeon_system_type(void)
 {
 	char const *board_type;
 
@@ -476,10 +476,7 @@ static int __init init_octeon_system_type(void)
 
 	snprintf(octeon_system_type, sizeof(octeon_system_type), "%s (%s)",
 		 board_type, octeon_model_get_string(read_c0_prid()));
-
-	return 0;
 }
-early_initcall(init_octeon_system_type);
 
 /**
  * Return a string representing the system type
@@ -1122,6 +1119,7 @@ void __init device_tree_init(void)
 		pr_info("Using internal Device Tree.\n");
 	}
 	unflatten_and_copy_device_tree();
+	init_octeon_system_type();
 }
 
 static int __initdata disable_octeon_edac_p;
-- 
2.4.0

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

* [PATCH 3/3] MIPS: OCTEON: use model string from DTB for unknown board type
  2016-02-22 22:22 [PATCH 0/3] MIPS: OCTEON: Make DT "model" visible in /proc/cpuinfo Aaro Koskinen
  2016-02-22 22:22 ` [PATCH 1/3] MIPS: OCTEON: board_type_to_string: return NULL for unsupported board Aaro Koskinen
  2016-02-22 22:22 ` [PATCH 2/3] MIPS: OCTEON: initialize system type string after device tree init Aaro Koskinen
@ 2016-02-22 22:22 ` Aaro Koskinen
  2016-02-23  2:02 ` [PATCH 0/3] MIPS: OCTEON: Make DT "model" visible in /proc/cpuinfo David Daney
  3 siblings, 0 replies; 5+ messages in thread
From: Aaro Koskinen @ 2016-02-22 22:22 UTC (permalink / raw)
  To: Ralf Baechle, David Daney, linux-mips; +Cc: Aaro Koskinen

Use model string from DTB for board type if the board is unknown.
This is more informative, e.g. with EdgeRouter Pro the /proc/cpuinfo
will display "ubnt,e200 (CN6120p1.1-1000-NSP)" instead of misleading
"Unsupported Board".

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
---
 arch/mips/cavium-octeon/setup.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/arch/mips/cavium-octeon/setup.c b/arch/mips/cavium-octeon/setup.c
index d9fb610..2338890 100644
--- a/arch/mips/cavium-octeon/setup.c
+++ b/arch/mips/cavium-octeon/setup.c
@@ -471,8 +471,16 @@ static void __init init_octeon_system_type(void)
 	char const *board_type;
 
 	board_type = cvmx_board_type_to_string(octeon_bootinfo->board_type);
-	if (board_type == NULL)
-		board_type = "Unsupported Board";
+	if (board_type == NULL) {
+		struct device_node *root;
+		int ret;
+
+		root = of_find_node_by_path("/");
+		ret = of_property_read_string(root, "model", &board_type);
+		of_node_put(root);
+		if (ret)
+			board_type = "Unsupported Board";
+	}
 
 	snprintf(octeon_system_type, sizeof(octeon_system_type), "%s (%s)",
 		 board_type, octeon_model_get_string(read_c0_prid()));
-- 
2.4.0

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

* Re: [PATCH 0/3] MIPS: OCTEON: Make DT "model" visible in /proc/cpuinfo
  2016-02-22 22:22 [PATCH 0/3] MIPS: OCTEON: Make DT "model" visible in /proc/cpuinfo Aaro Koskinen
                   ` (2 preceding siblings ...)
  2016-02-22 22:22 ` [PATCH 3/3] MIPS: OCTEON: use model string from DTB for unknown board type Aaro Koskinen
@ 2016-02-23  2:02 ` David Daney
  3 siblings, 0 replies; 5+ messages in thread
From: David Daney @ 2016-02-23  2:02 UTC (permalink / raw)
  To: Aaro Koskinen, Ralf Baechle; +Cc: linux-mips

Acked-by: David Daney <david.daney@cavium.com>

On 02/22/2016 02:22 PM, Aaro Koskinen wrote:
> Hi,
>
> This is a small cosmetic change to get rid of "Unsupported Board" in
> /proc/cpuinfo with "pure DT" boards.
>
> E.g. on EdgeRouter Pro this changes system type in /proc/cpuinfo from:
>
> 	system type             : Unsupported Board (CN6120p1.1-1000-NSP)
>
> to:
>
> 	system type             : ubnt,e200 (CN6120p1.1-1000-NSP)
>
> A.
>
> Aaro Koskinen (3):
>    MIPS: OCTEON: board_type_to_string: return NULL for unsupported board
>    MIPS: OCTEON: initialize system type string after device tree init
>    MIPS: OCTEON: use model string from DTB for unknown board type
>
>   arch/mips/cavium-octeon/setup.c              | 23 +++++++++++++++++------
>   arch/mips/include/asm/octeon/cvmx-bootinfo.h |  2 +-
>   2 files changed, 18 insertions(+), 7 deletions(-)
>

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

end of thread, other threads:[~2016-02-23  2:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-22 22:22 [PATCH 0/3] MIPS: OCTEON: Make DT "model" visible in /proc/cpuinfo Aaro Koskinen
2016-02-22 22:22 ` [PATCH 1/3] MIPS: OCTEON: board_type_to_string: return NULL for unsupported board Aaro Koskinen
2016-02-22 22:22 ` [PATCH 2/3] MIPS: OCTEON: initialize system type string after device tree init Aaro Koskinen
2016-02-22 22:22 ` [PATCH 3/3] MIPS: OCTEON: use model string from DTB for unknown board type Aaro Koskinen
2016-02-23  2:02 ` [PATCH 0/3] MIPS: OCTEON: Make DT "model" visible in /proc/cpuinfo David Daney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox