47 #include <linux/module.h>
60 #define WINDOW_START 0xdc000
63 #define WINDOW_SHIFT 14
64 #define WINDOW_LENGTH (1 << WINDOW_SHIFT)
67 #define WINDOW_MASK (WINDOW_LENGTH-1)
69 #define PAGE_IO_SIZE 2
72 #define DEVICE_ENABLE 0x8000
76 #define MAX_SIZE_KiB 16384
77 #define BOOT_PARTITION_SIZE_KiB 768
78 #define DATA_PARTITION_SIZE_KiB 1280
79 #define APP_PARTITION_SIZE_KiB 6144
83 static volatile int page_in_window = -1;
91 { .name =
"SBC-GXx flash boot partition",
94 { .name =
"SBC-GXx flash data partition",
97 { .name =
"SBC-GXx flash application partition",
101 #define NUM_PARTITIONS 3
103 static inline void sbc_gxx_page(
struct map_info *
map,
unsigned long ofs)
107 if( page!=page_in_window ) {
109 page_in_window =
page;
117 spin_lock(&sbc_gxx_spin);
118 sbc_gxx_page(map, ofs);
120 spin_unlock(&sbc_gxx_spin);
124 static void sbc_gxx_copy_from(
struct map_info *map,
void *to,
unsigned long from,
ssize_t len)
127 unsigned long thislen = len;
131 spin_lock(&sbc_gxx_spin);
132 sbc_gxx_page(map, from);
134 spin_unlock(&sbc_gxx_spin);
143 spin_lock(&sbc_gxx_spin);
144 sbc_gxx_page(map, adr);
146 spin_unlock(&sbc_gxx_spin);
149 static void sbc_gxx_copy_to(
struct map_info *map,
unsigned long to,
const void *from,
ssize_t len)
152 unsigned long thislen = len;
156 spin_lock(&sbc_gxx_spin);
157 sbc_gxx_page(map, to);
158 memcpy_toio(iomapadr + (to & WINDOW_MASK), from, thislen);
159 spin_unlock(&sbc_gxx_spin);
166 static struct map_info sbc_gxx_map = {
167 .name =
"SBC-GXx flash",
173 .read = sbc_gxx_read8,
174 .copy_from = sbc_gxx_copy_from,
175 .write = sbc_gxx_write8,
176 .copy_to = sbc_gxx_copy_to
182 static void cleanup_sbc_gxx(
void)
193 static int __init init_sbc_gxx(
void)