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/types.h>
13 #include <linux/kernel.h>
14 #include <linux/init.h>
15 #include <linux/string.h>
17 #include <asm/bootinfo.h>
18 #include <asm/addrspace.h>
19 #include <asm/byteorder.h>
21 #include <asm/mach-adm5120/adm5120_defs.h>
22 #include <prom/myloader.h>
23 #include "prom_read.h"
25 #define SYS_PARAMS_ADDR KSEG1ADDR(ADM5120_SRAM0_BASE+0x0F000)
26 #define BOARD_PARAMS_ADDR KSEG1ADDR(ADM5120_SRAM0_BASE+0x0F800)
27 #define PART_TABLE_ADDR KSEG1ADDR(ADM5120_SRAM0_BASE+0x10000)
29 static int myloader_found;
31 struct myloader_info myloader_info;
33 int __init myloader_present(void)
35 struct mylo_system_params *sysp;
36 struct mylo_board_params *boardp;
37 struct mylo_partition_table *parts;
43 sysp = (struct mylo_system_params *)(SYS_PARAMS_ADDR);
44 boardp = (struct mylo_board_params *)(BOARD_PARAMS_ADDR);
45 parts = (struct mylo_partition_table *)(PART_TABLE_ADDR);
47 /* Check for some magic numbers */
48 if ((le32_to_cpu(sysp->magic) != MYLO_MAGIC_SYS_PARAMS) ||
49 (le32_to_cpu(boardp->magic) != MYLO_MAGIC_BOARD_PARAMS) ||
50 (le32_to_cpu(parts->magic) != MYLO_MAGIC_PARTITIONS))
53 myloader_info.vid = le32_to_cpu(sysp->vid);
54 myloader_info.did = le32_to_cpu(sysp->did);
55 myloader_info.svid = le32_to_cpu(sysp->svid);
56 myloader_info.sdid = le32_to_cpu(sysp->sdid);
58 for (i = 0; i < MYLO_ETHADDR_COUNT; i++) {
60 for (j = 0; j < 6; j++)
61 myloader_info.macs[i][j] = boardp->addr[i].mac[j];
67 return myloader_found;