summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-mxs/Makefile2
-rw-r--r--arch/arm/mach-mxs/common.c33
-rw-r--r--arch/arm/mach-mxs/include/mach/mxs.h6
3 files changed, 40 insertions, 1 deletions
diff --git a/arch/arm/mach-mxs/Makefile b/arch/arm/mach-mxs/Makefile
index 172d928128..268e7dcbd6 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 0000000000..3730633c71
--- /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 0000000000..182ed8a998
--- /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 */