/* * Copyright (c) 2011 Broadcom Corporation * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef _BRCM_AIUTILS_H_ #define _BRCM_AIUTILS_H_ #include <linux/bcma/bcma.h> #include "types.h" /* * SOC Interconnect Address Map. * All regions may not exist on all chips. */ /* each core gets 4Kbytes for registers */ #define SI_CORE_SIZE … /* * Max cores (this is arbitrary, for software * convenience and could be changed if we * make any larger chips */ #define SI_MAXCORES … /* Client Mode sb2pcitranslation2 size in bytes */ #define SI_PCI_DMA_SZ … /* PCIE Client Mode sb2pcitranslation2 (2 ZettaBytes), high 32 bits */ #define SI_PCIE_DMA_H32 … /* chipcommon being the first core: */ #define SI_CC_IDX … /* SOC Interconnect types (aka chip types) */ #define SOCI_AI … /* A register that is common to all cores to * communicate w/PMU regarding clock control. */ #define SI_CLK_CTL_ST … /* clk_ctl_st register */ #define CCS_FORCEALP … #define CCS_FORCEHT … #define CCS_FORCEILP … #define CCS_ALPAREQ … #define CCS_HTAREQ … #define CCS_FORCEHWREQOFF … #define CCS_ERSRC_REQ_MASK … #define CCS_ERSRC_REQ_SHIFT … #define CCS_ALPAVAIL … #define CCS_HTAVAIL … #define CCS_BP_ON_APL … #define CCS_BP_ON_HT … #define CCS_ERSRC_STS_MASK … #define CCS_ERSRC_STS_SHIFT … /* HT avail in chipc and pcmcia on 4328a0 */ #define CCS0_HTAVAIL … /* ALP avail in chipc and pcmcia on 4328a0 */ #define CCS0_ALPAVAIL … /* Not really related to SOC Interconnect, but a couple of software * conventions for the use the flash space: */ /* Minumum amount of flash we support */ #define FLASH_MIN … #define CC_SROM_OTP … /* gpiotimerval */ #define GPIO_ONTIME_SHIFT … /* Fields in clkdiv */ #define CLKD_OTP … #define CLKD_OTP_SHIFT … /* dynamic clock control defines */ #define LPOMINFREQ … #define LPOMAXFREQ … #define XTALMINFREQ … #define XTALMAXFREQ … #define PCIMINFREQ … #define PCIMAXFREQ … #define ILP_DIV_5MHZ … #define ILP_DIV_1MHZ … /* clkctl xtal what flags */ #define XTAL … #define PLL … /* GPIO usage priorities */ #define GPIO_DRV_PRIORITY … #define GPIO_APP_PRIORITY … #define GPIO_HI_PRIORITY … /* GPIO pull up/down */ #define GPIO_PULLUP … #define GPIO_PULLDN … /* GPIO event regtype */ #define GPIO_REGEVT … #define GPIO_REGEVT_INTMSK … #define GPIO_REGEVT_INTPOL … /* device path */ #define SI_DEVPATH_BUFSZ … /* SI routine enumeration: to be used by update function with multiple hooks */ #define SI_DOATTACH … #define SI_PCIDOWN … #define SI_PCIUP … /* * Data structure to export all chip specific common variables * public (read-only) portion of aiutils handle returned by si_attach() */ struct si_pub { … }; struct pci_dev; /* misc si info needed by some of the routines */ struct si_info { … }; /* * Many of the routines below take an 'sih' handle as their first arg. * Allocate this by calling si_attach(). Free it by calling si_detach(). * At any one time, the sih is logically focused on one particular si core * (the "current core"). * Use si_setcore() or si_setcoreidx() to change the association to another core */ /* AMBA Interconnect exported externs */ u32 ai_core_cflags(struct bcma_device *core, u32 mask, u32 val); /* === exported functions === */ struct si_pub *ai_attach(struct bcma_bus *pbus); void ai_detach(struct si_pub *sih); uint ai_cc_reg(struct si_pub *sih, uint regoff, u32 mask, u32 val); void ai_clkctl_init(struct si_pub *sih); u16 ai_clkctl_fast_pwrup_delay(struct si_pub *sih); bool ai_clkctl_cc(struct si_pub *sih, enum bcma_clkmode mode); bool ai_deviceremoved(struct si_pub *sih); /* Enable Ex-PA for 4313 */ void ai_epa_4313war(struct si_pub *sih); static inline u32 ai_get_cccaps(struct si_pub *sih) { … } static inline int ai_get_pmurev(struct si_pub *sih) { … } static inline u32 ai_get_pmucaps(struct si_pub *sih) { … } static inline uint ai_get_boardtype(struct si_pub *sih) { … } static inline uint ai_get_boardvendor(struct si_pub *sih) { … } static inline uint ai_get_chip_id(struct si_pub *sih) { … } static inline uint ai_get_chiprev(struct si_pub *sih) { … } static inline uint ai_get_chippkg(struct si_pub *sih) { … } #endif /* _BRCM_AIUTILS_H_ */