Blame view

include/cpsw.h 2.36 KB
2b62997ce   Cyril Chemparathy   cpsw: add driver ...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
  /*
   * CPSW Ethernet Switch Driver
   *
   * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
   *
   * This program is free software; you can redistribute it and/or
   * modify it under the terms of the GNU General Public License as
   * published by the Free Software Foundation version 2.
   *
   * This program is distributed "as is" WITHOUT ANY WARRANTY of any
   * kind, whether express or implied; without even the implied warranty
   * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   * GNU General Public License for more details.
   */
  
  #ifndef _CPSW_H_
  #define _CPSW_H_
62f8e846a   Grygorii Strashko   net: ti: cpsw: co...
18
  #include <dm/ofnode.h>
0229c9330   Faiz Abbas   board: ti: am335x...
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
  /* reg offset */
  #define CPSW_HOST_PORT_OFFSET	0x108
  #define CPSW_SLAVE0_OFFSET	0x208
  #define CPSW_SLAVE1_OFFSET	0x308
  #define CPSW_SLAVE_SIZE		0x100
  #define CPSW_CPDMA_OFFSET	0x800
  #define CPSW_HW_STATS		0x900
  #define CPSW_STATERAM_OFFSET	0xa00
  #define CPSW_CPTS_OFFSET	0xc00
  #define CPSW_ALE_OFFSET		0xd00
  #define CPSW_SLIVER0_OFFSET	0xd80
  #define CPSW_SLIVER1_OFFSET	0xdc0
  #define CPSW_BD_OFFSET		0x2000
  #define CPSW_MDIO_DIV		0xff
  
  #define AM335X_GMII_SEL_OFFSET	0x630
2b62997ce   Cyril Chemparathy   cpsw: add driver ...
35
36
37
  struct cpsw_slave_data {
  	u32		slave_reg_ofs;
  	u32		sliver_reg_ofs;
9c653aad1   Mugunthan V N   drivers: net: cps...
38
  	int		phy_addr;
2b62997ce   Cyril Chemparathy   cpsw: add driver ...
39
  	int		phy_if;
62f8e846a   Grygorii Strashko   net: ti: cpsw: co...
40
  	ofnode		phy_of_handle;
3c57b620d   Grygorii Strashko   net: ti: cpsw: ad...
41
  	int		max_speed;
2b62997ce   Cyril Chemparathy   cpsw: add driver ...
42
43
44
45
46
47
48
49
50
51
  };
  
  enum {
  	CPSW_CTRL_VERSION_1 = 0,
  	CPSW_CTRL_VERSION_2	/* am33xx like devices */
  };
  
  struct cpsw_platform_data {
  	u32	mdio_base;
  	u32	cpsw_base;
4cc77895e   Mugunthan V N   drivers: net: cps...
52
53
  	u32	mac_id;
  	u32	gmii_sel;
2b62997ce   Cyril Chemparathy   cpsw: add driver ...
54
55
56
57
58
59
60
61
  	int	mdio_div;
  	int	channels;	/* number of cpdma channels (symmetric)	*/
  	u32	cpdma_reg_ofs;	/* cpdma register offset		*/
  	int	slaves;		/* number of slave cpgmac ports		*/
  	u32	ale_reg_ofs;	/* address lookup engine reg offset	*/
  	int	ale_entries;	/* ale table size			*/
  	u32	host_port_reg_ofs;	/* cpdma host port registers	*/
  	u32	hw_stats_reg_ofs;	/* cpsw hw stats counters	*/
2bf36ac63   Mugunthan V N   drivers: net: cps...
62
  	u32	bd_ram_ofs;		/* Buffer Descriptor RAM offset */
2b62997ce   Cyril Chemparathy   cpsw: add driver ...
63
64
65
66
  	u32	mac_control;
  	struct cpsw_slave_data	*slave_data;
  	void	(*control)(int enabled);
  	u32	host_port_num;
7a0227534   Mugunthan V N   drivers: net: cps...
67
  	u32	active_slave;
ab9715303   Mugunthan V N   driver: net: cpsw...
68
  	bool	rmii_clock_external;
2b62997ce   Cyril Chemparathy   cpsw: add driver ...
69
  	u8	version;
e50f878c9   Faiz Abbas   net: ti: cpsw: Mo...
70
  	const char *phy_sel_compat;
a58d222df   Faiz Abbas   net: ti: cpsw-com...
71
72
  	u32	syscon_addr;
  	const char *macid_sel_compat;
2b62997ce   Cyril Chemparathy   cpsw: add driver ...
73
74
75
  };
  
  int cpsw_register(struct cpsw_platform_data *data);
a58d222df   Faiz Abbas   net: ti: cpsw-com...
76
77
78
79
  int ti_cm_get_macid_addr(struct udevice *dev, int slave,
  			 struct cpsw_platform_data *data);
  void ti_cm_get_macid(struct udevice *dev, struct cpsw_platform_data *data,
  		     u8 *mac_addr);
e2597be5b   Sekhar Nori   drivers: net: cps...
80
  int cpsw_get_slave_phy_addr(struct udevice *dev, int slave);
2b62997ce   Cyril Chemparathy   cpsw: add driver ...
81
82
  
  #endif /* _CPSW_H_  */