Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /*
0003  * drivers/net/ethernet/ibm/emac/tah.h
0004  *
0005  * Driver for PowerPC 4xx on-chip ethernet controller, TAH support.
0006  *
0007  * Copyright 2007 Benjamin Herrenschmidt, IBM Corp.
0008  *                <benh@kernel.crashing.org>
0009  *
0010  * Based on the arch/ppc version of the driver:
0011  *
0012  * Copyright 2004 MontaVista Software, Inc.
0013  * Matt Porter <mporter@kernel.crashing.org>
0014  *
0015  * Copyright (c) 2005 Eugene Surovegin <ebs@ebshome.net>
0016  */
0017 
0018 #ifndef __IBM_NEWEMAC_TAH_H
0019 #define __IBM_NEWEMAC_TAH_H
0020 
0021 /* TAH */
0022 struct tah_regs {
0023     u32 revid;
0024     u32 pad[3];
0025     u32 mr;
0026     u32 ssr0;
0027     u32 ssr1;
0028     u32 ssr2;
0029     u32 ssr3;
0030     u32 ssr4;
0031     u32 ssr5;
0032     u32 tsr;
0033 };
0034 
0035 
0036 /* TAH device */
0037 struct tah_instance {
0038     struct tah_regs __iomem     *base;
0039 
0040     /* Only one EMAC whacks us at a time */
0041     struct mutex            lock;
0042 
0043     /* number of EMACs using this TAH */
0044     int             users;
0045 
0046     /* OF device instance */
0047     struct platform_device      *ofdev;
0048 };
0049 
0050 
0051 /* TAH engine */
0052 #define TAH_MR_CVR      0x80000000
0053 #define TAH_MR_SR       0x40000000
0054 #define TAH_MR_ST_256       0x01000000
0055 #define TAH_MR_ST_512       0x02000000
0056 #define TAH_MR_ST_768       0x03000000
0057 #define TAH_MR_ST_1024      0x04000000
0058 #define TAH_MR_ST_1280      0x05000000
0059 #define TAH_MR_ST_1536      0x06000000
0060 #define TAH_MR_TFS_16KB     0x00000000
0061 #define TAH_MR_TFS_2KB      0x00200000
0062 #define TAH_MR_TFS_4KB      0x00400000
0063 #define TAH_MR_TFS_6KB      0x00600000
0064 #define TAH_MR_TFS_8KB      0x00800000
0065 #define TAH_MR_TFS_10KB     0x00a00000
0066 #define TAH_MR_DTFP     0x00100000
0067 #define TAH_MR_DIG      0x00080000
0068 
0069 #ifdef CONFIG_IBM_EMAC_TAH
0070 
0071 int tah_init(void);
0072 void tah_exit(void);
0073 int tah_attach(struct platform_device *ofdev, int channel);
0074 void tah_detach(struct platform_device *ofdev, int channel);
0075 void tah_reset(struct platform_device *ofdev);
0076 int tah_get_regs_len(struct platform_device *ofdev);
0077 void *tah_dump_regs(struct platform_device *ofdev, void *buf);
0078 
0079 #else
0080 
0081 # define tah_init()     0
0082 # define tah_exit()     do { } while(0)
0083 # define tah_attach(x,y)    (-ENXIO)
0084 # define tah_detach(x,y)    do { } while(0)
0085 # define tah_reset(x)       do { } while(0)
0086 # define tah_get_regs_len(x)    0
0087 # define tah_dump_regs(x,buf)   (buf)
0088 
0089 #endif              /* !CONFIG_IBM_EMAC_TAH */
0090 
0091 #endif /* __IBM_NEWEMAC_TAH_H */