From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Cc: wsa@pengutronix.de
Subject: [PATCH 1/4] ARM mxs: Add mxs_reset_block function
Date: Thu, 7 Jun 2012 23:04:55 +0200 [thread overview]
Message-ID: <1339103098-32102-2-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1339103098-32102-1-git-send-email-s.hauer@pengutronix.de>
The i.MX23/28 have a reset block to reset several units.
Add a function to support this.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/mach-mxs/Makefile | 2 +-
arch/arm/mach-mxs/common.c | 33 +++++++++++++++++++++++++++++++++
arch/arm/mach-mxs/include/mach/mxs.h | 6 ++++++
3 files changed, 40 insertions(+), 1 deletion(-)
create mode 100644 arch/arm/mach-mxs/common.c
create mode 100644 arch/arm/mach-mxs/include/mach/mxs.h
diff --git a/arch/arm/mach-mxs/Makefile b/arch/arm/mach-mxs/Makefile
index 172d928..268e7dc 100644
--- a/arch/arm/mach-mxs/Makefile
+++ b/arch/arm/mach-mxs/Makefile
@@ -1,4 +1,4 @@
-obj-y += imx.o iomux-imx.o reset-imx.o
+obj-y += imx.o iomux-imx.o reset-imx.o common.o
obj-$(CONFIG_DRIVER_VIDEO_STM) += imx_lcd_clk.o
obj-$(CONFIG_ARCH_IMX23) += speed-imx23.o clocksource-imx23.o usb.o
obj-$(CONFIG_ARCH_IMX28) += speed-imx28.o clocksource-imx28.o
diff --git a/arch/arm/mach-mxs/common.c b/arch/arm/mach-mxs/common.c
new file mode 100644
index 0000000..3730633
--- /dev/null
+++ b/arch/arm/mach-mxs/common.c
@@ -0,0 +1,33 @@
+#include <common.h>
+#include <io.h>
+#include <mach/mxs.h>
+#include <mach/imx-regs.h>
+
+#define MXS_BLOCK_SFTRST (1 << 31)
+#define MXS_BLOCK_CLKGATE (1 << 30)
+
+int mxs_reset_block(void __iomem *reg, int just_enable)
+{
+ /* Clear SFTRST */
+ writel(MXS_BLOCK_SFTRST, reg + BIT_CLR);
+ mdelay(1);
+
+ /* Clear CLKGATE */
+ writel(MXS_BLOCK_CLKGATE, reg + BIT_CLR);
+
+ if (!just_enable) {
+ /* Set SFTRST */
+ writel(MXS_BLOCK_SFTRST, reg + BIT_SET);
+ mdelay(1);
+ }
+
+ /* Clear SFTRST */
+ writel(MXS_BLOCK_SFTRST, reg + BIT_CLR);
+ mdelay(1);
+
+ /* Clear CLKGATE */
+ writel(MXS_BLOCK_CLKGATE, reg + BIT_CLR);
+ mdelay(1);
+
+ return 0;
+}
diff --git a/arch/arm/mach-mxs/include/mach/mxs.h b/arch/arm/mach-mxs/include/mach/mxs.h
new file mode 100644
index 0000000..182ed8a
--- /dev/null
+++ b/arch/arm/mach-mxs/include/mach/mxs.h
@@ -0,0 +1,6 @@
+#ifndef __MACH_MXS_H
+#define __MACH_MXS_H
+
+int mxs_reset_block(void __iomem *reg, int just_enable);
+
+#endif /* __MACH_MXS_H */
--
1.7.10
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2012-06-07 21:05 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-07 21:04 [PATCH] mxs NAND support Sascha Hauer
2012-06-07 21:04 ` Sascha Hauer [this message]
2012-06-07 21:04 ` [PATCH 2/4] dma: add mxs-apbh-dma driver Sascha Hauer
2012-06-07 21:04 ` [PATCH 3/4] mtd nand: add mxs-nand driver Sascha Hauer
2012-06-08 15:06 ` Marek Vasut
2012-06-08 15:21 ` Sascha Hauer
2012-06-07 21:04 ` [PATCH 4/4] ARM mxs: add bcb command to create 'boot control block' for NAND boot Sascha Hauer
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=1339103098-32102-2-git-send-email-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=wsa@pengutronix.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