101-rhone_physmap.patch 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. --- a/arch/mips/sibyte/swarm/platform.c
  2. +++ b/arch/mips/sibyte/swarm/platform.c
  3. @@ -5,6 +5,7 @@
  4. #include <linux/platform_device.h>
  5. #include <linux/ata_platform.h>
  6. +#include <asm/addrspace.h>
  7. #include <asm/sibyte/board.h>
  8. #include <asm/sibyte/sb1250_genbus.h>
  9. #include <asm/sibyte/sb1250_regs.h>
  10. @@ -137,3 +138,71 @@ static int __init sb1250_device_init(voi
  11. return ret;
  12. }
  13. device_initcall(sb1250_device_init);
  14. +
  15. +#ifdef CONFIG_SIBYTE_RHONE
  16. +
  17. +#include <linux/mtd/partitions.h>
  18. +#include <linux/mtd/physmap.h>
  19. +
  20. +/* The board has 16MB flash but CFE sets up only 2MB */
  21. +#define PHYS_TO_K1(a) CKSEG1ADDR(a)
  22. +#define BOOTROM_SIZE 0x100
  23. +
  24. +static void fixup_cs0_size(void)
  25. +{
  26. + SBWRITECSR(((A_IO_EXT_CS_BASE(0)) + R_IO_EXT_MULT_SIZE), BOOTROM_SIZE);
  27. +}
  28. +
  29. +static struct mtd_partition flash_parts[] = {
  30. + {
  31. + .name = "cfe",
  32. + .offset = 0x00000000,
  33. + .size = 0x00200000,
  34. + .mask_flags = MTD_WRITEABLE,
  35. + },
  36. + {
  37. + .name = "os",
  38. + .offset = 0x00200000,
  39. + .size = 0x00d00000,
  40. + },
  41. + {
  42. + .name = "environment",
  43. + .offset = 0x00f00000,
  44. + .size = 0x00100000,
  45. + .mask_flags = MTD_WRITEABLE,
  46. + },
  47. +};
  48. +
  49. +static struct physmap_flash_data flash_data = {
  50. + .width = 1,
  51. + .nr_parts = ARRAY_SIZE(flash_parts),
  52. + .parts = flash_parts,
  53. +};
  54. +
  55. +static struct resource flash_resource = {
  56. + .start = 0x1fc00000,
  57. + .end = 0x20bfffff,
  58. + .flags = IORESOURCE_MEM,
  59. +};
  60. +
  61. +static struct platform_device flash_device = {
  62. + .name = "physmap-flash",
  63. + .id = 0,
  64. + .resource = &flash_resource,
  65. + .num_resources = 1,
  66. + .dev = {
  67. + .platform_data = &flash_data,
  68. + },
  69. +};
  70. +
  71. +static int __init flash_setup(void)
  72. +{
  73. + fixup_cs0_size();
  74. + platform_device_register(&flash_device);
  75. +
  76. + return 0;
  77. +};
  78. +
  79. +device_initcall(flash_setup);
  80. +
  81. +#endif /* CONFIG_SIBYTE_RHONE */