| Haavard Skinnemoen | 5f97f7f | 2006-09-25 23:32:13 -0700 | [diff] [blame] | 1 | /* | 
 | 2 |  * Copyright (C) 2004-2006 Atmel Corporation | 
 | 3 |  * | 
 | 4 |  * Based on linux/include/asm-arm/setup.h | 
 | 5 |  *   Copyright (C) 1997-1999 Russel King | 
 | 6 |  * | 
 | 7 |  * This program is free software; you can redistribute it and/or modify | 
 | 8 |  * it under the terms of the GNU General Public License version 2 as | 
 | 9 |  * published by the Free Software Foundation. | 
 | 10 |  */ | 
 | 11 | #ifndef __ASM_AVR32_SETUP_H__ | 
 | 12 | #define __ASM_AVR32_SETUP_H__ | 
 | 13 |  | 
 | 14 | #define COMMAND_LINE_SIZE 256 | 
 | 15 |  | 
 | 16 | /* Magic number indicating that a tag table is present */ | 
 | 17 | #define ATAG_MAGIC	0xa2a25441 | 
 | 18 |  | 
 | 19 | #ifndef __ASSEMBLY__ | 
 | 20 |  | 
 | 21 | /* | 
 | 22 |  * Generic memory range, used by several tags. | 
 | 23 |  * | 
 | 24 |  *   addr is always physical. | 
 | 25 |  *   size is measured in bytes. | 
 | 26 |  *   next is for use by the OS, e.g. for grouping regions into | 
 | 27 |  *        linked lists. | 
 | 28 |  */ | 
 | 29 | struct tag_mem_range { | 
 | 30 | 	u32			addr; | 
 | 31 | 	u32			size; | 
 | 32 | 	struct tag_mem_range *	next; | 
 | 33 | }; | 
 | 34 |  | 
 | 35 | /* The list ends with an ATAG_NONE node. */ | 
 | 36 | #define ATAG_NONE	0x00000000 | 
 | 37 |  | 
 | 38 | struct tag_header { | 
 | 39 | 	u32 size; | 
 | 40 | 	u32 tag; | 
 | 41 | }; | 
 | 42 |  | 
 | 43 | /* The list must start with an ATAG_CORE node */ | 
 | 44 | #define ATAG_CORE	0x54410001 | 
 | 45 |  | 
 | 46 | struct tag_core { | 
 | 47 | 	u32 flags; | 
 | 48 | 	u32 pagesize; | 
 | 49 | 	u32 rootdev; | 
 | 50 | }; | 
 | 51 |  | 
 | 52 | /* it is allowed to have multiple ATAG_MEM nodes */ | 
 | 53 | #define ATAG_MEM	0x54410002 | 
 | 54 | /* ATAG_MEM uses tag_mem_range */ | 
 | 55 |  | 
 | 56 | /* command line: \0 terminated string */ | 
 | 57 | #define ATAG_CMDLINE	0x54410003 | 
 | 58 |  | 
 | 59 | struct tag_cmdline { | 
 | 60 | 	char	cmdline[1];	/* this is the minimum size */ | 
 | 61 | }; | 
 | 62 |  | 
 | 63 | /* Ramdisk image (may be compressed) */ | 
 | 64 | #define ATAG_RDIMG	0x54410004 | 
 | 65 | /* ATAG_RDIMG uses tag_mem_range */ | 
 | 66 |  | 
 | 67 | /* Information about various clocks present in the system */ | 
 | 68 | #define ATAG_CLOCK	0x54410005 | 
 | 69 |  | 
 | 70 | struct tag_clock { | 
 | 71 | 	u32	clock_id;	/* Which clock are we talking about? */ | 
 | 72 | 	u32	clock_flags;	/* Special features */ | 
 | 73 | 	u64	clock_hz;	/* Clock speed in Hz */ | 
 | 74 | }; | 
 | 75 |  | 
 | 76 | /* The clock types we know about */ | 
 | 77 | #define CLOCK_BOOTCPU	0 | 
 | 78 |  | 
 | 79 | /* Memory reserved for the system (e.g. the bootloader) */ | 
 | 80 | #define ATAG_RSVD_MEM	0x54410006 | 
 | 81 | /* ATAG_RSVD_MEM uses tag_mem_range */ | 
 | 82 |  | 
 | 83 | /* Ethernet information */ | 
 | 84 |  | 
 | 85 | #define ATAG_ETHERNET	0x54410007 | 
 | 86 |  | 
 | 87 | struct tag_ethernet { | 
 | 88 | 	u8	mac_index; | 
 | 89 | 	u8	mii_phy_addr; | 
 | 90 | 	u8	hw_address[6]; | 
 | 91 | }; | 
 | 92 |  | 
 | 93 | #define ETH_INVALID_PHY	0xff | 
 | 94 |  | 
 | 95 | struct tag { | 
 | 96 | 	struct tag_header hdr; | 
 | 97 | 	union { | 
 | 98 | 		struct tag_core core; | 
 | 99 | 		struct tag_mem_range mem_range; | 
 | 100 | 		struct tag_cmdline cmdline; | 
 | 101 | 		struct tag_clock clock; | 
 | 102 | 		struct tag_ethernet ethernet; | 
 | 103 | 	} u; | 
 | 104 | }; | 
 | 105 |  | 
 | 106 | struct tagtable { | 
 | 107 | 	u32	tag; | 
 | 108 | 	int	(*parse)(struct tag *); | 
 | 109 | }; | 
 | 110 |  | 
 | 111 | #define __tag __attribute_used__ __attribute__((__section__(".taglist"))) | 
 | 112 | #define __tagtable(tag, fn)						\ | 
 | 113 | 	static struct tagtable __tagtable_##fn __tag = { tag, fn } | 
 | 114 |  | 
 | 115 | #define tag_member_present(tag,member)					\ | 
 | 116 | 	((unsigned long)(&((struct tag *)0L)->member + 1)		\ | 
 | 117 | 	 <= (tag)->hdr.size * 4) | 
 | 118 |  | 
 | 119 | #define tag_next(t)	((struct tag *)((u32 *)(t) + (t)->hdr.size)) | 
 | 120 | #define tag_size(type)	((sizeof(struct tag_header) + sizeof(struct type)) >> 2) | 
 | 121 |  | 
 | 122 | #define for_each_tag(t,base)						\ | 
 | 123 | 	for (t = base; t->hdr.size; t = tag_next(t)) | 
 | 124 |  | 
 | 125 | extern struct tag_mem_range *mem_phys; | 
 | 126 | extern struct tag_mem_range *mem_reserved; | 
 | 127 | extern struct tag_mem_range *mem_ramdisk; | 
 | 128 |  | 
 | 129 | extern struct tag *bootloader_tags; | 
 | 130 |  | 
 | 131 | extern void setup_bootmem(void); | 
 | 132 | extern void setup_processor(void); | 
 | 133 | extern void board_setup_fbmem(unsigned long fbmem_start, | 
 | 134 | 			      unsigned long fbmem_size); | 
 | 135 |  | 
 | 136 | /* Chip-specific hook to enable the use of SDRAM */ | 
 | 137 | void chip_enable_sdram(void); | 
 | 138 |  | 
 | 139 | #endif /* !__ASSEMBLY__ */ | 
 | 140 |  | 
 | 141 | #endif /* __ASM_AVR32_SETUP_H__ */ |