1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
diff -uprN u-boot-orig/board/atstk1000/spi.c u-boot/board/atstk1000/spi.c
--- u-boot-orig/board/atstk1000/spi.c 1970-01-01 01:00:00.000000000 +0100
+++ u-boot/board/atstk1000/spi.c 2007-01-03 08:46:36.000000000 +0100
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2006 Atmel Corporation
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * 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; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+#include <common.h>
+
+#include <spi.h>
+#include <asm/io.h>
+#include <atmel_spi.h>
+
+extern void ltv350qv_init(void);
+
+static struct spi_options_t cs0 = {
+ .reg = 0,
+ .baudrate = 200000,
+ .bits = 8,
+ .spck_delay = 0,
+ .trans_delay = 0,
+ .stay_act = 1,
+ .spi_mode = 3,
+};
+static struct spi_options_t cs1 = {
+ .reg = 1,
+ .baudrate = 1500000,
+ .bits = 8,
+ .spck_delay = 0,
+ .trans_delay = 0,
+ .stay_act = 1,
+ .spi_mode = 3,
+};
+
+void spi_chipsel_dac(int cs)
+{
+ if (cs) spi_select_chip(0);
+ else spi_unselect_chip(0);
+}
+
+void spi_chipsel_lcd(int cs)
+{
+ if (cs) spi_select_chip(1);
+ else spi_unselect_chip(1);
+}
+
+spi_chipsel_type spi_chipsel[] = {
+ spi_chipsel_dac,
+ spi_chipsel_lcd,
+};
+int spi_chipsel_cnt = sizeof(spi_chipsel) / sizeof(spi_chipsel[0]);
+
+void board_init_spi(void)
+{
+ int ret;
+
+ spi_init();
+
+ ret = spi_setup_chip_reg(&cs0, 45000000); /* TODO: get APBA speed */
+ if (ret)
+ return;
+ ret = spi_setup_chip_reg(&cs1, 45000000); /* TODO: get APBA speed */
+ if (ret)
+ return;
+
+ spi_enable();
+
+ ltv350qv_init();
+}
diff -uprN u-boot-orig/board/atstk1000/Makefile u-boot/board/atstk1000/Makefile
--- u-boot-orig/board/atstk1000/Makefile 2007-01-01 19:26:46.000000000 +0100
+++ u-boot/board/atstk1000/Makefile 2007-01-01 16:23:12.000000000 +0100
@@ -31,6 +31,7 @@ endif
LIB := lib$(BOARD).a
SRC := $(BOARD).c $(DAUGHTERBOARD).c eth.c flash.c
+SRC += spi.c
OBJS := $(addsuffix .o,$(basename $(SRC)))
.PHONY: all
|