diff mbox series

[1/5] ARM: tegra: rework fdt_serial_tag_setup_one

Message ID 1584387649-20959-2-git-send-email-twarren@nvidia.com
State New
Headers show
Series Misc fixes for Tegra | expand

Commit Message

Tom Warren March 16, 2020, 7:40 p.m. UTC
From: Stephen Warren <swarren at nvidia.com>

Reword fdt_serial_tag_setup_one() so that the types it uses aren't tied
to CONFIG_SERIAL_TAG, and rename the function to better indicate its
purpose. This will allow it to be re-used by future board info related
code.

Signed-off-by: Stephen Warren <swarren at nvidia.com>
Signed-off-by: Tom Warren <twarren at nvidia.com>
---
 arch/arm/mach-tegra/ft_board_info.c | 77 +++++++++++++++++++++++++++++++++++++
 arch/arm/mach-tegra/ft_board_info.h | 23 +++++++++++
 2 files changed, 100 insertions(+)
 create mode 100644 arch/arm/mach-tegra/ft_board_info.c
 create mode 100644 arch/arm/mach-tegra/ft_board_info.h

Comments

Stephen Warren March 17, 2020, 5:16 p.m. UTC | #1
On 3/16/20 1:40 PM, twarren at nvidia.com wrote:
> From: Stephen Warren <swarren at nvidia.com>
> 
> Reword fdt_serial_tag_setup_one() so that the types it uses aren't tied
> to CONFIG_SERIAL_TAG, and rename the function to better indicate its
> purpose. This will allow it to be re-used by future board info related
> code.

>  arch/arm/mach-tegra/ft_board_info.c | 77 +++++++++++++++++++++++++++++++++++++
>  arch/arm/mach-tegra/ft_board_info.h | 23 +++++++++++

I don't think this series was based on upstream, or there are missing
patches in between upstream and this series; those files don't exist
upstream.
Stephen Warren March 17, 2020, 5:18 p.m. UTC | #2
On 3/17/20 11:16 AM, Stephen Warren wrote:
> On 3/16/20 1:40 PM, twarren at nvidia.com wrote:
>> From: Stephen Warren <swarren at nvidia.com>
>>
>> Reword fdt_serial_tag_setup_one() so that the types it uses aren't tied
>> to CONFIG_SERIAL_TAG, and rename the function to better indicate its
>> purpose. This will allow it to be re-used by future board info related
>> code.
> 
>>  arch/arm/mach-tegra/ft_board_info.c | 77 +++++++++++++++++++++++++++++++++++++
>>  arch/arm/mach-tegra/ft_board_info.h | 23 +++++++++++
> 
> I don't think this series was based on upstream, or there are missing
> patches in between upstream and this series; those files don't exist
> upstream.

Oh. This patch adds those files. But the commit description says it's
reworking some existing logic. I guess the description is from some
squashed patch, and doesn't describe what the patch actually does? Also,
the new file isn't added to any Makefile, and no edits are made to any
other file in order to call the newly added functionality.
Tom Warren March 17, 2020, 5:42 p.m. UTC | #3
-----Original Message-----
From: Stephen Warren <swarren at wwwdotorg.org> 
Sent: Tuesday, March 17, 2020 10:18 AM
To: Tom Warren <TWarren at nvidia.com>
Cc: u-boot at lists.denx.de; Stephen Warren <swarren at nvidia.com>
Subject: Re: [PATCH 1/5] ARM: tegra: rework fdt_serial_tag_setup_one

External email: Use caution opening links or attachments


On 3/17/20 11:16 AM, Stephen Warren wrote:
> On 3/16/20 1:40 PM, twarren at nvidia.com wrote:
>> From: Stephen Warren <swarren at nvidia.com>
>>
>> Reword fdt_serial_tag_setup_one() so that the types it uses aren't 
>> tied to CONFIG_SERIAL_TAG, and rename the function to better indicate 
>> its purpose. This will allow it to be re-used by future board info 
>> related code.
>
>>  arch/arm/mach-tegra/ft_board_info.c | 77 
>> +++++++++++++++++++++++++++++++++++++
>>  arch/arm/mach-tegra/ft_board_info.h | 23 +++++++++++
>
> I don't think this series was based on upstream, or there are missing 
> patches in between upstream and this series; those files don't exist 
> upstream.

Oh. This patch adds those files. But the commit description says it's reworking some existing logic. I guess the description is from some squashed patch, and doesn't describe what the patch actually does? Also, the new file isn't added to any Makefile, and no edits are made to any other file in order to call the newly added functionality.
[Tom] Yeah, this got messed up when I squashed/edited the transition from nvtboot to cboot support files in arch/arm/mach-tegra. I'll have to revisit this, as the code isn't called anywhere currently in my upstream work, nor build by a Makefile. 


-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------
Tom Warren March 17, 2020, 7:37 p.m. UTC | #4
-----Original Message-----
From: Tom Warren 
Sent: Tuesday, March 17, 2020 10:43 AM
To: Stephen Warren <swarren at wwwdotorg.org>
Cc: u-boot at lists.denx.de; Stephen Warren <swarren at nvidia.com>; tomcwarren3959 at gmail.com
Subject: RE: [PATCH 1/5] ARM: tegra: rework fdt_serial_tag_setup_one

-----Original Message-----
From: Stephen Warren <swarren at wwwdotorg.org>
Sent: Tuesday, March 17, 2020 10:18 AM
To: Tom Warren <TWarren at nvidia.com>
Cc: u-boot at lists.denx.de; Stephen Warren <swarren at nvidia.com>
Subject: Re: [PATCH 1/5] ARM: tegra: rework fdt_serial_tag_setup_one

