From 61e129885a8fd6d36c25301e537d46e66b6c6e6a Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sat, 21 Jul 2012 05:02:26 +0000 Subject: dm: net: Move IXP NPE to drivers/net/ Signed-off-by: Marek Vasut Cc: Bryan Hundven Cc: Michael Schwingen Cc: Wolfgang Denk Cc: Albert Aribaud Cc: U-Boot DM Cc: Joe Hershberger --- drivers/net/npe/include/IxTimeSyncAcc.h | 783 ++++++++++++++++++++++++++++++++ 1 file changed, 783 insertions(+) create mode 100644 drivers/net/npe/include/IxTimeSyncAcc.h (limited to 'drivers/net/npe/include/IxTimeSyncAcc.h') diff --git a/drivers/net/npe/include/IxTimeSyncAcc.h b/drivers/net/npe/include/IxTimeSyncAcc.h new file mode 100644 index 0000000..25effed --- /dev/null +++ b/drivers/net/npe/include/IxTimeSyncAcc.h @@ -0,0 +1,783 @@ +/** + * @file IxTimeSyncAcc.h + * + * @author Intel Corporation + * @date 07 May 2004 + * + * @brief Header file for IXP400 Access Layer to IEEE 1588(TM) Precision + * Clock Synchronisation Protocol Hardware Assist + * + * @version 1 + * + * @par + * IXP400 SW Release version 2.0 + * + * -- Copyright Notice -- + * + * @par + * Copyright 2001-2005, Intel Corporation. + * All rights reserved. + * + * @par + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Intel Corporation nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * @par + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @par + * -- End of Copyright Notice -- + */ + +/** + * @defgroup IxTimeSyncAcc IXP400 Time Sync Access Component API + * + * @brief Public API for IxTimeSyncAcc + * + * @{ + */ +#ifndef IXTIMESYNCACC_H +#define IXTIMESYNCACC_H + +#ifdef __ixp46X + +#include "IxOsal.h" + +/** + * Section for enum + */ + +/** + * @ingroup IxTimeSyncAcc + * + * @enum IxTimeSyncAccStatus + * + * @brief The status as returned from the API + */ +typedef enum /**< IxTimeSyncAccStatus */ +{ + IX_TIMESYNCACC_SUCCESS = IX_SUCCESS, /**< Requested operation successful */ + IX_TIMESYNCACC_INVALIDPARAM, /**< An invalid parameter was passed */ + IX_TIMESYNCACC_NOTIMESTAMP, /**< While polling no time stamp available */ + IX_TIMESYNCACC_INTERRUPTMODEINUSE, /**< Polling not allowed while operating in interrupt mode */ + IX_TIMESYNCACC_FAILED /**< Internal error occurred */ +}IxTimeSyncAccStatus; + +/** + * @ingroup IxTimeSyncAcc + * + * @enum IxTimeSyncAccAuxMode + * + * @brief Master or Slave Auxiliary Time Stamp (Snap Shot) + */ +typedef enum /**< IxTimeSyncAccAuxMode */ +{ + IX_TIMESYNCACC_AUXMODE_MASTER, /**< Auxiliary Master Mode */ + IX_TIMESYNCACC_AUXMODE_SLAVE, /**< Auxiliary Slave Mode */ + IX_TIMESYNCACC_AUXMODE_INVALID /**< Invalid Auxiliary Mode */ +}IxTimeSyncAccAuxMode; + +/** + * @ingroup IxTimeSyncAcc + * + * @enum IxTimeSyncAcc1588PTPPort + * + * @brief IEEE 1588 PTP Communication Port(Channel) + */ +typedef enum /**< IxTimeSyncAcc1588PTPPort */ +{ + IX_TIMESYNCACC_NPE_A_1588PTP_PORT, /**< PTP Communication Port on NPE-A */ + IX_TIMESYNCACC_NPE_B_1588PTP_PORT, /**< PTP Communication Port on NPE-B */ + IX_TIMESYNCACC_NPE_C_1588PTP_PORT, /**< PTP Communication Port on NPE-C */ + IX_TIMESYNCACC_NPE_1588PORT_INVALID /**< Invalid PTP Communication Port */ +} IxTimeSyncAcc1588PTPPort; + +/** + * @ingroup IxTimeSyncAcc + * + * @enum IxTimeSyncAcc1588PTPPortMode + * + * @brief Master or Slave mode for IEEE 1588 PTP Communication Port + */ +typedef enum /**< IxTimeSyncAcc1588PTPPortMode */ +{ + IX_TIMESYNCACC_1588PTP_PORT_MASTER, /**< PTP Communication Port in Master Mode */ + IX_TIMESYNCACC_1588PTP_PORT_SLAVE, /**< PTP Communication Port in Slave Mode */ + IX_TIMESYNCACC_1588PTP_PORT_ANYMODE, /**< PTP Communication Port in ANY Mode + allows time stamping of all messages + including non-1588 PTP */ + IX_TIMESYNCACC_1588PTP_PORT_MODE_INVALID /**< Invalid PTP Port Mode */ +}IxTimeSyncAcc1588PTPPortMode; + +/** + * @ingroup IxTimeSyncAcc + * + * @enum IxTimeSyncAcc1588PTPMsgType + * + * @brief 1588 PTP Messages types that can be detected on communication port + * + * Note that client code can determine this based on master/slave mode in which + * it is already operating in and this information is made available for the sake + * of convenience only. + */ +typedef enum /**< IxTimeSyncAcc1588PTPMsgType */ +{ + IX_TIMESYNCACC_1588PTP_MSGTYPE_SYNC, /**< PTP Sync message sent by Master or received by Slave */ + IX_TIMESYNCACC_1588PTP_MSGTYPE_DELAYREQ, /**< PTP Delay_Req message sent by Slave or received by Master */ + IX_TIMESYNCACC_1588PTP_MSGTYPE_UNKNOWN /**< Other PTP and non-PTP message sent or received by both + Master and/or Slave */ +} IxTimeSyncAcc1588PTPMsgType; + +/** + * Section for struct + */ + +/** + * @ingroup IxTimeSyncAcc + * + * @struct IxTimeSyncAccTimeValue + * + * @brief Struct to hold 64 bit SystemTime and TimeStamp values + */ +typedef struct /**< IxTimeSyncAccTimeValue */ +{ + UINT32 timeValueLowWord; /**< Lower 32 bits of the time value */ + UINT32 timeValueHighWord; /**< Upper 32 bits of the time value */ +} IxTimeSyncAccTimeValue; + +/** + * @ingroup IxTimeSyncAcc + * + * @struct IxTimeSyncAccUuid + * + * @brief Struct to hold 48 bit UUID values captured in Sync or Delay_Req messages + */ +typedef struct /**< IxTimeSyncAccUuid */ +{ + UINT32 uuidValueLowWord; /** + * NOTE: 1) An individual callback is to be registered for each Slave and Master + * Auxiliary Time Stamp registers. Thus to register for both Master and Slave time + * stamp interrupts either the same callback or two separate callbacks the API has + * to be invoked twice. + * 2) On the IXDP465 Development Platform, the Auxiliary Timestamp signal for + * slave mode is tied to GPIO 8 pin. This signal is software routed by default to + * PCI for backwards compatibility with the IXDP425 Development Platform. This + * routing must be disabled for the auxiliary slave time stamp register to work + * properly. The following commands may be used to accomplish this. However, refer + * to the IXDP465 Development Platform Users Guide or the BSP/LSP documentation for + * more specific information. + * + * For Linux (at the Redboot prompt i.e., before loading zImage): + * mfill -b 0x54100000 -1 -l 1 -p 8 + * mfill -b 0x54100001 -1 -l 1 -p 0x7f + * For vxWorks, at the prompt: + * intDisable(25) + * ixdp400FpgaIODetach(8) + * + * + * @li Re-entrant : no + * @li ISR Callable : no + * + * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful + * @li IX_TIMESYNCACC_INVALIDPARAM - Null parameter passed for callback or + invalid auxiliary snapshot mode + * @li IX_TIMESYNCACC_FAILED - Internal error occurred + */ +PUBLIC IxTimeSyncAccStatus +ixTimeSyncAccAuxTimeInterruptEnable(IxTimeSyncAccAuxMode auxMode, + IxTimeSyncAccAuxTimeCallback auxTimeCallback); + +/** + * @ingroup IxTimeSyncAcc + * + * @fn IxTimeSyncAccStatus ixTimeSyncAccAuxTimeInterruptDisable( + IxTimeSyncAccAuxMode auxMode) + * + * @brief Disables the interrupt for the indicated mode of Auxiliary Time Stamp + * in the IEEE 1588 hardware assist block + * + * @param auxMode [in] - Auxiliary time stamp mode (slave or master) using which + * the interrupt will be disabled. + * + * This API will disable the Auxiliary Time Stamp Interrupt (Master or Slave) + * + * @li Re-entrant : yes + * @li ISR Callable : no + * + * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful + * @li IX_TIMESYNCACC_INVALIDPARAM - Invalid parameters passed + * @li IX_TIMESYNCACC_FAILED - Internal error occurred + */ +PUBLIC IxTimeSyncAccStatus +ixTimeSyncAccAuxTimeInterruptDisable(IxTimeSyncAccAuxMode auxMode); + +/** + * @ingroup IxTimeSyncAcc + * + * @fn IxTimeSyncAccStatus ixTimeSyncAccAuxTimePoll( + IxTimeSyncAccAuxMode auxMode, + BOOL *auxPollFlag, + IxTimeSyncAccTimeValue *auxTime) + * + * @brief Poll for the Auxiliary Time Stamp captured for the mode indicated + * (Master or Slave) + * + * @param auxMode [in] - Auxiliary Snapshot Register (Slave or Master) to be checked + * @param auxPollFlag [out] - TRUE if the time stamp captured in auxiliary + snapshot register + * FALSE if the time stamp not captured in + auxiliary snapshot register + * @param auxTime [out] - Copy the current Auxiliary Snapshot Register value into the + * client provided buffer + * + * Polls for the Time stamp in the appropriate Auxiliary Snapshot Registers based + * on the mode specified. Return true and the contents of the Auxiliary snapshot, + * if it is available else return false. + * + * Please refer to the note #2 of the API @ref ixTimeSyncAccAuxTimeInterruptEnable + * for more information for Auxiliary Slave mode. + * + * @li Re-entrant : yes + * @li ISR Callable : no + * + * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful + * @li IX_TIMESYNCACC_INVALIDPARAM - Null parameter passed for auxPollFlag, + callback or invalid auxiliary snapshot mode + * @li IX_TIMESYNCACC_FAILED - Internal error occurred + * @li IX_TIMESYNCACC_INTERRUPTMODEINUSE - Interrupt mode in use + */ +PUBLIC IxTimeSyncAccStatus +ixTimeSyncAccAuxTimePoll(IxTimeSyncAccAuxMode auxMode, + BOOL *auxPollFlag, + IxTimeSyncAccTimeValue *auxTime); + +/** + * @ingroup IxTimeSyncAcc + * + * @fn IxTimeSyncAccStatus ixTimeSyncAccReset(void) + * + * @brief Resets the IEEE 1588 hardware assist block + * + * Sets the reset bit in the IEEE1588 silicon which fully resets the silicon block + * + * @li Reentrant : yes + * @li ISR Callable : no + * + * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful + * @li IX_TIMESYNCACC_FAILED - Internal error occurred + */ +PUBLIC IxTimeSyncAccStatus +ixTimeSyncAccReset(void); + +/** + * @ingroup IxTimeSyncAcc + * + * @fn IxTimeSyncAccStatus ixTimeSyncAccStatsGet(IxTimeSyncAccStats + *timeSyncStats) + * + * @brief Returns the IxTimeSyncAcc Statistics in the client supplied buffer + * + * @param timeSyncStats [out] - TimeSync statistics counter values + * + * This API will return the statistics of the received or transmitted messages. + * + * NOTE: 1) These counters are updated only when the client polls for the time + * stamps or interrupt are enabled. This is because the IxTimeSyncAcc module + * does not either transmit or receive messages and does only run the code + * when explicit requests received by client application. + * + * 2) These statistics reflect the number of valid PTP messages exchanged + * in Master and Slave modes but includes all the messages (including valid + * non-PTP messages) while operating in the Any mode. + * + * @li Reentrant : no + * @li ISR Callable : no + * + * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful + * @li IX_TIMESYNCACC_INVALIDPARAM - NULL parameter passed + * @li IX_TIMESYNCACC_FAILED - Internal error occurred + */ +PUBLIC IxTimeSyncAccStatus +ixTimeSyncAccStatsGet(IxTimeSyncAccStats *timeSyncStats); + +/** + * @ingroup IxTimeSyncAcc + * + * @fn void ixTimeSyncAccStatsReset(void) + * + * @brief Reset Time Sync statistics + * + * This API will reset the statistics counters of the TimeSync access layer. + * + * @li Reentrant : yes + * @li ISR Callable: no + * + * @return @li None + */ +PUBLIC void +ixTimeSyncAccStatsReset(void); + +/** + * @ingroup IxTimeSyncAcc + * + * @fn IxTimeSyncAccStatus ixTimeSyncAccShow(void) + * + * @brief Displays the Time Sync current status + * + * This API will display status on the current configuration of the IEEE + * 1588 hardware assist block, contents of the various time stamp registers, + * outstanding interrupts and/or events. + * + * Note that this is intended for debug only, and in contrast to the other + * functions, it does not clear the any of the status bits associated with + * active timestamps and so is passive in its nature. + * + * @li Reentrant : yes + * @li ISR Callable : no + * + * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful + * @li IX_TIMESYNCACC_FAILED - Internal error occurred + */ +PUBLIC IxTimeSyncAccStatus +ixTimeSyncAccShow(void); + +#endif /* __ixp46X */ +#endif /* IXTIMESYNCACC_H */ + +/** + * @} defgroup IxTimeSyncAcc + */ + -- cgit v1.1