aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ibm_newemac/debug.h
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2007-08-22 23:56:01 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:51:52 -0400
commit1d3bb996481e116f5f2b127cbd29b83365d2cf62 (patch)
treeb612a1dbf51c920fb5a9758a6d35f9ed37eb927f /drivers/net/ibm_newemac/debug.h
parent03233b90b0977d577322a6e1ddd56d9cc570d406 (diff)
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>
Diffstat (limited to 'drivers/net/ibm_newemac/debug.h')
-rw-r--r--drivers/net/ibm_newemac/debug.h78
1 files changed, 78 insertions, 0 deletions
diff --git a/drivers/net/ibm_newemac/debug.h b/drivers/net/ibm_newemac/debug.h
new file mode 100644
index 000000000000..1dd2dcbc157f
--- /dev/null
+++ b/drivers/net/ibm_newemac/debug.h
@@ -0,0 +1,78 @@
1/*
2 * drivers/net/ibm_newemac/debug.h
3 *
4 * Driver for PowerPC 4xx on-chip ethernet controller, debug print routines.
5 *
6 * Copyright (c) 2004, 2005 Zultys Technologies
7 * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 *
14 */
15#ifndef __IBM_NEWEMAC_DEBUG_H
16#define __IBM_NEWEMAC_DEBUG_H
17
18#include <linux/init.h>
19
20#include "core.h"
21
22#if defined(CONFIG_IBM_NEW_EMAC_DEBUG)
23
24struct emac_instance;
25struct mal_instance;
26
27extern void emac_dbg_register(struct emac_instance *dev);
28extern void emac_dbg_unregister(struct emac_instance *dev);
29extern void mal_dbg_register(struct mal_instance *mal);
30extern void mal_dbg_unregister(struct mal_instance *mal);
31extern int emac_init_debug(void) __init;
32extern void emac_fini_debug(void) __exit;
33extern void emac_dbg_dump_all(void);
34
35# define DBG_LEVEL 1
36
37#else
38
39# define emac_dbg_register(x) do { } while(0)
40# define emac_dbg_unregister(x) do { } while(0)
41# define mal_dbg_register(x) do { } while(0)
42# define mal_dbg_unregister(x) do { } while(0)
43# define emac_init_debug() do { } while(0)
44# define emac_fini_debug() do { } while(0)
45# define emac_dbg_dump_all() do { } while(0)
46
47# define DBG_LEVEL 0
48
49#endif
50
51#define EMAC_DBG(dev, name, fmt, arg...) \
52 printk(KERN_DEBUG #name "%s: " fmt, dev->ofdev->node->full_name, ## arg)
53
54#if DBG_LEVEL > 0
55# define DBG(d,f,x...) EMAC_DBG(d, emac, f, ##x)
56# define MAL_DBG(d,f,x...) EMAC_DBG(d, mal, f, ##x)
57# define ZMII_DBG(d,f,x...) EMAC_DBG(d, zmii, f, ##x)
58# define RGMII_DBG(d,f,x...) EMAC_DBG(d, rgmii, f, ##x)
59# define NL "\n"
60#else
61# define DBG(f,x...) ((void)0)
62# define MAL_DBG(d,f,x...) ((void)0)
63# define ZMII_DBG(d,f,x...) ((void)0)
64# define RGMII_DBG(d,f,x...) ((void)0)
65#endif
66#if DBG_LEVEL > 1
67# define DBG2(d,f,x...) DBG(d,f, ##x)
68# define MAL_DBG2(d,f,x...) MAL_DBG(d,f, ##x)
69# define ZMII_DBG2(d,f,x...) ZMII_DBG(d,f, ##x)
70# define RGMII_DBG2(d,f,x...) RGMII_DBG(d,f, ##x)
71#else
72# define DBG2(f,x...) ((void)0)
73# define MAL_DBG2(d,f,x...) ((void)0)
74# define ZMII_DBG2(d,f,x...) ((void)0)
75# define RGMII_DBG2(d,f,x...) ((void)0)
76#endif
77
78#endif /* __IBM_NEWEMAC_DEBUG_H */