1 /* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
13 #ifndef _EMAC_SGMII_H_
14 #define _EMAC_SGMII_H_
17 struct platform_device
;
19 /** emac_sgmii - internal emac phy
20 * @init initialization function
21 * @open called when the driver is opened
22 * @close called when the driver is closed
23 * @link_change called when the link state changes
26 int (*init
)(struct emac_adapter
*adpt
);
27 int (*open
)(struct emac_adapter
*adpt
);
28 void (*close
)(struct emac_adapter
*adpt
);
29 int (*link_change
)(struct emac_adapter
*adpt
, bool link_state
);
30 void (*reset
)(struct emac_adapter
*adpt
);
33 /** emac_sgmii - internal emac phy
35 * @digital per-lane digital block
36 * @irq the interrupt number
37 * @decode_error_count reference count of consecutive decode errors
38 * @sgmii_ops sgmii ops
42 void __iomem
*digital
;
44 atomic_t decode_error_count
;
45 struct sgmii_ops
*sgmii_ops
;
48 int emac_sgmii_config(struct platform_device
*pdev
, struct emac_adapter
*adpt
);
50 int emac_sgmii_init_fsm9900(struct emac_adapter
*adpt
);
51 int emac_sgmii_init_qdf2432(struct emac_adapter
*adpt
);
52 int emac_sgmii_init_qdf2400(struct emac_adapter
*adpt
);
54 int emac_sgmii_init(struct emac_adapter
*adpt
);
55 int emac_sgmii_open(struct emac_adapter
*adpt
);
56 void emac_sgmii_close(struct emac_adapter
*adpt
);
57 int emac_sgmii_link_change(struct emac_adapter
*adpt
, bool link_state
);
58 void emac_sgmii_reset(struct emac_adapter
*adpt
);