1/***********************license start***************
2 * Copyright (c) 2003-2010  Cavium Inc. (support@cavium.com). All rights
3 * reserved.
4 *
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met:
9 *
10 *   * Redistributions of source code must retain the above copyright
11 *     notice, this list of conditions and the following disclaimer.
12 *
13 *   * Redistributions in binary form must reproduce the above
14 *     copyright notice, this list of conditions and the following
15 *     disclaimer in the documentation and/or other materials provided
16 *     with the distribution.
17
18 *   * Neither the name of Cavium Inc. nor the names of
19 *     its contributors may be used to endorse or promote products
20 *     derived from this software without specific prior written
21 *     permission.
22
23 * This Software, including technical data, may be subject to U.S. export  control
24 * laws, including the U.S. Export Administration Act and its  associated
25 * regulations, and may be subject to export or import  regulations in other
26 * countries.
27
28 * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
29 * AND WITH ALL FAULTS AND CAVIUM INC. MAKES NO PROMISES, REPRESENTATIONS OR
30 * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
31 * THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR
32 * DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM
33 * SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE,
34 * MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF
35 * VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
36 * CORRESPONDENCE TO DESCRIPTION. THE ENTIRE  RISK ARISING OUT OF USE OR
37 * PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
38 ***********************license end**************************************/
39
40
41
42#ifndef __CVMX_IXF18201_H__
43#define __CVMX_IXF18201_H__
44
45#ifdef	__cplusplus
46extern "C" {
47#endif
48
49/**
50 * Initialize the IXF18201 SPI<->XAUI MAC.
51 * @return 1 on success
52 *         0 on failure
53 */
54int cvmx_ixf18201_init(void);
55
56/**
57 * Read a 16 bit register from the IXF18201
58 *
59 * @param reg_addr Register address
60 *
61 * @return 16 bit register value
62 */
63uint16_t cvmx_ixf18201_read16(uint16_t reg_addr);
64/**
65 * Write a 16 bit IXF18201 register
66 *
67 * @param reg_addr Register address
68 * @param data Value to write
69 *
70 */
71void cvmx_ixf18201_write16(uint16_t reg_addr, uint16_t data);
72/**
73 * Write a 16 bit IXF18201 register
74 *
75 * @param reg_addr Register address (must be 4 byte aligned)
76 *
77 * @return 32 bit register value
78 */
79uint32_t cvmx_ixf18201_read32(uint16_t reg_addr);
80/**
81 * Write a 32 bit IXF18201 register
82 *
83 * @param reg_addr Register address (must be 4 byte aligned)
84 * @param data Value to write
85 *
86 */
87void cvmx_ixf18201_write32(uint16_t reg_addr, uint32_t data);
88
89/**
90 * Performs an MII clause 45 write using the MII block in IXF18201.
91 *
92 * @param mii_addr Device MII address
93 * @param mmd      MMD address (block within device)
94 * @param reg      Register address
95 * @param val      Value to write
96 */
97void cvmx_ixf18201_mii_write(int mii_addr, int mmd, uint16_t reg, uint16_t val);
98/**
99 * Performs an MII clause 45 read using the MII block in IXF18201.
100 *
101 * @param mii_addr Device MII address
102 * @param mmd      MMD address (block within device)
103 * @param reg      Register address
104 * @return  register value read from device
105 */
106int cvmx_ixf18201_mii_read(int mii_addr, int mmd, uint16_t reg);
107
108#ifdef	__cplusplus
109}
110#endif
111
112#endif  /*  __CVMX_IXF18201_H__ */
113