xref: /openbmc/linux/drivers/net/ethernet/qualcomm/emac/emac-sgmii.h (revision 75bf465f0bc33e9b776a46d6a1b9b990f5fb7c37)
1*97fb5e8dSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
2b9b17debSTimur Tabi /* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
3b9b17debSTimur Tabi  */
4b9b17debSTimur Tabi 
5b9b17debSTimur Tabi #ifndef _EMAC_SGMII_H_
6b9b17debSTimur Tabi #define _EMAC_SGMII_H_
7b9b17debSTimur Tabi 
8b9b17debSTimur Tabi struct emac_adapter;
9b9b17debSTimur Tabi struct platform_device;
10b9b17debSTimur Tabi 
119e6881d3SHemanth Puranik /** emac_sgmii - internal emac phy
129e6881d3SHemanth Puranik  * @init initialization function
139e6881d3SHemanth Puranik  * @open called when the driver is opened
149e6881d3SHemanth Puranik  * @close called when the driver is closed
159e6881d3SHemanth Puranik  * @link_change called when the link state changes
169e6881d3SHemanth Puranik  */
179e6881d3SHemanth Puranik struct sgmii_ops {
189e6881d3SHemanth Puranik 	int (*init)(struct emac_adapter *adpt);
199e6881d3SHemanth Puranik 	int (*open)(struct emac_adapter *adpt);
209e6881d3SHemanth Puranik 	void (*close)(struct emac_adapter *adpt);
219e6881d3SHemanth Puranik 	int (*link_change)(struct emac_adapter *adpt, bool link_state);
229e6881d3SHemanth Puranik 	void (*reset)(struct emac_adapter *adpt);
239e6881d3SHemanth Puranik };
2441c1093fSTimur Tabi 
2541c1093fSTimur Tabi /** emac_sgmii - internal emac phy
2641c1093fSTimur Tabi  * @base base address
2741c1093fSTimur Tabi  * @digital per-lane digital block
28fd0e97b8STimur Tabi  * @irq the interrupt number
29fd0e97b8STimur Tabi  * @decode_error_count reference count of consecutive decode errors
309e6881d3SHemanth Puranik  * @sgmii_ops sgmii ops
3141c1093fSTimur Tabi  */
3241c1093fSTimur Tabi struct emac_sgmii {
3341c1093fSTimur Tabi 	void __iomem		*base;
3441c1093fSTimur Tabi 	void __iomem		*digital;
35fd0e97b8STimur Tabi 	unsigned int		irq;
36fd0e97b8STimur Tabi 	atomic_t		decode_error_count;
379e6881d3SHemanth Puranik 	struct	sgmii_ops	*sgmii_ops;
3841c1093fSTimur Tabi };
3941c1093fSTimur Tabi 
40b9b17debSTimur Tabi int emac_sgmii_config(struct platform_device *pdev, struct emac_adapter *adpt);
41b9b17debSTimur Tabi 
421e88ab6fSTimur Tabi int emac_sgmii_init_fsm9900(struct emac_adapter *adpt);
431e88ab6fSTimur Tabi int emac_sgmii_init_qdf2432(struct emac_adapter *adpt);
44a51f4047STimur Tabi int emac_sgmii_init_qdf2400(struct emac_adapter *adpt);
451e88ab6fSTimur Tabi 
469e6881d3SHemanth Puranik int emac_sgmii_init(struct emac_adapter *adpt);
479e6881d3SHemanth Puranik int emac_sgmii_open(struct emac_adapter *adpt);
489e6881d3SHemanth Puranik void emac_sgmii_close(struct emac_adapter *adpt);
499e6881d3SHemanth Puranik int emac_sgmii_link_change(struct emac_adapter *adpt, bool link_state);
509e6881d3SHemanth Puranik void emac_sgmii_reset(struct emac_adapter *adpt);
51b9b17debSTimur Tabi #endif
52