Release 4.7 drivers/net/ethernet/ibm/emac/tah.c
  
  
/*
 * drivers/net/ethernet/ibm/emac/tah.c
 *
 * Driver for PowerPC 4xx on-chip ethernet controller, TAH support.
 *
 * Copyright 2007 Benjamin Herrenschmidt, IBM Corp.
 *                <benh@kernel.crashing.org>
 *
 * Based on the arch/ppc version of the driver:
 *
 * Copyright 2004 MontaVista Software, Inc.
 * Matt Porter <mporter@kernel.crashing.org>
 *
 * Copyright (c) 2005 Eugene Surovegin <ebs@ebshome.net>
 *
 * This program is free software; you can redistribute  it and/or modify it
 * under  the terms of  the GNU General  Public License as published by the
 * Free Software Foundation;  either version 2 of the  License, or (at your
 * option) any later version.
 */
#include <linux/of_address.h>
#include <asm/io.h>
#include "emac.h"
#include "core.h"
int tah_attach(struct platform_device *ofdev, int channel)
{
	struct tah_instance *dev = platform_get_drvdata(ofdev);
	mutex_lock(&dev->lock);
	/* Reset has been done at probe() time... nothing else to do for now */
	++dev->users;
	mutex_unlock(&dev->lock);
	return 0;
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| david gibson | david gibson | 46 | 95.83% | 1 | 33.33% | 
| jingoo han | jingoo han | 1 | 2.08% | 1 | 33.33% | 
| grant likely | grant likely | 1 | 2.08% | 1 | 33.33% | 
 | Total | 48 | 100.00% | 3 | 100.00% | 
void tah_detach(struct platform_device *ofdev, int channel)
{
	struct tah_instance *dev = platform_get_drvdata(ofdev);
	mutex_lock(&dev->lock);
	--dev->users;
	mutex_unlock(&dev->lock);
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| david gibson | david gibson | 42 | 95.45% | 1 | 33.33% | 
| grant likely | grant likely | 1 | 2.27% | 1 | 33.33% | 
| jingoo han | jingoo han | 1 | 2.27% | 1 | 33.33% | 
 | Total | 44 | 100.00% | 3 | 100.00% | 
void tah_reset(struct platform_device *ofdev)
{
	struct tah_instance *dev = platform_get_drvdata(ofdev);
	struct tah_regs __iomem *p = dev->base;
	int n;
	/* Reset TAH */
	out_be32(&p->mr, TAH_MR_SR);
	n = 100;
	while ((in_be32(&p->mr) & TAH_MR_SR) && n)
		--n;
	if (unlikely(!n))
		printk(KERN_ERR "%s: reset timeout\n",
			ofdev->dev.of_node->full_name);
	/* 10KB TAH TX FIFO accommodates the max MTU of 9000 */
	out_be32(&p->mr,
		 TAH_MR_CVR | TAH_MR_ST_768 | TAH_MR_TFS_10KB | TAH_MR_DTFP |
		 TAH_MR_DIG);
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| david gibson | david gibson | 101 | 93.52% | 1 | 16.67% | 
| grant likely | grant likely | 4 | 3.70% | 2 | 33.33% | 
| lucas de marchi | lucas de marchi | 1 | 0.93% | 1 | 16.67% | 
| al viro | al viro | 1 | 0.93% | 1 | 16.67% | 
| jingoo han | jingoo han | 1 | 0.93% | 1 | 16.67% | 
 | Total | 108 | 100.00% | 6 | 100.00% | 
int tah_get_regs_len(struct platform_device *ofdev)
{
	return sizeof(struct emac_ethtool_regs_subhdr) +
		sizeof(struct tah_regs);
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| david gibson | david gibson | 22 | 95.65% | 1 | 50.00% | 
| grant likely | grant likely | 1 | 4.35% | 1 | 50.00% | 
 | Total | 23 | 100.00% | 2 | 100.00% | 
void *tah_dump_regs(struct platform_device *ofdev, void *buf)
{
	struct tah_instance *dev = platform_get_drvdata(ofdev);
	struct emac_ethtool_regs_subhdr *hdr = buf;
	struct tah_regs *regs = (struct tah_regs *)(hdr + 1);
	hdr->version = 0;
	hdr->index = 0; /* for now, are there chips with more than one
                         * zmii ? if yes, then we'll add a cell_index
                         * like we do for emac
                         */
	memcpy_fromio(regs, dev->base, sizeof(struct tah_regs));
	return regs + 1;
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| david gibson | david gibson | 79 | 97.53% | 1 | 33.33% | 
| grant likely | grant likely | 1 | 1.23% | 1 | 33.33% | 
| jingoo han | jingoo han | 1 | 1.23% | 1 | 33.33% | 
 | Total | 81 | 100.00% | 3 | 100.00% | 
static int tah_probe(struct platform_device *ofdev)
{
	struct device_node *np = ofdev->dev.of_node;
	struct tah_instance *dev;
	struct resource regs;
	int rc;
	rc = -ENOMEM;
	dev = kzalloc(sizeof(struct tah_instance), GFP_KERNEL);
	if (dev == NULL)
		goto err_gone;
	mutex_init(&dev->lock);
	dev->ofdev = ofdev;
	rc = -ENXIO;
	if (of_address_to_resource(np, 0, ®s)) {
		printk(KERN_ERR "%s: Can't get registers address\n",
		       np->full_name);
		goto err_free;
	}
	rc = -ENOMEM;
	dev->base = (struct tah_regs __iomem *)ioremap(regs.start,
					       sizeof(struct tah_regs));
	if (dev->base == NULL) {
		printk(KERN_ERR "%s: Can't map device registers!\n",
		       np->full_name);
		goto err_free;
	}
	platform_set_drvdata(ofdev, dev);
	/* Initialize TAH and enable IPv4 checksum verification, no TSO yet */
	tah_reset(ofdev);
	printk(KERN_INFO
	       "TAH %s initialized\n", ofdev->dev.of_node->full_name);
	wmb();
	return 0;
 err_free:
	kfree(dev);
 err_gone:
	return rc;
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| david gibson | david gibson | 188 | 92.61% | 1 | 16.67% | 
| grant likely | grant likely | 7 | 3.45% | 2 | 33.33% | 
| valentine barshak | valentine barshak | 6 | 2.96% | 1 | 16.67% | 
| jingoo han | jingoo han | 1 | 0.49% | 1 | 16.67% | 
| al viro | al viro | 1 | 0.49% | 1 | 16.67% | 
 | Total | 203 | 100.00% | 6 | 100.00% | 
static int tah_remove(struct platform_device *ofdev)
{
	struct tah_instance *dev = platform_get_drvdata(ofdev);
	WARN_ON(dev->users != 0);
	iounmap(dev->base);
	kfree(dev);
	return 0;
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| david gibson | david gibson | 43 | 95.56% | 1 | 33.33% | 
| jingoo han | jingoo han | 1 | 2.22% | 1 | 33.33% | 
| grant likely | grant likely | 1 | 2.22% | 1 | 33.33% | 
 | Total | 45 | 100.00% | 3 | 100.00% | 
static const struct of_device_id tah_match[] =
{
	{
		.compatible	= "ibm,tah",
        },
	/* For backward compat with old DT */
	{
		.type		= "tah",
        },
	{},
};
static struct platform_driver tah_driver = {
	.driver = {
		.name = "emac-tah",
		.of_match_table = tah_match,
        },
	.probe = tah_probe,
	.remove = tah_remove,
};
int __init tah_init(void)
{
	return platform_driver_register(&tah_driver);
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| david gibson | david gibson | 14 | 93.33% | 1 | 50.00% | 
| grant likely | grant likely | 1 | 6.67% | 1 | 50.00% | 
 | Total | 15 | 100.00% | 2 | 100.00% | 
void tah_exit(void)
{
	platform_driver_unregister(&tah_driver);
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| david gibson | david gibson | 12 | 92.31% | 1 | 50.00% | 
| grant likely | grant likely | 1 | 7.69% | 1 | 50.00% | 
 | Total | 13 | 100.00% | 2 | 100.00% | 
Overall Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| david gibson | david gibson | 598 | 91.86% | 1 | 7.69% | 
| grant likely | grant likely | 25 | 3.84% | 4 | 30.77% | 
| stefan roese | stefan roese | 8 | 1.23% | 1 | 7.69% | 
| jingoo han | jingoo han | 6 | 0.92% | 1 | 7.69% | 
| valentine barshak | valentine barshak | 6 | 0.92% | 1 | 7.69% | 
| rob herring | rob herring | 3 | 0.46% | 1 | 7.69% | 
| al viro | al viro | 2 | 0.31% | 1 | 7.69% | 
| paul gortmaker | paul gortmaker | 1 | 0.15% | 1 | 7.69% | 
| fabian frederick | fabian frederick | 1 | 0.15% | 1 | 7.69% | 
| lucas de marchi | lucas de marchi | 1 | 0.15% | 1 | 7.69% | 
 | Total | 651 | 100.00% | 13 | 100.00% | 
  
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.