xref: /freebsd/sys/contrib/alpine-hal/al_serdes.c (revision c697fb7f)
1 /*******************************************************************************
2 Copyright (C) 2015 Annapurna Labs Ltd.
3 
4 This file may be licensed under the terms of the Annapurna Labs Commercial
5 License Agreement.
6 
7 Alternatively, this file can be distributed under the terms of the GNU General
8 Public License V2 as published by the Free Software Foundation and can be
9 found at http://www.gnu.org/licenses/gpl-2.0.html
10 
11 Alternatively, redistribution and use in source and binary forms, with or
12 without modification, are permitted provided that the following conditions are
13 met:
14 
15     *     Redistributions of source code must retain the above copyright notice,
16 this list of conditions and the following disclaimer.
17 
18     *     Redistributions in binary form must reproduce the above copyright
19 notice, this list of conditions and the following disclaimer in
20 the documentation and/or other materials provided with the
21 distribution.
22 
23 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
24 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
27 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
30 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 
34 *******************************************************************************/
35 
36 #include "al_serdes.h"
37 #include "al_hal_serdes_hssp.h"
38 #include "al_hal_serdes_25g.h"
39 
40 static int(*handle_init[AL_SRDS_NUM_GROUPS])(void __iomem *, struct al_serdes_grp_obj *) = {
41 	al_serdes_hssp_handle_init,
42 	al_serdes_hssp_handle_init,
43 	al_serdes_hssp_handle_init,
44 	al_serdes_hssp_handle_init,
45 #if CHECK_ALPINE_V2
46 	al_serdes_25g_handle_init,
47 #endif
48 };
49 
50 int al_serdes_handle_grp_init(
51 	void __iomem			*serdes_regs_base,
52 	enum al_serdes_group		grp,
53 	struct al_serdes_grp_obj	*obj)
54 {
55 	handle_init[grp](serdes_regs_base, obj);
56 
57 	return 0;
58 }
59 
60