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; 24cb386227SDan Murphy int phy_of_handle; 252b62997cSCyril Chemparathy }; 262b62997cSCyril Chemparathy 272b62997cSCyril Chemparathy enum { 282b62997cSCyril Chemparathy CPSW_CTRL_VERSION_1 = 0, 292b62997cSCyril Chemparathy CPSW_CTRL_VERSION_2 /* am33xx like devices */ 302b62997cSCyril Chemparathy }; 312b62997cSCyril Chemparathy 322b62997cSCyril Chemparathy struct cpsw_platform_data { 332b62997cSCyril Chemparathy u32 mdio_base; 342b62997cSCyril Chemparathy u32 cpsw_base; 354cc77895SMugunthan V N u32 mac_id; 364cc77895SMugunthan V N u32 gmii_sel; 372b62997cSCyril Chemparathy int mdio_div; 382b62997cSCyril Chemparathy int channels; /* number of cpdma channels (symmetric) */ 392b62997cSCyril Chemparathy u32 cpdma_reg_ofs; /* cpdma register offset */ 402b62997cSCyril Chemparathy int slaves; /* number of slave cpgmac ports */ 412b62997cSCyril Chemparathy u32 ale_reg_ofs; /* address lookup engine reg offset */ 422b62997cSCyril Chemparathy int ale_entries; /* ale table size */ 432b62997cSCyril Chemparathy u32 host_port_reg_ofs; /* cpdma host port registers */ 442b62997cSCyril Chemparathy u32 hw_stats_reg_ofs; /* cpsw hw stats counters */ 452bf36ac6SMugunthan V N u32 bd_ram_ofs; /* Buffer Descriptor RAM offset */ 462b62997cSCyril Chemparathy u32 mac_control; 472b62997cSCyril Chemparathy struct cpsw_slave_data *slave_data; 482b62997cSCyril Chemparathy void (*control)(int enabled); 492b62997cSCyril Chemparathy u32 host_port_num; 507a022753SMugunthan V N u32 active_slave; 51ab971530SMugunthan V N bool rmii_clock_external; 522b62997cSCyril Chemparathy u8 version; 532b62997cSCyril Chemparathy }; 542b62997cSCyril Chemparathy 552b62997cSCyril Chemparathy int cpsw_register(struct cpsw_platform_data *data); 56e4310566SMugunthan V N int ti_cm_get_macid(struct udevice *dev, int slave, u8 *mac_addr); 57*e2597be5SSekhar Nori int cpsw_get_slave_phy_addr(struct udevice *dev, int slave); 582b62997cSCyril Chemparathy 592b62997cSCyril Chemparathy #endif /* _CPSW_H_ */ 60