1/*- 2 * SPDX-License-Identifier: ISC 3 * 4 * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting 5 * Copyright (c) 2002-2008 Atheros Communications, Inc. 6 * 7 * Permission to use, copy, modify, and/or distribute this software for any 8 * purpose with or without fee is hereby granted, provided that the above 9 * copyright notice and this permission notice appear in all copies. 10 * 11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 18 * 19 * $FreeBSD: releng/12.0/sys/dev/ath/ath_hal/ar5312/ar5312.h 326695 2017-12-08 15:57:29Z pfg $ 20 */ 21#ifndef _ATH_AR5312_H_ 22#define _ATH_AR5312_H_ 23 24#include "ah_soc.h" 25#include "ar5212/ar5212.h" 26 27#define AR5312_UNIT(_ah) \ 28 (((const struct ar531x_config *)((_ah)->ah_st))->unit) 29#define AR5312_BOARDCONFIG(_ah) \ 30 (((const struct ar531x_config *)((_ah)->ah_st))->board) 31#define AR5312_RADIOCONFIG(_ah) \ 32 (((const struct ar531x_config *)((_ah)->ah_st))->radio) 33 34#define IS_5312_2_X(ah) \ 35 (AH_PRIVATE(ah)->ah_macVersion == AR_SREV_VERSION_VENICE && \ 36 (AH_PRIVATE(ah)->ah_macRev == 2 || AH_PRIVATE(ah)->ah_macRev == 7)) 37#define IS_5315(ah) \ 38 (AH_PRIVATE(ah)->ah_devid == AR5212_AR2315_REV6 || \ 39 AH_PRIVATE(ah)->ah_devid == AR5212_AR2315_REV7 || \ 40 AH_PRIVATE(ah)->ah_devid == AR5212_AR2317_REV1 || \ 41 AH_PRIVATE(ah)->ah_devid == AR5212_AR2317_REV2) 42 43extern HAL_BOOL ar5312IsInterruptPending(struct ath_hal *ah); 44 45/* AR5312 */ 46extern HAL_BOOL ar5312GpioCfgOutput(struct ath_hal *, uint32_t gpio, 47 HAL_GPIO_MUX_TYPE); 48extern HAL_BOOL ar5312GpioCfgInput(struct ath_hal *, uint32_t gpio); 49extern HAL_BOOL ar5312GpioSet(struct ath_hal *, uint32_t gpio, uint32_t val); 50extern uint32_t ar5312GpioGet(struct ath_hal *ah, uint32_t gpio); 51extern void ar5312GpioSetIntr(struct ath_hal *ah, u_int, uint32_t ilevel); 52 53/* AR2315+ */ 54extern HAL_BOOL ar5315GpioCfgOutput(struct ath_hal *, uint32_t gpio, 55 HAL_GPIO_MUX_TYPE); 56extern HAL_BOOL ar5315GpioCfgInput(struct ath_hal *, uint32_t gpio); 57extern HAL_BOOL ar5315GpioSet(struct ath_hal *, uint32_t gpio, uint32_t val); 58extern uint32_t ar5315GpioGet(struct ath_hal *ah, uint32_t gpio); 59extern void ar5315GpioSetIntr(struct ath_hal *ah, u_int, uint32_t ilevel); 60 61extern void ar5312SetLedState(struct ath_hal *ah, HAL_LED_STATE state); 62extern HAL_BOOL ar5312DetectCardPresent(struct ath_hal *ah); 63extern void ar5312SetupClock(struct ath_hal *ah, HAL_OPMODE opmode); 64extern void ar5312RestoreClock(struct ath_hal *ah, HAL_OPMODE opmode); 65extern void ar5312DumpState(struct ath_hal *ah); 66extern HAL_BOOL ar5312Reset(struct ath_hal *ah, HAL_OPMODE opmode, 67 struct ieee80211_channel *chan, 68 HAL_BOOL bChannelChange, 69 HAL_RESET_TYPE resetType, 70 HAL_STATUS *status); 71extern HAL_BOOL ar5312ChipReset(struct ath_hal *ah, 72 struct ieee80211_channel *chan); 73extern HAL_BOOL ar5312SetPowerMode(struct ath_hal *ah, HAL_POWER_MODE mode, 74 int setChip); 75extern HAL_BOOL ar5312PhyDisable(struct ath_hal *ah); 76extern HAL_BOOL ar5312Disable(struct ath_hal *ah); 77extern HAL_BOOL ar5312MacReset(struct ath_hal *ah, unsigned int RCMask); 78extern uint32_t ar5312GetPowerMode(struct ath_hal *ah); 79extern HAL_BOOL ar5312GetPowerStatus(struct ath_hal *ah); 80 81/* BSP functions */ 82extern HAL_BOOL ar5312EepromRead(struct ath_hal *, u_int off, uint16_t *data); 83extern HAL_BOOL ar5312EepromWrite(struct ath_hal *, u_int off, uint16_t data); 84 85#endif /* _ATH_AR3212_H_ */ 86