~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/soc/ti/knav_dma.h

Version: ~ [ linux-5.4-rc7 ] ~ [ linux-5.3.11 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.84 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.154 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.201 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.201 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.77 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-3.9.11 ] ~ [ linux-3.8.13 ] ~ [ linux-3.7.10 ] ~ [ linux-3.6.11 ] ~ [ linux-3.5.7 ] ~ [ linux-3.4.113 ] ~ [ linux-3.3.8 ] ~ [ linux-3.2.102 ] ~ [ linux-3.1.10 ] ~ [ linux-3.0.101 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * Copyright (C) 2014 Texas Instruments Incorporated
  3  * Authors:     Sandeep Nair <sandeep_n@ti.com
  4  *              Cyril Chemparathy <cyril@ti.com
  5                 Santosh Shilimkar <santosh.shilimkar@ti.com>
  6  *
  7  * This program is free software; you can redistribute it and/or
  8  * modify it under the terms of the GNU General Public License as
  9  * published by the Free Software Foundation version 2.
 10  *
 11  * This program is distributed "as is" WITHOUT ANY WARRANTY of any
 12  * kind, whether express or implied; without even the implied warranty
 13  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 14  * GNU General Public License for more details.
 15  */
 16 
 17 #ifndef __SOC_TI_KEYSTONE_NAVIGATOR_DMA_H__
 18 #define __SOC_TI_KEYSTONE_NAVIGATOR_DMA_H__
 19 
 20 /*
 21  * PKTDMA descriptor manipulation macros for host packet descriptor
 22  */
 23 #define MASK(x)                                 (BIT(x) - 1)
 24 #define KNAV_DMA_DESC_PKT_LEN_MASK              MASK(22)
 25 #define KNAV_DMA_DESC_PKT_LEN_SHIFT             0
 26 #define KNAV_DMA_DESC_PS_INFO_IN_SOP            BIT(22)
 27 #define KNAV_DMA_DESC_PS_INFO_IN_DESC           0
 28 #define KNAV_DMA_DESC_TAG_MASK                  MASK(8)
 29 #define KNAV_DMA_DESC_SAG_HI_SHIFT              24
 30 #define KNAV_DMA_DESC_STAG_LO_SHIFT             16
 31 #define KNAV_DMA_DESC_DTAG_HI_SHIFT             8
 32 #define KNAV_DMA_DESC_DTAG_LO_SHIFT             0
 33 #define KNAV_DMA_DESC_HAS_EPIB                  BIT(31)
 34 #define KNAV_DMA_DESC_NO_EPIB                   0
 35 #define KNAV_DMA_DESC_PSLEN_SHIFT               24
 36 #define KNAV_DMA_DESC_PSLEN_MASK                MASK(6)
 37 #define KNAV_DMA_DESC_ERR_FLAG_SHIFT            20
 38 #define KNAV_DMA_DESC_ERR_FLAG_MASK             MASK(4)
 39 #define KNAV_DMA_DESC_PSFLAG_SHIFT              16
 40 #define KNAV_DMA_DESC_PSFLAG_MASK               MASK(4)
 41 #define KNAV_DMA_DESC_RETQ_SHIFT                0
 42 #define KNAV_DMA_DESC_RETQ_MASK                 MASK(14)
 43 #define KNAV_DMA_DESC_BUF_LEN_MASK              MASK(22)
 44 
 45 #define KNAV_DMA_NUM_EPIB_WORDS                 4
 46 #define KNAV_DMA_NUM_PS_WORDS                   16
 47 #define KNAV_DMA_FDQ_PER_CHAN                   4
 48 
 49 /* Tx channel scheduling priority */
 50 enum knav_dma_tx_priority {
 51         DMA_PRIO_HIGH   = 0,
 52         DMA_PRIO_MED_H,
 53         DMA_PRIO_MED_L,
 54         DMA_PRIO_LOW
 55 };
 56 
 57 /* Rx channel error handling mode during buffer starvation */
 58 enum knav_dma_rx_err_mode {
 59         DMA_DROP = 0,
 60         DMA_RETRY
 61 };
 62 
 63 /* Rx flow size threshold configuration */
 64 enum knav_dma_rx_thresholds {
 65         DMA_THRESH_NONE         = 0,
 66         DMA_THRESH_0            = 1,
 67         DMA_THRESH_0_1          = 3,
 68         DMA_THRESH_0_1_2        = 7
 69 };
 70 
 71 /* Descriptor type */
 72 enum knav_dma_desc_type {
 73         DMA_DESC_HOST = 0,
 74         DMA_DESC_MONOLITHIC = 2
 75 };
 76 
 77 /**
 78  * struct knav_dma_tx_cfg:      Tx channel configuration
 79  * @filt_einfo:                 Filter extended packet info
 80  * @filt_pswords:               Filter PS words present
 81  * @knav_dma_tx_priority:       Tx channel scheduling priority
 82  */
 83 struct knav_dma_tx_cfg {
 84         bool                            filt_einfo;
 85         bool                            filt_pswords;
 86         enum knav_dma_tx_priority       priority;
 87 };
 88 
 89 /**
 90  * struct knav_dma_rx_cfg:      Rx flow configuration
 91  * @einfo_present:              Extended packet info present
 92  * @psinfo_present:             PS words present
 93  * @knav_dma_rx_err_mode:       Error during buffer starvation
 94  * @knav_dma_desc_type: Host or Monolithic desc
 95  * @psinfo_at_sop:              PS word located at start of packet
 96  * @sop_offset:                 Start of packet offset
 97  * @dst_q:                      Destination queue for a given flow
 98  * @thresh:                     Rx flow size threshold
 99  * @fdq[]:                      Free desc Queue array
100  * @sz_thresh0:                 RX packet size threshold 0
101  * @sz_thresh1:                 RX packet size threshold 1
102  * @sz_thresh2:                 RX packet size threshold 2
103  */
104 struct knav_dma_rx_cfg {
105         bool                            einfo_present;
106         bool                            psinfo_present;
107         enum knav_dma_rx_err_mode       err_mode;
108         enum knav_dma_desc_type         desc_type;
109         bool                            psinfo_at_sop;
110         unsigned int                    sop_offset;
111         unsigned int                    dst_q;
112         enum knav_dma_rx_thresholds     thresh;
113         unsigned int                    fdq[KNAV_DMA_FDQ_PER_CHAN];
114         unsigned int                    sz_thresh0;
115         unsigned int                    sz_thresh1;
116         unsigned int                    sz_thresh2;
117 };
118 
119 /**
120  * struct knav_dma_cfg: Pktdma channel configuration
121  * @sl_cfg:                     Slave configuration
122  * @tx:                         Tx channel configuration
123  * @rx:                         Rx flow configuration
124  */
125 struct knav_dma_cfg {
126         enum dma_transfer_direction direction;
127         union {
128                 struct knav_dma_tx_cfg  tx;
129                 struct knav_dma_rx_cfg  rx;
130         } u;
131 };
132 
133 /**
134  * struct knav_dma_desc:        Host packet descriptor layout
135  * @desc_info:                  Descriptor information like id, type, length
136  * @tag_info:                   Flow tag info written in during RX
137  * @packet_info:                Queue Manager, policy, flags etc
138  * @buff_len:                   Buffer length in bytes
139  * @buff:                       Buffer pointer
140  * @next_desc:                  For chaining the descriptors
141  * @orig_len:                   length since 'buff_len' can be overwritten
142  * @orig_buff:                  buff pointer since 'buff' can be overwritten
143  * @epib:                       Extended packet info block
144  * @psdata:                     Protocol specific
145  */
146 struct knav_dma_desc {
147         u32     desc_info;
148         u32     tag_info;
149         u32     packet_info;
150         u32     buff_len;
151         u32     buff;
152         u32     next_desc;
153         u32     orig_len;
154         u32     orig_buff;
155         u32     epib[KNAV_DMA_NUM_EPIB_WORDS];
156         u32     psdata[KNAV_DMA_NUM_PS_WORDS];
157         u32     pad[4];
158 } ____cacheline_aligned;
159 
160 #if IS_ENABLED(CONFIG_KEYSTONE_NAVIGATOR_DMA)
161 void *knav_dma_open_channel(struct device *dev, const char *name,
162                                 struct knav_dma_cfg *config);
163 void knav_dma_close_channel(void *channel);
164 #else
165 static inline void *knav_dma_open_channel(struct device *dev, const char *name,
166                                 struct knav_dma_cfg *config)
167 {
168         return (void *) NULL;
169 }
170 static inline void knav_dma_close_channel(void *channel)
171 {}
172 
173 #endif
174 
175 #endif /* __SOC_TI_KEYSTONE_NAVIGATOR_DMA_H__ */
176 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp