Skip to contentSkip to conversation

Add support for Tegra114 SPI boot device

PATCH In review [email protected] 4 participants 8 messages Jun 5, 2013 – Jun 11, 2013 5 messages not in the archive Tegra architecture support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add support for Tegra114 SPI boot device

From: Penny Chiu <[email protected]>

This patch adds SpiFlashParams to generate/dump BCT for SPI flash.

Change-Id Icf256caade8d0aa2d1639541377fa0aa71786eda
---
 src/parse.h                |  3 +++
 src/t114/nvbctlib_t114.c   | 17 ++++++++++++++--
 src/t114/nvboot_bct_t114.h | 48 ++++++++++++++++++++++++++++++++++++++++++++++
 src/t114/parse_t114.c      | 25 ++++++++++++++++++++++++
 4 files changed, 91 insertions(+), 2 deletions(-)
src/parse.h +3 -0
index 21a2c7c..ced4cfc 100644
@@ -120,6 +120,7 @@ typedef enum
 	token_sdmmc_sd_controller,
 	token_sdmmc_max_power_class_supported,
 	token_spiflash_read_command_type_fast,
+	token_spiflash_page_size_2k_or_16k,
 	token_spiflash_clock_source,
 	token_spiflash_clock_divider,
 	token_sdmmc_data_width_4bit,
@@ -790,6 +791,7 @@ extern enum_item s_sdmmc_data_width_table_t114[];
 
 extern enum_item s_spi_clock_source_table_t20[];
 extern enum_item s_spi_clock_source_table_t30[];
+extern enum_item s_spi_clock_source_table_t114[];
 
 extern enum_item s_nvboot_memory_type_table_t20[];
 extern enum_item s_nvboot_memory_type_table_t30[];
@@ -808,6 +810,7 @@ extern field_item s_sdmmc_table_t114[];
 
 extern field_item s_spiflash_table_t20[];
 extern field_item s_spiflash_table_t30[];
+extern field_item s_spiflash_table_t114[];
 
 extern parse_subfield_item s_device_type_table_t20[];
 extern parse_subfield_item s_device_type_table_t30[];
