Path: blob/main/sys/contrib/dev/broadcom/brcm80211/brcmfmac/chip.h
178665 views
// SPDX-License-Identifier: ISC1/*2* Copyright (c) 2014 Broadcom Corporation3*/4#ifndef BRCMF_CHIP_H5#define BRCMF_CHIP_H67#include <linux/types.h>89#define CORE_CC_REG(base, field) \10(base + offsetof(struct chipcregs, field))1112/**13* struct brcmf_chip - chip level information.14*15* @chip: chip identifier.16* @chiprev: chip revision.17* @enum_base: base address of core enumeration space.18* @cc_caps: chipcommon core capabilities.19* @cc_caps_ext: chipcommon core extended capabilities.20* @pmucaps: PMU capabilities.21* @pmurev: PMU revision.22* @rambase: RAM base address (only applicable for ARM CR4 chips).23* @ramsize: amount of RAM on chip including retention.24* @srsize: amount of retention RAM on chip.25* @name: string representation of the chip identifier.26*/27struct brcmf_chip {28u32 chip;29u32 chiprev;30u32 enum_base;31u32 cc_caps;32u32 cc_caps_ext;33u32 pmucaps;34u32 pmurev;35u32 rambase;36u32 ramsize;37u32 srsize;38char name[12];39};4041/**42* struct brcmf_core - core related information.43*44* @id: core identifier.45* @rev: core revision.46* @base: base address of core register space.47*/48struct brcmf_core {49u16 id;50u16 rev;51u32 base;52};5354/**55* struct brcmf_buscore_ops - buscore specific callbacks.56*57* @read32: read 32-bit value over bus.58* @write32: write 32-bit value over bus.59* @prepare: prepare bus for core configuration.60* @setup: bus-specific core setup.61* @active: chip becomes active.62* The callback should use the provided @rstvec when non-zero.63*/64struct brcmf_buscore_ops {65u32 (*read32)(void *ctx, u32 addr);66void (*write32)(void *ctx, u32 addr, u32 value);67int (*prepare)(void *ctx);68int (*reset)(void *ctx, struct brcmf_chip *chip);69int (*setup)(void *ctx, struct brcmf_chip *chip);70void (*activate)(void *ctx, struct brcmf_chip *chip, u32 rstvec);71};7273int brcmf_chip_get_raminfo(struct brcmf_chip *pub);74struct brcmf_chip *brcmf_chip_attach(void *ctx, u16 devid,75const struct brcmf_buscore_ops *ops);76void brcmf_chip_detach(struct brcmf_chip *chip);77struct brcmf_core *brcmf_chip_get_core(struct brcmf_chip *chip, u16 coreid);78struct brcmf_core *brcmf_chip_get_d11core(struct brcmf_chip *pub, u8 unit);79struct brcmf_core *brcmf_chip_get_chipcommon(struct brcmf_chip *chip);80struct brcmf_core *brcmf_chip_get_pmu(struct brcmf_chip *pub);81bool brcmf_chip_iscoreup(struct brcmf_core *core);82void brcmf_chip_coredisable(struct brcmf_core *core, u32 prereset, u32 reset);83void brcmf_chip_resetcore(struct brcmf_core *core, u32 prereset, u32 reset,84u32 postreset);85void brcmf_chip_set_passive(struct brcmf_chip *ci);86bool brcmf_chip_set_active(struct brcmf_chip *ci, u32 rstvec);87bool brcmf_chip_sr_capable(struct brcmf_chip *pub);88char *brcmf_chip_name(u32 chipid, u32 chiprev, char *buf, uint len);89u32 brcmf_chip_enum_base(u16 devid);9091#endif /* BRCMF_AXIDMP_H */929394