blob: bc41853b6e26f8ef470664cc3b6e78ec971ce4ac [file] [log] [blame]
David Gibson1d3bb992007-08-23 13:56:01 +10001/*
2 * drivers/net/ibm_newemac/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_NEWEMAC_TAH_H
18#define __IBM_NEWEMAC_TAH_H
19
20/* TAH */
21struct tah_regs {
22 u32 revid;
23 u32 pad[3];
24 u32 mr;
25 u32 ssr0;
26 u32 ssr1;
27 u32 ssr2;
28 u32 ssr3;
29 u32 ssr4;
30 u32 ssr5;
31 u32 tsr;
32};
33
34
35/* TAH device */
36struct tah_instance {
37 struct tah_regs __iomem *base;
38
39 /* Only one EMAC whacks us at a time */
40 struct mutex lock;
41
42 /* number of EMACs using this TAH */
43 int users;
44
45 /* OF device instance */
46 struct of_device *ofdev;
47};
48
49
50/* TAH engine */
51#define TAH_MR_CVR 0x80000000
52#define TAH_MR_SR 0x40000000
53#define TAH_MR_ST_256 0x01000000
54#define TAH_MR_ST_512 0x02000000
55#define TAH_MR_ST_768 0x03000000
56#define TAH_MR_ST_1024 0x04000000
57#define TAH_MR_ST_1280 0x05000000
58#define TAH_MR_ST_1536 0x06000000
59#define TAH_MR_TFS_16KB 0x00000000
60#define TAH_MR_TFS_2KB 0x00200000
61#define TAH_MR_TFS_4KB 0x00400000
62#define TAH_MR_TFS_6KB 0x00600000
63#define TAH_MR_TFS_8KB 0x00800000
64#define TAH_MR_TFS_10KB 0x00a00000
65#define TAH_MR_DTFP 0x00100000
66#define TAH_MR_DIG 0x00080000
67
68#ifdef CONFIG_IBM_NEW_EMAC_TAH
69
70extern int tah_init(void);
71extern void tah_exit(void);
72extern int tah_attach(struct of_device *ofdev, int channel);
73extern void tah_detach(struct of_device *ofdev, int channel);
74extern void tah_reset(struct of_device *ofdev);
75extern int tah_get_regs_len(struct of_device *ofdev);
76extern void *tah_dump_regs(struct of_device *ofdev, void *buf);
77
78#else
79
80# define tah_init() 0
81# define tah_exit() do { } while(0)
82# define tah_attach(x,y) (-ENXIO)
83# define tah_detach(x,y) do { } while(0)
84# define tah_reset(x) do { } while(0)
85# define tah_get_regs_len(x) 0
86# define tah_dump_regs(x,buf) (buf)
87
88#endif /* !CONFIG_IBM_NEW_EMAC_TAH */
89
90#endif /* __IBM_NEWEMAC_TAH_H */