48c762db5a9086077321b3d3ef5afea56769b3d4
[openwrt/svn-archive/archive.git] / target / linux / aruba-2.6 / files / arch / mips / aruba / flash_lock.c
1 #include <linux/module.h>
2 #include <linux/types.h>
3 #include <asm/bootinfo.h>
4
5 #define AP70_PROT_ADDR 0xb8010008
6 #define AP70_PROT_DATA 0x8
7 #define AP60_PROT_ADDR 0xB8400000
8 #define AP60_PROT_DATA 0x04000000
9
10 void unlock_ap60_70_flash(void)
11 {
12 volatile __u32 val;
13 switch (mips_machtype) {
14 case MACH_ARUBA_AP70:
15 val = *(volatile __u32 *)AP70_PROT_ADDR;
16 val &= ~(AP70_PROT_DATA);
17 *(volatile __u32 *)AP70_PROT_ADDR = val;
18 break;
19 case MACH_ARUBA_AP65:
20 case MACH_ARUBA_AP60:
21 default:
22 val = *(volatile __u32 *)AP60_PROT_ADDR;
23 val &= ~(AP60_PROT_DATA);
24 *(volatile __u32 *)AP60_PROT_ADDR = val;
25 break;
26 }
27 }