4 * Compex's MyLoader specific prom routines
6 * Copyright (C) 2007 OpenWrt.org
7 * Copyright (C) 2007 Gabor Juhos <juhosg@freemail.hu>
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the
21 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 * Boston, MA 02110-1301, USA.
25 #include <linux/types.h>
26 #include <linux/autoconf.h>
27 #include <linux/kernel.h>
28 #include <linux/init.h>
29 #include <linux/string.h>
31 #include <asm/bootinfo.h>
32 #include <asm/addrspace.h>
33 #include <asm/byteorder.h>
35 #include <adm5120_defs.h>
36 #include <prom/myloader.h>
37 #include "prom_read.h"
39 #define SYS_PARAMS_ADDR KSEG1ADDR(ADM5120_SRAM0_BASE+0x0F000)
40 #define BOARD_PARAMS_ADDR KSEG1ADDR(ADM5120_SRAM0_BASE+0x0F800)
41 #define PART_TABLE_ADDR KSEG1ADDR(ADM5120_SRAM0_BASE+0x10000)
43 static int myloader_found
= 0;
45 struct myloader_info myloader_info
;
47 int __init
myloader_present(void)
49 struct mylo_system_params
*sysp
;
50 struct mylo_board_params
*boardp
;
51 struct mylo_partition_table
*parts
;
56 sysp
= (struct mylo_system_params
*)(SYS_PARAMS_ADDR
);
57 boardp
= (struct mylo_board_params
*)(BOARD_PARAMS_ADDR
);
58 parts
= (struct mylo_partition_table
*)(PART_TABLE_ADDR
);
60 /* Check for some magic numbers */
61 if ((le32_to_cpu(sysp
->magic
) != MYLO_MAGIC_SYS_PARAMS
) ||
62 (le32_to_cpu(boardp
->magic
) != MYLO_MAGIC_BOARD_PARAMS
) ||
63 (le32_to_cpu(parts
->magic
) != MYLO_MAGIC_PARTITIONS
))
66 myloader_info
.vid
= le32_to_cpu(sysp
->vid
);
67 myloader_info
.did
= le32_to_cpu(sysp
->did
);
68 myloader_info
.svid
= le32_to_cpu(sysp
->svid
);
69 myloader_info
.sdid
= le32_to_cpu(sysp
->sdid
);
74 return myloader_found
;