1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-12-25 12:41:45 +02:00

[ar71xx] rewrite memory size detection

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@13198 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
juhosg 2008-11-13 15:55:39 +00:00
parent 6974a2421e
commit 7bb460e11a

View File

@ -85,28 +85,14 @@ int __init ar71xx_pci_init(unsigned nr_irqs, struct ar71xx_pci_irq *map)
static void __init ar71xx_detect_mem_size(void) static void __init ar71xx_detect_mem_size(void)
{ {
volatile u8 *p; unsigned long size;
u8 memsave;
u32 size;
p = (volatile u8 *) KSEG1ADDR(0); for (size = AR71XX_MEM_SIZE_MIN; size < AR71XX_MEM_SIZE_MAX;
memsave = *p; size <<= 1 ) {
for (size = AR71XX_MEM_SIZE_MIN; if (!memcmp(ar71xx_detect_mem_size,
size <= (AR71XX_MEM_SIZE_MAX >> 1); size <<= 1) { ar71xx_detect_mem_size + size, 1024))
volatile u8 *r; break;
r = (p + size);
*p = 0x55;
if (*r == 0x55) {
/* Mirrored data found, try another pattern */
*p = 0xAA;
if (*r == 0xAA) {
/* Mirrored data found again, stop detection */
break;
}
}
} }
*p = memsave;
add_memory_region(0, size, BOOT_MEM_RAM); add_memory_region(0, size, BOOT_MEM_RAM);
} }