1 | /* $ZEL: sis5100rem_init.c,v 1.2 2004/05/27 23:10:47 wuestner Exp $ */
|
---|
2 |
|
---|
3 | /*
|
---|
4 | * Copyright (c) 2004
|
---|
5 | * Peter Wuestner. All rights reserved.
|
---|
6 | *
|
---|
7 | * Redistribution and use in source and binary forms, with or without
|
---|
8 | * modification, are permitted provided that the following conditions
|
---|
9 | * are met:
|
---|
10 | * 1. Redistributions of source code must retain the above copyright
|
---|
11 | * notice, this list of conditions, and the following disclaimer.
|
---|
12 | * 2. Redistributions in binary form must reproduce the above copyright
|
---|
13 | * notice, this list of conditions and the following disclaimer in the
|
---|
14 | * documentation and/or other materials provided with the distribution.
|
---|
15 | *
|
---|
16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
|
---|
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
---|
18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
---|
19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
---|
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
---|
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
---|
22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
---|
23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
---|
24 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
---|
25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
---|
26 | * SUCH DAMAGE.
|
---|
27 | */
|
---|
28 |
|
---|
29 | #include "sis1100_sc.h"
|
---|
30 |
|
---|
31 | static int
|
---|
32 | sis5100_dsp_present(struct sis1100_softc* sc)
|
---|
33 | {
|
---|
34 | u_int32_t dsp_sc;
|
---|
35 | int res;
|
---|
36 |
|
---|
37 | res=sis5100readremreg(sc, dsp_sc, &dsp_sc, 0);
|
---|
38 | if (res) {
|
---|
39 | pINFO(sc, "5100: read dsp_sc: error=0x%x", res);
|
---|
40 | return 0;
|
---|
41 | }
|
---|
42 | return !!(dsp_sc&sis5100_dsp_available);
|
---|
43 | }
|
---|
44 |
|
---|
45 | int
|
---|
46 | sis5100rem_init(struct sis1100_softc* sc)
|
---|
47 | {
|
---|
48 | #define MIN_FV 1
|
---|
49 | #define MAX_FV 1
|
---|
50 | u_int32_t hv, fk, fv;
|
---|
51 |
|
---|
52 | hv=(sc->remote_ident>>8)&0xff;
|
---|
53 | fk=(sc->remote_ident>>16)&0xff;
|
---|
54 | fv=(sc->remote_ident>>24)&0xff;
|
---|
55 |
|
---|
56 | switch (sc->remote_ident&0x00ffff00) {
|
---|
57 | case 0x00010100:
|
---|
58 | if (fv<MIN_FV) {
|
---|
59 | pERROR(sc, "5100: remote firmware version too old;"
|
---|
60 | " at least version %d is required.",
|
---|
61 | MIN_FV);
|
---|
62 | return -1;
|
---|
63 | }
|
---|
64 | if (fv>MAX_FV) {
|
---|
65 | pINFO(sc, "5100: Driver not tested with"
|
---|
66 | " remote firmware versions greater than %d.",
|
---|
67 | MAX_FV);
|
---|
68 | }
|
---|
69 | break;
|
---|
70 | default:
|
---|
71 | pERROR(sc, "5100: remote hw/fw type not supported");
|
---|
72 | return -1;
|
---|
73 | }
|
---|
74 |
|
---|
75 | #if 0
|
---|
76 | if (sis1100_init_sdram(sc)<0)
|
---|
77 | return -1;
|
---|
78 | pINFO(sc, "5100: size of SDRAM: 0x%llx (%lld MByte)",
|
---|
79 | sc->ram_size, sc->ram_size>>20);
|
---|
80 | #else
|
---|
81 | sc->ram_size=0;
|
---|
82 | #endif
|
---|
83 |
|
---|
84 | sc->dsp_present=sis5100_dsp_present(sc);
|
---|
85 | pINFO(sc, "5100: DSP is %spresent", sc->dsp_present?"":"not ");
|
---|
86 |
|
---|
87 | {
|
---|
88 | u_int32_t error, data;
|
---|
89 |
|
---|
90 | error=sis5100readremreg(sc, ident, &data, 0);
|
---|
91 | pINFO(sc, "5100: %s: val=0x%08x, error=0x%x", "ident", data, error);
|
---|
92 |
|
---|
93 | error=sis5100readremreg(sc, optical_sr, &data, 0);
|
---|
94 | pINFO(sc, "5100: %s: val=0x%08x, error=0x%x", "optical_sr", data, error);
|
---|
95 |
|
---|
96 | error=sis5100readremreg(sc, optical_cr, &data, 0);
|
---|
97 | pINFO(sc, "5100: %s: val=0x%08x, error=0x%x", "optical_cr", data, error);
|
---|
98 |
|
---|
99 | error=sis5100readremreg(sc, in_out, &data, 0);
|
---|
100 | pINFO(sc, "5100: %s: val=0x%08x, error=0x%x", "in_out", data, error);
|
---|
101 |
|
---|
102 | error=sis5100readremreg(sc, in_latch_irq, &data, 0);
|
---|
103 | pINFO(sc, "5100: %s: val=0x%08x, error=0x%x", "in_latch_irq", data, error);
|
---|
104 |
|
---|
105 | error=sis5100readremreg(sc, camac_sc, &data, 0);
|
---|
106 | pINFO(sc, "5100: %s: val=0x%08x, error=0x%x", "camac_sc", data, error);
|
---|
107 |
|
---|
108 | error=sis5100readremreg(sc, camac_irq_sc, &data, 0);
|
---|
109 | pINFO(sc, "5100: %s: val=0x%08x, error=0x%x", "camac_irq_sc", data, error);
|
---|
110 |
|
---|
111 | error=sis5100readremreg(sc, lam_enable, &data, 0);
|
---|
112 | pINFO(sc, "5100: %s: val=0x%08x, error=0x%x", "lam_enable", data, error);
|
---|
113 |
|
---|
114 | error=sis5100readremreg(sc, multistation, &data, 0);
|
---|
115 | pINFO(sc, "5100: %s: val=0x%08x, error=0x%x", "multistation", data, error);
|
---|
116 |
|
---|
117 | error=sis5100readremreg(sc, dma_write_counter, &data, 0);
|
---|
118 | pINFO(sc, "5100: %s: val=0x%08x, error=0x%x", "dma_write_counter", data, error);
|
---|
119 |
|
---|
120 | error=sis5100readremreg(sc, dsp_sc, &data, 0);
|
---|
121 | pINFO(sc, "5100: %s: val=0x%08x, error=0x%x", "dsp_sc", data, error);
|
---|
122 | }
|
---|
123 |
|
---|
124 | return 0;
|
---|
125 | }
|
---|