1/*
2 * drivers/net/ibm_emac/ibm_emac_tah.h
3 *
4 * Driver for PowerPC 4xx on-chip ethernet controller, TAH support.
5 *
6 * Copyright 2004 MontaVista Software, Inc.
7 * Matt Porter <mporter@kernel.crashing.org>
8 *
9 * Copyright (c) 2005 Eugene Surovegin <ebs@ebshome.net>
10 *
11 * This program is free software; you can redistribute  it and/or modify it
12 * under  the terms of  the GNU General  Public License as published by the
13 * Free Software Foundation;  either version 2 of the  License, or (at your
14 * option) any later version.
15 */
16
17#ifndef _IBM_EMAC_TAH_H
18#define _IBM_EMAC_TAH_H
19
20#include <linux/init.h>
21#include <asm/ocp.h>
22
23/* TAH */
24struct tah_regs {
25	u32 revid;
26	u32 pad[3];
27	u32 mr;
28	u32 ssr0;
29	u32 ssr1;
30	u32 ssr2;
31	u32 ssr3;
32	u32 ssr4;
33	u32 ssr5;
34	u32 tsr;
35};
36
37/* TAH engine */
38#define TAH_MR_CVR		0x80000000
39#define TAH_MR_SR		0x40000000
40#define TAH_MR_ST_256		0x01000000
41#define TAH_MR_ST_512		0x02000000
42#define TAH_MR_ST_768		0x03000000
43#define TAH_MR_ST_1024		0x04000000
44#define TAH_MR_ST_1280		0x05000000
45#define TAH_MR_ST_1536		0x06000000
46#define TAH_MR_TFS_16KB		0x00000000
47#define TAH_MR_TFS_2KB		0x00200000
48#define TAH_MR_TFS_4KB		0x00400000
49#define TAH_MR_TFS_6KB		0x00600000
50#define TAH_MR_TFS_8KB		0x00800000
51#define TAH_MR_TFS_10KB		0x00a00000
52#define TAH_MR_DTFP		0x00100000
53#define TAH_MR_DIG		0x00080000
54
55#ifdef CONFIG_IBM_EMAC_TAH
56int tah_attach(void *emac) __init;
57
58void __tah_fini(struct ocp_device *ocpdev);
59static inline void tah_fini(struct ocp_device *ocpdev)
60{
61	if (ocpdev)
62		__tah_fini(ocpdev);
63}
64
65void __tah_reset(struct ocp_device *ocpdev);
66static inline void tah_reset(struct ocp_device *ocpdev)
67{
68	if (ocpdev)
69		__tah_reset(ocpdev);
70}
71
72int __tah_get_regs_len(struct ocp_device *ocpdev);
73static inline int tah_get_regs_len(struct ocp_device *ocpdev)
74{
75	return ocpdev ? __tah_get_regs_len(ocpdev) : 0;
76}
77
78void *tah_dump_regs(struct ocp_device *ocpdev, void *buf);
79#else
80# define tah_attach(x)		0
81# define tah_fini(x)		((void)0)
82# define tah_reset(x)		((void)0)
83# define tah_get_regs_len(x)	0
84# define tah_dump_regs(x,buf)	(buf)
85#endif				/* !CONFIG_IBM_EMAC_TAH */
86
87#endif				/* _IBM_EMAC_TAH_H */
88