brcm.patch 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. --- linux-2.6.36.orig/arch/mips/bcm47xx/Makefile 2010-10-20 22:30:22.000000000 +0200
  2. +++ linux-2.6.36/arch/mips/bcm47xx/Makefile 2010-12-22 16:39:15.000000000 +0100
  3. @@ -3,4 +3,4 @@
  4. # under Linux.
  5. #
  6. -obj-y := gpio.o irq.o nvram.o prom.o serial.o setup.o time.o wgt634u.o
  7. +obj-y := gpio.o irq.o nvram.o prom.o serial.o setup.o time.o platform.o
  8. --- /dev/null Fri Jan 7 17:21:57 2011
  9. +++ linux-2.6.36/arch/mips/bcm47xx/platform.c Fri Jan 7 17:21:42 2011
  10. @@ -0,0 +1,147 @@
  11. +/*
  12. + * This file is subject to the terms and conditions of the GNU General Public
  13. + * License. See the file "COPYING" in the main directory of this archive
  14. + * for more details.
  15. + *
  16. + * Copyright (C) 2010, 2011 Waldemar Brodkorb <wbx@openadk.org>
  17. + * Copyright © 2007, 2011 Thorsten Glaser <tg@freewrt.org>
  18. + */
  19. +
  20. +#include <linux/platform_device.h>
  21. +#include <linux/module.h>
  22. +#include <linux/mtd/physmap.h>
  23. +#include <linux/ssb/ssb.h>
  24. +
  25. +#include <asm/mach-bcm47xx/bcm47xx.h>
  26. +#include <asm/mach-bcm47xx/nvram.h>
  27. +
  28. +#define NVRAM_FLASH_SIZE 0x10000
  29. +#define CFGFS_FLASH_SIZE (64 * 1024)
  30. +
  31. +static struct mtd_partition bcm47xx_partitions[] = {
  32. +#define SLOT_CFE 0
  33. + {
  34. + .name = "cfe",
  35. + .offset = 0,
  36. + .size = 0x40000, /* 256k */
  37. + .mask_flags = MTD_WRITEABLE /* force read-only */
  38. + },
  39. +#define SLOT_LINUX 1
  40. + {
  41. + .name = "linux",
  42. + .offset = 0,
  43. + .size = 0,
  44. + },
  45. +#define SLOT_ROOTFS 2
  46. + {
  47. + .name = "rootfs",
  48. + .offset = 0,
  49. + .size = 0,
  50. + },
  51. +#define SLOT_CFGFS 3
  52. + {
  53. + .name = "cfgfs",
  54. + .offset = 0,
  55. + .size = 0,
  56. + },
  57. +#define SLOT_NVRAM 4
  58. + {
  59. + .name = "nvram",
  60. + .offset = 0,
  61. + .size = 0,
  62. + },
  63. +};
  64. +
  65. +static struct physmap_flash_data bcm47xx_flash_data = {
  66. + .parts = bcm47xx_partitions,
  67. + .nr_parts = ARRAY_SIZE(bcm47xx_partitions)
  68. +};
  69. +
  70. +static struct resource bcm47xx_flash_resource = {
  71. + .flags = IORESOURCE_MEM,
  72. +};
  73. +
  74. +static struct platform_device bcm47xx_flash = {
  75. + .name = "physmap-flash",
  76. + .id = 0,
  77. + .dev = { .platform_data = &bcm47xx_flash_data, },
  78. + .resource = &bcm47xx_flash_resource,
  79. + .num_resources = 1,
  80. +};
  81. +
  82. +static struct platform_device *bcm47xx_devices[] __initdata = {
  83. + &bcm47xx_flash,
  84. +};
  85. +
  86. +struct bcm47xx_trx_header {
  87. +#define BCM47XX_TRX_MAGIC 0x30524448
  88. + u32 magic;
  89. + u32 len;
  90. + u32 crc32;
  91. + u32 flag_version;
  92. + u32 offsets[3];
  93. +};
  94. +
  95. +#define UPTODOWN(slot, psize) do { \
  96. + posn -= psize; left -= psize; \
  97. + bcm47xx_partitions[slot].offset = posn; \
  98. + bcm47xx_partitions[slot].size = psize; \
  99. +} while (/* CONSTCOND */ 0)
  100. +
  101. +static int __init bcm47xx_register_devices(void)
  102. +{
  103. + u32 flash_size;
  104. + size_t left, posn;
  105. + struct ssb_mipscore *mcore = &ssb_bcm47xx.mipscore;
  106. + struct bcm47xx_trx_header *trx_hdr;
  107. +
  108. + trx_hdr = (void *)KSEG1ADDR(mcore->flash_window + 0x40000);
  109. +
  110. + /* devices might have 2, 4 or 8 MB flash size */
  111. +#ifdef BCM47XX_OVERRIDE_FLASHSIZE
  112. + flash_size = BCM47XX_OVERRIDE_FLASHSIZE;
  113. + mcore->flash_window_size = flash_size;
  114. +#define BCM47XX_OVERRODE_FLASHSIZE " (overridden)"
  115. +#else
  116. + flash_size = mcore->flash_window_size;
  117. +#define BCM47XX_OVERRODE_FLASHSIZE ""
  118. +#endif
  119. + printk(KERN_INFO "FLASH SIZE%s: %x\n", BCM47XX_OVERRODE_FLASHSIZE,
  120. + flash_size);
  121. +
  122. + left = flash_size - 0x40000;
  123. + posn = flash_size;
  124. + UPTODOWN(SLOT_NVRAM, NVRAM_FLASH_SIZE);
  125. + UPTODOWN(SLOT_CFGFS, CFGFS_FLASH_SIZE);
  126. + bcm47xx_partitions[SLOT_LINUX].offset = 0x40000;
  127. + bcm47xx_partitions[SLOT_LINUX].size = left;
  128. +
  129. + if (trx_hdr->magic == BCM47XX_TRX_MAGIC) {
  130. + bcm47xx_partitions[SLOT_ROOTFS].offset =
  131. + bcm47xx_partitions[SLOT_LINUX].offset +
  132. + trx_hdr->offsets[1];
  133. + bcm47xx_partitions[SLOT_ROOTFS].size =
  134. + bcm47xx_partitions[SLOT_LINUX].size -
  135. + trx_hdr->offsets[1];
  136. + } else
  137. + printk("bcm47xx/platform: no TRX header found\n");
  138. +
  139. + printk(KERN_INFO "=== Flash map dump ===\n");
  140. + for (posn = 0; posn < bcm47xx_flash_data.nr_parts; ++posn)
  141. + printk(KERN_INFO " #%u %08X @%08X '%s'\n",
  142. + (unsigned int)posn,
  143. + (unsigned int)bcm47xx_partitions[posn].size,
  144. + (unsigned int)bcm47xx_partitions[posn].offset,
  145. + bcm47xx_partitions[posn].name);
  146. + printk(KERN_INFO "=== Hope this works, have a nice day\n");
  147. +
  148. + bcm47xx_flash_data.width = mcore->flash_buswidth;
  149. + bcm47xx_flash_resource.start = mcore->flash_window;
  150. + bcm47xx_flash_resource.end = mcore->flash_window
  151. + + mcore->flash_window_size
  152. + - 1;
  153. + return platform_add_devices(bcm47xx_devices,
  154. + ARRAY_SIZE(bcm47xx_devices));
  155. +}
  156. +
  157. +device_initcall(bcm47xx_register_devices);
  158. --- linux-2.6.36.orig/drivers/ssb/driver_mipscore.c 2010-10-20 22:30:22.000000000 +0200
  159. +++ linux-2.6.36/drivers/ssb/driver_mipscore.c 2010-12-22 16:38:53.000000000 +0100
  160. @@ -193,7 +193,7 @@
  161. mcore->flash_buswidth = 2;
  162. if (bus->chipco.dev) {
  163. mcore->flash_window = 0x1c000000;
  164. - mcore->flash_window_size = 0x02000000;
  165. + mcore->flash_window_size = 0x00800000;
  166. if ((ssb_read32(bus->chipco.dev, SSB_CHIPCO_FLASH_CFG)
  167. & SSB_CHIPCO_CFG_DS16) == 0)
  168. mcore->flash_buswidth = 1;