1 /***********************license start***************
2 * Copyright (c) 2003-2010 Cavium Networks (support@cavium.com). All rights
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
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.
18 * * Neither the name of Cavium Networks nor the names of
19 * its contributors may be used to endorse or promote products
20 * derived from this software without specific prior written
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
28 * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
29 * AND WITH ALL FAULTS AND CAVIUM NETWORKS 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**************************************/
46 #ifndef __CVMX_THUNDER_H__
47 #define __CVMX_THUNDER_H__
52 * Interface to the Thunder specific devices
54 * <hr>$Revision: 49448 $<hr>
62 #define CVMX_RTC_DS1374_ADDR (0x68)
65 * Read time-of-day counter.
66 * This function is called internally by cvmx-rtc functions.
68 uint32_t cvmx_rtc_ds1374_read(void);
71 * Write time-of-day counter.
72 * This function is called internally by cvmx-rtc functions.
74 int cvmx_rtc_ds1374_write(uint32_t time);
81 CVMX_LAN_BYPASS_OFF = 0, /**< LAN bypass is disabled, port 0 and port 1
82 are always connected to Octeon */
83 CVMX_LAN_BYPASS_GPIO, /**< LAN bypass controlled by GPIO only */
84 CVMX_LAN_BYPASS_WATCHDOG, /**< LAN bypass controlled by watchdog (and GPIO) */
85 CVMX_LAN_BYPASS_LAST /* Keep as last entry */
86 } cvmx_lan_bypass_mode_t;
90 * Set LAN bypass mode.
92 * Supported modes are:
93 * - CVMX_LAN_BYPASS_OFF
94 * <br>LAN ports are connected ( port 0 <--> Octeon <--> port 1 )
96 * - CVMX_LAN_BYPASS_GPIO
97 * <br>LAN bypass is controlled by software using cvmx_lan_bypass_force() function.
98 * When transitioning to this mode, default is LAN bypass enabled
99 * ( port 0 <--> port 1, disconnected from Octeon ).
101 * - CVMX_LAN_BYPASS_WATCHDOG
102 * <br>LAN bypass is inactive as long as the watchdog is kept alive.
103 * The default expiration time is 1 second and the function to
104 * call periodically to prevent watchdog expiration is
105 * cvmx_lan_bypass_keep_alive().
107 * @param mode LAN bypass mode
109 * @return Error code, or 0 in case of success
111 int cvmx_lan_bypass_mode_set(cvmx_lan_bypass_mode_t mode);
114 * Return status of LAN bypass circuit.
116 * @return 1 if ports are in LAN bypass, or 0 if normally connected
118 int cvmx_lan_bypass_is_active(void);
121 * Refresh watchdog timer.
123 * Call periodically (less than 1 second) to prevent triggering LAN bypass.
124 * The alternative cvmx_lan_bypass_keep_alive_ms() is provided for cases
125 * where a variable interval is required.
127 void cvmx_lan_bypass_keep_alive(void);
130 * Refresh watchdog timer, setting a specific expiration interval.
132 * @param interval_ms Interval, in milliseconds, to next watchdog expiration.
134 void cvmx_lan_bypass_keep_alive_ms(uint32_t interval_ms);
137 * Control LAN bypass via software.
139 * @param force_bypass Force LAN bypass to active (1) or inactive (0)
141 * @return Error code, or 0 in case of success
143 int cvmx_lan_bypass_force(int force_bypass);
150 #endif /* __CVMX_THUNDER_H__ */