drv_sfc_gd25qxx_mtd_partition.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * File : drv_sfc_gd25qxx_mtd_partition.c
  3. * COPYRIGHT (C) 2008 - 2016, RT-Thread Development Team
  4. *
  5. * Change Logs:
  6. * Date Author Notes
  7. * 2017Äê4ÔÂ19ÈÕ Urey the first version
  8. */
  9. #include <rthw.h>
  10. #include <rtthread.h>
  11. #include <rtdevice.h>
  12. #include <drivers/mtd_nor.h>
  13. #include "board.h"
  14. #include "drv_clock.h"
  15. #include "drv_gpio.h"
  16. #include "drv_sfc.h"
  17. #include "mtd_nor_partition.h"
  18. static struct rt_mtd_nor_partition _sf_gd25_parts[] =
  19. {
  20. {
  21. /* sf01 u-boot 512K */
  22. .name = "uboot",
  23. .offset = 0x0,
  24. .size = (0x80000),
  25. .mask_flags = PART_FLAG_RDONLY | PART_TYPE_BLK, /* force read-only */
  26. },
  27. {
  28. /* kernel */
  29. .name = "kernel",
  30. .offset = 0x80000,
  31. .size = 0x380000,
  32. .mask_flags = PART_FLAG_RDONLY | PART_TYPE_BLK, /* force read-only */
  33. },
  34. {
  35. /* rootfs */
  36. .name = "rootfs",
  37. .offset = 0x400000,
  38. .size = 0x800000,
  39. .mask_flags = PART_FLAG_RDONLY | PART_TYPE_BLK, /* force read-only & Block device */
  40. },
  41. {
  42. /* sf04 appfs 2M*/
  43. .name = "appfs",
  44. .offset = 0xE00000,
  45. .size = 0x200000,
  46. .mask_flags = PART_FLAG_RDWR | PART_TYPE_BLK, /* force read-only & Block device */
  47. },
  48. //end
  49. {
  50. .name = (char *)0
  51. }
  52. };
  53. int rt_hw_gd25qxx_mtd_part_init(const char *mtd_name)
  54. {
  55. mtd_nor_init_partition(mtd_name,_sf_gd25_parts);
  56. return 0;
  57. }