blob: f457aa30c6a49a71831316caa8563a97aa3c2679 [file] [log] [blame]
Heiko Schocher210c8c02008-11-21 08:29:40 +01001/*
2 * (C) Copyright 2008
3 * Heiko Schocher, DENX Software Engineering, hs@denx.de.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; either version 2 of
8 * the License, or (at your option) any later version.
9 */
10
11#ifndef __KEYMILE_COMMON_H
12#define __KEYMILE_COMMON_H
13
Heiko Schocherb11f53f2011-03-15 16:52:29 +010014#define WRG_RESET 0x80
15#define H_OPORTS_14 0x40
16#define WRG_LED 0x02
17#define WRL_BOOT 0x01
18
Stefan Bigler5758dd72012-05-04 10:55:55 +020019#define OPRTL_XBUFENA 0x20
20
Heiko Schocherb11f53f2011-03-15 16:52:29 +010021#define H_OPORTS_SCC4_ENA 0x10
22#define H_OPORTS_SCC4_FD_ENA 0x04
23#define H_OPORTS_FCC1_PW_DWN 0x01
24
25#define PIGGY_PRESENT 0x80
26
27struct km_bec_fpga {
28 unsigned char id;
29 unsigned char rev;
30 unsigned char oprth;
31 unsigned char oprtl;
32 unsigned char res1[3];
33 unsigned char bprth;
34 unsigned char bprtl;
Thomas Herzmann95209b62012-05-04 10:55:56 +020035 unsigned char gprt3;
36 unsigned char gprt2;
37 unsigned char gprt1;
38 unsigned char gprt0;
39 unsigned char res2[2];
Heiko Schocherb11f53f2011-03-15 16:52:29 +010040 unsigned char prst;
41 unsigned char res3[0xfff0];
42 unsigned char pgy_id;
43 unsigned char pgy_rev;
44 unsigned char pgy_outputs;
45 unsigned char pgy_eth;
46};
47
Huber, Andreasf30c62b2011-05-02 22:56:54 +000048#define BFTICU_DIPSWITCH_MASK 0x0f
49
50/*
51 * BFTICU FPGA iomap
52 * BFTICU is used on mgcoge and mgocge3ne
53 */
54struct bfticu_iomap {
55 u8 xi_ena; /* General defect enable */
56 u8 pack1[3];
57 u8 en_csn;
58 u8 pack2;
59 u8 safe_mem;
60 u8 pack3;
61 u8 id;
62 u8 pack4;
63 u8 rev;
64 u8 build;
65 u8 p_frc;
66 u8 p_msk;
67 u8 pack5[2];
68 u8 xg_int;
69 u8 pack6[15];
70 u8 s_conf;
71 u8 pack7;
72 u8 dmx_conf12;
73 u8 pack8;
74 u8 s_clkslv;
75 u8 pack9[11];
76 u8 d_conf;
77 u8 d_mask_ca;
78 u8 d_pll_del;
79 u8 pack10[16];
80 u8 t_conf_ca;
81 u8 t_mask_ca;
82 u8 pack11[13];
83 u8 m_def0;
84 u8 m_def1;
85 u8 m_def2;
86 u8 m_def3;
87 u8 m_def4;
88 u8 m_def5;
89 u8 m_def_trap0;
90 u8 m_def_trap1;
91 u8 m_def_trap2;
92 u8 m_def_trap3;
93 u8 m_def_trap4;
94 u8 m_def_trap5;
95 u8 m_mask_def0;
96 u8 m_mask_def1;
97 u8 m_mask_def2;
98 u8 m_mask_def3;
99 u8 m_mask_def4;
100 u8 m_mask_def5;
101 u8 m_def_mask0;
102 u8 m_def_mask1;
103 u8 m_def_mask2;
104 u8 m_def_mask3;
105 u8 m_def_mask4;
106 u8 m_def_mask5;
107 u8 m_def_pri;
108 u8 pack12[11];
109 u8 hw_status;
110 u8 pack13;
111 u8 hw_control1;
112 u8 hw_control2;
113 u8 hw_control3;
114 u8 pack14[7];
115 u8 led_on; /* Leds */
116 u8 pack15;
117 u8 sfp_control; /* SFP modules */
118 u8 pack16;
119 u8 alarm_control; /* Alarm output */
120 u8 pack17;
121 u8 icps; /* ICN clock pulse shaping */
122 u8 mswitch; /* Read mode switch */
123 u8 pack18[6];
124 u8 pb_dbug;
125};
126
Heiko Schocher0d015202011-01-06 10:25:26 +0100127#if !defined(CONFIG_PIGGY_MAC_ADRESS_OFFSET)
128#define CONFIG_PIGGY_MAC_ADRESS_OFFSET 0
129#endif
130
Heiko Schocherb11f53f2011-03-15 16:52:29 +0100131int ethernet_present(void);
132int ivm_read_eeprom(void);
Heiko Schocher210c8c02008-11-21 08:29:40 +0100133
Heiko Schocherf1fef1d2010-04-26 13:07:28 +0200134int set_km_env(void);
Heiko Schocherb11f53f2011-03-15 16:52:29 +0100135int fdt_set_node_and_value(void *blob,
Heiko Schocherdc71b242009-07-09 12:04:18 +0200136 char *nodename,
137 char *regname,
138 void *var,
139 int size);
Heiko Schocherb11f53f2011-03-15 16:52:29 +0100140int fdt_get_node_and_value(void *blob,
Heiko Schocherdc71b242009-07-09 12:04:18 +0200141 char *nodename,
142 char *propname,
143 void **var);
Heiko Schocherb11f53f2011-03-15 16:52:29 +0100144
Holger Bruncke792aff2011-09-14 10:54:12 +0200145#define DELAY_ABORT_SEQ 62 /* @200kHz 9 clocks = 44us, 62us is ok */
146#define DELAY_HALF_PERIOD (500 / (CONFIG_SYS_I2C_SPEED / 1000))
147
Heiko Schocherb11f53f2011-03-15 16:52:29 +0100148int i2c_soft_read_pin(void);
Holger Brunck4f745bf2011-06-05 22:22:18 +0000149int i2c_make_abort(void);
Heiko Schocher210c8c02008-11-21 08:29:40 +0100150#endif /* __KEYMILE_COMMON_H */