4 #include <linux/types.h>
6 #define PCI_VENDOR_ID_MEN 0x1a88
7 #define PCI_DEVICE_ID_MEN_CHAMELEON 0x4d45
8 #define CHAMELEONV2_MAGIC 0xabce
9 #define CHAM_HEADER_SIZE 0x200
11 enum chameleon_descriptor_type
{
12 CHAMELEON_DTYPE_GENERAL
= 0x0,
13 CHAMELEON_DTYPE_BRIDGE
= 0x1,
14 CHAMELEON_DTYPE_CPU
= 0x2,
15 CHAMELEON_DTYPE_BAR
= 0x3,
16 CHAMELEON_DTYPE_END
= 0xf,
19 enum chameleon_bus_type
{
20 CHAMELEON_BUS_WISHBONE
,
27 * struct chameleon_fpga_header
29 * @revision: Revison of Chameleon table in FPGA
30 * @model: Chameleon table model ASCII char
31 * @minor: Revision minor
32 * @bus_type: Bus type (usually %CHAMELEON_BUS_WISHBONE)
33 * @magic: Chameleon header magic number (0xabce for version 2)
35 * @filename: Filename of FPGA bitstream
37 struct chameleon_fpga_header
{
44 /* This one has no '\0' at the end!!! */
45 char filename
[CHAMELEON_FILENAME_LEN
];
47 #define HEADER_MAGIC_OFFSET 0x4
50 * struct chameleon_gdd - Chameleon General Device Descriptor
52 * @irq: the position in the FPGA's IRQ controller vector
53 * @rev: the revision of the variant's implementation
54 * @var: the variant of the IP core
55 * @dev: the device the IP core is
56 * @dtype: device descriptor type
57 * @bar: BAR offset that must be added to module offset
58 * @inst: the instance number of the device, 0 is first instance
59 * @group: the group the device belongs to (0 = no group)
61 * @offset: beginning of the address window of desired module
62 * @size: size of the module's address window
64 struct chameleon_gdd
{
72 /* GDD Register 1 fields */
73 #define GDD_IRQ(x) ((x) & 0x1f)
74 #define GDD_REV(x) (((x) >> 5) & 0x3f)
75 #define GDD_VAR(x) (((x) >> 11) & 0x3f)
76 #define GDD_DEV(x) (((x) >> 18) & 0x3ff)
77 #define GDD_DTY(x) (((x) >> 28) & 0xf)
79 /* GDD Register 2 fields */
80 #define GDD_BAR(x) ((x) & 0x7)
81 #define GDD_INS(x) (((x) >> 3) & 0x3f)
82 #define GDD_GRP(x) (((x) >> 9) & 0x3f)
85 * struct chameleon_bdd - Chameleon Bridge Device Descriptor
87 * @irq: the position in the FPGA's IRQ controller vector
88 * @rev: the revision of the variant's implementation
89 * @var: the variant of the IP core
90 * @dev: the device the IP core is
91 * @dtype: device descriptor type
92 * @bar: BAR offset that must be added to module offset
93 * @inst: the instance number of the device, 0 is first instance
94 * @dbar: destination bar from the bus _behind_ the bridge
95 * @chamoff: offset within the BAR of the source bus
99 struct chameleon_bdd
{
104 unsigned int dtype
:4;
108 unsigned int group
:6;
109 unsigned int reserved
:14;
115 struct chameleon_bar
{
120 #define BAR_CNT(x) ((x) & 0x07)
121 #define CHAMELEON_BAR_MAX 6
122 #define BAR_DESC_SIZE(x) ((x) * sizeof(struct chameleon_bar) + sizeof(__le32))
124 int chameleon_parse_cells(struct mcb_bus
*bus
, phys_addr_t mapbase
,