src/t114/nvbctlib_t114.c +15 -2
index 9b11c76..f7e449a 100644
@@ -116,6 +116,11 @@ t114_set_dev_param(build_image_context *context,
 	CASE_SET_DEV_PARAM(sdmmc, max_power_class_supported);
 	CASE_SET_DEV_PARAM(sdmmc, multi_page_support);
 
+	CASE_SET_DEV_PARAM(spiflash, clock_source);
+	CASE_SET_DEV_PARAM(spiflash, clock_divider);
+	CASE_SET_DEV_PARAM(spiflash, read_command_type_fast);
+	CASE_SET_DEV_PARAM(spiflash, page_size_2k_or_16k);
+
 	case token_dev_type:
 		bct->dev_type[index] = value;
 		break;
@@ -145,6 +150,11 @@ t114_get_dev_param(build_image_context *context,
 	CASE_GET_DEV_PARAM(sdmmc, max_power_class_supported);
 	CASE_GET_DEV_PARAM(sdmmc, multi_page_support);
 
+	CASE_GET_DEV_PARAM(spiflash, clock_source);
+	CASE_GET_DEV_PARAM(spiflash, clock_divider);
+	CASE_GET_DEV_PARAM(spiflash, read_command_type_fast);
+	CASE_GET_DEV_PARAM(spiflash, page_size_2k_or_16k);
+
 	case token_dev_type:
 		*value = bct->dev_type[index];
 		break;
@@ -955,8 +965,11 @@ t114_bct_get_value(parse_token id, u_int32_t *data, u_int8_t *bct)
 	CASE_GET_CONST(max_bct_search_blks, NVBOOT_MAX_BCT_SEARCH_BLOCKS);
 
 	CASE_GET_CONST_PREFIX(dev_type_sdmmc, nvboot);
+	CASE_GET_CONST_PREFIX(dev_type_spi, nvboot);
 	CASE_GET_CONST_PREFIX(sdmmc_data_width_4bit, nvboot);
 	CASE_GET_CONST_PREFIX(sdmmc_data_width_8bit, nvboot);
+	CASE_GET_CONST_PREFIX(spi_clock_source_pllp_out0, nvboot);
+	CASE_GET_CONST_PREFIX(spi_clock_source_clockm, nvboot);
 
 	CASE_GET_CONST_PREFIX(memory_type_none, nvboot);
 	CASE_GET_CONST_PREFIX(memory_type_ddr, nvboot);
@@ -1060,12 +1073,12 @@ cbootimage_soc_config tegra114_config = {
 
 	.devtype_table				= s_devtype_table_t114,
 	.sdmmc_data_width_table		= s_sdmmc_data_width_table_t114,
-	.spi_clock_source_table		= 0,
+	.spi_clock_source_table		= s_spi_clock_source_table_t114,
 	.nvboot_memory_type_table	= s_nvboot_memory_type_table_t114,
 	.sdram_field_table			= s_sdram_field_table_t114,
 	.nand_table					= 0,
 	.sdmmc_table				= s_sdmmc_table_t114,
-	.spiflash_table				= 0,
+	.spiflash_table				= s_spiflash_table_t114,
 	.device_type_table			= s_device_type_table_t114,
 };
 
src/t114/nvboot_bct_t114.h +48 -0

66 lines not on this page · raw message

src/t114/parse_t114.c +25 -0
index 81ac024..17f612e 100644
@@ -26,7 +26,9 @@
 
 enum_item s_devtype_table_t114[] = {
 	{ "NvBootDevType_Sdmmc", nvboot_dev_type_sdmmc },
+	{ "NvBootDevType_Spi", nvboot_dev_type_spi },
 	{ "Sdmmc", nvboot_dev_type_sdmmc },
+	{ "Spi", nvboot_dev_type_spi },
 	{ NULL, 0 }
 };
 
@@ -44,6 +46,16 @@ enum_item s_sdmmc_data_width_table_t114[] = {
 	{ NULL, 0 }
 };
 
+enum_item s_spi_clock_source_table_t114[] = {
+	{ "NvBootSpiClockSource_PllPOut0", nvboot_spi_clock_source_pllp_out0 },
+	{ "NvBootSpiClockSource_ClockM", nvboot_spi_clock_source_clockm },
+	{ "ClockSource_PllPOut0", nvboot_spi_clock_source_pllp_out0 },
+	{ "ClockSource_ClockM", nvboot_spi_clock_source_clockm },
+	{ "PllPOut0", nvboot_spi_clock_source_pllp_out0 },
+	{ "ClockM", nvboot_spi_clock_source_clockm },
+	{ NULL, 0 }
+};
+
 enum_item s_nvboot_memory_type_table_t114[] = {
 	{ "NvBootMemoryType_None", nvboot_memory_type_none },
 	{ "NvBootMemoryType_Ddr3", nvboot_memory_type_ddr3 },
@@ -398,8 +410,21 @@ field_item s_sdmmc_table_t114[] = {
 	{ NULL, 0, 0, NULL }
 };
 
+field_item s_spiflash_table_t114[] = {
+	{ "ReadCommandTypeFast",        TOKEN(spiflash_read_command_type_fast) },
+	{ "PageSize2kor16k",            TOKEN(spiflash_page_size_2k_or_16k) },
+	{ "ClockDivider",               TOKEN(spiflash_clock_divider) },
+	{ "ClockSource",
+	  token_spiflash_clock_source,
+	  field_type_enum,
+	  s_spi_clock_source_table_t114 },
+	{ NULL, 0, 0, NULL }
+};
+
 parse_subfield_item s_device_type_table_t114[] = {
 	{ "SdmmcParams.", token_sdmmc_params,
 		s_sdmmc_table_t114, t114_set_dev_param },
+	{ "SpiFlashParams.", token_spiflash_params,
+		s_spiflash_table_t114, t114_set_dev_param },
 	{ NULL, 0, NULL }
 };
Signature · 1 line
1.8.1.5
#2 lore raw
In reply to a message not in the archive
Quoted 3 lines · On 06/05/2013 02:35 AM, [email protected] wrote:

From: Penny Chiu <[email protected]>

This patch adds SpiFlashParams to generate/dump BCT for SPI flash.

This looks fine to me.

Allen, if you ack, I can apply/push if you want.

Penny,

When posting patches upstream, it might be a good idea to prefix the subject line with "cbootimage:" so it's obvious what the patch is for.

Your git configuration (perhaps git send-email configuration) is a bit broken; this email contains the following header:

From: [email protected], [email protected]

which should be:

From: Penny Chiu <[email protected]>

This won't stop me applying this, but you should fix that.

#5 lore raw
In reply to a message not in the archive

Hi Stephen,

Please let me know if I need to re-send the patch for fixing these problems.

Thanks,
Penny

-----Original Message-----
From: Stephen Warren [mailto:[email protected]]
Sent: Thursday, June 06, 2013 1:33 AM
Cc: Allen Martin; Stephen Warren; [email protected]; Penny Chiu
Subject: Re: [PATCH 1/1] Add support for Tegra114 SPI boot device

Quoted 5 lines · On 06/05/2013 02:35 AM, [email protected] wrote:

From: Penny Chiu <[email protected]>

This patch adds SpiFlashParams to generate/dump BCT for SPI flash.

Change-Id: Icf256caade8d0aa2d1639541377fa0aa71786eda

Oh, you should remove that line before posting patches upstream.

#8 lore raw
Quoted 11 lines · Allen Martin
Quoted 4 lines · Penny Chiu

Hi Stephen,

Please let me know if I need to re-send the patch for fixing these problems.

Yes, please resend with a fixed commit message and you can add:

Stephen or I can apply to the cbootimage repo

I can fix up the commit description when I apply it. I'll do it in a second...

#10 lore raw
In reply to a message not in the archive
Quoted 7 lines · Stephen Warren
Quoted 6 lines · Allen Martin
Quoted 4 lines · Penny Chiu

Hi Stephen,

Please let me know if I need to re-send the patch for fixing these problems.

Quoted 8 lines
Quoted 5 lines

Yes, please resend with a fixed commit message and you can add:

Stephen or I can apply to the cbootimage repo

I can fix up the commit description when I apply it. I'll do it in a second...

It's applied now. Is there a need to tag a new version?

#12 lore raw
In reply to a message not in the archive
Quoted 10 lines · Stephen Warren
Quoted 9 lines · Stephen Warren
Quoted 8 lines · Allen Martin
Quoted 4 lines · Penny Chiu

Hi Stephen,

Please let me know if I need to re-send the patch for fixing these problems.

Yes, please resend with a fixed commit message and you can add:

Quoted 9 lines
Quoted 6 lines
Quoted 3 lines

Stephen or I can apply to the cbootimage repo

I can fix up the commit description when I apply it. I'll do it in a second...

It's applied now. Is there a need to tag a new version?

Yes, the chromeos ebuild pulls by tag. The version number in configure.ac should match the tag, so I'll send a patch to bump the version and tag it when it goes in.

-Allen

Signature · 1 line
nvpublic