flash.c 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /* Flash mappings for the MB93090-MB00 motherboard
  2. *
  3. * Copyright (C) 2009 Red Hat, Inc. All Rights Reserved.
  4. * Written by David Howells (dhowells@redhat.com)
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public Licence
  8. * as published by the Free Software Foundation; either version
  9. * 2 of the Licence, or (at your option) any later version.
  10. */
  11. #include <linux/module.h>
  12. #include <linux/platform_device.h>
  13. #include <linux/mtd/partitions.h>
  14. #include <linux/mtd/physmap.h>
  15. #define MB93090_BOOTROM_ADDR 0xFF000000 /* Boot ROM */
  16. #define MB93090_BOOTROM_SIZE (2 * 1024 * 1024)
  17. #define MB93090_USERROM_ADDR 0xFF200000 /* User ROM */
  18. #define MB93090_USERROM_SIZE (2 * 1024 * 1024)
  19. /*
  20. * default MTD partition table for both main flash devices, expected to be
  21. * overridden by RedBoot
  22. */
  23. static struct mtd_partition mb93090_partitions[] = {
  24. {
  25. .name = "Filesystem",
  26. .size = MTDPART_SIZ_FULL,
  27. .offset = 0,
  28. }
  29. };
  30. /*
  31. * Definition of the MB93090 Boot ROM (on the CPU card)
  32. */
  33. static struct physmap_flash_data mb93090_bootrom_data = {
  34. .width = 2,
  35. .nr_parts = 2,
  36. .parts = mb93090_partitions,
  37. };
  38. static struct resource mb93090_bootrom_resource = {
  39. .start = MB93090_BOOTROM_ADDR,
  40. .end = MB93090_BOOTROM_ADDR + MB93090_BOOTROM_SIZE - 1,
  41. .flags = IORESOURCE_MEM,
  42. };
  43. static struct platform_device mb93090_bootrom = {
  44. .name = "physmap-flash",
  45. .id = 0,
  46. .dev.platform_data = &mb93090_bootrom_data,
  47. .num_resources = 1,
  48. .resource = &mb93090_bootrom_resource,
  49. };
  50. /*
  51. * Definition of the MB93090 User ROM definition (on the motherboard)
  52. */
  53. static struct physmap_flash_data mb93090_userrom_data = {
  54. .width = 2,
  55. .nr_parts = 2,
  56. .parts = mb93090_partitions,
  57. };
  58. static struct resource mb93090_userrom_resource = {
  59. .start = MB93090_USERROM_ADDR,
  60. .end = MB93090_USERROM_ADDR + MB93090_USERROM_SIZE - 1,
  61. .flags = IORESOURCE_MEM,
  62. };
  63. static struct platform_device mb93090_userrom = {
  64. .name = "physmap-flash",
  65. .id = 1,
  66. .dev.platform_data = &mb93090_userrom_data,
  67. .num_resources = 1,
  68. .resource = &mb93090_userrom_resource,
  69. };
  70. /*
  71. * register the MB93090 flashes
  72. */
  73. static int __init mb93090_mtd_init(void)
  74. {
  75. platform_device_register(&mb93090_bootrom);
  76. platform_device_register(&mb93090_userrom);
  77. return 0;
  78. }
  79. module_init(mb93090_mtd_init);