Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /* SPDX-License-Identifier: GPL-2.0+ */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * CompactPCI Hot Plug Core Functions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * Copyright (C) 2002 SOMA Networks, Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  * Copyright (C) 2001 Greg Kroah-Hartman (greg@kroah.com)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  * Copyright (C) 2001 IBM Corp.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  * All rights reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11)  * Send feedback to <scottm@somanetworks.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #ifndef _CPCI_HOTPLUG_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #define _CPCI_HOTPLUG_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #include <linux/pci.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) #include <linux/pci_hotplug.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) /* PICMG 2.1 R2.0 HS CSR bits: */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) #define HS_CSR_INS	0x0080
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) #define HS_CSR_EXT	0x0040
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) #define HS_CSR_PI	0x0030
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) #define HS_CSR_LOO	0x0008
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) #define HS_CSR_PIE	0x0004
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) #define HS_CSR_EIM	0x0002
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) #define HS_CSR_DHA	0x0001
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) struct slot {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 	u8 number;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 	unsigned int devfn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 	struct pci_bus *bus;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 	struct pci_dev *dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 	unsigned int latch_status:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 	unsigned int adapter_status:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 	unsigned int extracting;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 	struct hotplug_slot hotplug_slot;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 	struct list_head slot_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) struct cpci_hp_controller_ops {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 	int (*query_enum)(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 	int (*enable_irq)(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 	int (*disable_irq)(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 	int (*check_irq)(void *dev_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	int (*hardware_test)(struct slot *slot, u32 value);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	u8  (*get_power)(struct slot *slot);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	int (*set_power)(struct slot *slot, int value);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) struct cpci_hp_controller {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	unsigned int irq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	unsigned long irq_flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	char *devname;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	void *dev_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	char *name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	struct cpci_hp_controller_ops *ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) static inline const char *slot_name(struct slot *slot)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	return hotplug_slot_name(&slot->hotplug_slot);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) static inline struct slot *to_slot(struct hotplug_slot *hotplug_slot)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	return container_of(hotplug_slot, struct slot, hotplug_slot);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) int cpci_hp_register_controller(struct cpci_hp_controller *controller);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) int cpci_hp_unregister_controller(struct cpci_hp_controller *controller);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) int cpci_hp_register_bus(struct pci_bus *bus, u8 first, u8 last);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) int cpci_hp_unregister_bus(struct pci_bus *bus);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) int cpci_hp_start(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) int cpci_hp_stop(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79)  * Internal function prototypes, these functions should not be used by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80)  * board/chassis drivers.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) u8 cpci_get_attention_status(struct slot *slot);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) u8 cpci_get_latch_status(struct slot *slot);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) u8 cpci_get_adapter_status(struct slot *slot);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) u16 cpci_get_hs_csr(struct slot *slot);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) int cpci_set_attention_status(struct slot *slot, int status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) int cpci_check_and_clear_ins(struct slot *slot);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) int cpci_check_ext(struct slot *slot);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) int cpci_clear_ext(struct slot *slot);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) int cpci_led_on(struct slot *slot);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) int cpci_led_off(struct slot *slot);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) int cpci_configure_slot(struct slot *slot);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) int cpci_unconfigure_slot(struct slot *slot);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) #ifdef CONFIG_HOTPLUG_PCI_CPCI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) int cpci_hotplug_init(int debug);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) static inline int cpci_hotplug_init(int debug) { return 0; }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) #endif	/* _CPCI_HOTPLUG_H */