drivers/net/wireless/ath/ath9k/ahb.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/ath/ath9k/ahb.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/ath/ath9k/ahb.c- Extension
.c- Size
- 4051 bytes
- Lines
- 153
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/mod_devicetable.hlinux/module.hlinux/nl80211.hlinux/of.hlinux/platform_device.hath9k.h
Detected Declarations
function ath_ahb_read_cachesizefunction ath_ahb_eeprom_readfunction ath_ahb_probefunction ath_ahb_removefunction ath_ahb_initfunction ath_ahb_exit
Annotated Snippet
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/nl80211.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include "ath9k.h"
static const struct of_device_id ath9k_of_match_table[] = {
{ .compatible = "qca,ar9130-wifi", .data = (void *)AR5416_AR9100_DEVID },
{ .compatible = "qca,ar9330-wifi", .data = (void *)AR9300_DEVID_AR9330 },
{ .compatible = "qca,ar9340-wifi", .data = (void *)AR9300_DEVID_AR9340 },
{ .compatible = "qca,qca9530-wifi", .data = (void *)AR9300_DEVID_AR953X },
{ .compatible = "qca,qca9550-wifi", .data = (void *)AR9300_DEVID_QCA955X },
{ .compatible = "qca,qca9560-wifi", .data = (void *)AR9300_DEVID_QCA956X },
{},
};
/* return bus cachesize in 4B word units */
static void ath_ahb_read_cachesize(struct ath_common *common, int *csz)
{
*csz = L1_CACHE_BYTES >> 2;
}
static bool ath_ahb_eeprom_read(struct ath_common *common, u32 off, u16 *data)
{
ath_err(common, "%s: eeprom data has to be provided externally\n",
__func__);
return false;
}
static const struct ath_bus_ops ath_ahb_bus_ops = {
.ath_bus_type = ATH_AHB,
.read_cachesize = ath_ahb_read_cachesize,
.eeprom_read = ath_ahb_eeprom_read,
};
static int ath_ahb_probe(struct platform_device *pdev)
{
struct ieee80211_hw *hw;
struct ath_softc *sc;
struct ath_hw *ah;
void __iomem *mem;
char hw_name[64];
u16 dev_id;
int irq;
int ret;
mem = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(mem)) {
dev_err(&pdev->dev, "ioremap failed\n");
return PTR_ERR(mem);
}
irq = platform_get_irq(pdev, 0);
if (irq < 0)
return irq;
ath9k_fill_chanctx_ops();
hw = ieee80211_alloc_hw(sizeof(struct ath_softc), &ath9k_ops);
if (hw == NULL) {
dev_err(&pdev->dev, "no memory for ieee80211_hw\n");
return -ENOMEM;
}
SET_IEEE80211_DEV(hw, &pdev->dev);
platform_set_drvdata(pdev, hw);
sc = hw->priv;
sc->hw = hw;
sc->dev = &pdev->dev;
sc->mem = mem;
sc->irq = irq;
ret = request_irq(irq, ath_isr, IRQF_SHARED, "ath9k", sc);
if (ret) {
dev_err(&pdev->dev, "request_irq failed\n");
goto err_free_hw;
}
dev_id = (u16)(kernel_ulong_t)of_device_get_match_data(&pdev->dev);
ret = ath9k_init_device(dev_id, sc, &ath_ahb_bus_ops);
if (ret) {
dev_err(&pdev->dev, "failed to initialize device\n");
goto err_irq;
}
ah = sc->sc_ah;
ath9k_hw_name(ah, hw_name, sizeof(hw_name));
wiphy_info(hw->wiphy, "%s mem=0x%p, irq=%d\n",
Annotation
- Immediate include surface: `linux/mod_devicetable.h`, `linux/module.h`, `linux/nl80211.h`, `linux/of.h`, `linux/platform_device.h`, `ath9k.h`.
- Detected declarations: `function ath_ahb_read_cachesize`, `function ath_ahb_eeprom_read`, `function ath_ahb_probe`, `function ath_ahb_remove`, `function ath_ahb_init`, `function ath_ahb_exit`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.