1572ff6f6SMatthew Dillon /* 2572ff6f6SMatthew Dillon * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting 3572ff6f6SMatthew Dillon * Copyright (c) 2002-2008 Atheros Communications, Inc. 4572ff6f6SMatthew Dillon * 5572ff6f6SMatthew Dillon * Permission to use, copy, modify, and/or distribute this software for any 6572ff6f6SMatthew Dillon * purpose with or without fee is hereby granted, provided that the above 7572ff6f6SMatthew Dillon * copyright notice and this permission notice appear in all copies. 8572ff6f6SMatthew Dillon * 9572ff6f6SMatthew Dillon * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10572ff6f6SMatthew Dillon * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11572ff6f6SMatthew Dillon * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12572ff6f6SMatthew Dillon * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13572ff6f6SMatthew Dillon * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14572ff6f6SMatthew Dillon * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15572ff6f6SMatthew Dillon * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16572ff6f6SMatthew Dillon * 17572ff6f6SMatthew Dillon * $FreeBSD$ 18572ff6f6SMatthew Dillon */ 19572ff6f6SMatthew Dillon #ifndef _ATH_AR5312_H_ 20572ff6f6SMatthew Dillon #define _ATH_AR5312_H_ 21572ff6f6SMatthew Dillon 22572ff6f6SMatthew Dillon #include "ah_soc.h" 23572ff6f6SMatthew Dillon #include "ar5212/ar5212.h" 24572ff6f6SMatthew Dillon 25572ff6f6SMatthew Dillon #define AR5312_UNIT(_ah) \ 26572ff6f6SMatthew Dillon (((const struct ar531x_config *)((_ah)->ah_st))->unit) 27572ff6f6SMatthew Dillon #define AR5312_BOARDCONFIG(_ah) \ 28572ff6f6SMatthew Dillon (((const struct ar531x_config *)((_ah)->ah_st))->board) 29572ff6f6SMatthew Dillon #define AR5312_RADIOCONFIG(_ah) \ 30572ff6f6SMatthew Dillon (((const struct ar531x_config *)((_ah)->ah_st))->radio) 31572ff6f6SMatthew Dillon 32572ff6f6SMatthew Dillon #define IS_5312_2_X(ah) \ 33572ff6f6SMatthew Dillon (AH_PRIVATE(ah)->ah_macVersion == AR_SREV_VERSION_VENICE && \ 34572ff6f6SMatthew Dillon (AH_PRIVATE(ah)->ah_macRev == 2 || AH_PRIVATE(ah)->ah_macRev == 7)) 35572ff6f6SMatthew Dillon #define IS_5315(ah) \ 36572ff6f6SMatthew Dillon (AH_PRIVATE(ah)->ah_devid == AR5212_AR2315_REV6 || \ 37572ff6f6SMatthew Dillon AH_PRIVATE(ah)->ah_devid == AR5212_AR2315_REV7 || \ 38572ff6f6SMatthew Dillon AH_PRIVATE(ah)->ah_devid == AR5212_AR2317_REV1 || \ 39572ff6f6SMatthew Dillon AH_PRIVATE(ah)->ah_devid == AR5212_AR2317_REV2) 40572ff6f6SMatthew Dillon 41572ff6f6SMatthew Dillon extern HAL_BOOL ar5312IsInterruptPending(struct ath_hal *ah); 42572ff6f6SMatthew Dillon 43572ff6f6SMatthew Dillon /* AR5312 */ 44572ff6f6SMatthew Dillon extern HAL_BOOL ar5312GpioCfgOutput(struct ath_hal *, uint32_t gpio, 45572ff6f6SMatthew Dillon HAL_GPIO_MUX_TYPE); 46572ff6f6SMatthew Dillon extern HAL_BOOL ar5312GpioCfgInput(struct ath_hal *, uint32_t gpio); 47572ff6f6SMatthew Dillon extern HAL_BOOL ar5312GpioSet(struct ath_hal *, uint32_t gpio, uint32_t val); 48572ff6f6SMatthew Dillon extern uint32_t ar5312GpioGet(struct ath_hal *ah, uint32_t gpio); 49572ff6f6SMatthew Dillon extern void ar5312GpioSetIntr(struct ath_hal *ah, u_int, uint32_t ilevel); 50572ff6f6SMatthew Dillon 51572ff6f6SMatthew Dillon /* AR2315+ */ 52572ff6f6SMatthew Dillon extern HAL_BOOL ar5315GpioCfgOutput(struct ath_hal *, uint32_t gpio, 53572ff6f6SMatthew Dillon HAL_GPIO_MUX_TYPE); 54572ff6f6SMatthew Dillon extern HAL_BOOL ar5315GpioCfgInput(struct ath_hal *, uint32_t gpio); 55572ff6f6SMatthew Dillon extern HAL_BOOL ar5315GpioSet(struct ath_hal *, uint32_t gpio, uint32_t val); 56572ff6f6SMatthew Dillon extern uint32_t ar5315GpioGet(struct ath_hal *ah, uint32_t gpio); 57572ff6f6SMatthew Dillon extern void ar5315GpioSetIntr(struct ath_hal *ah, u_int, uint32_t ilevel); 58572ff6f6SMatthew Dillon 59572ff6f6SMatthew Dillon extern void ar5312SetLedState(struct ath_hal *ah, HAL_LED_STATE state); 60572ff6f6SMatthew Dillon extern HAL_BOOL ar5312DetectCardPresent(struct ath_hal *ah); 61572ff6f6SMatthew Dillon extern void ar5312SetupClock(struct ath_hal *ah, HAL_OPMODE opmode); 62572ff6f6SMatthew Dillon extern void ar5312RestoreClock(struct ath_hal *ah, HAL_OPMODE opmode); 63572ff6f6SMatthew Dillon extern void ar5312DumpState(struct ath_hal *ah); 64572ff6f6SMatthew Dillon extern HAL_BOOL ar5312Reset(struct ath_hal *ah, HAL_OPMODE opmode, 65572ff6f6SMatthew Dillon struct ieee80211_channel *chan, 66*b14ca477SMatthew Dillon HAL_BOOL bChannelChange, 67*b14ca477SMatthew Dillon HAL_RESET_TYPE resetType, 68*b14ca477SMatthew Dillon HAL_STATUS *status); 69572ff6f6SMatthew Dillon extern HAL_BOOL ar5312ChipReset(struct ath_hal *ah, 70572ff6f6SMatthew Dillon struct ieee80211_channel *chan); 71572ff6f6SMatthew Dillon extern HAL_BOOL ar5312SetPowerMode(struct ath_hal *ah, HAL_POWER_MODE mode, 72572ff6f6SMatthew Dillon int setChip); 73572ff6f6SMatthew Dillon extern HAL_BOOL ar5312PhyDisable(struct ath_hal *ah); 74572ff6f6SMatthew Dillon extern HAL_BOOL ar5312Disable(struct ath_hal *ah); 75572ff6f6SMatthew Dillon extern HAL_BOOL ar5312MacReset(struct ath_hal *ah, unsigned int RCMask); 76572ff6f6SMatthew Dillon extern uint32_t ar5312GetPowerMode(struct ath_hal *ah); 77572ff6f6SMatthew Dillon extern HAL_BOOL ar5312GetPowerStatus(struct ath_hal *ah); 78572ff6f6SMatthew Dillon 79572ff6f6SMatthew Dillon /* BSP functions */ 80572ff6f6SMatthew Dillon extern HAL_BOOL ar5312EepromRead(struct ath_hal *, u_int off, uint16_t *data); 81572ff6f6SMatthew Dillon extern HAL_BOOL ar5312EepromWrite(struct ath_hal *, u_int off, uint16_t data); 82572ff6f6SMatthew Dillon 83572ff6f6SMatthew Dillon #endif /* _ATH_AR3212_H_ */ 84