4 #include <linux/types.h>
6 #define CHAMELEON_FILENAME_LEN 12
7 #define CHAMELEONV2_MAGIC 0xabce
9 enum chameleon_descriptor_type
{
10 CHAMELEON_DTYPE_GENERAL
= 0x0,
11 CHAMELEON_DTYPE_BRIDGE
= 0x1,
12 CHAMELEON_DTYPE_CPU
= 0x2,
13 CHAMELEON_DTYPE_BAR
= 0x3,
14 CHAMELEON_DTYPE_END
= 0xf,
17 enum chameleon_bus_type
{
18 CHAMELEON_BUS_WISHBONE
,
25 * struct chameleon_fpga_header
27 * @revision: Revison of Chameleon table in FPGA
28 * @model: Chameleon table model ASCII char
29 * @minor: Revision minor
30 * @bus_type: Bus type (usually %CHAMELEON_BUS_WISHBONE)
31 * @magic: Chameleon header magic number (0xabce for version 2)
33 * @filename: Filename of FPGA bitstream
35 struct chameleon_fpga_header
{
42 /* This one has no '\0' at the end!!! */
43 char filename
[CHAMELEON_FILENAME_LEN
];
45 #define HEADER_MAGIC_OFFSET 0x4
48 * struct chameleon_gdd - Chameleon General Device Descriptor
50 * @irq: the position in the FPGA's IRQ controller vector
51 * @rev: the revision of the variant's implementation
52 * @var: the variant of the IP core
53 * @dev: the device the IP core is
54 * @dtype: device descriptor type
55 * @bar: BAR offset that must be added to module offset
56 * @inst: the instance number of the device, 0 is first instance
57 * @group: the group the device belongs to (0 = no group)
59 * @offset: beginning of the address window of desired module
60 * @size: size of the module's address window
62 struct chameleon_gdd
{
70 /* GDD Register 1 fields */
71 #define GDD_IRQ(x) ((x) & 0x1f)
72 #define GDD_REV(x) (((x) >> 5) & 0x3f)
73 #define GDD_VAR(x) (((x) >> 11) & 0x3f)
74 #define GDD_DEV(x) (((x) >> 18) & 0x3ff)
75 #define GDD_DTY(x) (((x) >> 28) & 0xf)
77 /* GDD Register 2 fields */
78 #define GDD_BAR(x) ((x) & 0x7)
79 #define GDD_INS(x) (((x) >> 3) & 0x3f)
80 #define GDD_GRP(x) (((x) >> 9) & 0x3f)
83 * struct chameleon_bdd - Chameleon Bridge Device Descriptor
85 * @irq: the position in the FPGA's IRQ controller vector
86 * @rev: the revision of the variant's implementation
87 * @var: the variant of the IP core
88 * @dev: the device the IP core is
89 * @dtype: device descriptor type
90 * @bar: BAR offset that must be added to module offset
91 * @inst: the instance number of the device, 0 is first instance
92 * @dbar: destination bar from the bus _behind_ the bridge
93 * @chamoff: offset within the BAR of the source bus
97 struct chameleon_bdd
{
102 unsigned int dtype
:4;
106 unsigned int group
:6;
107 unsigned int reserved
:14;
113 int chameleon_parse_cells(struct mcb_bus
*bus
, phys_addr_t mapbase
,