Dirk Eibach | 81b3793 | 2011-01-21 09:31:21 +0100 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2010 |
| 3 | * Dirk Eibach, Guntermann & Drunck GmbH, eibach@gdsys.de |
| 4 | * |
Wolfgang Denk | bd8ec7e | 2013-10-07 13:07:26 +0200 | [diff] [blame] | 5 | * SPDX-License-Identifier: GPL-2.0+ |
Dirk Eibach | 81b3793 | 2011-01-21 09:31:21 +0100 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #ifndef __GDSYS_FPGA_H |
| 9 | #define __GDSYS_FPGA_H |
| 10 | |
Dirk Eibach | 6fabe55 | 2011-10-20 11:12:55 +0200 | [diff] [blame] | 11 | int init_func_fpga(void); |
| 12 | |
Dirk Eibach | 81b3793 | 2011-01-21 09:31:21 +0100 | [diff] [blame] | 13 | enum { |
| 14 | FPGA_STATE_DONE_FAILED = 1 << 0, |
| 15 | FPGA_STATE_REFLECTION_FAILED = 1 << 1, |
Dirk Eibach | 6fabe55 | 2011-10-20 11:12:55 +0200 | [diff] [blame] | 16 | FPGA_STATE_PLATFORM = 1 << 2, |
Dirk Eibach | 81b3793 | 2011-01-21 09:31:21 +0100 | [diff] [blame] | 17 | }; |
| 18 | |
| 19 | int get_fpga_state(unsigned dev); |
| 20 | void print_fpga_state(unsigned dev); |
| 21 | |
Dirk Eibach | 20614a2 | 2013-06-26 16:04:26 +0200 | [diff] [blame] | 22 | int fpga_set_reg(u32 fpga, u16 *reg, off_t regoff, u16 data); |
| 23 | int fpga_get_reg(u32 fpga, u16 *reg, off_t regoff, u16 *data); |
| 24 | |
| 25 | extern struct ihs_fpga *fpga_ptr[]; |
| 26 | |
| 27 | #define FPGA_SET_REG(ix, fld, val) \ |
| 28 | fpga_set_reg((ix), \ |
| 29 | &fpga_ptr[ix]->fld, \ |
| 30 | offsetof(struct ihs_fpga, fld), \ |
| 31 | val) |
| 32 | |
| 33 | #define FPGA_GET_REG(ix, fld, val) \ |
| 34 | fpga_get_reg((ix), \ |
| 35 | &fpga_ptr[ix]->fld, \ |
| 36 | offsetof(struct ihs_fpga, fld), \ |
| 37 | val) |
| 38 | |
Dirk Eibach | 6176f4c | 2012-04-27 10:33:46 +0200 | [diff] [blame] | 39 | struct ihs_gpio { |
Dirk Eibach | 81b3793 | 2011-01-21 09:31:21 +0100 | [diff] [blame] | 40 | u16 read; |
| 41 | u16 clear; |
| 42 | u16 set; |
Dirk Eibach | 6176f4c | 2012-04-27 10:33:46 +0200 | [diff] [blame] | 43 | }; |
Dirk Eibach | 81b3793 | 2011-01-21 09:31:21 +0100 | [diff] [blame] | 44 | |
Dirk Eibach | 6176f4c | 2012-04-27 10:33:46 +0200 | [diff] [blame] | 45 | struct ihs_i2c { |
Dirk Eibach | 81b3793 | 2011-01-21 09:31:21 +0100 | [diff] [blame] | 46 | u16 write_mailbox; |
| 47 | u16 write_mailbox_ext; |
| 48 | u16 read_mailbox; |
| 49 | u16 read_mailbox_ext; |
Dirk Eibach | 6176f4c | 2012-04-27 10:33:46 +0200 | [diff] [blame] | 50 | }; |
Dirk Eibach | 81b3793 | 2011-01-21 09:31:21 +0100 | [diff] [blame] | 51 | |
Dirk Eibach | 6176f4c | 2012-04-27 10:33:46 +0200 | [diff] [blame] | 52 | struct ihs_osd { |
Dirk Eibach | 81b3793 | 2011-01-21 09:31:21 +0100 | [diff] [blame] | 53 | u16 version; |
| 54 | u16 features; |
| 55 | u16 control; |
| 56 | u16 xy_size; |
Dirk Eibach | d3b1700 | 2011-04-06 13:53:47 +0200 | [diff] [blame] | 57 | u16 xy_scale; |
| 58 | u16 x_pos; |
| 59 | u16 y_pos; |
Dirk Eibach | 6176f4c | 2012-04-27 10:33:46 +0200 | [diff] [blame] | 60 | }; |
Dirk Eibach | 81b3793 | 2011-01-21 09:31:21 +0100 | [diff] [blame] | 61 | |
Dirk Eibach | 9a65957 | 2012-04-26 03:54:22 +0000 | [diff] [blame] | 62 | #ifdef CONFIG_NEO |
Dirk Eibach | 6176f4c | 2012-04-27 10:33:46 +0200 | [diff] [blame] | 63 | struct ihs_fpga { |
Dirk Eibach | 9a65957 | 2012-04-26 03:54:22 +0000 | [diff] [blame] | 64 | u16 reflection_low; /* 0x0000 */ |
| 65 | u16 versions; /* 0x0002 */ |
| 66 | u16 fpga_features; /* 0x0004 */ |
| 67 | u16 fpga_version; /* 0x0006 */ |
| 68 | u16 reserved_0[8187]; /* 0x0008 */ |
| 69 | u16 reflection_high; /* 0x3ffe */ |
Dirk Eibach | 6176f4c | 2012-04-27 10:33:46 +0200 | [diff] [blame] | 70 | }; |
Dirk Eibach | 9a65957 | 2012-04-26 03:54:22 +0000 | [diff] [blame] | 71 | #endif |
| 72 | |
Dirk Eibach | 81b3793 | 2011-01-21 09:31:21 +0100 | [diff] [blame] | 73 | #ifdef CONFIG_IO |
Dirk Eibach | 6176f4c | 2012-04-27 10:33:46 +0200 | [diff] [blame] | 74 | struct ihs_fpga { |
Dirk Eibach | 81b3793 | 2011-01-21 09:31:21 +0100 | [diff] [blame] | 75 | u16 reflection_low; /* 0x0000 */ |
| 76 | u16 versions; /* 0x0002 */ |
| 77 | u16 fpga_features; /* 0x0004 */ |
| 78 | u16 fpga_version; /* 0x0006 */ |
| 79 | u16 reserved_0[5]; /* 0x0008 */ |
| 80 | u16 quad_serdes_reset; /* 0x0012 */ |
| 81 | u16 reserved_1[8181]; /* 0x0014 */ |
| 82 | u16 reflection_high; /* 0x3ffe */ |
Dirk Eibach | 6176f4c | 2012-04-27 10:33:46 +0200 | [diff] [blame] | 83 | }; |
Dirk Eibach | 81b3793 | 2011-01-21 09:31:21 +0100 | [diff] [blame] | 84 | #endif |
| 85 | |
Dirk Eibach | 6fabe55 | 2011-10-20 11:12:55 +0200 | [diff] [blame] | 86 | #ifdef CONFIG_IO64 |
Dirk Eibach | 20614a2 | 2013-06-26 16:04:26 +0200 | [diff] [blame] | 87 | |
| 88 | struct ihs_fpga_channel { |
| 89 | u16 status_int; |
| 90 | u16 config_int; |
| 91 | u16 switch_connect_config; |
| 92 | u16 tx_destination; |
| 93 | }; |
| 94 | |
| 95 | struct ihs_fpga_hicb { |
| 96 | u16 status_int; |
| 97 | u16 config_int; |
| 98 | }; |
| 99 | |
Dirk Eibach | 6176f4c | 2012-04-27 10:33:46 +0200 | [diff] [blame] | 100 | struct ihs_fpga { |
Dirk Eibach | 6fabe55 | 2011-10-20 11:12:55 +0200 | [diff] [blame] | 101 | u16 reflection_low; /* 0x0000 */ |
| 102 | u16 versions; /* 0x0002 */ |
| 103 | u16 fpga_features; /* 0x0004 */ |
| 104 | u16 fpga_version; /* 0x0006 */ |
| 105 | u16 reserved_0[5]; /* 0x0008 */ |
| 106 | u16 quad_serdes_reset; /* 0x0012 */ |
| 107 | u16 reserved_1[502]; /* 0x0014 */ |
Dirk Eibach | 20614a2 | 2013-06-26 16:04:26 +0200 | [diff] [blame] | 108 | struct ihs_fpga_channel ch[32]; /* 0x0400 */ |
| 109 | struct ihs_fpga_channel hicb_ch[32]; /* 0x0500 */ |
| 110 | u16 reserved_2[7487]; /* 0x0580 */ |
Dirk Eibach | 6fabe55 | 2011-10-20 11:12:55 +0200 | [diff] [blame] | 111 | u16 reflection_high; /* 0x3ffe */ |
Dirk Eibach | 6176f4c | 2012-04-27 10:33:46 +0200 | [diff] [blame] | 112 | }; |
Dirk Eibach | 6fabe55 | 2011-10-20 11:12:55 +0200 | [diff] [blame] | 113 | #endif |
| 114 | |
Dirk Eibach | 81b3793 | 2011-01-21 09:31:21 +0100 | [diff] [blame] | 115 | #ifdef CONFIG_IOCON |
Dirk Eibach | 6176f4c | 2012-04-27 10:33:46 +0200 | [diff] [blame] | 116 | struct ihs_fpga { |
Dirk Eibach | 81b3793 | 2011-01-21 09:31:21 +0100 | [diff] [blame] | 117 | u16 reflection_low; /* 0x0000 */ |
| 118 | u16 versions; /* 0x0002 */ |
| 119 | u16 fpga_version; /* 0x0004 */ |
| 120 | u16 fpga_features; /* 0x0006 */ |
| 121 | u16 reserved_0[6]; /* 0x0008 */ |
Dirk Eibach | 6176f4c | 2012-04-27 10:33:46 +0200 | [diff] [blame] | 122 | struct ihs_gpio gpio; /* 0x0014 */ |
Dirk Eibach | 81b3793 | 2011-01-21 09:31:21 +0100 | [diff] [blame] | 123 | u16 mpc3w_control; /* 0x001a */ |
| 124 | u16 reserved_1[19]; /* 0x001c */ |
| 125 | u16 videocontrol; /* 0x0042 */ |
Dirk Eibach | 437145e | 2013-07-25 19:28:13 +0200 | [diff] [blame] | 126 | u16 reserved_2[14]; /* 0x0044 */ |
| 127 | u16 mc_int; /* 0x0060 */ |
| 128 | u16 mc_int_en; /* 0x0062 */ |
| 129 | u16 mc_status; /* 0x0064 */ |
| 130 | u16 mc_control; /* 0x0066 */ |
| 131 | u16 mc_tx_data; /* 0x0068 */ |
| 132 | u16 mc_tx_address; /* 0x006a */ |
| 133 | u16 mc_tx_cmd; /* 0x006c */ |
| 134 | u16 mc_res; /* 0x006e */ |
| 135 | u16 mc_rx_cmd_status; /* 0x0070 */ |
| 136 | u16 mc_rx_data; /* 0x0072 */ |
| 137 | u16 reserved_3[69]; /* 0x0074 */ |
Dirk Eibach | 81b3793 | 2011-01-21 09:31:21 +0100 | [diff] [blame] | 138 | u16 reflection_high; /* 0x00fe */ |
Dirk Eibach | 6176f4c | 2012-04-27 10:33:46 +0200 | [diff] [blame] | 139 | struct ihs_osd osd; /* 0x0100 */ |
Dirk Eibach | 437145e | 2013-07-25 19:28:13 +0200 | [diff] [blame] | 140 | u16 reserved_4[889]; /* 0x010e */ |
Dirk Eibach | 20614a2 | 2013-06-26 16:04:26 +0200 | [diff] [blame] | 141 | u16 videomem[31736]; /* 0x0800 */ |
Dirk Eibach | 6176f4c | 2012-04-27 10:33:46 +0200 | [diff] [blame] | 142 | }; |
Dirk Eibach | 81b3793 | 2011-01-21 09:31:21 +0100 | [diff] [blame] | 143 | #endif |
| 144 | |
| 145 | #ifdef CONFIG_DLVISION_10G |
Dirk Eibach | 6176f4c | 2012-04-27 10:33:46 +0200 | [diff] [blame] | 146 | struct ihs_fpga { |
Dirk Eibach | 81b3793 | 2011-01-21 09:31:21 +0100 | [diff] [blame] | 147 | u16 reflection_low; /* 0x0000 */ |
| 148 | u16 versions; /* 0x0002 */ |
| 149 | u16 fpga_version; /* 0x0004 */ |
| 150 | u16 fpga_features; /* 0x0006 */ |
| 151 | u16 reserved_0[10]; /* 0x0008 */ |
| 152 | u16 extended_interrupt; /* 0x001c */ |
| 153 | u16 reserved_1[9]; /* 0x001e */ |
Dirk Eibach | 6176f4c | 2012-04-27 10:33:46 +0200 | [diff] [blame] | 154 | struct ihs_i2c i2c; /* 0x0030 */ |
Dirk Eibach | c0413ee | 2011-04-06 13:53:48 +0200 | [diff] [blame] | 155 | u16 reserved_2[16]; /* 0x0038 */ |
| 156 | u16 mpc3w_control; /* 0x0058 */ |
| 157 | u16 reserved_3[34]; /* 0x005a */ |
Dirk Eibach | 81b3793 | 2011-01-21 09:31:21 +0100 | [diff] [blame] | 158 | u16 videocontrol; /* 0x009e */ |
Dirk Eibach | c0413ee | 2011-04-06 13:53:48 +0200 | [diff] [blame] | 159 | u16 reserved_4[176]; /* 0x00a0 */ |
Dirk Eibach | 6176f4c | 2012-04-27 10:33:46 +0200 | [diff] [blame] | 160 | struct ihs_osd osd; /* 0x0200 */ |
Dirk Eibach | c0413ee | 2011-04-06 13:53:48 +0200 | [diff] [blame] | 161 | u16 reserved_5[761]; /* 0x020e */ |
Dirk Eibach | 20614a2 | 2013-06-26 16:04:26 +0200 | [diff] [blame] | 162 | u16 videomem[31736]; /* 0x0800 */ |
Dirk Eibach | 6176f4c | 2012-04-27 10:33:46 +0200 | [diff] [blame] | 163 | }; |
Dirk Eibach | 81b3793 | 2011-01-21 09:31:21 +0100 | [diff] [blame] | 164 | #endif |
| 165 | |
| 166 | #endif |