| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Alchemy Au1x00 ethernet driver include file | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Author: Pete Popov <ppopov@mvista.com> | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Copyright 2001 MontaVista Software Inc. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * ######################################################################## | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  *  This program is free software; you can distribute it and/or modify it | 
					
						
							|  |  |  |  *  under the terms of the GNU General Public License (Version 2) as | 
					
						
							|  |  |  |  *  published by the Free Software Foundation. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  *  This program is distributed in the hope it will be useful, but WITHOUT | 
					
						
							|  |  |  |  *  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | 
					
						
							|  |  |  |  *  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License | 
					
						
							|  |  |  |  *  for more details. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  *  You should have received a copy of the GNU General Public License along | 
					
						
							| 
									
										
										
										
											2013-12-06 06:28:43 -08:00
										 |  |  |  *  with this program; if not, see <http://www.gnu.org/licenses/>.
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  |  * | 
					
						
							|  |  |  |  * ######################################################################## | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2006-09-13 13:24:59 -04:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define MAC_IOSIZE 0x10000
 | 
					
						
							|  |  |  | #define NUM_RX_DMA 4       /* Au1x00 has 4 rx hardware descriptors */
 | 
					
						
							|  |  |  | #define NUM_TX_DMA 4       /* Au1x00 has 4 tx hardware descriptors */
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define NUM_RX_BUFFS 4
 | 
					
						
							|  |  |  | #define NUM_TX_BUFFS 4
 | 
					
						
							|  |  |  | #define MAX_BUF_SIZE 2048
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-04-06 22:09:06 +00:00
										 |  |  | #define ETH_TX_TIMEOUT (HZ/4)
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | #define MAC_MIN_PKT_SIZE 64
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define MULTICAST_FILTER_LIMIT 64
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-09-13 13:24:59 -04:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * Data Buffer Descriptor. Data buffers must be aligned on 32 byte | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  |  * boundary for both, receive and transmit. | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2010-09-08 11:11:25 +00:00
										 |  |  | struct db_dest { | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	struct db_dest *pnext; | 
					
						
							| 
									
										
										
										
											2010-09-08 11:15:13 +00:00
										 |  |  | 	u32 *vaddr; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	dma_addr_t dma_addr; | 
					
						
							| 
									
										
										
										
											2010-09-08 11:11:25 +00:00
										 |  |  | }; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | /*
 | 
					
						
							| 
									
										
										
										
											2006-09-13 13:24:59 -04:00
										 |  |  |  * The transmit and receive descriptors are memory | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  |  * mapped registers. | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2010-09-08 11:11:25 +00:00
										 |  |  | struct tx_dma { | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	u32 status; | 
					
						
							|  |  |  | 	u32 buff_stat; | 
					
						
							|  |  |  | 	u32 len; | 
					
						
							|  |  |  | 	u32 pad; | 
					
						
							| 
									
										
										
										
											2010-09-08 11:11:25 +00:00
										 |  |  | }; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-09-08 11:11:25 +00:00
										 |  |  | struct rx_dma { | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	u32 status; | 
					
						
							|  |  |  | 	u32 buff_stat; | 
					
						
							|  |  |  | 	u32 pad[2]; | 
					
						
							| 
									
										
										
										
											2010-09-08 11:11:25 +00:00
										 |  |  | }; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*
 | 
					
						
							|  |  |  |  * MAC control registers, memory mapped. | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2010-09-08 11:11:25 +00:00
										 |  |  | struct mac_reg { | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	u32 control; | 
					
						
							|  |  |  | 	u32 mac_addr_high; | 
					
						
							|  |  |  | 	u32 mac_addr_low; | 
					
						
							|  |  |  | 	u32 multi_hash_high; | 
					
						
							|  |  |  | 	u32 multi_hash_low; | 
					
						
							|  |  |  | 	u32 mii_control; | 
					
						
							|  |  |  | 	u32 mii_data; | 
					
						
							|  |  |  | 	u32 flow_control; | 
					
						
							|  |  |  | 	u32 vlan1_tag; | 
					
						
							|  |  |  | 	u32 vlan2_tag; | 
					
						
							| 
									
										
										
										
											2010-09-08 11:11:25 +00:00
										 |  |  | }; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | struct au1000_private { | 
					
						
							| 
									
										
										
										
											2010-09-08 11:11:25 +00:00
										 |  |  | 	struct db_dest *pDBfree; | 
					
						
							|  |  |  | 	struct db_dest db[NUM_RX_BUFFS+NUM_TX_BUFFS]; | 
					
						
							| 
									
										
										
										
											2010-09-08 11:15:13 +00:00
										 |  |  | 	struct rx_dma *rx_dma_ring[NUM_RX_DMA]; | 
					
						
							|  |  |  | 	struct tx_dma *tx_dma_ring[NUM_TX_DMA]; | 
					
						
							| 
									
										
										
										
											2010-09-08 11:11:25 +00:00
										 |  |  | 	struct db_dest *rx_db_inuse[NUM_RX_DMA]; | 
					
						
							|  |  |  | 	struct db_dest *tx_db_inuse[NUM_TX_DMA]; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	u32 rx_head; | 
					
						
							|  |  |  | 	u32 tx_head; | 
					
						
							|  |  |  | 	u32 tx_tail; | 
					
						
							|  |  |  | 	u32 tx_full; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	int mac_id; | 
					
						
							| 
									
										
										
										
											2006-06-01 09:41:04 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-09-08 11:11:40 +00:00
										 |  |  | 	int mac_enabled;       /* whether MAC is currently enabled and running
 | 
					
						
							| 
									
										
										
										
											2010-09-08 11:11:59 +00:00
										 |  |  | 				* (req. for mdio) | 
					
						
							|  |  |  | 				*/ | 
					
						
							| 
									
										
										
										
											2006-06-01 09:41:04 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	int old_link;          /* used by au1000_adjust_link */ | 
					
						
							|  |  |  | 	int old_speed; | 
					
						
							|  |  |  | 	int old_duplex; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	struct phy_device *phy_dev; | 
					
						
							| 
									
										
										
										
											2008-10-08 16:29:57 -07:00
										 |  |  | 	struct mii_bus *mii_bus; | 
					
						
							| 
									
										
										
										
											2006-09-13 13:24:59 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-10 01:13:38 +01:00
										 |  |  | 	/* PHY configuration */ | 
					
						
							|  |  |  | 	int phy_static_config; | 
					
						
							|  |  |  | 	int phy_search_highest_addr; | 
					
						
							|  |  |  | 	int phy1_search_mac0; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	int phy_addr; | 
					
						
							|  |  |  | 	int phy_busid; | 
					
						
							|  |  |  | 	int phy_irq; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-09-08 11:11:40 +00:00
										 |  |  | 	/* These variables are just for quick access
 | 
					
						
							| 
									
										
										
										
											2010-09-08 11:11:59 +00:00
										 |  |  | 	 * to certain regs addresses. | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2010-09-08 11:15:13 +00:00
										 |  |  | 	struct mac_reg *mac;  /* mac registers                      */ | 
					
						
							|  |  |  | 	u32 *enable;     /* address of MAC Enable Register     */ | 
					
						
							| 
									
										
										
										
											2011-08-02 19:50:57 +02:00
										 |  |  | 	void __iomem *macdma;	/* base of MAC DMA port */ | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	u32 vaddr;                /* virtual address of rx/tx buffers   */ | 
					
						
							|  |  |  | 	dma_addr_t dma_addr;      /* dma address of rx/tx buffers       */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	spinlock_t lock;       /* Serialise access to device */ | 
					
						
							| 
									
										
										
										
											2010-04-06 22:09:09 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	u32 msg_enable; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | }; |