1 // SPDX-License-Identifier: ISC
3 #include <linux/kernel.h>
4 #include <linux/module.h>
5 #include <linux/platform_device.h>
10 mt76_wmac_probe(struct platform_device
*pdev
)
12 struct mt7603_dev
*dev
;
13 void __iomem
*mem_base
;
14 struct mt76_dev
*mdev
;
18 irq
= platform_get_irq(pdev
, 0);
22 mem_base
= devm_platform_ioremap_resource(pdev
, 0);
23 if (IS_ERR(mem_base
)) {
24 dev_err(&pdev
->dev
, "Failed to get memory resource\n");
25 return PTR_ERR(mem_base
);
28 mdev
= mt76_alloc_device(&pdev
->dev
, sizeof(*dev
), &mt7603_ops
,
33 dev
= container_of(mdev
, struct mt7603_dev
, mt76
);
34 mt76_mmio_init(mdev
, mem_base
);
36 mdev
->rev
= (mt76_rr(dev
, MT_HW_CHIPID
) << 16) |
37 (mt76_rr(dev
, MT_HW_REV
) & 0xff);
38 dev_info(mdev
->dev
, "ASIC revision: %04x\n", mdev
->rev
);
40 ret
= devm_request_irq(mdev
->dev
, irq
, mt7603_irq_handler
,
41 IRQF_SHARED
, KBUILD_MODNAME
, dev
);
45 ret
= mt7603_register_device(dev
);
51 ieee80211_free_hw(mt76_hw(dev
));
56 mt76_wmac_remove(struct platform_device
*pdev
)
58 struct mt76_dev
*mdev
= platform_get_drvdata(pdev
);
59 struct mt7603_dev
*dev
= container_of(mdev
, struct mt7603_dev
, mt76
);
61 mt7603_unregister_device(dev
);
66 static const struct of_device_id of_wmac_match
[] = {
67 { .compatible
= "mediatek,mt7628-wmac" },
71 MODULE_DEVICE_TABLE(of
, of_wmac_match
);
72 MODULE_FIRMWARE(MT7628_FIRMWARE_E1
);
73 MODULE_FIRMWARE(MT7628_FIRMWARE_E2
);
75 struct platform_driver mt76_wmac_driver
= {
76 .probe
= mt76_wmac_probe
,
77 .remove
= mt76_wmac_remove
,
80 .of_match_table
= of_wmac_match
,