cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

soc.c (1602B)


      1// SPDX-License-Identifier: ISC
      2/* Copyright (C) 2019 MediaTek Inc.
      3 *
      4 * Author: Ryder Lee <ryder.lee@mediatek.com>
      5 *         Felix Fietkau <nbd@nbd.name>
      6 */
      7
      8#include <linux/kernel.h>
      9#include <linux/module.h>
     10#include <linux/platform_device.h>
     11#include <linux/regmap.h>
     12#include <linux/mfd/syscon.h>
     13#include <linux/of.h>
     14#include "mt7615.h"
     15
     16int mt7622_wmac_init(struct mt7615_dev *dev)
     17{
     18	struct device_node *np = dev->mt76.dev->of_node;
     19
     20	if (!is_mt7622(&dev->mt76))
     21		return 0;
     22
     23	dev->infracfg = syscon_regmap_lookup_by_phandle(np, "mediatek,infracfg");
     24	if (IS_ERR(dev->infracfg)) {
     25		dev_err(dev->mt76.dev, "Cannot find infracfg controller\n");
     26		return PTR_ERR(dev->infracfg);
     27	}
     28
     29	return 0;
     30}
     31
     32static int mt7622_wmac_probe(struct platform_device *pdev)
     33{
     34	void __iomem *mem_base;
     35	int irq;
     36
     37	irq = platform_get_irq(pdev, 0);
     38	if (irq < 0)
     39		return irq;
     40
     41	mem_base = devm_platform_get_and_ioremap_resource(pdev, 0, NULL);
     42	if (IS_ERR(mem_base))
     43		return PTR_ERR(mem_base);
     44
     45	return mt7615_mmio_probe(&pdev->dev, mem_base, irq, mt7615e_reg_map);
     46}
     47
     48static int mt7622_wmac_remove(struct platform_device *pdev)
     49{
     50	struct mt7615_dev *dev = platform_get_drvdata(pdev);
     51
     52	mt7615_unregister_device(dev);
     53
     54	return 0;
     55}
     56
     57static const struct of_device_id mt7622_wmac_of_match[] = {
     58	{ .compatible = "mediatek,mt7622-wmac" },
     59	{},
     60};
     61
     62struct platform_driver mt7622_wmac_driver = {
     63	.driver = {
     64		.name = "mt7622-wmac",
     65		.of_match_table = mt7622_wmac_of_match,
     66	},
     67	.probe = mt7622_wmac_probe,
     68	.remove = mt7622_wmac_remove,
     69};
     70
     71MODULE_FIRMWARE(MT7622_FIRMWARE_N9);
     72MODULE_FIRMWARE(MT7622_ROM_PATCH);