Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
0003  */
0004 
0005 #ifndef _EMAC_SGMII_H_
0006 #define _EMAC_SGMII_H_
0007 
0008 struct emac_adapter;
0009 struct platform_device;
0010 
0011 /** emac_sgmii - internal emac phy
0012  * @init initialization function
0013  * @open called when the driver is opened
0014  * @close called when the driver is closed
0015  * @link_change called when the link state changes
0016  */
0017 struct sgmii_ops {
0018     int (*init)(struct emac_adapter *adpt);
0019     int (*open)(struct emac_adapter *adpt);
0020     void (*close)(struct emac_adapter *adpt);
0021     int (*link_change)(struct emac_adapter *adpt, bool link_state);
0022     void (*reset)(struct emac_adapter *adpt);
0023 };
0024 
0025 /** emac_sgmii - internal emac phy
0026  * @base base address
0027  * @digital per-lane digital block
0028  * @irq the interrupt number
0029  * @decode_error_count reference count of consecutive decode errors
0030  * @sgmii_ops sgmii ops
0031  */
0032 struct emac_sgmii {
0033     void __iomem        *base;
0034     void __iomem        *digital;
0035     unsigned int        irq;
0036     atomic_t        decode_error_count;
0037     struct  sgmii_ops   *sgmii_ops;
0038 };
0039 
0040 int emac_sgmii_config(struct platform_device *pdev, struct emac_adapter *adpt);
0041 
0042 int emac_sgmii_init_fsm9900(struct emac_adapter *adpt);
0043 int emac_sgmii_init_qdf2432(struct emac_adapter *adpt);
0044 int emac_sgmii_init_qdf2400(struct emac_adapter *adpt);
0045 
0046 int emac_sgmii_init(struct emac_adapter *adpt);
0047 int emac_sgmii_open(struct emac_adapter *adpt);
0048 void emac_sgmii_close(struct emac_adapter *adpt);
0049 int emac_sgmii_link_change(struct emac_adapter *adpt, bool link_state);
0050 void emac_sgmii_reset(struct emac_adapter *adpt);
0051 #endif