Path: blob/main/sys/contrib/dev/mediatek/mt76/mt7615/soc.c
48526 views
// SPDX-License-Identifier: ISC1/* Copyright (C) 2019 MediaTek Inc.2*3* Author: Ryder Lee <[email protected]>4* Felix Fietkau <[email protected]>5*/67#include <linux/kernel.h>8#include <linux/module.h>9#include <linux/platform_device.h>10#include <linux/regmap.h>11#include <linux/mfd/syscon.h>12#include <linux/of.h>13#include "mt7615.h"1415int mt7622_wmac_init(struct mt7615_dev *dev)16{17struct device_node *np = dev->mt76.dev->of_node;1819if (!is_mt7622(&dev->mt76))20return 0;2122dev->infracfg = syscon_regmap_lookup_by_phandle(np, "mediatek,infracfg");23if (IS_ERR(dev->infracfg)) {24dev_err(dev->mt76.dev, "Cannot find infracfg controller\n");25return PTR_ERR(dev->infracfg);26}2728return 0;29}3031static int mt7622_wmac_probe(struct platform_device *pdev)32{33void __iomem *mem_base;34int irq;3536irq = platform_get_irq(pdev, 0);37if (irq < 0)38return irq;3940mem_base = devm_platform_get_and_ioremap_resource(pdev, 0, NULL);41if (IS_ERR(mem_base))42return PTR_ERR(mem_base);4344return mt7615_mmio_probe(&pdev->dev, mem_base, irq, mt7615e_reg_map);45}4647static void mt7622_wmac_remove(struct platform_device *pdev)48{49struct mt7615_dev *dev = platform_get_drvdata(pdev);5051mt7615_unregister_device(dev);52}5354static const struct of_device_id mt7622_wmac_of_match[] = {55{ .compatible = "mediatek,mt7622-wmac" },56{},57};5859struct platform_driver mt7622_wmac_driver = {60.driver = {61.name = "mt7622-wmac",62.of_match_table = mt7622_wmac_of_match,63},64.probe = mt7622_wmac_probe,65.remove = mt7622_wmac_remove,66};6768MODULE_FIRMWARE(MT7622_FIRMWARE_N9);69MODULE_FIRMWARE(MT7622_ROM_PATCH);707172