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-only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * cs_internal.h -- definitions internal to the PCMCIA core modules
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * The initial developer of the original code is David A. Hinds
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  * <dahinds@users.sourceforge.net>.  Portions created by David A. Hinds
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  * are Copyright (C) 1999 David A. Hinds.  All Rights Reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  * (C) 1999		David A. Hinds
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)  * (C) 2003 - 2010	Dominik Brodowski
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12)  * This file contains definitions _only_ needed by the PCMCIA core modules.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13)  * It must not be included by PCMCIA socket drivers or by PCMCIA device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14)  * drivers.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) #ifndef _LINUX_CS_INTERNAL_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #define _LINUX_CS_INTERNAL_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) #include <linux/kref.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) /* Flags in client state */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) #define CLIENT_WIN_REQ(i)	(0x1<<(i))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) /* Flag to access all functions */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) #define BIND_FN_ALL	0xff
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) /* Each card function gets one of these guys */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) typedef struct config_t {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 	struct kref	ref;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 	unsigned int	state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 	struct resource io[MAX_IO_WIN]; /* io ports */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 	struct resource mem[MAX_WIN];   /* mem areas */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) } config_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) struct cis_cache_entry {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 	struct list_head	node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 	unsigned int		addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 	unsigned int		len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 	unsigned int		attr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 	unsigned char		cache[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) struct pccard_resource_ops {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	int	(*validate_mem)		(struct pcmcia_socket *s);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	int	(*find_io)		(struct pcmcia_socket *s,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 					 unsigned int attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 					 unsigned int *base,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 					 unsigned int num,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 					 unsigned int align,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 					 struct resource **parent);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	struct resource* (*find_mem)	(unsigned long base, unsigned long num,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 					 unsigned long align, int low,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 					 struct pcmcia_socket *s);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	int	(*init)			(struct pcmcia_socket *s);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	void	(*exit)			(struct pcmcia_socket *s);
^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) /* Flags in config state */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) #define CONFIG_LOCKED		0x01
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) #define CONFIG_IRQ_REQ		0x02
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) #define CONFIG_IO_REQ		0x04
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) /* Flags in socket state */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) #define SOCKET_PRESENT		0x0008
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) #define SOCKET_INUSE		0x0010
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) #define SOCKET_IN_RESUME	0x0040
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) #define SOCKET_SUSPEND		0x0080
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) #define SOCKET_WIN_REQ(i)	(0x0100<<(i))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) #define SOCKET_CARDBUS		0x8000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) #define SOCKET_CARDBUS_CONFIG	0x10000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77)  * Stuff internal to module "pcmcia_rsrc":
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) extern int static_init(struct pcmcia_socket *s);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) extern struct resource *pcmcia_make_resource(resource_size_t start,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 					resource_size_t end,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 					unsigned long flags, const char *name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85)  * Stuff internal to module "pcmcia_core":
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) /* socket_sysfs.c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) extern int pccard_sysfs_add_socket(struct device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) extern void pccard_sysfs_remove_socket(struct device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) /* cardbus.c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) int cb_alloc(struct pcmcia_socket *s);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) void cb_free(struct pcmcia_socket *s);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99)  * Stuff exported by module "pcmcia_core" to module "pcmcia"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) struct pcmcia_callback{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	struct module	*owner;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	int		(*add) (struct pcmcia_socket *s);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 	int		(*remove) (struct pcmcia_socket *s);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	void		(*requery) (struct pcmcia_socket *s);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	int		(*validate) (struct pcmcia_socket *s, unsigned int *i);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	int		(*suspend) (struct pcmcia_socket *s);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 	int		(*early_resume) (struct pcmcia_socket *s);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	int		(*resume) (struct pcmcia_socket *s);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) /* cs.c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) extern struct rw_semaphore pcmcia_socket_list_rwsem;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) extern struct list_head pcmcia_socket_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) extern struct class pcmcia_socket_class;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) int pccard_register_pcmcia(struct pcmcia_socket *s, struct pcmcia_callback *c);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) struct pcmcia_socket *pcmcia_get_socket_by_nr(unsigned int nr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) void pcmcia_parse_uevents(struct pcmcia_socket *socket, unsigned int events);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) #define PCMCIA_UEVENT_EJECT	0x0001
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) #define PCMCIA_UEVENT_INSERT	0x0002
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) #define PCMCIA_UEVENT_SUSPEND	0x0004
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) #define PCMCIA_UEVENT_RESUME	0x0008
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) #define PCMCIA_UEVENT_REQUERY	0x0010
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) struct pcmcia_socket *pcmcia_get_socket(struct pcmcia_socket *skt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) void pcmcia_put_socket(struct pcmcia_socket *skt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132)  * Stuff internal to module "pcmcia".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) /* ds.c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) extern struct bus_type pcmcia_bus_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) struct pcmcia_device;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) /* pcmcia_resource.c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) extern int pcmcia_release_configuration(struct pcmcia_device *p_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) extern int pcmcia_validate_mem(struct pcmcia_socket *s);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) extern struct resource *pcmcia_find_mem_region(u_long base,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 					       u_long num,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 					       u_long align,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 					       int low,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 					       struct pcmcia_socket *s);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) void pcmcia_cleanup_irq(struct pcmcia_socket *s);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) int pcmcia_setup_irq(struct pcmcia_device *p_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) /* cistpl.c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) extern const struct bin_attribute pccard_cis_attr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) int pcmcia_read_cis_mem(struct pcmcia_socket *s, int attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 			u_int addr, u_int len, void *ptr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) int pcmcia_write_cis_mem(struct pcmcia_socket *s, int attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 			u_int addr, u_int len, void *ptr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) void release_cis_mem(struct pcmcia_socket *s);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) void destroy_cis_cache(struct pcmcia_socket *s);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) int pccard_read_tuple(struct pcmcia_socket *s, unsigned int function,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 		      cisdata_t code, void *parse);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) int pcmcia_replace_cis(struct pcmcia_socket *s,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 		       const u8 *data, const size_t len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) int pccard_validate_cis(struct pcmcia_socket *s, unsigned int *count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) int verify_cis_cache(struct pcmcia_socket *s);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) int pccard_get_first_tuple(struct pcmcia_socket *s, unsigned int function,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 			tuple_t *tuple);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) int pccard_get_next_tuple(struct pcmcia_socket *s, unsigned int function,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 			tuple_t *tuple);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) int pccard_get_tuple_data(struct pcmcia_socket *s, tuple_t *tuple);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) #endif /* _LINUX_CS_INTERNAL_H */