aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/include/asm/mach-bcm63xx
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/include/asm/mach-bcm63xx')
-rw-r--r--arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h7
-rw-r--r--arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h122
-rw-r--r--arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h93
-rw-r--r--arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h2
4 files changed, 214 insertions, 10 deletions
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h
index 22390a2a0661..19f9134bfe2f 100644
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h
@@ -187,7 +187,10 @@ enum bcm63xx_regs_set {
187#define BCM_6358_RSET_SPI_SIZE 1804 187#define BCM_6358_RSET_SPI_SIZE 1804
188#define BCM_6368_RSET_SPI_SIZE 1804 188#define BCM_6368_RSET_SPI_SIZE 1804
189#define RSET_ENET_SIZE 2048 189#define RSET_ENET_SIZE 2048
190#define RSET_ENETDMA_SIZE 2048 190#define RSET_ENETDMA_SIZE 256
191#define RSET_6345_ENETDMA_SIZE 64
192#define RSET_ENETDMAC_SIZE(chans) (16 * (chans))
193#define RSET_ENETDMAS_SIZE(chans) (16 * (chans))
191#define RSET_ENETSW_SIZE 65536 194#define RSET_ENETSW_SIZE 65536
192#define RSET_UART_SIZE 24 195#define RSET_UART_SIZE 24
193#define RSET_UDC_SIZE 256 196#define RSET_UDC_SIZE 256
@@ -361,7 +364,7 @@ enum bcm63xx_regs_set {
361#define BCM_6345_USBDMA_BASE (0xfffe2800) 364#define BCM_6345_USBDMA_BASE (0xfffe2800)
362#define BCM_6345_ENET0_BASE (0xfffe1800) 365#define BCM_6345_ENET0_BASE (0xfffe1800)
363#define BCM_6345_ENETDMA_BASE (0xfffe2800) 366#define BCM_6345_ENETDMA_BASE (0xfffe2800)
364#define BCM_6345_ENETDMAC_BASE (0xfffe2900) 367#define BCM_6345_ENETDMAC_BASE (0xfffe2840)
365#define BCM_6345_ENETDMAS_BASE (0xfffe2a00) 368#define BCM_6345_ENETDMAS_BASE (0xfffe2a00)
366#define BCM_6345_ENETSW_BASE (0xdeadbeef) 369#define BCM_6345_ENETSW_BASE (0xdeadbeef)
367#define BCM_6345_PCMCIA_BASE (0xfffe2028) 370#define BCM_6345_PCMCIA_BASE (0xfffe2028)
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h
index d53f611184b9..753953e86242 100644
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h
@@ -4,6 +4,8 @@
4#include <linux/if_ether.h> 4#include <linux/if_ether.h>
5#include <linux/init.h> 5#include <linux/init.h>
6 6
7#include <bcm63xx_regs.h>
8
7/* 9/*
8 * on board ethernet platform data 10 * on board ethernet platform data
9 */ 11 */
@@ -37,9 +39,129 @@ struct bcm63xx_enet_platform_data {
37 int phy_id, int reg), 39 int phy_id, int reg),
38 void (*mii_write)(struct net_device *dev, 40 void (*mii_write)(struct net_device *dev,
39 int phy_id, int reg, int val)); 41 int phy_id, int reg, int val));
42
43 /* DMA channel enable mask */
44 u32 dma_chan_en_mask;
45
46 /* DMA channel interrupt mask */
47 u32 dma_chan_int_mask;
48
49 /* DMA engine has internal SRAM */
50 bool dma_has_sram;
51
52 /* DMA channel register width */
53 unsigned int dma_chan_width;
54
55 /* DMA descriptor shift */
56 unsigned int dma_desc_shift;
57};
58
59/*
60 * on board ethernet switch platform data
61 */
62#define ENETSW_MAX_PORT 8
63#define ENETSW_PORTS_6328 5 /* 4 FE PHY + 1 RGMII */
64#define ENETSW_PORTS_6368 6 /* 4 FE PHY + 2 RGMII */
65
66#define ENETSW_RGMII_PORT0 4
67
68struct bcm63xx_enetsw_port {
69 int used;
70 int phy_id;
71
72 int bypass_link;
73 int force_speed;
74 int force_duplex_full;
75
76 const char *name;
77};
78
79struct bcm63xx_enetsw_platform_data {
80 char mac_addr[ETH_ALEN];
81 int num_ports;
82 struct bcm63xx_enetsw_port used_ports[ENETSW_MAX_PORT];
83
84 /* DMA channel enable mask */
85 u32 dma_chan_en_mask;
86
87 /* DMA channel interrupt mask */
88 u32 dma_chan_int_mask;
89
90 /* DMA channel register width */
91 unsigned int dma_chan_width;
92
93 /* DMA engine has internal SRAM */
94 bool dma_has_sram;
40}; 95};
41 96
42int __init bcm63xx_enet_register(int unit, 97int __init bcm63xx_enet_register(int unit,
43 const struct bcm63xx_enet_platform_data *pd); 98 const struct bcm63xx_enet_platform_data *pd);
44 99
100int bcm63xx_enetsw_register(const struct bcm63xx_enetsw_platform_data *pd);
101
102enum bcm63xx_regs_enetdmac {
103 ENETDMAC_CHANCFG,
104 ENETDMAC_IR,
105 ENETDMAC_IRMASK,
106 ENETDMAC_MAXBURST,
107 ENETDMAC_BUFALLOC,
108 ENETDMAC_RSTART,
109 ENETDMAC_FC,
110 ENETDMAC_LEN,
111};
112
113static inline unsigned long bcm63xx_enetdmacreg(enum bcm63xx_regs_enetdmac reg)
114{
115#ifdef BCMCPU_RUNTIME_DETECT
116 extern const unsigned long *bcm63xx_regs_enetdmac;
117
118 return bcm63xx_regs_enetdmac[reg];
119#else
120#ifdef CONFIG_BCM63XX_CPU_6345
121 switch (reg) {
122 case ENETDMAC_CHANCFG:
123 return ENETDMA_6345_CHANCFG_REG;
124 case ENETDMAC_IR:
125 return ENETDMA_6345_IR_REG;
126 case ENETDMAC_IRMASK:
127 return ENETDMA_6345_IRMASK_REG;
128 case ENETDMAC_MAXBURST:
129 return ENETDMA_6345_MAXBURST_REG;
130 case ENETDMAC_BUFALLOC:
131 return ENETDMA_6345_BUFALLOC_REG;
132 case ENETDMAC_RSTART:
133 return ENETDMA_6345_RSTART_REG;
134 case ENETDMAC_FC:
135 return ENETDMA_6345_FC_REG;
136 case ENETDMAC_LEN:
137 return ENETDMA_6345_LEN_REG;
138 }
139#endif
140#if defined(CONFIG_BCM63XX_CPU_6328) || \
141 defined(CONFIG_BCM63XX_CPU_6338) || \
142 defined(CONFIG_BCM63XX_CPU_6348) || \
143 defined(CONFIG_BCM63XX_CPU_6358) || \
144 defined(CONFIG_BCM63XX_CPU_6362) || \
145 defined(CONFIG_BCM63XX_CPU_6368)
146 switch (reg) {
147 case ENETDMAC_CHANCFG:
148 return ENETDMAC_CHANCFG_REG;
149 case ENETDMAC_IR:
150 return ENETDMAC_IR_REG;
151 case ENETDMAC_IRMASK:
152 return ENETDMAC_IRMASK_REG;
153 case ENETDMAC_MAXBURST:
154 return ENETDMAC_MAXBURST_REG;
155 case ENETDMAC_BUFALLOC:
156 case ENETDMAC_RSTART:
157 case ENETDMAC_FC:
158 case ENETDMAC_LEN:
159 return 0;
160 }
161#endif
162#endif
163 return 0;
164}
165
166
45#endif /* ! BCM63XX_DEV_ENET_H_ */ 167#endif /* ! BCM63XX_DEV_ENET_H_ */
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
index 018628fe6f15..9875db31d883 100644
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
@@ -770,6 +770,8 @@
770/************************************************************************* 770/*************************************************************************
771 * _REG relative to RSET_ENETDMA 771 * _REG relative to RSET_ENETDMA
772 *************************************************************************/ 772 *************************************************************************/
773#define ENETDMA_CHAN_WIDTH 0x10
774#define ENETDMA_6345_CHAN_WIDTH 0x40
773 775
774/* Controller Configuration Register */ 776/* Controller Configuration Register */
775#define ENETDMA_CFG_REG (0x0) 777#define ENETDMA_CFG_REG (0x0)
@@ -825,31 +827,56 @@
825/* State Ram Word 4 */ 827/* State Ram Word 4 */
826#define ENETDMA_SRAM4_REG(x) (0x20c + (x) * 0x10) 828#define ENETDMA_SRAM4_REG(x) (0x20c + (x) * 0x10)
827 829
830/* Broadcom 6345 ENET DMA definitions */
831#define ENETDMA_6345_CHANCFG_REG (0x00)
832
833#define ENETDMA_6345_MAXBURST_REG (0x40)
834
835#define ENETDMA_6345_RSTART_REG (0x08)
836
837#define ENETDMA_6345_LEN_REG (0x0C)
838
839#define ENETDMA_6345_IR_REG (0x14)
840
841#define ENETDMA_6345_IRMASK_REG (0x18)
842
843#define ENETDMA_6345_FC_REG (0x1C)
844
845#define ENETDMA_6345_BUFALLOC_REG (0x20)
846
847/* Shift down for EOP, SOP and WRAP bits */
848#define ENETDMA_6345_DESC_SHIFT (3)
828 849
829/************************************************************************* 850/*************************************************************************
830 * _REG relative to RSET_ENETDMAC 851 * _REG relative to RSET_ENETDMAC
831 *************************************************************************/ 852 *************************************************************************/
832 853
833/* Channel Configuration register */ 854/* Channel Configuration register */
834#define ENETDMAC_CHANCFG_REG(x) ((x) * 0x10) 855#define ENETDMAC_CHANCFG_REG (0x0)
835#define ENETDMAC_CHANCFG_EN_SHIFT 0 856#define ENETDMAC_CHANCFG_EN_SHIFT 0
836#define ENETDMAC_CHANCFG_EN_MASK (1 << ENETDMAC_CHANCFG_EN_SHIFT) 857#define ENETDMAC_CHANCFG_EN_MASK (1 << ENETDMAC_CHANCFG_EN_SHIFT)
837#define ENETDMAC_CHANCFG_PKTHALT_SHIFT 1 858#define ENETDMAC_CHANCFG_PKTHALT_SHIFT 1
838#define ENETDMAC_CHANCFG_PKTHALT_MASK (1 << ENETDMAC_CHANCFG_PKTHALT_SHIFT) 859#define ENETDMAC_CHANCFG_PKTHALT_MASK (1 << ENETDMAC_CHANCFG_PKTHALT_SHIFT)
839#define ENETDMAC_CHANCFG_BUFHALT_SHIFT 2 860#define ENETDMAC_CHANCFG_BUFHALT_SHIFT 2
840#define ENETDMAC_CHANCFG_BUFHALT_MASK (1 << ENETDMAC_CHANCFG_BUFHALT_SHIFT) 861#define ENETDMAC_CHANCFG_BUFHALT_MASK (1 << ENETDMAC_CHANCFG_BUFHALT_SHIFT)
862#define ENETDMAC_CHANCFG_CHAINING_SHIFT 2
863#define ENETDMAC_CHANCFG_CHAINING_MASK (1 << ENETDMAC_CHANCFG_CHAINING_SHIFT)
864#define ENETDMAC_CHANCFG_WRAP_EN_SHIFT 3
865#define ENETDMAC_CHANCFG_WRAP_EN_MASK (1 << ENETDMAC_CHANCFG_WRAP_EN_SHIFT)
866#define ENETDMAC_CHANCFG_FLOWC_EN_SHIFT 4
867#define ENETDMAC_CHANCFG_FLOWC_EN_MASK (1 << ENETDMAC_CHANCFG_FLOWC_EN_SHIFT)
841 868
842/* Interrupt Control/Status register */ 869/* Interrupt Control/Status register */
843#define ENETDMAC_IR_REG(x) (0x4 + (x) * 0x10) 870#define ENETDMAC_IR_REG (0x4)
844#define ENETDMAC_IR_BUFDONE_MASK (1 << 0) 871#define ENETDMAC_IR_BUFDONE_MASK (1 << 0)
845#define ENETDMAC_IR_PKTDONE_MASK (1 << 1) 872#define ENETDMAC_IR_PKTDONE_MASK (1 << 1)
846#define ENETDMAC_IR_NOTOWNER_MASK (1 << 2) 873#define ENETDMAC_IR_NOTOWNER_MASK (1 << 2)
847 874
848/* Interrupt Mask register */ 875/* Interrupt Mask register */
849#define ENETDMAC_IRMASK_REG(x) (0x8 + (x) * 0x10) 876#define ENETDMAC_IRMASK_REG (0x8)
850 877
851/* Maximum Burst Length */ 878/* Maximum Burst Length */
852#define ENETDMAC_MAXBURST_REG(x) (0xc + (x) * 0x10) 879#define ENETDMAC_MAXBURST_REG (0xc)
853 880
854 881
855/************************************************************************* 882/*************************************************************************
@@ -857,26 +884,76 @@
857 *************************************************************************/ 884 *************************************************************************/
858 885
859/* Ring Start Address register */ 886/* Ring Start Address register */
860#define ENETDMAS_RSTART_REG(x) ((x) * 0x10) 887#define ENETDMAS_RSTART_REG (0x0)
861 888
862/* State Ram Word 2 */ 889/* State Ram Word 2 */
863#define ENETDMAS_SRAM2_REG(x) (0x4 + (x) * 0x10) 890#define ENETDMAS_SRAM2_REG (0x4)
864 891
865/* State Ram Word 3 */ 892/* State Ram Word 3 */
866#define ENETDMAS_SRAM3_REG(x) (0x8 + (x) * 0x10) 893#define ENETDMAS_SRAM3_REG (0x8)
867 894
868/* State Ram Word 4 */ 895/* State Ram Word 4 */
869#define ENETDMAS_SRAM4_REG(x) (0xc + (x) * 0x10) 896#define ENETDMAS_SRAM4_REG (0xc)
870 897
871 898
872/************************************************************************* 899/*************************************************************************
873 * _REG relative to RSET_ENETSW 900 * _REG relative to RSET_ENETSW
874 *************************************************************************/ 901 *************************************************************************/
875 902
903/* Port traffic control */
904#define ENETSW_PTCTRL_REG(x) (0x0 + (x))
905#define ENETSW_PTCTRL_RXDIS_MASK (1 << 0)
906#define ENETSW_PTCTRL_TXDIS_MASK (1 << 1)
907
908/* Switch mode register */
909#define ENETSW_SWMODE_REG (0xb)
910#define ENETSW_SWMODE_FWD_EN_MASK (1 << 1)
911
912/* IMP override Register */
913#define ENETSW_IMPOV_REG (0xe)
914#define ENETSW_IMPOV_FORCE_MASK (1 << 7)
915#define ENETSW_IMPOV_TXFLOW_MASK (1 << 5)
916#define ENETSW_IMPOV_RXFLOW_MASK (1 << 4)
917#define ENETSW_IMPOV_1000_MASK (1 << 3)
918#define ENETSW_IMPOV_100_MASK (1 << 2)
919#define ENETSW_IMPOV_FDX_MASK (1 << 1)
920#define ENETSW_IMPOV_LINKUP_MASK (1 << 0)
921
922/* Port override Register */
923#define ENETSW_PORTOV_REG(x) (0x58 + (x))
924#define ENETSW_PORTOV_ENABLE_MASK (1 << 6)
925#define ENETSW_PORTOV_TXFLOW_MASK (1 << 5)
926#define ENETSW_PORTOV_RXFLOW_MASK (1 << 4)
927#define ENETSW_PORTOV_1000_MASK (1 << 3)
928#define ENETSW_PORTOV_100_MASK (1 << 2)
929#define ENETSW_PORTOV_FDX_MASK (1 << 1)
930#define ENETSW_PORTOV_LINKUP_MASK (1 << 0)
931
932/* MDIO control register */
933#define ENETSW_MDIOC_REG (0xb0)
934#define ENETSW_MDIOC_EXT_MASK (1 << 16)
935#define ENETSW_MDIOC_REG_SHIFT 20
936#define ENETSW_MDIOC_PHYID_SHIFT 25
937#define ENETSW_MDIOC_RD_MASK (1 << 30)
938#define ENETSW_MDIOC_WR_MASK (1 << 31)
939
940/* MDIO data register */
941#define ENETSW_MDIOD_REG (0xb4)
942
943/* Global Management Configuration Register */
944#define ENETSW_GMCR_REG (0x200)
945#define ENETSW_GMCR_RST_MIB_MASK (1 << 0)
946
876/* MIB register */ 947/* MIB register */
877#define ENETSW_MIB_REG(x) (0x2800 + (x) * 4) 948#define ENETSW_MIB_REG(x) (0x2800 + (x) * 4)
878#define ENETSW_MIB_REG_COUNT 47 949#define ENETSW_MIB_REG_COUNT 47
879 950
951/* Jumbo control register port mask register */
952#define ENETSW_JMBCTL_PORT_REG (0x4004)
953
954/* Jumbo control mib good frame register */
955#define ENETSW_JMBCTL_MAXSIZE_REG (0x4008)
956
880 957
881/************************************************************************* 958/*************************************************************************
882 * _REG relative to RSET_OHCI_PRIV 959 * _REG relative to RSET_OHCI_PRIV
diff --git a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
index 5981fe0c3dfb..b86a0efba665 100644
--- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
+++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
@@ -24,6 +24,7 @@ struct board_info {
24 /* enabled feature/device */ 24 /* enabled feature/device */
25 unsigned int has_enet0:1; 25 unsigned int has_enet0:1;
26 unsigned int has_enet1:1; 26 unsigned int has_enet1:1;
27 unsigned int has_enetsw:1;
27 unsigned int has_pci:1; 28 unsigned int has_pci:1;
28 unsigned int has_pccard:1; 29 unsigned int has_pccard:1;
29 unsigned int has_ohci0:1; 30 unsigned int has_ohci0:1;
@@ -36,6 +37,7 @@ struct board_info {
36 /* ethernet config */ 37 /* ethernet config */
37 struct bcm63xx_enet_platform_data enet0; 38 struct bcm63xx_enet_platform_data enet0;
38 struct bcm63xx_enet_platform_data enet1; 39 struct bcm63xx_enet_platform_data enet1;
40 struct bcm63xx_enetsw_platform_data enetsw;
39 41
40 /* USB config */ 42 /* USB config */
41 struct bcm63xx_usbd_platform_data usbd; 43 struct bcm63xx_usbd_platform_data usbd;