From: Bin Meng <bmeng.cn@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 5/5] x86: fsp: Configure SPI opcode registers before SPI is locked down
Date: Tue, 15 Aug 2017 22:38:31 -0700 [thread overview]
Message-ID: <1502861911-14366-5-git-send-email-bmeng.cn@gmail.com> (raw)
In-Reply-To: <1502861911-14366-1-git-send-email-bmeng.cn@gmail.com>
Some Intel FSP (like Braswell) does SPI lock-down during the call
to fsp_notify(INIT_PHASE_BOOT). But before SPI lock-down is done,
it's bootloader's responsibility to configure the SPI controller's
opcode registers properly otherwise SPI controller driver doesn't
know how to communicate with the SPI flash device.
This introduces a Kconfig option CONFIG_FSP_LOCKDOWN_SPI for such
FSPs. When it is on, U-Boot will configure the SPI opcode registers
before the lock-down.
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---
arch/x86/Kconfig | 9 +++++++++
arch/x86/lib/fsp/fsp_common.c | 24 ++++++++++++++++++++++++
2 files changed, 33 insertions(+)
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index c26710b..5373082 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -401,6 +401,15 @@ config FSP_BROKEN_HOB
do not overwrite the important boot service data which is used by
FSP, otherwise the subsequent call to fsp_notify() will fail.
+config FSP_LOCKDOWN_SPI
+ bool
+ depends on HAVE_FSP
+ help
+ Some Intel FSP (like Braswell) does SPI lock-down during the call
+ to fsp_notify(INIT_PHASE_BOOT). This option should be turned on
+ for such FSP and U-Boot will configure the SPI opcode registers
+ before the lock-down.
+
config ENABLE_MRC_CACHE
bool "Enable MRC cache"
depends on !EFI && !SYS_COREBOOT
diff --git a/arch/x86/lib/fsp/fsp_common.c b/arch/x86/lib/fsp/fsp_common.c
index 3397bb8..320d87d 100644
--- a/arch/x86/lib/fsp/fsp_common.c
+++ b/arch/x86/lib/fsp/fsp_common.c
@@ -19,6 +19,8 @@
DECLARE_GLOBAL_DATA_PTR;
+extern void ich_spi_config_opcode(struct udevice *dev);
+
int checkcpu(void)
{
return 0;
@@ -49,6 +51,28 @@ void board_final_cleanup(void)
{
u32 status;
+#ifdef CONFIG_FSP_LOCKDOWN_SPI
+ struct udevice *dev;
+
+ /*
+ * Some Intel FSP (like Braswell) does SPI lock-down during the call
+ * to fsp_notify(INIT_PHASE_BOOT). But before SPI lock-down is done,
+ * it's bootloader's responsibility to configure the SPI controller's
+ * opcode registers properly otherwise SPI controller driver doesn't
+ * know how to communicate with the SPI flash device.
+ *
+ * Note we cannot do such configuration elsewhere (eg: during the SPI
+ * controller driver's probe() routine), becasue:
+ *
+ * 1). U-Boot SPI controller driver does not set the lock-down bit
+ * 2). Any SPI transfer will corrupt the contents of these registers
+ *
+ * Hence we have to do it right here before SPI lock-down bit is set.
+ */
+ if (!uclass_first_device_err(UCLASS_SPI, &dev))
+ ich_spi_config_opcode(dev);
+#endif
+
/* call into FspNotify */
debug("Calling into FSP (notify phase INIT_PHASE_BOOT): ");
status = fsp_notify(NULL, INIT_PHASE_BOOT);
--
2.9.2
next prev parent reply other threads:[~2017-08-16 5:38 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-16 5:38 [U-Boot] [PATCH 1/5] x86: ich-spi: Remove spi_write_protect_region() Bin Meng
2017-08-16 5:38 ` [U-Boot] [PATCH 2/5] x86: ich-spi: Remove unnecessary assignment in ich_init_controller() Bin Meng
2017-08-16 6:18 ` Stefan Roese
2017-08-24 3:17 ` Bin Meng
2017-08-16 5:38 ` [U-Boot] [PATCH 3/5] x86: ich-spi: Don't read cached lock status Bin Meng
2017-08-16 6:19 ` Stefan Roese
2017-08-24 3:17 ` Bin Meng
2017-08-16 5:38 ` [U-Boot] [PATCH 4/5] x86: ich-spi: Move opcode registers configuration to another routine Bin Meng
2017-08-16 6:19 ` Stefan Roese
2017-08-24 3:17 ` Bin Meng
2017-08-16 5:38 ` Bin Meng [this message]
2017-08-16 6:21 ` [U-Boot] [PATCH 5/5] x86: fsp: Configure SPI opcode registers before SPI is locked down Stefan Roese
2017-08-24 3:17 ` Bin Meng
2017-08-26 13:39 ` Simon Glass
2017-08-26 13:58 ` Bin Meng
2017-08-26 22:40 ` Simon Glass
2017-08-27 0:12 ` Bin Meng
2017-09-06 1:39 ` Simon Glass
2017-09-12 13:53 ` Bin Meng
2017-09-13 2:31 ` Simon Glass
2017-08-16 6:18 ` [U-Boot] [PATCH 1/5] x86: ich-spi: Remove spi_write_protect_region() Stefan Roese
2017-08-24 3:17 ` Bin Meng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1502861911-14366-5-git-send-email-bmeng.cn@gmail.com \
--to=bmeng.cn@gmail.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox