blob: 73490ae0c47685773d08c4c502d5d66e9279cf99 [file] [log] [blame]
Haavard Skinnemoen5f97f7f2006-09-25 23:32:13 -07001/*
2 * Copyright (C) 2004-2006 Atmel Corporation
3 *
4 * Based on linux/include/asm-arm/setup.h
Uwe Kleine-Königac310bb2008-07-10 17:30:46 -07005 * Copyright (C) 1997-1999 Russell King
Haavard Skinnemoen5f97f7f2006-09-25 23:32:13 -07006 *
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
David Howells83b9d3a2012-10-10 12:09:31 +010014#include <uapi/asm/setup.h>
Haavard Skinnemoen5f97f7f2006-09-25 23:32:13 -070015
Adrian Bunk7d1362c2006-12-06 20:40:38 -080016
Haavard Skinnemoen5f97f7f2006-09-25 23:32:13 -070017/* Magic number indicating that a tag table is present */
18#define ATAG_MAGIC 0xa2a25441
19
20#ifndef __ASSEMBLY__
21
22/*
23 * Generic memory range, used by several tags.
24 *
25 * addr is always physical.
26 * size is measured in bytes.
27 * next is for use by the OS, e.g. for grouping regions into
28 * linked lists.
29 */
30struct tag_mem_range {
31 u32 addr;
32 u32 size;
33 struct tag_mem_range * next;
34};
35
36/* The list ends with an ATAG_NONE node. */
37#define ATAG_NONE 0x00000000
38
39struct tag_header {
40 u32 size;
41 u32 tag;
42};
43
44/* The list must start with an ATAG_CORE node */
45#define ATAG_CORE 0x54410001
46
47struct tag_core {
48 u32 flags;
49 u32 pagesize;
50 u32 rootdev;
51};
52
53/* it is allowed to have multiple ATAG_MEM nodes */
54#define ATAG_MEM 0x54410002
55/* ATAG_MEM uses tag_mem_range */
56
57/* command line: \0 terminated string */
58#define ATAG_CMDLINE 0x54410003
59
60struct tag_cmdline {
61 char cmdline[1]; /* this is the minimum size */
62};
63
64/* Ramdisk image (may be compressed) */
65#define ATAG_RDIMG 0x54410004
66/* ATAG_RDIMG uses tag_mem_range */
67
68/* Information about various clocks present in the system */
69#define ATAG_CLOCK 0x54410005
70
71struct tag_clock {
72 u32 clock_id; /* Which clock are we talking about? */
73 u32 clock_flags; /* Special features */
74 u64 clock_hz; /* Clock speed in Hz */
75};
76
77/* The clock types we know about */
78#define CLOCK_BOOTCPU 0
79
80/* Memory reserved for the system (e.g. the bootloader) */
81#define ATAG_RSVD_MEM 0x54410006
82/* ATAG_RSVD_MEM uses tag_mem_range */
83
84/* Ethernet information */
85
86#define ATAG_ETHERNET 0x54410007
87
88struct tag_ethernet {
89 u8 mac_index;
90 u8 mii_phy_addr;
91 u8 hw_address[6];
92};
93
94#define ETH_INVALID_PHY 0xff
95
Andreas Bießmann24a1a472011-04-13 10:07:35 +020096/* board information */
97#define ATAG_BOARDINFO 0x54410008
98
99struct tag_boardinfo {
100 u32 board_number;
101};
102
Haavard Skinnemoen5f97f7f2006-09-25 23:32:13 -0700103struct tag {
104 struct tag_header hdr;
105 union {
106 struct tag_core core;
107 struct tag_mem_range mem_range;
108 struct tag_cmdline cmdline;
109 struct tag_clock clock;
110 struct tag_ethernet ethernet;
Andreas Bießmann24a1a472011-04-13 10:07:35 +0200111 struct tag_boardinfo boardinfo;
Haavard Skinnemoen5f97f7f2006-09-25 23:32:13 -0700112 } u;
113};
114
115struct tagtable {
116 u32 tag;
117 int (*parse)(struct tag *);
118};
119
Adrian Bunk3ff6eec2008-01-24 22:16:20 +0100120#define __tag __used __attribute__((__section__(".taglist.init")))
Haavard Skinnemoen5f97f7f2006-09-25 23:32:13 -0700121#define __tagtable(tag, fn) \
122 static struct tagtable __tagtable_##fn __tag = { tag, fn }
123
124#define tag_member_present(tag,member) \
125 ((unsigned long)(&((struct tag *)0L)->member + 1) \
126 <= (tag)->hdr.size * 4)
127
128#define tag_next(t) ((struct tag *)((u32 *)(t) + (t)->hdr.size))
129#define tag_size(type) ((sizeof(struct tag_header) + sizeof(struct type)) >> 2)
130
131#define for_each_tag(t,base) \
132 for (t = base; t->hdr.size; t = tag_next(t))
133
Haavard Skinnemoen5f97f7f2006-09-25 23:32:13 -0700134extern struct tag *bootloader_tags;
135
Haavard Skinnemoend80e2bb2007-03-21 16:23:41 +0100136extern resource_size_t fbmem_start;
137extern resource_size_t fbmem_size;
Andreas Bießmann24a1a472011-04-13 10:07:35 +0200138extern u32 board_number;
Haavard Skinnemoend8011762007-03-21 16:02:57 +0100139
140void setup_processor(void);
Haavard Skinnemoen5f97f7f2006-09-25 23:32:13 -0700141
Haavard Skinnemoen5f97f7f2006-09-25 23:32:13 -0700142#endif /* !__ASSEMBLY__ */
143
Haavard Skinnemoen5f97f7f2006-09-25 23:32:13 -0700144#endif /* __ASM_AVR32_SETUP_H__ */