sead3-mtd.c 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * This file is subject to the terms and conditions of the GNU General Public
  3. * License. See the file "COPYING" in the main directory of this archive
  4. * for more details.
  5. *
  6. * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved.
  7. */
  8. #include <linux/init.h>
  9. #include <linux/platform_device.h>
  10. #include <linux/mtd/physmap.h>
  11. static struct mtd_partition sead3_mtd_partitions[] = {
  12. {
  13. .name = "User FS",
  14. .offset = 0x00000000,
  15. .size = 0x01fc0000,
  16. }, {
  17. .name = "Board Config",
  18. .offset = 0x01fc0000,
  19. .size = 0x00040000,
  20. .mask_flags = MTD_WRITEABLE
  21. },
  22. };
  23. static struct physmap_flash_data sead3_flash_data = {
  24. .width = 4,
  25. .nr_parts = ARRAY_SIZE(sead3_mtd_partitions),
  26. .parts = sead3_mtd_partitions
  27. };
  28. static struct resource sead3_flash_resource = {
  29. .start = 0x1c000000,
  30. .end = 0x1dffffff,
  31. .flags = IORESOURCE_MEM
  32. };
  33. static struct platform_device sead3_flash = {
  34. .name = "physmap-flash",
  35. .id = 0,
  36. .dev = {
  37. .platform_data = &sead3_flash_data,
  38. },
  39. .num_resources = 1,
  40. .resource = &sead3_flash_resource,
  41. };
  42. static int __init sead3_mtd_init(void)
  43. {
  44. platform_device_register(&sead3_flash);
  45. return 0;
  46. }
  47. module_init(sead3_mtd_init)