From: Stefan Roese <sr@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/6] arm: socfpga: Add socfpga_spim_enable() to reset_manager.c
Date: Fri, 7 Nov 2014 13:50:30 +0100 [thread overview]
Message-ID: <1415364634-8290-3-git-send-email-sr@denx.de> (raw)
In-Reply-To: <1415364634-8290-1-git-send-email-sr@denx.de>
This function will be needed by the upcoming Designware master SPI
driver. As the SPI master controller is held in reset by the current
Preloader implementation. So we need to release the reset for the
driver to communicate with the controller.
This function is called from arch_early_init_r() if the SPI
driver is enabled.
Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Chin Liang See <clsee@altera.com>
Cc: Dinh Nguyen <dinguyen@altera.com>
Cc: Vince Bridgers <vbridger@altera.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Pavel Machek <pavel@denx.de>
---
arch/arm/cpu/armv7/socfpga/misc.c | 6 ++++++
arch/arm/cpu/armv7/socfpga/reset_manager.c | 9 +++++++++
arch/arm/include/asm/arch-socfpga/reset_manager.h | 3 +++
3 files changed, 18 insertions(+)
diff --git a/arch/arm/cpu/armv7/socfpga/misc.c b/arch/arm/cpu/armv7/socfpga/misc.c
index 8c3e5f7..73cffd3 100644
--- a/arch/arm/cpu/armv7/socfpga/misc.c
+++ b/arch/arm/cpu/armv7/socfpga/misc.c
@@ -202,6 +202,12 @@ int arch_early_init_r(void)
/* Add device descriptor to FPGA device table */
socfpga_fpga_add();
+
+#ifdef CONFIG_DESIGNWARE_SPI
+ /* Get Designware SPI controller out of reset */
+ socfpga_spim_enable();
+#endif
+
return 0;
}
diff --git a/arch/arm/cpu/armv7/socfpga/reset_manager.c b/arch/arm/cpu/armv7/socfpga/reset_manager.c
index 1d3a95d..af9db85 100644
--- a/arch/arm/cpu/armv7/socfpga/reset_manager.c
+++ b/arch/arm/cpu/armv7/socfpga/reset_manager.c
@@ -104,3 +104,12 @@ void socfpga_emac_reset(int enable)
#endif
}
}
+
+/* SPI Master enable (its held in reset by the preloader) */
+void socfpga_spim_enable(void)
+{
+ const void *reset = &reset_manager_base->per_mod_reset;
+
+ clrbits_le32(reset, 1 << RSTMGR_PERMODRST_SPIM0_LSB);
+ clrbits_le32(reset, 1 << RSTMGR_PERMODRST_SPIM1_LSB);
+}
diff --git a/arch/arm/include/asm/arch-socfpga/reset_manager.h b/arch/arm/include/asm/arch-socfpga/reset_manager.h
index 1857b80..034135b 100644
--- a/arch/arm/include/asm/arch-socfpga/reset_manager.h
+++ b/arch/arm/include/asm/arch-socfpga/reset_manager.h
@@ -14,6 +14,7 @@ void socfpga_bridges_reset(int enable);
void socfpga_emac_reset(int enable);
void socfpga_watchdog_reset(void);
+void socfpga_spim_enable(void);
struct socfpga_reset_manager {
u32 status;
@@ -35,5 +36,7 @@ struct socfpga_reset_manager {
#define RSTMGR_PERMODRST_EMAC0_LSB 0
#define RSTMGR_PERMODRST_EMAC1_LSB 1
#define RSTMGR_PERMODRST_L4WD0_LSB 6
+#define RSTMGR_PERMODRST_SPIM0_LSB 18
+#define RSTMGR_PERMODRST_SPIM1_LSB 19
#endif /* _RESET_MANAGER_H_ */
--
2.1.3
next prev parent reply other threads:[~2014-11-07 12:50 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-07 12:50 [U-Boot] [PATCH 0/6] arm: socfpga: Add Designware SPI support Stefan Roese
2014-11-07 12:50 ` [U-Boot] [PATCH 1/6] arm: socfpga: Add DW master SPI clock to clock_manager.c Stefan Roese
2014-11-07 15:08 ` Marek Vasut
2014-11-12 17:41 ` Pavel Machek
2014-11-07 12:50 ` Stefan Roese [this message]
2014-11-12 17:42 ` [U-Boot] [PATCH 2/6] arm: socfpga: Add socfpga_spim_enable() to reset_manager.c Pavel Machek
2014-11-16 10:47 ` Stefan Roese
2014-11-07 12:50 ` [U-Boot] [PATCH 3/6] spi: Add designware master SPI DM driver used on SoCFPGA Stefan Roese
2014-11-07 15:12 ` Marek Vasut
2014-11-07 18:01 ` Simon Glass
2014-11-12 17:51 ` Pavel Machek
2014-11-14 20:16 ` Marek Vasut
2014-11-15 13:33 ` Stefan Roese
2014-11-15 14:40 ` Marek Vasut
2014-11-07 12:50 ` [U-Boot] [PATCH 4/6] arm: socfpga: dts: Add spi0/1 dts nodes for the Designware master SPI devices Stefan Roese
2014-11-12 17:52 ` Pavel Machek
2014-11-07 12:50 ` [U-Boot] [PATCH 5/6] arm: socfpga: dts: socrates: Add spi1/2 aliases needed DM SPI probing Stefan Roese
2014-11-12 17:52 ` Pavel Machek
2014-11-07 12:50 ` [U-Boot] [PATCH 6/6] arm: socfpga: Add Designware (DW) SPI support to config header Stefan Roese
2014-11-12 17:53 ` Pavel Machek
2014-11-14 20:18 ` Marek Vasut
2014-11-15 13:35 ` Stefan Roese
2014-11-15 14:40 ` Marek Vasut
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=1415364634-8290-3-git-send-email-sr@denx.de \
--to=sr@denx.de \
--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