xref: /linux/drivers/net/ethernet/qualcomm/emac/emac-sgmii.h (revision e58e871becec2d3b04ed91c0c16fe8deac9c9dfa)
1 /* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
2  *
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.
6  *
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.
11  */
12 
13 #ifndef _EMAC_SGMII_H_
14 #define _EMAC_SGMII_H_
15 
16 struct emac_adapter;
17 struct platform_device;
18 
19 typedef int (*emac_sgmii_function)(struct emac_adapter *adpt);
20 
21 /** emac_sgmii - internal emac phy
22  * @base base address
23  * @digital per-lane digital block
24  * @irq the interrupt number
25  * @decode_error_count reference count of consecutive decode errors
26  * @initialize initialization function
27  * @open called when the driver is opened
28  * @close called when the driver is closed
29  * @link_up called when the link comes up
30  * @link_down called when the link comes down
31  */
32 struct emac_sgmii {
33 	void __iomem		*base;
34 	void __iomem		*digital;
35 	unsigned int		irq;
36 	atomic_t		decode_error_count;
37 	emac_sgmii_function	initialize;
38 	emac_sgmii_function	open;
39 	emac_sgmii_function	close;
40 	emac_sgmii_function	link_up;
41 	emac_sgmii_function	link_down;
42 };
43 
44 int emac_sgmii_config(struct platform_device *pdev, struct emac_adapter *adpt);
45 void emac_sgmii_reset(struct emac_adapter *adpt);
46 
47 int emac_sgmii_init_fsm9900(struct emac_adapter *adpt);
48 int emac_sgmii_init_qdf2432(struct emac_adapter *adpt);
49 int emac_sgmii_init_qdf2400(struct emac_adapter *adpt);
50 
51 #endif
52