2 * Compex's MyLoader specific prom routines
4 * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published
8 * by the Free Software Foundation.
12 #include <linux/kernel.h>
13 #include <linux/init.h>
14 #include <linux/types.h>
15 #include <linux/string.h>
17 #include <asm/addrspace.h>
18 #include <asm/fw/myloader/myloader.h>
20 #define SYS_PARAMS_ADDR KSEG1ADDR(0x80000800)
21 #define BOARD_PARAMS_ADDR KSEG1ADDR(0x80000A00)
22 #define PART_TABLE_ADDR KSEG1ADDR(0x80000C00)
23 #define BOOT_PARAMS_ADDR KSEG1ADDR(0x80000E00)
25 static struct myloader_info myloader_info __initdata
;
26 static int myloader_found __initdata
;
28 struct myloader_info
* __init
myloader_get_info(void)
30 struct mylo_system_params
*sysp
;
31 struct mylo_board_params
*boardp
;
32 struct mylo_partition_table
*parts
;
35 return &myloader_info
;
37 sysp
= (struct mylo_system_params
*)(SYS_PARAMS_ADDR
);
38 boardp
= (struct mylo_board_params
*)(BOARD_PARAMS_ADDR
);
39 parts
= (struct mylo_partition_table
*)(PART_TABLE_ADDR
);
41 printk(KERN_DEBUG
"MyLoader: sysp=%08x, boardp=%08x, parts=%08x\n",
42 sysp
->magic
, boardp
->magic
, parts
->magic
);
44 /* Check for some magic numbers */
45 if (sysp
->magic
!= MYLO_MAGIC_SYS_PARAMS
||
46 boardp
->magic
!= MYLO_MAGIC_BOARD_PARAMS
||
47 le32_to_cpu(parts
->magic
) != MYLO_MAGIC_PARTITIONS
)
50 printk(KERN_DEBUG
"MyLoader: id=%04x:%04x, sub_id=%04x:%04x\n",
51 sysp
->vid
, sysp
->did
, sysp
->svid
, sysp
->sdid
);
53 myloader_info
.vid
= sysp
->vid
;
54 myloader_info
.did
= sysp
->did
;
55 myloader_info
.svid
= sysp
->svid
;
56 myloader_info
.sdid
= sysp
->sdid
;
58 memcpy(myloader_info
.macs
, boardp
->addr
, sizeof(myloader_info
.macs
));
62 return &myloader_info
;