External email: Use caution opening links or attachments


On 3/17/20 11:16 AM, Stephen Warren wrote:
> On 3/16/20 1:40 PM, twarren at nvidia.com wrote:
>> From: Stephen Warren <swarren at nvidia.com>
>>
>> Reword fdt_serial_tag_setup_one() so that the types it uses aren't 
>> tied to CONFIG_SERIAL_TAG, and rename the function to better indicate 
>> its purpose. This will allow it to be re-used by future board info 
>> related code.
>
>>  arch/arm/mach-tegra/ft_board_info.c | 77
>> +++++++++++++++++++++++++++++++++++++
>>  arch/arm/mach-tegra/ft_board_info.h | 23 +++++++++++
>
> I don't think this series was based on upstream, or there are missing 
> patches in between upstream and this series; those files don't exist 
> upstream.

Oh. This patch adds those files. But the commit description says it's reworking some existing logic. I guess the description is from some squashed patch, and doesn't describe what the patch actually does? Also, the new file isn't added to any Makefile, and no edits are made to any other file in order to call the newly added functionality.
[Tom] Yeah, this got messed up when I squashed/edited the transition from nvtboot to cboot support files in arch/arm/mach-tegra. I'll have to revisit this, as the code isn't called anywhere currently in my upstream work, nor build by a Makefile. 
  [Tom] OK, so this work (adding board info (proc/pmu/display) is already done by CBoot on T210 before we get to U-Boot, so it's not needed. Mea culpa - lots of churn w/these patches, trying to get them squashed/optimized for upstreaming, and I mistakenly kept this one around from the nvtboot->U-Boot days. I'll drop it.

-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------
diff mbox series

Patch

diff --git a/arch/arm/mach-tegra/ft_board_info.c b/arch/arm/mach-tegra/ft_board_info.c
new file mode 100644
index 0000000..7dd3a40
--- /dev/null
+++ b/arch/arm/mach-tegra/ft_board_info.c
@@ -0,0 +1,77 @@ 
+/*
+ *  (C) Copyright 2010-2016
+ *  NVIDIA Corporation <www.nvidia.com>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+#include <fdt_support.h>
+#include <fdtdec.h>
+#include "ft_board_info.h"
+
+int ft_board_info_set(void *blob, const struct ft_board_info *bi,
+		      const char *chosen_subnode_name)
+{
+	int chosen, offset, ret;
+	u32 val;
+
+	chosen = fdt_path_offset(blob, "/chosen");
+	if (!chosen) {
+		chosen = fdt_add_subnode(blob, 0, "chosen");
+		if (chosen < 0) {
+			error("fdt_add_subnode(/, chosen) failed: %s.\n",
+			      fdt_strerror(chosen));
+			return chosen;
+		}
+	}
+
+	offset = fdt_add_subnode(blob, chosen, chosen_subnode_name);
+	if (offset < 0) {
+		error("fdt_add_subnode(/chosen, %s): %s.\n",
+			chosen_subnode_name, fdt_strerror(offset));
+		return offset;
+	}
+
+	val = cpu_to_fdt32(bi->id);
+	ret = fdt_setprop(blob, offset, "id", &val, sizeof(val));
+	if (ret < 0) {
+		error("could not update id property %s.\n",
+		      fdt_strerror(ret));
+		return ret;
+	}
+
+	val = cpu_to_fdt32(bi->sku);
+	ret = fdt_setprop(blob, offset, "sku", &val, sizeof(val));
+	if (ret < 0) {
+		error("could not update sku property %s.\n",
+		      fdt_strerror(ret));
+		return ret;
+	}
+
+	val = cpu_to_fdt32(bi->fab);
+	ret = fdt_setprop(blob, offset, "fab", &val, sizeof(val));
+	if (ret < 0) {
+		error("could not update fab property %s.\n",
+		      fdt_strerror(ret));
+		return ret;
+	}
+
+	val = cpu_to_fdt32(bi->major);
+	ret = fdt_setprop(blob, offset, "major_revision", &val, sizeof(val));
+	if (ret < 0) {
+		error("could not update major_revision property %s.\n",
+		      fdt_strerror(ret));
+		return ret;
+	}
+
+	val = cpu_to_fdt32(bi->minor);
+	ret = fdt_setprop(blob, offset, "minor_revision", &val, sizeof(val));
+	if (ret < 0) {
+		error("could not update minor_revision property %s.\n",
+		      fdt_strerror(ret));
+		return ret;
+	}
+
+	return 0;
+}
diff --git a/arch/arm/mach-tegra/ft_board_info.h b/arch/arm/mach-tegra/ft_board_info.h
new file mode 100644
index 0000000..c320aee
--- /dev/null
+++ b/arch/arm/mach-tegra/ft_board_info.h
@@ -0,0 +1,23 @@ 
+/*
+ * Board info related definitions
+ *
+ * (C) Copyright 2015 NVIDIA Corporation <www.nvidia.com>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef _BOARD_INFO_H_
+#define _BOARD_INFO_H_
+
+struct ft_board_info {
+	u32 id;
+	u32 sku;
+	u32 fab;
+	u32 major;
+	u32 minor;
+};
+
+int ft_board_info_set(void *blob, const struct ft_board_info *bi,
+		      const char *chosen_subnode_name);
+
+#endif