26 #include <linux/module.h>
34 #define WINDOW_START 0xe8000
35 #define WINDOW_LENGTH 0x8000
36 #define WINDOW_SHIFT 27
37 #define WINDOW_MASK 0x7FFF
40 static volatile char page_n_dev = 0;
41 static unsigned long iomapadr;
54 static inline void oct5066_page(
struct map_info *
map,
unsigned long ofs)
58 if (page_n_dev != byte)
59 __oct5066_page(map, byte);
66 spin_lock(&oct5066_spin);
67 oct5066_page(map, ofs);
69 spin_unlock(&oct5066_spin);
73 static void oct5066_copy_from(
struct map_info *map,
void *to,
unsigned long from,
ssize_t len)
76 unsigned long thislen = len;
80 spin_lock(&oct5066_spin);
81 oct5066_page(map, from);
83 spin_unlock(&oct5066_spin);
92 spin_lock(&oct5066_spin);
93 oct5066_page(map, adr);
95 spin_unlock(&oct5066_spin);
98 static void oct5066_copy_to(
struct map_info *map,
unsigned long to,
const void *from,
ssize_t len)
101 unsigned long thislen = len;
105 spin_lock(&oct5066_spin);
106 oct5066_page(map, to);
108 spin_unlock(&oct5066_spin);
115 static struct map_info oct5066_map[2] = {
117 .name =
"Octagon 5066 Socket",
121 .read = oct5066_read8,
122 .copy_from = oct5066_copy_from,
123 .write = oct5066_write8,
124 .copy_to = oct5066_copy_to,
128 .name =
"Octagon 5066 Internal Flash",
130 .size = 2 * 1024 * 1024,
132 .read = oct5066_read8,
133 .copy_from = oct5066_copy_from,
134 .write = oct5066_write8,
135 .copy_to = oct5066_copy_to,
148 static int __init OctProbe(
void)
150 unsigned int Base = (1 << 6);
152 unsigned long Values[10];
153 for (I = 0; I != 20; I++)
159 Values[I%10] =
readl(iomapadr);
160 if (I > 0 && Values[I%10] == Values[0])
166 if (Values[I%10] !=
readl(iomapadr))
176 for (i=0; i<2; i++) {
177 if (oct5066_mtd[i]) {
186 static int __init init_oct5066(
void)
202 if (OctProbe() != 0) {
203 printk(
KERN_NOTICE "5066: Octagon Probe Failed, is this an Octagon 5066 SBC?\n");
213 for (i=0; i<2; i++) {
221 if (oct5066_mtd[i]) {
227 if (!oct5066_mtd[0] && !oct5066_mtd[1]) {