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