1 /***********************license start***************
2 * Copyright (c) 2003-2008 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 * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
24 * AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS
25 * OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH
26 * RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY
27 * REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT
28 * DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES
29 * OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR
30 * PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET
31 * POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT
32 * OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
35 * For any questions regarding licensing please contact marketing@caviumnetworks.com
37 ***********************license end**************************************/
44 #ifndef __CVMX_THUNDER_H__
45 #define __CVMX_THUNDER_H__
50 * Interface to the Thunder specific devices
52 * <hr>$Revision: 41586 $<hr>
60 #define CVMX_RTC_DS1374_ADDR (0x68)
63 * Read time-of-day counter.
64 * This function is called internally by cvmx-rtc functions.
66 uint32_t cvmx_rtc_ds1374_read(void);
69 * Write time-of-day counter.
70 * This function is called internally by cvmx-rtc functions.
72 int cvmx_rtc_ds1374_write(uint32_t time);
79 CVMX_LAN_BYPASS_OFF = 0, /**< LAN bypass is disabled, port 0 and port 1
80 are always connected to Octeon */
81 CVMX_LAN_BYPASS_GPIO, /**< LAN bypass controlled by GPIO only */
82 CVMX_LAN_BYPASS_WATCHDOG, /**< LAN bypass controlled by watchdog (and GPIO) */
83 CVMX_LAN_BYPASS_LAST /* Keep as last entry */
84 } cvmx_lan_bypass_mode_t;
88 * Set LAN bypass mode.
90 * Supported modes are:
91 * - CVMX_LAN_BYPASS_OFF
92 * <br>LAN ports are connected ( port 0 <--> Octeon <--> port 1 )
94 * - CVMX_LAN_BYPASS_GPIO
95 * <br>LAN bypass is controlled by software using cvmx_lan_bypass_force() function.
96 * When transitioning to this mode, default is LAN bypass enabled
97 * ( port 0 <--> port 1, disconnected from Octeon ).
99 * - CVMX_LAN_BYPASS_WATCHDOG
100 * <br>LAN bypass is inactive as long as the watchdog is kept alive.
101 * The default expiration time is 1 second and the function to
102 * call periodically to prevent watchdog expiration is
103 * cvmx_lan_bypass_keep_alive().
105 * @param mode LAN bypass mode
107 * @return Error code, or 0 in case of success
109 int cvmx_lan_bypass_mode_set(cvmx_lan_bypass_mode_t mode);
112 * Return status of LAN bypass circuit.
114 * @return 1 if ports are in LAN bypass, or 0 if normally connected
116 int cvmx_lan_bypass_is_active(void);
119 * Refresh watchdog timer.
121 * Call periodically (less than 1 second) to prevent triggering LAN bypass.
122 * The alternative cvmx_lan_bypass_keep_alive_ms() is provided for cases
123 * where a variable interval is required.
125 void cvmx_lan_bypass_keep_alive(void);
128 * Refresh watchdog timer, setting a specific expiration interval.
130 * @param interval_ms Interval, in milliseconds, to next watchdog expiration.
132 void cvmx_lan_bypass_keep_alive_ms(uint32_t interval_ms);
135 * Control LAN bypass via software.
137 * @param force_bypass Force LAN bypass to active (1) or inactive (0)
139 * @return Error code, or 0 in case of success
141 int cvmx_lan_bypass_force(int force_bypass);
148 #endif /* __CVMX_THUNDER_H__ */