blob: 276a01e744ed8b4914c6dd64130c93212c128abe [file] [log] [blame]
Dirk Eibach2da0fc02011-01-21 09:31:21 +01001/*
2 * (C) Copyright 2010
3 * Dirk Eibach, Guntermann & Drunck GmbH, eibach@gdsys.de
4 *
Wolfgang Denk3765b3e2013-10-07 13:07:26 +02005 * SPDX-License-Identifier: GPL-2.0+
Dirk Eibach2da0fc02011-01-21 09:31:21 +01006 */
7
8#ifndef __GDSYS_FPGA_H
9#define __GDSYS_FPGA_H
10
Dirk Eibach255ef4d2011-10-20 11:12:55 +020011int init_func_fpga(void);
12
Dirk Eibach2da0fc02011-01-21 09:31:21 +010013enum {
14 FPGA_STATE_DONE_FAILED = 1 << 0,
15 FPGA_STATE_REFLECTION_FAILED = 1 << 1,
Dirk Eibach255ef4d2011-10-20 11:12:55 +020016 FPGA_STATE_PLATFORM = 1 << 2,
Dirk Eibach2da0fc02011-01-21 09:31:21 +010017};
18
19int get_fpga_state(unsigned dev);
20void print_fpga_state(unsigned dev);
21
Dirk Eibachaba27ac2013-06-26 16:04:26 +020022int fpga_set_reg(u32 fpga, u16 *reg, off_t regoff, u16 data);
23int fpga_get_reg(u32 fpga, u16 *reg, off_t regoff, u16 *data);
24
25extern 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 Eibach0e60aa82012-04-27 10:33:46 +020039struct ihs_gpio {
Dirk Eibach2da0fc02011-01-21 09:31:21 +010040 u16 read;
41 u16 clear;
42 u16 set;
Dirk Eibach0e60aa82012-04-27 10:33:46 +020043};
Dirk Eibach2da0fc02011-01-21 09:31:21 +010044
Dirk Eibach0e60aa82012-04-27 10:33:46 +020045struct ihs_i2c {
Dirk Eibachb46226b2014-07-03 09:28:18 +020046 u16 interrupt_status;
47 u16 interrupt_enable;
Dirk Eibach2da0fc02011-01-21 09:31:21 +010048 u16 write_mailbox_ext;
Dirk Eibachb46226b2014-07-03 09:28:18 +020049 u16 write_mailbox;
Dirk Eibach2da0fc02011-01-21 09:31:21 +010050 u16 read_mailbox_ext;
Dirk Eibachb46226b2014-07-03 09:28:18 +020051 u16 read_mailbox;
Dirk Eibach0e60aa82012-04-27 10:33:46 +020052};
Dirk Eibach2da0fc02011-01-21 09:31:21 +010053
Dirk Eibach0e60aa82012-04-27 10:33:46 +020054struct ihs_osd {
Dirk Eibach2da0fc02011-01-21 09:31:21 +010055 u16 version;
56 u16 features;
57 u16 control;
58 u16 xy_size;
Dirk Eibach52158e32011-04-06 13:53:47 +020059 u16 xy_scale;
60 u16 x_pos;
61 u16 y_pos;
Dirk Eibach0e60aa82012-04-27 10:33:46 +020062};
Dirk Eibach2da0fc02011-01-21 09:31:21 +010063
Dirk Eibach6e9e6c32012-04-26 03:54:22 +000064#ifdef CONFIG_NEO
Dirk Eibach0e60aa82012-04-27 10:33:46 +020065struct ihs_fpga {
Dirk Eibach6e9e6c32012-04-26 03:54:22 +000066 u16 reflection_low; /* 0x0000 */
67 u16 versions; /* 0x0002 */
68 u16 fpga_features; /* 0x0004 */
69 u16 fpga_version; /* 0x0006 */
70 u16 reserved_0[8187]; /* 0x0008 */
71 u16 reflection_high; /* 0x3ffe */
Dirk Eibach0e60aa82012-04-27 10:33:46 +020072};
Dirk Eibach6e9e6c32012-04-26 03:54:22 +000073#endif
74
Dirk Eibach2da0fc02011-01-21 09:31:21 +010075#ifdef CONFIG_IO
Dirk Eibach0e60aa82012-04-27 10:33:46 +020076struct ihs_fpga {
Dirk Eibach2da0fc02011-01-21 09:31:21 +010077 u16 reflection_low; /* 0x0000 */
78 u16 versions; /* 0x0002 */
79 u16 fpga_features; /* 0x0004 */
80 u16 fpga_version; /* 0x0006 */
81 u16 reserved_0[5]; /* 0x0008 */
82 u16 quad_serdes_reset; /* 0x0012 */
83 u16 reserved_1[8181]; /* 0x0014 */
84 u16 reflection_high; /* 0x3ffe */
Dirk Eibach0e60aa82012-04-27 10:33:46 +020085};
Dirk Eibach2da0fc02011-01-21 09:31:21 +010086#endif
87
Dirk Eibach255ef4d2011-10-20 11:12:55 +020088#ifdef CONFIG_IO64
Dirk Eibachaba27ac2013-06-26 16:04:26 +020089struct ihs_fpga_channel {
90 u16 status_int;
91 u16 config_int;
92 u16 switch_connect_config;
93 u16 tx_destination;
94};
95
96struct ihs_fpga_hicb {
97 u16 status_int;
98 u16 config_int;
99};
100
Dirk Eibach0e60aa82012-04-27 10:33:46 +0200101struct ihs_fpga {
Dirk Eibach255ef4d2011-10-20 11:12:55 +0200102 u16 reflection_low; /* 0x0000 */
103 u16 versions; /* 0x0002 */
104 u16 fpga_features; /* 0x0004 */
105 u16 fpga_version; /* 0x0006 */
106 u16 reserved_0[5]; /* 0x0008 */
107 u16 quad_serdes_reset; /* 0x0012 */
108 u16 reserved_1[502]; /* 0x0014 */
Dirk Eibachaba27ac2013-06-26 16:04:26 +0200109 struct ihs_fpga_channel ch[32]; /* 0x0400 */
110 struct ihs_fpga_channel hicb_ch[32]; /* 0x0500 */
111 u16 reserved_2[7487]; /* 0x0580 */
Dirk Eibach255ef4d2011-10-20 11:12:55 +0200112 u16 reflection_high; /* 0x3ffe */
Dirk Eibach0e60aa82012-04-27 10:33:46 +0200113};
Dirk Eibach255ef4d2011-10-20 11:12:55 +0200114#endif
115
Dirk Eibach2da0fc02011-01-21 09:31:21 +0100116#ifdef CONFIG_IOCON
Dirk Eibach0e60aa82012-04-27 10:33:46 +0200117struct ihs_fpga {
Dirk Eibach2da0fc02011-01-21 09:31:21 +0100118 u16 reflection_low; /* 0x0000 */
119 u16 versions; /* 0x0002 */
120 u16 fpga_version; /* 0x0004 */
121 u16 fpga_features; /* 0x0006 */
122 u16 reserved_0[6]; /* 0x0008 */
Dirk Eibach0e60aa82012-04-27 10:33:46 +0200123 struct ihs_gpio gpio; /* 0x0014 */
Dirk Eibach2da0fc02011-01-21 09:31:21 +0100124 u16 mpc3w_control; /* 0x001a */
Dirk Eibachb46226b2014-07-03 09:28:18 +0200125 u16 reserved_1[18]; /* 0x001c */
126 struct ihs_i2c i2c; /* 0x0040 */
127 u16 reserved_2[10]; /* 0x004c */
Dirk Eibache50e8962013-07-25 19:28:13 +0200128 u16 mc_int; /* 0x0060 */
129 u16 mc_int_en; /* 0x0062 */
130 u16 mc_status; /* 0x0064 */
131 u16 mc_control; /* 0x0066 */
132 u16 mc_tx_data; /* 0x0068 */
133 u16 mc_tx_address; /* 0x006a */
134 u16 mc_tx_cmd; /* 0x006c */
135 u16 mc_res; /* 0x006e */
136 u16 mc_rx_cmd_status; /* 0x0070 */
137 u16 mc_rx_data; /* 0x0072 */
138 u16 reserved_3[69]; /* 0x0074 */
Dirk Eibach2da0fc02011-01-21 09:31:21 +0100139 u16 reflection_high; /* 0x00fe */
Dirk Eibach0e60aa82012-04-27 10:33:46 +0200140 struct ihs_osd osd; /* 0x0100 */
Dirk Eibache50e8962013-07-25 19:28:13 +0200141 u16 reserved_4[889]; /* 0x010e */
Dirk Eibachaba27ac2013-06-26 16:04:26 +0200142 u16 videomem[31736]; /* 0x0800 */
Dirk Eibach0e60aa82012-04-27 10:33:46 +0200143};
Dirk Eibach2da0fc02011-01-21 09:31:21 +0100144#endif
145
146#ifdef CONFIG_DLVISION_10G
Dirk Eibach0e60aa82012-04-27 10:33:46 +0200147struct ihs_fpga {
Dirk Eibach2da0fc02011-01-21 09:31:21 +0100148 u16 reflection_low; /* 0x0000 */
149 u16 versions; /* 0x0002 */
150 u16 fpga_version; /* 0x0004 */
151 u16 fpga_features; /* 0x0006 */
152 u16 reserved_0[10]; /* 0x0008 */
153 u16 extended_interrupt; /* 0x001c */
Dirk Eibachb46226b2014-07-03 09:28:18 +0200154 u16 reserved_1[29]; /* 0x001e */
Dirk Eibach7749c842011-04-06 13:53:48 +0200155 u16 mpc3w_control; /* 0x0058 */
Dirk Eibachb46226b2014-07-03 09:28:18 +0200156 u16 reserved_2[3]; /* 0x005a */
157 struct ihs_i2c i2c; /* 0x0060 */
158 u16 reserved_3[205]; /* 0x0066 */
Dirk Eibach0e60aa82012-04-27 10:33:46 +0200159 struct ihs_osd osd; /* 0x0200 */
Dirk Eibachb46226b2014-07-03 09:28:18 +0200160 u16 reserved_4[761]; /* 0x020e */
Dirk Eibachaba27ac2013-06-26 16:04:26 +0200161 u16 videomem[31736]; /* 0x0800 */
Dirk Eibach0e60aa82012-04-27 10:33:46 +0200162};
Dirk Eibach2da0fc02011-01-21 09:31:21 +0100163#endif
164
165#endif