1 | # |
---|
2 | # $Id$ |
---|
3 | # |
---|
4 | |
---|
5 | This SONIC driver does not make any attempt to support the SONIC chip |
---|
6 | in any of the following modes: |
---|
7 | |
---|
8 | + 16-bit |
---|
9 | + little endian |
---|
10 | |
---|
11 | It does not attempt to handle SONIC's older than Revision C. There is |
---|
12 | a bug in chips before that revision that must be handled in the driver. |
---|
13 | |
---|
14 | The configuration table should be discussed here but if you look in the |
---|
15 | include file for the sonic, it is reasonably obvious. :) |
---|
16 | |
---|
17 | The performance impact of transforming this driver into libchip format |
---|
18 | was minimal. |
---|
19 | |
---|
20 | The powerpc/dmv177 BSP used this driver and the following should |
---|
21 | serve as an example configuration table. This BSP was obsoleted after |
---|
22 | the 4.6 release series so the code is included here. |
---|
23 | |
---|
24 | ====================================================================== |
---|
25 | |
---|
26 | /* |
---|
27 | * DMV177 SONIC Configuration Information |
---|
28 | * |
---|
29 | * References: |
---|
30 | * |
---|
31 | * 1) SVME/DMV-171 Single Board Computer Documentation Package, #805905, |
---|
32 | * DY 4 Systems Inc., Kanata, Ontario, September, 1996. |
---|
33 | * |
---|
34 | * $Id$ |
---|
35 | */ |
---|
36 | |
---|
37 | #include <bsp.h> |
---|
38 | #include <rtems/rtems_bsdnet.h> |
---|
39 | #include <libchip/sonic.h> |
---|
40 | |
---|
41 | void dmv177_sonic_write_register( |
---|
42 | void *base, |
---|
43 | unsigned32 regno, |
---|
44 | unsigned32 value |
---|
45 | ) |
---|
46 | { |
---|
47 | volatile unsigned32 *p = base; |
---|
48 | |
---|
49 | #if (SONIC_DEBUG & SONIC_DEBUG_PRINT_REGISTERS) |
---|
50 | printf( "%p Write 0x%04x to %s (0x%02x)\n", |
---|
51 | &p[regno], value, SONIC_Reg_name[regno], regno ); |
---|
52 | fflush( stdout ); |
---|
53 | #endif |
---|
54 | p[regno] = value; |
---|
55 | } |
---|
56 | |
---|
57 | unsigned32 dmv177_sonic_read_register( |
---|
58 | void *base, |
---|
59 | unsigned32 regno |
---|
60 | ) |
---|
61 | { |
---|
62 | volatile unsigned32 *p = base; |
---|
63 | unsigned32 value; |
---|
64 | |
---|
65 | value = p[regno]; |
---|
66 | #if (SONIC_DEBUG & SONIC_DEBUG_PRINT_REGISTERS) |
---|
67 | printf( "%p Read 0x%04x from %s (0x%02x)\n", |
---|
68 | &p[regno], value, SONIC_Reg_name[regno], regno ); |
---|
69 | fflush( stdout ); |
---|
70 | #endif |
---|
71 | return value; |
---|
72 | } |
---|
73 | |
---|
74 | /* |
---|
75 | * Default sizes of transmit and receive descriptor areas |
---|
76 | */ |
---|
77 | #define RDA_COUNT 20 /* 20 */ |
---|
78 | #define TDA_COUNT 20 /* 10 */ |
---|
79 | |
---|
80 | /* |
---|
81 | * Default device configuration register values |
---|
82 | * Conservative, generic values. |
---|
83 | * DCR: |
---|
84 | * No extended bus mode |
---|
85 | * Unlatched bus retry |
---|
86 | * Programmable outputs unused |
---|
87 | * Asynchronous bus mode |
---|
88 | * User definable pins unused |
---|
89 | * No wait states (access time controlled by DTACK*) |
---|
90 | * 32-bit DMA |
---|
91 | * Empty/Fill DMA mode |
---|
92 | * Maximum Transmit/Receive FIFO |
---|
93 | * DC2: |
---|
94 | * Extended programmable outputs unused |
---|
95 | * Normal HOLD request |
---|
96 | * Packet compress output unused |
---|
97 | * No reject on CAM match |
---|
98 | */ |
---|
99 | #define SONIC_DCR \ |
---|
100 | (DCR_DW32 | DCR_WAIT0 | DCR_PO0 | DCR_PO1 | DCR_RFT24 | DCR_TFT28) |
---|
101 | #ifndef SONIC_DCR |
---|
102 | # define SONIC_DCR (DCR_DW32 | DCR_TFT28) |
---|
103 | #endif |
---|
104 | #ifndef SONIC_DC2 |
---|
105 | # define SONIC_DC2 (0) |
---|
106 | #endif |
---|
107 | |
---|
108 | /* |
---|
109 | * Default location of device registers |
---|
110 | */ |
---|
111 | #ifndef SONIC_BASE_ADDRESS |
---|
112 | # define SONIC_BASE_ADDRESS 0xF3000000 |
---|
113 | # warning "Using default SONIC_BASE_ADDRESS." |
---|
114 | #endif |
---|
115 | |
---|
116 | /* |
---|
117 | * Default interrupt vector |
---|
118 | */ |
---|
119 | #ifndef SONIC_VECTOR |
---|
120 | # define SONIC_VECTOR 1 |
---|
121 | # warning "Using default SONIC_VECTOR." |
---|
122 | #endif |
---|
123 | |
---|
124 | sonic_configuration_t dmv177_sonic_configuration = { |
---|
125 | SONIC_BASE_ADDRESS, /* base address */ |
---|
126 | SONIC_VECTOR, /* vector number */ |
---|
127 | SONIC_DCR, /* DCR register value */ |
---|
128 | SONIC_DC2, /* DC2 register value */ |
---|
129 | TDA_COUNT, /* number of transmit descriptors */ |
---|
130 | RDA_COUNT, /* number of receive descriptors */ |
---|
131 | dmv177_sonic_write_register, |
---|
132 | dmv177_sonic_read_register |
---|
133 | }; |
---|
134 | |
---|
135 | int rtems_dmv177_sonic_driver_attach(struct rtems_bsdnet_ifconfig *config) |
---|
136 | { |
---|
137 | return rtems_sonic_driver_attach( config, &dmv177_sonic_configuration ); |
---|
138 | |
---|
139 | } |
---|
140 | |
---|
141 | ====================================================================== |
---|