1*6e778a7eSPedro F. Giffuni /*- 2*6e778a7eSPedro F. Giffuni * SPDX-License-Identifier: ISC 3*6e778a7eSPedro F. Giffuni * 459efa8b5SSam Leffler * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting 514779705SSam Leffler * Copyright (c) 2002-2008 Atheros Communications, Inc. 614779705SSam Leffler * 714779705SSam Leffler * Permission to use, copy, modify, and/or distribute this software for any 814779705SSam Leffler * purpose with or without fee is hereby granted, provided that the above 914779705SSam Leffler * copyright notice and this permission notice appear in all copies. 1014779705SSam Leffler * 1114779705SSam Leffler * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 1214779705SSam Leffler * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 1314779705SSam Leffler * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 1414779705SSam Leffler * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 1514779705SSam Leffler * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 1614779705SSam Leffler * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 1714779705SSam Leffler * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 1814779705SSam Leffler */ 1914779705SSam Leffler #ifndef _ATH_AR5312_H_ 2014779705SSam Leffler #define _ATH_AR5312_H_ 2114779705SSam Leffler 2214779705SSam Leffler #include "ah_soc.h" 2314779705SSam Leffler #include "ar5212/ar5212.h" 2414779705SSam Leffler 2514779705SSam Leffler #define AR5312_UNIT(_ah) \ 2614779705SSam Leffler (((const struct ar531x_config *)((_ah)->ah_st))->unit) 2714779705SSam Leffler #define AR5312_BOARDCONFIG(_ah) \ 2814779705SSam Leffler (((const struct ar531x_config *)((_ah)->ah_st))->board) 2914779705SSam Leffler #define AR5312_RADIOCONFIG(_ah) \ 3014779705SSam Leffler (((const struct ar531x_config *)((_ah)->ah_st))->radio) 3114779705SSam Leffler 3214779705SSam Leffler #define IS_5312_2_X(ah) \ 3314779705SSam Leffler (AH_PRIVATE(ah)->ah_macVersion == AR_SREV_VERSION_VENICE && \ 3414779705SSam Leffler (AH_PRIVATE(ah)->ah_macRev == 2 || AH_PRIVATE(ah)->ah_macRev == 7)) 3514779705SSam Leffler #define IS_5315(ah) \ 3614779705SSam Leffler (AH_PRIVATE(ah)->ah_devid == AR5212_AR2315_REV6 || \ 3714779705SSam Leffler AH_PRIVATE(ah)->ah_devid == AR5212_AR2315_REV7 || \ 3814779705SSam Leffler AH_PRIVATE(ah)->ah_devid == AR5212_AR2317_REV1 || \ 3914779705SSam Leffler AH_PRIVATE(ah)->ah_devid == AR5212_AR2317_REV2) 4014779705SSam Leffler 4114779705SSam Leffler extern HAL_BOOL ar5312IsInterruptPending(struct ath_hal *ah); 4214779705SSam Leffler 4314779705SSam Leffler /* AR5312 */ 44869ff02eSSam Leffler extern HAL_BOOL ar5312GpioCfgOutput(struct ath_hal *, uint32_t gpio, 45869ff02eSSam Leffler HAL_GPIO_MUX_TYPE); 4614779705SSam Leffler extern HAL_BOOL ar5312GpioCfgInput(struct ath_hal *, uint32_t gpio); 4714779705SSam Leffler extern HAL_BOOL ar5312GpioSet(struct ath_hal *, uint32_t gpio, uint32_t val); 4814779705SSam Leffler extern uint32_t ar5312GpioGet(struct ath_hal *ah, uint32_t gpio); 4914779705SSam Leffler extern void ar5312GpioSetIntr(struct ath_hal *ah, u_int, uint32_t ilevel); 5014779705SSam Leffler 5114779705SSam Leffler /* AR2315+ */ 52869ff02eSSam Leffler extern HAL_BOOL ar5315GpioCfgOutput(struct ath_hal *, uint32_t gpio, 53869ff02eSSam Leffler HAL_GPIO_MUX_TYPE); 5414779705SSam Leffler extern HAL_BOOL ar5315GpioCfgInput(struct ath_hal *, uint32_t gpio); 5514779705SSam Leffler extern HAL_BOOL ar5315GpioSet(struct ath_hal *, uint32_t gpio, uint32_t val); 5614779705SSam Leffler extern uint32_t ar5315GpioGet(struct ath_hal *ah, uint32_t gpio); 5714779705SSam Leffler extern void ar5315GpioSetIntr(struct ath_hal *ah, u_int, uint32_t ilevel); 5814779705SSam Leffler 5914779705SSam Leffler extern void ar5312SetLedState(struct ath_hal *ah, HAL_LED_STATE state); 6014779705SSam Leffler extern HAL_BOOL ar5312DetectCardPresent(struct ath_hal *ah); 6114779705SSam Leffler extern void ar5312SetupClock(struct ath_hal *ah, HAL_OPMODE opmode); 6214779705SSam Leffler extern void ar5312RestoreClock(struct ath_hal *ah, HAL_OPMODE opmode); 6314779705SSam Leffler extern void ar5312DumpState(struct ath_hal *ah); 6414779705SSam Leffler extern HAL_BOOL ar5312Reset(struct ath_hal *ah, HAL_OPMODE opmode, 6559efa8b5SSam Leffler struct ieee80211_channel *chan, 66f50e4ebfSAdrian Chadd HAL_BOOL bChannelChange, 67f50e4ebfSAdrian Chadd HAL_RESET_TYPE resetType, 68f50e4ebfSAdrian Chadd HAL_STATUS *status); 6959efa8b5SSam Leffler extern HAL_BOOL ar5312ChipReset(struct ath_hal *ah, 7059efa8b5SSam Leffler struct ieee80211_channel *chan); 7114779705SSam Leffler extern HAL_BOOL ar5312SetPowerMode(struct ath_hal *ah, HAL_POWER_MODE mode, 7214779705SSam Leffler int setChip); 7314779705SSam Leffler extern HAL_BOOL ar5312PhyDisable(struct ath_hal *ah); 7414779705SSam Leffler extern HAL_BOOL ar5312Disable(struct ath_hal *ah); 7514779705SSam Leffler extern HAL_BOOL ar5312MacReset(struct ath_hal *ah, unsigned int RCMask); 7614779705SSam Leffler extern uint32_t ar5312GetPowerMode(struct ath_hal *ah); 7714779705SSam Leffler extern HAL_BOOL ar5312GetPowerStatus(struct ath_hal *ah); 7814779705SSam Leffler 7914779705SSam Leffler /* BSP functions */ 8014779705SSam Leffler extern HAL_BOOL ar5312EepromRead(struct ath_hal *, u_int off, uint16_t *data); 8114779705SSam Leffler extern HAL_BOOL ar5312EepromWrite(struct ath_hal *, u_int off, uint16_t data); 8214779705SSam Leffler 8314779705SSam Leffler #endif /* _ATH_AR3212_H_ */ 84