Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 


Quelle  mt7530-mmio.c   Sprache: C

 
// SPDX-License-Identifier: GPL-2.0-only

#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
#include <linux/regulator/consumer.h>
#include <linux/reset.h>
#include <net/dsa.h>

#include "mt7530.h"

static const struct of_device_id mt7988_of_match[] = {
 { .compatible = "airoha,an7583-switch", .data = &mt753x_table[ID_AN7583], },
 { .compatible = "airoha,en7581-switch", .data = &mt753x_table[ID_EN7581], },
 { .compatible = "mediatek,mt7988-switch", .data = &mt753x_table[ID_MT7988], },
 { /* sentinel */ },
};
MODULE_DEVICE_TABLE(of, mt7988_of_match);

static const struct regmap_config sw_regmap_config = {
 .name = "switch",
 .reg_bits = 16,
 .val_bits = 32,
 .reg_stride = 4,
 .max_register = MT7530_CREV,
};

static int
mt7988_probe(struct platform_device *pdev)
{
 struct mt7530_priv *priv;
 void __iomem *base_addr;
 int ret;

 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
 if (!priv)
  return -ENOMEM;

 priv->bus = NULL;
 priv->dev = &pdev->dev;

 ret = mt7530_probe_common(priv);
 if (ret)
  return ret;

 priv->rstc = devm_reset_control_get(&pdev->dev, NULL);
 if (IS_ERR(priv->rstc)) {
  dev_err(&pdev->dev, "Couldn't get our reset line\n");
  return PTR_ERR(priv->rstc);
 }

 base_addr = devm_platform_ioremap_resource(pdev, 0);
 if (IS_ERR(base_addr)) {
  dev_err(&pdev->dev, "cannot request I/O memory space\n");
  return -ENXIO;
 }

 priv->regmap = devm_regmap_init_mmio(&pdev->dev, base_addr,
          &sw_regmap_config);
 if (IS_ERR(priv->regmap))
  return PTR_ERR(priv->regmap);

 return dsa_register_switch(priv->ds);
}

static void mt7988_remove(struct platform_device *pdev)
{
 struct mt7530_priv *priv = platform_get_drvdata(pdev);

 if (priv)
  mt7530_remove_common(priv);
}

static void mt7988_shutdown(struct platform_device *pdev)
{
 struct mt7530_priv *priv = platform_get_drvdata(pdev);

 if (!priv)
  return;

 dsa_switch_shutdown(priv->ds);

 dev_set_drvdata(&pdev->dev, NULL);
}

static struct platform_driver mt7988_platform_driver = {
 .probe  = mt7988_probe,
 .remove = mt7988_remove,
 .shutdown = mt7988_shutdown,
 .driver = {
  .name = "mt7530-mmio",
  .of_match_table = mt7988_of_match,
 },
};
module_platform_driver(mt7988_platform_driver);

MODULE_AUTHOR("Daniel Golle ");
MODULE_DESCRIPTION("Driver for Mediatek MT7530 Switch (MMIO)");
MODULE_LICENSE("GPL");

Messung V0.5
C=94 H=95 G=94

¤ Dauer der Verarbeitung: 0.16 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Produkte
     Quellcodebibliothek

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik

Monitoring

Montastic status badge