root/drivers/net/ethernet/ibm/emac/rgmii.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 /* SPDX-License-Identifier: GPL-2.0-or-later */
   2 /*
   3  * drivers/net/ethernet/ibm/emac/rgmii.h
   4  *
   5  * Driver for PowerPC 4xx on-chip ethernet controller, RGMII bridge 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  * Based on ocp_zmii.h/ibm_emac_zmii.h
  13  * Armin Kuster akuster@mvista.com
  14  *
  15  * Copyright 2004 MontaVista Software, Inc.
  16  * Matt Porter <mporter@kernel.crashing.org>
  17  *
  18  * Copyright (c) 2004, 2005 Zultys Technologies.
  19  * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>
  20  */
  21 
  22 #ifndef __IBM_NEWEMAC_RGMII_H
  23 #define __IBM_NEWEMAC_RGMII_H
  24 
  25 /* RGMII bridge type */
  26 #define RGMII_STANDARD          0
  27 #define RGMII_AXON              1
  28 
  29 /* RGMII bridge */
  30 struct rgmii_regs {
  31         u32 fer;                /* Function enable register */
  32         u32 ssr;                /* Speed select register */
  33 };
  34 
  35 /* RGMII device */
  36 struct rgmii_instance {
  37         struct rgmii_regs __iomem       *base;
  38 
  39         /* RGMII bridge flags */
  40         int                             flags;
  41 #define EMAC_RGMII_FLAG_HAS_MDIO        0x00000001
  42 
  43         /* Only one EMAC whacks us at a time */
  44         struct mutex                    lock;
  45 
  46         /* number of EMACs using this RGMII bridge */
  47         int                             users;
  48 
  49         /* OF device instance */
  50         struct platform_device          *ofdev;
  51 };
  52 
  53 #ifdef CONFIG_IBM_EMAC_RGMII
  54 
  55 int rgmii_init(void);
  56 void rgmii_exit(void);
  57 int rgmii_attach(struct platform_device *ofdev, int input, int mode);
  58 void rgmii_detach(struct platform_device *ofdev, int input);
  59 void rgmii_get_mdio(struct platform_device *ofdev, int input);
  60 void rgmii_put_mdio(struct platform_device *ofdev, int input);
  61 void rgmii_set_speed(struct platform_device *ofdev, int input, int speed);
  62 int rgmii_get_regs_len(struct platform_device *ofdev);
  63 void *rgmii_dump_regs(struct platform_device *ofdev, void *buf);
  64 
  65 #else
  66 
  67 # define rgmii_init()           0
  68 # define rgmii_exit()           do { } while(0)
  69 # define rgmii_attach(x,y,z)    (-ENXIO)
  70 # define rgmii_detach(x,y)      do { } while(0)
  71 # define rgmii_get_mdio(o,i)    do { } while (0)
  72 # define rgmii_put_mdio(o,i)    do { } while (0)
  73 # define rgmii_set_speed(x,y,z) do { } while(0)
  74 # define rgmii_get_regs_len(x)  0
  75 # define rgmii_dump_regs(x,buf) (buf)
  76 #endif                          /* !CONFIG_IBM_EMAC_RGMII */
  77 
  78 #endif /* __IBM_NEWEMAC_RGMII_H */

/* [<][>][^][v][top][bottom][index][help] */