mtd.c 962 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // SPDX-License-Identifier: GPL-2.0-or-later
  2. /*
  3. * Registration of Cobalt MTD device.
  4. *
  5. * Copyright (C) 2006 Yoichi Yuasa <[email protected]>
  6. */
  7. #include <linux/init.h>
  8. #include <linux/platform_device.h>
  9. #include <linux/mtd/partitions.h>
  10. #include <linux/mtd/physmap.h>
  11. static struct mtd_partition cobalt_mtd_partitions[] = {
  12. {
  13. .name = "firmware",
  14. .offset = 0x0,
  15. .size = 0x80000,
  16. },
  17. };
  18. static struct physmap_flash_data cobalt_flash_data = {
  19. .width = 1,
  20. .nr_parts = 1,
  21. .parts = cobalt_mtd_partitions,
  22. };
  23. static struct resource cobalt_mtd_resource = {
  24. .start = 0x1fc00000,
  25. .end = 0x1fc7ffff,
  26. .flags = IORESOURCE_MEM,
  27. };
  28. static struct platform_device cobalt_mtd = {
  29. .name = "physmap-flash",
  30. .dev = {
  31. .platform_data = &cobalt_flash_data,
  32. },
  33. .num_resources = 1,
  34. .resource = &cobalt_mtd_resource,
  35. };
  36. static int __init cobalt_mtd_init(void)
  37. {
  38. platform_device_register(&cobalt_mtd);
  39. return 0;
  40. }
  41. device_initcall(cobalt_mtd_init);