firebee.c 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /***************************************************************************/
  2. /*
  3. * firebee.c -- extra startup code support for the FireBee boards
  4. *
  5. * Copyright (C) 2011, Greg Ungerer (gerg@snapgear.com)
  6. */
  7. /***************************************************************************/
  8. #include <linux/kernel.h>
  9. #include <linux/init.h>
  10. #include <linux/io.h>
  11. #include <linux/platform_device.h>
  12. #include <linux/mtd/mtd.h>
  13. #include <linux/mtd/partitions.h>
  14. #include <linux/mtd/physmap.h>
  15. #include <asm/coldfire.h>
  16. #include <asm/mcfsim.h>
  17. /***************************************************************************/
  18. /*
  19. * 8MB of NOR flash fitted to the FireBee board.
  20. */
  21. #define FLASH_PHYS_ADDR 0xe0000000 /* Physical address of flash */
  22. #define FLASH_PHYS_SIZE 0x00800000 /* Size of flash */
  23. #define PART_BOOT_START 0x00000000 /* Start at bottom of flash */
  24. #define PART_BOOT_SIZE 0x00040000 /* 256k in size */
  25. #define PART_IMAGE_START 0x00040000 /* Start after boot loader */
  26. #define PART_IMAGE_SIZE 0x006c0000 /* Most of flash */
  27. #define PART_FPGA_START 0x00700000 /* Start at offset 7MB */
  28. #define PART_FPGA_SIZE 0x00100000 /* 1MB in size */
  29. static struct mtd_partition firebee_flash_parts[] = {
  30. {
  31. .name = "dBUG",
  32. .offset = PART_BOOT_START,
  33. .size = PART_BOOT_SIZE,
  34. },
  35. {
  36. .name = "FPGA",
  37. .offset = PART_FPGA_START,
  38. .size = PART_FPGA_SIZE,
  39. },
  40. {
  41. .name = "image",
  42. .offset = PART_IMAGE_START,
  43. .size = PART_IMAGE_SIZE,
  44. },
  45. };
  46. static struct physmap_flash_data firebee_flash_data = {
  47. .width = 2,
  48. .nr_parts = ARRAY_SIZE(firebee_flash_parts),
  49. .parts = firebee_flash_parts,
  50. };
  51. static struct resource firebee_flash_resource = {
  52. .start = FLASH_PHYS_ADDR,
  53. .end = FLASH_PHYS_ADDR + FLASH_PHYS_SIZE,
  54. .flags = IORESOURCE_MEM,
  55. };
  56. static struct platform_device firebee_flash = {
  57. .name = "physmap-flash",
  58. .id = 0,
  59. .dev = {
  60. .platform_data = &firebee_flash_data,
  61. },
  62. .num_resources = 1,
  63. .resource = &firebee_flash_resource,
  64. };
  65. /***************************************************************************/
  66. static int __init init_firebee(void)
  67. {
  68. platform_device_register(&firebee_flash);
  69. return 0;
  70. }
  71. arch_initcall(init_firebee);
  72. /***************************************************************************/