blob: aa9b9f58b810055e6e843fa728d8c79296087b47 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Dirk Eibach2da0fc02011-01-21 09:31:21 +01002/*
3 * (C) Copyright 2010
Mario Sixd38826a2018-03-06 08:04:58 +01004 * Dirk Eibach, Guntermann & Drunck GmbH, dirk.eibach@gdsys.cc
Dirk Eibach2da0fc02011-01-21 09:31:21 +01005 */
6
7#ifndef __GDSYS_FPGA_H
8#define __GDSYS_FPGA_H
9
Mario Sixfe4a9672019-03-29 10:18:10 +010010#ifdef CONFIG_GDSYS_LEGACY_DRIVERS
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);
Dirk Eibach2da0fc02011-01-21 09:31:21 +010020
Dirk Eibachaba27ac2013-06-26 16:04:26 +020021int fpga_set_reg(u32 fpga, u16 *reg, off_t regoff, u16 data);
22int fpga_get_reg(u32 fpga, u16 *reg, off_t regoff, u16 *data);
23
24extern struct ihs_fpga *fpga_ptr[];
25
26#define FPGA_SET_REG(ix, fld, val) \
27 fpga_set_reg((ix), \
28 &fpga_ptr[ix]->fld, \
29 offsetof(struct ihs_fpga, fld), \
30 val)
31
32#define FPGA_GET_REG(ix, fld, val) \
33 fpga_get_reg((ix), \
34 &fpga_ptr[ix]->fld, \
35 offsetof(struct ihs_fpga, fld), \
36 val)
Mario Sixfe4a9672019-03-29 10:18:10 +010037#endif
Dirk Eibachaba27ac2013-06-26 16:04:26 +020038
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 Eibach50dcf892014-11-13 19:21:18 +010064struct ihs_mdio {
65 u16 control;
66 u16 address_data;
67 u16 rx_data;
68};
69
70struct ihs_io_ep {
71 u16 transmit_data;
72 u16 rx_tx_control;
73 u16 receive_data;
74 u16 rx_tx_status;
75 u16 reserved;
76 u16 device_address;
77 u16 target_address;
78};
79
Dirk Eibach6e9e6c32012-04-26 03:54:22 +000080#ifdef CONFIG_NEO
Dirk Eibach0e60aa82012-04-27 10:33:46 +020081struct ihs_fpga {
Dirk Eibach6e9e6c32012-04-26 03:54:22 +000082 u16 reflection_low; /* 0x0000 */
83 u16 versions; /* 0x0002 */
84 u16 fpga_features; /* 0x0004 */
85 u16 fpga_version; /* 0x0006 */
86 u16 reserved_0[8187]; /* 0x0008 */
87 u16 reflection_high; /* 0x3ffe */
Dirk Eibach0e60aa82012-04-27 10:33:46 +020088};
Dirk Eibach6e9e6c32012-04-26 03:54:22 +000089#endif
90
Dirk Eibach2da0fc02011-01-21 09:31:21 +010091#endif