blob: e075f4687bac7f01ce51dc2f31dd20ac55afdc28 [file] [log] [blame]
Heiko Schocherd19a6ec2008-11-21 08:29:40 +01001/*
2 * (C) Copyright 2008
3 * Heiko Schocher, DENX Software Engineering, hs@denx.de.
4 *
Wolfgang Denkd79de1d2013-07-08 09:37:19 +02005 * SPDX-License-Identifier: GPL-2.0+
Heiko Schocherd19a6ec2008-11-21 08:29:40 +01006 */
7
8#ifndef __KEYMILE_COMMON_H
9#define __KEYMILE_COMMON_H
10
Heiko Schocher8ce3dd52011-03-15 16:52:29 +010011#define WRG_RESET 0x80
12#define H_OPORTS_14 0x40
13#define WRG_LED 0x02
14#define WRL_BOOT 0x01
15
Stefan Biglerabcd23c2012-05-04 10:55:55 +020016#define OPRTL_XBUFENA 0x20
17
Heiko Schocher8ce3dd52011-03-15 16:52:29 +010018#define H_OPORTS_SCC4_ENA 0x10
19#define H_OPORTS_SCC4_FD_ENA 0x04
20#define H_OPORTS_FCC1_PW_DWN 0x01
21
22#define PIGGY_PRESENT 0x80
23
24struct km_bec_fpga {
25 unsigned char id;
26 unsigned char rev;
27 unsigned char oprth;
28 unsigned char oprtl;
29 unsigned char res1[3];
30 unsigned char bprth;
31 unsigned char bprtl;
Thomas Herzmann94fbf522012-05-04 10:55:56 +020032 unsigned char gprt3;
33 unsigned char gprt2;
34 unsigned char gprt1;
35 unsigned char gprt0;
36 unsigned char res2[2];
Heiko Schocher8ce3dd52011-03-15 16:52:29 +010037 unsigned char prst;
38 unsigned char res3[0xfff0];
39 unsigned char pgy_id;
40 unsigned char pgy_rev;
41 unsigned char pgy_outputs;
42 unsigned char pgy_eth;
43};
44
Huber, Andreas49adfa82011-05-02 22:56:54 +000045#define BFTICU_DIPSWITCH_MASK 0x0f
46
47/*
48 * BFTICU FPGA iomap
49 * BFTICU is used on mgcoge and mgocge3ne
50 */
51struct bfticu_iomap {
52 u8 xi_ena; /* General defect enable */
53 u8 pack1[3];
54 u8 en_csn;
55 u8 pack2;
56 u8 safe_mem;
57 u8 pack3;
58 u8 id;
59 u8 pack4;
60 u8 rev;
61 u8 build;
62 u8 p_frc;
63 u8 p_msk;
64 u8 pack5[2];
65 u8 xg_int;
66 u8 pack6[15];
67 u8 s_conf;
68 u8 pack7;
69 u8 dmx_conf12;
70 u8 pack8;
71 u8 s_clkslv;
72 u8 pack9[11];
73 u8 d_conf;
74 u8 d_mask_ca;
75 u8 d_pll_del;
76 u8 pack10[16];
77 u8 t_conf_ca;
78 u8 t_mask_ca;
79 u8 pack11[13];
80 u8 m_def0;
81 u8 m_def1;
82 u8 m_def2;
83 u8 m_def3;
84 u8 m_def4;
85 u8 m_def5;
86 u8 m_def_trap0;
87 u8 m_def_trap1;
88 u8 m_def_trap2;
89 u8 m_def_trap3;
90 u8 m_def_trap4;
91 u8 m_def_trap5;
92 u8 m_mask_def0;
93 u8 m_mask_def1;
94 u8 m_mask_def2;
95 u8 m_mask_def3;
96 u8 m_mask_def4;
97 u8 m_mask_def5;
98 u8 m_def_mask0;
99 u8 m_def_mask1;
100 u8 m_def_mask2;
101 u8 m_def_mask3;
102 u8 m_def_mask4;
103 u8 m_def_mask5;
104 u8 m_def_pri;
105 u8 pack12[11];
106 u8 hw_status;
107 u8 pack13;
108 u8 hw_control1;
109 u8 hw_control2;
110 u8 hw_control3;
111 u8 pack14[7];
112 u8 led_on; /* Leds */
113 u8 pack15;
114 u8 sfp_control; /* SFP modules */
115 u8 pack16;
116 u8 alarm_control; /* Alarm output */
117 u8 pack17;
118 u8 icps; /* ICN clock pulse shaping */
119 u8 mswitch; /* Read mode switch */
120 u8 pack18[6];
121 u8 pb_dbug;
122};
123
Heiko Schocherb7aa50f2011-01-06 10:25:26 +0100124#if !defined(CONFIG_PIGGY_MAC_ADRESS_OFFSET)
125#define CONFIG_PIGGY_MAC_ADRESS_OFFSET 0
126#endif
127
Heiko Schocher8ce3dd52011-03-15 16:52:29 +0100128int ethernet_present(void);
129int ivm_read_eeprom(void);
Heiko Schocherd19a6ec2008-11-21 08:29:40 +0100130
Valentin Longchamp6633fed2012-07-05 05:05:05 +0000131int trigger_fpga_config(void);
132int wait_for_fpga_config(void);
133int fpga_reset(void);
134int toggle_eeprom_spi_bus(void);
135
Heiko Schochercfc58042010-04-26 13:07:28 +0200136int set_km_env(void);
Heiko Schocher8ce3dd52011-03-15 16:52:29 +0100137int fdt_set_node_and_value(void *blob,
Heiko Schocher875f47282009-07-09 12:04:18 +0200138 char *nodename,
139 char *regname,
140 void *var,
141 int size);
Heiko Schocher8ce3dd52011-03-15 16:52:29 +0100142int fdt_get_node_and_value(void *blob,
Heiko Schocher875f47282009-07-09 12:04:18 +0200143 char *nodename,
144 char *propname,
145 void **var);
Heiko Schocher8ce3dd52011-03-15 16:52:29 +0100146
Holger Brunck015a60f2011-09-14 10:54:12 +0200147#define DELAY_ABORT_SEQ 62 /* @200kHz 9 clocks = 44us, 62us is ok */
148#define DELAY_HALF_PERIOD (500 / (CONFIG_SYS_I2C_SPEED / 1000))
149
Heiko Schocher8ce3dd52011-03-15 16:52:29 +0100150int i2c_soft_read_pin(void);
Holger Brunckbf20a882011-06-05 22:22:18 +0000151int i2c_make_abort(void);
Heiko Schocherd19a6ec2008-11-21 08:29:40 +0100152#endif /* __KEYMILE_COMMON_H */