xref: /linux/drivers/net/ethernet/qualcomm/emac/emac-sgmii.h (revision 0526b56cbc3c489642bd6a5fe4b718dea7ef0ee8)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
3  */
4 
5 #ifndef _EMAC_SGMII_H_
6 #define _EMAC_SGMII_H_
7 
8 struct emac_adapter;
9 struct platform_device;
10 
11 /** emac_sgmii - internal emac phy
12  * @init initialization function
13  * @open called when the driver is opened
14  * @close called when the driver is closed
15  * @link_change called when the link state changes
16  */
17 struct sgmii_ops {
18 	int (*init)(struct emac_adapter *adpt);
19 	int (*open)(struct emac_adapter *adpt);
20 	void (*close)(struct emac_adapter *adpt);
21 	int (*link_change)(struct emac_adapter *adpt, bool link_state);
22 	void (*reset)(struct emac_adapter *adpt);
23 };
24 
25 /** emac_sgmii - internal emac phy
26  * @base base address
27  * @digital per-lane digital block
28  * @irq the interrupt number
29  * @decode_error_count reference count of consecutive decode errors
30  * @sgmii_ops sgmii ops
31  */
32 struct emac_sgmii {
33 	void __iomem		*base;
34 	void __iomem		*digital;
35 	unsigned int		irq;
36 	atomic_t		decode_error_count;
37 	struct	sgmii_ops	*sgmii_ops;
38 };
39 
40 int emac_sgmii_config(struct platform_device *pdev, struct emac_adapter *adpt);
41 
42 int emac_sgmii_init_fsm9900(struct emac_adapter *adpt);
43 int emac_sgmii_init_qdf2432(struct emac_adapter *adpt);
44 int emac_sgmii_init_qdf2400(struct emac_adapter *adpt);
45 
46 int emac_sgmii_init(struct emac_adapter *adpt);
47 int emac_sgmii_open(struct emac_adapter *adpt);
48 void emac_sgmii_close(struct emac_adapter *adpt);
49 int emac_sgmii_link_change(struct emac_adapter *adpt, bool link_state);
50 void emac_sgmii_reset(struct emac_adapter *adpt);
51 #endif
52