xref: /freebsd/sys/contrib/alpine-hal/al_serdes.h (revision c66ec88fed842fbaad62c30d510644ceb7bd2d71)
1 /*******************************************************************************
2 Copyright (C) 2013 Annapurna Labs Ltd.
3 
4 This file is licensed under the terms of the Annapurna Labs' Commercial License
5 Agreement distributed with the file or available on the software download site.
6 Recipient shall use the content of this file only on semiconductor devices or
7 systems developed by or for Annapurna Labs.
8 
9  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
10  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
11  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
12  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
13  ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
14  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
15  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
16  ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
17  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
18  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
19 
20 *******************************************************************************/
21 
22 /**
23  * @defgroup group_serdes_init SerDes Initialization
24  * @ingroup group_serdes SerDes
25  * @{
26  *
27  * @file   al_serdes.h
28  *
29  */
30 
31 #ifndef __AL_SERDES_H__
32 #define __AL_SERDES_H__
33 
34 #include "al_hal_serdes_interface.h"
35 
36 /* *INDENT-OFF* */
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 /* *INDENT-ON* */
41 
42 #ifdef AL_DEV_ID
43 #define CHECK_ALPINE_V1	(AL_DEV_ID == AL_DEV_ID_ALPINE_V1)
44 #define CHECK_ALPINE_V2	(AL_DEV_ID == AL_DEV_ID_ALPINE_V2)
45 #else
46 #define CHECK_ALPINE_V1	1
47 #define CHECK_ALPINE_V2	1
48 #endif
49 
50 enum al_serdes_group {
51 	AL_SRDS_GRP_A = 0,
52 	AL_SRDS_GRP_B,
53 	AL_SRDS_GRP_C,
54 	AL_SRDS_GRP_D,
55 	AL_SRDS_NUM_HSSP_GROUPS,
56 #if CHECK_ALPINE_V2
57 	AL_SRDS_GRP_E = AL_SRDS_NUM_HSSP_GROUPS,
58 	AL_SRDS_NUM_GROUPS,
59 #else
60 	AL_SRDS_NUM_GROUPS = AL_SRDS_NUM_HSSP_GROUPS,
61 #endif
62 };
63 
64 int al_serdes_handle_grp_init(
65 	void __iomem			*serdes_regs_base,
66 	enum al_serdes_group		grp,
67 	struct al_serdes_grp_obj	*obj);
68 
69 /* *INDENT-OFF* */
70 #ifdef __cplusplus
71 }
72 #endif
73 
74 /* *INDENT-ON* */
75 #endif
76 
77 /** @} end of SERDES group */
78 
79