0001
0002
0003
0004
0005
0006
0007
0008 #include <linux/kernel.h>
0009 #include <linux/module.h>
0010 #include <linux/platform_device.h>
0011 #include <linux/regmap.h>
0012 #include <linux/mfd/syscon.h>
0013 #include <linux/of.h>
0014 #include "mt7615.h"
0015
0016 int mt7622_wmac_init(struct mt7615_dev *dev)
0017 {
0018 struct device_node *np = dev->mt76.dev->of_node;
0019
0020 if (!is_mt7622(&dev->mt76))
0021 return 0;
0022
0023 dev->infracfg = syscon_regmap_lookup_by_phandle(np, "mediatek,infracfg");
0024 if (IS_ERR(dev->infracfg)) {
0025 dev_err(dev->mt76.dev, "Cannot find infracfg controller\n");
0026 return PTR_ERR(dev->infracfg);
0027 }
0028
0029 return 0;
0030 }
0031
0032 static int mt7622_wmac_probe(struct platform_device *pdev)
0033 {
0034 void __iomem *mem_base;
0035 int irq;
0036
0037 irq = platform_get_irq(pdev, 0);
0038 if (irq < 0)
0039 return irq;
0040
0041 mem_base = devm_platform_get_and_ioremap_resource(pdev, 0, NULL);
0042 if (IS_ERR(mem_base))
0043 return PTR_ERR(mem_base);
0044
0045 return mt7615_mmio_probe(&pdev->dev, mem_base, irq, mt7615e_reg_map);
0046 }
0047
0048 static int mt7622_wmac_remove(struct platform_device *pdev)
0049 {
0050 struct mt7615_dev *dev = platform_get_drvdata(pdev);
0051
0052 mt7615_unregister_device(dev);
0053
0054 return 0;
0055 }
0056
0057 static const struct of_device_id mt7622_wmac_of_match[] = {
0058 { .compatible = "mediatek,mt7622-wmac" },
0059 {},
0060 };
0061
0062 struct platform_driver mt7622_wmac_driver = {
0063 .driver = {
0064 .name = "mt7622-wmac",
0065 .of_match_table = mt7622_wmac_of_match,
0066 },
0067 .probe = mt7622_wmac_probe,
0068 .remove = mt7622_wmac_remove,
0069 };
0070
0071 MODULE_FIRMWARE(MT7622_FIRMWARE_N9);
0072 MODULE_FIRMWARE(MT7622_ROM_PATCH);