9fa47f91a9f2ae95f5bd2c784c154804014928ac
[platform/adaptation/renesas_rcar/renesas_kernel.git] / drivers / staging / et131x / et131x.h
1 /*
2  * Copyright © 2005 Agere Systems Inc.
3  * All rights reserved.
4  *   http://www.agere.com
5  *
6  * SOFTWARE LICENSE
7  *
8  * This software is provided subject to the following terms and conditions,
9  * which you should read carefully before using the software.  Using this
10  * software indicates your acceptance of these terms and conditions.  If you do
11  * not agree with these terms and conditions, do not use the software.
12  *
13  * Copyright © 2005 Agere Systems Inc.
14  * All rights reserved.
15  *
16  * Redistribution and use in source or binary forms, with or without
17  * modifications, are permitted provided that the following conditions are met:
18  *
19  * . Redistributions of source code must retain the above copyright notice, this
20  *    list of conditions and the following Disclaimer as comments in the code as
21  *    well as in the documentation and/or other materials provided with the
22  *    distribution.
23  *
24  * . Redistributions in binary form must reproduce the above copyright notice,
25  *    this list of conditions and the following Disclaimer in the documentation
26  *    and/or other materials provided with the distribution.
27  *
28  * . Neither the name of Agere Systems Inc. nor the names of the contributors
29  *    may be used to endorse or promote products derived from this software
30  *    without specific prior written permission.
31  *
32  * Disclaimer
33  *
34  * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
35  * INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF
36  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  ANY
37  * USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN
38  * RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY
39  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
40  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
41  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
42  * ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT
43  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
44  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
45  * DAMAGE.
46  *
47  */
48
49 #define DRIVER_NAME "et131x"
50 #define DRIVER_VERSION "v2.0"
51
52 /* EEPROM registers */
53
54 /* LBCIF Register Groups (addressed via 32-bit offsets) */
55 #define LBCIF_DWORD0_GROUP       0xAC
56 #define LBCIF_DWORD1_GROUP       0xB0
57
58 /* LBCIF Registers (addressed via 8-bit offsets) */
59 #define LBCIF_ADDRESS_REGISTER   0xAC
60 #define LBCIF_DATA_REGISTER      0xB0
61 #define LBCIF_CONTROL_REGISTER   0xB1
62 #define LBCIF_STATUS_REGISTER    0xB2
63
64 /* LBCIF Control Register Bits */
65 #define LBCIF_CONTROL_SEQUENTIAL_READ   0x01
66 #define LBCIF_CONTROL_PAGE_WRITE        0x02
67 #define LBCIF_CONTROL_EEPROM_RELOAD     0x08
68 #define LBCIF_CONTROL_TWO_BYTE_ADDR     0x20
69 #define LBCIF_CONTROL_I2C_WRITE         0x40
70 #define LBCIF_CONTROL_LBCIF_ENABLE      0x80
71
72 /* LBCIF Status Register Bits */
73 #define LBCIF_STATUS_PHY_QUEUE_AVAIL    0x01
74 #define LBCIF_STATUS_I2C_IDLE           0x02
75 #define LBCIF_STATUS_ACK_ERROR          0x04
76 #define LBCIF_STATUS_GENERAL_ERROR      0x08
77 #define LBCIF_STATUS_CHECKSUM_ERROR     0x40
78 #define LBCIF_STATUS_EEPROM_PRESENT     0x80
79
80 /* START OF GLOBAL REGISTER ADDRESS MAP */
81
82 /*
83  * 10bit registers
84  *
85  * Tx queue start address reg in global address map at address 0x0000
86  * tx queue end address reg in global address map at address 0x0004
87  * rx queue start address reg in global address map at address 0x0008
88  * rx queue end address reg in global address map at address 0x000C
89  */
90
91 /*
92  * structure for power management control status reg in global address map
93  * located at address 0x0010
94  *      jagcore_rx_rdy  bit 9
95  *      jagcore_tx_rdy  bit 8
96  *      phy_lped_en     bit 7
97  *      phy_sw_coma     bit 6
98  *      rxclk_gate      bit 5
99  *      txclk_gate      bit 4
100  *      sysclk_gate     bit 3
101  *      jagcore_rx_en   bit 2
102  *      jagcore_tx_en   bit 1
103  *      gigephy_en      bit 0
104  */
105
106 #define ET_PM_PHY_SW_COMA               0x40
107 #define ET_PMCSR_INIT                   0x38
108
109 /*
110  * Interrupt status reg at address 0x0018
111  */
112
113 #define ET_INTR_TXDMA_ISR       0x00000008
114 #define ET_INTR_TXDMA_ERR       0x00000010
115 #define ET_INTR_RXDMA_XFR_DONE  0x00000020
116 #define ET_INTR_RXDMA_FB_R0_LOW 0x00000040
117 #define ET_INTR_RXDMA_FB_R1_LOW 0x00000080
118 #define ET_INTR_RXDMA_STAT_LOW  0x00000100
119 #define ET_INTR_RXDMA_ERR       0x00000200
120 #define ET_INTR_WATCHDOG        0x00004000
121 #define ET_INTR_WOL             0x00008000
122 #define ET_INTR_PHY             0x00010000
123 #define ET_INTR_TXMAC           0x00020000
124 #define ET_INTR_RXMAC           0x00040000
125 #define ET_INTR_MAC_STAT        0x00080000
126 #define ET_INTR_SLV_TIMEOUT     0x00100000
127
128 /*
129  * Interrupt mask register at address 0x001C
130  * Interrupt alias clear mask reg at address 0x0020
131  * Interrupt status alias reg at address 0x0024
132  *
133  * Same masks as above
134  */
135
136 /*
137  * Software reset reg at address 0x0028
138  * 0:   txdma_sw_reset
139  * 1:   rxdma_sw_reset
140  * 2:   txmac_sw_reset
141  * 3:   rxmac_sw_reset
142  * 4:   mac_sw_reset
143  * 5:   mac_stat_sw_reset
144  * 6:   mmc_sw_reset
145  *31:   selfclr_disable
146  */
147
148 /*
149  * SLV Timer reg at address 0x002C (low 24 bits)
150  */
151
152 /*
153  * MSI Configuration reg at address 0x0030
154  */
155
156 #define ET_MSI_VECTOR   0x0000001F
157 #define ET_MSI_TC       0x00070000
158
159 /*
160  * Loopback reg located at address 0x0034
161  */
162
163 #define ET_LOOP_MAC     0x00000001
164 #define ET_LOOP_DMA     0x00000002
165
166 /*
167  * GLOBAL Module of JAGCore Address Mapping
168  * Located at address 0x0000
169  */
170 struct global_regs {                            /* Location: */
171         u32 txq_start_addr;                     /*  0x0000 */
172         u32 txq_end_addr;                       /*  0x0004 */
173         u32 rxq_start_addr;                     /*  0x0008 */
174         u32 rxq_end_addr;                       /*  0x000C */
175         u32 pm_csr;                             /*  0x0010 */
176         u32 unused;                             /*  0x0014 */
177         u32 int_status;                         /*  0x0018 */
178         u32 int_mask;                           /*  0x001C */
179         u32 int_alias_clr_en;                   /*  0x0020 */
180         u32 int_status_alias;                   /*  0x0024 */
181         u32 sw_reset;                           /*  0x0028 */
182         u32 slv_timer;                          /*  0x002C */
183         u32 msi_config;                         /*  0x0030 */
184         u32 loopback;                           /*  0x0034 */
185         u32 watchdog_timer;                     /*  0x0038 */
186 };
187
188
189 /* START OF TXDMA REGISTER ADDRESS MAP */
190
191 /*
192  * txdma control status reg at address 0x1000
193  */
194
195 #define ET_TXDMA_CSR_HALT       0x00000001
196 #define ET_TXDMA_DROP_TLP       0x00000002
197 #define ET_TXDMA_CACHE_THRS     0x000000F0
198 #define ET_TXDMA_CACHE_SHIFT    4
199 #define ET_TXDMA_SNGL_EPKT      0x00000100
200 #define ET_TXDMA_CLASS          0x00001E00
201
202 /*
203  * structure for txdma packet ring base address hi reg in txdma address map
204  * located at address 0x1004
205  * Defined earlier (u32)
206  */
207
208 /*
209  * structure for txdma packet ring base address low reg in txdma address map
210  * located at address 0x1008
211  * Defined earlier (u32)
212  */
213
214 /*
215  * structure for txdma packet ring number of descriptor reg in txdma address
216  * map.  Located at address 0x100C
217  *
218  * 31-10: unused
219  * 9-0: pr ndes
220  */
221
222 #define ET_DMA12_MASK           0x0FFF  /* 12 bit mask for DMA12W types */
223 #define ET_DMA12_WRAP           0x1000
224 #define ET_DMA10_MASK           0x03FF  /* 10 bit mask for DMA10W types */
225 #define ET_DMA10_WRAP           0x0400
226 #define ET_DMA4_MASK            0x000F  /* 4 bit mask for DMA4W types */
227 #define ET_DMA4_WRAP            0x0010
228
229 #define INDEX12(x)      ((x) & ET_DMA12_MASK)
230 #define INDEX10(x)      ((x) & ET_DMA10_MASK)
231 #define INDEX4(x)       ((x) & ET_DMA4_MASK)
232
233 /*
234  * 10bit DMA with wrap
235  * txdma tx queue write address reg in txdma address map at 0x1010
236  * txdma tx queue write address external reg in txdma address map at 0x1014
237  * txdma tx queue read address reg in txdma address map at 0x1018
238  *
239  * u32
240  * txdma status writeback address hi reg in txdma address map at0x101C
241  * txdma status writeback address lo reg in txdma address map at 0x1020
242  *
243  * 10bit DMA with wrap
244  * txdma service request reg in txdma address map at 0x1024
245  * structure for txdma service complete reg in txdma address map at 0x1028
246  *
247  * 4bit DMA with wrap
248  * txdma tx descriptor cache read index reg in txdma address map at 0x102C
249  * txdma tx descriptor cache write index reg in txdma address map at 0x1030
250  *
251  * txdma error reg in txdma address map at address 0x1034
252  * 0: PyldResend
253  * 1: PyldRewind
254  * 4: DescrResend
255  * 5: DescrRewind
256  * 8: WrbkResend
257  * 9: WrbkRewind
258  */
259
260 /*
261  * Tx DMA Module of JAGCore Address Mapping
262  * Located at address 0x1000
263  */
264 struct txdma_regs {                     /* Location: */
265         u32 csr;                        /*  0x1000 */
266         u32 pr_base_hi;                 /*  0x1004 */
267         u32 pr_base_lo;                 /*  0x1008 */
268         u32 pr_num_des;                 /*  0x100C */
269         u32 txq_wr_addr;                /*  0x1010 */
270         u32 txq_wr_addr_ext;            /*  0x1014 */
271         u32 txq_rd_addr;                /*  0x1018 */
272         u32 dma_wb_base_hi;             /*  0x101C */
273         u32 dma_wb_base_lo;             /*  0x1020 */
274         u32 service_request;            /*  0x1024 */
275         u32 service_complete;           /*  0x1028 */
276         u32 cache_rd_index;             /*  0x102C */
277         u32 cache_wr_index;             /*  0x1030 */
278         u32 tx_dma_error;               /*  0x1034 */
279         u32 desc_abort_cnt;             /*  0x1038 */
280         u32 payload_abort_cnt;          /*  0x103c */
281         u32 writeback_abort_cnt;        /*  0x1040 */
282         u32 desc_timeout_cnt;           /*  0x1044 */
283         u32 payload_timeout_cnt;        /*  0x1048 */
284         u32 writeback_timeout_cnt;      /*  0x104c */
285         u32 desc_error_cnt;             /*  0x1050 */
286         u32 payload_error_cnt;          /*  0x1054 */
287         u32 writeback_error_cnt;        /*  0x1058 */
288         u32 dropped_tlp_cnt;            /*  0x105c */
289         u32 new_service_complete;       /*  0x1060 */
290         u32 ethernet_packet_cnt;        /*  0x1064 */
291 };
292
293 /* END OF TXDMA REGISTER ADDRESS MAP */
294
295
296 /* START OF RXDMA REGISTER ADDRESS MAP */
297
298 /*
299  * structure for control status reg in rxdma address map
300  * Located at address 0x2000
301  *
302  * CSR
303  * 0: halt
304  * 1-3: tc
305  * 4: fbr_big_endian
306  * 5: psr_big_endian
307  * 6: pkt_big_endian
308  * 7: dma_big_endian
309  * 8-9: fbr0_size
310  * 10: fbr0_enable
311  * 11-12: fbr1_size
312  * 13: fbr1_enable
313  * 14: unused
314  * 15: pkt_drop_disable
315  * 16: pkt_done_flush
316  * 17: halt_status
317  * 18-31: unused
318  */
319
320 #define ET_RXDMA_CSR_HALT               0x0001
321 #define ET_RXDMA_CSR_FBR0_SIZE_LO       0x0100
322 #define ET_RXDMA_CSR_FBR0_SIZE_HI       0x0200
323 #define ET_RXDMA_CSR_FBR0_ENABLE        0x0400
324 #define ET_RXDMA_CSR_FBR1_SIZE_LO       0x0800
325 #define ET_RXDMA_CSR_FBR1_SIZE_HI       0x1000
326 #define ET_RXDMA_CSR_FBR1_ENABLE        0x2000
327 #define ET_RXDMA_CSR_HALT_STATUS        0x00020000
328
329 /*
330  * structure for dma writeback lo reg in rxdma address map
331  * located at address 0x2004
332  * Defined earlier (u32)
333  */
334
335 /*
336  * structure for dma writeback hi reg in rxdma address map
337  * located at address 0x2008
338  * Defined earlier (u32)
339  */
340
341 /*
342  * structure for number of packets done reg in rxdma address map
343  * located at address 0x200C
344  *
345  * 31-8: unused
346  * 7-0: num done
347  */
348
349 /*
350  * structure for max packet time reg in rxdma address map
351  * located at address 0x2010
352  *
353  * 31-18: unused
354  * 17-0: time done
355  */
356
357 /*
358  * structure for rx queue read address reg in rxdma address map
359  * located at address 0x2014
360  * Defined earlier (u32)
361  */
362
363 /*
364  * structure for rx queue read address external reg in rxdma address map
365  * located at address 0x2018
366  * Defined earlier (u32)
367  */
368
369 /*
370  * structure for rx queue write address reg in rxdma address map
371  * located at address 0x201C
372  * Defined earlier (u32)
373  */
374
375 /*
376  * structure for packet status ring base address lo reg in rxdma address map
377  * located at address 0x2020
378  * Defined earlier (u32)
379  */
380
381 /*
382  * structure for packet status ring base address hi reg in rxdma address map
383  * located at address 0x2024
384  * Defined earlier (u32)
385  */
386
387 /*
388  * structure for packet status ring number of descriptors reg in rxdma address
389  * map.  Located at address 0x2028
390  *
391  * 31-12: unused
392  * 11-0: psr ndes
393  */
394
395 /*
396  * structure for packet status ring available offset reg in rxdma address map
397  * located at address 0x202C
398  *
399  * 31-13: unused
400  * 12: psr avail wrap
401  * 11-0: psr avail
402  */
403
404 /*
405  * structure for packet status ring full offset reg in rxdma address map
406  * located at address 0x2030
407  *
408  * 31-13: unused
409  * 12: psr full wrap
410  * 11-0: psr full
411  */
412
413 /*
414  * structure for packet status ring access index reg in rxdma address map
415  * located at address 0x2034
416  *
417  * 31-5: unused
418  * 4-0: psr_ai
419  */
420
421 /*
422  * structure for packet status ring minimum descriptors reg in rxdma address
423  * map.  Located at address 0x2038
424  *
425  * 31-12: unused
426  * 11-0: psr_min
427  */
428
429 /*
430  * structure for free buffer ring base lo address reg in rxdma address map
431  * located at address 0x203C
432  * Defined earlier (u32)
433  */
434
435 /*
436  * structure for free buffer ring base hi address reg in rxdma address map
437  * located at address 0x2040
438  * Defined earlier (u32)
439  */
440
441 /*
442  * structure for free buffer ring number of descriptors reg in rxdma address
443  * map.  Located at address 0x2044
444  *
445  * 31-10: unused
446  * 9-0: fbr ndesc
447  */
448
449 /*
450  * structure for free buffer ring 0 available offset reg in rxdma address map
451  * located at address 0x2048
452  * Defined earlier (u32)
453  */
454
455 /*
456  * structure for free buffer ring 0 full offset reg in rxdma address map
457  * located at address 0x204C
458  * Defined earlier (u32)
459  */
460
461 /*
462  * structure for free buffer cache 0 full offset reg in rxdma address map
463  * located at address 0x2050
464  *
465  * 31-5: unused
466  * 4-0: fbc rdi
467  */
468
469 /*
470  * structure for free buffer ring 0 minimum descriptor reg in rxdma address map
471  * located at address 0x2054
472  *
473  * 31-10: unused
474  * 9-0: fbr min
475  */
476
477 /*
478  * structure for free buffer ring 1 base address lo reg in rxdma address map
479  * located at address 0x2058 - 0x205C
480  * Defined earlier (RXDMA_FBR_BASE_LO_t and RXDMA_FBR_BASE_HI_t)
481  */
482
483 /*
484  * structure for free buffer ring 1 number of descriptors reg in rxdma address
485  * map.  Located at address 0x2060
486  * Defined earlier (RXDMA_FBR_NUM_DES_t)
487  */
488
489 /*
490  * structure for free buffer ring 1 available offset reg in rxdma address map
491  * located at address 0x2064
492  * Defined Earlier (RXDMA_FBR_AVAIL_OFFSET_t)
493  */
494
495 /*
496  * structure for free buffer ring 1 full offset reg in rxdma address map
497  * located at address 0x2068
498  * Defined Earlier (RXDMA_FBR_FULL_OFFSET_t)
499  */
500
501 /*
502  * structure for free buffer cache 1 read index reg in rxdma address map
503  * located at address 0x206C
504  * Defined Earlier (RXDMA_FBC_RD_INDEX_t)
505  */
506
507 /*
508  * structure for free buffer ring 1 minimum descriptor reg in rxdma address map
509  * located at address 0x2070
510  * Defined Earlier (RXDMA_FBR_MIN_DES_t)
511  */
512
513 /*
514  * Rx DMA Module of JAGCore Address Mapping
515  * Located at address 0x2000
516  */
517 struct rxdma_regs {                                     /* Location: */
518         u32 csr;                                        /*  0x2000 */
519         u32 dma_wb_base_lo;                             /*  0x2004 */
520         u32 dma_wb_base_hi;                             /*  0x2008 */
521         u32 num_pkt_done;                               /*  0x200C */
522         u32 max_pkt_time;                               /*  0x2010 */
523         u32 rxq_rd_addr;                                /*  0x2014 */
524         u32 rxq_rd_addr_ext;                            /*  0x2018 */
525         u32 rxq_wr_addr;                                /*  0x201C */
526         u32 psr_base_lo;                                /*  0x2020 */
527         u32 psr_base_hi;                                /*  0x2024 */
528         u32 psr_num_des;                                /*  0x2028 */
529         u32 psr_avail_offset;                           /*  0x202C */
530         u32 psr_full_offset;                            /*  0x2030 */
531         u32 psr_access_index;                           /*  0x2034 */
532         u32 psr_min_des;                                /*  0x2038 */
533         u32 fbr0_base_lo;                               /*  0x203C */
534         u32 fbr0_base_hi;                               /*  0x2040 */
535         u32 fbr0_num_des;                               /*  0x2044 */
536         u32 fbr0_avail_offset;                          /*  0x2048 */
537         u32 fbr0_full_offset;                           /*  0x204C */
538         u32 fbr0_rd_index;                              /*  0x2050 */
539         u32 fbr0_min_des;                               /*  0x2054 */
540         u32 fbr1_base_lo;                               /*  0x2058 */
541         u32 fbr1_base_hi;                               /*  0x205C */
542         u32 fbr1_num_des;                               /*  0x2060 */
543         u32 fbr1_avail_offset;                          /*  0x2064 */
544         u32 fbr1_full_offset;                           /*  0x2068 */
545         u32 fbr1_rd_index;                              /*  0x206C */
546         u32 fbr1_min_des;                               /*  0x2070 */
547 };
548
549 /* END OF RXDMA REGISTER ADDRESS MAP */
550
551
552 /* START OF TXMAC REGISTER ADDRESS MAP */
553
554 /*
555  * structure for control reg in txmac address map
556  * located at address 0x3000
557  *
558  * bits
559  * 31-8: unused
560  * 7: cklseg_disable
561  * 6: ckbcnt_disable
562  * 5: cksegnum
563  * 4: async_disable
564  * 3: fc_disable
565  * 2: mcif_disable
566  * 1: mif_disable
567  * 0: txmac_en
568  */
569
570 /*
571  * structure for shadow pointer reg in txmac address map
572  * located at address 0x3004
573  * 31-27: reserved
574  * 26-16: txq rd ptr
575  * 15-11: reserved
576  * 10-0: txq wr ptr
577  */
578
579 /*
580  * structure for error count reg in txmac address map
581  * located at address 0x3008
582  *
583  * 31-12: unused
584  * 11-8: reserved
585  * 7-4: txq_underrun
586  * 3-0: fifo_underrun
587  */
588
589 /*
590  * structure for max fill reg in txmac address map
591  * located at address 0x300C
592  * 31-12: unused
593  * 11-0: max fill
594  */
595
596 /*
597  * structure for cf parameter reg in txmac address map
598  * located at address 0x3010
599  * 31-16: cfep
600  * 15-0: cfpt
601  */
602
603 /*
604  * structure for tx test reg in txmac address map
605  * located at address 0x3014
606  * 31-17: unused
607  * 16: reserved
608  * 15: txtest_en
609  * 14-11: unused
610  * 10-0: txq test pointer
611  */
612
613 /*
614  * structure for error reg in txmac address map
615  * located at address 0x3018
616  *
617  * 31-9: unused
618  * 8: fifo_underrun
619  * 7-6: unused
620  * 5: ctrl2_err
621  * 4: txq_underrun
622  * 3: bcnt_err
623  * 2: lseg_err
624  * 1: segnum_err
625  * 0: seg0_err
626  */
627
628 /*
629  * structure for error interrupt reg in txmac address map
630  * located at address 0x301C
631  *
632  * 31-9: unused
633  * 8: fifo_underrun
634  * 7-6: unused
635  * 5: ctrl2_err
636  * 4: txq_underrun
637  * 3: bcnt_err
638  * 2: lseg_err
639  * 1: segnum_err
640  * 0: seg0_err
641  */
642
643 /*
644  * structure for error interrupt reg in txmac address map
645  * located at address 0x3020
646  *
647  * 31-2: unused
648  * 1: bp_req
649  * 0: bp_xonxoff
650  */
651
652 /*
653  * Tx MAC Module of JAGCore Address Mapping
654  */
655 struct txmac_regs {                     /* Location: */
656         u32 ctl;                        /*  0x3000 */
657         u32 shadow_ptr;                 /*  0x3004 */
658         u32 err_cnt;                    /*  0x3008 */
659         u32 max_fill;                   /*  0x300C */
660         u32 cf_param;                   /*  0x3010 */
661         u32 tx_test;                    /*  0x3014 */
662         u32 err;                        /*  0x3018 */
663         u32 err_int;                    /*  0x301C */
664         u32 bp_ctrl;                    /*  0x3020 */
665 };
666
667 /* END OF TXMAC REGISTER ADDRESS MAP */
668
669 /* START OF RXMAC REGISTER ADDRESS MAP */
670
671 /*
672  * structure for rxmac control reg in rxmac address map
673  * located at address 0x4000
674  *
675  * 31-7: reserved
676  * 6: rxmac_int_disable
677  * 5: async_disable
678  * 4: mif_disable
679  * 3: wol_disable
680  * 2: pkt_filter_disable
681  * 1: mcif_disable
682  * 0: rxmac_en
683  */
684
685 /*
686  * structure for Wake On Lan Control and CRC 0 reg in rxmac address map
687  * located at address 0x4004
688  * 31-16: crc
689  * 15-12: reserved
690  * 11: ignore_pp
691  * 10: ignore_mp
692  * 9: clr_intr
693  * 8: ignore_link_chg
694  * 7: ignore_uni
695  * 6: ignore_multi
696  * 5: ignore_broad
697  * 4-0: valid_crc 4-0
698  */
699
700 /*
701  * structure for CRC 1 and CRC 2 reg in rxmac address map
702  * located at address 0x4008
703  *
704  * 31-16: crc2
705  * 15-0: crc1
706  */
707
708 /*
709  * structure for CRC 3 and CRC 4 reg in rxmac address map
710  * located at address 0x400C
711  *
712  * 31-16: crc4
713  * 15-0: crc3
714  */
715
716 /*
717  * structure for Wake On Lan Source Address Lo reg in rxmac address map
718  * located at address 0x4010
719  *
720  * 31-24: sa3
721  * 23-16: sa4
722  * 15-8: sa5
723  * 7-0: sa6
724  */
725
726 #define ET_WOL_LO_SA3_SHIFT 24
727 #define ET_WOL_LO_SA4_SHIFT 16
728 #define ET_WOL_LO_SA5_SHIFT 8
729
730 /*
731  * structure for Wake On Lan Source Address Hi reg in rxmac address map
732  * located at address 0x4014
733  *
734  * 31-16: reserved
735  * 15-8: sa1
736  * 7-0: sa2
737  */
738
739 #define ET_WOL_HI_SA1_SHIFT 8
740
741 /*
742  * structure for Wake On Lan mask reg in rxmac address map
743  * located at address 0x4018 - 0x4064
744  * Defined earlier (u32)
745  */
746
747 /*
748  * structure for Unicast Paket Filter Address 1 reg in rxmac address map
749  * located at address 0x4068
750  *
751  * 31-24: addr1_3
752  * 23-16: addr1_4
753  * 15-8: addr1_5
754  * 7-0: addr1_6
755  */
756
757 #define ET_UNI_PF_ADDR1_3_SHIFT 24
758 #define ET_UNI_PF_ADDR1_4_SHIFT 16
759 #define ET_UNI_PF_ADDR1_5_SHIFT 8
760
761 /*
762  * structure for Unicast Paket Filter Address 2 reg in rxmac address map
763  * located at address 0x406C
764  *
765  * 31-24: addr2_3
766  * 23-16: addr2_4
767  * 15-8: addr2_5
768  * 7-0: addr2_6
769  */
770
771 #define ET_UNI_PF_ADDR2_3_SHIFT 24
772 #define ET_UNI_PF_ADDR2_4_SHIFT 16
773 #define ET_UNI_PF_ADDR2_5_SHIFT 8
774
775 /*
776  * structure for Unicast Paket Filter Address 1 & 2 reg in rxmac address map
777  * located at address 0x4070
778  *
779  * 31-24: addr2_1
780  * 23-16: addr2_2
781  * 15-8: addr1_1
782  * 7-0: addr1_2
783  */
784
785 #define ET_UNI_PF_ADDR2_1_SHIFT 24
786 #define ET_UNI_PF_ADDR2_2_SHIFT 16
787 #define ET_UNI_PF_ADDR1_1_SHIFT 8
788
789
790 /*
791  * structure for Multicast Hash reg in rxmac address map
792  * located at address 0x4074 - 0x4080
793  * Defined earlier (u32)
794  */
795
796 /*
797  * structure for Packet Filter Control reg in rxmac address map
798  * located at address 0x4084
799  *
800  * 31-23: unused
801  * 22-16: min_pkt_size
802  * 15-4: unused
803  * 3: filter_frag_en
804  * 2: filter_uni_en
805  * 1: filter_multi_en
806  * 0: filter_broad_en
807  */
808
809 /*
810  * structure for Memory Controller Interface Control Max Segment reg in rxmac
811  * address map.  Located at address 0x4088
812  *
813  * 31-10: reserved
814  * 9-2: max_size
815  * 1: fc_en
816  * 0: seg_en
817  */
818
819 /*
820  * structure for Memory Controller Interface Water Mark reg in rxmac address
821  * map.  Located at address 0x408C
822  *
823  * 31-26: unused
824  * 25-16: mark_hi
825  * 15-10: unused
826  * 9-0: mark_lo
827  */
828
829 /*
830  * structure for Rx Queue Dialog reg in rxmac address map.
831  * located at address 0x4090
832  *
833  * 31-26: reserved
834  * 25-16: rd_ptr
835  * 15-10: reserved
836  * 9-0: wr_ptr
837  */
838
839 /*
840  * structure for space available reg in rxmac address map.
841  * located at address 0x4094
842  *
843  * 31-17: reserved
844  * 16: space_avail_en
845  * 15-10: reserved
846  * 9-0: space_avail
847  */
848
849 /*
850  * structure for management interface reg in rxmac address map.
851  * located at address 0x4098
852  *
853  * 31-18: reserved
854  * 17: drop_pkt_en
855  * 16-0: drop_pkt_mask
856  */
857
858 /*
859  * structure for Error reg in rxmac address map.
860  * located at address 0x409C
861  *
862  * 31-4: unused
863  * 3: mif
864  * 2: async
865  * 1: pkt_filter
866  * 0: mcif
867  */
868
869 /*
870  * Rx MAC Module of JAGCore Address Mapping
871  */
872 struct rxmac_regs {                                     /* Location: */
873         u32 ctrl;                                       /*  0x4000 */
874         u32 crc0;                                       /*  0x4004 */
875         u32 crc12;                                      /*  0x4008 */
876         u32 crc34;                                      /*  0x400C */
877         u32 sa_lo;                                      /*  0x4010 */
878         u32 sa_hi;                                      /*  0x4014 */
879         u32 mask0_word0;                                /*  0x4018 */
880         u32 mask0_word1;                                /*  0x401C */
881         u32 mask0_word2;                                /*  0x4020 */
882         u32 mask0_word3;                                /*  0x4024 */
883         u32 mask1_word0;                                /*  0x4028 */
884         u32 mask1_word1;                                /*  0x402C */
885         u32 mask1_word2;                                /*  0x4030 */
886         u32 mask1_word3;                                /*  0x4034 */
887         u32 mask2_word0;                                /*  0x4038 */
888         u32 mask2_word1;                                /*  0x403C */
889         u32 mask2_word2;                                /*  0x4040 */
890         u32 mask2_word3;                                /*  0x4044 */
891         u32 mask3_word0;                                /*  0x4048 */
892         u32 mask3_word1;                                /*  0x404C */
893         u32 mask3_word2;                                /*  0x4050 */
894         u32 mask3_word3;                                /*  0x4054 */
895         u32 mask4_word0;                                /*  0x4058 */
896         u32 mask4_word1;                                /*  0x405C */
897         u32 mask4_word2;                                /*  0x4060 */
898         u32 mask4_word3;                                /*  0x4064 */
899         u32 uni_pf_addr1;                               /*  0x4068 */
900         u32 uni_pf_addr2;                               /*  0x406C */
901         u32 uni_pf_addr3;                               /*  0x4070 */
902         u32 multi_hash1;                                /*  0x4074 */
903         u32 multi_hash2;                                /*  0x4078 */
904         u32 multi_hash3;                                /*  0x407C */
905         u32 multi_hash4;                                /*  0x4080 */
906         u32 pf_ctrl;                                    /*  0x4084 */
907         u32 mcif_ctrl_max_seg;                          /*  0x4088 */
908         u32 mcif_water_mark;                            /*  0x408C */
909         u32 rxq_diag;                                   /*  0x4090 */
910         u32 space_avail;                                /*  0x4094 */
911
912         u32 mif_ctrl;                                   /*  0x4098 */
913         u32 err_reg;                                    /*  0x409C */
914 };
915
916 /* END OF RXMAC REGISTER ADDRESS MAP */
917
918
919 /* START OF MAC REGISTER ADDRESS MAP */
920
921 /*
922  * structure for configuration #1 reg in mac address map.
923  * located at address 0x5000
924  *
925  * 31: soft reset
926  * 30: sim reset
927  * 29-20: reserved
928  * 19: reset rx mc
929  * 18: reset tx mc
930  * 17: reset rx func
931  * 16: reset tx fnc
932  * 15-9: reserved
933  * 8: loopback
934  * 7-6: reserved
935  * 5: rx flow
936  * 4: tx flow
937  * 3: syncd rx en
938  * 2: rx enable
939  * 1: syncd tx en
940  * 0: tx enable
941  */
942
943 #define CFG1_LOOPBACK   0x00000100
944 #define CFG1_RX_FLOW    0x00000020
945 #define CFG1_TX_FLOW    0x00000010
946 #define CFG1_RX_ENABLE  0x00000004
947 #define CFG1_TX_ENABLE  0x00000001
948 #define CFG1_WAIT       0x0000000A      /* RX & TX syncd */
949
950 /*
951  * structure for configuration #2 reg in mac address map.
952  * located at address 0x5004
953  * 31-16: reserved
954  * 15-12: preamble
955  * 11-10: reserved
956  * 9-8: if mode
957  * 7-6: reserved
958  * 5: huge frame
959  * 4: length check
960  * 3: undefined
961  * 2: pad crc
962  * 1: crc enable
963  * 0: full duplex
964  */
965
966
967 /*
968  * structure for Interpacket gap reg in mac address map.
969  * located at address 0x5008
970  *
971  * 31: reserved
972  * 30-24: non B2B ipg 1
973  * 23: undefined
974  * 22-16: non B2B ipg 2
975  * 15-8: Min ifg enforce
976  * 7-0: B2B ipg
977  *
978  * structure for half duplex reg in mac address map.
979  * located at address 0x500C
980  * 31-24: reserved
981  * 23-20: Alt BEB trunc
982  * 19: Alt BEB enable
983  * 18: BP no backoff
984  * 17: no backoff
985  * 16: excess defer
986  * 15-12: re-xmit max
987  * 11-10: reserved
988  * 9-0: collision window
989  */
990
991 /*
992  * structure for Maximum Frame Length reg in mac address map.
993  * located at address 0x5010: bits 0-15 hold the length.
994  */
995
996 /*
997  * structure for Reserve 1 reg in mac address map.
998  * located at address 0x5014 - 0x5018
999  * Defined earlier (u32)
1000  */
1001
1002 /*
1003  * structure for Test reg in mac address map.
1004  * located at address 0x501C
1005  * test: bits 0-2, rest unused
1006  */
1007
1008 /*
1009  * structure for MII Management Configuration reg in mac address map.
1010  * located at address 0x5020
1011  *
1012  * 31: reset MII mgmt
1013  * 30-6: unused
1014  * 5: scan auto increment
1015  * 4: preamble suppress
1016  * 3: undefined
1017  * 2-0: mgmt clock reset
1018  */
1019
1020 /*
1021  * structure for MII Management Command reg in mac address map.
1022  * located at address 0x5024
1023  * bit 1: scan cycle
1024  * bit 0: read cycle
1025  */
1026
1027 /*
1028  * structure for MII Management Address reg in mac address map.
1029  * located at address 0x5028
1030  * 31-13: reserved
1031  * 12-8: phy addr
1032  * 7-5: reserved
1033  * 4-0: register
1034  */
1035
1036 #define MII_ADDR(phy, reg)      ((phy) << 8 | (reg))
1037
1038 /*
1039  * structure for MII Management Control reg in mac address map.
1040  * located at address 0x502C
1041  * 31-16: reserved
1042  * 15-0: phy control
1043  */
1044
1045 /*
1046  * structure for MII Management Status reg in mac address map.
1047  * located at address 0x5030
1048  * 31-16: reserved
1049  * 15-0: phy control
1050  */
1051
1052 /*
1053  * structure for MII Management Indicators reg in mac address map.
1054  * located at address 0x5034
1055  * 31-3: reserved
1056  * 2: not valid
1057  * 1: scanning
1058  * 0: busy
1059  */
1060
1061 #define MGMT_BUSY       0x00000001      /* busy */
1062 #define MGMT_WAIT       0x00000005      /* busy | not valid */
1063
1064 /*
1065  * structure for Interface Control reg in mac address map.
1066  * located at address 0x5038
1067  *
1068  * 31: reset if module
1069  * 30-28: reserved
1070  * 27: tbi mode
1071  * 26: ghd mode
1072  * 25: lhd mode
1073  * 24: phy mode
1074  * 23: reset per mii
1075  * 22-17: reserved
1076  * 16: speed
1077  * 15: reset pe100x
1078  * 14-11: reserved
1079  * 10: force quiet
1080  * 9: no cipher
1081  * 8: disable link fail
1082  * 7: reset gpsi
1083  * 6-1: reserved
1084  * 0: enable jabber protection
1085  */
1086
1087 /*
1088  * structure for Interface Status reg in mac address map.
1089  * located at address 0x503C
1090  *
1091  * 31-10: reserved
1092  * 9: excess_defer
1093  * 8: clash
1094  * 7: phy_jabber
1095  * 6: phy_link_ok
1096  * 5: phy_full_duplex
1097  * 4: phy_speed
1098  * 3: pe100x_link_fail
1099  * 2: pe10t_loss_carrier
1100  * 1: pe10t_sqe_error
1101  * 0: pe10t_jabber
1102  */
1103
1104 /*
1105  * structure for Mac Station Address, Part 1 reg in mac address map.
1106  * located at address 0x5040
1107  *
1108  * 31-24: Octet6
1109  * 23-16: Octet5
1110  * 15-8: Octet4
1111  * 7-0: Octet3
1112  */
1113
1114 #define ET_MAC_STATION_ADDR1_OC6_SHIFT 24
1115 #define ET_MAC_STATION_ADDR1_OC5_SHIFT 16
1116 #define ET_MAC_STATION_ADDR1_OC4_SHIFT 8
1117
1118 /*
1119  * structure for Mac Station Address, Part 2 reg in mac address map.
1120  * located at address 0x5044
1121  *
1122  * 31-24: Octet2
1123  * 23-16: Octet1
1124  * 15-0: reserved
1125  */
1126
1127 #define ET_MAC_STATION_ADDR2_OC2_SHIFT 24
1128 #define ET_MAC_STATION_ADDR2_OC1_SHIFT 16
1129
1130 /*
1131  * MAC Module of JAGCore Address Mapping
1132  */
1133 struct mac_regs {                                       /* Location: */
1134         u32 cfg1;                                       /*  0x5000 */
1135         u32 cfg2;                                       /*  0x5004 */
1136         u32 ipg;                                        /*  0x5008 */
1137         u32 hfdp;                                       /*  0x500C */
1138         u32 max_fm_len;                                 /*  0x5010 */
1139         u32 rsv1;                                       /*  0x5014 */
1140         u32 rsv2;                                       /*  0x5018 */
1141         u32 mac_test;                                   /*  0x501C */
1142         u32 mii_mgmt_cfg;                               /*  0x5020 */
1143         u32 mii_mgmt_cmd;                               /*  0x5024 */
1144         u32 mii_mgmt_addr;                              /*  0x5028 */
1145         u32 mii_mgmt_ctrl;                              /*  0x502C */
1146         u32 mii_mgmt_stat;                              /*  0x5030 */
1147         u32 mii_mgmt_indicator;                         /*  0x5034 */
1148         u32 if_ctrl;                                    /*  0x5038 */
1149         u32 if_stat;                                    /*  0x503C */
1150         u32 station_addr_1;                             /*  0x5040 */
1151         u32 station_addr_2;                             /*  0x5044 */
1152 };
1153
1154 /* END OF MAC REGISTER ADDRESS MAP */
1155
1156 /* START OF MAC STAT REGISTER ADDRESS MAP */
1157
1158 /*
1159  * structure for Carry Register One and it's Mask Register reg located in mac
1160  * stat address map address 0x6130 and 0x6138.
1161  *
1162  * 31: tr64
1163  * 30: tr127
1164  * 29: tr255
1165  * 28: tr511
1166  * 27: tr1k
1167  * 26: trmax
1168  * 25: trmgv
1169  * 24-17: unused
1170  * 16: rbyt
1171  * 15: rpkt
1172  * 14: rfcs
1173  * 13: rmca
1174  * 12: rbca
1175  * 11: rxcf
1176  * 10: rxpf
1177  * 9: rxuo
1178  * 8: raln
1179  * 7: rflr
1180  * 6: rcde
1181  * 5: rcse
1182  * 4: rund
1183  * 3: rovr
1184  * 2: rfrg
1185  * 1: rjbr
1186  * 0: rdrp
1187  */
1188
1189 /*
1190  * structure for Carry Register Two Mask Register reg in mac stat address map.
1191  * located at address 0x613C
1192  *
1193  * 31-20: unused
1194  * 19: tjbr
1195  * 18: tfcs
1196  * 17: txcf
1197  * 16: tovr
1198  * 15: tund
1199  * 14: trfg
1200  * 13: tbyt
1201  * 12: tpkt
1202  * 11: tmca
1203  * 10: tbca
1204  * 9: txpf
1205  * 8: tdfr
1206  * 7: tedf
1207  * 6: tscl
1208  * 5: tmcl
1209  * 4: tlcl
1210  * 3: txcl
1211  * 2: tncl
1212  * 1: tpfh
1213  * 0: tdrp
1214  */
1215
1216 /*
1217  * MAC STATS Module of JAGCore Address Mapping
1218  */
1219 struct macstat_regs {                   /* Location: */
1220         u32 pad[32];                    /*  0x6000 - 607C */
1221
1222         /* Tx/Rx 0-64 Byte Frame Counter */
1223         u32 txrx_0_64_byte_frames;      /*  0x6080 */
1224
1225         /* Tx/Rx 65-127 Byte Frame Counter */
1226         u32 txrx_65_127_byte_frames;    /*  0x6084 */
1227
1228         /* Tx/Rx 128-255 Byte Frame Counter */
1229         u32 txrx_128_255_byte_frames;   /*  0x6088 */
1230
1231         /* Tx/Rx 256-511 Byte Frame Counter */
1232         u32 txrx_256_511_byte_frames;   /*  0x608C */
1233
1234         /* Tx/Rx 512-1023 Byte Frame Counter */
1235         u32 txrx_512_1023_byte_frames;  /*  0x6090 */
1236
1237         /* Tx/Rx 1024-1518 Byte Frame Counter */
1238         u32 txrx_1024_1518_byte_frames; /*  0x6094 */
1239
1240         /* Tx/Rx 1519-1522 Byte Good VLAN Frame Count */
1241         u32 txrx_1519_1522_gvln_frames; /*  0x6098 */
1242
1243         /* Rx Byte Counter */
1244         u32 rx_bytes;                   /*  0x609C */
1245
1246         /* Rx Packet Counter */
1247         u32 rx_packets;                 /*  0x60A0 */
1248
1249         /* Rx FCS Error Counter */
1250         u32 rx_fcs_errs;                /*  0x60A4 */
1251
1252         /* Rx Multicast Packet Counter */
1253         u32 rx_multicast_packets;       /*  0x60A8 */
1254
1255         /* Rx Broadcast Packet Counter */
1256         u32 rx_broadcast_packets;       /*  0x60AC */
1257
1258         /* Rx Control Frame Packet Counter */
1259         u32 rx_control_frames;          /*  0x60B0 */
1260
1261         /* Rx Pause Frame Packet Counter */
1262         u32 rx_pause_frames;            /*  0x60B4 */
1263
1264         /* Rx Unknown OP Code Counter */
1265         u32 rx_unknown_opcodes;         /*  0x60B8 */
1266
1267         /* Rx Alignment Error Counter */
1268         u32 rx_align_errs;              /*  0x60BC */
1269
1270         /* Rx Frame Length Error Counter */
1271         u32 rx_frame_len_errs;          /*  0x60C0 */
1272
1273         /* Rx Code Error Counter */
1274         u32 rx_code_errs;               /*  0x60C4 */
1275
1276         /* Rx Carrier Sense Error Counter */
1277         u32 rx_carrier_sense_errs;      /*  0x60C8 */
1278
1279         /* Rx Undersize Packet Counter */
1280         u32 rx_undersize_packets;       /*  0x60CC */
1281
1282         /* Rx Oversize Packet Counter */
1283         u32 rx_oversize_packets;        /*  0x60D0 */
1284
1285         /* Rx Fragment Counter */
1286         u32 rx_fragment_packets;        /*  0x60D4 */
1287
1288         /* Rx Jabber Counter */
1289         u32 rx_jabbers;                 /*  0x60D8 */
1290
1291         /* Rx Drop */
1292         u32 rx_drops;                   /*  0x60DC */
1293
1294         /* Tx Byte Counter */
1295         u32 tx_bytes;                   /*  0x60E0 */
1296
1297         /* Tx Packet Counter */
1298         u32 tx_packets;                 /*  0x60E4 */
1299
1300         /* Tx Multicast Packet Counter */
1301         u32 tx_multicast_packets;       /*  0x60E8 */
1302
1303         /* Tx Broadcast Packet Counter */
1304         u32 tx_broadcast_packets;       /*  0x60EC */
1305
1306         /* Tx Pause Control Frame Counter */
1307         u32 tx_pause_frames;            /*  0x60F0 */
1308
1309         /* Tx Deferral Packet Counter */
1310         u32 tx_deferred;                /*  0x60F4 */
1311
1312         /* Tx Excessive Deferral Packet Counter */
1313         u32 tx_excessive_deferred;      /*  0x60F8 */
1314
1315         /* Tx Single Collision Packet Counter */
1316         u32 tx_single_collisions;       /*  0x60FC */
1317
1318         /* Tx Multiple Collision Packet Counter */
1319         u32 tx_multiple_collisions;     /*  0x6100 */
1320
1321         /* Tx Late Collision Packet Counter */
1322         u32 tx_late_collisions;         /*  0x6104 */
1323
1324         /* Tx Excessive Collision Packet Counter */
1325         u32 tx_excessive_collisions;    /*  0x6108 */
1326
1327         /* Tx Total Collision Packet Counter */
1328         u32 tx_total_collisions;        /*  0x610C */
1329
1330         /* Tx Pause Frame Honored Counter */
1331         u32 tx_pause_honored_frames;    /*  0x6110 */
1332
1333         /* Tx Drop Frame Counter */
1334         u32 tx_drops;                   /*  0x6114 */
1335
1336         /* Tx Jabber Frame Counter */
1337         u32 tx_jabbers;                 /*  0x6118 */
1338
1339         /* Tx FCS Error Counter */
1340         u32 tx_fcs_errs;                /*  0x611C */
1341
1342         /* Tx Control Frame Counter */
1343         u32 tx_control_frames;          /*  0x6120 */
1344
1345         /* Tx Oversize Frame Counter */
1346         u32 tx_oversize_frames;         /*  0x6124 */
1347
1348         /* Tx Undersize Frame Counter */
1349         u32 tx_undersize_frames;        /*  0x6128 */
1350
1351         /* Tx Fragments Frame Counter */
1352         u32 tx_fragments;               /*  0x612C */
1353
1354         /* Carry Register One Register */
1355         u32 carry_reg1;                 /*  0x6130 */
1356
1357         /* Carry Register Two Register */
1358         u32 carry_reg2;                 /*  0x6134 */
1359
1360         /* Carry Register One Mask Register */
1361         u32 carry_reg1_mask;            /*  0x6138 */
1362
1363         /* Carry Register Two Mask Register */
1364         u32 carry_reg2_mask;            /*  0x613C */
1365 };
1366
1367 /* END OF MAC STAT REGISTER ADDRESS MAP */
1368
1369 /* START OF MMC REGISTER ADDRESS MAP */
1370
1371 /*
1372  * Main Memory Controller Control reg in mmc address map.
1373  * located at address 0x7000
1374  */
1375
1376 #define ET_MMC_ENABLE           1
1377 #define ET_MMC_ARB_DISABLE      2
1378 #define ET_MMC_RXMAC_DISABLE    4
1379 #define ET_MMC_TXMAC_DISABLE    8
1380 #define ET_MMC_TXDMA_DISABLE    16
1381 #define ET_MMC_RXDMA_DISABLE    32
1382 #define ET_MMC_FORCE_CE         64
1383
1384 /*
1385  * Main Memory Controller Host Memory Access Address reg in mmc
1386  * address map.  Located at address 0x7004. Top 16 bits hold the address bits
1387  */
1388
1389 #define ET_SRAM_REQ_ACCESS      1
1390 #define ET_SRAM_WR_ACCESS       2
1391 #define ET_SRAM_IS_CTRL         4
1392
1393 /*
1394  * structure for Main Memory Controller Host Memory Access Data reg in mmc
1395  * address map.  Located at address 0x7008 - 0x7014
1396  * Defined earlier (u32)
1397  */
1398
1399 /*
1400  * Memory Control Module of JAGCore Address Mapping
1401  */
1402 struct mmc_regs {               /* Location: */
1403         u32 mmc_ctrl;           /*  0x7000 */
1404         u32 sram_access;        /*  0x7004 */
1405         u32 sram_word1;         /*  0x7008 */
1406         u32 sram_word2;         /*  0x700C */
1407         u32 sram_word3;         /*  0x7010 */
1408         u32 sram_word4;         /*  0x7014 */
1409 };
1410
1411 /* END OF MMC REGISTER ADDRESS MAP */
1412
1413
1414 /*
1415  * JAGCore Address Mapping
1416  */
1417 struct address_map {
1418         struct global_regs global;
1419         /* unused section of global address map */
1420         u8 unused_global[4096 - sizeof(struct global_regs)];
1421         struct txdma_regs txdma;
1422         /* unused section of txdma address map */
1423         u8 unused_txdma[4096 - sizeof(struct txdma_regs)];
1424         struct rxdma_regs rxdma;
1425         /* unused section of rxdma address map */
1426         u8 unused_rxdma[4096 - sizeof(struct rxdma_regs)];
1427         struct txmac_regs txmac;
1428         /* unused section of txmac address map */
1429         u8 unused_txmac[4096 - sizeof(struct txmac_regs)];
1430         struct rxmac_regs rxmac;
1431         /* unused section of rxmac address map */
1432         u8 unused_rxmac[4096 - sizeof(struct rxmac_regs)];
1433         struct mac_regs mac;
1434         /* unused section of mac address map */
1435         u8 unused_mac[4096 - sizeof(struct mac_regs)];
1436         struct macstat_regs macstat;
1437         /* unused section of mac stat address map */
1438         u8 unused_mac_stat[4096 - sizeof(struct macstat_regs)];
1439         struct mmc_regs mmc;
1440         /* unused section of mmc address map */
1441         u8 unused_mmc[4096 - sizeof(struct mmc_regs)];
1442         /* unused section of address map */
1443         u8 unused_[1015808];
1444
1445         u8 unused_exp_rom[4096];        /* MGS-size TBD */
1446         u8 unused__[524288];    /* unused section of address map */
1447 };
1448
1449 /*
1450  * Defines for generic MII registers 0x00 -> 0x0F can be found in
1451  * include/linux/mii.h
1452  */
1453
1454 /* some defines for modem registers that seem to be 'reserved' */
1455 #define PHY_INDEX_REG              0x10
1456 #define PHY_DATA_REG               0x11
1457 #define PHY_MPHY_CONTROL_REG       0x12
1458
1459 /* defines for specified registers */
1460 #define PHY_LOOPBACK_CONTROL       0x13 /* TRU_VMI_LOOPBACK_CONTROL_1_REG 19 */
1461                                         /* TRU_VMI_LOOPBACK_CONTROL_2_REG 20 */
1462 #define PHY_REGISTER_MGMT_CONTROL  0x15 /* TRU_VMI_MI_SEQ_CONTROL_REG     21 */
1463 #define PHY_CONFIG                 0x16 /* TRU_VMI_CONFIGURATION_REG      22 */
1464 #define PHY_PHY_CONTROL            0x17 /* TRU_VMI_PHY_CONTROL_REG        23 */
1465 #define PHY_INTERRUPT_MASK         0x18 /* TRU_VMI_INTERRUPT_MASK_REG     24 */
1466 #define PHY_INTERRUPT_STATUS       0x19 /* TRU_VMI_INTERRUPT_STATUS_REG   25 */
1467 #define PHY_PHY_STATUS             0x1A /* TRU_VMI_PHY_STATUS_REG         26 */
1468 #define PHY_LED_1                  0x1B /* TRU_VMI_LED_CONTROL_1_REG      27 */
1469 #define PHY_LED_2                  0x1C /* TRU_VMI_LED_CONTROL_2_REG      28 */
1470                                         /* TRU_VMI_LINK_CONTROL_REG       29 */
1471                                         /* TRU_VMI_TIMING_CONTROL_REG        */
1472
1473 /* MI Register 10: Gigabit basic mode status reg(Reg 0x0A) */
1474 #define ET_1000BT_MSTR_SLV 0x4000
1475
1476 /* MI Register 16 - 18: Reserved Reg(0x10-0x12) */
1477
1478 /* MI Register 19: Loopback Control Reg(0x13)
1479  *      15:     mii_en
1480  *      14:     pcs_en
1481  *      13:     pmd_en
1482  *      12:     all_digital_en
1483  *      11:     replica_en
1484  *      10:     line_driver_en
1485  *      9-0:    reserved
1486  */
1487
1488 /* MI Register 20: Reserved Reg(0x14) */
1489
1490 /* MI Register 21: Management Interface Control Reg(0x15)
1491  *      15-11:  reserved
1492  *      10-4:   mi_error_count
1493  *      3:      reserved
1494  *      2:      ignore_10g_fr
1495  *      1:      reserved
1496  *      0:      preamble_suppress_en
1497  */
1498
1499 /* MI Register 22: PHY Configuration Reg(0x16)
1500  *      15:     crs_tx_en
1501  *      14:     reserved
1502  *      13-12:  tx_fifo_depth
1503  *      11-10:  speed_downshift
1504  *      9:      pbi_detect
1505  *      8:      tbi_rate
1506  *      7:      alternate_np
1507  *      6:      group_mdio_en
1508  *      5:      tx_clock_en
1509  *      4:      sys_clock_en
1510  *      3:      reserved
1511  *      2-0:    mac_if_mode
1512  */
1513
1514 #define ET_PHY_CONFIG_TX_FIFO_DEPTH     0x3000
1515
1516 #define ET_PHY_CONFIG_FIFO_DEPTH_8      0x0000
1517 #define ET_PHY_CONFIG_FIFO_DEPTH_16     0x1000
1518 #define ET_PHY_CONFIG_FIFO_DEPTH_32     0x2000
1519 #define ET_PHY_CONFIG_FIFO_DEPTH_64     0x3000
1520
1521 /* MI Register 23: PHY CONTROL Reg(0x17)
1522  *      15:     reserved
1523  *      14:     tdr_en
1524  *      13:     reserved
1525  *      12-11:  downshift_attempts
1526  *      10-6:   reserved
1527  *      5:      jabber_10baseT
1528  *      4:      sqe_10baseT
1529  *      3:      tp_loopback_10baseT
1530  *      2:      preamble_gen_en
1531  *      1:      reserved
1532  *      0:      force_int
1533  */
1534
1535 /* MI Register 24: Interrupt Mask Reg(0x18)
1536  *      15-10:  reserved
1537  *      9:      mdio_sync_lost
1538  *      8:      autoneg_status
1539  *      7:      hi_bit_err
1540  *      6:      np_rx
1541  *      5:      err_counter_full
1542  *      4:      fifo_over_underflow
1543  *      3:      rx_status
1544  *      2:      link_status
1545  *      1:      automatic_speed
1546  *      0:      int_en
1547  */
1548
1549 /* MI Register 25: Interrupt Status Reg(0x19)
1550  *      15-10:  reserved
1551  *      9:      mdio_sync_lost
1552  *      8:      autoneg_status
1553  *      7:      hi_bit_err
1554  *      6:      np_rx
1555  *      5:      err_counter_full
1556  *      4:      fifo_over_underflow
1557  *      3:      rx_status
1558  *      2:      link_status
1559  *      1:      automatic_speed
1560  *      0:      int_en
1561  */
1562
1563 /* MI Register 26: PHY Status Reg(0x1A)
1564  *      15:     reserved
1565  *      14-13:  autoneg_fault
1566  *      12:     autoneg_status
1567  *      11:     mdi_x_status
1568  *      10:     polarity_status
1569  *      9-8:    speed_status
1570  *      7:      duplex_status
1571  *      6:      link_status
1572  *      5:      tx_status
1573  *      4:      rx_status
1574  *      3:      collision_status
1575  *      2:      autoneg_en
1576  *      1:      pause_en
1577  *      0:      asymmetric_dir
1578  */
1579 #define ET_PHY_AUTONEG_STATUS   0x1000
1580 #define ET_PHY_POLARITY_STATUS  0x0400
1581 #define ET_PHY_SPEED_STATUS     0x0300
1582 #define ET_PHY_DUPLEX_STATUS    0x0080
1583 #define ET_PHY_LSTATUS          0x0040
1584 #define ET_PHY_AUTONEG_ENABLE   0x0020
1585
1586 /* MI Register 27: LED Control Reg 1(0x1B)
1587  *      15-14:  reserved
1588  *      13-12:  led_dup_indicate
1589  *      11-10:  led_10baseT
1590  *      9-8:    led_collision
1591  *      7-4:    reserved
1592  *      3-2:    pulse_dur
1593  *      1:      pulse_stretch1
1594  *      0:      pulse_stretch0
1595  */
1596
1597 /* MI Register 28: LED Control Reg 2(0x1C)
1598  *      15-12:  led_link
1599  *      11-8:   led_tx_rx
1600  *      7-4:    led_100BaseTX
1601  *      3-0:    led_1000BaseT
1602  */
1603 #define ET_LED2_LED_LINK        0xF000
1604 #define ET_LED2_LED_TXRX        0x0F00
1605 #define ET_LED2_LED_100TX       0x00F0
1606 #define ET_LED2_LED_1000T       0x000F
1607
1608 /* defines for LED control reg 2 values */
1609 #define LED_VAL_1000BT                  0x0
1610 #define LED_VAL_100BTX                  0x1
1611 #define LED_VAL_10BT                    0x2
1612 #define LED_VAL_1000BT_100BTX           0x3 /* 1000BT on, 100BTX blink */
1613 #define LED_VAL_LINKON                  0x4
1614 #define LED_VAL_TX                      0x5
1615 #define LED_VAL_RX                      0x6
1616 #define LED_VAL_TXRX                    0x7 /* TX or RX */
1617 #define LED_VAL_DUPLEXFULL              0x8
1618 #define LED_VAL_COLLISION               0x9
1619 #define LED_VAL_LINKON_ACTIVE           0xA /* Link on, activity blink */
1620 #define LED_VAL_LINKON_RECV             0xB /* Link on, receive blink */
1621 #define LED_VAL_DUPLEXFULL_COLLISION    0xC /* Duplex on, collision blink */
1622 #define LED_VAL_BLINK                   0xD
1623 #define LED_VAL_ON                      0xE
1624 #define LED_VAL_OFF                     0xF
1625
1626 #define LED_LINK_SHIFT                  12
1627 #define LED_TXRX_SHIFT                  8
1628 #define LED_100TX_SHIFT                 4
1629
1630 /* MI Register 29 - 31: Reserved Reg(0x1D - 0x1E) */
1631
1632 /* Defines for PHY access routines */
1633
1634 /* Define bit operation flags */
1635 #define TRUEPHY_BIT_CLEAR               0
1636 #define TRUEPHY_BIT_SET                 1
1637 #define TRUEPHY_BIT_READ                2
1638
1639 /* Define read/write operation flags */
1640 #ifndef TRUEPHY_READ
1641 #define TRUEPHY_READ                    0
1642 #define TRUEPHY_WRITE                   1
1643 #define TRUEPHY_MASK                    2
1644 #endif
1645
1646 /* Define master/slave configuration values */
1647 #define TRUEPHY_CFG_SLAVE               0
1648 #define TRUEPHY_CFG_MASTER              1
1649
1650 /* Define MDI/MDI-X settings */
1651 #define TRUEPHY_MDI                     0
1652 #define TRUEPHY_MDIX                    1
1653 #define TRUEPHY_AUTO_MDI_MDIX           2
1654
1655 /* Define 10Base-T link polarities */
1656 #define TRUEPHY_POLARITY_NORMAL         0
1657 #define TRUEPHY_POLARITY_INVERTED       1
1658
1659 /* Define auto-negotiation results */
1660 #define TRUEPHY_ANEG_NOT_COMPLETE       0
1661 #define TRUEPHY_ANEG_COMPLETE           1
1662 #define TRUEPHY_ANEG_DISABLED           2
1663
1664 /* Define duplex advertisement flags */
1665 #define TRUEPHY_ADV_DUPLEX_NONE         0x00
1666 #define TRUEPHY_ADV_DUPLEX_FULL         0x01
1667 #define TRUEPHY_ADV_DUPLEX_HALF         0x02
1668 #define TRUEPHY_ADV_DUPLEX_BOTH     \
1669         (TRUEPHY_ADV_DUPLEX_FULL | TRUEPHY_ADV_DUPLEX_HALF)
1670