diff options
author | Vitaly Bordug <vbordug@ru.mvista.com> | 2006-01-17 14:22:27 -0500 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-01-20 00:13:55 -0500 |
commit | 076d022c566fddde41fd4a858dd24bacad8304d7 (patch) | |
tree | 2fbc6b45c4d67642e3f8852f1ac8a70dfe7cd3d2 /arch/ppc | |
parent | 0ec57e53c945fe962b190953f61e1ffd127e68d3 (diff) |
[PATCH] PPC32 8xx: support for the physmapped flash on m8xx
Implemented more correct way to support physmapped flash on m8xx
than map in mtd.
The areas intended to contain bootloader are protected readonly.
Note that CFI and JEDEC stuff should be configured properly in order
this to work, e.g. for 885/86x CFI should support 4-chip flash interleave.
Also fixed compilation warning.
Signed-off-by: Vitaly Bordug <vbordug@ru.mvista.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/ppc')
-rw-r--r-- | arch/ppc/syslib/m8xx_setup.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/arch/ppc/syslib/m8xx_setup.c b/arch/ppc/syslib/m8xx_setup.c index ff0282479a78..cdb73a23a538 100644 --- a/arch/ppc/syslib/m8xx_setup.c +++ b/arch/ppc/syslib/m8xx_setup.c | |||
@@ -34,6 +34,13 @@ | |||
34 | #include <linux/seq_file.h> | 34 | #include <linux/seq_file.h> |
35 | #include <linux/root_dev.h> | 35 | #include <linux/root_dev.h> |
36 | 36 | ||
37 | #if defined(CONFIG_MTD) && defined(CONFIG_MTD_PHYSMAP) | ||
38 | #include <linux/mtd/partitions.h> | ||
39 | #include <linux/mtd/physmap.h> | ||
40 | #include <linux/mtd/mtd.h> | ||
41 | #include <linux/mtd/map.h> | ||
42 | #endif | ||
43 | |||
37 | #include <asm/mmu.h> | 44 | #include <asm/mmu.h> |
38 | #include <asm/reg.h> | 45 | #include <asm/reg.h> |
39 | #include <asm/residual.h> | 46 | #include <asm/residual.h> |
@@ -49,6 +56,34 @@ | |||
49 | 56 | ||
50 | #include "ppc8xx_pic.h" | 57 | #include "ppc8xx_pic.h" |
51 | 58 | ||
59 | #ifdef CONFIG_MTD_PHYSMAP | ||
60 | #define MPC8xxADS_BANK_WIDTH 4 | ||
61 | #endif | ||
62 | |||
63 | #define MPC8xxADS_U_BOOT_SIZE 0x80000 | ||
64 | #define MPC8xxADS_FREE_AREA_OFFSET MPC8xxADS_U_BOOT_SIZE | ||
65 | |||
66 | #if defined(CONFIG_MTD_PARTITIONS) | ||
67 | /* | ||
68 | NOTE: bank width and interleave relative to the installed flash | ||
69 | should have been chosen within MTD_CFI_GEOMETRY options. | ||
70 | */ | ||
71 | static struct mtd_partition mpc8xxads_partitions[] = { | ||
72 | { | ||
73 | .name = "bootloader", | ||
74 | .size = MPC8xxADS_U_BOOT_SIZE, | ||
75 | .offset = 0, | ||
76 | .mask_flags = MTD_WRITEABLE, /* force read-only */ | ||
77 | }, { | ||
78 | .name = "User FS", | ||
79 | .offset = MPC8xxADS_FREE_AREA_OFFSET | ||
80 | } | ||
81 | }; | ||
82 | |||
83 | #define mpc8xxads_part_num (sizeof (mpc8xxads_partitions) / sizeof (mpc8xxads_partitions[0])) | ||
84 | |||
85 | #endif | ||
86 | |||
52 | static int m8xx_set_rtc_time(unsigned long time); | 87 | static int m8xx_set_rtc_time(unsigned long time); |
53 | static unsigned long m8xx_get_rtc_time(void); | 88 | static unsigned long m8xx_get_rtc_time(void); |
54 | void m8xx_calibrate_decr(void); | 89 | void m8xx_calibrate_decr(void); |
@@ -71,6 +106,10 @@ board_init(void) | |||
71 | void __init | 106 | void __init |
72 | m8xx_setup_arch(void) | 107 | m8xx_setup_arch(void) |
73 | { | 108 | { |
109 | #if defined(CONFIG_MTD) && defined(CONFIG_MTD_PHYSMAP) | ||
110 | bd_t *binfo = (bd_t *)__res; | ||
111 | #endif | ||
112 | |||
74 | /* Reset the Communication Processor Module. | 113 | /* Reset the Communication Processor Module. |
75 | */ | 114 | */ |
76 | m8xx_cpm_reset(); | 115 | m8xx_cpm_reset(); |
@@ -106,6 +145,17 @@ m8xx_setup_arch(void) | |||
106 | } | 145 | } |
107 | #endif | 146 | #endif |
108 | #endif | 147 | #endif |
148 | |||
149 | #if defined (CONFIG_MPC86XADS) || defined (CONFIG_MPC885ADS) | ||
150 | #if defined(CONFIG_MTD_PHYSMAP) | ||
151 | physmap_configure(binfo->bi_flashstart, binfo->bi_flashsize, | ||
152 | MPC8xxADS_BANK_WIDTH, NULL); | ||
153 | #ifdef CONFIG_MTD_PARTITIONS | ||
154 | physmap_set_partitions(mpc8xxads_partitions, mpc8xxads_part_num); | ||
155 | #endif /* CONFIG_MTD_PARTITIONS */ | ||
156 | #endif /* CONFIG_MTD_PHYSMAP */ | ||
157 | #endif | ||
158 | |||
109 | board_init(); | 159 | board_init(); |
110 | } | 160 | } |
111 | 161 | ||