xref: /netbsd-src/sys/arch/mips/cavium/dev/octeon_smireg.h (revision bdc22b2e01993381dcefeff2bc9b56ca75a4235c)
1 /*	$NetBSD: octeon_smireg.h,v 1.1 2015/04/29 08:32:01 hikaru Exp $	*/
2 
3 /*
4  * Copyright (c) 2007 Internet Initiative Japan, Inc.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26  * SUCH DAMAGE.
27  */
28 
29 /*
30  * SMI Registers
31  */
32 
33 #ifndef _OCTEON_SMIREG_H_
34 #define _OCTEON_SMIREG_H_
35 
36 #define	SMI_CMD					0x0001180000001800ULL
37 #define	SMI_WR_DAT				0x0001180000001808ULL
38 #define	SMI_RD_DAT				0x0001180000001810ULL
39 #define	SMI_CLK					0x0001180000001818ULL
40 #define	SMI_EN					0x0001180000001820ULL
41 
42 #define	SMI_CMD_OFFSET				0x00ULL
43 #define	SMI_WR_DAT_OFFSET			0x08ULL
44 #define	SMI_RD_DAT_OFFSET			0x10ULL
45 #define	SMI_CLK_OFFSET				0x18ULL
46 #define	SMI_EN_OFFSET				0x20ULL
47 
48 #define SMI_BASE				0x0001180000001800ULL
49 #define SMI_SIZE				0x028ULL
50 
51 /* SMI CMD */
52 #define SMI_CMD_63_17			UINT64_C(0xfffffffffffe0000)
53 #define SMI_CMD_PHY_OP			UINT64_C(0x0000000000010000)
54 #define SMI_CMD_15_13			UINT64_C(0x000000000000e000)
55 #define SMI_CMD_PHY_ADR			UINT64_C(0x0000000000001f00)
56 #define  SMI_CMD_PHY_ADR_SHIFT		8
57 #define SMI_CMD_7_5			UINT64_C(0x00000000000000e0)
58 #define SMI_CMD_REG_ADR			UINT64_C(0x000000000000001f)
59 #define  SMI_CMD_REG_ADR_SHIFT		0
60 
61 /* SMI_WR_DAT */
62 #define SMI_WR_DAT_63_18		UINT64_C(0xfffffffffffc0000)
63 #define SMI_WR_DAT_PENDING		UINT64_C(0x0000000000020000)
64 #define SMI_WR_DAT_VAL			UINT64_C(0x0000000000010000)
65 #define SMI_WR_DAT_DAT			UINT64_C(0x000000000000ffff)
66 
67 /* SMI_RD_DAT */
68 #define SMI_RD_DAT_63_18		UINT64_C(0xfffffffffffc0000)
69 #define SMI_RD_DAT_PENDING		UINT64_C(0x0000000000020000)
70 #define SMI_RD_DAT_VAL			UINT64_C(0x0000000000010000)
71 #define SMI_RD_DAT_DAT			UINT64_C(0x000000000000ffff)
72 
73 /* SMI_CLK */
74 #define SMI_CLK_63_21			UINT64_C(0xffffffffffe00000)
75 #define SMI_CLK_SAMPLE_HI		UINT64_C(0x00000000001f0000)
76 #define SMI_CLK_15_14			UINT64_C(0x000000000000c000)
77 #define SMI_CLK_CLK_IDLE		UINT64_C(0x0000000000002000)
78 #define SMI_CLK_PREAMBLE		UINT64_C(0x0000000000001000)
79 #define SMI_CLK_SAMPLE			UINT64_C(0x0000000000000f00)
80 #define SMI_CLK_PHASE			UINT64_C(0x00000000000000ff)
81 
82 /* SMI_EN */
83 #define SMI_EN_63_1			UINT64_C(0xfffffffffffffffe)
84 #define SMI_EN_EN			UINT64_C(0x0000000000000001)
85 
86 /* XXX */
87 
88 #endif /* _OCTEON_SMIREG_H_ */
89