1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  *  Include file for NEC VR4100 series PCI Control Unit.
4  *
5  *  Copyright (C) 2004-2005  Yoichi Yuasa <yuasa@linux-mips.org>
6  */
7 #ifndef __NEC_VR41XX_PCI_H
8 #define __NEC_VR41XX_PCI_H
9 
10 #define PCI_MASTER_ADDRESS_MASK 0x7fffffffU
11 
12 struct pci_master_address_conversion {
13 	uint32_t bus_base_address;
14 	uint32_t address_mask;
15 	uint32_t pci_base_address;
16 };
17 
18 struct pci_target_address_conversion {
19 	uint32_t address_mask;
20 	uint32_t bus_base_address;
21 };
22 
23 typedef enum {
24 	CANNOT_LOCK_FROM_DEVICE,
25 	CAN_LOCK_FROM_DEVICE,
26 } pci_exclusive_access_t;
27 
28 struct pci_mailbox_address {
29 	uint32_t base_address;
30 };
31 
32 struct pci_target_address_window {
33 	uint32_t base_address;
34 };
35 
36 typedef enum {
37 	PCI_ARBITRATION_MODE_FAIR,
38 	PCI_ARBITRATION_MODE_ALTERNATE_0,
39 	PCI_ARBITRATION_MODE_ALTERNATE_B,
40 } pci_arbiter_priority_control_t;
41 
42 typedef enum {
43 	PCI_TAKE_AWAY_GNT_DISABLE,
44 	PCI_TAKE_AWAY_GNT_ENABLE,
45 } pci_take_away_gnt_mode_t;
46 
47 struct pci_controller_unit_setup {
48 	struct pci_master_address_conversion *master_memory1;
49 	struct pci_master_address_conversion *master_memory2;
50 
51 	struct pci_target_address_conversion *target_memory1;
52 	struct pci_target_address_conversion *target_memory2;
53 
54 	struct pci_master_address_conversion *master_io;
55 
56 	pci_exclusive_access_t exclusive_access;
57 
58 	uint32_t pci_clock_max;
59 	uint8_t wait_time_limit_from_irdy_to_trdy;	/* Only VR4122 is supported */
60 
61 	struct pci_mailbox_address *mailbox;
62 	struct pci_target_address_window *target_window1;
63 	struct pci_target_address_window *target_window2;
64 
65 	uint8_t master_latency_timer;
66 	uint8_t retry_limit;
67 
68 	pci_arbiter_priority_control_t arbiter_priority_control;
69 	pci_take_away_gnt_mode_t take_away_gnt_mode;
70 
71 	struct resource *mem_resource;
72 	struct resource *io_resource;
73 };
74 
75 extern void vr41xx_pciu_setup(struct pci_controller_unit_setup *setup);
76 
77 #endif /* __NEC_VR41XX_PCI_H */
78