Path: blob/main/sys/dev/ath/ath_hal/ar5312/ar5312.h
39566 views
/*-1* SPDX-License-Identifier: ISC2*3* Copyright (c) 2002-2009 Sam Leffler, Errno Consulting4* Copyright (c) 2002-2008 Atheros Communications, Inc.5*6* Permission to use, copy, modify, and/or distribute this software for any7* purpose with or without fee is hereby granted, provided that the above8* copyright notice and this permission notice appear in all copies.9*10* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES11* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF12* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR13* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES14* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN15* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF16* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.17*/18#ifndef _ATH_AR5312_H_19#define _ATH_AR5312_H_2021#include "ah_soc.h"22#include "ar5212/ar5212.h"2324#define AR5312_UNIT(_ah) \25(((const struct ar531x_config *)((_ah)->ah_st))->unit)26#define AR5312_BOARDCONFIG(_ah) \27(((const struct ar531x_config *)((_ah)->ah_st))->board)28#define AR5312_RADIOCONFIG(_ah) \29(((const struct ar531x_config *)((_ah)->ah_st))->radio)3031#define IS_5312_2_X(ah) \32(AH_PRIVATE(ah)->ah_macVersion == AR_SREV_VERSION_VENICE && \33(AH_PRIVATE(ah)->ah_macRev == 2 || AH_PRIVATE(ah)->ah_macRev == 7))34#define IS_5315(ah) \35(AH_PRIVATE(ah)->ah_devid == AR5212_AR2315_REV6 || \36AH_PRIVATE(ah)->ah_devid == AR5212_AR2315_REV7 || \37AH_PRIVATE(ah)->ah_devid == AR5212_AR2317_REV1 || \38AH_PRIVATE(ah)->ah_devid == AR5212_AR2317_REV2)3940extern HAL_BOOL ar5312IsInterruptPending(struct ath_hal *ah);4142/* AR5312 */43extern HAL_BOOL ar5312GpioCfgOutput(struct ath_hal *, uint32_t gpio,44HAL_GPIO_MUX_TYPE);45extern HAL_BOOL ar5312GpioCfgInput(struct ath_hal *, uint32_t gpio);46extern HAL_BOOL ar5312GpioSet(struct ath_hal *, uint32_t gpio, uint32_t val);47extern uint32_t ar5312GpioGet(struct ath_hal *ah, uint32_t gpio);48extern void ar5312GpioSetIntr(struct ath_hal *ah, u_int, uint32_t ilevel);4950/* AR2315+ */51extern HAL_BOOL ar5315GpioCfgOutput(struct ath_hal *, uint32_t gpio,52HAL_GPIO_MUX_TYPE);53extern HAL_BOOL ar5315GpioCfgInput(struct ath_hal *, uint32_t gpio);54extern HAL_BOOL ar5315GpioSet(struct ath_hal *, uint32_t gpio, uint32_t val);55extern uint32_t ar5315GpioGet(struct ath_hal *ah, uint32_t gpio);56extern void ar5315GpioSetIntr(struct ath_hal *ah, u_int, uint32_t ilevel);5758extern void ar5312SetLedState(struct ath_hal *ah, HAL_LED_STATE state);59extern HAL_BOOL ar5312DetectCardPresent(struct ath_hal *ah);60extern void ar5312SetupClock(struct ath_hal *ah, HAL_OPMODE opmode);61extern void ar5312RestoreClock(struct ath_hal *ah, HAL_OPMODE opmode);62extern void ar5312DumpState(struct ath_hal *ah);63extern HAL_BOOL ar5312Reset(struct ath_hal *ah, HAL_OPMODE opmode,64struct ieee80211_channel *chan,65HAL_BOOL bChannelChange,66HAL_RESET_TYPE resetType,67HAL_STATUS *status);68extern HAL_BOOL ar5312ChipReset(struct ath_hal *ah,69struct ieee80211_channel *chan);70extern HAL_BOOL ar5312SetPowerMode(struct ath_hal *ah, HAL_POWER_MODE mode,71int setChip);72extern HAL_BOOL ar5312PhyDisable(struct ath_hal *ah);73extern HAL_BOOL ar5312Disable(struct ath_hal *ah);74extern HAL_BOOL ar5312MacReset(struct ath_hal *ah, unsigned int RCMask);75extern uint32_t ar5312GetPowerMode(struct ath_hal *ah);76extern HAL_BOOL ar5312GetPowerStatus(struct ath_hal *ah);7778/* BSP functions */79extern HAL_BOOL ar5312EepromRead(struct ath_hal *, u_int off, uint16_t *data);80extern HAL_BOOL ar5312EepromWrite(struct ath_hal *, u_int off, uint16_t data);8182#endif /* _ATH_AR3212_H_ */838485