12da0fc0dSDirk Eibach /* 22da0fc0dSDirk Eibach * (C) Copyright 2010 32da0fc0dSDirk Eibach * Dirk Eibach, Guntermann & Drunck GmbH, eibach@gdsys.de 42da0fc0dSDirk Eibach * 51a459660SWolfgang Denk * SPDX-License-Identifier: GPL-2.0+ 62da0fc0dSDirk Eibach */ 72da0fc0dSDirk Eibach 82da0fc0dSDirk Eibach #ifndef __GDSYS_FPGA_H 92da0fc0dSDirk Eibach #define __GDSYS_FPGA_H 102da0fc0dSDirk Eibach 11255ef4d9SDirk Eibach int init_func_fpga(void); 12255ef4d9SDirk Eibach 132da0fc0dSDirk Eibach enum { 142da0fc0dSDirk Eibach FPGA_STATE_DONE_FAILED = 1 << 0, 152da0fc0dSDirk Eibach FPGA_STATE_REFLECTION_FAILED = 1 << 1, 16255ef4d9SDirk Eibach FPGA_STATE_PLATFORM = 1 << 2, 172da0fc0dSDirk Eibach }; 182da0fc0dSDirk Eibach 192da0fc0dSDirk Eibach int get_fpga_state(unsigned dev); 202da0fc0dSDirk Eibach void print_fpga_state(unsigned dev); 212da0fc0dSDirk Eibach 22aba27acfSDirk Eibach int fpga_set_reg(u32 fpga, u16 *reg, off_t regoff, u16 data); 23aba27acfSDirk Eibach int fpga_get_reg(u32 fpga, u16 *reg, off_t regoff, u16 *data); 24aba27acfSDirk Eibach 25aba27acfSDirk Eibach extern struct ihs_fpga *fpga_ptr[]; 26aba27acfSDirk Eibach 27aba27acfSDirk Eibach #define FPGA_SET_REG(ix, fld, val) \ 28aba27acfSDirk Eibach fpga_set_reg((ix), \ 29aba27acfSDirk Eibach &fpga_ptr[ix]->fld, \ 30aba27acfSDirk Eibach offsetof(struct ihs_fpga, fld), \ 31aba27acfSDirk Eibach val) 32aba27acfSDirk Eibach 33aba27acfSDirk Eibach #define FPGA_GET_REG(ix, fld, val) \ 34aba27acfSDirk Eibach fpga_get_reg((ix), \ 35aba27acfSDirk Eibach &fpga_ptr[ix]->fld, \ 36aba27acfSDirk Eibach offsetof(struct ihs_fpga, fld), \ 37aba27acfSDirk Eibach val) 38aba27acfSDirk Eibach 390e60aa85SDirk Eibach struct ihs_gpio { 402da0fc0dSDirk Eibach u16 read; 412da0fc0dSDirk Eibach u16 clear; 422da0fc0dSDirk Eibach u16 set; 430e60aa85SDirk Eibach }; 442da0fc0dSDirk Eibach 450e60aa85SDirk Eibach struct ihs_i2c { 46b46226bdSDirk Eibach u16 interrupt_status; 47b46226bdSDirk Eibach u16 interrupt_enable; 482da0fc0dSDirk Eibach u16 write_mailbox_ext; 49b46226bdSDirk Eibach u16 write_mailbox; 502da0fc0dSDirk Eibach u16 read_mailbox_ext; 51b46226bdSDirk Eibach u16 read_mailbox; 520e60aa85SDirk Eibach }; 532da0fc0dSDirk Eibach 540e60aa85SDirk Eibach struct ihs_osd { 552da0fc0dSDirk Eibach u16 version; 562da0fc0dSDirk Eibach u16 features; 572da0fc0dSDirk Eibach u16 control; 582da0fc0dSDirk Eibach u16 xy_size; 5952158e36SDirk Eibach u16 xy_scale; 6052158e36SDirk Eibach u16 x_pos; 6152158e36SDirk Eibach u16 y_pos; 620e60aa85SDirk Eibach }; 632da0fc0dSDirk Eibach 6450dcf89dSDirk Eibach struct ihs_mdio { 6550dcf89dSDirk Eibach u16 control; 6650dcf89dSDirk Eibach u16 address_data; 6750dcf89dSDirk Eibach u16 rx_data; 6850dcf89dSDirk Eibach }; 6950dcf89dSDirk Eibach 7050dcf89dSDirk Eibach struct ihs_io_ep { 7150dcf89dSDirk Eibach u16 transmit_data; 7250dcf89dSDirk Eibach u16 rx_tx_control; 7350dcf89dSDirk Eibach u16 receive_data; 7450dcf89dSDirk Eibach u16 rx_tx_status; 7550dcf89dSDirk Eibach u16 reserved; 7650dcf89dSDirk Eibach u16 device_address; 7750dcf89dSDirk Eibach u16 target_address; 7850dcf89dSDirk Eibach }; 7950dcf89dSDirk Eibach 806e9e6c36SDirk Eibach #ifdef CONFIG_NEO 810e60aa85SDirk Eibach struct ihs_fpga { 826e9e6c36SDirk Eibach u16 reflection_low; /* 0x0000 */ 836e9e6c36SDirk Eibach u16 versions; /* 0x0002 */ 846e9e6c36SDirk Eibach u16 fpga_features; /* 0x0004 */ 856e9e6c36SDirk Eibach u16 fpga_version; /* 0x0006 */ 866e9e6c36SDirk Eibach u16 reserved_0[8187]; /* 0x0008 */ 876e9e6c36SDirk Eibach u16 reflection_high; /* 0x3ffe */ 880e60aa85SDirk Eibach }; 896e9e6c36SDirk Eibach #endif 906e9e6c36SDirk Eibach 912da0fc0dSDirk Eibach #ifdef CONFIG_IO 920e60aa85SDirk Eibach struct ihs_fpga { 932da0fc0dSDirk Eibach u16 reflection_low; /* 0x0000 */ 942da0fc0dSDirk Eibach u16 versions; /* 0x0002 */ 952da0fc0dSDirk Eibach u16 fpga_features; /* 0x0004 */ 962da0fc0dSDirk Eibach u16 fpga_version; /* 0x0006 */ 972da0fc0dSDirk Eibach u16 reserved_0[5]; /* 0x0008 */ 982da0fc0dSDirk Eibach u16 quad_serdes_reset; /* 0x0012 */ 992da0fc0dSDirk Eibach u16 reserved_1[8181]; /* 0x0014 */ 1002da0fc0dSDirk Eibach u16 reflection_high; /* 0x3ffe */ 1010e60aa85SDirk Eibach }; 1022da0fc0dSDirk Eibach #endif 1032da0fc0dSDirk Eibach 104255ef4d9SDirk Eibach #ifdef CONFIG_IO64 105aba27acfSDirk Eibach struct ihs_fpga_channel { 106aba27acfSDirk Eibach u16 status_int; 107aba27acfSDirk Eibach u16 config_int; 108aba27acfSDirk Eibach u16 switch_connect_config; 109aba27acfSDirk Eibach u16 tx_destination; 110aba27acfSDirk Eibach }; 111aba27acfSDirk Eibach 112aba27acfSDirk Eibach struct ihs_fpga_hicb { 113aba27acfSDirk Eibach u16 status_int; 114aba27acfSDirk Eibach u16 config_int; 115aba27acfSDirk Eibach }; 116aba27acfSDirk Eibach 1170e60aa85SDirk Eibach struct ihs_fpga { 118255ef4d9SDirk Eibach u16 reflection_low; /* 0x0000 */ 119255ef4d9SDirk Eibach u16 versions; /* 0x0002 */ 120255ef4d9SDirk Eibach u16 fpga_features; /* 0x0004 */ 121255ef4d9SDirk Eibach u16 fpga_version; /* 0x0006 */ 122255ef4d9SDirk Eibach u16 reserved_0[5]; /* 0x0008 */ 123255ef4d9SDirk Eibach u16 quad_serdes_reset; /* 0x0012 */ 124255ef4d9SDirk Eibach u16 reserved_1[502]; /* 0x0014 */ 125aba27acfSDirk Eibach struct ihs_fpga_channel ch[32]; /* 0x0400 */ 126aba27acfSDirk Eibach struct ihs_fpga_channel hicb_ch[32]; /* 0x0500 */ 127aba27acfSDirk Eibach u16 reserved_2[7487]; /* 0x0580 */ 128255ef4d9SDirk Eibach u16 reflection_high; /* 0x3ffe */ 1290e60aa85SDirk Eibach }; 130255ef4d9SDirk Eibach #endif 131255ef4d9SDirk Eibach 1322da0fc0dSDirk Eibach #ifdef CONFIG_IOCON 1330e60aa85SDirk Eibach struct ihs_fpga { 1342da0fc0dSDirk Eibach u16 reflection_low; /* 0x0000 */ 1352da0fc0dSDirk Eibach u16 versions; /* 0x0002 */ 1362da0fc0dSDirk Eibach u16 fpga_version; /* 0x0004 */ 1372da0fc0dSDirk Eibach u16 fpga_features; /* 0x0006 */ 13850dcf89dSDirk Eibach u16 reserved_0[1]; /* 0x0008 */ 13950dcf89dSDirk Eibach u16 top_interrupt; /* 0x000a */ 14050dcf89dSDirk Eibach u16 reserved_1[4]; /* 0x000c */ 1410e60aa85SDirk Eibach struct ihs_gpio gpio; /* 0x0014 */ 1422da0fc0dSDirk Eibach u16 mpc3w_control; /* 0x001a */ 14350dcf89dSDirk Eibach u16 reserved_2[2]; /* 0x001c */ 14450dcf89dSDirk Eibach struct ihs_io_ep ep; /* 0x0020 */ 14550dcf89dSDirk Eibach u16 reserved_3[9]; /* 0x002e */ 146071be896SDirk Eibach struct ihs_i2c i2c0; /* 0x0040 */ 14750dcf89dSDirk Eibach u16 reserved_4[10]; /* 0x004c */ 148e50e8968SDirk Eibach u16 mc_int; /* 0x0060 */ 149e50e8968SDirk Eibach u16 mc_int_en; /* 0x0062 */ 150e50e8968SDirk Eibach u16 mc_status; /* 0x0064 */ 151e50e8968SDirk Eibach u16 mc_control; /* 0x0066 */ 152e50e8968SDirk Eibach u16 mc_tx_data; /* 0x0068 */ 153e50e8968SDirk Eibach u16 mc_tx_address; /* 0x006a */ 154e50e8968SDirk Eibach u16 mc_tx_cmd; /* 0x006c */ 155e50e8968SDirk Eibach u16 mc_res; /* 0x006e */ 156e50e8968SDirk Eibach u16 mc_rx_cmd_status; /* 0x0070 */ 157e50e8968SDirk Eibach u16 mc_rx_data; /* 0x0072 */ 15850dcf89dSDirk Eibach u16 reserved_5[69]; /* 0x0074 */ 1592da0fc0dSDirk Eibach u16 reflection_high; /* 0x00fe */ 1600e60aa85SDirk Eibach struct ihs_osd osd; /* 0x0100 */ 16150dcf89dSDirk Eibach u16 reserved_6[889]; /* 0x010e */ 16250dcf89dSDirk Eibach u16 videomem[31736]; /* 0x0800 */ 16350dcf89dSDirk Eibach }; 16450dcf89dSDirk Eibach #endif 16550dcf89dSDirk Eibach 16650dcf89dSDirk Eibach #ifdef CONFIG_HRCON 16750dcf89dSDirk Eibach struct ihs_fpga { 16850dcf89dSDirk Eibach u16 reflection_low; /* 0x0000 */ 16950dcf89dSDirk Eibach u16 versions; /* 0x0002 */ 17050dcf89dSDirk Eibach u16 fpga_version; /* 0x0004 */ 17150dcf89dSDirk Eibach u16 fpga_features; /* 0x0006 */ 17250dcf89dSDirk Eibach u16 reserved_0[1]; /* 0x0008 */ 17350dcf89dSDirk Eibach u16 top_interrupt; /* 0x000a */ 17450dcf89dSDirk Eibach u16 reserved_1[4]; /* 0x000c */ 17550dcf89dSDirk Eibach struct ihs_gpio gpio; /* 0x0014 */ 17650dcf89dSDirk Eibach u16 mpc3w_control; /* 0x001a */ 17750dcf89dSDirk Eibach u16 reserved_2[2]; /* 0x001c */ 17850dcf89dSDirk Eibach struct ihs_io_ep ep; /* 0x0020 */ 17950dcf89dSDirk Eibach u16 reserved_3[9]; /* 0x002e */ 180071be896SDirk Eibach struct ihs_i2c i2c0; /* 0x0040 */ 18150dcf89dSDirk Eibach u16 reserved_4[10]; /* 0x004c */ 18250dcf89dSDirk Eibach u16 mc_int; /* 0x0060 */ 18350dcf89dSDirk Eibach u16 mc_int_en; /* 0x0062 */ 18450dcf89dSDirk Eibach u16 mc_status; /* 0x0064 */ 18550dcf89dSDirk Eibach u16 mc_control; /* 0x0066 */ 18650dcf89dSDirk Eibach u16 mc_tx_data; /* 0x0068 */ 18750dcf89dSDirk Eibach u16 mc_tx_address; /* 0x006a */ 18850dcf89dSDirk Eibach u16 mc_tx_cmd; /* 0x006c */ 18950dcf89dSDirk Eibach u16 mc_res; /* 0x006e */ 19050dcf89dSDirk Eibach u16 mc_rx_cmd_status; /* 0x0070 */ 19150dcf89dSDirk Eibach u16 mc_rx_data; /* 0x0072 */ 19250dcf89dSDirk Eibach u16 reserved_5[69]; /* 0x0074 */ 19350dcf89dSDirk Eibach u16 reflection_high; /* 0x00fe */ 19450dcf89dSDirk Eibach struct ihs_osd osd; /* 0x0100 */ 19550dcf89dSDirk Eibach u16 reserved_6[889]; /* 0x010e */ 196aba27acfSDirk Eibach u16 videomem[31736]; /* 0x0800 */ 1970e60aa85SDirk Eibach }; 1982da0fc0dSDirk Eibach #endif 1992da0fc0dSDirk Eibach 200*a3f9d6c7SDirk Eibach #ifdef CONFIG_STRIDER_CPU 201*a3f9d6c7SDirk Eibach struct ihs_fpga { 202*a3f9d6c7SDirk Eibach u16 reflection_low; /* 0x0000 */ 203*a3f9d6c7SDirk Eibach u16 versions; /* 0x0002 */ 204*a3f9d6c7SDirk Eibach u16 fpga_version; /* 0x0004 */ 205*a3f9d6c7SDirk Eibach u16 fpga_features; /* 0x0006 */ 206*a3f9d6c7SDirk Eibach u16 reserved_0[1]; /* 0x0008 */ 207*a3f9d6c7SDirk Eibach u16 top_interrupt; /* 0x000a */ 208*a3f9d6c7SDirk Eibach u16 reserved_1[3]; /* 0x000c */ 209*a3f9d6c7SDirk Eibach u16 extended_control; /* 0x0012 */ 210*a3f9d6c7SDirk Eibach struct ihs_gpio gpio; /* 0x0014 */ 211*a3f9d6c7SDirk Eibach u16 mpc3w_control; /* 0x001a */ 212*a3f9d6c7SDirk Eibach u16 reserved_2[2]; /* 0x001c */ 213*a3f9d6c7SDirk Eibach struct ihs_io_ep ep; /* 0x0020 */ 214*a3f9d6c7SDirk Eibach u16 reserved_3[9]; /* 0x002e */ 215*a3f9d6c7SDirk Eibach u16 mc_int; /* 0x0040 */ 216*a3f9d6c7SDirk Eibach u16 mc_int_en; /* 0x0042 */ 217*a3f9d6c7SDirk Eibach u16 mc_status; /* 0x0044 */ 218*a3f9d6c7SDirk Eibach u16 mc_control; /* 0x0046 */ 219*a3f9d6c7SDirk Eibach u16 mc_tx_data; /* 0x0048 */ 220*a3f9d6c7SDirk Eibach u16 mc_tx_address; /* 0x004a */ 221*a3f9d6c7SDirk Eibach u16 mc_tx_cmd; /* 0x004c */ 222*a3f9d6c7SDirk Eibach u16 mc_res; /* 0x004e */ 223*a3f9d6c7SDirk Eibach u16 mc_rx_cmd_status; /* 0x0050 */ 224*a3f9d6c7SDirk Eibach u16 mc_rx_data; /* 0x0052 */ 225*a3f9d6c7SDirk Eibach u16 reserved_4[62]; /* 0x0054 */ 226*a3f9d6c7SDirk Eibach struct ihs_i2c i2c0; /* 0x00d0 */ 227*a3f9d6c7SDirk Eibach }; 228*a3f9d6c7SDirk Eibach #endif 229*a3f9d6c7SDirk Eibach 230*a3f9d6c7SDirk Eibach #ifdef CONFIG_STRIDER_CON 231*a3f9d6c7SDirk Eibach struct ihs_fpga { 232*a3f9d6c7SDirk Eibach u16 reflection_low; /* 0x0000 */ 233*a3f9d6c7SDirk Eibach u16 versions; /* 0x0002 */ 234*a3f9d6c7SDirk Eibach u16 fpga_version; /* 0x0004 */ 235*a3f9d6c7SDirk Eibach u16 fpga_features; /* 0x0006 */ 236*a3f9d6c7SDirk Eibach u16 reserved_0[1]; /* 0x0008 */ 237*a3f9d6c7SDirk Eibach u16 top_interrupt; /* 0x000a */ 238*a3f9d6c7SDirk Eibach u16 reserved_1[4]; /* 0x000c */ 239*a3f9d6c7SDirk Eibach struct ihs_gpio gpio; /* 0x0014 */ 240*a3f9d6c7SDirk Eibach u16 mpc3w_control; /* 0x001a */ 241*a3f9d6c7SDirk Eibach u16 reserved_2[2]; /* 0x001c */ 242*a3f9d6c7SDirk Eibach struct ihs_io_ep ep; /* 0x0020 */ 243*a3f9d6c7SDirk Eibach u16 reserved_3[9]; /* 0x002e */ 244*a3f9d6c7SDirk Eibach struct ihs_i2c i2c0; /* 0x0040 */ 245*a3f9d6c7SDirk Eibach u16 reserved_4[10]; /* 0x004c */ 246*a3f9d6c7SDirk Eibach u16 mc_int; /* 0x0060 */ 247*a3f9d6c7SDirk Eibach u16 mc_int_en; /* 0x0062 */ 248*a3f9d6c7SDirk Eibach u16 mc_status; /* 0x0064 */ 249*a3f9d6c7SDirk Eibach u16 mc_control; /* 0x0066 */ 250*a3f9d6c7SDirk Eibach u16 mc_tx_data; /* 0x0068 */ 251*a3f9d6c7SDirk Eibach u16 mc_tx_address; /* 0x006a */ 252*a3f9d6c7SDirk Eibach u16 mc_tx_cmd; /* 0x006c */ 253*a3f9d6c7SDirk Eibach u16 mc_res; /* 0x006e */ 254*a3f9d6c7SDirk Eibach u16 mc_rx_cmd_status; /* 0x0070 */ 255*a3f9d6c7SDirk Eibach u16 mc_rx_data; /* 0x0072 */ 256*a3f9d6c7SDirk Eibach u16 reserved_5[70]; /* 0x0074 */ 257*a3f9d6c7SDirk Eibach struct ihs_osd osd; /* 0x0100 */ 258*a3f9d6c7SDirk Eibach u16 reserved_6[889]; /* 0x010e */ 259*a3f9d6c7SDirk Eibach u16 videomem[31736]; /* 0x0800 */ 260*a3f9d6c7SDirk Eibach }; 261*a3f9d6c7SDirk Eibach #endif 262*a3f9d6c7SDirk Eibach 2632da0fc0dSDirk Eibach #ifdef CONFIG_DLVISION_10G 2640e60aa85SDirk Eibach struct ihs_fpga { 2652da0fc0dSDirk Eibach u16 reflection_low; /* 0x0000 */ 2662da0fc0dSDirk Eibach u16 versions; /* 0x0002 */ 2672da0fc0dSDirk Eibach u16 fpga_version; /* 0x0004 */ 2682da0fc0dSDirk Eibach u16 fpga_features; /* 0x0006 */ 2692da0fc0dSDirk Eibach u16 reserved_0[10]; /* 0x0008 */ 2702da0fc0dSDirk Eibach u16 extended_interrupt; /* 0x001c */ 271b46226bdSDirk Eibach u16 reserved_1[29]; /* 0x001e */ 2727749c84eSDirk Eibach u16 mpc3w_control; /* 0x0058 */ 273b46226bdSDirk Eibach u16 reserved_2[3]; /* 0x005a */ 274071be896SDirk Eibach struct ihs_i2c i2c0; /* 0x0060 */ 275071be896SDirk Eibach u16 reserved_3[2]; /* 0x006c */ 276071be896SDirk Eibach struct ihs_i2c i2c1; /* 0x0070 */ 277071be896SDirk Eibach u16 reserved_4[194]; /* 0x007c */ 2780e60aa85SDirk Eibach struct ihs_osd osd; /* 0x0200 */ 279071be896SDirk Eibach u16 reserved_5[761]; /* 0x020e */ 280aba27acfSDirk Eibach u16 videomem[31736]; /* 0x0800 */ 2810e60aa85SDirk Eibach }; 2822da0fc0dSDirk Eibach #endif 2832da0fc0dSDirk Eibach 2842da0fc0dSDirk Eibach #endif 285