xref: /wlan-driver/fw-api/hw/qca6290/v2/seq_hwio.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1*5113495bSYour Name /*
2*5113495bSYour Name  * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved.
3*5113495bSYour Name  *
4*5113495bSYour Name  * Permission to use, copy, modify, and/or distribute this software for
5*5113495bSYour Name  * any purpose with or without fee is hereby granted, provided that the
6*5113495bSYour Name  * above copyright notice and this permission notice appear in all
7*5113495bSYour Name  * copies.
8*5113495bSYour Name  *
9*5113495bSYour Name  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10*5113495bSYour Name  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11*5113495bSYour Name  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12*5113495bSYour Name  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13*5113495bSYour Name  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14*5113495bSYour Name  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15*5113495bSYour Name  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16*5113495bSYour Name  * PERFORMANCE OF THIS SOFTWARE.
17*5113495bSYour Name  */
18*5113495bSYour Name 
19*5113495bSYour Name /*********************************************************************************
20*5113495bSYour Name  *
21*5113495bSYour Name  * DESCRIPTION
22*5113495bSYour Name  * - This is an extension of standard msmhwio.h to support relative addressing
23*5113495bSYour Name  *   scheme used in SCALe auto-generated sequences.
24*5113495bSYour Name  * - The objective of this new addressing scheme is enable the same C function
25*5113495bSYour Name  *   definition to be applicable to multiple baseances of the same block.
26*5113495bSYour Name  * - Such code reuse is not feasible with the standard HWIO macros that use a
27*5113495bSYour Name  *   absolute addressing scheme.
28*5113495bSYour Name  * - Compared to the standard HWIO macros, the new macros defined here take an
29*5113495bSYour Name  *   additional parameter 'baseance offset'.  So are the C functions generated
30*5113495bSYour Name  *   by SCALe Autoseq from .seq inputs.
31*5113495bSYour Name  * - As such, macros defined in this file must be used with 'seq_msmhwiobase.h',
32*5113495bSYour Name  *   'seq_msmhwioreg.h', and the C codes generated from SCALe Autoseq.
33*5113495bSYour Name  * - Macros defined in this file leverage the lower-level macros from the
34*5113495bSYour Name  *   standard 'msmhwio.h', and the two sets of macros are compatible.
35*5113495bSYour Name  *
36*5113495bSYour Name  ********************************************************************************/
37*5113495bSYour Name 
38*5113495bSYour Name #ifndef __SEQ_H__
39*5113495bSYour Name #define __SEQ_H__
40*5113495bSYour Name 
41*5113495bSYour Name #include "HALhwio.h"
42*5113495bSYour Name 
43*5113495bSYour Name 
44*5113495bSYour Name 
45*5113495bSYour Name /**** Register Ref Read ****/
46*5113495bSYour Name #define SEQ_INH(base, regtype, reg) \
47*5113495bSYour Name         SEQ_##regtype##_INH(base, reg)
48*5113495bSYour Name 
49*5113495bSYour Name /**** Masked Register Read ****/
50*5113495bSYour Name #define SEQ_INMH(base, regtype, reg, mask) \
51*5113495bSYour Name         SEQ_##regtype##_INMH(base, reg, mask)
52*5113495bSYour Name 
53*5113495bSYour Name 
54*5113495bSYour Name /**** Ref Reg Field Read ****/
55*5113495bSYour Name #define SEQ_INFH(base, regtype, reg, fld) \
56*5113495bSYour Name         (SEQ_##regtype##_INMH(base, reg, HWIO_FMSK(regtype, fld)) >> HWIO_SHFT(regtype, fld))
57*5113495bSYour Name 
58*5113495bSYour Name 
59*5113495bSYour Name /**** Ref Register  Write ****/
60*5113495bSYour Name #define SEQ_OUTH(base, regtype, reg, val) \
61*5113495bSYour Name         SEQ_##regtype##_OUTH(base, reg, val)
62*5113495bSYour Name 
63*5113495bSYour Name /**** Ref Register Masked Write ****/
64*5113495bSYour Name #define SEQ_OUTMH(base, regtype, reg, mask, val) \
65*5113495bSYour Name         SEQ_##regtype##_OUTMH(base, reg, mask, val)
66*5113495bSYour Name 
67*5113495bSYour Name 
68*5113495bSYour Name /**** Ref Register Field Write ****/
69*5113495bSYour Name #define SEQ_OUTFH(base, regtype, reg, fld, val) \
70*5113495bSYour Name         SEQ_##regtype##_OUTMH(base, reg, HWIO_FMSK(regtype, fld), val << HWIO_SHFT(regtype, fld))
71*5113495bSYour Name 
72*5113495bSYour Name 
73*5113495bSYour Name /**** seq_msg() ****
74*5113495bSYour Name 
75*5113495bSYour Name typedef enum {
76*5113495bSYour Name 	DEBUG,
77*5113495bSYour Name 	INFO,
78*5113495bSYour Name 	WARNING,
79*5113495bSYour Name 	ERROR,
80*5113495bSYour Name 	FATAL
81*5113495bSYour Name } SeverityLevel ;
82*5113495bSYour Name 
83*5113495bSYour Name void seq_msg(SeverityLevel severity, unsigned int msg_id, const char *format_str, ... );
84*5113495bSYour Name 
85*5113495bSYour Name */
86*5113495bSYour Name 
87*5113495bSYour Name /************ seq_wait() ************/
88*5113495bSYour Name 
89*5113495bSYour Name typedef enum {
90*5113495bSYour Name     SEC,
91*5113495bSYour Name     MS,
92*5113495bSYour Name     US,
93*5113495bSYour Name     NS
94*5113495bSYour Name } SEQ_TimeUnit;
95*5113495bSYour Name 
96*5113495bSYour Name extern void seq_wait(uint32 time_value, SEQ_TimeUnit time_unit);
97*5113495bSYour Name 
98*5113495bSYour Name 
99*5113495bSYour Name /************ seq_poll() ************/
100*5113495bSYour Name extern uint32 seq_poll(uint32 reg_offset, uint32 expect_value, uint32 value_mask, uint32 value_shift, uint32 max_poll_cnt);
101*5113495bSYour Name 
102*5113495bSYour Name #endif /* __SEQ_H__ */
103*5113495bSYour Name 
104*5113495bSYour Name 
105*5113495bSYour Name 
106*5113495bSYour Name 
107*5113495bSYour Name 
108*5113495bSYour Name 
109*5113495bSYour Name 
110*5113495bSYour Name 
111*5113495bSYour Name 
112*5113495bSYour Name 
113*5113495bSYour Name 
114*5113495bSYour Name 
115*5113495bSYour Name 
116*5113495bSYour Name 
117*5113495bSYour Name 
118*5113495bSYour Name 
119*5113495bSYour Name 
120*5113495bSYour Name 
121*5113495bSYour Name 
122