Loading...
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * drivers/net/ethernet/ibm/emac/tah.h
4 *
5 * Driver for PowerPC 4xx on-chip ethernet controller, TAH support.
6 *
7 * Copyright 2007 Benjamin Herrenschmidt, IBM Corp.
8 * <benh@kernel.crashing.org>
9 *
10 * Based on the arch/ppc version of the driver:
11 *
12 * Copyright 2004 MontaVista Software, Inc.
13 * Matt Porter <mporter@kernel.crashing.org>
14 *
15 * Copyright (c) 2005 Eugene Surovegin <ebs@ebshome.net>
16 */
17
18#ifndef __IBM_NEWEMAC_TAH_H
19#define __IBM_NEWEMAC_TAH_H
20
21/* TAH */
22struct tah_regs {
23 u32 revid;
24 u32 pad[3];
25 u32 mr;
26 u32 ssr0;
27 u32 ssr1;
28 u32 ssr2;
29 u32 ssr3;
30 u32 ssr4;
31 u32 ssr5;
32 u32 tsr;
33};
34
35
36/* TAH device */
37struct tah_instance {
38 struct tah_regs __iomem *base;
39
40 /* Only one EMAC whacks us at a time */
41 struct mutex lock;
42
43 /* number of EMACs using this TAH */
44 int users;
45
46 /* OF device instance */
47 struct platform_device *ofdev;
48};
49
50
51/* TAH engine */
52#define TAH_MR_CVR 0x80000000
53#define TAH_MR_SR 0x40000000
54#define TAH_MR_ST_256 0x01000000
55#define TAH_MR_ST_512 0x02000000
56#define TAH_MR_ST_768 0x03000000
57#define TAH_MR_ST_1024 0x04000000
58#define TAH_MR_ST_1280 0x05000000
59#define TAH_MR_ST_1536 0x06000000
60#define TAH_MR_TFS_16KB 0x00000000
61#define TAH_MR_TFS_2KB 0x00200000
62#define TAH_MR_TFS_4KB 0x00400000
63#define TAH_MR_TFS_6KB 0x00600000
64#define TAH_MR_TFS_8KB 0x00800000
65#define TAH_MR_TFS_10KB 0x00a00000
66#define TAH_MR_DTFP 0x00100000
67#define TAH_MR_DIG 0x00080000
68
69#ifdef CONFIG_IBM_EMAC_TAH
70
71int tah_init(void);
72void tah_exit(void);
73int tah_attach(struct platform_device *ofdev, int channel);
74void tah_detach(struct platform_device *ofdev, int channel);
75void tah_reset(struct platform_device *ofdev);
76int tah_get_regs_len(struct platform_device *ofdev);
77void *tah_dump_regs(struct platform_device *ofdev, void *buf);
78
79#else
80
81# define tah_init() 0
82# define tah_exit() do { } while(0)
83# define tah_attach(x,y) (-ENXIO)
84# define tah_detach(x,y) do { } while(0)
85# define tah_reset(x) do { } while(0)
86# define tah_get_regs_len(x) 0
87# define tah_dump_regs(x,buf) (buf)
88
89#endif /* !CONFIG_IBM_EMAC_TAH */
90
91#endif /* __IBM_NEWEMAC_TAH_H */
1/*
2 * drivers/net/ethernet/ibm/emac/tah.h
3 *
4 * Driver for PowerPC 4xx on-chip ethernet controller, TAH support.
5 *
6 * Copyright 2007 Benjamin Herrenschmidt, IBM Corp.
7 * <benh@kernel.crashing.org>
8 *
9 * Based on the arch/ppc version of the driver:
10 *
11 * Copyright 2004 MontaVista Software, Inc.
12 * Matt Porter <mporter@kernel.crashing.org>
13 *
14 * Copyright (c) 2005 Eugene Surovegin <ebs@ebshome.net>
15 *
16 * This program is free software; you can redistribute it and/or modify it
17 * under the terms of the GNU General Public License as published by the
18 * Free Software Foundation; either version 2 of the License, or (at your
19 * option) any later version.
20 */
21
22#ifndef __IBM_NEWEMAC_TAH_H
23#define __IBM_NEWEMAC_TAH_H
24
25/* TAH */
26struct tah_regs {
27 u32 revid;
28 u32 pad[3];
29 u32 mr;
30 u32 ssr0;
31 u32 ssr1;
32 u32 ssr2;
33 u32 ssr3;
34 u32 ssr4;
35 u32 ssr5;
36 u32 tsr;
37};
38
39
40/* TAH device */
41struct tah_instance {
42 struct tah_regs __iomem *base;
43
44 /* Only one EMAC whacks us at a time */
45 struct mutex lock;
46
47 /* number of EMACs using this TAH */
48 int users;
49
50 /* OF device instance */
51 struct platform_device *ofdev;
52};
53
54
55/* TAH engine */
56#define TAH_MR_CVR 0x80000000
57#define TAH_MR_SR 0x40000000
58#define TAH_MR_ST_256 0x01000000
59#define TAH_MR_ST_512 0x02000000
60#define TAH_MR_ST_768 0x03000000
61#define TAH_MR_ST_1024 0x04000000
62#define TAH_MR_ST_1280 0x05000000
63#define TAH_MR_ST_1536 0x06000000
64#define TAH_MR_TFS_16KB 0x00000000
65#define TAH_MR_TFS_2KB 0x00200000
66#define TAH_MR_TFS_4KB 0x00400000
67#define TAH_MR_TFS_6KB 0x00600000
68#define TAH_MR_TFS_8KB 0x00800000
69#define TAH_MR_TFS_10KB 0x00a00000
70#define TAH_MR_DTFP 0x00100000
71#define TAH_MR_DIG 0x00080000
72
73#ifdef CONFIG_IBM_EMAC_TAH
74
75int tah_init(void);
76void tah_exit(void);
77int tah_attach(struct platform_device *ofdev, int channel);
78void tah_detach(struct platform_device *ofdev, int channel);
79void tah_reset(struct platform_device *ofdev);
80int tah_get_regs_len(struct platform_device *ofdev);
81void *tah_dump_regs(struct platform_device *ofdev, void *buf);
82
83#else
84
85# define tah_init() 0
86# define tah_exit() do { } while(0)
87# define tah_attach(x,y) (-ENXIO)
88# define tah_detach(x,y) do { } while(0)
89# define tah_reset(x) do { } while(0)
90# define tah_get_regs_len(x) 0
91# define tah_dump_regs(x,buf) (buf)
92
93#endif /* !CONFIG_IBM_EMAC_TAH */
94
95#endif /* __IBM_NEWEMAC_TAH_H */