26 #include <linux/module.h>
27 #include <linux/types.h>
28 #include <linux/kernel.h>
30 #include <linux/string.h>
51 #define DNPC_BIOS_BLOCKS_WRITEPROTECTED
57 #define BIOSID_BASE 0x000fe100
59 #define ID_DNPC "DNP1486"
60 #define ID_ADNP "ADNP1486"
65 #define FLASH_BASE 0x2000000
70 #define CSC_INDEX 0x22
73 #define CSC_MMSWAR 0x30
74 #define CSC_MMSWDSR 0x31
81 #define CSC_PCCMDCR 0xf1
88 #define PCC_INDEX 0x3e0
89 #define PCC_DATA 0x3e1
91 #define PCC_AWER_B 0x46
92 #define PCC_MWSAR_1_Lo 0x58
93 #define PCC_MWSAR_1_Hi 0x59
94 #define PCC_MWEAR_1_Lo 0x5A
95 #define PCC_MWEAR_1_Hi 0x5B
96 #define PCC_MWAOR_1_Lo 0x5C
97 #define PCC_MWAOR_1_Hi 0x5D
104 static inline void setcsc(
int reg,
unsigned char data)
110 static inline unsigned char getcsc(
int reg)
116 static inline void setpcc(
int reg,
unsigned char data)
122 static inline unsigned char getpcc(
int reg)
135 static void dnpc_map_flash(
unsigned long flash_base,
unsigned long flash_size)
137 unsigned long flash_end = flash_base + flash_size - 1;
180 static void dnpc_unmap_flash(
void)
201 static int vpp_counter = 0;
205 static void dnp_set_vpp(
struct map_info *not_used,
int on)
207 spin_lock_irq(&dnpc_spin);
211 if(++vpp_counter == 1)
216 if(--vpp_counter == 0)
221 spin_unlock_irq(&dnpc_spin);
227 static void adnp_set_vpp(
struct map_info *not_used,
int on)
229 spin_lock_irq(&dnpc_spin);
233 if(++vpp_counter == 1)
238 if(--vpp_counter == 0)
243 spin_unlock_irq(&dnpc_spin);
248 #define DNP_WINDOW_SIZE 0x00200000
249 #define ADNP_WINDOW_SIZE 0x00400000
250 #define WINDOW_ADDR FLASH_BASE
253 .name =
"ADNP Flash Bank",
256 .set_vpp = adnp_set_vpp,
278 .name =
"ADNP system BIOS",
281 #ifdef DNPC_BIOS_BLOCKS_WRITEPROTECTED
286 .name =
"ADNP file system",
291 .name =
"ADNP system BIOS entry",
294 #ifdef DNPC_BIOS_BLOCKS_WRITEPROTECTED
300 #define NUM_PARTITIONS ARRAY_SIZE(partition_info)
326 .name =
"ADNP boot block",
328 .size = CONFIG_MTD_DILNETPC_BOOTSIZE,
331 .name =
"ADNP file system space",
336 .name =
"ADNP system BIOS + BIOS Entry",
339 #ifdef DNPC_BIOS_BLOCKS_WRITEPROTECTED
345 #define NUM_HIGHLVL_PARTITIONS ARRAY_SIZE(higlvl_partition_info)
348 static int dnp_adnp_probe(
void)
350 char *biosid,
rc = -1;
365 static int __init init_dnpc(
void)
372 if((is_dnp = dnp_adnp_probe()) < 0)
387 dnpc_map.
set_vpp = dnp_set_vpp;
388 partition_info[2].
size = 0xf0000;
396 ++partition_info[i].
name;
398 CONFIG_MTD_DILNETPC_BOOTSIZE - 0x20000;
400 ++higlvl_partition_info[i].
name;
404 is_dnp ?
"DNPC" :
"ADNP", dnpc_map.
size, (
unsigned long long)dnpc_map.
phys);
408 dnpc_map_flash(dnpc_map.
phys, dnpc_map.
size);
410 if (!dnpc_map.
virt) {
411 printk(
"Failed to ioremap_nocache\n");
416 printk(
"FLASH virtual address: 0x%p\n", dnpc_map.
virt);
448 partition_info[0].mtdp = &lowlvl_parts[0];
449 partition_info[1].mtdp = &lowlvl_parts[2];
450 partition_info[2].mtdp = &lowlvl_parts[1];
451 partition_info[3].mtdp = &lowlvl_parts[3];
459 merged_mtd =
mtd_concat_create(lowlvl_parts, NUM_PARTITIONS,
"(A)DNP Flash Concatenated");
473 static void __exit cleanup_dnpc(
void)