1 /* 2 * the ``general-purpose'' memory controller. 3 * only works with flash memory. 4 */ 5 6 enum { 7 /* syscfg bits */ 8 Idlemask = MASK(2) << 3, 9 Noidle = 1 << 3, 10 11 /* config bits */ 12 Postnandwrites = 1<<0, /* force nand reg. writes to be posted */ 13 14 /* indices of cscfg[].cfg[] */ 15 Csctl = 1 - 1, /* chip-select signal ctl */ 16 Csmap = 7 - 1, /* chip-select addr map cfg */ 17 18 /* Csctl bits */ 19 Muxadddata = 1 << 9, 20 Devtypemask = MASK(2) << 10, 21 Devtypenor = 0 << 10, 22 Devtypenand = 2 << 10, 23 Devsizemask = 1 << 12, 24 Devsize8 = 0 << 12, 25 Devsize16 = 1 << 12, 26 Writesync = 1 << 27, 27 Readsync = 1 << 29, 28 29 /* Csmap bits */ 30 Csvalid = 1 << 6, 31 MB16 = 017 << 8, /* 16MB size */ 32 MB128 = 010 << 8, /* 128MB size */ 33 }; 34 35 typedef struct Gpmc Gpmc; 36 typedef struct Gpmccs Gpmccs; 37 38 /* 39 * configuration for non-dram (e.g., flash) memory 40 */ 41 struct Gpmc { /* hw registers */ 42 uchar _pad0[0x10]; 43 ulong syscfg; 44 ulong syssts; 45 ulong irqsts; 46 ulong irqenable; 47 uchar _pad1[0x40 - 0x20]; 48 ulong tmout_ctl; 49 ulong erraddr; 50 ulong errtype; 51 ulong _pad7; 52 ulong config; 53 ulong sts; 54 uchar _pad2[0x60 - 0x58]; 55 56 /* chip-select config */ 57 struct Gpmccs { 58 ulong cfg[7]; 59 ulong nandcmd; 60 ulong nandaddr; 61 ulong nanddata; 62 ulong _pad6[2]; 63 } cscfg[8]; 64 65 /* prefetch */ 66 ulong prefcfg[2]; 67 ulong _pad8; 68 ulong prefctl; 69 ulong prefsts; 70 71 /* ecc */ 72 ulong ecccfg; 73 ulong eccctl; 74 ulong eccsize; 75 ulong eccres[9]; 76 uchar _pad3[0x240 - 0x224]; 77 78 /* bch */ 79 ulong bchres[8][4]; 80 uchar _pad4[0x2d0 - 0x2c0]; 81 ulong bchswdata; 82 }; 83