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) /* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  * Copyright (C) 2019-2020 Linaro Ltd.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) #ifndef _IPA_ENDPOINT_H_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) #define _IPA_ENDPOINT_H_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #include <linux/workqueue.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #include <linux/if_ether.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #include "gsi.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #include "ipa_reg.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) struct net_device;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) struct sk_buff;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) struct ipa;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) struct ipa_gsi_endpoint_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) /* Non-zero granularity of counter used to implement aggregation timeout */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) #define IPA_AGGR_GRANULARITY		500	/* microseconds */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) #define IPA_MTU			ETH_DATA_LEN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) enum ipa_endpoint_name {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 	IPA_ENDPOINT_AP_MODEM_TX	= 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 	IPA_ENDPOINT_MODEM_LAN_TX,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 	IPA_ENDPOINT_MODEM_COMMAND_TX,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 	IPA_ENDPOINT_AP_COMMAND_TX,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 	IPA_ENDPOINT_MODEM_AP_TX,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 	IPA_ENDPOINT_AP_LAN_RX,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 	IPA_ENDPOINT_AP_MODEM_RX,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 	IPA_ENDPOINT_MODEM_AP_RX,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 	IPA_ENDPOINT_MODEM_LAN_RX,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 	IPA_ENDPOINT_COUNT,	/* Number of names (not an index) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) #define IPA_ENDPOINT_MAX		32	/* Max supported by driver */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43)  * enum ipa_replenish_flag:	RX buffer replenish flags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45)  * @IPA_REPLENISH_ENABLED:	Whether receive buffer replenishing is enabled
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46)  * @IPA_REPLENISH_ACTIVE:	Whether replenishing is underway
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47)  * @IPA_REPLENISH_COUNT:	Number of defined replenish flags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) enum ipa_replenish_flag {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	IPA_REPLENISH_ENABLED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	IPA_REPLENISH_ACTIVE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	IPA_REPLENISH_COUNT,	/* Number of flags (must be last) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56)  * struct ipa_endpoint - IPA endpoint information
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57)  * @channel_id:	EP's GSI channel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58)  * @evt_ring_id: EP's GSI channel event ring
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) struct ipa_endpoint {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	struct ipa *ipa;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	enum ipa_seq_type seq_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	enum gsi_ee_id ee_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	u32 channel_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	u32 endpoint_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	bool toward_ipa;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	const struct ipa_endpoint_config_data *data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	u32 trans_tre_max;	/* maximum descriptors per transaction */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 	u32 evt_ring_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	/* Net device this endpoint is associated with, if any */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	struct net_device *netdev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	/* Receive buffer replenishing for RX endpoints */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	DECLARE_BITMAP(replenish_flags, IPA_REPLENISH_COUNT);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	u32 replenish_ready;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	atomic_t replenish_saved;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	atomic_t replenish_backlog;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 	struct delayed_work replenish_work;		/* global wq */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) void ipa_endpoint_modem_hol_block_clear_all(struct ipa *ipa);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) void ipa_endpoint_modem_pause_all(struct ipa *ipa, bool enable);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) int ipa_endpoint_modem_exception_reset_all(struct ipa *ipa);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) int ipa_endpoint_skb_tx(struct ipa_endpoint *endpoint, struct sk_buff *skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) void ipa_endpoint_exit_one(struct ipa_endpoint *endpoint);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) int ipa_endpoint_enable_one(struct ipa_endpoint *endpoint);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) void ipa_endpoint_disable_one(struct ipa_endpoint *endpoint);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) void ipa_endpoint_suspend_one(struct ipa_endpoint *endpoint);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) void ipa_endpoint_resume_one(struct ipa_endpoint *endpoint);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) void ipa_endpoint_suspend(struct ipa *ipa);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) void ipa_endpoint_resume(struct ipa *ipa);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) void ipa_endpoint_setup(struct ipa *ipa);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) void ipa_endpoint_teardown(struct ipa *ipa);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) int ipa_endpoint_config(struct ipa *ipa);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) void ipa_endpoint_deconfig(struct ipa *ipa);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) void ipa_endpoint_default_route_set(struct ipa *ipa, u32 endpoint_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) void ipa_endpoint_default_route_clear(struct ipa *ipa);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) u32 ipa_endpoint_init(struct ipa *ipa, u32 count,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 		      const struct ipa_gsi_endpoint_data *data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) void ipa_endpoint_exit(struct ipa *ipa);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) void ipa_endpoint_trans_complete(struct ipa_endpoint *ipa,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 				 struct gsi_trans *trans);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) void ipa_endpoint_trans_release(struct ipa_endpoint *ipa,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 				struct gsi_trans *trans);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) #endif /* _IPA_ENDPOINT_H_ */