Cyril Chemparathy | 2b62997 | 2012-07-24 12:22:16 +0000 | [diff] [blame] | 1 | /* |
| 2 | * CPSW Ethernet Switch Driver |
| 3 | * |
| 4 | * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU General Public License as |
| 8 | * published by the Free Software Foundation version 2. |
| 9 | * |
| 10 | * This program is distributed "as is" WITHOUT ANY WARRANTY of any |
| 11 | * kind, whether express or implied; without even the implied warranty |
| 12 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | */ |
| 15 | |
| 16 | #ifndef _CPSW_H_ |
| 17 | #define _CPSW_H_ |
| 18 | |
| 19 | struct cpsw_slave_data { |
| 20 | u32 slave_reg_ofs; |
| 21 | u32 sliver_reg_ofs; |
Mugunthan V N | 9c653aa | 2014-02-18 07:31:52 -0500 | [diff] [blame] | 22 | int phy_addr; |
Cyril Chemparathy | 2b62997 | 2012-07-24 12:22:16 +0000 | [diff] [blame] | 23 | int phy_if; |
Dan Murphy | cb38622 | 2016-05-02 15:45:56 -0500 | [diff] [blame] | 24 | int phy_of_handle; |
Cyril Chemparathy | 2b62997 | 2012-07-24 12:22:16 +0000 | [diff] [blame] | 25 | }; |
| 26 | |
| 27 | enum { |
| 28 | CPSW_CTRL_VERSION_1 = 0, |
| 29 | CPSW_CTRL_VERSION_2 /* am33xx like devices */ |
| 30 | }; |
| 31 | |
| 32 | struct cpsw_platform_data { |
| 33 | u32 mdio_base; |
| 34 | u32 cpsw_base; |
Mugunthan V N | 4cc7789 | 2015-09-07 14:22:21 +0530 | [diff] [blame] | 35 | u32 mac_id; |
| 36 | u32 gmii_sel; |
Cyril Chemparathy | 2b62997 | 2012-07-24 12:22:16 +0000 | [diff] [blame] | 37 | int mdio_div; |
| 38 | int channels; /* number of cpdma channels (symmetric) */ |
| 39 | u32 cpdma_reg_ofs; /* cpdma register offset */ |
| 40 | int slaves; /* number of slave cpgmac ports */ |
| 41 | u32 ale_reg_ofs; /* address lookup engine reg offset */ |
| 42 | int ale_entries; /* ale table size */ |
| 43 | u32 host_port_reg_ofs; /* cpdma host port registers */ |
| 44 | u32 hw_stats_reg_ofs; /* cpsw hw stats counters */ |
Mugunthan V N | 2bf36ac | 2013-07-08 16:04:37 +0530 | [diff] [blame] | 45 | u32 bd_ram_ofs; /* Buffer Descriptor RAM offset */ |
Cyril Chemparathy | 2b62997 | 2012-07-24 12:22:16 +0000 | [diff] [blame] | 46 | u32 mac_control; |
| 47 | struct cpsw_slave_data *slave_data; |
| 48 | void (*control)(int enabled); |
| 49 | u32 host_port_num; |
Mugunthan V N | 7a02275 | 2014-05-22 14:37:10 +0530 | [diff] [blame] | 50 | u32 active_slave; |
Mugunthan V N | ab97153 | 2016-10-13 19:33:38 +0530 | [diff] [blame] | 51 | bool rmii_clock_external; |
Cyril Chemparathy | 2b62997 | 2012-07-24 12:22:16 +0000 | [diff] [blame] | 52 | u8 version; |
| 53 | }; |
| 54 | |
| 55 | int cpsw_register(struct cpsw_platform_data *data); |
Mugunthan V N | e431056 | 2016-04-28 15:36:07 +0530 | [diff] [blame] | 56 | int ti_cm_get_macid(struct udevice *dev, int slave, u8 *mac_addr); |
Sekhar Nori | e2597be | 2018-08-23 17:11:29 +0530 | [diff] [blame] | 57 | int cpsw_get_slave_phy_addr(struct udevice *dev, int slave); |
Cyril Chemparathy | 2b62997 | 2012-07-24 12:22:16 +0000 | [diff] [blame] | 58 | |
| 59 | #endif /* _CPSW_H_ */ |