Sascha Hauer | 198016e | 2009-02-06 15:38:22 +0100 | [diff] [blame] | 1 | |
| 2 | #include <linux/module.h> |
Fabio Estevam | bb07d75 | 2012-02-29 10:28:08 -0300 | [diff] [blame] | 3 | #include <linux/io.h> |
Shawn Guo | 50f2de6 | 2012-09-14 14:14:45 +0800 | [diff] [blame] | 4 | |
| 5 | #include "hardware.h" |
Fabio Estevam | e7feaaa | 2013-03-25 09:20:28 -0300 | [diff] [blame] | 6 | #include "common.h" |
Sascha Hauer | 198016e | 2009-02-06 15:38:22 +0100 | [diff] [blame] | 7 | |
| 8 | unsigned int __mxc_cpu_type; |
| 9 | EXPORT_SYMBOL(__mxc_cpu_type); |
| 10 | |
Shawn Guo | bfefdff | 2013-08-13 13:54:02 +0800 | [diff] [blame^] | 11 | static unsigned int imx_soc_revision; |
| 12 | |
Sascha Hauer | 198016e | 2009-02-06 15:38:22 +0100 | [diff] [blame] | 13 | void mxc_set_cpu_type(unsigned int type) |
| 14 | { |
| 15 | __mxc_cpu_type = type; |
| 16 | } |
| 17 | |
Shawn Guo | bfefdff | 2013-08-13 13:54:02 +0800 | [diff] [blame^] | 18 | void imx_set_soc_revision(unsigned int rev) |
| 19 | { |
| 20 | imx_soc_revision = rev; |
| 21 | } |
| 22 | |
| 23 | unsigned int imx_get_soc_revision(void) |
| 24 | { |
| 25 | return imx_soc_revision; |
| 26 | } |
| 27 | |
Fabio Estevam | 059e58f | 2011-08-26 13:35:18 +0800 | [diff] [blame] | 28 | void imx_print_silicon_rev(const char *cpu, int srev) |
| 29 | { |
| 30 | if (srev == IMX_CHIP_REVISION_UNKNOWN) |
| 31 | pr_info("CPU identified as %s, unknown revision\n", cpu); |
| 32 | else |
| 33 | pr_info("CPU identified as %s, silicon rev %d.%d\n", |
| 34 | cpu, (srev >> 4) & 0xf, srev & 0xf); |
| 35 | } |
Fabio Estevam | bb07d75 | 2012-02-29 10:28:08 -0300 | [diff] [blame] | 36 | |
| 37 | void __init imx_set_aips(void __iomem *base) |
| 38 | { |
| 39 | unsigned int reg; |
| 40 | /* |
| 41 | * Set all MPROTx to be non-bufferable, trusted for R/W, |
| 42 | * not forced to user-mode. |
| 43 | */ |
| 44 | __raw_writel(0x77777777, base + 0x0); |
| 45 | __raw_writel(0x77777777, base + 0x4); |
| 46 | |
| 47 | /* |
| 48 | * Set all OPACRx to be non-bufferable, to not require |
| 49 | * supervisor privilege level for access, allow for |
| 50 | * write access and untrusted master access. |
| 51 | */ |
| 52 | __raw_writel(0x0, base + 0x40); |
| 53 | __raw_writel(0x0, base + 0x44); |
| 54 | __raw_writel(0x0, base + 0x48); |
| 55 | __raw_writel(0x0, base + 0x4C); |
| 56 | reg = __raw_readl(base + 0x50) & 0x00FFFFFF; |
| 57 | __raw_writel(reg, base + 0x50); |
| 58 | } |