merge of 'a1ae39784d60dda6b344012a273c0a4f2a339a97'
[vuplus_openembedded] / packages / u-boot / u-boot-git / pdaXrom-u-boot.patch
1 diff -Nur u-boot-2006-04-18-1106/CREDITS u-boot-2006-04-18-1106-new/CREDITS
2 --- u-boot-2006-04-18-1106/CREDITS      2006-04-18 09:05:03.000000000 +0000
3 +++ u-boot-2006-04-18-1106-new/CREDITS  2006-07-05 11:19:44.000000000 +0000
4 @@ -93,6 +93,12 @@
5  E: jonathan.debruyne@siemens.atea.be
6  D: Port to Siemens IAD210 board
7  
8 +N: Alexander Chukov
9 +E: sash@pdaXrom.org
10 +D: initial support for Sharp Zaurus SL-C1000/3100
11 +D: initial support for Sharp Zaurus SL-C7x0/C860
12 +W: http://www.pdaXrom.org
13 +
14  N: Ken Chou
15  E: kchou@ieee.org
16  D: Support for A3000 SBC board
17 diff -Nur u-boot-2006-04-18-1106/MAINTAINERS u-boot-2006-04-18-1106-new/MAINTAINERS
18 --- u-boot-2006-04-18-1106/MAINTAINERS  2006-04-18 09:05:03.000000000 +0000
19 +++ u-boot-2006-04-18-1106-new/MAINTAINERS      2006-07-05 11:19:44.000000000 +0000
20 @@ -379,6 +379,11 @@
21  
22         AT91RM9200DK            at91rm9200
23  
24 +Alexander Chukov <sash@pdaXrom.org>
25 +
26 +       akita                   xscale
27 +       corgi                   xscale
28 +
29  George G. Davis <gdavis@mvista.com>
30  
31         assabet                 SA1100
32 diff -Nur u-boot-2006-04-18-1106/MAKEALL u-boot-2006-04-18-1106-new/MAKEALL
33 --- u-boot-2006-04-18-1106/MAKEALL      2006-04-18 09:05:03.000000000 +0000
34 +++ u-boot-2006-04-18-1106-new/MAKEALL  2006-07-05 11:19:44.000000000 +0000
35 @@ -206,7 +206,7 @@
36         adsvix          cerf250         cradle          csb226          \
37         delta           innokom         lubbock         pxa255_idp      \
38         wepep250        xaeniax         xm250           xsengine        \
39 -       zylonite                                                        \
40 +       zylonite        akita   corgi                                   \
41  "
42  
43  LIST_ixp="ixdp425"
44 diff -Nur u-boot-2006-04-18-1106/Makefile u-boot-2006-04-18-1106-new/Makefile
45 --- u-boot-2006-04-18-1106/Makefile     2006-04-18 09:05:03.000000000 +0000
46 +++ u-boot-2006-04-18-1106-new/Makefile 2006-07-05 11:19:44.000000000 +0000
47 @@ -61,7 +61,7 @@
48  CROSS_COMPILE = powerpc-linux-
49  endif
50  ifeq ($(ARCH),arm)
51 -CROSS_COMPILE = arm-linux-
52 +CROSS_COMPILE = armv5tel-linux-
53  endif
54  ifeq ($(ARCH),i386)
55  ifeq ($(HOSTARCH),i386)
56 @@ -1709,6 +1709,12 @@
57  zylonite_config :
58         @./mkconfig $(@:_config=) arm pxa zylonite
59  
60 +akita_config   :       unconfig
61 +       @./mkconfig $(@:_config=) arm pxa akita
62 +
63 +corgi_config   :       unconfig
64 +       @./mkconfig $(@:_config=) arm pxa corgi
65 +
66  #########################################################################
67  ## ARM1136 Systems
68  #########################################################################
69 diff -Nur u-boot-2006-04-18-1106/README u-boot-2006-04-18-1106-new/README
70 --- u-boot-2006-04-18-1106/README       2006-04-18 09:05:03.000000000 +0000
71 +++ u-boot-2006-04-18-1106-new/README   2006-07-05 11:19:44.000000000 +0000
72 @@ -311,7 +311,8 @@
73                 CONFIG_KB9202,          CONFIG_LART,            CONFIG_LPD7A400,
74                 CONFIG_LUBBOCK,         CONFIG_OSK_OMAP5912,    CONFIG_OMAP2420H4,
75                 CONFIG_SHANNON,         CONFIG_P2_OMAP730,      CONFIG_SMDK2400,
76 -               CONFIG_SMDK2410,        CONFIG_TRAB,            CONFIG_VCMA9
77 +               CONFIG_SMDK2410,        CONFIG_TRAB,            CONFIG_VCMA9,
78 +               CONFIG_AKITA,           CONFIG_CORGI
79  
80                 MicroBlaze based boards:
81                 ------------------------
82 diff -Nur u-boot-2006-04-18-1106/board/akita/Makefile u-boot-2006-04-18-1106-new/board/akita/Makefile
83 --- u-boot-2006-04-18-1106/board/akita/Makefile 1970-01-01 00:00:00.000000000 +0000
84 +++ u-boot-2006-04-18-1106-new/board/akita/Makefile     2006-07-05 11:19:44.000000000 +0000
85 @@ -0,0 +1,51 @@
86 +#
87 +# board/akita/Makefile
88 +#
89 +# (C) Copyright 2006 Alexander Chukov <sash@pdaXrom.org>
90 +#
91 +# (C) Copyright 2000
92 +# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
93 +#
94 +# See file CREDITS for list of people who contributed to this
95 +# project.
96 +#
97 +# This program is free software; you can redistribute it and/or
98 +# modify it under the terms of the GNU General Public License as
99 +# published by the Free Software Foundation; either version 2 of
100 +# the License, or (at your option) any later version.
101 +#
102 +# This program is distributed in the hope that it will be useful,
103 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
104 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
105 +# GNU General Public License for more details.
106 +#
107 +# You should have received a copy of the GNU General Public License
108 +# along with this program; if not, write to the Free Software
109 +# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
110 +# MA 02111-1307 USA
111 +#
112 +
113 +include $(TOPDIR)/config.mk
114 +
115 +LIB    = lib$(BOARD).a
116 +
117 +OBJS   := akita.o nand.o kbd.o
118 +SOBJS  := lowlevel_init.o
119 +
120 +$(LIB):        $(OBJS) $(SOBJS)
121 +       $(AR) crv $@ $(OBJS) $(SOBJS)
122 +
123 +clean:
124 +       rm -f $(SOBJS) $(OBJS)
125 +
126 +distclean:     clean
127 +       rm -f $(LIB) core *.bak .depend
128 +
129 +#########################################################################
130 +
131 +.depend:       Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c)
132 +               $(CC) -M $(CPPFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
133 +
134 +-include .depend
135 +
136 +#########################################################################
137 diff -Nur u-boot-2006-04-18-1106/board/akita/akita.c u-boot-2006-04-18-1106-new/board/akita/akita.c
138 --- u-boot-2006-04-18-1106/board/akita/akita.c  1970-01-01 00:00:00.000000000 +0000
139 +++ u-boot-2006-04-18-1106-new/board/akita/akita.c      2006-07-05 11:19:44.000000000 +0000
140 @@ -0,0 +1,89 @@
141 +/*
142 + * board/akita/akita.c
143 + *
144 + * Configuration settings for the Sharp Zaurus SL-Cxx00.
145 + *
146 + * (C) Copyright 2006 Alexander Chukov <sash@pdaXrom.org>
147 + *
148 + * portions from adsvix board configuration:
149 + * (C) Copyright 2004
150 + * Robert Whaley, Applied Data Systems, Inc. rwhaley@applieddata.net
151 + * (C) Copyright 2002
152 + * Kyle Harris, Nexus Technologies, Inc. kharris@nexus-tech.net
153 + * (C) Copyright 2002
154 + * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
155 + * Marius Groeger <mgroeger@sysgo.de>
156 + *
157 + * See file CREDITS for list of people who contributed to this
158 + * project.
159 + *
160 + * This program is free software; you can redistribute it and/or
161 + * modify it under the terms of the GNU General Public License as
162 + * published by the Free Software Foundation; either version 2 of
163 + * the License, or (at your option) any later version.
164 + *
165 + * This program is distributed in the hope that it will be useful,
166 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
167 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
168 + * GNU General Public License for more details.
169 + *
170 + * You should have received a copy of the GNU General Public License
171 + * along with this program; if not, write to the Free Software
172 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
173 + * MA 02111-1307 USA
174 + */
175 +
176 +#include <common.h>
177 +
178 +void set_turbo_mode(void);
179 +
180 +/* ------------------------------------------------------------------------- */
181 +
182 +/*
183 + * Miscellaneous platform dependent initialisations
184 + */
185 +
186 +int board_init (void)
187 +{
188 +       DECLARE_GLOBAL_DATA_PTR;
189 +
190 +       /* memory and cpu-speed are setup before relocation */
191 +       /* so we do _nothing_ here */
192 +
193 +       /* arch number of Sharp Zaurus Akita : MACH_TYPE_AKITA */
194 +       gd->bd->bi_arch_number = 744;
195 +
196 +       /* adress of boot parameters */
197 +       gd->bd->bi_boot_params = 0xa0000100;
198 +
199 +       /* set cpu turbo mode */
200 +       set_turbo_mode();
201 +
202 +       spitzkbd_init();
203 +
204 +       return 0;
205 +}
206 +
207 +int board_late_init(void)
208 +{
209 +       setenv("stdout", "serial");
210 +       setenv("stderr", "serial");
211 +       return 0;
212 +}
213 +
214 +
215 +int dram_init (void)
216 +{
217 +       DECLARE_GLOBAL_DATA_PTR;
218 +
219 +       gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
220 +       gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
221 +       gd->bd->bi_dram[1].start = PHYS_SDRAM_2;
222 +       gd->bd->bi_dram[1].size = PHYS_SDRAM_2_SIZE;
223 +       gd->bd->bi_dram[2].start = PHYS_SDRAM_3;
224 +       gd->bd->bi_dram[2].size = PHYS_SDRAM_3_SIZE;
225 +       gd->bd->bi_dram[3].start = PHYS_SDRAM_4;
226 +       gd->bd->bi_dram[3].size = PHYS_SDRAM_4_SIZE;
227 +
228 +       return 0;
229 +}
230 diff -Nur u-boot-2006-04-18-1106/board/akita/config.mk u-boot-2006-04-18-1106-new/board/akita/config.mk
231 --- u-boot-2006-04-18-1106/board/akita/config.mk        1970-01-01 00:00:00.000000000 +0000
232 +++ u-boot-2006-04-18-1106-new/board/akita/config.mk    2006-07-05 11:19:44.000000000 +0000
233 @@ -0,0 +1 @@
234 +TEXT_BASE = 0xa3000000
235 diff -Nur u-boot-2006-04-18-1106/board/akita/kbd.c u-boot-2006-04-18-1106-new/board/akita/kbd.c
236 --- u-boot-2006-04-18-1106/board/akita/kbd.c    1970-01-01 00:00:00.000000000 +0000
237 +++ u-boot-2006-04-18-1106-new/board/akita/kbd.c        2006-07-05 11:19:44.000000000 +0000
238 @@ -0,0 +1,261 @@
239 +/*
240 + * board/akita/kbd.c
241 + *
242 + * Keyboard driver for the Sharp Zaurus SL-Cxx00.
243 + *
244 + * (C) Copyright 2006 Alexander Chukov <sash@pdaXrom.org>
245 + *
246 + * portions from:
247 + *
248 + * linux/drivers/input/keyboard/spitzkbd.c
249 + *
250 + * Keyboard driver for Sharp Spitz, Borzoi and Akita (SL-Cxx00 series)
251 + *
252 + * Copyright (C) 2005 Richard Purdie
253 + *
254 + * See file CREDITS for list of people who contributed to this
255 + * project.
256 + *
257 + * This program is free software; you can redistribute it and/or
258 + * modify it under the terms of the GNU General Public License as
259 + * published by the Free Software Foundation; either version 2 of
260 + * the License, or (at your option) any later version.
261 + *
262 + * This program is distributed in the hope that it will be useful,
263 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
264 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
265 + * GNU General Public License for more details.
266 + *
267 + * You should have received a copy of the GNU General Public License
268 + * along with this program; if not, write to the Free Software
269 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
270 + * MA 02111-1307 USA
271 + */
272 +
273 +#include <common.h>
274 +#include <command.h>
275 +#include <config.h>
276 +#include <version.h>
277 +#include <asm/arch/pxa-regs.h>
278 +
279 +#define GPIO_DFLT_LOW          0x400
280 +#define GPIO_DFLT_HIGH         0x800
281 +
282 +void pxa_gpio_mode(int gpio_mode)
283 +{
284 +       int gpio = gpio_mode & GPIO_MD_MASK_NR;
285 +       int fn = (gpio_mode & GPIO_MD_MASK_FN) >> 8;
286 +       int gafr;
287 +
288 +       if (gpio_mode & GPIO_DFLT_LOW)
289 +               GPCR(gpio) = GPIO_bit(gpio);
290 +       else if (gpio_mode & GPIO_DFLT_HIGH)
291 +               GPSR(gpio) = GPIO_bit(gpio);
292 +       if (gpio_mode & GPIO_MD_MASK_DIR)
293 +               GPDR(gpio) |= GPIO_bit(gpio);
294 +       else
295 +               GPDR(gpio) &= ~GPIO_bit(gpio);
296 +       gafr = GAFR(gpio) & ~(0x3 << (((gpio) & 0xf)*2));
297 +       GAFR(gpio) = gafr |  (fn  << (((gpio) & 0xf)*2));
298 +}
299 +
300 +#define SPITZ_KEY_STROBE_NUM         (11)
301 +#define SPITZ_KEY_SENSE_NUM          (7)
302 +
303 +#define SPITZ_GPIO_G0_STROBE_BIT     0x0f800000
304 +#define SPITZ_GPIO_G1_STROBE_BIT     0x00100000
305 +#define SPITZ_GPIO_G2_STROBE_BIT     0x01000000
306 +#define SPITZ_GPIO_G3_STROBE_BIT     0x00041880
307 +#define SPITZ_GPIO_G0_SENSE_BIT      0x00021000
308 +#define SPITZ_GPIO_G1_SENSE_BIT      0x000000d4
309 +#define SPITZ_GPIO_G2_SENSE_BIT      0x08000000
310 +#define SPITZ_GPIO_G3_SENSE_BIT      0x00000000
311 +
312 +#define SPITZ_GPIO_KEY_STROBE0       88
313 +#define SPITZ_GPIO_KEY_STROBE1       23
314 +#define SPITZ_GPIO_KEY_STROBE2       24
315 +#define SPITZ_GPIO_KEY_STROBE3       25
316 +#define SPITZ_GPIO_KEY_STROBE4       26
317 +#define SPITZ_GPIO_KEY_STROBE5       27
318 +#define SPITZ_GPIO_KEY_STROBE6       52
319 +#define SPITZ_GPIO_KEY_STROBE7       103
320 +#define SPITZ_GPIO_KEY_STROBE8       107
321 +#define SPITZ_GPIO_KEY_STROBE9       108
322 +#define SPITZ_GPIO_KEY_STROBE10      114
323 +
324 +#define SPITZ_GPIO_KEY_SENSE0        12
325 +#define SPITZ_GPIO_KEY_SENSE1        17
326 +#define SPITZ_GPIO_KEY_SENSE2        91
327 +#define SPITZ_GPIO_KEY_SENSE3        34
328 +#define SPITZ_GPIO_KEY_SENSE4        36
329 +#define SPITZ_GPIO_KEY_SENSE5        38
330 +#define SPITZ_GPIO_KEY_SENSE6        39
331 +
332 +#define SPITZ_GPIO_ON_KEY          (95)
333 +
334 +#define KB_ROWS                        7
335 +#define KB_COLS                        11
336 +#define KB_ROWMASK(r)          (1 << (r))
337 +#define SCANCODE(r,c)          (((r)<<4) + (c) + 1)
338 +#define        NR_SCANCODES            ((KB_ROWS<<4) + 1)
339 +
340 +#define SCAN_INTERVAL          (50) /* ms */
341 +#define HINGE_SCAN_INTERVAL    (150) /* ms */
342 +
343 +#define KB_DISCHARGE_DELAY     10
344 +#define KB_ACTIVATE_DELAY      10
345 +
346 +static int spitz_strobes[] = {
347 +       SPITZ_GPIO_KEY_STROBE0,
348 +       SPITZ_GPIO_KEY_STROBE1,
349 +       SPITZ_GPIO_KEY_STROBE2,
350 +       SPITZ_GPIO_KEY_STROBE3,
351 +       SPITZ_GPIO_KEY_STROBE4,
352 +       SPITZ_GPIO_KEY_STROBE5,
353 +       SPITZ_GPIO_KEY_STROBE6,
354 +       SPITZ_GPIO_KEY_STROBE7,
355 +       SPITZ_GPIO_KEY_STROBE8,
356 +       SPITZ_GPIO_KEY_STROBE9,
357 +       SPITZ_GPIO_KEY_STROBE10,
358 +};
359 +
360 +static int spitz_senses[] = {
361 +       SPITZ_GPIO_KEY_SENSE0,
362 +       SPITZ_GPIO_KEY_SENSE1,
363 +       SPITZ_GPIO_KEY_SENSE2,
364 +       SPITZ_GPIO_KEY_SENSE3,
365 +       SPITZ_GPIO_KEY_SENSE4,
366 +       SPITZ_GPIO_KEY_SENSE5,
367 +       SPITZ_GPIO_KEY_SENSE6,
368 +};
369 +
370 +static inline void spitzkbd_discharge_all(void)
371 +{
372 +       /* STROBE All HiZ */
373 +       GPCR0  =  SPITZ_GPIO_G0_STROBE_BIT;
374 +       GPDR0 &= ~SPITZ_GPIO_G0_STROBE_BIT;
375 +       GPCR1  =  SPITZ_GPIO_G1_STROBE_BIT;
376 +       GPDR1 &= ~SPITZ_GPIO_G1_STROBE_BIT;
377 +       GPCR2  =  SPITZ_GPIO_G2_STROBE_BIT;
378 +       GPDR2 &= ~SPITZ_GPIO_G2_STROBE_BIT;
379 +       GPCR3  =  SPITZ_GPIO_G3_STROBE_BIT;
380 +       GPDR3 &= ~SPITZ_GPIO_G3_STROBE_BIT;
381 +}
382 +
383 +static inline void spitzkbd_activate_all(void)
384 +{
385 +       /* STROBE ALL -> High */
386 +       GPSR0  =  SPITZ_GPIO_G0_STROBE_BIT;
387 +       GPDR0 |=  SPITZ_GPIO_G0_STROBE_BIT;
388 +       GPSR1  =  SPITZ_GPIO_G1_STROBE_BIT;
389 +       GPDR1 |=  SPITZ_GPIO_G1_STROBE_BIT;
390 +       GPSR2  =  SPITZ_GPIO_G2_STROBE_BIT;
391 +       GPDR2 |=  SPITZ_GPIO_G2_STROBE_BIT;
392 +       GPSR3  =  SPITZ_GPIO_G3_STROBE_BIT;
393 +       GPDR3 |=  SPITZ_GPIO_G3_STROBE_BIT;
394 +
395 +       udelay(KB_DISCHARGE_DELAY);
396 +}
397 +
398 +static inline void spitzkbd_activate_col(int col)
399 +{
400 +       int gpio = spitz_strobes[col];
401 +       GPDR0 &= ~SPITZ_GPIO_G0_STROBE_BIT;
402 +       GPDR1 &= ~SPITZ_GPIO_G1_STROBE_BIT;
403 +       GPDR2 &= ~SPITZ_GPIO_G2_STROBE_BIT;
404 +       GPDR3 &= ~SPITZ_GPIO_G3_STROBE_BIT;
405 +       GPSR(gpio) = GPIO_bit(gpio);
406 +       GPDR(gpio) |= GPIO_bit(gpio);
407 +}
408 +
409 +static inline void spitzkbd_reset_col(int col)
410 +{
411 +       int gpio = spitz_strobes[col];
412 +       GPDR0 &= ~SPITZ_GPIO_G0_STROBE_BIT;
413 +       GPDR1 &= ~SPITZ_GPIO_G1_STROBE_BIT;
414 +       GPDR2 &= ~SPITZ_GPIO_G2_STROBE_BIT;
415 +       GPDR3 &= ~SPITZ_GPIO_G3_STROBE_BIT;
416 +       GPCR(gpio) = GPIO_bit(gpio);
417 +       GPDR(gpio) |= GPIO_bit(gpio);
418 +}
419 +
420 +static inline int spitzkbd_get_row_status(int col)
421 +{
422 +       return ((GPLR0 >> 12) & 0x01) | ((GPLR0 >> 16) & 0x02)
423 +               | ((GPLR2 >> 25) & 0x04) | ((GPLR1 << 1) & 0x08)
424 +               | ((GPLR1 >> 0) & 0x10) | ((GPLR1 >> 1) & 0x60);
425 +}
426 +
427 +static int spitzkbd_scankeyboard(void)
428 +{
429 +       unsigned int row, col, rowd;
430 +       unsigned int num_pressed, pwrkey = ((GPLR(SPITZ_GPIO_ON_KEY) & GPIO_bit(SPITZ_GPIO_ON_KEY)) != 0);
431 +       int ret = -1;
432 +
433 +       num_pressed = 0;
434 +       for (col = 0; col < KB_COLS; col++) {
435 +               spitzkbd_discharge_all();
436 +               udelay(KB_DISCHARGE_DELAY);
437 +
438 +               spitzkbd_activate_col(col);
439 +               udelay(KB_ACTIVATE_DELAY);
440 +
441 +               rowd = spitzkbd_get_row_status(col);
442 +               for (row = 0; row < KB_ROWS; row++) {
443 +                       unsigned int scancode, pressed;
444 +
445 +                       scancode = SCANCODE(row, col);
446 +                       pressed = rowd & KB_ROWMASK(row);
447 +
448 +                       if (pressed)
449 +                               ret = scancode;
450 +               }
451 +               spitzkbd_reset_col(col);
452 +       }
453 +
454 +       spitzkbd_activate_all();
455 +
456 +       if (pwrkey)
457 +               return -2;
458 +       
459 +       return ret;
460 +}
461 +
462 +void spitzkbd_init(void)
463 +{
464 +       int i;
465 +
466 +       /* Setup sense interrupts - RisingEdge Detect, sense lines as inputs */
467 +       for (i = 0; i < SPITZ_KEY_SENSE_NUM; i++)
468 +               pxa_gpio_mode(spitz_senses[i] | GPIO_IN);
469 +
470 +       /* Set Strobe lines as outputs - set high */
471 +       for (i = 0; i < SPITZ_KEY_STROBE_NUM; i++)
472 +               pxa_gpio_mode(spitz_strobes[i] | GPIO_OUT | GPIO_DFLT_HIGH);
473 +
474 +       pxa_gpio_mode(SPITZ_GPIO_ON_KEY | GPIO_IN);
475 +}
476 +
477 +int do_testkey(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
478 +{
479 +       int scan;
480 +       
481 +       if (argc < 2)
482 +               return 1;
483 +
484 +       scan = spitzkbd_scankeyboard();
485 +
486 +
487 +//     if (scan >= 0)
488 +//             printf("Scan = %d\n", scan);
489 +//     else
490 +//             printf("Nothing!\n");
491 +
492 +       return !(simple_strtol(argv[1], NULL, 10) == scan);
493 +}
494 +
495 +U_BOOT_CMD(
496 +       testkey,   2,      1,      do_testkey,
497 +       "testkey - compare pressed key with arg\n",
498 +       "<key scancode>"
499 +);
500 diff -Nur u-boot-2006-04-18-1106/board/akita/lowlevel_init.S u-boot-2006-04-18-1106-new/board/akita/lowlevel_init.S
501 --- u-boot-2006-04-18-1106/board/akita/lowlevel_init.S  1970-01-01 00:00:00.000000000 +0000
502 +++ u-boot-2006-04-18-1106-new/board/akita/lowlevel_init.S      2006-07-05 11:19:44.000000000 +0000
503 @@ -0,0 +1,135 @@
504 +/*
505 + * board/akita/lowlevel_init.S
506 + *
507 + * Configuration settings for the Sharp Zaurus SL-Cxx00.
508 + *
509 + * (C) Copyright 2006 Alexander Chukov <sash@pdaXrom.org>
510 + *
511 + * This was originally from the Lubbock u-boot port and from BLOB with cleanup
512 + *
513 + * NOTE: I haven't clean this up considerably, just enough to get it
514 + * running. See hal_platform_setup.h for the source. See
515 + * board/cradle/lowlevel_init.S for another PXA250 setup that is
516 + * much cleaner.
517 + *
518 + * See file CREDITS for list of people who contributed to this
519 + * project.
520 + *
521 + * This program is free software; you can redistribute it and/or
522 + * modify it under the terms of the GNU General Public License as
523 + * published by the Free Software Foundation; either version 2 of
524 + * the License, or (at your option) any later version.
525 + *
526 + * This program is distributed in the hope that it will be useful,
527 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
528 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the
529 + * GNU General Public License for more details.
530 + *
531 + * You should have received a copy of the GNU General Public License
532 + * along with this program; if not, write to the Free Software
533 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
534 + * MA 02111-1307 USA
535 + */
536 +
537 +#include <config.h>
538 +#include <version.h>
539 +#include <asm/arch/pxa-regs.h>
540 +
541 +/* wait for coprocessor write complete */
542 +   .macro CPWAIT reg
543 +   mrc p15,0,\reg,c2,c0,0
544 +   mov \reg,\reg
545 +   sub pc,pc,#4
546 +   .endm
547 +
548 +/*********** Write out to HEX 7 segment leds *********/
549 +
550 +#undef DEBUG_HEXLOG
551 +
552 +#ifdef DEBUG_HEXLOG
553 +#define LEDCTL         0x08000040
554 +#define LEDDAT1        0x08000010
555 +#define LEDDAT2        0x08000014
556 +
557 +.macro wait, count
558 +       mov             r10, \count
559 +0:
560 +       subs    r10, r10, #1
561 +       bne             0b
562 +.endm
563 +
564 +.macro hexlog_init
565 +       ldr             r11, =LEDCTL
566 +       mov             r10, #0xff
567 +       str             r10, [r11]
568 +       ldr             r11, =LEDDAT2
569 +       mov             r10, #0xFFFFFFFF
570 +       str             r10, [r11]
571 +       ldr             r11, =LEDDAT1
572 +       mov             r10, #0x0
573 +       str             r10, [r11]
574 +.endm
575 +
576 +.macro hexlog, val
577 +       ldr             r11, =LEDCTL
578 +       mov             r10, #0xff
579 +       str             r10, [r11]
580 +       ldr             r11, =LEDDAT2
581 +       mov             r10, #0xFFFFFFFF
582 +       str             r10, [r11]
583 +
584 +       ldr             r11, =LEDDAT1
585 +       mov             r10, \val
586 +       str             r10, [r11]
587 +
588 +       wait            #0x400000
589 +.endm
590 +
591 +#else
592 +
593 +.macro hexlog_init
594 +       nop
595 +.endm
596 +
597 +.macro hexlog, val
598 +       nop
599 +.endm
600 +
601 +#endif
602 +
603 +/***********************************/
604 +
605 +/*
606 + *     Memory setup
607 + */
608 +
609 +.globl lowlevel_init
610 +lowlevel_init:
611 +
612 +       mov     pc, lr
613 +
614 +.globl set_turbo_mode
615 +
616 +set_turbo_mode:
617 +       /* Turn on turbo mode */
618 +       mrc     p14, 0, r2, c6, c0, 0
619 +       orr     r2, r2, #0xB            /* Turbo, Fast-Bus, Freq change**/
620 +       mcr     p14, 0, r2, c6, c0, 0
621 +
622 +       /* Setup vectors */
623 +       ldr     r0, =TEXT_BASE
624 +       ldr     r1, =TEXT_BASE+0x40
625 +       ldr     r2, =0x0
626 +1:
627 +       ldr     r3, [r0]
628 +       str     r3, [r2]
629 +       add     r0, r0, #4
630 +       add     r2, r2, #4
631 +       cmp     r0, r1
632 +       bne     1b
633 +
634 +       ldr     r0, =0x0
635 +       ldr     r1, [r0, #4]
636 +       str     r1, [r0]
637 +
638 +       mov     pc, lr
639 diff -Nur u-boot-2006-04-18-1106/board/akita/nand.c u-boot-2006-04-18-1106-new/board/akita/nand.c
640 --- u-boot-2006-04-18-1106/board/akita/nand.c   1970-01-01 00:00:00.000000000 +0000
641 +++ u-boot-2006-04-18-1106-new/board/akita/nand.c       2006-07-05 11:19:44.000000000 +0000
642 @@ -0,0 +1,169 @@
643 +/*
644 + * board/akita/nand.c
645 + *
646 + * NAND driver for the Sharp Zaurus SL-Cxx00.
647 + *
648 + * (C) Copyright 2006 Alexander Chukov <sash@pdaXrom.org>
649 + *
650 + * portions from mtd nand driver:
651 + *
652 + * drivers/mtd/nand/sharpsl.c
653 + *
654 + * Copyright (C) 2004 Richard Purdie
655 + *
656 + * See file CREDITS for list of people who contributed to this
657 + * project.
658 + *
659 + * This program is free software; you can redistribute it and/or
660 + * modify it under the terms of the GNU General Public License as
661 + * published by the Free Software Foundation; either version 2 of
662 + * the License, or (at your option) any later version.
663 + *
664 + * This program is distributed in the hope that it will be useful,
665 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
666 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
667 + * GNU General Public License for more details.
668 + *
669 + * You should have received a copy of the GNU General Public License
670 + * along with this program; if not, write to the Free Software
671 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
672 + * MA 02111-1307 USA
673 + */
674 +
675 +#include <common.h>
676 +
677 +
678 +#if (CONFIG_COMMANDS & CFG_CMD_NAND)
679 +
680 +#include <nand.h>
681 +#include <linux/mtd/nand_ecc.h>
682 +
683 +static int sharpsl_io_base = CFG_NAND_BASE;
684 +
685 +/* register offset */
686 +#define ECCLPLB                sharpsl_io_base+0x00    /* line parity 7 - 0 bit */
687 +#define ECCLPUB                sharpsl_io_base+0x04    /* line parity 15 - 8 bit */
688 +#define ECCCP          sharpsl_io_base+0x08    /* column parity 5 - 0 bit */
689 +#define ECCCNTR                sharpsl_io_base+0x0C    /* ECC byte counter */
690 +#define ECCCLRR                sharpsl_io_base+0x10    /* cleare ECC */
691 +#define FLASHIO                sharpsl_io_base+0x14    /* Flash I/O */
692 +#define FLASHCTL       sharpsl_io_base+0x18    /* Flash Control */
693 +
694 +/* Flash control bit */
695 +#define FLRYBY         (1 << 5)
696 +#define FLCE1          (1 << 4)
697 +#define FLWP           (1 << 3)
698 +#define FLALE          (1 << 2)
699 +#define FLCLE          (1 << 1)
700 +#define FLCE0          (1 << 0)
701 +
702 +#define readb(address) *((volatile unsigned char *)(address))
703 +#define writeb(v, address) *((volatile unsigned char *)(address))=v
704 +
705 +/*
706 + *     hardware specific access to control-lines
707 + */
708 +static void
709 +sharpsl_nand_hwcontrol(struct mtd_info* mtd, int cmd)
710 +{
711 +       switch (cmd) {
712 +       case NAND_CTL_SETCLE:
713 +               writeb(readb(FLASHCTL) | FLCLE, FLASHCTL);
714 +               break;
715 +       case NAND_CTL_CLRCLE:
716 +               writeb(readb(FLASHCTL) & ~FLCLE, FLASHCTL);
717 +               break;
718 +
719 +       case NAND_CTL_SETALE:
720 +               writeb(readb(FLASHCTL) | FLALE, FLASHCTL);
721 +               break;
722 +       case NAND_CTL_CLRALE:
723 +               writeb(readb(FLASHCTL) & ~FLALE, FLASHCTL);
724 +               break;
725 +
726 +       case NAND_CTL_SETNCE:
727 +               writeb(readb(FLASHCTL) & ~(FLCE0|FLCE1), FLASHCTL);
728 +               break;
729 +       case NAND_CTL_CLRNCE:
730 +               writeb(readb(FLASHCTL) | (FLCE0|FLCE1), FLASHCTL);
731 +               break;
732 +       }
733 +}
734 +
735 +static int
736 +sharpsl_nand_dev_ready(struct mtd_info* mtd)
737 +{
738 +       return !((readb(FLASHCTL) & FLRYBY) == 0);
739 +}
740 +
741 +static void
742 +sharpsl_nand_enable_hwecc(struct mtd_info* mtd, int mode)
743 +{
744 +       writeb(0 ,ECCCLRR);
745 +}
746 +
747 +static int
748 +sharpsl_nand_calculate_ecc(struct mtd_info* mtd, const u_char* dat,
749 +                               u_char* ecc_code)
750 +{
751 +       ecc_code[0] = ~readb(ECCLPUB);
752 +       ecc_code[1] = ~readb(ECCLPLB);
753 +       ecc_code[2] = (~readb(ECCCP) << 2) | 0x03;
754 +       return readb(ECCCNTR) != 0;
755 +}
756 +
757 +static uint8_t scan_ff_pattern[] = { 0xff, 0xff };
758 +
759 +static struct nand_bbt_descr sharpsl_akita_bbt = {
760 +       .options = 0,
761 +       .offs = 4,
762 +       .len = 1,
763 +       .pattern = scan_ff_pattern
764 +};
765 +
766 +static struct nand_oobinfo akita_oobinfo = {
767 +       .useecc = MTD_NANDECC_AUTOPLACE,
768 +       .eccbytes = 24,
769 +       .eccpos = {
770 +               0x5,  0x1,  0x2,  0x3,  0x6,  0x7,  0x15, 0x11,
771 +               0x12, 0x13, 0x16, 0x17, 0x25, 0x21, 0x22, 0x23,
772 +               0x26, 0x27, 0x35, 0x31, 0x32, 0x33, 0x36, 0x37},
773 +       .oobfree = { {0x08, 0x09} }
774 +};
775 +
776 +/*
777 + * Board-specific NAND initialization. The following members of the
778 + * argument are board-specific (per include/linux/mtd/nand.h):
779 + * - IO_ADDR_R?: address to read the 8 I/O lines of the flash device
780 + * - IO_ADDR_W?: address to write the 8 I/O lines of the flash device
781 + * - hwcontrol: hardwarespecific function for accesing control-lines
782 + * - dev_ready: hardwarespecific function for  accesing device ready/busy line
783 + * - enable_hwecc?: function to enable (reset)  hardware ecc generator. Must
784 + *   only be provided if a hardware ECC is available
785 + * - eccmode: mode of ecc, see defines
786 + * - chip_delay: chip dependent delay for transfering data from array to
787 + *   read regs (tR)
788 + * - options: various chip options. They can partly be set to inform
789 + *   nand_scan about special functionality. See the defines for further
790 + *   explanation
791 + * Members with a "?" were not set in the merged testing-NAND branch,
792 + * so they are not set here either.
793 + */
794 +void board_nand_init(struct nand_chip *nand)
795 +{
796 +       writeb(readb(FLASHCTL) | FLWP, FLASHCTL);
797 +
798 +       nand->IO_ADDR_R = FLASHIO;
799 +       nand->IO_ADDR_W = FLASHIO;
800 +       nand->hwcontrol = sharpsl_nand_hwcontrol;
801 +       nand->dev_ready = sharpsl_nand_dev_ready;
802 +       nand->eccmode = NAND_ECC_HW3_256;
803 +       nand->chip_delay = 15;
804 +       nand->options = NAND_SAMSUNG_LP_OPTIONS;
805 +       nand->badblock_pattern = &sharpsl_akita_bbt;
806 +       nand->autooob = &akita_oobinfo;
807 +       nand->enable_hwecc = sharpsl_nand_enable_hwecc;
808 +       nand->calculate_ecc = sharpsl_nand_calculate_ecc;
809 +       nand->correct_data = nand_correct_data;
810 +}
811 +#endif /* (CONFIG_COMMANDS & CFG_CMD_NAND) */
812 diff -Nur u-boot-2006-04-18-1106/board/akita/u-boot.lds u-boot-2006-04-18-1106-new/board/akita/u-boot.lds
813 --- u-boot-2006-04-18-1106/board/akita/u-boot.lds       1970-01-01 00:00:00.000000000 +0000
814 +++ u-boot-2006-04-18-1106-new/board/akita/u-boot.lds   2006-07-05 11:19:44.000000000 +0000
815 @@ -0,0 +1,56 @@
816 +/*
817 + * (C) Copyright 2000
818 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
819 + *
820 + * See file CREDITS for list of people who contributed to this
821 + * project.
822 + *
823 + * This program is free software; you can redistribute it and/or
824 + * modify it under the terms of the GNU General Public License as
825 + * published by the Free Software Foundation; either version 2 of
826 + * the License, or (at your option) any later version.
827 + *
828 + * This program is distributed in the hope that it will be useful,
829 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
830 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
831 + * GNU General Public License for more details.
832 + *
833 + * You should have received a copy of the GNU General Public License
834 + * along with this program; if not, write to the Free Software
835 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
836 + * MA 02111-1307 USA
837 + */
838 +
839 +OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
840 +OUTPUT_ARCH(arm)
841 +ENTRY(_start)
842 +SECTIONS
843 +{
844 +       . = 0x00000000;
845 +
846 +       . = ALIGN(4);
847 +       .text      :
848 +       {
849 +         cpu/pxa/start.o       (.text)
850 +         *(.text)
851 +       }
852 +
853 +       . = ALIGN(4);
854 +       .rodata : { *(.rodata) }
855 +
856 +       . = ALIGN(4);
857 +       .data : { *(.data) }
858 +
859 +       . = ALIGN(4);
860 +       .got : { *(.got) }
861 +
862 +       . = .;
863 +       __u_boot_cmd_start = .;
864 +       .u_boot_cmd : { *(.u_boot_cmd) }
865 +       __u_boot_cmd_end = .;
866 +
867 +       . = ALIGN(4);
868 +       __bss_start = .;
869 +       .bss : { *(.bss) }
870 +       _end = .;
871 +}
872 diff -Nur u-boot-2006-04-18-1106/board/corgi/Makefile u-boot-2006-04-18-1106-new/board/corgi/Makefile
873 --- u-boot-2006-04-18-1106/board/corgi/Makefile 1970-01-01 00:00:00.000000000 +0000
874 +++ u-boot-2006-04-18-1106-new/board/corgi/Makefile     2006-07-05 11:19:44.000000000 +0000
875 @@ -0,0 +1,51 @@
876 +#
877 +# board/corgi/Makefile
878 +#
879 +# (C) Copyright 2006 Alexander Chukov <sash@pdaXrom.org>
880 +#
881 +# (C) Copyright 2000
882 +# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
883 +#
884 +# See file CREDITS for list of people who contributed to this
885 +# project.
886 +#
887 +# This program is free software; you can redistribute it and/or
888 +# modify it under the terms of the GNU General Public License as
889 +# published by the Free Software Foundation; either version 2 of
890 +# the License, or (at your option) any later version.
891 +#
892 +# This program is distributed in the hope that it will be useful,
893 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
894 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
895 +# GNU General Public License for more details.
896 +#
897 +# You should have received a copy of the GNU General Public License
898 +# along with this program; if not, write to the Free Software
899 +# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
900 +# MA 02111-1307 USA
901 +#
902 +
903 +include $(TOPDIR)/config.mk
904 +
905 +LIB    = lib$(BOARD).a
906 +
907 +OBJS   := corgi.o nand.o kbd.o
908 +SOBJS  := lowlevel_init.o
909 +
910 +$(LIB):        $(OBJS) $(SOBJS)
911 +       $(AR) crv $@ $(OBJS) $(SOBJS)
912 +
913 +clean:
914 +       rm -f $(SOBJS) $(OBJS)
915 +
916 +distclean:     clean
917 +       rm -f $(LIB) core *.bak .depend
918 +
919 +#########################################################################
920 +
921 +.depend:       Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c)
922 +               $(CC) -M $(CPPFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
923 +
924 +-include .depend
925 +
926 +#########################################################################
927 diff -Nur u-boot-2006-04-18-1106/board/corgi/config.mk u-boot-2006-04-18-1106-new/board/corgi/config.mk
928 --- u-boot-2006-04-18-1106/board/corgi/config.mk        1970-01-01 00:00:00.000000000 +0000
929 +++ u-boot-2006-04-18-1106-new/board/corgi/config.mk    2006-07-05 11:19:44.000000000 +0000
930 @@ -0,0 +1 @@
931 +TEXT_BASE = 0xa1000000
932 diff -Nur u-boot-2006-04-18-1106/board/corgi/corgi.c u-boot-2006-04-18-1106-new/board/corgi/corgi.c
933 --- u-boot-2006-04-18-1106/board/corgi/corgi.c  1970-01-01 00:00:00.000000000 +0000
934 +++ u-boot-2006-04-18-1106-new/board/corgi/corgi.c      2006-07-05 11:19:44.000000000 +0000
935 @@ -0,0 +1,87 @@
936 +/*
937 + * board/corgi/corgi.c
938 + *
939 + * Configuration settings for the Sharp Zaurus SL-C7x0/860.
940 + *
941 + * (C) Copyright 2006 Alexander Chukov <sash@pdaXrom.org>
942 + *
943 + * portions from adsvix board configuration:
944 + * (C) Copyright 2004
945 + * Robert Whaley, Applied Data Systems, Inc. rwhaley@applieddata.net
946 + * (C) Copyright 2002
947 + * Kyle Harris, Nexus Technologies, Inc. kharris@nexus-tech.net
948 + * (C) Copyright 2002
949 + * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
950 + * Marius Groeger <mgroeger@sysgo.de>
951 + *
952 + * See file CREDITS for list of people who contributed to this
953 + * project.
954 + *
955 + * This program is free software; you can redistribute it and/or
956 + * modify it under the terms of the GNU General Public License as
957 + * published by the Free Software Foundation; either version 2 of
958 + * the License, or (at your option) any later version.
959 + *
960 + * This program is distributed in the hope that it will be useful,
961 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
962 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
963 + * GNU General Public License for more details.
964 + *
965 + * You should have received a copy of the GNU General Public License
966 + * along with this program; if not, write to the Free Software
967 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
968 + * MA 02111-1307 USA
969 + */
970 +
971 +#include <common.h>
972 +
973 +/* ------------------------------------------------------------------------- */
974 +
975 +/*
976 + * Miscellaneous platform dependent initialisations
977 + */
978 +
979 +int board_init (void)
980 +{
981 +       DECLARE_GLOBAL_DATA_PTR;
982 +
983 +       /* memory and cpu-speed are setup before relocation */
984 +       /* so we do _nothing_ here */
985 +
986 +       /* arch number of Sharp Zaurus Corgi : MACH_TYPE_CORGI */
987 +       gd->bd->bi_arch_number = 423;
988 +
989 +       /* adress of boot parameters */
990 +       gd->bd->bi_boot_params = 0xa0000100;
991 +
992 +       /* set cpu turbo mode */
993 +       set_turbo_mode();
994 +
995 +       corgikbd_init();
996 +
997 +       return 0;
998 +}
999 +
1000 +int board_late_init(void)
1001 +{
1002 +       setenv("stdout", "serial");
1003 +       setenv("stderr", "serial");
1004 +       return 0;
1005 +}
1006 +
1007 +
1008 +int dram_init (void)
1009 +{
1010 +       DECLARE_GLOBAL_DATA_PTR;
1011 +
1012 +       gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
1013 +       gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
1014 +       gd->bd->bi_dram[1].start = PHYS_SDRAM_2;
1015 +       gd->bd->bi_dram[1].size = PHYS_SDRAM_2_SIZE;
1016 +       gd->bd->bi_dram[2].start = PHYS_SDRAM_3;
1017 +       gd->bd->bi_dram[2].size = PHYS_SDRAM_3_SIZE;
1018 +       gd->bd->bi_dram[3].start = PHYS_SDRAM_4;
1019 +       gd->bd->bi_dram[3].size = PHYS_SDRAM_4_SIZE;
1020 +
1021 +       return 0;
1022 +}
1023 diff -Nur u-boot-2006-04-18-1106/board/corgi/kbd.c u-boot-2006-04-18-1106-new/board/corgi/kbd.c
1024 --- u-boot-2006-04-18-1106/board/corgi/kbd.c    1970-01-01 00:00:00.000000000 +0000
1025 +++ u-boot-2006-04-18-1106-new/board/corgi/kbd.c        2006-07-05 11:19:44.000000000 +0000
1026 @@ -0,0 +1,202 @@
1027 +/*
1028 + * board/corgi/kbd.c
1029 + *
1030 + * Keyboard driver for the Sharp Zaurus SL-C7x0/860.
1031 + *
1032 + * (C) Copyright 2006 Alexander Chukov <sash@pdaXrom.org>
1033 + *
1034 + * portions from:
1035 + *
1036 + * linux/drivers/input/keyboard/spitzkbd.c
1037 + *
1038 + * Keyboard driver for Sharp Corgi models (SL-C7xx)
1039 + *
1040 + * Copyright (C) 2005 Richard Purdie
1041 + *
1042 + * See file CREDITS for list of people who contributed to this
1043 + * project.
1044 + *
1045 + * This program is free software; you can redistribute it and/or
1046 + * modify it under the terms of the GNU General Public License as
1047 + * published by the Free Software Foundation; either version 2 of
1048 + * the License, or (at your option) any later version.
1049 + *
1050 + * This program is distributed in the hope that it will be useful,
1051 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1052 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1053 + * GNU General Public License for more details.
1054 + *
1055 + * You should have received a copy of the GNU General Public License
1056 + * along with this program; if not, write to the Free Software
1057 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
1058 + * MA 02111-1307 USA
1059 + */
1060 +
1061 +#include <common.h>
1062 +#include <command.h>
1063 +#include <config.h>
1064 +#include <version.h>
1065 +#include <asm/arch/pxa-regs.h>
1066 +
1067 +#define GPIO_DFLT_LOW          0x400
1068 +#define GPIO_DFLT_HIGH         0x800
1069 +
1070 +void pxa_gpio_mode(int gpio_mode)
1071 +{
1072 +       int gpio = gpio_mode & GPIO_MD_MASK_NR;
1073 +       int fn = (gpio_mode & GPIO_MD_MASK_FN) >> 8;
1074 +       int gafr;
1075 +
1076 +       if (gpio_mode & GPIO_DFLT_LOW)
1077 +               GPCR(gpio) = GPIO_bit(gpio);
1078 +       else if (gpio_mode & GPIO_DFLT_HIGH)
1079 +               GPSR(gpio) = GPIO_bit(gpio);
1080 +       if (gpio_mode & GPIO_MD_MASK_DIR)
1081 +               GPDR(gpio) |= GPIO_bit(gpio);
1082 +       else
1083 +               GPDR(gpio) &= ~GPIO_bit(gpio);
1084 +       gafr = GAFR(gpio) & ~(0x3 << (((gpio) & 0xf)*2));
1085 +       GAFR(gpio) = gafr |  (fn  << (((gpio) & 0xf)*2));
1086 +}
1087 +
1088 +/*
1089 + * Corgi Keyboard Definitions
1090 + */
1091 +#define CORGI_KEY_STROBE_NUM           (12)
1092 +#define CORGI_KEY_SENSE_NUM                    (8)
1093 +#define CORGI_GPIO_ALL_STROBE_BIT      (0x00003ffc)
1094 +#define CORGI_GPIO_HIGH_SENSE_BIT      (0xfc000000)
1095 +#define CORGI_GPIO_HIGH_SENSE_RSHIFT   (26)
1096 +#define CORGI_GPIO_LOW_SENSE_BIT       (0x00000003)
1097 +#define CORGI_GPIO_LOW_SENSE_LSHIFT    (6)
1098 +#define CORGI_GPIO_STROBE_BIT(a)       GPIO_bit(66+(a))
1099 +#define CORGI_GPIO_SENSE_BIT(a)                GPIO_bit(58+(a))
1100 +#define CORGI_GAFR_ALL_STROBE_BIT      (0x0ffffff0)
1101 +#define CORGI_GAFR_HIGH_SENSE_BIT      (0xfff00000)
1102 +#define CORGI_GAFR_LOW_SENSE_BIT       (0x0000000f)
1103 +#define CORGI_GPIO_KEY_SENSE(a)                (58+(a))
1104 +#define CORGI_GPIO_KEY_STROBE(a)       (66+(a))
1105 +
1106 +#define CORGI_GPIO_AK_INT                      (4)     /* Headphone Jack Control Interrupt */
1107 +
1108 +#define KB_ROWS                                8
1109 +#define KB_COLS                                12
1110 +#define KB_ROWMASK(r)          (1 << (r))
1111 +#define SCANCODE(r,c)          ( ((r)<<4) + (c) + 1 )
1112 +/* zero code, 124 scancodes */
1113 +#define        NR_SCANCODES            ( SCANCODE(KB_ROWS-1,KB_COLS-1) +1 +1 )
1114 +
1115 +#define SCAN_INTERVAL          (50) /* ms */
1116 +#define HINGE_SCAN_INTERVAL    (250) /* ms */
1117 +
1118 +#define KB_DISCHARGE_DELAY     10
1119 +#define KB_ACTIVATE_DELAY      10
1120 +
1121 +static inline void corgikbd_discharge_all(void)
1122 +{
1123 +       /* STROBE All HiZ */
1124 +       GPCR2  = CORGI_GPIO_ALL_STROBE_BIT;
1125 +       GPDR2 &= ~CORGI_GPIO_ALL_STROBE_BIT;
1126 +}
1127 +
1128 +static inline void corgikbd_activate_all(void)
1129 +{
1130 +       /* STROBE ALL -> High */
1131 +       GPSR2  = CORGI_GPIO_ALL_STROBE_BIT;
1132 +       GPDR2 |= CORGI_GPIO_ALL_STROBE_BIT;
1133 +
1134 +       udelay(KB_DISCHARGE_DELAY);
1135 +
1136 +       /* Clear any interrupts we may have triggered when altering the GPIO lines */
1137 +       GEDR1 = CORGI_GPIO_HIGH_SENSE_BIT;
1138 +       GEDR2 = CORGI_GPIO_LOW_SENSE_BIT;
1139 +}
1140 +
1141 +static inline void corgikbd_activate_col(int col)
1142 +{
1143 +       /* STROBE col -> High, not col -> HiZ */
1144 +       GPSR2 = CORGI_GPIO_STROBE_BIT(col);
1145 +       GPDR2 = (GPDR2 & ~CORGI_GPIO_ALL_STROBE_BIT) | CORGI_GPIO_STROBE_BIT(col);
1146 +}
1147 +
1148 +static inline void corgikbd_reset_col(int col)
1149 +{
1150 +       /* STROBE col -> Low */
1151 +       GPCR2 = CORGI_GPIO_STROBE_BIT(col);
1152 +       /* STROBE col -> out, not col -> HiZ */
1153 +       GPDR2 = (GPDR2 & ~CORGI_GPIO_ALL_STROBE_BIT) | CORGI_GPIO_STROBE_BIT(col);
1154 +}
1155 +
1156 +#define GET_ROWS_STATUS(c)     (((GPLR1 & CORGI_GPIO_HIGH_SENSE_BIT) >> CORGI_GPIO_HIGH_SENSE_RSHIFT) | ((GPLR2 & CORGI_GPIO_LOW_SENSE_BIT) << CORGI_GPIO_LOW_SENSE_LSHIFT))
1157 +
1158 +static int corgikbd_scankeyboard(void)
1159 +{
1160 +       unsigned int row, col, rowd;
1161 +       unsigned int num_pressed;
1162 +       int ret = -1;
1163 +
1164 +       num_pressed = 0;
1165 +       for (col = 0; col < KB_COLS; col++) {
1166 +               corgikbd_discharge_all();
1167 +               udelay(KB_DISCHARGE_DELAY);
1168 +
1169 +               corgikbd_activate_col(col);
1170 +               udelay(KB_ACTIVATE_DELAY);
1171 +
1172 +               rowd = GET_ROWS_STATUS(col);
1173 +               for (row = 0; row < KB_ROWS; row++) {
1174 +                       unsigned int scancode, pressed;
1175 +
1176 +                       scancode = SCANCODE(row, col);
1177 +                       pressed = rowd & KB_ROWMASK(row);
1178 +
1179 +                       if (pressed)
1180 +                           ret = scancode;
1181 +               }
1182 +               corgikbd_reset_col(col);
1183 +       }
1184 +
1185 +       corgikbd_activate_all();
1186 +
1187 +       return ret;
1188 +}
1189 +
1190 +void corgikbd_init(void)
1191 +{
1192 +       int i;
1193 +       
1194 +       /* Setup sense interrupts - RisingEdge Detect, sense lines as inputs */
1195 +       for (i = 0; i < CORGI_KEY_SENSE_NUM; i++)
1196 +               pxa_gpio_mode(CORGI_GPIO_KEY_SENSE(i) | GPIO_IN);
1197 +
1198 +       /* Set Strobe lines as outputs - set high */
1199 +       for (i = 0; i < CORGI_KEY_STROBE_NUM; i++)
1200 +               pxa_gpio_mode(CORGI_GPIO_KEY_STROBE(i) | GPIO_OUT | GPIO_DFLT_HIGH);
1201 +
1202 +       /* Setup the headphone jack as an input */
1203 +       pxa_gpio_mode(CORGI_GPIO_AK_INT | GPIO_IN);
1204 +}
1205 +
1206 +int do_testkey(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
1207 +{
1208 +       int scan;
1209 +       
1210 +       if (argc < 2)
1211 +               return 1;
1212 +
1213 +       scan = corgikbd_scankeyboard();
1214 +
1215 +
1216 +//     if (scan >= 0)
1217 +//             printf("Scan = %d\n", scan);
1218 +//     else
1219 +//             printf("Nothing!\n");
1220 +
1221 +       return !(simple_strtol(argv[1], NULL, 10) == scan);
1222 +}
1223 +
1224 +U_BOOT_CMD(
1225 +       testkey,   2,      1,      do_testkey,
1226 +       "testkey - compare pressed key with arg\n",
1227 +       "<key scancode>"
1228 +);
1229 diff -Nur u-boot-2006-04-18-1106/board/corgi/lowlevel_init.S u-boot-2006-04-18-1106-new/board/corgi/lowlevel_init.S
1230 --- u-boot-2006-04-18-1106/board/corgi/lowlevel_init.S  1970-01-01 00:00:00.000000000 +0000
1231 +++ u-boot-2006-04-18-1106-new/board/corgi/lowlevel_init.S      2006-07-05 11:19:44.000000000 +0000
1232 @@ -0,0 +1,136 @@
1233 +/*
1234 + * board/corgi/lowlevel_init.S
1235 + *
1236 + * Configuration settings for the Sharp Zaurus SL-C7x0/860.
1237 + *
1238 + * (C) Copyright 2006 Alexander Chukov <sash@pdaXrom.org>
1239 + *
1240 + * This was originally from the Lubbock u-boot port and from BLOB with cleanup
1241 + *
1242 + * NOTE: I haven't clean this up considerably, just enough to get it
1243 + * running. See hal_platform_setup.h for the source. See
1244 + * board/cradle/lowlevel_init.S for another PXA250 setup that is
1245 + * much cleaner.
1246 + *
1247 + * See file CREDITS for list of people who contributed to this
1248 + * project.
1249 + *
1250 + * This program is free software; you can redistribute it and/or
1251 + * modify it under the terms of the GNU General Public License as
1252 + * published by the Free Software Foundation; either version 2 of
1253 + * the License, or (at your option) any later version.
1254 + *
1255 + * This program is distributed in the hope that it will be useful,
1256 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1257 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the
1258 + * GNU General Public License for more details.
1259 + *
1260 + * You should have received a copy of the GNU General Public License
1261 + * along with this program; if not, write to the Free Software
1262 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
1263 + * MA 02111-1307 USA
1264 + */
1265 +
1266 +#include <config.h>
1267 +#include <version.h>
1268 +#include <asm/arch/pxa-regs.h>
1269 +
1270 +/* wait for coprocessor write complete */
1271 +   .macro CPWAIT reg
1272 +   mrc p15,0,\reg,c2,c0,0
1273 +   mov \reg,\reg
1274 +   sub pc,pc,#4
1275 +   .endm
1276 +
1277 +/*********** Write out to HEX 7 segment leds *********/
1278 +
1279 +#undef DEBUG_HEXLOG
1280 +
1281 +#ifdef DEBUG_HEXLOG
1282 +#define LEDCTL         0x08000040
1283 +#define LEDDAT1        0x08000010
1284 +#define LEDDAT2        0x08000014
1285 +
1286 +.macro wait, count
1287 +       mov             r10, \count
1288 +0:
1289 +       subs    r10, r10, #1
1290 +       bne             0b
1291 +.endm
1292 +
1293 +.macro hexlog_init
1294 +       ldr             r11, =LEDCTL
1295 +       mov             r10, #0xff
1296 +       str             r10, [r11]
1297 +       ldr             r11, =LEDDAT2
1298 +       mov             r10, #0xFFFFFFFF
1299 +       str             r10, [r11]
1300 +       ldr             r11, =LEDDAT1
1301 +       mov             r10, #0x0
1302 +       str             r10, [r11]
1303 +.endm
1304 +
1305 +.macro hexlog, val
1306 +       ldr             r11, =LEDCTL
1307 +       mov             r10, #0xff
1308 +       str             r10, [r11]
1309 +       ldr             r11, =LEDDAT2
1310 +       mov             r10, #0xFFFFFFFF
1311 +       str             r10, [r11]
1312 +
1313 +       ldr             r11, =LEDDAT1
1314 +       mov             r10, \val
1315 +       str             r10, [r11]
1316 +
1317 +       wait            #0x400000
1318 +.endm
1319 +
1320 +#else
1321 +
1322 +.macro hexlog_init
1323 +       nop
1324 +.endm
1325 +
1326 +.macro hexlog, val
1327 +       nop
1328 +.endm
1329 +
1330 +#endif
1331 +
1332 +/***********************************/
1333 +
1334 +/*
1335 + *     Memory setup
1336 + */
1337 +
1338 +.globl lowlevel_init
1339 +lowlevel_init:
1340 +
1341 +       mov     pc, lr
1342 +
1343 +.globl set_turbo_mode
1344 +
1345 +set_turbo_mode:
1346 +       /* Turn on turbo mode */
1347 +       mrc     p14, 0, r2, c6, c0, 0
1348 +       orr     r2, r2, #0x3            /* Turbo, Freq change */
1349 +       mcr     p14, 0, r2, c6, c0, 0
1350 +
1351 +
1352 +       /* Setup vectors */
1353 +       ldr     r0, =TEXT_BASE
1354 +       ldr     r1, =TEXT_BASE+0x40
1355 +       ldr     r2, =0x0
1356 +1:
1357 +       ldr     r3, [r0]
1358 +       str     r3, [r2]
1359 +       add     r0, r0, #4
1360 +       add     r2, r2, #4
1361 +       cmp     r0, r1
1362 +       bne     1b
1363 +
1364 +       ldr     r0, =0x0
1365 +       ldr     r1, [r0, #4]
1366 +       str     r1, [r0]
1367 +
1368 +       mov     pc, lr
1369 diff -Nur u-boot-2006-04-18-1106/board/corgi/nand.c u-boot-2006-04-18-1106-new/board/corgi/nand.c
1370 --- u-boot-2006-04-18-1106/board/corgi/nand.c   1970-01-01 00:00:00.000000000 +0000
1371 +++ u-boot-2006-04-18-1106-new/board/corgi/nand.c       2006-07-05 11:19:44.000000000 +0000
1372 @@ -0,0 +1,157 @@
1373 +/*
1374 + * board/corgi/nand.c
1375 + *
1376 + * NAND driver for the Sharp Zaurus SL-C7x0/860.
1377 + *
1378 + * (C) Copyright 2006 Alexander Chukov <sash@pdaXrom.org>
1379 + *
1380 + * portions from mtd nand driver:
1381 + *
1382 + * drivers/mtd/nand/sharpsl.c
1383 + *
1384 + * Copyright (C) 2004 Richard Purdie
1385 + *
1386 + * See file CREDITS for list of people who contributed to this
1387 + * project.
1388 + *
1389 + * This program is free software; you can redistribute it and/or
1390 + * modify it under the terms of the GNU General Public License as
1391 + * published by the Free Software Foundation; either version 2 of
1392 + * the License, or (at your option) any later version.
1393 + *
1394 + * This program is distributed in the hope that it will be useful,
1395 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1396 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1397 + * GNU General Public License for more details.
1398 + *
1399 + * You should have received a copy of the GNU General Public License
1400 + * along with this program; if not, write to the Free Software
1401 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
1402 + * MA 02111-1307 USA
1403 + */
1404 +
1405 +#include <common.h>
1406 +
1407 +
1408 +#if (CONFIG_COMMANDS & CFG_CMD_NAND)
1409 +
1410 +#include <nand.h>
1411 +#include <linux/mtd/nand_ecc.h>
1412 +
1413 +static int sharpsl_io_base = CFG_NAND_BASE;
1414 +
1415 +/* register offset */
1416 +#define ECCLPLB                sharpsl_io_base+0x00    /* line parity 7 - 0 bit */
1417 +#define ECCLPUB                sharpsl_io_base+0x04    /* line parity 15 - 8 bit */
1418 +#define ECCCP          sharpsl_io_base+0x08    /* column parity 5 - 0 bit */
1419 +#define ECCCNTR                sharpsl_io_base+0x0C    /* ECC byte counter */
1420 +#define ECCCLRR                sharpsl_io_base+0x10    /* cleare ECC */
1421 +#define FLASHIO                sharpsl_io_base+0x14    /* Flash I/O */
1422 +#define FLASHCTL       sharpsl_io_base+0x18    /* Flash Control */
1423 +
1424 +/* Flash control bit */
1425 +#define FLRYBY         (1 << 5)
1426 +#define FLCE1          (1 << 4)
1427 +#define FLWP           (1 << 3)
1428 +#define FLALE          (1 << 2)
1429 +#define FLCLE          (1 << 1)
1430 +#define FLCE0          (1 << 0)
1431 +
1432 +#define readb(address) *((volatile unsigned char *)(address))
1433 +#define writeb(v, address) *((volatile unsigned char *)(address))=v
1434 +
1435 +/*
1436 + *     hardware specific access to control-lines
1437 + */
1438 +static void
1439 +sharpsl_nand_hwcontrol(struct mtd_info* mtd, int cmd)
1440 +{
1441 +       switch (cmd) {
1442 +       case NAND_CTL_SETCLE:
1443 +               writeb(readb(FLASHCTL) | FLCLE, FLASHCTL);
1444 +               break;
1445 +       case NAND_CTL_CLRCLE:
1446 +               writeb(readb(FLASHCTL) & ~FLCLE, FLASHCTL);
1447 +               break;
1448 +
1449 +       case NAND_CTL_SETALE:
1450 +               writeb(readb(FLASHCTL) | FLALE, FLASHCTL);
1451 +               break;
1452 +       case NAND_CTL_CLRALE:
1453 +               writeb(readb(FLASHCTL) & ~FLALE, FLASHCTL);
1454 +               break;
1455 +
1456 +       case NAND_CTL_SETNCE:
1457 +               writeb(readb(FLASHCTL) & ~(FLCE0|FLCE1), FLASHCTL);
1458 +               break;
1459 +       case NAND_CTL_CLRNCE:
1460 +               writeb(readb(FLASHCTL) | (FLCE0|FLCE1), FLASHCTL);
1461 +               break;
1462 +       }
1463 +}
1464 +
1465 +static int
1466 +sharpsl_nand_dev_ready(struct mtd_info* mtd)
1467 +{
1468 +       return !((readb(FLASHCTL) & FLRYBY) == 0);
1469 +}
1470 +
1471 +static void
1472 +sharpsl_nand_enable_hwecc(struct mtd_info* mtd, int mode)
1473 +{
1474 +       writeb(0 ,ECCCLRR);
1475 +}
1476 +
1477 +static int
1478 +sharpsl_nand_calculate_ecc(struct mtd_info* mtd, const u_char* dat,
1479 +                               u_char* ecc_code)
1480 +{
1481 +       ecc_code[0] = ~readb(ECCLPUB);
1482 +       ecc_code[1] = ~readb(ECCLPLB);
1483 +       ecc_code[2] = (~readb(ECCCP) << 2) | 0x03;
1484 +       return readb(ECCCNTR) != 0;
1485 +}
1486 +
1487 +static uint8_t scan_ff_pattern[] = { 0xff, 0xff };
1488 +
1489 +static struct nand_bbt_descr sharpsl_bbt = {
1490 +       .options = 0,
1491 +       .offs = 4,
1492 +       .len = 2,
1493 +       .pattern = scan_ff_pattern
1494 +};
1495 +
1496 +/*
1497 + * Board-specific NAND initialization. The following members of the
1498 + * argument are board-specific (per include/linux/mtd/nand.h):
1499 + * - IO_ADDR_R?: address to read the 8 I/O lines of the flash device
1500 + * - IO_ADDR_W?: address to write the 8 I/O lines of the flash device
1501 + * - hwcontrol: hardwarespecific function for accesing control-lines
1502 + * - dev_ready: hardwarespecific function for  accesing device ready/busy line
1503 + * - enable_hwecc?: function to enable (reset)  hardware ecc generator. Must
1504 + *   only be provided if a hardware ECC is available
1505 + * - eccmode: mode of ecc, see defines
1506 + * - chip_delay: chip dependent delay for transfering data from array to
1507 + *   read regs (tR)
1508 + * - options: various chip options. They can partly be set to inform
1509 + *   nand_scan about special functionality. See the defines for further
1510 + *   explanation
1511 + * Members with a "?" were not set in the merged testing-NAND branch,
1512 + * so they are not set here either.
1513 + */
1514 +void board_nand_init(struct nand_chip *nand)
1515 +{
1516 +       writeb(readb(FLASHCTL) | FLWP, FLASHCTL);
1517 +
1518 +       nand->IO_ADDR_R = FLASHIO;
1519 +       nand->IO_ADDR_W = FLASHIO;
1520 +       nand->hwcontrol = sharpsl_nand_hwcontrol;
1521 +       nand->dev_ready = sharpsl_nand_dev_ready;
1522 +       nand->eccmode = NAND_ECC_HW3_256;
1523 +       nand->chip_delay = 15;
1524 +       nand->badblock_pattern = &sharpsl_bbt;
1525 +       nand->enable_hwecc = sharpsl_nand_enable_hwecc;
1526 +       nand->calculate_ecc = sharpsl_nand_calculate_ecc;
1527 +       nand->correct_data = nand_correct_data;
1528 +}
1529 +#endif /* (CONFIG_COMMANDS & CFG_CMD_NAND) */
1530 diff -Nur u-boot-2006-04-18-1106/board/corgi/u-boot.lds u-boot-2006-04-18-1106-new/board/corgi/u-boot.lds
1531 --- u-boot-2006-04-18-1106/board/corgi/u-boot.lds       1970-01-01 00:00:00.000000000 +0000
1532 +++ u-boot-2006-04-18-1106-new/board/corgi/u-boot.lds   2006-07-05 11:19:44.000000000 +0000
1533 @@ -0,0 +1,56 @@
1534 +/*
1535 + * (C) Copyright 2000
1536 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
1537 + *
1538 + * See file CREDITS for list of people who contributed to this
1539 + * project.
1540 + *
1541 + * This program is free software; you can redistribute it and/or
1542 + * modify it under the terms of the GNU General Public License as
1543 + * published by the Free Software Foundation; either version 2 of
1544 + * the License, or (at your option) any later version.
1545 + *
1546 + * This program is distributed in the hope that it will be useful,
1547 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1548 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1549 + * GNU General Public License for more details.
1550 + *
1551 + * You should have received a copy of the GNU General Public License
1552 + * along with this program; if not, write to the Free Software
1553 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
1554 + * MA 02111-1307 USA
1555 + */
1556 +
1557 +OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
1558 +OUTPUT_ARCH(arm)
1559 +ENTRY(_start)
1560 +SECTIONS
1561 +{
1562 +       . = 0x00000000;
1563 +
1564 +       . = ALIGN(4);
1565 +       .text      :
1566 +       {
1567 +         cpu/pxa/start.o       (.text)
1568 +         *(.text)
1569 +       }
1570 +
1571 +       . = ALIGN(4);
1572 +       .rodata : { *(.rodata) }
1573 +
1574 +       . = ALIGN(4);
1575 +       .data : { *(.data) }
1576 +
1577 +       . = ALIGN(4);
1578 +       .got : { *(.got) }
1579 +
1580 +       . = .;
1581 +       __u_boot_cmd_start = .;
1582 +       .u_boot_cmd : { *(.u_boot_cmd) }
1583 +       __u_boot_cmd_end = .;
1584 +
1585 +       . = ALIGN(4);
1586 +       __bss_start = .;
1587 +       .bss : { *(.bss) }
1588 +       _end = .;
1589 +}
1590 diff -Nur u-boot-2006-04-18-1106/common/cmd_nand.c u-boot-2006-04-18-1106-new/common/cmd_nand.c
1591 --- u-boot-2006-04-18-1106/common/cmd_nand.c    2006-04-18 09:05:03.000000000 +0000
1592 +++ u-boot-2006-04-18-1106-new/common/cmd_nand.c        2006-07-05 11:19:44.000000000 +0000
1593 @@ -81,6 +81,63 @@
1594         return 0;
1595  }
1596  
1597 +#ifdef NAND_LOGICAL
1598 +/////////////////////////////////////////////////////////////////////
1599 +// oob structure
1600 +/////////////////////////////////////////////////////////////////////
1601 +
1602 +#define NAND_NOOB_LOGADDR_00           8
1603 +#define NAND_NOOB_LOGADDR_01           9
1604 +#define NAND_NOOB_LOGADDR_10           10
1605 +#define NAND_NOOB_LOGADDR_11           11
1606 +#define NAND_NOOB_LOGADDR_20           12
1607 +#define NAND_NOOB_LOGADDR_21           13
1608 +
1609 +static uint nand_get_logical_no(unsigned char *oob)
1610 +{
1611 +    unsigned short us,bit;
1612 +    int par;
1613 +    int good0, good1;
1614 +
1615 +    if(oob[NAND_NOOB_LOGADDR_00] == oob[NAND_NOOB_LOGADDR_10] &&
1616 +       oob[NAND_NOOB_LOGADDR_01] == oob[NAND_NOOB_LOGADDR_11]){
1617 +       good0 = NAND_NOOB_LOGADDR_00;
1618 +       good1 = NAND_NOOB_LOGADDR_01;
1619 +    }else
1620 +    if(oob[NAND_NOOB_LOGADDR_10] == oob[NAND_NOOB_LOGADDR_20] &&
1621 +       oob[NAND_NOOB_LOGADDR_11] == oob[NAND_NOOB_LOGADDR_21]){
1622 +       good0 = NAND_NOOB_LOGADDR_10;
1623 +       good1 = NAND_NOOB_LOGADDR_11;
1624 +    }else
1625 +    if(oob[NAND_NOOB_LOGADDR_20] == oob[NAND_NOOB_LOGADDR_00] &&
1626 +       oob[NAND_NOOB_LOGADDR_21] == oob[NAND_NOOB_LOGADDR_01]){
1627 +       good0 = NAND_NOOB_LOGADDR_20;
1628 +       good1 = NAND_NOOB_LOGADDR_21;
1629 +    }else{
1630 +       return (uint)-1;
1631 +    }
1632 +
1633 +    us = (((unsigned short)(oob[good0]) & 0x00ff) << 0) |
1634 +        (((unsigned short)(oob[good1]) & 0x00ff) << 8);
1635 +
1636 +    par = 0;
1637 +    for(bit = 0x0001; bit != 0; bit <<= 1){
1638 +       if(us & bit){
1639 +           par++;
1640 +       }
1641 +    }
1642 +    if(par & 1){
1643 +       return (uint)-2;
1644 +    }
1645 +
1646 +    if(us == 0xffff){
1647 +       return 0xffff;
1648 +    }else{
1649 +       return ((us & 0x07fe) >> 1);
1650 +    }
1651 +}
1652 +#endif
1653 +
1654  /* ------------------------------------------------------------------------- */
1655  
1656  static void
1657 @@ -245,6 +302,55 @@
1658                 if (off == 0 && size == 0)
1659                         return 1;
1660  
1661 +#ifdef NAND_LOGICAL
1662 +               s = strchr(cmd, '.');
1663 +               if (s != NULL) {
1664 +                       if (strcmp(s, ".logical") == 0) {
1665 +                               int blocks = NAND_LOGICAL_SIZE / nand->erasesize;
1666 +                               ulong *log2phy = malloc(blocks * sizeof(ulong));
1667 +                               u_char *oobuf = malloc(nand->oobblock + nand->oobsize);
1668 +                               int i;
1669 +                               ulong offset;
1670 +                               ret = 1;
1671 +                               for (i = 0; i < blocks; i++)
1672 +                                       log2phy[i] = (uint) -1;
1673 +                               offset = 0;
1674 +                               for (i = 0; i < blocks; i++) {
1675 +                                       ret = nand_read_raw(nand, oobuf, offset, nand->oobblock, nand->oobsize);
1676 +                                       if (!ret) {
1677 +                                               int log_no = nand_get_logical_no(oobuf + nand->oobblock);
1678 +                                               if (((int)log_no >= 0) && (log_no < blocks)) {
1679 +                                                       log2phy[log_no] = offset;
1680 +                                                       //printf("NAND logical - %08X -> %04X\n", offset, log_no);
1681 +                                               }
1682 +                                       }
1683 +                                       offset += nand->erasesize;
1684 +                               }
1685 +                               
1686 +                               for (i = 0; i < size / nand->erasesize; i++) {
1687 +                                       ulong sz = nand->erasesize;
1688 +                                       offset = log2phy[off / nand->erasesize];
1689 +                                       if ((int)offset < 0) {
1690 +                                               printf("NAND logical - offset %08X not found\n", off);
1691 +                                               return 1;
1692 +                                       }
1693 +                                       //printf("NAND logical - %04X -> %08X\n", off / nand->erasesize, offset);
1694 +                                       ret = nand_read(nand, offset, &sz, (u_char *)addr);
1695 +                                       if (ret) {
1696 +                                               printf("NAND logical - offset %08X, read error\n", off);
1697 +                                               return 1;
1698 +                                       }
1699 +                                       off += nand->erasesize;
1700 +                                       addr += nand->erasesize;
1701 +                               }
1702 +                               printf(" %d bytes read from NAND logical\n", size);
1703 +                               free(oobuf);
1704 +                               free(log2phy);
1705 +                               return ret == 0 ? 0 : 1;
1706 +                       }
1707 +               }
1708 +#endif
1709 +
1710                 i = strncmp(cmd, "read", 4) == 0;       /* 1 = read, 0 = write */
1711                 printf("\nNAND %s: device %d offset %u, size %u ... ",
1712                        i ? "read" : "write", nand_curr_device, off, size);
1713 diff -Nur u-boot-2006-04-18-1106/cpu/pxa/config.mk u-boot-2006-04-18-1106-new/cpu/pxa/config.mk
1714 --- u-boot-2006-04-18-1106/cpu/pxa/config.mk    2006-04-18 09:05:03.000000000 +0000
1715 +++ u-boot-2006-04-18-1106-new/cpu/pxa/config.mk        2006-07-05 11:19:44.000000000 +0000
1716 @@ -22,8 +22,7 @@
1717  # MA 02111-1307 USA
1718  #
1719  
1720 -PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8 \
1721 -       -msoft-float
1722 +PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8 -fomit-frame-pointer
1723  
1724  #PLATFORM_CPPFLAGS += -mapcs-32 -march=armv4 -mtune=strongarm1100
1725  PLATFORM_CPPFLAGS += -march=armv5 -mtune=xscale
1726 @@ -32,5 +31,5 @@
1727  # Supply options according to compiler version
1728  #
1729  # ========================================================================
1730 -PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu)
1731 +#PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu)
1732  PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
1733 diff -Nur u-boot-2006-04-18-1106/cpu/pxa/start.S u-boot-2006-04-18-1106-new/cpu/pxa/start.S
1734 --- u-boot-2006-04-18-1106/cpu/pxa/start.S      2006-04-18 09:05:03.000000000 +0000
1735 +++ u-boot-2006-04-18-1106-new/cpu/pxa/start.S  2006-07-05 11:19:44.000000000 +0000
1736 @@ -42,6 +42,7 @@
1737         ldr     pc, _irq
1738         ldr     pc, _fiq
1739  
1740 +_reset:                        .word reset
1741  _undefined_instruction: .word undefined_instruction
1742  _software_interrupt:   .word software_interrupt
1743  _prefetch_abort:       .word prefetch_abort
1744 diff -Nur u-boot-2006-04-18-1106/fs/cramfs/cramfs.c u-boot-2006-04-18-1106-new/fs/cramfs/cramfs.c
1745 --- u-boot-2006-04-18-1106/fs/cramfs/cramfs.c   2006-04-18 09:05:03.000000000 +0000
1746 +++ u-boot-2006-04-18-1106-new/fs/cramfs/cramfs.c       2006-07-05 11:19:44.000000000 +0000
1747 @@ -44,8 +44,13 @@
1748  
1749  /* CPU address space offset calculation macro, struct part_info offset is
1750   * device address space offset, so we need to shift it by a device start address. */
1751 +#if (CONFIG_COMMANDS & CFG_CMD_FLASH)
1752  extern flash_info_t flash_info[];
1753  #define PART_OFFSET(x) (x->offset + flash_info[x->dev->id->num].start[0])
1754 +#else
1755 +static struct cramfs_super super_fake;
1756 +#define PART_OFFSET(x) (&super_fake)
1757 +#endif
1758  
1759  static int cramfs_read_super (struct part_info *info)
1760  {
1761 diff -Nur u-boot-2006-04-18-1106/include/asm-arm/arch-pxa/pxa-regs.h u-boot-2006-04-18-1106-new/include/asm-arm/arch-pxa/pxa-regs.h
1762 --- u-boot-2006-04-18-1106/include/asm-arm/arch-pxa/pxa-regs.h  2006-04-18 09:05:03.000000000 +0000
1763 +++ u-boot-2006-04-18-1106-new/include/asm-arm/arch-pxa/pxa-regs.h      2006-07-05 11:19:44.000000000 +0000
1764 @@ -1269,15 +1269,16 @@
1765  #define _GEDR(x)       __REG2(0x40E00048, ((x) & 0x60) >> 3)
1766  #define _GAFR(x)       __REG2(0x40E00054, ((x) & 0x70) >> 2)
1767  
1768 -#define GPLR(x)                ((((x) & 0x7f) < 96) ? _GPLR(x) : GPLR3)
1769 -#define GPDR(x)                ((((x) & 0x7f) < 96) ? _GPDR(x) : GPDR3)
1770 -#define GPSR(x)                ((((x) & 0x7f) < 96) ? _GPSR(x) : GPSR3)
1771 -#define GPCR(x)                ((((x) & 0x7f) < 96) ? _GPCR(x) : GPCR3)
1772 -#define GRER(x)                ((((x) & 0x7f) < 96) ? _GRER(x) : GRER3)
1773 -#define GFER(x)                ((((x) & 0x7f) < 96) ? _GFER(x) : GFER3)
1774 -#define GEDR(x)                ((((x) & 0x7f) < 96) ? _GEDR(x) : GEDR3)
1775 -#define GAFR(x)                ((((x) & 0x7f) < 96) ? _GAFR(x) : \
1776 -                        ((((x) & 0x7f) < 112) ? GAFR3_L : GAFR3_U))
1777 +#define GPLR(x)        (*((((x) & 0x7f) < 96) ? &_GPLR(x) : &GPLR3))
1778 +#define GPDR(x)                (*((((x) & 0x7f) < 96) ? &_GPDR(x) : &GPDR3))
1779 +#define GPSR(x)                (*((((x) & 0x7f) < 96) ? &_GPSR(x) : &GPSR3))
1780 +#define GPCR(x)                (*((((x) & 0x7f) < 96) ? &_GPCR(x) : &GPCR3))
1781 +#define GRER(x)                (*((((x) & 0x7f) < 96) ? &_GRER(x) : &GRER3))
1782 +#define GFER(x)                (*((((x) & 0x7f) < 96) ? &_GFER(x) : &GFER3))
1783 +#define GEDR(x)                (*((((x) & 0x7f) < 96) ? &_GEDR(x) : &GEDR3))
1784 +#define GAFR(x)                (*((((x) & 0x7f) < 96) ? &_GAFR(x) : \
1785 +                        ((((x) & 0x7f) < 112) ? &GAFR3_L : &GAFR3_U)))
1786 +
1787  #else
1788  
1789  #define GPLR(x)                __REG2(0x40E00000, ((x) & 0x60) >> 3)
1790 diff -Nur u-boot-2006-04-18-1106/include/configs/akita.h u-boot-2006-04-18-1106-new/include/configs/akita.h
1791 --- u-boot-2006-04-18-1106/include/configs/akita.h      1970-01-01 00:00:00.000000000 +0000
1792 +++ u-boot-2006-04-18-1106-new/include/configs/akita.h  2006-07-13 11:00:46.000000000 +0000
1793 @@ -0,0 +1,324 @@
1794 +/*
1795 + * include/configs/akita.h
1796 + *
1797 + * Configuration settings for the Sharp Zaurus SL-C1000/C3100.
1798 + *
1799 + * (C) Copyright 2006 Alexander Chukov <sash@pdaXrom.org>
1800 + *
1801 + * portions from adsvix board configuration:
1802 + * (C) Copyright 2004
1803 + * Robert Whaley, Applied Data Systems, Inc. rwhaley@applieddata.net
1804 + * (C) Copyright 2002
1805 + * Kyle Harris, Nexus Technologies, Inc. kharris@nexus-tech.net
1806 + * (C) Copyright 2002
1807 + * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
1808 + * Marius Groeger <mgroeger@sysgo.de>
1809 + *
1810 + * See file CREDITS for list of people who contributed to this
1811 + * project.
1812 + *
1813 + * This program is free software; you can redistribute it and/or
1814 + * modify it under the terms of the GNU General Public License as
1815 + * published by the Free Software Foundation; either version 2 of
1816 + * the License, or (at your option) any later version.
1817 + *
1818 + * This program is distributed in the hope that it will be useful,
1819 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1820 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the
1821 + * GNU General Public License for more details.
1822 + *
1823 + * You should have received a copy of the GNU General Public License
1824 + * along with this program; if not, write to the Free Software
1825 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
1826 + * MA 02111-1307 USA
1827 + */
1828 +
1829 +#ifndef __CONFIG_H
1830 +#define __CONFIG_H
1831 +
1832 +#define CONFIG_SKIP_LOWLEVEL_INIT
1833 +
1834 +#undef SKIP_CONFIG_RELOCATE_UBOOT
1835 +
1836 +#undef CONFIG_HARD_I2C
1837 +
1838 +/*
1839 + * High Level Configuration Options
1840 + * (easy to change)
1841 + */
1842 +#define CONFIG_PXA27X          1       /* This is an PXA27x CPU */
1843 +#define CONFIG_AKITA           1       /* on Sharp Zaurus Akita */
1844 +//#define CONFIG_MMC                   1
1845 +#define BOARD_LATE_INIT                1
1846 +
1847 +#undef CONFIG_USE_IRQ                  /* we don't need IRQ/FIQ stuff */
1848 +
1849 +#define RTC                    1
1850 +
1851 +/*
1852 + * Size of malloc() pool
1853 + */
1854 +//#define CFG_MALLOC_LEN           (CFG_ENV_SIZE + 128*1024)
1855 +#define CFG_MALLOC_LEN     (CFG_ENV_SIZE + 256*1024)
1856 +#define CFG_GBL_DATA_SIZE      128     /* size in bytes reserved for initial data */
1857 +
1858 +/*
1859 + * select serial console configuration
1860 + */
1861 +#define CONFIG_FFUART         1       /* we use FFUART on Mainstone */
1862 +
1863 +/* allow to overwrite serial and ethaddr */
1864 +#define CONFIG_BAUDRATE               115200
1865 +//#define CONFIG_DOS_PARTITION   1
1866 +
1867 +#undef CONFIG_SHOW_BOOT_PROGRESS
1868 +
1869 +#if 1
1870 +#define        CONFIG_BOOTDELAY        1
1871 +#define CONFIG_AUTOBOOT_PROMPT  "Autobooting in %d seconds\n"
1872 +
1873 +#define        CONFIG_BOOTCOMMAND                                              \
1874 +       "if testkey 101 ; "                                                                                             \
1875 +       "then "                                                                                                         \
1876 +               "nand read.logical 0xa1000000 0x00060000 0x00540000; "                                                  \
1877 +               "setenv bootargs console=ttyS0,115200 console=tty1 root=/dev/ram rw fbcon=rotate:1 ramdisk_size=8192; " \
1878 +               "bootm; "                                                                                               \
1879 +       "fi; "                                                                                                          \
1880 +       "if testkey 2 ; "                                                                                               \
1881 +       "then "                                                                                                         \
1882 +               "nand read.logical 0xa1000000 0x005a0000 0x00160000; "                                                  \
1883 +               "setenv bootargs console=ttyS0,115200 console=tty1 root=/dev/mmcblk0p1 fbcon=rotate:1; "                \
1884 +               "bootm; "                                                                                               \
1885 +       "fi; "                                                                                                          \
1886 +       "if testkey 18 ; "                                                                                              \
1887 +       "then "                                                                                                         \
1888 +               "nand read.logical 0xa1000000 0x005a0000 0x00160000; "                                                  \
1889 +               "setenv bootargs console=ttyS0,115200 console=tty1 root=/dev/hda1 fbcon=rotate:1; "                     \
1890 +               "bootm; "                                                                                               \
1891 +       "fi; "                                                                                                          \
1892 +       "if testkey 3 ; "                                                                                               \
1893 +       "then "                                                                                                         \
1894 +               "nand read.logical 0xa1000000 0x005a0000 0x00160000; "                                                  \
1895 +               "setenv bootargs console=ttyS0,115200 console=tty1 root=/dev/hdc1 fbcon=rotate:1; "                     \
1896 +               "bootm; "                                                                                               \
1897 +       "fi; "                                                                                                          \
1898 +       "nand read.logical 0xa1000000 0x005a0000 0x00160000; "                                                          \
1899 +       "setenv bootargs console=ttyS0,115200 console=tty1 root=/dev/mtdblock2 rootfstype=jffs2 fbcon=rotate:1; "       \
1900 +       "bootm; "
1901 +#else
1902 +#define CONFIG_BOOTCOMMAND     "" // "run boot_flash"
1903 +#endif
1904 +
1905 +#define CONFIG_BOOTARGS                "console=ttyS0,115200 console=tty1 root=/dev/ram rw fbcon=rotate:1 ramdisk_size=8192"
1906 +#define CONFIG_SETUP_MEMORY_TAGS 1
1907 +#define CONFIG_CMDLINE_TAG      1      /* enable passing of ATAGs      */
1908 +#define CONFIG_INITRD_TAG       1
1909 +
1910 +#define CONFIG_COMMANDS                ((                              \
1911 +                                   CONFIG_CMD_DFL      |       \
1912 +                                   CFG_CMD_NAND        |       \
1913 +                                   CFG_CMD_JFFS2               \
1914 +                                   ) & ~(                      \
1915 +                                   CFG_CMD_NET         |       \
1916 +                                   CFG_CMD_FLASH       |       \
1917 +                                   CFG_CMD_IMLS                \
1918 +                               ))
1919 +
1920 +//                                 CFG_CMD_ENV
1921 +                       
1922 +/* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */
1923 +#include <cmd_confdefs.h>
1924 +
1925 +
1926 +#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
1927 +#define CONFIG_KGDB_BAUDRATE   230400          /* speed to run kgdb serial port */
1928 +#define CONFIG_KGDB_SER_INDEX  2               /* which serial port to use */
1929 +#endif
1930 +
1931 +/*
1932 + * Miscellaneous configurable options
1933 + */
1934 +#define CFG_HUSH_PARSER                1
1935 +#define CFG_PROMPT_HUSH_PS2    "> "
1936 +
1937 +#define CFG_LONGHELP                           /* undef to save memory         */
1938 +#define CFG_PROMPT             "U-Boot> "      /* Monitor Command Prompt */
1939 +
1940 +#define CFG_CBSIZE             256             /* Console I/O Buffer Size      */
1941 +#define CFG_PBSIZE (CFG_CBSIZE+sizeof(CFG_PROMPT)+16) /* Print Buffer Size */
1942 +#define CFG_MAXARGS            16              /* max number of command args   */
1943 +#define CFG_BARGSIZE           CFG_CBSIZE      /* Boot Argument Buffer Size    */
1944 +#define CFG_DEVICE_NULLDEV     1
1945 +
1946 +#define CFG_MEMTEST_START      0xa0400000      /* memtest works on     */
1947 +#define CFG_MEMTEST_END                0xa0800000      /* 4 ... 8 MB in DRAM   */
1948 +
1949 +#undef CFG_CLKS_IN_HZ          /* everything, incl board info, in Hz */
1950 +
1951 +#define CFG_LOAD_ADDR          0xa1000000      /* default load address */
1952 +
1953 +#define CFG_HZ                 3686400         /* incrementer freq: 3.6864 MHz */
1954 +#define CFG_CPUSPEED           0x207           /* need to look more closely, I think this is Turbo = 2x, L=91Mhz */
1955 +
1956 +                                               /* valid baudrates */
1957 +#define CFG_BAUDRATE_TABLE     { 9600, 19200, 38400, 57600, 115200 }
1958 +
1959 +#define CFG_MMC_BASE           0xF0000000
1960 +
1961 +/*
1962 + * Stack sizes
1963 + *
1964 + * The stack sizes are set up in start.S using the settings below
1965 + */
1966 +#define CONFIG_STACKSIZE       (128*1024)      /* regular stack */
1967 +#ifdef CONFIG_USE_IRQ
1968 +#define CONFIG_STACKSIZE_IRQ   (4*1024)        /* IRQ stack */
1969 +#define CONFIG_STACKSIZE_FIQ   (4*1024)        /* FIQ stack */
1970 +#endif
1971 +
1972 +/*
1973 + * Physical Memory Map
1974 + */
1975 +#define CONFIG_NR_DRAM_BANKS   4          /* we have 2 banks of DRAM */
1976 +#define PHYS_SDRAM_1           0xa0000000 /* SDRAM Bank #1 */
1977 +#define PHYS_SDRAM_1_SIZE      0x04000000 /* 64 MB */
1978 +#define PHYS_SDRAM_2           0xa4000000 /* SDRAM Bank #2 */
1979 +#define PHYS_SDRAM_2_SIZE      0x00000000 /* 0 MB */
1980 +#define PHYS_SDRAM_3           0xa8000000 /* SDRAM Bank #3 */
1981 +#define PHYS_SDRAM_3_SIZE      0x00000000 /* 0 MB */
1982 +#define PHYS_SDRAM_4           0xac000000 /* SDRAM Bank #4 */
1983 +#define PHYS_SDRAM_4_SIZE      0x00000000 /* 0 MB */
1984 +
1985 +#define PHYS_FLASH_1           0xd4000000 /* Flash Bank #1 */
1986 +
1987 +#define CFG_DRAM_BASE          0xa0000000
1988 +#define CFG_DRAM_SIZE          0x04000000
1989 +
1990 +#define CFG_FLASH_BASE         PHYS_FLASH_1
1991 +
1992 +/*
1993 + * GPIO settings for Mainstone
1994 + */
1995 +
1996 +#define CFG_GPSR0_VAL          0x00708800
1997 +#define CFG_GPSR1_VAL          0x03cf0002
1998 +#define CFG_GPSR2_VAL          0x0021FC00
1999 +#define CFG_GPSR3_VAL          0x00000000
2000 +
2001 +#define CFG_GPCR0_VAL          0x00001000
2002 +#define CFG_GPCR1_VAL          0x00000000
2003 +#define CFG_GPCR2_VAL          0x00000000
2004 +#define CFG_GPCR3_VAL          0x00000000
2005 +
2006 +#define CFG_GPDR0_VAL          0xC27B9C04
2007 +#define CFG_GPDR1_VAL          0x00EFAA83
2008 +#define CFG_GPDR2_VAL          0x0E23FC00
2009 +#define CFG_GPDR3_VAL          0x001E1F81
2010 +
2011 +#define CFG_GAFR0_L_VAL                0x94F00000
2012 +#define CFG_GAFR0_U_VAL                0x015A859A
2013 +#define CFG_GAFR1_L_VAL                0x999A955A
2014 +#define CFG_GAFR1_U_VAL                0x0005A4AA
2015 +#define CFG_GAFR2_L_VAL                0x6AA00000
2016 +#define CFG_GAFR2_U_VAL                0x55A8041A
2017 +#define CFG_GAFR3_L_VAL                0x56AA955A
2018 +#define CFG_GAFR3_U_VAL                0x00000001
2019 +
2020 +#define CFG_PSSR_VAL           0x20    // ???????????
2021 +
2022 +/*
2023 + * PCMCIA and CF Interfaces
2024 + */
2025 +#define CFG_MECR_VAL           0x00000001
2026 +#define CFG_MCMEM0_VAL         0x00010204
2027 +#define CFG_MCMEM1_VAL         0x00010204
2028 +#define CFG_MCATT0_VAL         0x00010204
2029 +#define CFG_MCATT1_VAL         0x00010204
2030 +#define CFG_MCIO0_VAL          0x0000c108
2031 +#define CFG_MCIO1_VAL          0x0001c108
2032 +
2033 +//#define CONFIG_PXA_PCMCIA 1
2034 +//#define CONFIG_PXA_IDE 1
2035 +
2036 +#define CONFIG_PCMCIA_SLOT_A 1
2037 +/* just to keep build system happy  */
2038 +
2039 +#define CFG_PCMCIA_MEM_ADDR     0x28000000
2040 +#define CFG_PCMCIA_MEM_SIZE     0x04000000
2041 +
2042 +#define CFG_IDE_MAXBUS         1
2043 +/* max. 1 IDE bus              */
2044 +#define CFG_IDE_MAXDEVICE      1
2045 +/* max. 1 drive per IDE bus    */
2046 +
2047 +#define CFG_ATA_IDE0_OFFSET    0x0000
2048 +
2049 +#define CFG_ATA_BASE_ADDR      0x20000000
2050 +
2051 +/* Offset for data I/O                 */
2052 +#define CFG_ATA_DATA_OFFSET    0x1f0
2053 +
2054 +/* Offset for normal register accesses */
2055 +#define CFG_ATA_REG_OFFSET     0x1f0
2056 +
2057 +/* Offset for alternate registers      */
2058 +#define CFG_ATA_ALT_OFFSET     0x3f0
2059 +
2060 +#define CFG_NO_FLASH 1
2061 +#define CFG_MAX_FLASH_BANKS    1       /* max number of memory banks           */
2062 +#define CFG_MAX_FLASH_SECT     512     /* max number of sectors on one chip    */
2063 +
2064 +/*-----------------------------------------------------------------------
2065 + * NAND-FLASH stuff
2066 + *-----------------------------------------------------------------------
2067 + */
2068 +#undef CFG_NAND_LEGACY
2069 +
2070 +/* NAND debugging */
2071 +//#define CONFIG_MTD_DEBUG
2072 +//#define CONFIG_MTD_DEBUG_VERBOSE 3
2073 +
2074 +#define CFG_NAND_BASE          0xd4000000
2075 +#define CFG_MAX_NAND_DEVICE    1       /* Max number of NAND devices           */
2076 +#define NAND_MAX_CHIPS                 1
2077 +
2078 +//#define CONFIG_MTD_NAND_VERIFY_WRITE 1  /* verify all writes!!!         */
2079 +//#define CFG_NAND_SKIP_BAD_DOT_I      1  /* ".i" read skips bad blocks   */
2080 +
2081 +#define CONFIG_JFFS2_NAND 1                    /* jffs2 on nand support */
2082 +#define NAND_CACHE_PAGES 16                    /* size of nand cache in 512 bytes pages */
2083 +
2084 +/*
2085 + * JFFS2 partitions
2086 + *
2087 + */
2088 +/* No command line, one static partition */
2089 +//#undef CONFIG_JFFS2_CMDLINE
2090 +//#define CONFIG_JFFS2_DEV             "nand0"
2091 +//#define CONFIG_JFFS2_PART_SIZE               0xFFFFFFFF
2092 +//#define CONFIG_JFFS2_PART_OFFSET     0x00060000
2093 +
2094 +/* mtdparts command line support */
2095 +/* Note: fake mtd_id used, no linux mtd map file */
2096 +
2097 +#define CONFIG_JFFS2_CMDLINE
2098 +#define MTDIDS_DEFAULT         "nand0=laze-0"
2099 +//#define MTDPARTS_DEFAULT     "mtdparts=laze-0:256k(uboot),128k(env),-(jffs2)"
2100 +#define MTDPARTS_DEFAULT       "mtdparts=laze-0:7168k(Logical),-(JFFS2)"
2101 +
2102 +/*
2103 + * SHARP SL NAND logical partition
2104 + */
2105 +#define NAND_LOGICAL           1
2106 +#define NAND_LOGICAL_SIZE      0x700000
2107 +
2108 +/*
2109 + * Environment
2110 + */
2111 +
2112 +#define CFG_ENV_IS_IN_NAND     1
2113 +#define CFG_ENV_OFFSET         0x40000
2114 +//#define CFG_ENV_OFFSET_REDUND        0x44000
2115 +#define CFG_ENV_SIZE           0x20000
2116 +
2117 +#endif /* __CONFIG_H */
2118 diff -Nur u-boot-2006-04-18-1106/include/configs/corgi.h u-boot-2006-04-18-1106-new/include/configs/corgi.h
2119 --- u-boot-2006-04-18-1106/include/configs/corgi.h      1970-01-01 00:00:00.000000000 +0000
2120 +++ u-boot-2006-04-18-1106-new/include/configs/corgi.h  2006-07-13 11:19:04.000000000 +0000
2121 @@ -0,0 +1,326 @@
2122 +/*
2123 + * include/configs/corgi.h
2124 + *
2125 + * Configuration settings for the Sharp Zaurus SL-C7x0/C860.
2126 + *
2127 + * (C) Copyright 2006 Alexander Chukov <sash@pdaXrom.org>
2128 + *
2129 + * portions from adsvix board configuration:
2130 + * (C) Copyright 2004
2131 + * Robert Whaley, Applied Data Systems, Inc. rwhaley@applieddata.net
2132 + * (C) Copyright 2002
2133 + * Kyle Harris, Nexus Technologies, Inc. kharris@nexus-tech.net
2134 + * (C) Copyright 2002
2135 + * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
2136 + * Marius Groeger <mgroeger@sysgo.de>
2137 + *
2138 + * See file CREDITS for list of people who contributed to this
2139 + * project.
2140 + *
2141 + * This program is free software; you can redistribute it and/or
2142 + * modify it under the terms of the GNU General Public License as
2143 + * published by the Free Software Foundation; either version 2 of
2144 + * the License, or (at your option) any later version.
2145 + *
2146 + * This program is distributed in the hope that it will be useful,
2147 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
2148 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the
2149 + * GNU General Public License for more details.
2150 + *
2151 + * You should have received a copy of the GNU General Public License
2152 + * along with this program; if not, write to the Free Software
2153 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
2154 + * MA 02111-1307 USA
2155 + */
2156 +
2157 +#ifndef __CONFIG_H
2158 +#define __CONFIG_H
2159 +
2160 +#define CONFIG_SKIP_LOWLEVEL_INIT
2161 +
2162 +#undef SKIP_CONFIG_RELOCATE_UBOOT
2163 +
2164 +#undef CONFIG_HARD_I2C
2165 +
2166 +/*
2167 + * High Level Configuration Options
2168 + * (easy to change)
2169 + */
2170 +#define CONFIG_PXA250          1       /* This is an PXA255 CPU    */
2171 +#define CONFIG_CORGI           1       /* on Sharp Zaurus Corgi    */
2172 +//#define CONFIG_MMC                   1
2173 +#define BOARD_LATE_INIT                1
2174 +
2175 +#undef CONFIG_USE_IRQ                  /* we don't need IRQ/FIQ stuff */
2176 +
2177 +#define RTC                    1
2178 +
2179 +/*
2180 + * Size of malloc() pool
2181 + */
2182 +//#define CFG_MALLOC_LEN           (CFG_ENV_SIZE + 128*1024)
2183 +#define CFG_MALLOC_LEN     (CFG_ENV_SIZE + 256*1024)
2184 +#define CFG_GBL_DATA_SIZE      128     /* size in bytes reserved for initial data */
2185 +
2186 +/*
2187 + * select serial console configuration
2188 + */
2189 +#define CONFIG_FFUART         1       /* we use FFUART on Mainstone */
2190 +
2191 +/* allow to overwrite serial and ethaddr */
2192 +#define CONFIG_BAUDRATE               115200
2193 +//#define CONFIG_DOS_PARTITION   1
2194 +
2195 +#undef CONFIG_SHOW_BOOT_PROGRESS
2196 +
2197 +#if 1
2198 +#define        CONFIG_BOOTDELAY        1
2199 +#define CONFIG_AUTOBOOT_PROMPT  "Autobooting in %d seconds\n"
2200 +
2201 +#define        CONFIG_BOOTCOMMAND                                              \
2202 +       "if testkey 101 ; "                                                                                             \
2203 +       "then "                                                                                                         \
2204 +               "nand read.logical 0xa0800000 0x00060000 0x00540000; "                                                  \
2205 +               "setenv bootargs console=ttyS0,115200 console=tty1 root=/dev/ram rw ramdisk_size=8192; "                \
2206 +               "bootm; "                                                                                               \
2207 +       "fi; "                                                                                                          \
2208 +       "if testkey 2 ; "                                                                                               \
2209 +       "then "                                                                                                         \
2210 +               "nand read.logical 0xa0800000 0x005a0000 0x00160000; "                                                  \
2211 +               "setenv bootargs console=ttyS0,115200 console=tty1 root=/dev/mmcblk0p1; "                               \
2212 +               "bootm; "                                                                                               \
2213 +       "fi; "                                                                                                          \
2214 +       "if testkey 18 ; "                                                                                              \
2215 +       "then "                                                                                                         \
2216 +               "nand read.logical 0xa0800000 0x005a0000 0x00160000; "                                                  \
2217 +               "setenv bootargs console=ttyS0,115200 console=tty1 root=/dev/hda1; "                                    \
2218 +               "bootm; "                                                                                               \
2219 +       "fi; "                                                                                                          \
2220 +       "if testkey 3 ; "                                                                                               \
2221 +       "then "                                                                                                         \
2222 +               "nand read.logical 0xa0800000 0x005a0000 0x00160000; "                                                  \
2223 +               "setenv bootargs console=ttyS0,115200 console=tty1 root=/dev/hdc1; "                                    \
2224 +               "bootm; "                                                                                               \
2225 +       "fi; "                                                                                                          \
2226 +       "nand read.logical 0xa0800000 0x005a0000 0x00160000; "                                                          \
2227 +       "setenv bootargs console=ttyS0,115200 console=tty1 root=/dev/mtdblock2 rootfstype=jffs2; "                      \
2228 +       "bootm; "
2229 +#else
2230 +#define CONFIG_BOOTCOMMAND     "" // "run boot_flash"
2231 +#endif
2232 +
2233 +#define CONFIG_BOOTARGS                "console=ttyS0,115200 console=tty1 root=/dev/ram rw ramdisk_size=8192"
2234 +#define CONFIG_SETUP_MEMORY_TAGS 1
2235 +#define CONFIG_CMDLINE_TAG      1      /* enable passing of ATAGs      */
2236 +#define CONFIG_INITRD_TAG       1
2237 +
2238 +#define CONFIG_COMMANDS                ((                              \
2239 +                                   CONFIG_CMD_DFL      |       \
2240 +                                   CFG_CMD_NAND        |       \
2241 +                                   CFG_CMD_JFFS2               \
2242 +                                   ) & ~(                      \
2243 +                                   CFG_CMD_NET         |       \
2244 +                                   CFG_CMD_FLASH       |       \
2245 +                                   CFG_CMD_IMLS                \
2246 +                               ))
2247 +
2248 +//                                 CFG_CMD_ENV
2249 +                       
2250 +/* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */
2251 +#include <cmd_confdefs.h>
2252 +
2253 +
2254 +#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
2255 +#define CONFIG_KGDB_BAUDRATE   230400          /* speed to run kgdb serial port */
2256 +#define CONFIG_KGDB_SER_INDEX  2               /* which serial port to use */
2257 +#endif
2258 +
2259 +/*
2260 + * Miscellaneous configurable options
2261 + */
2262 +#define CFG_HUSH_PARSER                1
2263 +#define CFG_PROMPT_HUSH_PS2    "> "
2264 +
2265 +#define CFG_LONGHELP                           /* undef to save memory         */
2266 +#define CFG_PROMPT             "U-Boot> "      /* Monitor Command Prompt */
2267 +
2268 +#define CFG_CBSIZE             256             /* Console I/O Buffer Size      */
2269 +#define CFG_PBSIZE (CFG_CBSIZE+sizeof(CFG_PROMPT)+16) /* Print Buffer Size */
2270 +#define CFG_MAXARGS            16              /* max number of command args   */
2271 +#define CFG_BARGSIZE           CFG_CBSIZE      /* Boot Argument Buffer Size    */
2272 +#define CFG_DEVICE_NULLDEV     1
2273 +
2274 +#define CFG_MEMTEST_START      0xa0400000      /* memtest works on     */
2275 +#define CFG_MEMTEST_END                0xa0800000      /* 4 ... 8 MB in DRAM   */
2276 +
2277 +#undef CFG_CLKS_IN_HZ          /* everything, incl board info, in Hz */
2278 +
2279 +#define CFG_LOAD_ADDR          0xa0800000      /* default load address */
2280 +
2281 +#define CFG_HZ                 3686400         /* incrementer freq: 3.6864 MHz */
2282 +#define CFG_CPUSPEED           0x207           /* need to look more closely, I think this is Turbo = 2x, L=91Mhz */
2283 +
2284 +                                               /* valid baudrates */
2285 +#define CFG_BAUDRATE_TABLE     { 9600, 19200, 38400, 57600, 115200 }
2286 +
2287 +#define CFG_MMC_BASE           0xF0000000
2288 +
2289 +/*
2290 + * Stack sizes
2291 + *
2292 + * The stack sizes are set up in start.S using the settings below
2293 + */
2294 +#define CONFIG_STACKSIZE       (128*1024)      /* regular stack */
2295 +#ifdef CONFIG_USE_IRQ
2296 +#define CONFIG_STACKSIZE_IRQ   (4*1024)        /* IRQ stack */
2297 +#define CONFIG_STACKSIZE_FIQ   (4*1024)        /* FIQ stack */
2298 +#endif
2299 +
2300 +/*
2301 + * Physical Memory Map
2302 + */
2303 +#define CONFIG_NR_DRAM_BANKS   4          /* we have 2 banks of DRAM */
2304 +#define PHYS_SDRAM_1           0xa0000000 /* SDRAM Bank #1 */
2305 +#define PHYS_SDRAM_1_SIZE      0x04000000 /* 64 MB */
2306 +#define PHYS_SDRAM_2           0xa4000000 /* SDRAM Bank #2 */
2307 +#define PHYS_SDRAM_2_SIZE      0x00000000 /* 0 MB */
2308 +#define PHYS_SDRAM_3           0xa8000000 /* SDRAM Bank #3 */
2309 +#define PHYS_SDRAM_3_SIZE      0x00000000 /* 0 MB */
2310 +#define PHYS_SDRAM_4           0xac000000 /* SDRAM Bank #4 */
2311 +#define PHYS_SDRAM_4_SIZE      0x00000000 /* 0 MB */
2312 +
2313 +#define PHYS_FLASH_1           0xd4000000 /* Flash Bank #1 */
2314 +
2315 +#define CFG_DRAM_BASE          0xa0000000
2316 +#define CFG_DRAM_SIZE          0x04000000
2317 +
2318 +#define CFG_FLASH_BASE         PHYS_FLASH_1
2319 +
2320 +/*
2321 + * GPIO settings for Mainstone
2322 + */
2323 +
2324 +#define CFG_GPSR0_VAL          0x00708800
2325 +#define CFG_GPSR1_VAL          0x03cf0002
2326 +#define CFG_GPSR2_VAL          0x0021FC00
2327 +#define CFG_GPSR3_VAL          0x00000000
2328 +
2329 +#define CFG_GPCR0_VAL          0x00001000
2330 +#define CFG_GPCR1_VAL          0x00000000
2331 +#define CFG_GPCR2_VAL          0x00000000
2332 +#define CFG_GPCR3_VAL          0x00000000
2333 +
2334 +#define CFG_GPDR0_VAL          0xC27B9C04
2335 +#define CFG_GPDR1_VAL          0x00EFAA83
2336 +#define CFG_GPDR2_VAL          0x0E23FC00
2337 +#define CFG_GPDR3_VAL          0x001E1F81
2338 +
2339 +#define CFG_GAFR0_L_VAL                0x94F00000
2340 +#define CFG_GAFR0_U_VAL                0x015A859A
2341 +#define CFG_GAFR1_L_VAL                0x999A955A
2342 +#define CFG_GAFR1_U_VAL                0x0005A4AA
2343 +#define CFG_GAFR2_L_VAL                0x6AA00000
2344 +#define CFG_GAFR2_U_VAL                0x55A8041A
2345 +#define CFG_GAFR3_L_VAL                0x56AA955A
2346 +#define CFG_GAFR3_U_VAL                0x00000001
2347 +
2348 +#define CFG_PSSR_VAL           0x20    // ???????????
2349 +
2350 +/*
2351 + * PCMCIA and CF Interfaces
2352 + */
2353 +#define CFG_MECR_VAL           0x00000001
2354 +#define CFG_MCMEM0_VAL         0x00010204
2355 +#define CFG_MCMEM1_VAL         0x00010204
2356 +#define CFG_MCATT0_VAL         0x00010204
2357 +#define CFG_MCATT1_VAL         0x00010204
2358 +#define CFG_MCIO0_VAL          0x0000c108
2359 +#define CFG_MCIO1_VAL          0x0001c108
2360 +
2361 +//#define CONFIG_PXA_PCMCIA 1
2362 +//#define CONFIG_PXA_IDE 1
2363 +
2364 +#define CONFIG_PCMCIA_SLOT_A 1
2365 +/* just to keep build system happy  */
2366 +
2367 +#define CFG_PCMCIA_MEM_ADDR     0x28000000
2368 +#define CFG_PCMCIA_MEM_SIZE     0x04000000
2369 +
2370 +#define CFG_IDE_MAXBUS         1
2371 +/* max. 1 IDE bus              */
2372 +#define CFG_IDE_MAXDEVICE      1
2373 +/* max. 1 drive per IDE bus    */
2374 +
2375 +#define CFG_ATA_IDE0_OFFSET    0x0000
2376 +
2377 +#define CFG_ATA_BASE_ADDR      0x20000000
2378 +
2379 +/* Offset for data I/O                 */
2380 +#define CFG_ATA_DATA_OFFSET    0x1f0
2381 +
2382 +/* Offset for normal register accesses */
2383 +#define CFG_ATA_REG_OFFSET     0x1f0
2384 +
2385 +/* Offset for alternate registers      */
2386 +#define CFG_ATA_ALT_OFFSET     0x3f0
2387 +
2388 +#define CFG_NO_FLASH 1
2389 +#define CFG_MAX_FLASH_BANKS    1       /* max number of memory banks           */
2390 +#define CFG_MAX_FLASH_SECT     512     /* max number of sectors on one chip    */
2391 +
2392 +/*-----------------------------------------------------------------------
2393 + * NAND-FLASH stuff
2394 + *-----------------------------------------------------------------------
2395 + */
2396 +#undef CFG_NAND_LEGACY
2397 +
2398 +/* NAND debugging */
2399 +//#define CONFIG_MTD_DEBUG
2400 +//#define CONFIG_MTD_DEBUG_VERBOSE 3
2401 +
2402 +#define CFG_NAND_BASE          0xd4000000
2403 +#define CFG_MAX_NAND_DEVICE    1       /* Max number of NAND devices           */
2404 +#define NAND_MAX_CHIPS                 1
2405 +
2406 +//#define CONFIG_MTD_NAND_VERIFY_WRITE 1  /* verify all writes!!!         */
2407 +//#define CFG_NAND_SKIP_BAD_DOT_I      1  /* ".i" read skips bad blocks   */
2408 +
2409 +#define CONFIG_JFFS2_NAND 1                    /* jffs2 on nand support */
2410 +#define NAND_CACHE_PAGES 16                    /* size of nand cache in 512 bytes pages */
2411 +
2412 +#define NAND_ALLOW_ERASE_ALL   1
2413 +
2414 +/*
2415 + * JFFS2 partitions
2416 + *
2417 + */
2418 +/* No command line, one static partition */
2419 +//#undef CONFIG_JFFS2_CMDLINE
2420 +//#define CONFIG_JFFS2_DEV             "nand0"
2421 +//#define CONFIG_JFFS2_PART_SIZE               0xFFFFFFFF
2422 +//#define CONFIG_JFFS2_PART_OFFSET     0x00060000
2423 +
2424 +/* mtdparts command line support */
2425 +/* Note: fake mtd_id used, no linux mtd map file */
2426 +
2427 +#define CONFIG_JFFS2_CMDLINE
2428 +#define MTDIDS_DEFAULT         "nand0=laze-0"
2429 +//#define MTDPARTS_DEFAULT     "mtdparts=laze-0:256k(uboot),128k(env),-(jffs2)"
2430 +#define MTDPARTS_DEFAULT       "mtdparts=laze-0:7168k(Logical),-(JFFS2)"
2431 +
2432 +/*
2433 + * SHARP SL NAND logical partition
2434 + */
2435 +#define NAND_LOGICAL           1
2436 +#define NAND_LOGICAL_SIZE      0x700000
2437 +
2438 +/*
2439 + * Environment
2440 + */
2441 +
2442 +#define CFG_ENV_IS_IN_NAND     1
2443 +#define CFG_ENV_OFFSET         0x40000
2444 +//#define CFG_ENV_OFFSET_REDUND        0x44000
2445 +#define CFG_ENV_SIZE           0x20000
2446 +
2447 +#endif /* __CONFIG_H */
2448 --- s/examples/Makefile.orig    2006-12-09 15:08:45.000000000 +0600
2449 +++ s/examples/Makefile 2006-12-09 15:09:00.000000000 +0600
2450 @@ -60,7 +60,7 @@
2451  include $(TOPDIR)/config.mk
2452  
2453  SREC   = hello_world.srec
2454 -BIN    = hello_world.bin hello_world
2455 +BIN    = hello_world hello_world.bin
2456  
2457  ifeq ($(CPU),mpc8xx)
2458  SREC   = test_burst.srec
2459 @@ -122,7 +122,7 @@
2460  
2461  CPPFLAGS += -I..
2462  
2463 -all:   .depend $(OBJS) $(LIB) $(SREC) $(BIN)
2464 +all:   .depend $(OBJS) $(LIB) $(BIN) $(SREC)
2465  
2466  #########################################################################
2467  $(LIB): .depend $(LIBOBJS)
2468 diff -Nur u-boot-2006-04-18-1106/CREDITS u-boot-2006-04-18-1106-new/CREDITS
2469 --- u-boot-2006-04-18-1106/CREDITS      2006-04-18 09:05:03.000000000 +0000
2470 +++ u-boot-2006-04-18-1106-new/CREDITS  2006-07-05 11:19:44.000000000 +0000
2471 @@ -93,6 +93,12 @@
2472  E: jonathan.debruyne@siemens.atea.be
2473  D: Port to Siemens IAD210 board
2474  
2475 +N: Alexander Chukov
2476 +E: sash@pdaXrom.org
2477 +D: initial support for Sharp Zaurus SL-C1000/3100
2478 +D: initial support for Sharp Zaurus SL-C7x0/C860
2479 +W: http://www.pdaXrom.org
2480 +
2481  N: Ken Chou
2482  E: kchou@ieee.org
2483  D: Support for A3000 SBC board
2484 diff -Nur u-boot-2006-04-18-1106/MAINTAINERS u-boot-2006-04-18-1106-new/MAINTAINERS
2485 --- u-boot-2006-04-18-1106/MAINTAINERS  2006-04-18 09:05:03.000000000 +0000
2486 +++ u-boot-2006-04-18-1106-new/MAINTAINERS      2006-07-05 11:19:44.000000000 +0000
2487 @@ -379,6 +379,11 @@
2488  
2489         AT91RM9200DK            at91rm9200
2490  
2491 +Alexander Chukov <sash@pdaXrom.org>
2492 +
2493 +       akita                   xscale
2494 +       corgi                   xscale
2495 +
2496  George G. Davis <gdavis@mvista.com>
2497  
2498         assabet                 SA1100
2499 diff -Nur u-boot-2006-04-18-1106/MAKEALL u-boot-2006-04-18-1106-new/MAKEALL
2500 --- u-boot-2006-04-18-1106/MAKEALL      2006-04-18 09:05:03.000000000 +0000
2501 +++ u-boot-2006-04-18-1106-new/MAKEALL  2006-07-05 11:19:44.000000000 +0000
2502 @@ -206,7 +206,7 @@
2503         adsvix          cerf250         cradle          csb226          \
2504         delta           innokom         lubbock         pxa255_idp      \
2505         wepep250        xaeniax         xm250           xsengine        \
2506 -       zylonite                                                        \
2507 +       zylonite        akita   corgi                                   \
2508  "
2509  
2510  LIST_ixp="ixdp425"
2511 diff -Nur u-boot-2006-04-18-1106/Makefile u-boot-2006-04-18-1106-new/Makefile
2512 --- u-boot-2006-04-18-1106/Makefile     2006-04-18 09:05:03.000000000 +0000
2513 +++ u-boot-2006-04-18-1106-new/Makefile 2006-07-05 11:19:44.000000000 +0000
2514 @@ -61,7 +61,7 @@
2515  CROSS_COMPILE = powerpc-linux-
2516  endif
2517  ifeq ($(ARCH),arm)
2518 -CROSS_COMPILE = arm-linux-
2519 +CROSS_COMPILE = armv5tel-linux-
2520  endif
2521  ifeq ($(ARCH),i386)
2522  ifeq ($(HOSTARCH),i386)
2523 @@ -1709,6 +1709,12 @@
2524  zylonite_config :
2525         @./mkconfig $(@:_config=) arm pxa zylonite
2526  
2527 +akita_config   :       unconfig
2528 +       @./mkconfig $(@:_config=) arm pxa akita
2529 +
2530 +corgi_config   :       unconfig
2531 +       @./mkconfig $(@:_config=) arm pxa corgi
2532 +
2533  #########################################################################
2534  ## ARM1136 Systems
2535  #########################################################################
2536 diff -Nur u-boot-2006-04-18-1106/README u-boot-2006-04-18-1106-new/README
2537 --- u-boot-2006-04-18-1106/README       2006-04-18 09:05:03.000000000 +0000
2538 +++ u-boot-2006-04-18-1106-new/README   2006-07-05 11:19:44.000000000 +0000
2539 @@ -311,7 +311,8 @@
2540                 CONFIG_KB9202,          CONFIG_LART,            CONFIG_LPD7A400,
2541                 CONFIG_LUBBOCK,         CONFIG_OSK_OMAP5912,    CONFIG_OMAP2420H4,
2542                 CONFIG_SHANNON,         CONFIG_P2_OMAP730,      CONFIG_SMDK2400,
2543 -               CONFIG_SMDK2410,        CONFIG_TRAB,            CONFIG_VCMA9
2544 +               CONFIG_SMDK2410,        CONFIG_TRAB,            CONFIG_VCMA9,
2545 +               CONFIG_AKITA,           CONFIG_CORGI
2546  
2547                 MicroBlaze based boards:
2548                 ------------------------
2549 diff -Nur u-boot-2006-04-18-1106/board/akita/Makefile u-boot-2006-04-18-1106-new/board/akita/Makefile
2550 --- u-boot-2006-04-18-1106/board/akita/Makefile 1970-01-01 00:00:00.000000000 +0000
2551 +++ u-boot-2006-04-18-1106-new/board/akita/Makefile     2006-07-05 11:19:44.000000000 +0000
2552 @@ -0,0 +1,51 @@
2553 +#
2554 +# board/akita/Makefile
2555 +#
2556 +# (C) Copyright 2006 Alexander Chukov <sash@pdaXrom.org>
2557 +#
2558 +# (C) Copyright 2000
2559 +# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
2560 +#
2561 +# See file CREDITS for list of people who contributed to this
2562 +# project.
2563 +#
2564 +# This program is free software; you can redistribute it and/or
2565 +# modify it under the terms of the GNU General Public License as
2566 +# published by the Free Software Foundation; either version 2 of
2567 +# the License, or (at your option) any later version.
2568 +#
2569 +# This program is distributed in the hope that it will be useful,
2570 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
2571 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2572 +# GNU General Public License for more details.
2573 +#
2574 +# You should have received a copy of the GNU General Public License
2575 +# along with this program; if not, write to the Free Software
2576 +# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
2577 +# MA 02111-1307 USA
2578 +#
2579 +
2580 +include $(TOPDIR)/config.mk
2581 +
2582 +LIB    = lib$(BOARD).a
2583 +
2584 +OBJS   := akita.o nand.o kbd.o
2585 +SOBJS  := lowlevel_init.o
2586 +
2587 +$(LIB):        $(OBJS) $(SOBJS)
2588 +       $(AR) crv $@ $(OBJS) $(SOBJS)
2589 +
2590 +clean:
2591 +       rm -f $(SOBJS) $(OBJS)
2592 +
2593 +distclean:     clean
2594 +       rm -f $(LIB) core *.bak .depend
2595 +
2596 +#########################################################################
2597 +
2598 +.depend:       Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c)
2599 +               $(CC) -M $(CPPFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
2600 +
2601 +-include .depend
2602 +
2603 +#########################################################################
2604 diff -Nur u-boot-2006-04-18-1106/board/akita/akita.c u-boot-2006-04-18-1106-new/board/akita/akita.c
2605 --- u-boot-2006-04-18-1106/board/akita/akita.c  1970-01-01 00:00:00.000000000 +0000
2606 +++ u-boot-2006-04-18-1106-new/board/akita/akita.c      2006-07-05 11:19:44.000000000 +0000
2607 @@ -0,0 +1,89 @@
2608 +/*
2609 + * board/akita/akita.c
2610 + *
2611 + * Configuration settings for the Sharp Zaurus SL-Cxx00.
2612 + *
2613 + * (C) Copyright 2006 Alexander Chukov <sash@pdaXrom.org>
2614 + *
2615 + * portions from adsvix board configuration:
2616 + * (C) Copyright 2004
2617 + * Robert Whaley, Applied Data Systems, Inc. rwhaley@applieddata.net
2618 + * (C) Copyright 2002
2619 + * Kyle Harris, Nexus Technologies, Inc. kharris@nexus-tech.net
2620 + * (C) Copyright 2002
2621 + * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
2622 + * Marius Groeger <mgroeger@sysgo.de>
2623 + *
2624 + * See file CREDITS for list of people who contributed to this
2625 + * project.
2626 + *
2627 + * This program is free software; you can redistribute it and/or
2628 + * modify it under the terms of the GNU General Public License as
2629 + * published by the Free Software Foundation; either version 2 of
2630 + * the License, or (at your option) any later version.
2631 + *
2632 + * This program is distributed in the hope that it will be useful,
2633 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
2634 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2635 + * GNU General Public License for more details.
2636 + *
2637 + * You should have received a copy of the GNU General Public License
2638 + * along with this program; if not, write to the Free Software
2639 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
2640 + * MA 02111-1307 USA
2641 + */
2642 +
2643 +#include <common.h>
2644 +
2645 +void set_turbo_mode(void);
2646 +
2647 +/* ------------------------------------------------------------------------- */
2648 +
2649 +/*
2650 + * Miscellaneous platform dependent initialisations
2651 + */
2652 +
2653 +int board_init (void)
2654 +{
2655 +       DECLARE_GLOBAL_DATA_PTR;
2656 +
2657 +       /* memory and cpu-speed are setup before relocation */
2658 +       /* so we do _nothing_ here */
2659 +
2660 +       /* arch number of Sharp Zaurus Akita : MACH_TYPE_AKITA */
2661 +       gd->bd->bi_arch_number = 744;
2662 +
2663 +       /* adress of boot parameters */
2664 +       gd->bd->bi_boot_params = 0xa0000100;
2665 +
2666 +       /* set cpu turbo mode */
2667 +       set_turbo_mode();
2668 +
2669 +       spitzkbd_init();
2670 +
2671 +       return 0;
2672 +}
2673 +
2674 +int board_late_init(void)
2675 +{
2676 +       setenv("stdout", "serial");
2677 +       setenv("stderr", "serial");
2678 +       return 0;
2679 +}
2680 +
2681 +
2682 +int dram_init (void)
2683 +{
2684 +       DECLARE_GLOBAL_DATA_PTR;
2685 +
2686 +       gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
2687 +       gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
2688 +       gd->bd->bi_dram[1].start = PHYS_SDRAM_2;
2689 +       gd->bd->bi_dram[1].size = PHYS_SDRAM_2_SIZE;
2690 +       gd->bd->bi_dram[2].start = PHYS_SDRAM_3;
2691 +       gd->bd->bi_dram[2].size = PHYS_SDRAM_3_SIZE;
2692 +       gd->bd->bi_dram[3].start = PHYS_SDRAM_4;
2693 +       gd->bd->bi_dram[3].size = PHYS_SDRAM_4_SIZE;
2694 +
2695 +       return 0;
2696 +}
2697 diff -Nur u-boot-2006-04-18-1106/board/akita/config.mk u-boot-2006-04-18-1106-new/board/akita/config.mk
2698 --- u-boot-2006-04-18-1106/board/akita/config.mk        1970-01-01 00:00:00.000000000 +0000
2699 +++ u-boot-2006-04-18-1106-new/board/akita/config.mk    2006-07-05 11:19:44.000000000 +0000
2700 @@ -0,0 +1 @@
2701 +TEXT_BASE = 0xa3000000
2702 diff -Nur u-boot-2006-04-18-1106/board/akita/kbd.c u-boot-2006-04-18-1106-new/board/akita/kbd.c
2703 --- u-boot-2006-04-18-1106/board/akita/kbd.c    1970-01-01 00:00:00.000000000 +0000
2704 +++ u-boot-2006-04-18-1106-new/board/akita/kbd.c        2006-07-05 11:19:44.000000000 +0000
2705 @@ -0,0 +1,261 @@
2706 +/*
2707 + * board/akita/kbd.c
2708 + *
2709 + * Keyboard driver for the Sharp Zaurus SL-Cxx00.
2710 + *
2711 + * (C) Copyright 2006 Alexander Chukov <sash@pdaXrom.org>
2712 + *
2713 + * portions from:
2714 + *
2715 + * linux/drivers/input/keyboard/spitzkbd.c
2716 + *
2717 + * Keyboard driver for Sharp Spitz, Borzoi and Akita (SL-Cxx00 series)
2718 + *
2719 + * Copyright (C) 2005 Richard Purdie
2720 + *
2721 + * See file CREDITS for list of people who contributed to this
2722 + * project.
2723 + *
2724 + * This program is free software; you can redistribute it and/or
2725 + * modify it under the terms of the GNU General Public License as
2726 + * published by the Free Software Foundation; either version 2 of
2727 + * the License, or (at your option) any later version.
2728 + *
2729 + * This program is distributed in the hope that it will be useful,
2730 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
2731 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2732 + * GNU General Public License for more details.
2733 + *
2734 + * You should have received a copy of the GNU General Public License
2735 + * along with this program; if not, write to the Free Software
2736 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
2737 + * MA 02111-1307 USA
2738 + */
2739 +
2740 +#include <common.h>
2741 +#include <command.h>
2742 +#include <config.h>
2743 +#include <version.h>
2744 +#include <asm/arch/pxa-regs.h>
2745 +
2746 +#define GPIO_DFLT_LOW          0x400
2747 +#define GPIO_DFLT_HIGH         0x800
2748 +
2749 +void pxa_gpio_mode(int gpio_mode)
2750 +{
2751 +       int gpio = gpio_mode & GPIO_MD_MASK_NR;
2752 +       int fn = (gpio_mode & GPIO_MD_MASK_FN) >> 8;
2753 +       int gafr;
2754 +
2755 +       if (gpio_mode & GPIO_DFLT_LOW)
2756 +               GPCR(gpio) = GPIO_bit(gpio);
2757 +       else if (gpio_mode & GPIO_DFLT_HIGH)
2758 +               GPSR(gpio) = GPIO_bit(gpio);
2759 +       if (gpio_mode & GPIO_MD_MASK_DIR)
2760 +               GPDR(gpio) |= GPIO_bit(gpio);
2761 +       else
2762 +               GPDR(gpio) &= ~GPIO_bit(gpio);
2763 +       gafr = GAFR(gpio) & ~(0x3 << (((gpio) & 0xf)*2));
2764 +       GAFR(gpio) = gafr |  (fn  << (((gpio) & 0xf)*2));
2765 +}
2766 +
2767 +#define SPITZ_KEY_STROBE_NUM         (11)
2768 +#define SPITZ_KEY_SENSE_NUM          (7)
2769 +
2770 +#define SPITZ_GPIO_G0_STROBE_BIT     0x0f800000
2771 +#define SPITZ_GPIO_G1_STROBE_BIT     0x00100000
2772 +#define SPITZ_GPIO_G2_STROBE_BIT     0x01000000
2773 +#define SPITZ_GPIO_G3_STROBE_BIT     0x00041880
2774 +#define SPITZ_GPIO_G0_SENSE_BIT      0x00021000
2775 +#define SPITZ_GPIO_G1_SENSE_BIT      0x000000d4
2776 +#define SPITZ_GPIO_G2_SENSE_BIT      0x08000000
2777 +#define SPITZ_GPIO_G3_SENSE_BIT      0x00000000
2778 +
2779 +#define SPITZ_GPIO_KEY_STROBE0       88
2780 +#define SPITZ_GPIO_KEY_STROBE1       23
2781 +#define SPITZ_GPIO_KEY_STROBE2       24
2782 +#define SPITZ_GPIO_KEY_STROBE3       25
2783 +#define SPITZ_GPIO_KEY_STROBE4       26
2784 +#define SPITZ_GPIO_KEY_STROBE5       27
2785 +#define SPITZ_GPIO_KEY_STROBE6       52
2786 +#define SPITZ_GPIO_KEY_STROBE7       103
2787 +#define SPITZ_GPIO_KEY_STROBE8       107
2788 +#define SPITZ_GPIO_KEY_STROBE9       108
2789 +#define SPITZ_GPIO_KEY_STROBE10      114
2790 +
2791 +#define SPITZ_GPIO_KEY_SENSE0        12
2792 +#define SPITZ_GPIO_KEY_SENSE1        17
2793 +#define SPITZ_GPIO_KEY_SENSE2        91
2794 +#define SPITZ_GPIO_KEY_SENSE3        34
2795 +#define SPITZ_GPIO_KEY_SENSE4        36
2796 +#define SPITZ_GPIO_KEY_SENSE5        38
2797 +#define SPITZ_GPIO_KEY_SENSE6        39
2798 +
2799 +#define SPITZ_GPIO_ON_KEY          (95)
2800 +
2801 +#define KB_ROWS                        7
2802 +#define KB_COLS                        11
2803 +#define KB_ROWMASK(r)          (1 << (r))
2804 +#define SCANCODE(r,c)          (((r)<<4) + (c) + 1)
2805 +#define        NR_SCANCODES            ((KB_ROWS<<4) + 1)
2806 +
2807 +#define SCAN_INTERVAL          (50) /* ms */
2808 +#define HINGE_SCAN_INTERVAL    (150) /* ms */
2809 +
2810 +#define KB_DISCHARGE_DELAY     10
2811 +#define KB_ACTIVATE_DELAY      10
2812 +
2813 +static int spitz_strobes[] = {
2814 +       SPITZ_GPIO_KEY_STROBE0,
2815 +       SPITZ_GPIO_KEY_STROBE1,
2816 +       SPITZ_GPIO_KEY_STROBE2,
2817 +       SPITZ_GPIO_KEY_STROBE3,
2818 +       SPITZ_GPIO_KEY_STROBE4,
2819 +       SPITZ_GPIO_KEY_STROBE5,
2820 +       SPITZ_GPIO_KEY_STROBE6,
2821 +       SPITZ_GPIO_KEY_STROBE7,
2822 +       SPITZ_GPIO_KEY_STROBE8,
2823 +       SPITZ_GPIO_KEY_STROBE9,
2824 +       SPITZ_GPIO_KEY_STROBE10,
2825 +};
2826 +
2827 +static int spitz_senses[] = {
2828 +       SPITZ_GPIO_KEY_SENSE0,
2829 +       SPITZ_GPIO_KEY_SENSE1,
2830 +       SPITZ_GPIO_KEY_SENSE2,
2831 +       SPITZ_GPIO_KEY_SENSE3,
2832 +       SPITZ_GPIO_KEY_SENSE4,
2833 +       SPITZ_GPIO_KEY_SENSE5,
2834 +       SPITZ_GPIO_KEY_SENSE6,
2835 +};
2836 +
2837 +static inline void spitzkbd_discharge_all(void)
2838 +{
2839 +       /* STROBE All HiZ */
2840 +       GPCR0  =  SPITZ_GPIO_G0_STROBE_BIT;
2841 +       GPDR0 &= ~SPITZ_GPIO_G0_STROBE_BIT;
2842 +       GPCR1  =  SPITZ_GPIO_G1_STROBE_BIT;
2843 +       GPDR1 &= ~SPITZ_GPIO_G1_STROBE_BIT;
2844 +       GPCR2  =  SPITZ_GPIO_G2_STROBE_BIT;
2845 +       GPDR2 &= ~SPITZ_GPIO_G2_STROBE_BIT;
2846 +       GPCR3  =  SPITZ_GPIO_G3_STROBE_BIT;
2847 +       GPDR3 &= ~SPITZ_GPIO_G3_STROBE_BIT;
2848 +}
2849 +
2850 +static inline void spitzkbd_activate_all(void)
2851 +{
2852 +       /* STROBE ALL -> High */
2853 +       GPSR0  =  SPITZ_GPIO_G0_STROBE_BIT;
2854 +       GPDR0 |=  SPITZ_GPIO_G0_STROBE_BIT;
2855 +       GPSR1  =  SPITZ_GPIO_G1_STROBE_BIT;
2856 +       GPDR1 |=  SPITZ_GPIO_G1_STROBE_BIT;
2857 +       GPSR2  =  SPITZ_GPIO_G2_STROBE_BIT;
2858 +       GPDR2 |=  SPITZ_GPIO_G2_STROBE_BIT;
2859 +       GPSR3  =  SPITZ_GPIO_G3_STROBE_BIT;
2860 +       GPDR3 |=  SPITZ_GPIO_G3_STROBE_BIT;
2861 +
2862 +       udelay(KB_DISCHARGE_DELAY);
2863 +}
2864 +
2865 +static inline void spitzkbd_activate_col(int col)
2866 +{
2867 +       int gpio = spitz_strobes[col];
2868 +       GPDR0 &= ~SPITZ_GPIO_G0_STROBE_BIT;
2869 +       GPDR1 &= ~SPITZ_GPIO_G1_STROBE_BIT;
2870 +       GPDR2 &= ~SPITZ_GPIO_G2_STROBE_BIT;
2871 +       GPDR3 &= ~SPITZ_GPIO_G3_STROBE_BIT;
2872 +       GPSR(gpio) = GPIO_bit(gpio);
2873 +       GPDR(gpio) |= GPIO_bit(gpio);
2874 +}
2875 +
2876 +static inline void spitzkbd_reset_col(int col)
2877 +{
2878 +       int gpio = spitz_strobes[col];
2879 +       GPDR0 &= ~SPITZ_GPIO_G0_STROBE_BIT;
2880 +       GPDR1 &= ~SPITZ_GPIO_G1_STROBE_BIT;
2881 +       GPDR2 &= ~SPITZ_GPIO_G2_STROBE_BIT;
2882 +       GPDR3 &= ~SPITZ_GPIO_G3_STROBE_BIT;
2883 +       GPCR(gpio) = GPIO_bit(gpio);
2884 +       GPDR(gpio) |= GPIO_bit(gpio);
2885 +}
2886 +
2887 +static inline int spitzkbd_get_row_status(int col)
2888 +{
2889 +       return ((GPLR0 >> 12) & 0x01) | ((GPLR0 >> 16) & 0x02)
2890 +               | ((GPLR2 >> 25) & 0x04) | ((GPLR1 << 1) & 0x08)
2891 +               | ((GPLR1 >> 0) & 0x10) | ((GPLR1 >> 1) & 0x60);
2892 +}
2893 +
2894 +static int spitzkbd_scankeyboard(void)
2895 +{
2896 +       unsigned int row, col, rowd;
2897 +       unsigned int num_pressed, pwrkey = ((GPLR(SPITZ_GPIO_ON_KEY) & GPIO_bit(SPITZ_GPIO_ON_KEY)) != 0);
2898 +       int ret = -1;
2899 +
2900 +       num_pressed = 0;
2901 +       for (col = 0; col < KB_COLS; col++) {
2902 +               spitzkbd_discharge_all();
2903 +               udelay(KB_DISCHARGE_DELAY);
2904 +
2905 +               spitzkbd_activate_col(col);
2906 +               udelay(KB_ACTIVATE_DELAY);
2907 +
2908 +               rowd = spitzkbd_get_row_status(col);
2909 +               for (row = 0; row < KB_ROWS; row++) {
2910 +                       unsigned int scancode, pressed;
2911 +
2912 +                       scancode = SCANCODE(row, col);
2913 +                       pressed = rowd & KB_ROWMASK(row);
2914 +
2915 +                       if (pressed)
2916 +                               ret = scancode;
2917 +               }
2918 +               spitzkbd_reset_col(col);
2919 +       }
2920 +
2921 +       spitzkbd_activate_all();
2922 +
2923 +       if (pwrkey)
2924 +               return -2;
2925 +       
2926 +       return ret;
2927 +}
2928 +
2929 +void spitzkbd_init(void)
2930 +{
2931 +       int i;
2932 +
2933 +       /* Setup sense interrupts - RisingEdge Detect, sense lines as inputs */
2934 +       for (i = 0; i < SPITZ_KEY_SENSE_NUM; i++)
2935 +               pxa_gpio_mode(spitz_senses[i] | GPIO_IN);
2936 +
2937 +       /* Set Strobe lines as outputs - set high */
2938 +       for (i = 0; i < SPITZ_KEY_STROBE_NUM; i++)
2939 +               pxa_gpio_mode(spitz_strobes[i] | GPIO_OUT | GPIO_DFLT_HIGH);
2940 +
2941 +       pxa_gpio_mode(SPITZ_GPIO_ON_KEY | GPIO_IN);
2942 +}
2943 +
2944 +int do_testkey(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
2945 +{
2946 +       int scan;
2947 +       
2948 +       if (argc < 2)
2949 +               return 1;
2950 +
2951 +       scan = spitzkbd_scankeyboard();
2952 +
2953 +
2954 +//     if (scan >= 0)
2955 +//             printf("Scan = %d\n", scan);
2956 +//     else
2957 +//             printf("Nothing!\n");
2958 +
2959 +       return !(simple_strtol(argv[1], NULL, 10) == scan);
2960 +}
2961 +
2962 +U_BOOT_CMD(
2963 +       testkey,   2,      1,      do_testkey,
2964 +       "testkey - compare pressed key with arg\n",
2965 +       "<key scancode>"
2966 +);
2967 diff -Nur u-boot-2006-04-18-1106/board/akita/lowlevel_init.S u-boot-2006-04-18-1106-new/board/akita/lowlevel_init.S
2968 --- u-boot-2006-04-18-1106/board/akita/lowlevel_init.S  1970-01-01 00:00:00.000000000 +0000
2969 +++ u-boot-2006-04-18-1106-new/board/akita/lowlevel_init.S      2006-07-05 11:19:44.000000000 +0000
2970 @@ -0,0 +1,135 @@
2971 +/*
2972 + * board/akita/lowlevel_init.S
2973 + *
2974 + * Configuration settings for the Sharp Zaurus SL-Cxx00.
2975 + *
2976 + * (C) Copyright 2006 Alexander Chukov <sash@pdaXrom.org>
2977 + *
2978 + * This was originally from the Lubbock u-boot port and from BLOB with cleanup
2979 + *
2980 + * NOTE: I haven't clean this up considerably, just enough to get it
2981 + * running. See hal_platform_setup.h for the source. See
2982 + * board/cradle/lowlevel_init.S for another PXA250 setup that is
2983 + * much cleaner.
2984 + *
2985 + * See file CREDITS for list of people who contributed to this
2986 + * project.
2987 + *
2988 + * This program is free software; you can redistribute it and/or
2989 + * modify it under the terms of the GNU General Public License as
2990 + * published by the Free Software Foundation; either version 2 of
2991 + * the License, or (at your option) any later version.
2992 + *
2993 + * This program is distributed in the hope that it will be useful,
2994 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
2995 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the
2996 + * GNU General Public License for more details.
2997 + *
2998 + * You should have received a copy of the GNU General Public License
2999 + * along with this program; if not, write to the Free Software
3000 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
3001 + * MA 02111-1307 USA
3002 + */
3003 +
3004 +#include <config.h>
3005 +#include <version.h>
3006 +#include <asm/arch/pxa-regs.h>
3007 +
3008 +/* wait for coprocessor write complete */
3009 +   .macro CPWAIT reg
3010 +   mrc p15,0,\reg,c2,c0,0
3011 +   mov \reg,\reg
3012 +   sub pc,pc,#4
3013 +   .endm
3014 +
3015 +/*********** Write out to HEX 7 segment leds *********/
3016 +
3017 +#undef DEBUG_HEXLOG
3018 +
3019 +#ifdef DEBUG_HEXLOG
3020 +#define LEDCTL         0x08000040
3021 +#define LEDDAT1        0x08000010
3022 +#define LEDDAT2        0x08000014
3023 +
3024 +.macro wait, count
3025 +       mov             r10, \count
3026 +0:
3027 +       subs    r10, r10, #1
3028 +       bne             0b
3029 +.endm
3030 +
3031 +.macro hexlog_init
3032 +       ldr             r11, =LEDCTL
3033 +       mov             r10, #0xff
3034 +       str             r10, [r11]
3035 +       ldr             r11, =LEDDAT2
3036 +       mov             r10, #0xFFFFFFFF
3037 +       str             r10, [r11]
3038 +       ldr             r11, =LEDDAT1
3039 +       mov             r10, #0x0
3040 +       str             r10, [r11]
3041 +.endm
3042 +
3043 +.macro hexlog, val
3044 +       ldr             r11, =LEDCTL
3045 +       mov             r10, #0xff
3046 +       str             r10, [r11]
3047 +       ldr             r11, =LEDDAT2
3048 +       mov             r10, #0xFFFFFFFF
3049 +       str             r10, [r11]
3050 +
3051 +       ldr             r11, =LEDDAT1
3052 +       mov             r10, \val
3053 +       str             r10, [r11]
3054 +
3055 +       wait            #0x400000
3056 +.endm
3057 +
3058 +#else
3059 +
3060 +.macro hexlog_init
3061 +       nop
3062 +.endm
3063 +
3064 +.macro hexlog, val
3065 +       nop
3066 +.endm
3067 +
3068 +#endif
3069 +
3070 +/***********************************/
3071 +
3072 +/*
3073 + *     Memory setup
3074 + */
3075 +
3076 +.globl lowlevel_init
3077 +lowlevel_init:
3078 +
3079 +       mov     pc, lr
3080 +
3081 +.globl set_turbo_mode
3082 +
3083 +set_turbo_mode:
3084 +       /* Turn on turbo mode */
3085 +       mrc     p14, 0, r2, c6, c0, 0
3086 +       orr     r2, r2, #0xB            /* Turbo, Fast-Bus, Freq change**/
3087 +       mcr     p14, 0, r2, c6, c0, 0
3088 +
3089 +       /* Setup vectors */
3090 +       ldr     r0, =TEXT_BASE
3091 +       ldr     r1, =TEXT_BASE+0x40
3092 +       ldr     r2, =0x0
3093 +1:
3094 +       ldr     r3, [r0]
3095 +       str     r3, [r2]
3096 +       add     r0, r0, #4
3097 +       add     r2, r2, #4
3098 +       cmp     r0, r1
3099 +       bne     1b
3100 +
3101 +       ldr     r0, =0x0
3102 +       ldr     r1, [r0, #4]
3103 +       str     r1, [r0]
3104 +
3105 +       mov     pc, lr
3106 diff -Nur u-boot-2006-04-18-1106/board/akita/nand.c u-boot-2006-04-18-1106-new/board/akita/nand.c
3107 --- u-boot-2006-04-18-1106/board/akita/nand.c   1970-01-01 00:00:00.000000000 +0000
3108 +++ u-boot-2006-04-18-1106-new/board/akita/nand.c       2006-07-05 11:19:44.000000000 +0000
3109 @@ -0,0 +1,169 @@
3110 +/*
3111 + * board/akita/nand.c
3112 + *
3113 + * NAND driver for the Sharp Zaurus SL-Cxx00.
3114 + *
3115 + * (C) Copyright 2006 Alexander Chukov <sash@pdaXrom.org>
3116 + *
3117 + * portions from mtd nand driver:
3118 + *
3119 + * drivers/mtd/nand/sharpsl.c
3120 + *
3121 + * Copyright (C) 2004 Richard Purdie
3122 + *
3123 + * See file CREDITS for list of people who contributed to this
3124 + * project.
3125 + *
3126 + * This program is free software; you can redistribute it and/or
3127 + * modify it under the terms of the GNU General Public License as
3128 + * published by the Free Software Foundation; either version 2 of
3129 + * the License, or (at your option) any later version.
3130 + *
3131 + * This program is distributed in the hope that it will be useful,
3132 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
3133 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
3134 + * GNU General Public License for more details.
3135 + *
3136 + * You should have received a copy of the GNU General Public License
3137 + * along with this program; if not, write to the Free Software
3138 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
3139 + * MA 02111-1307 USA
3140 + */
3141 +
3142 +#include <common.h>
3143 +
3144 +
3145 +#if (CONFIG_COMMANDS & CFG_CMD_NAND)
3146 +
3147 +#include <nand.h>
3148 +#include <linux/mtd/nand_ecc.h>
3149 +
3150 +static int sharpsl_io_base = CFG_NAND_BASE;
3151 +
3152 +/* register offset */
3153 +#define ECCLPLB                sharpsl_io_base+0x00    /* line parity 7 - 0 bit */
3154 +#define ECCLPUB                sharpsl_io_base+0x04    /* line parity 15 - 8 bit */
3155 +#define ECCCP          sharpsl_io_base+0x08    /* column parity 5 - 0 bit */
3156 +#define ECCCNTR                sharpsl_io_base+0x0C    /* ECC byte counter */
3157 +#define ECCCLRR                sharpsl_io_base+0x10    /* cleare ECC */
3158 +#define FLASHIO                sharpsl_io_base+0x14    /* Flash I/O */
3159 +#define FLASHCTL       sharpsl_io_base+0x18    /* Flash Control */
3160 +
3161 +/* Flash control bit */
3162 +#define FLRYBY         (1 << 5)
3163 +#define FLCE1          (1 << 4)
3164 +#define FLWP           (1 << 3)
3165 +#define FLALE          (1 << 2)
3166 +#define FLCLE          (1 << 1)
3167 +#define FLCE0          (1 << 0)
3168 +
3169 +#define readb(address) *((volatile unsigned char *)(address))
3170 +#define writeb(v, address) *((volatile unsigned char *)(address))=v
3171 +
3172 +/*
3173 + *     hardware specific access to control-lines
3174 + */
3175 +static void
3176 +sharpsl_nand_hwcontrol(struct mtd_info* mtd, int cmd)
3177 +{
3178 +       switch (cmd) {
3179 +       case NAND_CTL_SETCLE:
3180 +               writeb(readb(FLASHCTL) | FLCLE, FLASHCTL);
3181 +               break;
3182 +       case NAND_CTL_CLRCLE:
3183 +               writeb(readb(FLASHCTL) & ~FLCLE, FLASHCTL);
3184 +               break;
3185 +
3186 +       case NAND_CTL_SETALE:
3187 +               writeb(readb(FLASHCTL) | FLALE, FLASHCTL);
3188 +               break;
3189 +       case NAND_CTL_CLRALE:
3190 +               writeb(readb(FLASHCTL) & ~FLALE, FLASHCTL);
3191 +               break;
3192 +
3193 +       case NAND_CTL_SETNCE:
3194 +               writeb(readb(FLASHCTL) & ~(FLCE0|FLCE1), FLASHCTL);
3195 +               break;
3196 +       case NAND_CTL_CLRNCE:
3197 +               writeb(readb(FLASHCTL) | (FLCE0|FLCE1), FLASHCTL);
3198 +               break;
3199 +       }
3200 +}
3201 +
3202 +static int
3203 +sharpsl_nand_dev_ready(struct mtd_info* mtd)
3204 +{
3205 +       return !((readb(FLASHCTL) & FLRYBY) == 0);
3206 +}
3207 +
3208 +static void
3209 +sharpsl_nand_enable_hwecc(struct mtd_info* mtd, int mode)
3210 +{
3211 +       writeb(0 ,ECCCLRR);
3212 +}
3213 +
3214 +static int
3215 +sharpsl_nand_calculate_ecc(struct mtd_info* mtd, const u_char* dat,
3216 +                               u_char* ecc_code)
3217 +{
3218 +       ecc_code[0] = ~readb(ECCLPUB);
3219 +       ecc_code[1] = ~readb(ECCLPLB);
3220 +       ecc_code[2] = (~readb(ECCCP) << 2) | 0x03;
3221 +       return readb(ECCCNTR) != 0;
3222 +}
3223 +
3224 +static uint8_t scan_ff_pattern[] = { 0xff, 0xff };
3225 +
3226 +static struct nand_bbt_descr sharpsl_akita_bbt = {
3227 +       .options = 0,
3228 +       .offs = 4,
3229 +       .len = 1,
3230 +       .pattern = scan_ff_pattern
3231 +};
3232 +
3233 +static struct nand_oobinfo akita_oobinfo = {
3234 +       .useecc = MTD_NANDECC_AUTOPLACE,
3235 +       .eccbytes = 24,
3236 +       .eccpos = {
3237 +               0x5,  0x1,  0x2,  0x3,  0x6,  0x7,  0x15, 0x11,
3238 +               0x12, 0x13, 0x16, 0x17, 0x25, 0x21, 0x22, 0x23,
3239 +               0x26, 0x27, 0x35, 0x31, 0x32, 0x33, 0x36, 0x37},
3240 +       .oobfree = { {0x08, 0x09} }
3241 +};
3242 +
3243 +/*
3244 + * Board-specific NAND initialization. The following members of the
3245 + * argument are board-specific (per include/linux/mtd/nand.h):
3246 + * - IO_ADDR_R?: address to read the 8 I/O lines of the flash device
3247 + * - IO_ADDR_W?: address to write the 8 I/O lines of the flash device
3248 + * - hwcontrol: hardwarespecific function for accesing control-lines
3249 + * - dev_ready: hardwarespecific function for  accesing device ready/busy line
3250 + * - enable_hwecc?: function to enable (reset)  hardware ecc generator. Must
3251 + *   only be provided if a hardware ECC is available
3252 + * - eccmode: mode of ecc, see defines
3253 + * - chip_delay: chip dependent delay for transfering data from array to
3254 + *   read regs (tR)
3255 + * - options: various chip options. They can partly be set to inform
3256 + *   nand_scan about special functionality. See the defines for further
3257 + *   explanation
3258 + * Members with a "?" were not set in the merged testing-NAND branch,
3259 + * so they are not set here either.
3260 + */
3261 +void board_nand_init(struct nand_chip *nand)
3262 +{
3263 +       writeb(readb(FLASHCTL) | FLWP, FLASHCTL);
3264 +
3265 +       nand->IO_ADDR_R = FLASHIO;
3266 +       nand->IO_ADDR_W = FLASHIO;
3267 +       nand->hwcontrol = sharpsl_nand_hwcontrol;
3268 +       nand->dev_ready = sharpsl_nand_dev_ready;
3269 +       nand->eccmode = NAND_ECC_HW3_256;
3270 +       nand->chip_delay = 15;
3271 +       nand->options = NAND_SAMSUNG_LP_OPTIONS;
3272 +       nand->badblock_pattern = &sharpsl_akita_bbt;
3273 +       nand->autooob = &akita_oobinfo;
3274 +       nand->enable_hwecc = sharpsl_nand_enable_hwecc;
3275 +       nand->calculate_ecc = sharpsl_nand_calculate_ecc;
3276 +       nand->correct_data = nand_correct_data;
3277 +}
3278 +#endif /* (CONFIG_COMMANDS & CFG_CMD_NAND) */
3279 diff -Nur u-boot-2006-04-18-1106/board/akita/u-boot.lds u-boot-2006-04-18-1106-new/board/akita/u-boot.lds
3280 --- u-boot-2006-04-18-1106/board/akita/u-boot.lds       1970-01-01 00:00:00.000000000 +0000
3281 +++ u-boot-2006-04-18-1106-new/board/akita/u-boot.lds   2006-07-05 11:19:44.000000000 +0000
3282 @@ -0,0 +1,56 @@
3283 +/*
3284 + * (C) Copyright 2000
3285 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
3286 + *
3287 + * See file CREDITS for list of people who contributed to this
3288 + * project.
3289 + *
3290 + * This program is free software; you can redistribute it and/or
3291 + * modify it under the terms of the GNU General Public License as
3292 + * published by the Free Software Foundation; either version 2 of
3293 + * the License, or (at your option) any later version.
3294 + *
3295 + * This program is distributed in the hope that it will be useful,
3296 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
3297 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
3298 + * GNU General Public License for more details.
3299 + *
3300 + * You should have received a copy of the GNU General Public License
3301 + * along with this program; if not, write to the Free Software
3302 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
3303 + * MA 02111-1307 USA
3304 + */
3305 +
3306 +OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
3307 +OUTPUT_ARCH(arm)
3308 +ENTRY(_start)
3309 +SECTIONS
3310 +{
3311 +       . = 0x00000000;
3312 +
3313 +       . = ALIGN(4);
3314 +       .text      :
3315 +       {
3316 +         cpu/pxa/start.o       (.text)
3317 +         *(.text)
3318 +       }
3319 +
3320 +       . = ALIGN(4);
3321 +       .rodata : { *(.rodata) }
3322 +
3323 +       . = ALIGN(4);
3324 +       .data : { *(.data) }
3325 +
3326 +       . = ALIGN(4);
3327 +       .got : { *(.got) }
3328 +
3329 +       . = .;
3330 +       __u_boot_cmd_start = .;
3331 +       .u_boot_cmd : { *(.u_boot_cmd) }
3332 +       __u_boot_cmd_end = .;
3333 +
3334 +       . = ALIGN(4);
3335 +       __bss_start = .;
3336 +       .bss : { *(.bss) }
3337 +       _end = .;
3338 +}
3339 diff -Nur u-boot-2006-04-18-1106/board/corgi/Makefile u-boot-2006-04-18-1106-new/board/corgi/Makefile
3340 --- u-boot-2006-04-18-1106/board/corgi/Makefile 1970-01-01 00:00:00.000000000 +0000
3341 +++ u-boot-2006-04-18-1106-new/board/corgi/Makefile     2006-07-05 11:19:44.000000000 +0000
3342 @@ -0,0 +1,51 @@
3343 +#
3344 +# board/corgi/Makefile
3345 +#
3346 +# (C) Copyright 2006 Alexander Chukov <sash@pdaXrom.org>
3347 +#
3348 +# (C) Copyright 2000
3349 +# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
3350 +#
3351 +# See file CREDITS for list of people who contributed to this
3352 +# project.
3353 +#
3354 +# This program is free software; you can redistribute it and/or
3355 +# modify it under the terms of the GNU General Public License as
3356 +# published by the Free Software Foundation; either version 2 of
3357 +# the License, or (at your option) any later version.
3358 +#
3359 +# This program is distributed in the hope that it will be useful,
3360 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
3361 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
3362 +# GNU General Public License for more details.
3363 +#
3364 +# You should have received a copy of the GNU General Public License
3365 +# along with this program; if not, write to the Free Software
3366 +# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
3367 +# MA 02111-1307 USA
3368 +#
3369 +
3370 +include $(TOPDIR)/config.mk
3371 +
3372 +LIB    = lib$(BOARD).a
3373 +
3374 +OBJS   := corgi.o nand.o kbd.o
3375 +SOBJS  := lowlevel_init.o
3376 +
3377 +$(LIB):        $(OBJS) $(SOBJS)
3378 +       $(AR) crv $@ $(OBJS) $(SOBJS)
3379 +
3380 +clean:
3381 +       rm -f $(SOBJS) $(OBJS)
3382 +
3383 +distclean:     clean
3384 +       rm -f $(LIB) core *.bak .depend
3385 +
3386 +#########################################################################
3387 +
3388 +.depend:       Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c)
3389 +               $(CC) -M $(CPPFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
3390 +
3391 +-include .depend
3392 +
3393 +#########################################################################
3394 diff -Nur u-boot-2006-04-18-1106/board/corgi/config.mk u-boot-2006-04-18-1106-new/board/corgi/config.mk
3395 --- u-boot-2006-04-18-1106/board/corgi/config.mk        1970-01-01 00:00:00.000000000 +0000
3396 +++ u-boot-2006-04-18-1106-new/board/corgi/config.mk    2006-07-05 11:19:44.000000000 +0000
3397 @@ -0,0 +1 @@
3398 +TEXT_BASE = 0xa1000000
3399 diff -Nur u-boot-2006-04-18-1106/board/corgi/corgi.c u-boot-2006-04-18-1106-new/board/corgi/corgi.c
3400 --- u-boot-2006-04-18-1106/board/corgi/corgi.c  1970-01-01 00:00:00.000000000 +0000
3401 +++ u-boot-2006-04-18-1106-new/board/corgi/corgi.c      2006-07-05 11:19:44.000000000 +0000
3402 @@ -0,0 +1,87 @@
3403 +/*
3404 + * board/corgi/corgi.c
3405 + *
3406 + * Configuration settings for the Sharp Zaurus SL-C7x0/860.
3407 + *
3408 + * (C) Copyright 2006 Alexander Chukov <sash@pdaXrom.org>
3409 + *
3410 + * portions from adsvix board configuration:
3411 + * (C) Copyright 2004
3412 + * Robert Whaley, Applied Data Systems, Inc. rwhaley@applieddata.net
3413 + * (C) Copyright 2002
3414 + * Kyle Harris, Nexus Technologies, Inc. kharris@nexus-tech.net
3415 + * (C) Copyright 2002
3416 + * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
3417 + * Marius Groeger <mgroeger@sysgo.de>
3418 + *
3419 + * See file CREDITS for list of people who contributed to this
3420 + * project.
3421 + *
3422 + * This program is free software; you can redistribute it and/or
3423 + * modify it under the terms of the GNU General Public License as
3424 + * published by the Free Software Foundation; either version 2 of
3425 + * the License, or (at your option) any later version.
3426 + *
3427 + * This program is distributed in the hope that it will be useful,
3428 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
3429 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
3430 + * GNU General Public License for more details.
3431 + *
3432 + * You should have received a copy of the GNU General Public License
3433 + * along with this program; if not, write to the Free Software
3434 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
3435 + * MA 02111-1307 USA
3436 + */
3437 +
3438 +#include <common.h>
3439 +
3440 +/* ------------------------------------------------------------------------- */
3441 +
3442 +/*
3443 + * Miscellaneous platform dependent initialisations
3444 + */
3445 +
3446 +int board_init (void)
3447 +{
3448 +       DECLARE_GLOBAL_DATA_PTR;
3449 +
3450 +       /* memory and cpu-speed are setup before relocation */
3451 +       /* so we do _nothing_ here */
3452 +
3453 +       /* arch number of Sharp Zaurus Corgi : MACH_TYPE_CORGI */
3454 +       gd->bd->bi_arch_number = 423;
3455 +
3456 +       /* adress of boot parameters */
3457 +       gd->bd->bi_boot_params = 0xa0000100;
3458 +
3459 +       /* set cpu turbo mode */
3460 +       set_turbo_mode();
3461 +
3462 +       corgikbd_init();
3463 +
3464 +       return 0;
3465 +}
3466 +
3467 +int board_late_init(void)
3468 +{
3469 +       setenv("stdout", "serial");
3470 +       setenv("stderr", "serial");
3471 +       return 0;
3472 +}
3473 +
3474 +
3475 +int dram_init (void)
3476 +{
3477 +       DECLARE_GLOBAL_DATA_PTR;
3478 +
3479 +       gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
3480 +       gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
3481 +       gd->bd->bi_dram[1].start = PHYS_SDRAM_2;
3482 +       gd->bd->bi_dram[1].size = PHYS_SDRAM_2_SIZE;
3483 +       gd->bd->bi_dram[2].start = PHYS_SDRAM_3;
3484 +       gd->bd->bi_dram[2].size = PHYS_SDRAM_3_SIZE;
3485 +       gd->bd->bi_dram[3].start = PHYS_SDRAM_4;
3486 +       gd->bd->bi_dram[3].size = PHYS_SDRAM_4_SIZE;
3487 +
3488 +       return 0;
3489 +}
3490 diff -Nur u-boot-2006-04-18-1106/board/corgi/kbd.c u-boot-2006-04-18-1106-new/board/corgi/kbd.c
3491 --- u-boot-2006-04-18-1106/board/corgi/kbd.c    1970-01-01 00:00:00.000000000 +0000
3492 +++ u-boot-2006-04-18-1106-new/board/corgi/kbd.c        2006-07-05 11:19:44.000000000 +0000
3493 @@ -0,0 +1,202 @@
3494 +/*
3495 + * board/corgi/kbd.c
3496 + *
3497 + * Keyboard driver for the Sharp Zaurus SL-C7x0/860.
3498 + *
3499 + * (C) Copyright 2006 Alexander Chukov <sash@pdaXrom.org>
3500 + *
3501 + * portions from:
3502 + *
3503 + * linux/drivers/input/keyboard/spitzkbd.c
3504 + *
3505 + * Keyboard driver for Sharp Corgi models (SL-C7xx)
3506 + *
3507 + * Copyright (C) 2005 Richard Purdie
3508 + *
3509 + * See file CREDITS for list of people who contributed to this
3510 + * project.
3511 + *
3512 + * This program is free software; you can redistribute it and/or
3513 + * modify it under the terms of the GNU General Public License as
3514 + * published by the Free Software Foundation; either version 2 of
3515 + * the License, or (at your option) any later version.
3516 + *
3517 + * This program is distributed in the hope that it will be useful,
3518 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
3519 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
3520 + * GNU General Public License for more details.
3521 + *
3522 + * You should have received a copy of the GNU General Public License
3523 + * along with this program; if not, write to the Free Software
3524 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
3525 + * MA 02111-1307 USA
3526 + */
3527 +
3528 +#include <common.h>
3529 +#include <command.h>
3530 +#include <config.h>
3531 +#include <version.h>
3532 +#include <asm/arch/pxa-regs.h>
3533 +
3534 +#define GPIO_DFLT_LOW          0x400
3535 +#define GPIO_DFLT_HIGH         0x800
3536 +
3537 +void pxa_gpio_mode(int gpio_mode)
3538 +{
3539 +       int gpio = gpio_mode & GPIO_MD_MASK_NR;
3540 +       int fn = (gpio_mode & GPIO_MD_MASK_FN) >> 8;
3541 +       int gafr;
3542 +
3543 +       if (gpio_mode & GPIO_DFLT_LOW)
3544 +               GPCR(gpio) = GPIO_bit(gpio);
3545 +       else if (gpio_mode & GPIO_DFLT_HIGH)
3546 +               GPSR(gpio) = GPIO_bit(gpio);
3547 +       if (gpio_mode & GPIO_MD_MASK_DIR)
3548 +               GPDR(gpio) |= GPIO_bit(gpio);
3549 +       else
3550 +               GPDR(gpio) &= ~GPIO_bit(gpio);
3551 +       gafr = GAFR(gpio) & ~(0x3 << (((gpio) & 0xf)*2));
3552 +       GAFR(gpio) = gafr |  (fn  << (((gpio) & 0xf)*2));
3553 +}
3554 +
3555 +/*
3556 + * Corgi Keyboard Definitions
3557 + */
3558 +#define CORGI_KEY_STROBE_NUM           (12)
3559 +#define CORGI_KEY_SENSE_NUM                    (8)
3560 +#define CORGI_GPIO_ALL_STROBE_BIT      (0x00003ffc)
3561 +#define CORGI_GPIO_HIGH_SENSE_BIT      (0xfc000000)
3562 +#define CORGI_GPIO_HIGH_SENSE_RSHIFT   (26)
3563 +#define CORGI_GPIO_LOW_SENSE_BIT       (0x00000003)
3564 +#define CORGI_GPIO_LOW_SENSE_LSHIFT    (6)
3565 +#define CORGI_GPIO_STROBE_BIT(a)       GPIO_bit(66+(a))
3566 +#define CORGI_GPIO_SENSE_BIT(a)                GPIO_bit(58+(a))
3567 +#define CORGI_GAFR_ALL_STROBE_BIT      (0x0ffffff0)
3568 +#define CORGI_GAFR_HIGH_SENSE_BIT      (0xfff00000)
3569 +#define CORGI_GAFR_LOW_SENSE_BIT       (0x0000000f)
3570 +#define CORGI_GPIO_KEY_SENSE(a)                (58+(a))
3571 +#define CORGI_GPIO_KEY_STROBE(a)       (66+(a))
3572 +
3573 +#define CORGI_GPIO_AK_INT                      (4)     /* Headphone Jack Control Interrupt */
3574 +
3575 +#define KB_ROWS                                8
3576 +#define KB_COLS                                12
3577 +#define KB_ROWMASK(r)          (1 << (r))
3578 +#define SCANCODE(r,c)          ( ((r)<<4) + (c) + 1 )
3579 +/* zero code, 124 scancodes */
3580 +#define        NR_SCANCODES            ( SCANCODE(KB_ROWS-1,KB_COLS-1) +1 +1 )
3581 +
3582 +#define SCAN_INTERVAL          (50) /* ms */
3583 +#define HINGE_SCAN_INTERVAL    (250) /* ms */
3584 +
3585 +#define KB_DISCHARGE_DELAY     10
3586 +#define KB_ACTIVATE_DELAY      10
3587 +
3588 +static inline void corgikbd_discharge_all(void)
3589 +{
3590 +       /* STROBE All HiZ */
3591 +       GPCR2  = CORGI_GPIO_ALL_STROBE_BIT;
3592 +       GPDR2 &= ~CORGI_GPIO_ALL_STROBE_BIT;
3593 +}
3594 +
3595 +static inline void corgikbd_activate_all(void)
3596 +{
3597 +       /* STROBE ALL -> High */
3598 +       GPSR2  = CORGI_GPIO_ALL_STROBE_BIT;
3599 +       GPDR2 |= CORGI_GPIO_ALL_STROBE_BIT;
3600 +
3601 +       udelay(KB_DISCHARGE_DELAY);
3602 +
3603 +       /* Clear any interrupts we may have triggered when altering the GPIO lines */
3604 +       GEDR1 = CORGI_GPIO_HIGH_SENSE_BIT;
3605 +       GEDR2 = CORGI_GPIO_LOW_SENSE_BIT;
3606 +}
3607 +
3608 +static inline void corgikbd_activate_col(int col)
3609 +{
3610 +       /* STROBE col -> High, not col -> HiZ */
3611 +       GPSR2 = CORGI_GPIO_STROBE_BIT(col);
3612 +       GPDR2 = (GPDR2 & ~CORGI_GPIO_ALL_STROBE_BIT) | CORGI_GPIO_STROBE_BIT(col);
3613 +}
3614 +
3615 +static inline void corgikbd_reset_col(int col)
3616 +{
3617 +       /* STROBE col -> Low */
3618 +       GPCR2 = CORGI_GPIO_STROBE_BIT(col);
3619 +       /* STROBE col -> out, not col -> HiZ */
3620 +       GPDR2 = (GPDR2 & ~CORGI_GPIO_ALL_STROBE_BIT) | CORGI_GPIO_STROBE_BIT(col);
3621 +}
3622 +
3623 +#define GET_ROWS_STATUS(c)     (((GPLR1 & CORGI_GPIO_HIGH_SENSE_BIT) >> CORGI_GPIO_HIGH_SENSE_RSHIFT) | ((GPLR2 & CORGI_GPIO_LOW_SENSE_BIT) << CORGI_GPIO_LOW_SENSE_LSHIFT))
3624 +
3625 +static int corgikbd_scankeyboard(void)
3626 +{
3627 +       unsigned int row, col, rowd;
3628 +       unsigned int num_pressed;
3629 +       int ret = -1;
3630 +
3631 +       num_pressed = 0;
3632 +       for (col = 0; col < KB_COLS; col++) {
3633 +               corgikbd_discharge_all();
3634 +               udelay(KB_DISCHARGE_DELAY);
3635 +
3636 +               corgikbd_activate_col(col);
3637 +               udelay(KB_ACTIVATE_DELAY);
3638 +
3639 +               rowd = GET_ROWS_STATUS(col);
3640 +               for (row = 0; row < KB_ROWS; row++) {
3641 +                       unsigned int scancode, pressed;
3642 +
3643 +                       scancode = SCANCODE(row, col);
3644 +                       pressed = rowd & KB_ROWMASK(row);
3645 +
3646 +                       if (pressed)
3647 +                           ret = scancode;
3648 +               }
3649 +               corgikbd_reset_col(col);
3650 +       }
3651 +
3652 +       corgikbd_activate_all();
3653 +
3654 +       return ret;
3655 +}
3656 +
3657 +void corgikbd_init(void)
3658 +{
3659 +       int i;
3660 +       
3661 +       /* Setup sense interrupts - RisingEdge Detect, sense lines as inputs */
3662 +       for (i = 0; i < CORGI_KEY_SENSE_NUM; i++)
3663 +               pxa_gpio_mode(CORGI_GPIO_KEY_SENSE(i) | GPIO_IN);
3664 +
3665 +       /* Set Strobe lines as outputs - set high */
3666 +       for (i = 0; i < CORGI_KEY_STROBE_NUM; i++)
3667 +               pxa_gpio_mode(CORGI_GPIO_KEY_STROBE(i) | GPIO_OUT | GPIO_DFLT_HIGH);
3668 +
3669 +       /* Setup the headphone jack as an input */
3670 +       pxa_gpio_mode(CORGI_GPIO_AK_INT | GPIO_IN);
3671 +}
3672 +
3673 +int do_testkey(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
3674 +{
3675 +       int scan;
3676 +       
3677 +       if (argc < 2)
3678 +               return 1;
3679 +
3680 +       scan = corgikbd_scankeyboard();
3681 +
3682 +
3683 +//     if (scan >= 0)
3684 +//             printf("Scan = %d\n", scan);
3685 +//     else
3686 +//             printf("Nothing!\n");
3687 +
3688 +       return !(simple_strtol(argv[1], NULL, 10) == scan);
3689 +}
3690 +
3691 +U_BOOT_CMD(
3692 +       testkey,   2,      1,      do_testkey,
3693 +       "testkey - compare pressed key with arg\n",
3694 +       "<key scancode>"
3695 +);
3696 diff -Nur u-boot-2006-04-18-1106/board/corgi/lowlevel_init.S u-boot-2006-04-18-1106-new/board/corgi/lowlevel_init.S
3697 --- u-boot-2006-04-18-1106/board/corgi/lowlevel_init.S  1970-01-01 00:00:00.000000000 +0000
3698 +++ u-boot-2006-04-18-1106-new/board/corgi/lowlevel_init.S      2006-07-05 11:19:44.000000000 +0000
3699 @@ -0,0 +1,136 @@
3700 +/*
3701 + * board/corgi/lowlevel_init.S
3702 + *
3703 + * Configuration settings for the Sharp Zaurus SL-C7x0/860.
3704 + *
3705 + * (C) Copyright 2006 Alexander Chukov <sash@pdaXrom.org>
3706 + *
3707 + * This was originally from the Lubbock u-boot port and from BLOB with cleanup
3708 + *
3709 + * NOTE: I haven't clean this up considerably, just enough to get it
3710 + * running. See hal_platform_setup.h for the source. See
3711 + * board/cradle/lowlevel_init.S for another PXA250 setup that is
3712 + * much cleaner.
3713 + *
3714 + * See file CREDITS for list of people who contributed to this
3715 + * project.
3716 + *
3717 + * This program is free software; you can redistribute it and/or
3718 + * modify it under the terms of the GNU General Public License as
3719 + * published by the Free Software Foundation; either version 2 of
3720 + * the License, or (at your option) any later version.
3721 + *
3722 + * This program is distributed in the hope that it will be useful,
3723 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
3724 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the
3725 + * GNU General Public License for more details.
3726 + *
3727 + * You should have received a copy of the GNU General Public License
3728 + * along with this program; if not, write to the Free Software
3729 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
3730 + * MA 02111-1307 USA
3731 + */
3732 +
3733 +#include <config.h>
3734 +#include <version.h>
3735 +#include <asm/arch/pxa-regs.h>
3736 +
3737 +/* wait for coprocessor write complete */
3738 +   .macro CPWAIT reg
3739 +   mrc p15,0,\reg,c2,c0,0
3740 +   mov \reg,\reg
3741 +   sub pc,pc,#4
3742 +   .endm
3743 +
3744 +/*********** Write out to HEX 7 segment leds *********/
3745 +
3746 +#undef DEBUG_HEXLOG
3747 +
3748 +#ifdef DEBUG_HEXLOG
3749 +#define LEDCTL         0x08000040
3750 +#define LEDDAT1        0x08000010
3751 +#define LEDDAT2        0x08000014
3752 +
3753 +.macro wait, count
3754 +       mov             r10, \count
3755 +0:
3756 +       subs    r10, r10, #1
3757 +       bne             0b
3758 +.endm
3759 +
3760 +.macro hexlog_init
3761 +       ldr             r11, =LEDCTL
3762 +       mov             r10, #0xff
3763 +       str             r10, [r11]
3764 +       ldr             r11, =LEDDAT2
3765 +       mov             r10, #0xFFFFFFFF
3766 +       str             r10, [r11]
3767 +       ldr             r11, =LEDDAT1
3768 +       mov             r10, #0x0
3769 +       str             r10, [r11]
3770 +.endm
3771 +
3772 +.macro hexlog, val
3773 +       ldr             r11, =LEDCTL
3774 +       mov             r10, #0xff
3775 +       str             r10, [r11]
3776 +       ldr             r11, =LEDDAT2
3777 +       mov             r10, #0xFFFFFFFF
3778 +       str             r10, [r11]
3779 +
3780 +       ldr             r11, =LEDDAT1
3781 +       mov             r10, \val
3782 +       str             r10, [r11]
3783 +
3784 +       wait            #0x400000
3785 +.endm
3786 +
3787 +#else
3788 +
3789 +.macro hexlog_init
3790 +       nop
3791 +.endm
3792 +
3793 +.macro hexlog, val
3794 +       nop
3795 +.endm
3796 +
3797 +#endif
3798 +
3799 +/***********************************/
3800 +
3801 +/*
3802 + *     Memory setup
3803 + */
3804 +
3805 +.globl lowlevel_init
3806 +lowlevel_init:
3807 +
3808 +       mov     pc, lr
3809 +
3810 +.globl set_turbo_mode
3811 +
3812 +set_turbo_mode:
3813 +       /* Turn on turbo mode */
3814 +       mrc     p14, 0, r2, c6, c0, 0
3815 +       orr     r2, r2, #0x3            /* Turbo, Freq change */
3816 +       mcr     p14, 0, r2, c6, c0, 0
3817 +
3818 +
3819 +       /* Setup vectors */
3820 +       ldr     r0, =TEXT_BASE
3821 +       ldr     r1, =TEXT_BASE+0x40
3822 +       ldr     r2, =0x0
3823 +1:
3824 +       ldr     r3, [r0]
3825 +       str     r3, [r2]
3826 +       add     r0, r0, #4
3827 +       add     r2, r2, #4
3828 +       cmp     r0, r1
3829 +       bne     1b
3830 +
3831 +       ldr     r0, =0x0
3832 +       ldr     r1, [r0, #4]
3833 +       str     r1, [r0]
3834 +
3835 +       mov     pc, lr
3836 diff -Nur u-boot-2006-04-18-1106/board/corgi/nand.c u-boot-2006-04-18-1106-new/board/corgi/nand.c
3837 --- u-boot-2006-04-18-1106/board/corgi/nand.c   1970-01-01 00:00:00.000000000 +0000
3838 +++ u-boot-2006-04-18-1106-new/board/corgi/nand.c       2006-07-05 11:19:44.000000000 +0000
3839 @@ -0,0 +1,157 @@
3840 +/*
3841 + * board/corgi/nand.c
3842 + *
3843 + * NAND driver for the Sharp Zaurus SL-C7x0/860.
3844 + *
3845 + * (C) Copyright 2006 Alexander Chukov <sash@pdaXrom.org>
3846 + *
3847 + * portions from mtd nand driver:
3848 + *
3849 + * drivers/mtd/nand/sharpsl.c
3850 + *
3851 + * Copyright (C) 2004 Richard Purdie
3852 + *
3853 + * See file CREDITS for list of people who contributed to this
3854 + * project.
3855 + *
3856 + * This program is free software; you can redistribute it and/or
3857 + * modify it under the terms of the GNU General Public License as
3858 + * published by the Free Software Foundation; either version 2 of
3859 + * the License, or (at your option) any later version.
3860 + *
3861 + * This program is distributed in the hope that it will be useful,
3862 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
3863 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
3864 + * GNU General Public License for more details.
3865 + *
3866 + * You should have received a copy of the GNU General Public License
3867 + * along with this program; if not, write to the Free Software
3868 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
3869 + * MA 02111-1307 USA
3870 + */
3871 +
3872 +#include <common.h>
3873 +
3874 +
3875 +#if (CONFIG_COMMANDS & CFG_CMD_NAND)
3876 +
3877 +#include <nand.h>
3878 +#include <linux/mtd/nand_ecc.h>
3879 +
3880 +static int sharpsl_io_base = CFG_NAND_BASE;
3881 +
3882 +/* register offset */
3883 +#define ECCLPLB                sharpsl_io_base+0x00    /* line parity 7 - 0 bit */
3884 +#define ECCLPUB                sharpsl_io_base+0x04    /* line parity 15 - 8 bit */
3885 +#define ECCCP          sharpsl_io_base+0x08    /* column parity 5 - 0 bit */
3886 +#define ECCCNTR                sharpsl_io_base+0x0C    /* ECC byte counter */
3887 +#define ECCCLRR                sharpsl_io_base+0x10    /* cleare ECC */
3888 +#define FLASHIO                sharpsl_io_base+0x14    /* Flash I/O */
3889 +#define FLASHCTL       sharpsl_io_base+0x18    /* Flash Control */
3890 +
3891 +/* Flash control bit */
3892 +#define FLRYBY         (1 << 5)
3893 +#define FLCE1          (1 << 4)
3894 +#define FLWP           (1 << 3)
3895 +#define FLALE          (1 << 2)
3896 +#define FLCLE          (1 << 1)
3897 +#define FLCE0          (1 << 0)
3898 +
3899 +#define readb(address) *((volatile unsigned char *)(address))
3900 +#define writeb(v, address) *((volatile unsigned char *)(address))=v
3901 +
3902 +/*
3903 + *     hardware specific access to control-lines
3904 + */
3905 +static void
3906 +sharpsl_nand_hwcontrol(struct mtd_info* mtd, int cmd)
3907 +{
3908 +       switch (cmd) {
3909 +       case NAND_CTL_SETCLE:
3910 +               writeb(readb(FLASHCTL) | FLCLE, FLASHCTL);
3911 +               break;
3912 +       case NAND_CTL_CLRCLE:
3913 +               writeb(readb(FLASHCTL) & ~FLCLE, FLASHCTL);
3914 +               break;
3915 +
3916 +       case NAND_CTL_SETALE:
3917 +               writeb(readb(FLASHCTL) | FLALE, FLASHCTL);
3918 +               break;
3919 +       case NAND_CTL_CLRALE:
3920 +               writeb(readb(FLASHCTL) & ~FLALE, FLASHCTL);
3921 +               break;
3922 +
3923 +       case NAND_CTL_SETNCE:
3924 +               writeb(readb(FLASHCTL) & ~(FLCE0|FLCE1), FLASHCTL);
3925 +               break;
3926 +       case NAND_CTL_CLRNCE:
3927 +               writeb(readb(FLASHCTL) | (FLCE0|FLCE1), FLASHCTL);
3928 +               break;
3929 +       }
3930 +}
3931 +
3932 +static int
3933 +sharpsl_nand_dev_ready(struct mtd_info* mtd)
3934 +{
3935 +       return !((readb(FLASHCTL) & FLRYBY) == 0);
3936 +}
3937 +
3938 +static void
3939 +sharpsl_nand_enable_hwecc(struct mtd_info* mtd, int mode)
3940 +{
3941 +       writeb(0 ,ECCCLRR);
3942 +}
3943 +
3944 +static int
3945 +sharpsl_nand_calculate_ecc(struct mtd_info* mtd, const u_char* dat,
3946 +                               u_char* ecc_code)
3947 +{
3948 +       ecc_code[0] = ~readb(ECCLPUB);
3949 +       ecc_code[1] = ~readb(ECCLPLB);
3950 +       ecc_code[2] = (~readb(ECCCP) << 2) | 0x03;
3951 +       return readb(ECCCNTR) != 0;
3952 +}
3953 +
3954 +static uint8_t scan_ff_pattern[] = { 0xff, 0xff };
3955 +
3956 +static struct nand_bbt_descr sharpsl_bbt = {
3957 +       .options = 0,
3958 +       .offs = 4,
3959 +       .len = 2,
3960 +       .pattern = scan_ff_pattern
3961 +};
3962 +
3963 +/*
3964 + * Board-specific NAND initialization. The following members of the
3965 + * argument are board-specific (per include/linux/mtd/nand.h):
3966 + * - IO_ADDR_R?: address to read the 8 I/O lines of the flash device
3967 + * - IO_ADDR_W?: address to write the 8 I/O lines of the flash device
3968 + * - hwcontrol: hardwarespecific function for accesing control-lines
3969 + * - dev_ready: hardwarespecific function for  accesing device ready/busy line
3970 + * - enable_hwecc?: function to enable (reset)  hardware ecc generator. Must
3971 + *   only be provided if a hardware ECC is available
3972 + * - eccmode: mode of ecc, see defines
3973 + * - chip_delay: chip dependent delay for transfering data from array to
3974 + *   read regs (tR)
3975 + * - options: various chip options. They can partly be set to inform
3976 + *   nand_scan about special functionality. See the defines for further
3977 + *   explanation
3978 + * Members with a "?" were not set in the merged testing-NAND branch,
3979 + * so they are not set here either.
3980 + */
3981 +void board_nand_init(struct nand_chip *nand)
3982 +{
3983 +       writeb(readb(FLASHCTL) | FLWP, FLASHCTL);
3984 +
3985 +       nand->IO_ADDR_R = FLASHIO;
3986 +       nand->IO_ADDR_W = FLASHIO;
3987 +       nand->hwcontrol = sharpsl_nand_hwcontrol;
3988 +       nand->dev_ready = sharpsl_nand_dev_ready;
3989 +       nand->eccmode = NAND_ECC_HW3_256;
3990 +       nand->chip_delay = 15;
3991 +       nand->badblock_pattern = &sharpsl_bbt;
3992 +       nand->enable_hwecc = sharpsl_nand_enable_hwecc;
3993 +       nand->calculate_ecc = sharpsl_nand_calculate_ecc;
3994 +       nand->correct_data = nand_correct_data;
3995 +}
3996 +#endif /* (CONFIG_COMMANDS & CFG_CMD_NAND) */
3997 diff -Nur u-boot-2006-04-18-1106/board/corgi/u-boot.lds u-boot-2006-04-18-1106-new/board/corgi/u-boot.lds
3998 --- u-boot-2006-04-18-1106/board/corgi/u-boot.lds       1970-01-01 00:00:00.000000000 +0000
3999 +++ u-boot-2006-04-18-1106-new/board/corgi/u-boot.lds   2006-07-05 11:19:44.000000000 +0000
4000 @@ -0,0 +1,56 @@
4001 +/*
4002 + * (C) Copyright 2000
4003 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4004 + *
4005 + * See file CREDITS for list of people who contributed to this
4006 + * project.
4007 + *
4008 + * This program is free software; you can redistribute it and/or
4009 + * modify it under the terms of the GNU General Public License as
4010 + * published by the Free Software Foundation; either version 2 of
4011 + * the License, or (at your option) any later version.
4012 + *
4013 + * This program is distributed in the hope that it will be useful,
4014 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
4015 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
4016 + * GNU General Public License for more details.
4017 + *
4018 + * You should have received a copy of the GNU General Public License
4019 + * along with this program; if not, write to the Free Software
4020 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
4021 + * MA 02111-1307 USA
4022 + */
4023 +
4024 +OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
4025 +OUTPUT_ARCH(arm)
4026 +ENTRY(_start)
4027 +SECTIONS
4028 +{
4029 +       . = 0x00000000;
4030 +
4031 +       . = ALIGN(4);
4032 +       .text      :
4033 +       {
4034 +         cpu/pxa/start.o       (.text)
4035 +         *(.text)
4036 +       }
4037 +
4038 +       . = ALIGN(4);
4039 +       .rodata : { *(.rodata) }
4040 +
4041 +       . = ALIGN(4);
4042 +       .data : { *(.data) }
4043 +
4044 +       . = ALIGN(4);
4045 +       .got : { *(.got) }
4046 +
4047 +       . = .;
4048 +       __u_boot_cmd_start = .;
4049 +       .u_boot_cmd : { *(.u_boot_cmd) }
4050 +       __u_boot_cmd_end = .;
4051 +
4052 +       . = ALIGN(4);
4053 +       __bss_start = .;
4054 +       .bss : { *(.bss) }
4055 +       _end = .;
4056 +}
4057 diff -Nur u-boot-2006-04-18-1106/common/cmd_nand.c u-boot-2006-04-18-1106-new/common/cmd_nand.c
4058 --- u-boot-2006-04-18-1106/common/cmd_nand.c    2006-04-18 09:05:03.000000000 +0000
4059 +++ u-boot-2006-04-18-1106-new/common/cmd_nand.c        2006-07-05 11:19:44.000000000 +0000
4060 @@ -81,6 +81,63 @@
4061         return 0;
4062  }
4063  
4064 +#ifdef NAND_LOGICAL
4065 +/////////////////////////////////////////////////////////////////////
4066 +// oob structure
4067 +/////////////////////////////////////////////////////////////////////
4068 +
4069 +#define NAND_NOOB_LOGADDR_00           8
4070 +#define NAND_NOOB_LOGADDR_01           9
4071 +#define NAND_NOOB_LOGADDR_10           10
4072 +#define NAND_NOOB_LOGADDR_11           11
4073 +#define NAND_NOOB_LOGADDR_20           12
4074 +#define NAND_NOOB_LOGADDR_21           13
4075 +
4076 +static uint nand_get_logical_no(unsigned char *oob)
4077 +{
4078 +    unsigned short us,bit;
4079 +    int par;
4080 +    int good0, good1;
4081 +
4082 +    if(oob[NAND_NOOB_LOGADDR_00] == oob[NAND_NOOB_LOGADDR_10] &&
4083 +       oob[NAND_NOOB_LOGADDR_01] == oob[NAND_NOOB_LOGADDR_11]){
4084 +       good0 = NAND_NOOB_LOGADDR_00;
4085 +       good1 = NAND_NOOB_LOGADDR_01;
4086 +    }else
4087 +    if(oob[NAND_NOOB_LOGADDR_10] == oob[NAND_NOOB_LOGADDR_20] &&
4088 +       oob[NAND_NOOB_LOGADDR_11] == oob[NAND_NOOB_LOGADDR_21]){
4089 +       good0 = NAND_NOOB_LOGADDR_10;
4090 +       good1 = NAND_NOOB_LOGADDR_11;
4091 +    }else
4092 +    if(oob[NAND_NOOB_LOGADDR_20] == oob[NAND_NOOB_LOGADDR_00] &&
4093 +       oob[NAND_NOOB_LOGADDR_21] == oob[NAND_NOOB_LOGADDR_01]){
4094 +       good0 = NAND_NOOB_LOGADDR_20;
4095 +       good1 = NAND_NOOB_LOGADDR_21;
4096 +    }else{
4097 +       return (uint)-1;
4098 +    }
4099 +
4100 +    us = (((unsigned short)(oob[good0]) & 0x00ff) << 0) |
4101 +        (((unsigned short)(oob[good1]) & 0x00ff) << 8);
4102 +
4103 +    par = 0;
4104 +    for(bit = 0x0001; bit != 0; bit <<= 1){
4105 +       if(us & bit){
4106 +           par++;
4107 +       }
4108 +    }
4109 +    if(par & 1){
4110 +       return (uint)-2;
4111 +    }
4112 +
4113 +    if(us == 0xffff){
4114 +       return 0xffff;
4115 +    }else{
4116 +       return ((us & 0x07fe) >> 1);
4117 +    }
4118 +}
4119 +#endif
4120 +
4121  /* ------------------------------------------------------------------------- */
4122  
4123  static void
4124 @@ -245,6 +302,55 @@
4125                 if (off == 0 && size == 0)
4126                         return 1;
4127  
4128 +#ifdef NAND_LOGICAL
4129 +               s = strchr(cmd, '.');
4130 +               if (s != NULL) {
4131 +                       if (strcmp(s, ".logical") == 0) {
4132 +                               int blocks = NAND_LOGICAL_SIZE / nand->erasesize;
4133 +                               ulong *log2phy = malloc(blocks * sizeof(ulong));
4134 +                               u_char *oobuf = malloc(nand->oobblock + nand->oobsize);
4135 +                               int i;
4136 +                               ulong offset;
4137 +                               ret = 1;
4138 +                               for (i = 0; i < blocks; i++)
4139 +                                       log2phy[i] = (uint) -1;
4140 +                               offset = 0;
4141 +                               for (i = 0; i < blocks; i++) {
4142 +                                       ret = nand_read_raw(nand, oobuf, offset, nand->oobblock, nand->oobsize);
4143 +                                       if (!ret) {
4144 +                                               int log_no = nand_get_logical_no(oobuf + nand->oobblock);
4145 +                                               if (((int)log_no >= 0) && (log_no < blocks)) {
4146 +                                                       log2phy[log_no] = offset;
4147 +                                                       //printf("NAND logical - %08X -> %04X\n", offset, log_no);
4148 +                                               }
4149 +                                       }
4150 +                                       offset += nand->erasesize;
4151 +                               }
4152 +                               
4153 +                               for (i = 0; i < size / nand->erasesize; i++) {
4154 +                                       ulong sz = nand->erasesize;
4155 +                                       offset = log2phy[off / nand->erasesize];
4156 +                                       if ((int)offset < 0) {
4157 +                                               printf("NAND logical - offset %08X not found\n", off);
4158 +                                               return 1;
4159 +                                       }
4160 +                                       //printf("NAND logical - %04X -> %08X\n", off / nand->erasesize, offset);
4161 +                                       ret = nand_read(nand, offset, &sz, (u_char *)addr);
4162 +                                       if (ret) {
4163 +                                               printf("NAND logical - offset %08X, read error\n", off);
4164 +                                               return 1;
4165 +                                       }
4166 +                                       off += nand->erasesize;
4167 +                                       addr += nand->erasesize;
4168 +                               }
4169 +                               printf(" %d bytes read from NAND logical\n", size);
4170 +                               free(oobuf);
4171 +                               free(log2phy);
4172 +                               return ret == 0 ? 0 : 1;
4173 +                       }
4174 +               }
4175 +#endif
4176 +
4177                 i = strncmp(cmd, "read", 4) == 0;       /* 1 = read, 0 = write */
4178                 printf("\nNAND %s: device %d offset %u, size %u ... ",
4179                        i ? "read" : "write", nand_curr_device, off, size);
4180 diff -Nur u-boot-2006-04-18-1106/cpu/pxa/config.mk u-boot-2006-04-18-1106-new/cpu/pxa/config.mk
4181 --- u-boot-2006-04-18-1106/cpu/pxa/config.mk    2006-04-18 09:05:03.000000000 +0000
4182 +++ u-boot-2006-04-18-1106-new/cpu/pxa/config.mk        2006-07-05 11:19:44.000000000 +0000
4183 @@ -22,8 +22,7 @@
4184  # MA 02111-1307 USA
4185  #
4186  
4187 -PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8 \
4188 -       -msoft-float
4189 +PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8 -fomit-frame-pointer
4190  
4191  #PLATFORM_CPPFLAGS += -mapcs-32 -march=armv4 -mtune=strongarm1100
4192  PLATFORM_CPPFLAGS += -march=armv5 -mtune=xscale
4193 @@ -32,5 +31,5 @@
4194  # Supply options according to compiler version
4195  #
4196  # ========================================================================
4197 -PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu)
4198 +#PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu)
4199  PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
4200 diff -Nur u-boot-2006-04-18-1106/cpu/pxa/start.S u-boot-2006-04-18-1106-new/cpu/pxa/start.S
4201 --- u-boot-2006-04-18-1106/cpu/pxa/start.S      2006-04-18 09:05:03.000000000 +0000
4202 +++ u-boot-2006-04-18-1106-new/cpu/pxa/start.S  2006-07-05 11:19:44.000000000 +0000
4203 @@ -42,6 +42,7 @@
4204         ldr     pc, _irq
4205         ldr     pc, _fiq
4206  
4207 +_reset:                        .word reset
4208  _undefined_instruction: .word undefined_instruction
4209  _software_interrupt:   .word software_interrupt
4210  _prefetch_abort:       .word prefetch_abort
4211 diff -Nur u-boot-2006-04-18-1106/fs/cramfs/cramfs.c u-boot-2006-04-18-1106-new/fs/cramfs/cramfs.c
4212 --- u-boot-2006-04-18-1106/fs/cramfs/cramfs.c   2006-04-18 09:05:03.000000000 +0000
4213 +++ u-boot-2006-04-18-1106-new/fs/cramfs/cramfs.c       2006-07-05 11:19:44.000000000 +0000
4214 @@ -44,8 +44,13 @@
4215  
4216  /* CPU address space offset calculation macro, struct part_info offset is
4217   * device address space offset, so we need to shift it by a device start address. */
4218 +#if (CONFIG_COMMANDS & CFG_CMD_FLASH)
4219  extern flash_info_t flash_info[];
4220  #define PART_OFFSET(x) (x->offset + flash_info[x->dev->id->num].start[0])
4221 +#else
4222 +static struct cramfs_super super_fake;
4223 +#define PART_OFFSET(x) (&super_fake)
4224 +#endif
4225  
4226  static int cramfs_read_super (struct part_info *info)
4227  {
4228 diff -Nur u-boot-2006-04-18-1106/include/asm-arm/arch-pxa/pxa-regs.h u-boot-2006-04-18-1106-new/include/asm-arm/arch-pxa/pxa-regs.h
4229 --- u-boot-2006-04-18-1106/include/asm-arm/arch-pxa/pxa-regs.h  2006-04-18 09:05:03.000000000 +0000
4230 +++ u-boot-2006-04-18-1106-new/include/asm-arm/arch-pxa/pxa-regs.h      2006-07-05 11:19:44.000000000 +0000
4231 @@ -1269,15 +1269,16 @@
4232  #define _GEDR(x)       __REG2(0x40E00048, ((x) & 0x60) >> 3)
4233  #define _GAFR(x)       __REG2(0x40E00054, ((x) & 0x70) >> 2)
4234  
4235 -#define GPLR(x)                ((((x) & 0x7f) < 96) ? _GPLR(x) : GPLR3)
4236 -#define GPDR(x)                ((((x) & 0x7f) < 96) ? _GPDR(x) : GPDR3)
4237 -#define GPSR(x)                ((((x) & 0x7f) < 96) ? _GPSR(x) : GPSR3)
4238 -#define GPCR(x)                ((((x) & 0x7f) < 96) ? _GPCR(x) : GPCR3)
4239 -#define GRER(x)                ((((x) & 0x7f) < 96) ? _GRER(x) : GRER3)
4240 -#define GFER(x)                ((((x) & 0x7f) < 96) ? _GFER(x) : GFER3)
4241 -#define GEDR(x)                ((((x) & 0x7f) < 96) ? _GEDR(x) : GEDR3)
4242 -#define GAFR(x)                ((((x) & 0x7f) < 96) ? _GAFR(x) : \
4243 -                        ((((x) & 0x7f) < 112) ? GAFR3_L : GAFR3_U))
4244 +#define GPLR(x)        (*((((x) & 0x7f) < 96) ? &_GPLR(x) : &GPLR3))
4245 +#define GPDR(x)                (*((((x) & 0x7f) < 96) ? &_GPDR(x) : &GPDR3))
4246 +#define GPSR(x)                (*((((x) & 0x7f) < 96) ? &_GPSR(x) : &GPSR3))
4247 +#define GPCR(x)                (*((((x) & 0x7f) < 96) ? &_GPCR(x) : &GPCR3))
4248 +#define GRER(x)                (*((((x) & 0x7f) < 96) ? &_GRER(x) : &GRER3))
4249 +#define GFER(x)                (*((((x) & 0x7f) < 96) ? &_GFER(x) : &GFER3))
4250 +#define GEDR(x)                (*((((x) & 0x7f) < 96) ? &_GEDR(x) : &GEDR3))
4251 +#define GAFR(x)                (*((((x) & 0x7f) < 96) ? &_GAFR(x) : \
4252 +                        ((((x) & 0x7f) < 112) ? &GAFR3_L : &GAFR3_U)))
4253 +
4254  #else
4255  
4256  #define GPLR(x)                __REG2(0x40E00000, ((x) & 0x60) >> 3)
4257 diff -Nur u-boot-2006-04-18-1106/include/configs/akita.h u-boot-2006-04-18-1106-new/include/configs/akita.h
4258 --- u-boot-2006-04-18-1106/include/configs/akita.h      1970-01-01 00:00:00.000000000 +0000
4259 +++ u-boot-2006-04-18-1106-new/include/configs/akita.h  2006-07-13 11:00:46.000000000 +0000
4260 @@ -0,0 +1,324 @@
4261 +/*
4262 + * include/configs/akita.h
4263 + *
4264 + * Configuration settings for the Sharp Zaurus SL-C1000/C3100.
4265 + *
4266 + * (C) Copyright 2006 Alexander Chukov <sash@pdaXrom.org>
4267 + *
4268 + * portions from adsvix board configuration:
4269 + * (C) Copyright 2004
4270 + * Robert Whaley, Applied Data Systems, Inc. rwhaley@applieddata.net
4271 + * (C) Copyright 2002
4272 + * Kyle Harris, Nexus Technologies, Inc. kharris@nexus-tech.net
4273 + * (C) Copyright 2002
4274 + * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
4275 + * Marius Groeger <mgroeger@sysgo.de>
4276 + *
4277 + * See file CREDITS for list of people who contributed to this
4278 + * project.
4279 + *
4280 + * This program is free software; you can redistribute it and/or
4281 + * modify it under the terms of the GNU General Public License as
4282 + * published by the Free Software Foundation; either version 2 of
4283 + * the License, or (at your option) any later version.
4284 + *
4285 + * This program is distributed in the hope that it will be useful,
4286 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
4287 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the
4288 + * GNU General Public License for more details.
4289 + *
4290 + * You should have received a copy of the GNU General Public License
4291 + * along with this program; if not, write to the Free Software
4292 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
4293 + * MA 02111-1307 USA
4294 + */
4295 +
4296 +#ifndef __CONFIG_H
4297 +#define __CONFIG_H
4298 +
4299 +#define CONFIG_SKIP_LOWLEVEL_INIT
4300 +
4301 +#undef SKIP_CONFIG_RELOCATE_UBOOT
4302 +
4303 +#undef CONFIG_HARD_I2C
4304 +
4305 +/*
4306 + * High Level Configuration Options
4307 + * (easy to change)
4308 + */
4309 +#define CONFIG_PXA27X          1       /* This is an PXA27x CPU */
4310 +#define CONFIG_AKITA           1       /* on Sharp Zaurus Akita */
4311 +//#define CONFIG_MMC                   1
4312 +#define BOARD_LATE_INIT                1
4313 +
4314 +#undef CONFIG_USE_IRQ                  /* we don't need IRQ/FIQ stuff */
4315 +
4316 +#define RTC                    1
4317 +
4318 +/*
4319 + * Size of malloc() pool
4320 + */
4321 +//#define CFG_MALLOC_LEN           (CFG_ENV_SIZE + 128*1024)
4322 +#define CFG_MALLOC_LEN     (CFG_ENV_SIZE + 256*1024)
4323 +#define CFG_GBL_DATA_SIZE      128     /* size in bytes reserved for initial data */
4324 +
4325 +/*
4326 + * select serial console configuration
4327 + */
4328 +#define CONFIG_FFUART         1       /* we use FFUART on Mainstone */
4329 +
4330 +/* allow to overwrite serial and ethaddr */
4331 +#define CONFIG_BAUDRATE               115200
4332 +//#define CONFIG_DOS_PARTITION   1
4333 +
4334 +#undef CONFIG_SHOW_BOOT_PROGRESS
4335 +
4336 +#if 1
4337 +#define        CONFIG_BOOTDELAY        1
4338 +#define CONFIG_AUTOBOOT_PROMPT  "Autobooting in %d seconds\n"
4339 +
4340 +#define        CONFIG_BOOTCOMMAND                                              \
4341 +       "if testkey 101 ; "                                                                                             \
4342 +       "then "                                                                                                         \
4343 +               "nand read.logical 0xa1000000 0x00060000 0x00540000; "                                                  \
4344 +               "setenv bootargs console=ttyS0,115200 console=tty1 root=/dev/ram rw fbcon=rotate:1 ramdisk_size=8192; " \
4345 +               "bootm; "                                                                                               \
4346 +       "fi; "                                                                                                          \
4347 +       "if testkey 2 ; "                                                                                               \
4348 +       "then "                                                                                                         \
4349 +               "nand read.logical 0xa1000000 0x005a0000 0x00160000; "                                                  \
4350 +               "setenv bootargs console=ttyS0,115200 console=tty1 root=/dev/mmcblk0p1 fbcon=rotate:1; "                \
4351 +               "bootm; "                                                                                               \
4352 +       "fi; "                                                                                                          \
4353 +       "if testkey 18 ; "                                                                                              \
4354 +       "then "                                                                                                         \
4355 +               "nand read.logical 0xa1000000 0x005a0000 0x00160000; "                                                  \
4356 +               "setenv bootargs console=ttyS0,115200 console=tty1 root=/dev/hda1 fbcon=rotate:1; "                     \
4357 +               "bootm; "                                                                                               \
4358 +       "fi; "                                                                                                          \
4359 +       "if testkey 3 ; "                                                                                               \
4360 +       "then "                                                                                                         \
4361 +               "nand read.logical 0xa1000000 0x005a0000 0x00160000; "                                                  \
4362 +               "setenv bootargs console=ttyS0,115200 console=tty1 root=/dev/hdc1 fbcon=rotate:1; "                     \
4363 +               "bootm; "                                                                                               \
4364 +       "fi; "                                                                                                          \
4365 +       "nand read.logical 0xa1000000 0x005a0000 0x00160000; "                                                          \
4366 +       "setenv bootargs console=ttyS0,115200 console=tty1 root=/dev/mtdblock2 rootfstype=jffs2 fbcon=rotate:1; "       \
4367 +       "bootm; "
4368 +#else
4369 +#define CONFIG_BOOTCOMMAND     "" // "run boot_flash"
4370 +#endif
4371 +
4372 +#define CONFIG_BOOTARGS                "console=ttyS0,115200 console=tty1 root=/dev/ram rw fbcon=rotate:1 ramdisk_size=8192"
4373 +#define CONFIG_SETUP_MEMORY_TAGS 1
4374 +#define CONFIG_CMDLINE_TAG      1      /* enable passing of ATAGs      */
4375 +#define CONFIG_INITRD_TAG       1
4376 +
4377 +#define CONFIG_COMMANDS                ((                              \
4378 +                                   CONFIG_CMD_DFL      |       \
4379 +                                   CFG_CMD_NAND        |       \
4380 +                                   CFG_CMD_JFFS2               \
4381 +                                   ) & ~(                      \
4382 +                                   CFG_CMD_NET         |       \
4383 +                                   CFG_CMD_FLASH       |       \
4384 +                                   CFG_CMD_IMLS                \
4385 +                               ))
4386 +
4387 +//                                 CFG_CMD_ENV
4388 +                       
4389 +/* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */
4390 +#include <cmd_confdefs.h>
4391 +
4392 +
4393 +#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
4394 +#define CONFIG_KGDB_BAUDRATE   230400          /* speed to run kgdb serial port */
4395 +#define CONFIG_KGDB_SER_INDEX  2               /* which serial port to use */
4396 +#endif
4397 +
4398 +/*
4399 + * Miscellaneous configurable options
4400 + */
4401 +#define CFG_HUSH_PARSER                1
4402 +#define CFG_PROMPT_HUSH_PS2    "> "
4403 +
4404 +#define CFG_LONGHELP                           /* undef to save memory         */
4405 +#define CFG_PROMPT             "U-Boot> "      /* Monitor Command Prompt */
4406 +
4407 +#define CFG_CBSIZE             256             /* Console I/O Buffer Size      */
4408 +#define CFG_PBSIZE (CFG_CBSIZE+sizeof(CFG_PROMPT)+16) /* Print Buffer Size */
4409 +#define CFG_MAXARGS            16              /* max number of command args   */
4410 +#define CFG_BARGSIZE           CFG_CBSIZE      /* Boot Argument Buffer Size    */
4411 +#define CFG_DEVICE_NULLDEV     1
4412 +
4413 +#define CFG_MEMTEST_START      0xa0400000      /* memtest works on     */
4414 +#define CFG_MEMTEST_END                0xa0800000      /* 4 ... 8 MB in DRAM   */
4415 +
4416 +#undef CFG_CLKS_IN_HZ          /* everything, incl board info, in Hz */
4417 +
4418 +#define CFG_LOAD_ADDR          0xa1000000      /* default load address */
4419 +
4420 +#define CFG_HZ                 3686400         /* incrementer freq: 3.6864 MHz */
4421 +#define CFG_CPUSPEED           0x207           /* need to look more closely, I think this is Turbo = 2x, L=91Mhz */
4422 +
4423 +                                               /* valid baudrates */
4424 +#define CFG_BAUDRATE_TABLE     { 9600, 19200, 38400, 57600, 115200 }
4425 +
4426 +#define CFG_MMC_BASE           0xF0000000
4427 +
4428 +/*
4429 + * Stack sizes
4430 + *
4431 + * The stack sizes are set up in start.S using the settings below
4432 + */
4433 +#define CONFIG_STACKSIZE       (128*1024)      /* regular stack */
4434 +#ifdef CONFIG_USE_IRQ
4435 +#define CONFIG_STACKSIZE_IRQ   (4*1024)        /* IRQ stack */
4436 +#define CONFIG_STACKSIZE_FIQ   (4*1024)        /* FIQ stack */
4437 +#endif
4438 +
4439 +/*
4440 + * Physical Memory Map
4441 + */
4442 +#define CONFIG_NR_DRAM_BANKS   4          /* we have 2 banks of DRAM */
4443 +#define PHYS_SDRAM_1           0xa0000000 /* SDRAM Bank #1 */
4444 +#define PHYS_SDRAM_1_SIZE      0x04000000 /* 64 MB */
4445 +#define PHYS_SDRAM_2           0xa4000000 /* SDRAM Bank #2 */
4446 +#define PHYS_SDRAM_2_SIZE      0x00000000 /* 0 MB */
4447 +#define PHYS_SDRAM_3           0xa8000000 /* SDRAM Bank #3 */
4448 +#define PHYS_SDRAM_3_SIZE      0x00000000 /* 0 MB */
4449 +#define PHYS_SDRAM_4           0xac000000 /* SDRAM Bank #4 */
4450 +#define PHYS_SDRAM_4_SIZE      0x00000000 /* 0 MB */
4451 +
4452 +#define PHYS_FLASH_1           0xd4000000 /* Flash Bank #1 */
4453 +
4454 +#define CFG_DRAM_BASE          0xa0000000
4455 +#define CFG_DRAM_SIZE          0x04000000
4456 +
4457 +#define CFG_FLASH_BASE         PHYS_FLASH_1
4458 +
4459 +/*
4460 + * GPIO settings for Mainstone
4461 + */
4462 +
4463 +#define CFG_GPSR0_VAL          0x00708800
4464 +#define CFG_GPSR1_VAL          0x03cf0002
4465 +#define CFG_GPSR2_VAL          0x0021FC00
4466 +#define CFG_GPSR3_VAL          0x00000000
4467 +
4468 +#define CFG_GPCR0_VAL          0x00001000
4469 +#define CFG_GPCR1_VAL          0x00000000
4470 +#define CFG_GPCR2_VAL          0x00000000
4471 +#define CFG_GPCR3_VAL          0x00000000
4472 +
4473 +#define CFG_GPDR0_VAL          0xC27B9C04
4474 +#define CFG_GPDR1_VAL          0x00EFAA83
4475 +#define CFG_GPDR2_VAL          0x0E23FC00
4476 +#define CFG_GPDR3_VAL          0x001E1F81
4477 +
4478 +#define CFG_GAFR0_L_VAL                0x94F00000
4479 +#define CFG_GAFR0_U_VAL                0x015A859A
4480 +#define CFG_GAFR1_L_VAL                0x999A955A
4481 +#define CFG_GAFR1_U_VAL                0x0005A4AA
4482 +#define CFG_GAFR2_L_VAL                0x6AA00000
4483 +#define CFG_GAFR2_U_VAL                0x55A8041A
4484 +#define CFG_GAFR3_L_VAL                0x56AA955A
4485 +#define CFG_GAFR3_U_VAL                0x00000001
4486 +
4487 +#define CFG_PSSR_VAL           0x20    // ???????????
4488 +
4489 +/*
4490 + * PCMCIA and CF Interfaces
4491 + */
4492 +#define CFG_MECR_VAL           0x00000001
4493 +#define CFG_MCMEM0_VAL         0x00010204
4494 +#define CFG_MCMEM1_VAL         0x00010204
4495 +#define CFG_MCATT0_VAL         0x00010204
4496 +#define CFG_MCATT1_VAL         0x00010204
4497 +#define CFG_MCIO0_VAL          0x0000c108
4498 +#define CFG_MCIO1_VAL          0x0001c108
4499 +
4500 +//#define CONFIG_PXA_PCMCIA 1
4501 +//#define CONFIG_PXA_IDE 1
4502 +
4503 +#define CONFIG_PCMCIA_SLOT_A 1
4504 +/* just to keep build system happy  */
4505 +
4506 +#define CFG_PCMCIA_MEM_ADDR     0x28000000
4507 +#define CFG_PCMCIA_MEM_SIZE     0x04000000
4508 +
4509 +#define CFG_IDE_MAXBUS         1
4510 +/* max. 1 IDE bus              */
4511 +#define CFG_IDE_MAXDEVICE      1
4512 +/* max. 1 drive per IDE bus    */
4513 +
4514 +#define CFG_ATA_IDE0_OFFSET    0x0000
4515 +
4516 +#define CFG_ATA_BASE_ADDR      0x20000000
4517 +
4518 +/* Offset for data I/O                 */
4519 +#define CFG_ATA_DATA_OFFSET    0x1f0
4520 +
4521 +/* Offset for normal register accesses */
4522 +#define CFG_ATA_REG_OFFSET     0x1f0
4523 +
4524 +/* Offset for alternate registers      */
4525 +#define CFG_ATA_ALT_OFFSET     0x3f0
4526 +
4527 +#define CFG_NO_FLASH 1
4528 +#define CFG_MAX_FLASH_BANKS    1       /* max number of memory banks           */
4529 +#define CFG_MAX_FLASH_SECT     512     /* max number of sectors on one chip    */
4530 +
4531 +/*-----------------------------------------------------------------------
4532 + * NAND-FLASH stuff
4533 + *-----------------------------------------------------------------------
4534 + */
4535 +#undef CFG_NAND_LEGACY
4536 +
4537 +/* NAND debugging */
4538 +//#define CONFIG_MTD_DEBUG
4539 +//#define CONFIG_MTD_DEBUG_VERBOSE 3
4540 +
4541 +#define CFG_NAND_BASE          0xd4000000
4542 +#define CFG_MAX_NAND_DEVICE    1       /* Max number of NAND devices           */
4543 +#define NAND_MAX_CHIPS                 1
4544 +
4545 +//#define CONFIG_MTD_NAND_VERIFY_WRITE 1  /* verify all writes!!!         */
4546 +//#define CFG_NAND_SKIP_BAD_DOT_I      1  /* ".i" read skips bad blocks   */
4547 +
4548 +#define CONFIG_JFFS2_NAND 1                    /* jffs2 on nand support */
4549 +#define NAND_CACHE_PAGES 16                    /* size of nand cache in 512 bytes pages */
4550 +
4551 +/*
4552 + * JFFS2 partitions
4553 + *
4554 + */
4555 +/* No command line, one static partition */
4556 +//#undef CONFIG_JFFS2_CMDLINE
4557 +//#define CONFIG_JFFS2_DEV             "nand0"
4558 +//#define CONFIG_JFFS2_PART_SIZE               0xFFFFFFFF
4559 +//#define CONFIG_JFFS2_PART_OFFSET     0x00060000
4560 +
4561 +/* mtdparts command line support */
4562 +/* Note: fake mtd_id used, no linux mtd map file */
4563 +
4564 +#define CONFIG_JFFS2_CMDLINE
4565 +#define MTDIDS_DEFAULT         "nand0=laze-0"
4566 +//#define MTDPARTS_DEFAULT     "mtdparts=laze-0:256k(uboot),128k(env),-(jffs2)"
4567 +#define MTDPARTS_DEFAULT       "mtdparts=laze-0:7168k(Logical),-(JFFS2)"
4568 +
4569 +/*
4570 + * SHARP SL NAND logical partition
4571 + */
4572 +#define NAND_LOGICAL           1
4573 +#define NAND_LOGICAL_SIZE      0x700000
4574 +
4575 +/*
4576 + * Environment
4577 + */
4578 +
4579 +#define CFG_ENV_IS_IN_NAND     1
4580 +#define CFG_ENV_OFFSET         0x40000
4581 +//#define CFG_ENV_OFFSET_REDUND        0x44000
4582 +#define CFG_ENV_SIZE           0x20000
4583 +
4584 +#endif /* __CONFIG_H */
4585 diff -Nur u-boot-2006-04-18-1106/include/configs/corgi.h u-boot-2006-04-18-1106-new/include/configs/corgi.h
4586 --- u-boot-2006-04-18-1106/include/configs/corgi.h      1970-01-01 00:00:00.000000000 +0000
4587 +++ u-boot-2006-04-18-1106-new/include/configs/corgi.h  2006-07-13 11:19:04.000000000 +0000
4588 @@ -0,0 +1,326 @@
4589 +/*
4590 + * include/configs/corgi.h
4591 + *
4592 + * Configuration settings for the Sharp Zaurus SL-C7x0/C860.
4593 + *
4594 + * (C) Copyright 2006 Alexander Chukov <sash@pdaXrom.org>
4595 + *
4596 + * portions from adsvix board configuration:
4597 + * (C) Copyright 2004
4598 + * Robert Whaley, Applied Data Systems, Inc. rwhaley@applieddata.net
4599 + * (C) Copyright 2002
4600 + * Kyle Harris, Nexus Technologies, Inc. kharris@nexus-tech.net
4601 + * (C) Copyright 2002
4602 + * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
4603 + * Marius Groeger <mgroeger@sysgo.de>
4604 + *
4605 + * See file CREDITS for list of people who contributed to this
4606 + * project.
4607 + *
4608 + * This program is free software; you can redistribute it and/or
4609 + * modify it under the terms of the GNU General Public License as
4610 + * published by the Free Software Foundation; either version 2 of
4611 + * the License, or (at your option) any later version.
4612 + *
4613 + * This program is distributed in the hope that it will be useful,
4614 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
4615 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the
4616 + * GNU General Public License for more details.
4617 + *
4618 + * You should have received a copy of the GNU General Public License
4619 + * along with this program; if not, write to the Free Software
4620 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
4621 + * MA 02111-1307 USA
4622 + */
4623 +
4624 +#ifndef __CONFIG_H
4625 +#define __CONFIG_H
4626 +
4627 +#define CONFIG_SKIP_LOWLEVEL_INIT
4628 +
4629 +#undef SKIP_CONFIG_RELOCATE_UBOOT
4630 +
4631 +#undef CONFIG_HARD_I2C
4632 +
4633 +/*
4634 + * High Level Configuration Options
4635 + * (easy to change)
4636 + */
4637 +#define CONFIG_PXA250          1       /* This is an PXA255 CPU    */
4638 +#define CONFIG_CORGI           1       /* on Sharp Zaurus Corgi    */
4639 +//#define CONFIG_MMC                   1
4640 +#define BOARD_LATE_INIT                1
4641 +
4642 +#undef CONFIG_USE_IRQ                  /* we don't need IRQ/FIQ stuff */
4643 +
4644 +#define RTC                    1
4645 +
4646 +/*
4647 + * Size of malloc() pool
4648 + */
4649 +//#define CFG_MALLOC_LEN           (CFG_ENV_SIZE + 128*1024)
4650 +#define CFG_MALLOC_LEN     (CFG_ENV_SIZE + 256*1024)
4651 +#define CFG_GBL_DATA_SIZE      128     /* size in bytes reserved for initial data */
4652 +
4653 +/*
4654 + * select serial console configuration
4655 + */
4656 +#define CONFIG_FFUART         1       /* we use FFUART on Mainstone */
4657 +
4658 +/* allow to overwrite serial and ethaddr */
4659 +#define CONFIG_BAUDRATE               115200
4660 +//#define CONFIG_DOS_PARTITION   1
4661 +
4662 +#undef CONFIG_SHOW_BOOT_PROGRESS
4663 +
4664 +#if 1
4665 +#define        CONFIG_BOOTDELAY        1
4666 +#define CONFIG_AUTOBOOT_PROMPT  "Autobooting in %d seconds\n"
4667 +
4668 +#define        CONFIG_BOOTCOMMAND                                              \
4669 +       "if testkey 101 ; "                                                                                             \
4670 +       "then "                                                                                                         \
4671 +               "nand read.logical 0xa0800000 0x00060000 0x00540000; "                                                  \
4672 +               "setenv bootargs console=ttyS0,115200 console=tty1 root=/dev/ram rw ramdisk_size=8192; "                \
4673 +               "bootm; "                                                                                               \
4674 +       "fi; "                                                                                                          \
4675 +       "if testkey 2 ; "                                                                                               \
4676 +       "then "                                                                                                         \
4677 +               "nand read.logical 0xa0800000 0x005a0000 0x00160000; "                                                  \
4678 +               "setenv bootargs console=ttyS0,115200 console=tty1 root=/dev/mmcblk0p1; "                               \
4679 +               "bootm; "                                                                                               \
4680 +       "fi; "                                                                                                          \
4681 +       "if testkey 18 ; "                                                                                              \
4682 +       "then "                                                                                                         \
4683 +               "nand read.logical 0xa0800000 0x005a0000 0x00160000; "                                                  \
4684 +               "setenv bootargs console=ttyS0,115200 console=tty1 root=/dev/hda1; "                                    \
4685 +               "bootm; "                                                                                               \
4686 +       "fi; "                                                                                                          \
4687 +       "if testkey 3 ; "                                                                                               \
4688 +       "then "                                                                                                         \
4689 +               "nand read.logical 0xa0800000 0x005a0000 0x00160000; "                                                  \
4690 +               "setenv bootargs console=ttyS0,115200 console=tty1 root=/dev/hdc1; "                                    \
4691 +               "bootm; "                                                                                               \
4692 +       "fi; "                                                                                                          \
4693 +       "nand read.logical 0xa0800000 0x005a0000 0x00160000; "                                                          \
4694 +       "setenv bootargs console=ttyS0,115200 console=tty1 root=/dev/mtdblock2 rootfstype=jffs2; "                      \
4695 +       "bootm; "
4696 +#else
4697 +#define CONFIG_BOOTCOMMAND     "" // "run boot_flash"
4698 +#endif
4699 +
4700 +#define CONFIG_BOOTARGS                "console=ttyS0,115200 console=tty1 root=/dev/ram rw ramdisk_size=8192"
4701 +#define CONFIG_SETUP_MEMORY_TAGS 1
4702 +#define CONFIG_CMDLINE_TAG      1      /* enable passing of ATAGs      */
4703 +#define CONFIG_INITRD_TAG       1
4704 +
4705 +#define CONFIG_COMMANDS                ((                              \
4706 +                                   CONFIG_CMD_DFL      |       \
4707 +                                   CFG_CMD_NAND        |       \
4708 +                                   CFG_CMD_JFFS2               \
4709 +                                   ) & ~(                      \
4710 +                                   CFG_CMD_NET         |       \
4711 +                                   CFG_CMD_FLASH       |       \
4712 +                                   CFG_CMD_IMLS                \
4713 +                               ))
4714 +
4715 +//                                 CFG_CMD_ENV
4716 +                       
4717 +/* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */
4718 +#include <cmd_confdefs.h>
4719 +
4720 +
4721 +#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
4722 +#define CONFIG_KGDB_BAUDRATE   230400          /* speed to run kgdb serial port */
4723 +#define CONFIG_KGDB_SER_INDEX  2               /* which serial port to use */
4724 +#endif
4725 +
4726 +/*
4727 + * Miscellaneous configurable options
4728 + */
4729 +#define CFG_HUSH_PARSER                1
4730 +#define CFG_PROMPT_HUSH_PS2    "> "
4731 +
4732 +#define CFG_LONGHELP                           /* undef to save memory         */
4733 +#define CFG_PROMPT             "U-Boot> "      /* Monitor Command Prompt */
4734 +
4735 +#define CFG_CBSIZE             256             /* Console I/O Buffer Size      */
4736 +#define CFG_PBSIZE (CFG_CBSIZE+sizeof(CFG_PROMPT)+16) /* Print Buffer Size */
4737 +#define CFG_MAXARGS            16              /* max number of command args   */
4738 +#define CFG_BARGSIZE           CFG_CBSIZE      /* Boot Argument Buffer Size    */
4739 +#define CFG_DEVICE_NULLDEV     1
4740 +
4741 +#define CFG_MEMTEST_START      0xa0400000      /* memtest works on     */
4742 +#define CFG_MEMTEST_END                0xa0800000      /* 4 ... 8 MB in DRAM   */
4743 +
4744 +#undef CFG_CLKS_IN_HZ          /* everything, incl board info, in Hz */
4745 +
4746 +#define CFG_LOAD_ADDR          0xa0800000      /* default load address */
4747 +
4748 +#define CFG_HZ                 3686400         /* incrementer freq: 3.6864 MHz */
4749 +#define CFG_CPUSPEED           0x207           /* need to look more closely, I think this is Turbo = 2x, L=91Mhz */
4750 +
4751 +                                               /* valid baudrates */
4752 +#define CFG_BAUDRATE_TABLE     { 9600, 19200, 38400, 57600, 115200 }
4753 +
4754 +#define CFG_MMC_BASE           0xF0000000
4755 +
4756 +/*
4757 + * Stack sizes
4758 + *
4759 + * The stack sizes are set up in start.S using the settings below
4760 + */
4761 +#define CONFIG_STACKSIZE       (128*1024)      /* regular stack */
4762 +#ifdef CONFIG_USE_IRQ
4763 +#define CONFIG_STACKSIZE_IRQ   (4*1024)        /* IRQ stack */
4764 +#define CONFIG_STACKSIZE_FIQ   (4*1024)        /* FIQ stack */
4765 +#endif
4766 +
4767 +/*
4768 + * Physical Memory Map
4769 + */
4770 +#define CONFIG_NR_DRAM_BANKS   4          /* we have 2 banks of DRAM */
4771 +#define PHYS_SDRAM_1           0xa0000000 /* SDRAM Bank #1 */
4772 +#define PHYS_SDRAM_1_SIZE      0x04000000 /* 64 MB */
4773 +#define PHYS_SDRAM_2           0xa4000000 /* SDRAM Bank #2 */
4774 +#define PHYS_SDRAM_2_SIZE      0x00000000 /* 0 MB */
4775 +#define PHYS_SDRAM_3           0xa8000000 /* SDRAM Bank #3 */
4776 +#define PHYS_SDRAM_3_SIZE      0x00000000 /* 0 MB */
4777 +#define PHYS_SDRAM_4           0xac000000 /* SDRAM Bank #4 */
4778 +#define PHYS_SDRAM_4_SIZE      0x00000000 /* 0 MB */
4779 +
4780 +#define PHYS_FLASH_1           0xd4000000 /* Flash Bank #1 */
4781 +
4782 +#define CFG_DRAM_BASE          0xa0000000
4783 +#define CFG_DRAM_SIZE          0x04000000
4784 +
4785 +#define CFG_FLASH_BASE         PHYS_FLASH_1
4786 +
4787 +/*
4788 + * GPIO settings for Mainstone
4789 + */
4790 +
4791 +#define CFG_GPSR0_VAL          0x00708800
4792 +#define CFG_GPSR1_VAL          0x03cf0002
4793 +#define CFG_GPSR2_VAL          0x0021FC00
4794 +#define CFG_GPSR3_VAL          0x00000000
4795 +
4796 +#define CFG_GPCR0_VAL          0x00001000
4797 +#define CFG_GPCR1_VAL          0x00000000
4798 +#define CFG_GPCR2_VAL          0x00000000
4799 +#define CFG_GPCR3_VAL          0x00000000
4800 +
4801 +#define CFG_GPDR0_VAL          0xC27B9C04
4802 +#define CFG_GPDR1_VAL          0x00EFAA83
4803 +#define CFG_GPDR2_VAL          0x0E23FC00
4804 +#define CFG_GPDR3_VAL          0x001E1F81
4805 +
4806 +#define CFG_GAFR0_L_VAL                0x94F00000
4807 +#define CFG_GAFR0_U_VAL                0x015A859A
4808 +#define CFG_GAFR1_L_VAL                0x999A955A
4809 +#define CFG_GAFR1_U_VAL                0x0005A4AA
4810 +#define CFG_GAFR2_L_VAL                0x6AA00000
4811 +#define CFG_GAFR2_U_VAL                0x55A8041A
4812 +#define CFG_GAFR3_L_VAL                0x56AA955A
4813 +#define CFG_GAFR3_U_VAL                0x00000001
4814 +
4815 +#define CFG_PSSR_VAL           0x20    // ???????????
4816 +
4817 +/*
4818 + * PCMCIA and CF Interfaces
4819 + */
4820 +#define CFG_MECR_VAL           0x00000001
4821 +#define CFG_MCMEM0_VAL         0x00010204
4822 +#define CFG_MCMEM1_VAL         0x00010204
4823 +#define CFG_MCATT0_VAL         0x00010204
4824 +#define CFG_MCATT1_VAL         0x00010204
4825 +#define CFG_MCIO0_VAL          0x0000c108
4826 +#define CFG_MCIO1_VAL          0x0001c108
4827 +
4828 +//#define CONFIG_PXA_PCMCIA 1
4829 +//#define CONFIG_PXA_IDE 1
4830 +
4831 +#define CONFIG_PCMCIA_SLOT_A 1
4832 +/* just to keep build system happy  */
4833 +
4834 +#define CFG_PCMCIA_MEM_ADDR     0x28000000
4835 +#define CFG_PCMCIA_MEM_SIZE     0x04000000
4836 +
4837 +#define CFG_IDE_MAXBUS         1
4838 +/* max. 1 IDE bus              */
4839 +#define CFG_IDE_MAXDEVICE      1
4840 +/* max. 1 drive per IDE bus    */
4841 +
4842 +#define CFG_ATA_IDE0_OFFSET    0x0000
4843 +
4844 +#define CFG_ATA_BASE_ADDR      0x20000000
4845 +
4846 +/* Offset for data I/O                 */
4847 +#define CFG_ATA_DATA_OFFSET    0x1f0
4848 +
4849 +/* Offset for normal register accesses */
4850 +#define CFG_ATA_REG_OFFSET     0x1f0
4851 +
4852 +/* Offset for alternate registers      */
4853 +#define CFG_ATA_ALT_OFFSET     0x3f0
4854 +
4855 +#define CFG_NO_FLASH 1
4856 +#define CFG_MAX_FLASH_BANKS    1       /* max number of memory banks           */
4857 +#define CFG_MAX_FLASH_SECT     512     /* max number of sectors on one chip    */
4858 +
4859 +/*-----------------------------------------------------------------------
4860 + * NAND-FLASH stuff
4861 + *-----------------------------------------------------------------------
4862 + */
4863 +#undef CFG_NAND_LEGACY
4864 +
4865 +/* NAND debugging */
4866 +//#define CONFIG_MTD_DEBUG
4867 +//#define CONFIG_MTD_DEBUG_VERBOSE 3
4868 +
4869 +#define CFG_NAND_BASE          0xd4000000
4870 +#define CFG_MAX_NAND_DEVICE    1       /* Max number of NAND devices           */
4871 +#define NAND_MAX_CHIPS                 1
4872 +
4873 +//#define CONFIG_MTD_NAND_VERIFY_WRITE 1  /* verify all writes!!!         */
4874 +//#define CFG_NAND_SKIP_BAD_DOT_I      1  /* ".i" read skips bad blocks   */
4875 +
4876 +#define CONFIG_JFFS2_NAND 1                    /* jffs2 on nand support */
4877 +#define NAND_CACHE_PAGES 16                    /* size of nand cache in 512 bytes pages */
4878 +
4879 +#define NAND_ALLOW_ERASE_ALL   1
4880 +
4881 +/*
4882 + * JFFS2 partitions
4883 + *
4884 + */
4885 +/* No command line, one static partition */
4886 +//#undef CONFIG_JFFS2_CMDLINE
4887 +//#define CONFIG_JFFS2_DEV             "nand0"
4888 +//#define CONFIG_JFFS2_PART_SIZE               0xFFFFFFFF
4889 +//#define CONFIG_JFFS2_PART_OFFSET     0x00060000
4890 +
4891 +/* mtdparts command line support */
4892 +/* Note: fake mtd_id used, no linux mtd map file */
4893 +
4894 +#define CONFIG_JFFS2_CMDLINE
4895 +#define MTDIDS_DEFAULT         "nand0=laze-0"
4896 +//#define MTDPARTS_DEFAULT     "mtdparts=laze-0:256k(uboot),128k(env),-(jffs2)"
4897 +#define MTDPARTS_DEFAULT       "mtdparts=laze-0:7168k(Logical),-(JFFS2)"
4898 +
4899 +/*
4900 + * SHARP SL NAND logical partition
4901 + */
4902 +#define NAND_LOGICAL           1
4903 +#define NAND_LOGICAL_SIZE      0x700000
4904 +
4905 +/*
4906 + * Environment
4907 + */
4908 +
4909 +#define CFG_ENV_IS_IN_NAND     1
4910 +#define CFG_ENV_OFFSET         0x40000
4911 +//#define CFG_ENV_OFFSET_REDUND        0x44000
4912 +#define CFG_ENV_SIZE           0x20000
4913 +
4914 +#endif /* __CONFIG_H */
4915 --- s/examples/Makefile.orig    2006-12-09 15:08:45.000000000 +0600
4916 +++ s/examples/Makefile 2006-12-09 15:09:00.000000000 +0600
4917 @@ -60,7 +60,7 @@
4918  include $(TOPDIR)/config.mk
4919  
4920  SREC   = hello_world.srec
4921 -BIN    = hello_world.bin hello_world
4922 +BIN    = hello_world hello_world.bin
4923  
4924  ifeq ($(CPU),mpc8xx)
4925  SREC   = test_burst.srec
4926 @@ -122,7 +122,7 @@
4927  
4928  CPPFLAGS += -I..
4929  
4930 -all:   .depend $(OBJS) $(LIB) $(SREC) $(BIN)
4931 +all:   .depend $(OBJS) $(LIB) $(BIN) $(SREC)
4932  
4933  #########################################################################
4934  $(LIB): .depend $(LIBOBJS)