bcm47xxsflash.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #ifndef __BCM47XXSFLASH_H
  2. #define __BCM47XXSFLASH_H
  3. #include <linux/mtd/mtd.h>
  4. /* Used for ST flashes only. */
  5. #define OPCODE_ST_WREN 0x0006 /* Write Enable */
  6. #define OPCODE_ST_WRDIS 0x0004 /* Write Disable */
  7. #define OPCODE_ST_RDSR 0x0105 /* Read Status Register */
  8. #define OPCODE_ST_WRSR 0x0101 /* Write Status Register */
  9. #define OPCODE_ST_READ 0x0303 /* Read Data Bytes */
  10. #define OPCODE_ST_PP 0x0302 /* Page Program */
  11. #define OPCODE_ST_SE 0x02d8 /* Sector Erase */
  12. #define OPCODE_ST_BE 0x00c7 /* Bulk Erase */
  13. #define OPCODE_ST_DP 0x00b9 /* Deep Power-down */
  14. #define OPCODE_ST_RES 0x03ab /* Read Electronic Signature */
  15. #define OPCODE_ST_CSA 0x1000 /* Keep chip select asserted */
  16. #define OPCODE_ST_SSE 0x0220 /* Sub-sector Erase */
  17. /* Used for Atmel flashes only. */
  18. #define OPCODE_AT_READ 0x07e8
  19. #define OPCODE_AT_PAGE_READ 0x07d2
  20. #define OPCODE_AT_STATUS 0x01d7
  21. #define OPCODE_AT_BUF1_WRITE 0x0384
  22. #define OPCODE_AT_BUF2_WRITE 0x0387
  23. #define OPCODE_AT_BUF1_ERASE_PROGRAM 0x0283
  24. #define OPCODE_AT_BUF2_ERASE_PROGRAM 0x0286
  25. #define OPCODE_AT_BUF1_PROGRAM 0x0288
  26. #define OPCODE_AT_BUF2_PROGRAM 0x0289
  27. #define OPCODE_AT_PAGE_ERASE 0x0281
  28. #define OPCODE_AT_BLOCK_ERASE 0x0250
  29. #define OPCODE_AT_BUF1_WRITE_ERASE_PROGRAM 0x0382
  30. #define OPCODE_AT_BUF2_WRITE_ERASE_PROGRAM 0x0385
  31. #define OPCODE_AT_BUF1_LOAD 0x0253
  32. #define OPCODE_AT_BUF2_LOAD 0x0255
  33. #define OPCODE_AT_BUF1_COMPARE 0x0260
  34. #define OPCODE_AT_BUF2_COMPARE 0x0261
  35. #define OPCODE_AT_BUF1_REPROGRAM 0x0258
  36. #define OPCODE_AT_BUF2_REPROGRAM 0x0259
  37. /* Status register bits for ST flashes */
  38. #define SR_ST_WIP 0x01 /* Write In Progress */
  39. #define SR_ST_WEL 0x02 /* Write Enable Latch */
  40. #define SR_ST_BP_MASK 0x1c /* Block Protect */
  41. #define SR_ST_BP_SHIFT 2
  42. #define SR_ST_SRWD 0x80 /* Status Register Write Disable */
  43. /* Status register bits for Atmel flashes */
  44. #define SR_AT_READY 0x80
  45. #define SR_AT_MISMATCH 0x40
  46. #define SR_AT_ID_MASK 0x38
  47. #define SR_AT_ID_SHIFT 3
  48. struct bcma_drv_cc;
  49. enum bcm47xxsflash_type {
  50. BCM47XXSFLASH_TYPE_ATMEL,
  51. BCM47XXSFLASH_TYPE_ST,
  52. };
  53. struct bcm47xxsflash {
  54. struct bcma_drv_cc *bcma_cc;
  55. int (*cc_read)(struct bcm47xxsflash *b47s, u16 offset);
  56. void (*cc_write)(struct bcm47xxsflash *b47s, u16 offset, u32 value);
  57. enum bcm47xxsflash_type type;
  58. void __iomem *window;
  59. u32 blocksize;
  60. u16 numblocks;
  61. u32 size;
  62. struct mtd_info mtd;
  63. };
  64. #endif /* BCM47XXSFLASH */