jedec.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /* JEDEC Flash Interface.
  2. * This is an older type of interface for self programming flash. It is
  3. * commonly use in older AMD chips and is obsolete compared with CFI.
  4. * It is called JEDEC because the JEDEC association distributes the ID codes
  5. * for the chips.
  6. *
  7. * See the AMD flash databook for information on how to operate the interface.
  8. *
  9. * $Id: jedec.h,v 1.1.1.1 2007/06/12 07:27:16 eyryu Exp $
  10. */
  11. #ifndef __LINUX_MTD_JEDEC_H__
  12. #define __LINUX_MTD_JEDEC_H__
  13. #include <linux/types.h>
  14. #define MAX_JEDEC_CHIPS 16
  15. // Listing of all supported chips and their information
  16. struct JEDECTable
  17. {
  18. __u16 jedec;
  19. char *name;
  20. unsigned long size;
  21. unsigned long sectorsize;
  22. __u32 capabilities;
  23. };
  24. // JEDEC being 0 is the end of the chip array
  25. struct jedec_flash_chip
  26. {
  27. __u16 jedec;
  28. unsigned long size;
  29. unsigned long sectorsize;
  30. // *(__u8*)(base + (adder << addrshift)) = data << datashift
  31. // Address size = size << addrshift
  32. unsigned long base; // Byte 0 of the flash, will be unaligned
  33. unsigned int datashift; // Useful for 32bit/16bit accesses
  34. unsigned int addrshift;
  35. unsigned long offset; // linerized start. base==offset for unbanked, uninterleaved flash
  36. __u32 capabilities;
  37. // These markers are filled in by the flash_chip_scan function
  38. unsigned long start;
  39. unsigned long length;
  40. };
  41. struct jedec_private
  42. {
  43. unsigned long size; // Total size of all the devices
  44. /* Bank handling. If sum(bank_fill) == size then this is linear flash.
  45. Otherwise the mapping has holes in it. bank_fill may be used to
  46. find the holes, but in the common symetric case
  47. bank_fill[0] == bank_fill[*], thus addresses may be computed
  48. mathmatically. bank_fill must be powers of two */
  49. unsigned is_banked;
  50. unsigned long bank_fill[MAX_JEDEC_CHIPS];
  51. struct jedec_flash_chip chips[MAX_JEDEC_CHIPS];
  52. };
  53. #endif