b43legacy: move under broadcom vendor directory
[linux-2.6-block.git] / drivers / net / wireless / brcm80211 / brcmfmac / chip.h
CommitLineData
a83369b6 1/*
cb7cf7be 2 * Copyright (c) 2014 Broadcom Corporation
a83369b6
FL
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
cb7cf7be
AS
16#ifndef BRCMF_CHIP_H
17#define BRCMF_CHIP_H
a83369b6 18
cb7cf7be 19#include <linux/types.h>
a83369b6 20
a83369b6
FL
21#define CORE_CC_REG(base, field) \
22 (base + offsetof(struct chipcregs, field))
99ba15cd 23
cb7cf7be
AS
24/**
25 * struct brcmf_chip - chip level information.
26 *
27 * @chip: chip identifier.
28 * @chiprev: chip revision.
29 * @cc_caps: chipcommon core capabilities.
30 * @pmucaps: PMU capabilities.
31 * @pmurev: PMU revision.
32 * @rambase: RAM base address (only applicable for ARM CR4 chips).
0da32ba4
AS
33 * @ramsize: amount of RAM on chip including retention.
34 * @srsize: amount of retention RAM on chip.
cb7cf7be
AS
35 * @name: string representation of the chip identifier.
36 */
9cf218fc 37struct brcmf_chip {
a83369b6
FL
38 u32 chip;
39 u32 chiprev;
cb7cf7be 40 u32 cc_caps;
5b45e54e 41 u32 pmucaps;
cb7cf7be 42 u32 pmurev;
1640f28f 43 u32 rambase;
cb7cf7be 44 u32 ramsize;
0da32ba4 45 u32 srsize;
cb7cf7be 46 char name[8];
a83369b6
FL
47};
48
cb7cf7be
AS
49/**
50 * struct brcmf_core - core related information.
51 *
52 * @id: core identifier.
53 * @rev: core revision.
54 * @base: base address of core register space.
55 */
56struct brcmf_core {
57 u16 id;
58 u16 rev;
59 u32 base;
a83369b6
FL
60};
61
cb7cf7be
AS
62/**
63 * struct brcmf_buscore_ops - buscore specific callbacks.
64 *
65 * @read32: read 32-bit value over bus.
66 * @write32: write 32-bit value over bus.
67 * @prepare: prepare bus for core configuration.
68 * @setup: bus-specific core setup.
d380ebc9 69 * @active: chip becomes active.
cb7cf7be
AS
70 * The callback should use the provided @rstvec when non-zero.
71 */
72struct brcmf_buscore_ops {
73 u32 (*read32)(void *ctx, u32 addr);
74 void (*write32)(void *ctx, u32 addr, u32 value);
75 int (*prepare)(void *ctx);
07fe2e38 76 int (*reset)(void *ctx, struct brcmf_chip *chip);
cb7cf7be 77 int (*setup)(void *ctx, struct brcmf_chip *chip);
d380ebc9 78 void (*activate)(void *ctx, struct brcmf_chip *chip, u32 rstvec);
069eddd9
FL
79};
80
cb7cf7be
AS
81struct brcmf_chip *brcmf_chip_attach(void *ctx,
82 const struct brcmf_buscore_ops *ops);
83void brcmf_chip_detach(struct brcmf_chip *chip);
84struct brcmf_core *brcmf_chip_get_core(struct brcmf_chip *chip, u16 coreid);
85struct brcmf_core *brcmf_chip_get_chipcommon(struct brcmf_chip *chip);
86bool brcmf_chip_iscoreup(struct brcmf_core *core);
87void brcmf_chip_coredisable(struct brcmf_core *core, u32 prereset, u32 reset);
88void brcmf_chip_resetcore(struct brcmf_core *core, u32 prereset, u32 reset,
89 u32 postreset);
d380ebc9
AS
90void brcmf_chip_set_passive(struct brcmf_chip *ci);
91bool brcmf_chip_set_active(struct brcmf_chip *ci, u32 rstvec);
cb7cf7be
AS
92bool brcmf_chip_sr_capable(struct brcmf_chip *pub);
93
94#endif /* BRCMF_AXIDMP_H */