firebee.c 2.2 KB

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