Path: blob/main/sys/contrib/dev/broadcom/brcm80211/include/chipcommon.h
178665 views
// SPDX-License-Identifier: ISC1/*2* Copyright (c) 2010 Broadcom Corporation3*/45#ifndef _SBCHIPC_H6#define _SBCHIPC_H78#include "defs.h" /* for PAD macro */910#define CHIPCREGOFFS(field) offsetof(struct chipcregs, field)1112struct chipcregs {13u32 chipid; /* 0x0 */14u32 capabilities;15u32 corecontrol; /* corerev >= 1 */16u32 bist;1718/* OTP */19u32 otpstatus; /* 0x10, corerev >= 10 */20u32 otpcontrol;21u32 otpprog;22u32 otplayout; /* corerev >= 23 */2324/* Interrupt control */25u32 intstatus; /* 0x20 */26u32 intmask;2728/* Chip specific regs */29u32 chipcontrol; /* 0x28, rev >= 11 */30u32 chipstatus; /* 0x2c, rev >= 11 */3132/* Jtag Master */33u32 jtagcmd; /* 0x30, rev >= 10 */34u32 jtagir;35u32 jtagdr;36u32 jtagctrl;3738/* serial flash interface registers */39u32 flashcontrol; /* 0x40 */40u32 flashaddress;41u32 flashdata;42u32 PAD[1];4344/* Silicon backplane configuration broadcast control */45u32 broadcastaddress; /* 0x50 */46u32 broadcastdata;4748/* gpio - cleared only by power-on-reset */49u32 gpiopullup; /* 0x58, corerev >= 20 */50u32 gpiopulldown; /* 0x5c, corerev >= 20 */51u32 gpioin; /* 0x60 */52u32 gpioout; /* 0x64 */53u32 gpioouten; /* 0x68 */54u32 gpiocontrol; /* 0x6C */55u32 gpiointpolarity; /* 0x70 */56u32 gpiointmask; /* 0x74 */5758/* GPIO events corerev >= 11 */59u32 gpioevent;60u32 gpioeventintmask;6162/* Watchdog timer */63u32 watchdog; /* 0x80 */6465/* GPIO events corerev >= 11 */66u32 gpioeventintpolarity;6768/* GPIO based LED powersave registers corerev >= 16 */69u32 gpiotimerval; /* 0x88 */70u32 gpiotimeroutmask;7172/* clock control */73u32 clockcontrol_n; /* 0x90 */74u32 clockcontrol_sb; /* aka m0 */75u32 clockcontrol_pci; /* aka m1 */76u32 clockcontrol_m2; /* mii/uart/mipsref */77u32 clockcontrol_m3; /* cpu */78u32 clkdiv; /* corerev >= 3 */79u32 gpiodebugsel; /* corerev >= 28 */80u32 capabilities_ext; /* 0xac */8182/* pll delay registers (corerev >= 4) */83u32 pll_on_delay; /* 0xb0 */84u32 fref_sel_delay;85u32 slow_clk_ctl; /* 5 < corerev < 10 */86u32 PAD;8788/* Instaclock registers (corerev >= 10) */89u32 system_clk_ctl; /* 0xc0 */90u32 clkstatestretch;91u32 PAD[2];9293/* Indirect backplane access (corerev >= 22) */94u32 bp_addrlow; /* 0xd0 */95u32 bp_addrhigh;96u32 bp_data;97u32 PAD;98u32 bp_indaccess;99u32 PAD[3];100101/* More clock dividers (corerev >= 32) */102u32 clkdiv2;103u32 PAD[2];104105/* In AI chips, pointer to erom */106u32 eromptr; /* 0xfc */107108/* ExtBus control registers (corerev >= 3) */109u32 pcmcia_config; /* 0x100 */110u32 pcmcia_memwait;111u32 pcmcia_attrwait;112u32 pcmcia_iowait;113u32 ide_config;114u32 ide_memwait;115u32 ide_attrwait;116u32 ide_iowait;117u32 prog_config;118u32 prog_waitcount;119u32 flash_config;120u32 flash_waitcount;121u32 SECI_config; /* 0x130 SECI configuration */122u32 PAD[3];123124/* Enhanced Coexistence Interface (ECI) registers (corerev >= 21) */125u32 eci_output; /* 0x140 */126u32 eci_control;127u32 eci_inputlo;128u32 eci_inputmi;129u32 eci_inputhi;130u32 eci_inputintpolaritylo;131u32 eci_inputintpolaritymi;132u32 eci_inputintpolarityhi;133u32 eci_intmasklo;134u32 eci_intmaskmi;135u32 eci_intmaskhi;136u32 eci_eventlo;137u32 eci_eventmi;138u32 eci_eventhi;139u32 eci_eventmasklo;140u32 eci_eventmaskmi;141u32 eci_eventmaskhi;142u32 PAD[3];143144/* SROM interface (corerev >= 32) */145u32 sromcontrol; /* 0x190 */146u32 sromaddress;147u32 sromdata;148u32 PAD[17];149150/* Clock control and hardware workarounds (corerev >= 20) */151u32 clk_ctl_st; /* 0x1e0 */152u32 hw_war;153u32 PAD[70];154155/* UARTs */156u8 uart0data; /* 0x300 */157u8 uart0imr;158u8 uart0fcr;159u8 uart0lcr;160u8 uart0mcr;161u8 uart0lsr;162u8 uart0msr;163u8 uart0scratch;164u8 PAD[248]; /* corerev >= 1 */165166u8 uart1data; /* 0x400 */167u8 uart1imr;168u8 uart1fcr;169u8 uart1lcr;170u8 uart1mcr;171u8 uart1lsr;172u8 uart1msr;173u8 uart1scratch;174u32 PAD[62];175176/* save/restore, corerev >= 48 */177u32 sr_capability; /* 0x500 */178u32 sr_control0; /* 0x504 */179u32 sr_control1; /* 0x508 */180u32 gpio_control; /* 0x50C */181u32 PAD[60];182183/* PMU registers (corerev >= 20) */184u32 pmucontrol; /* 0x600 */185u32 pmucapabilities;186u32 pmustatus;187u32 res_state;188u32 res_pending;189u32 pmutimer;190u32 min_res_mask;191u32 max_res_mask;192u32 res_table_sel;193u32 res_dep_mask;194u32 res_updn_timer;195u32 res_timer;196u32 clkstretch;197u32 pmuwatchdog;198u32 gpiosel; /* 0x638, rev >= 1 */199u32 gpioenable; /* 0x63c, rev >= 1 */200u32 res_req_timer_sel;201u32 res_req_timer;202u32 res_req_mask;203u32 pmucapabilities_ext; /* 0x64c, pmurev >=15 */204u32 chipcontrol_addr; /* 0x650 */205u32 chipcontrol_data; /* 0x654 */206u32 regcontrol_addr;207u32 regcontrol_data;208u32 pllcontrol_addr;209u32 pllcontrol_data;210u32 pmustrapopt; /* 0x668, corerev >= 28 */211u32 pmu_xtalfreq; /* 0x66C, pmurev >= 10 */212u32 retention_ctl; /* 0x670, pmurev >= 15 */213u32 PAD[3];214u32 retention_grpidx; /* 0x680 */215u32 retention_grpctl; /* 0x684 */216u32 PAD[94];217u16 sromotp[768];218};219220/* chipid */221#define CID_ID_MASK 0x0000ffff /* Chip Id mask */222#define CID_REV_MASK 0x000f0000 /* Chip Revision mask */223#define CID_REV_SHIFT 16 /* Chip Revision shift */224#define CID_PKG_MASK 0x00f00000 /* Package Option mask */225#define CID_PKG_SHIFT 20 /* Package Option shift */226#define CID_CC_MASK 0x0f000000 /* CoreCount (corerev >= 4) */227#define CID_CC_SHIFT 24228#define CID_TYPE_MASK 0xf0000000 /* Chip Type */229#define CID_TYPE_SHIFT 28230231/* capabilities */232#define CC_CAP_UARTS_MASK 0x00000003 /* Number of UARTs */233#define CC_CAP_MIPSEB 0x00000004 /* MIPS is in big-endian mode */234#define CC_CAP_UCLKSEL 0x00000018 /* UARTs clock select */235/* UARTs are driven by internal divided clock */236#define CC_CAP_UINTCLK 0x00000008237#define CC_CAP_UARTGPIO 0x00000020 /* UARTs own GPIOs 15:12 */238#define CC_CAP_EXTBUS_MASK 0x000000c0 /* External bus mask */239#define CC_CAP_EXTBUS_NONE 0x00000000 /* No ExtBus present */240#define CC_CAP_EXTBUS_FULL 0x00000040 /* ExtBus: PCMCIA, IDE & Prog */241#define CC_CAP_EXTBUS_PROG 0x00000080 /* ExtBus: ProgIf only */242#define CC_CAP_FLASH_MASK 0x00000700 /* Type of flash */243#define CC_CAP_PLL_MASK 0x00038000 /* Type of PLL */244#define CC_CAP_PWR_CTL 0x00040000 /* Power control */245#define CC_CAP_OTPSIZE 0x00380000 /* OTP Size (0 = none) */246#define CC_CAP_OTPSIZE_SHIFT 19 /* OTP Size shift */247#define CC_CAP_OTPSIZE_BASE 5 /* OTP Size base */248#define CC_CAP_JTAGP 0x00400000 /* JTAG Master Present */249#define CC_CAP_ROM 0x00800000 /* Internal boot rom active */250#define CC_CAP_BKPLN64 0x08000000 /* 64-bit backplane */251#define CC_CAP_PMU 0x10000000 /* PMU Present, rev >= 20 */252#define CC_CAP_SROM 0x40000000 /* Srom Present, rev >= 32 */253/* Nand flash present, rev >= 35 */254#define CC_CAP_NFLASH 0x80000000255256#define CC_CAP2_SECI 0x00000001 /* SECI Present, rev >= 36 */257/* GSIO (spi/i2c) present, rev >= 37 */258#define CC_CAP2_GSIO 0x00000002259260/* sr_control0, rev >= 48 */261#define CC_SR_CTL0_ENABLE_MASK BIT(0)262#define CC_SR_CTL0_ENABLE_SHIFT 0263#define CC_SR_CTL0_EN_SR_ENG_CLK_SHIFT 1 /* sr_clk to sr_memory enable */264#define CC_SR_CTL0_RSRC_TRIGGER_SHIFT 2 /* Rising edge resource trigger 0 to265* sr_engine266*/267#define CC_SR_CTL0_MIN_DIV_SHIFT 6 /* Min division value for fast clk268* in sr_engine269*/270#define CC_SR_CTL0_EN_SBC_STBY_SHIFT 16271#define CC_SR_CTL0_EN_SR_ALP_CLK_MASK_SHIFT 18272#define CC_SR_CTL0_EN_SR_HT_CLK_SHIFT 19273#define CC_SR_CTL0_ALLOW_PIC_SHIFT 20 /* Allow pic to separate power274* domains275*/276#define CC_SR_CTL0_MAX_SR_LQ_CLK_CNT_SHIFT 25277#define CC_SR_CTL0_EN_MEM_DISABLE_FOR_SLEEP 30278279/* pmucapabilities */280#define PCAP_REV_MASK 0x000000ff281#define PCAP_RC_MASK 0x00001f00282#define PCAP_RC_SHIFT 8283#define PCAP_TC_MASK 0x0001e000284#define PCAP_TC_SHIFT 13285#define PCAP_PC_MASK 0x001e0000286#define PCAP_PC_SHIFT 17287#define PCAP_VC_MASK 0x01e00000288#define PCAP_VC_SHIFT 21289#define PCAP_CC_MASK 0x1e000000290#define PCAP_CC_SHIFT 25291#define PCAP5_PC_MASK 0x003e0000 /* PMU corerev >= 5 */292#define PCAP5_PC_SHIFT 17293#define PCAP5_VC_MASK 0x07c00000294#define PCAP5_VC_SHIFT 22295#define PCAP5_CC_MASK 0xf8000000296#define PCAP5_CC_SHIFT 27297/* pmucapabilites_ext PMU rev >= 15 */298#define PCAPEXT_SR_SUPPORTED_MASK (1 << 1)299/* retention_ctl PMU rev >= 15 */300#define PMU_RCTL_MACPHY_DISABLE_MASK (1 << 26)301#define PMU_RCTL_LOGIC_DISABLE_MASK (1 << 27)302303304/*305* Maximum delay for the PMU state transition in us.306* This is an upper bound intended for spinwaits etc.307*/308#define PMU_MAX_TRANSITION_DLY 15000309310#endif /* _SBCHIPC_H */311312313