Device tree aware EMAC driver
Based on BenH's earlier work, this is a new version of the EMAC driver
for the built-in ethernet found on PowerPC 4xx embedded CPUs. The
same ASIC is also found in the Axon bridge chip. This new version is
designed to work in the arch/powerpc tree, using the device tree to
probe the device, rather than the old and ugly arch/ppc OCP layer.
This driver is designed to sit alongside the old driver (that lies in
drivers/net/ibm_emac and this one in drivers/net/ibm_newemac). The
old driver is left in place to support arch/ppc until arch/ppc itself
reaches its final demise (not too long now, with luck).
This driver still has a number of things that could do with cleaning
up, but I think they can be fixed up after merging. Specifically:
- Should be adjusted to properly use the dma mapping API.
Axon needs this.
- Probe logic needs reworking, in conjuction with the general
probing code for of_platform devices. The dependencies here between
EMAC, MAL, ZMII etc. make this complicated. At present, it usually
works, because we initialize and register the sub-drivers before the
EMAC driver itself, and (being in driver code) runs after the devices
themselves have been instantiated from the device tree.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-08-23 11:56:01 +08:00
|
|
|
/*
|
|
|
|
* drivers/net/ibm_newemac/debug.h
|
|
|
|
*
|
|
|
|
* Driver for PowerPC 4xx on-chip ethernet controller, debug print routines.
|
|
|
|
*
|
2007-12-05 08:14:33 +08:00
|
|
|
* Copyright 2007 Benjamin Herrenschmidt, IBM Corp.
|
|
|
|
* <benh@kernel.crashing.org>
|
|
|
|
*
|
|
|
|
* Based on the arch/ppc version of the driver:
|
|
|
|
*
|
Device tree aware EMAC driver
Based on BenH's earlier work, this is a new version of the EMAC driver
for the built-in ethernet found on PowerPC 4xx embedded CPUs. The
same ASIC is also found in the Axon bridge chip. This new version is
designed to work in the arch/powerpc tree, using the device tree to
probe the device, rather than the old and ugly arch/ppc OCP layer.
This driver is designed to sit alongside the old driver (that lies in
drivers/net/ibm_emac and this one in drivers/net/ibm_newemac). The
old driver is left in place to support arch/ppc until arch/ppc itself
reaches its final demise (not too long now, with luck).
This driver still has a number of things that could do with cleaning
up, but I think they can be fixed up after merging. Specifically:
- Should be adjusted to properly use the dma mapping API.
Axon needs this.
- Probe logic needs reworking, in conjuction with the general
probing code for of_platform devices. The dependencies here between
EMAC, MAL, ZMII etc. make this complicated. At present, it usually
works, because we initialize and register the sub-drivers before the
EMAC driver itself, and (being in driver code) runs after the devices
themselves have been instantiated from the device tree.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-08-23 11:56:01 +08:00
|
|
|
* Copyright (c) 2004, 2005 Zultys Technologies
|
|
|
|
* Eugene Surovegin <eugene.surovegin@zultys.com> or <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.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
#ifndef __IBM_NEWEMAC_DEBUG_H
|
|
|
|
#define __IBM_NEWEMAC_DEBUG_H
|
|
|
|
|
|
|
|
#include <linux/init.h>
|
|
|
|
|
|
|
|
#include "core.h"
|
|
|
|
|
|
|
|
#if defined(CONFIG_IBM_NEW_EMAC_DEBUG)
|
|
|
|
|
|
|
|
struct emac_instance;
|
|
|
|
struct mal_instance;
|
|
|
|
|
|
|
|
extern void emac_dbg_register(struct emac_instance *dev);
|
|
|
|
extern void emac_dbg_unregister(struct emac_instance *dev);
|
|
|
|
extern void mal_dbg_register(struct mal_instance *mal);
|
|
|
|
extern void mal_dbg_unregister(struct mal_instance *mal);
|
|
|
|
extern int emac_init_debug(void) __init;
|
|
|
|
extern void emac_fini_debug(void) __exit;
|
|
|
|
extern void emac_dbg_dump_all(void);
|
|
|
|
|
|
|
|
# define DBG_LEVEL 1
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
# define emac_dbg_register(x) do { } while(0)
|
|
|
|
# define emac_dbg_unregister(x) do { } while(0)
|
|
|
|
# define mal_dbg_register(x) do { } while(0)
|
|
|
|
# define mal_dbg_unregister(x) do { } while(0)
|
|
|
|
# define emac_init_debug() do { } while(0)
|
|
|
|
# define emac_fini_debug() do { } while(0)
|
|
|
|
# define emac_dbg_dump_all() do { } while(0)
|
|
|
|
|
|
|
|
# define DBG_LEVEL 0
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define EMAC_DBG(dev, name, fmt, arg...) \
|
|
|
|
printk(KERN_DEBUG #name "%s: " fmt, dev->ofdev->node->full_name, ## arg)
|
|
|
|
|
|
|
|
#if DBG_LEVEL > 0
|
|
|
|
# define DBG(d,f,x...) EMAC_DBG(d, emac, f, ##x)
|
|
|
|
# define MAL_DBG(d,f,x...) EMAC_DBG(d, mal, f, ##x)
|
|
|
|
# define ZMII_DBG(d,f,x...) EMAC_DBG(d, zmii, f, ##x)
|
|
|
|
# define RGMII_DBG(d,f,x...) EMAC_DBG(d, rgmii, f, ##x)
|
|
|
|
# define NL "\n"
|
|
|
|
#else
|
|
|
|
# define DBG(f,x...) ((void)0)
|
|
|
|
# define MAL_DBG(d,f,x...) ((void)0)
|
|
|
|
# define ZMII_DBG(d,f,x...) ((void)0)
|
|
|
|
# define RGMII_DBG(d,f,x...) ((void)0)
|
|
|
|
#endif
|
|
|
|
#if DBG_LEVEL > 1
|
|
|
|
# define DBG2(d,f,x...) DBG(d,f, ##x)
|
|
|
|
# define MAL_DBG2(d,f,x...) MAL_DBG(d,f, ##x)
|
|
|
|
# define ZMII_DBG2(d,f,x...) ZMII_DBG(d,f, ##x)
|
|
|
|
# define RGMII_DBG2(d,f,x...) RGMII_DBG(d,f, ##x)
|
|
|
|
#else
|
|
|
|
# define DBG2(f,x...) ((void)0)
|
|
|
|
# define MAL_DBG2(d,f,x...) ((void)0)
|
|
|
|
# define ZMII_DBG2(d,f,x...) ((void)0)
|
|
|
|
# define RGMII_DBG2(d,f,x...) ((void)0)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* __IBM_NEWEMAC_DEBUG_H */
|