xref: /rk3399_rockchip-uboot/include/cpsw.h (revision 4cc77895eb03ebe16f13910bd85a68f24e432636)
12b62997cSCyril Chemparathy /*
22b62997cSCyril Chemparathy  * CPSW Ethernet Switch Driver
32b62997cSCyril Chemparathy  *
42b62997cSCyril Chemparathy  * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
52b62997cSCyril Chemparathy  *
62b62997cSCyril Chemparathy  * This program is free software; you can redistribute it and/or
72b62997cSCyril Chemparathy  * modify it under the terms of the GNU General Public License as
82b62997cSCyril Chemparathy  * published by the Free Software Foundation version 2.
92b62997cSCyril Chemparathy  *
102b62997cSCyril Chemparathy  * This program is distributed "as is" WITHOUT ANY WARRANTY of any
112b62997cSCyril Chemparathy  * kind, whether express or implied; without even the implied warranty
122b62997cSCyril Chemparathy  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
132b62997cSCyril Chemparathy  * GNU General Public License for more details.
142b62997cSCyril Chemparathy  */
152b62997cSCyril Chemparathy 
162b62997cSCyril Chemparathy #ifndef _CPSW_H_
172b62997cSCyril Chemparathy #define _CPSW_H_
182b62997cSCyril Chemparathy 
192b62997cSCyril Chemparathy struct cpsw_slave_data {
202b62997cSCyril Chemparathy 	u32		slave_reg_ofs;
212b62997cSCyril Chemparathy 	u32		sliver_reg_ofs;
229c653aadSMugunthan V N 	int		phy_addr;
232b62997cSCyril Chemparathy 	int		phy_if;
242b62997cSCyril Chemparathy };
252b62997cSCyril Chemparathy 
262b62997cSCyril Chemparathy enum {
272b62997cSCyril Chemparathy 	CPSW_CTRL_VERSION_1 = 0,
282b62997cSCyril Chemparathy 	CPSW_CTRL_VERSION_2	/* am33xx like devices */
292b62997cSCyril Chemparathy };
302b62997cSCyril Chemparathy 
312b62997cSCyril Chemparathy struct cpsw_platform_data {
322b62997cSCyril Chemparathy 	u32	mdio_base;
332b62997cSCyril Chemparathy 	u32	cpsw_base;
34*4cc77895SMugunthan V N 	u32	mac_id;
35*4cc77895SMugunthan V N 	u32	gmii_sel;
362b62997cSCyril Chemparathy 	int	mdio_div;
372b62997cSCyril Chemparathy 	int	channels;	/* number of cpdma channels (symmetric)	*/
382b62997cSCyril Chemparathy 	u32	cpdma_reg_ofs;	/* cpdma register offset		*/
392b62997cSCyril Chemparathy 	int	slaves;		/* number of slave cpgmac ports		*/
402b62997cSCyril Chemparathy 	u32	ale_reg_ofs;	/* address lookup engine reg offset	*/
412b62997cSCyril Chemparathy 	int	ale_entries;	/* ale table size			*/
422b62997cSCyril Chemparathy 	u32	host_port_reg_ofs;	/* cpdma host port registers	*/
432b62997cSCyril Chemparathy 	u32	hw_stats_reg_ofs;	/* cpsw hw stats counters	*/
442bf36ac6SMugunthan V N 	u32	bd_ram_ofs;		/* Buffer Descriptor RAM offset */
452b62997cSCyril Chemparathy 	u32	mac_control;
462b62997cSCyril Chemparathy 	struct cpsw_slave_data	*slave_data;
472b62997cSCyril Chemparathy 	void	(*control)(int enabled);
482b62997cSCyril Chemparathy 	u32	host_port_num;
497a022753SMugunthan V N 	u32	active_slave;
502b62997cSCyril Chemparathy 	u8	version;
512b62997cSCyril Chemparathy };
522b62997cSCyril Chemparathy 
532b62997cSCyril Chemparathy int cpsw_register(struct cpsw_platform_data *data);
542b62997cSCyril Chemparathy 
552b62997cSCyril Chemparathy #endif /* _CPSW_H_  */
56