1 diff -urN linux-2.4.26/arch/arm/boot/compressed/head.S linux-2.4.26-vrs1-lnode80/arch/arm/boot/compressed/head.S
2 --- linux-2.4.26/arch/arm/boot/compressed/head.S 2005-11-02 16:54:16.000000000 -0400
3 +++ linux-2.4.26-vrs1-lnode80/arch/arm/boot/compressed/head.S 2005-11-02 17:37:31.000000000 -0400
5 * 100% relocatable. Any attempt to do so will result in a crash.
6 * Please select one of the following when turning on debugging.
10 #if defined(CONFIG_DEBUG_DC21285_PORT)
14 str \rb, [r3, #0x14] @ UTDR
16 +#elif 1 /* Sharp LH79520-type */
18 + ldr \rb, =0xfffc0000 @ UART1 base
23 +#elif 0 /* Sharp LH7A400-type */
25 + ldr \rb, =0x80000700 @ UART1 base
31 #error no serial architecture defined
38 .macro debug_reloc_start
42 .word 0x016f2818 @ Magic numbers to help the loader
43 .word start @ absolute load/run zImage address
44 .word _edata @ zImage end address
45 -1: mov r7, r1 @ save architecture ID
46 +1: @mov r7, r1 @ save architecture ID
51 #ifndef __ARM_ARCH_2__
53 LC1: .word reloc_end - reloc_start
56 + .type proc_lh7a400_type,#object
59 + .size proc_lh7a400_type, . - proc_lh7a400_type
62 * Turn on the cache. We need to setup some page tables so that we
63 * can have both the I and D caches on.
64 diff -urN linux-2.4.26/arch/arm/boot/Makefile linux-2.4.26-vrs1-lnode80/arch/arm/boot/Makefile
65 --- linux-2.4.26/arch/arm/boot/Makefile 2003-08-25 07:44:39.000000000 -0400
66 +++ linux-2.4.26-vrs1-lnode80/arch/arm/boot/Makefile 2005-11-02 17:37:31.000000000 -0400
68 INITRD_VIRT = 0x0C800000
71 +ifeq ($(CONFIG_ARCH_LH79520),y)
72 + ZTEXTADDR = 0x20008000
73 + ZBSSADDR = 0x20200000
74 + ZRELADDR = 0x20008000
75 + INITRD_PHYS = 0x20400000
76 + INITRD_VIRT = 0xC0400000
77 + PARAMS_PHYS = 0x20110000
80 +ifeq ($(CONFIG_ARCH_LH7A400),y)
81 + ZTEXTADDR = 0xC0008000
82 + ZBSSADDR = 0xC0200000
83 + ZRELADDR = 0xC0008000
84 + INITRD_PHYS = 0xC4000000
85 + INITRD_VIRT = 0xC4000000
86 + PARAMS_PHYS = 0xC0000100
89 ifeq ($(CONFIG_ARCH_SA1100),y)
91 # No defconfig file to move this into...
92 diff -urN linux-2.4.26/arch/arm/config.in linux-2.4.26-vrs1-lnode80/arch/arm/config.in
93 --- linux-2.4.26/arch/arm/config.in 2005-11-02 16:54:16.000000000 -0400
94 +++ linux-2.4.26-vrs1-lnode80/arch/arm/config.in 2005-11-02 17:37:31.000000000 -0400
96 RiscPC CONFIG_ARCH_RPC \
97 RiscStation CONFIG_ARCH_RISCSTATION \
98 SA1100-based CONFIG_ARCH_SA1100 \
99 + LH79520-based CONFIG_ARCH_LH79520 \
100 + LH7A400-based CONFIG_ARCH_LH7A400 \
101 Shark CONFIG_ARCH_SHARK \
102 AT91RM9200-based CONFIG_ARCH_AT91RM9200 " RiscPC
108 +mainmenu_option next_comment
109 +comment 'Sharp LH79520 Implementations'
110 +dep_bool ' LH79520 EVB' CONFIG_LH79520_EVB $CONFIG_ARCH_LH79520
111 +dep_bool ' 520 BOGUS EVB' CONFIG_BOGON_EVB $CONFIG_ARCH_LH79520
114 +mainmenu_option next_comment
115 +comment 'Sharp LH7A400 Implementations'
116 +dep_bool ' LH7A400 EVB' CONFIG_LH7A400_EVB $CONFIG_ARCH_LH7A400
119 # Definitions to make life easier
120 if [ "$CONFIG_ARCH_ARCA5K" = "y" -o \
121 "$CONFIG_ARCH_RPC" = "y" ]; then
124 if [ "$CONFIG_ARCH_CLPS711X" = "y" -o \
125 "$CONFIG_ARCH_L7200" = "y" -o \
126 + "$CONFIG_ARCH_LH79520" = "y" -o \
127 "$CONFIG_ARCH_CDB89712" = "y" ]; then
128 define_bool CONFIG_CPU_ARM720T y
134 -if [ "$CONFIG_ARCH_CAMELOT" = "y" ]; then
135 +if [ "$CONFIG_ARCH_CAMELOT" = "y" -o \
136 + "$CONFIG_ARCH_LH7A400" = "y" ]; then
137 define_bool CONFIG_CPU_ARM922T y
139 if [ "$CONFIG_ARCH_INTEGRATOR" = "y" ]; then
141 "$CONFIG_ARCH_TBOX" = "y" -o "$CONFIG_ARCH_SHARK" = "y" -o \
142 "$CONFIG_ARCH_NEXUSPCI" = "y" -o "$CONFIG_ARCH_CLPS711X" = "y" -o \
143 "$CONFIG_ARCH_INTEGRATOR" = "y" -o "$CONFIG_ARCH_SA1100" = "y" -o \
144 + "$CONFIG_ARCH_LH79520" = "y" -o "$CONFIG_ARCH_LH7A400" = "y" -o \
145 "$CONFIG_ARCH_L7200" = "y" -o "$CONFIG_ARCH_ANAKIN" = "y" -o \
146 "$CONFIG_ARCH_CAMELOT" = "y" -o "$CONFIG_ARCH_MX1ADS" = "y" -o \
147 "$CONFIG_ARCH_OMAHA" = "y" -o "$CONFIG_ARCH_AT91RM9200" = "y" ]; then
150 # Select various configuration options depending on the machine type
151 if [ "$CONFIG_ARCH_EDB7211" = "y" -o \
152 + "$CONFIG_ARCH_LH79520" = "y" -o \
153 + "$CONFIG_ARCH_LH7A400" = "y" -o \
154 "$CONFIG_ARCH_SA1100" = "y" -o \
155 "$CONFIG_ARCH_RISCSTATION" = "y" ]; then
156 define_bool CONFIG_DISCONTIGMEM y
158 "$CONFIG_ARCH_EBSA110" = "y" -o \
159 "$CONFIG_ARCH_CDB89712" = "y" -o \
160 "$CONFIG_ARCH_EDB7211" = "y" -o \
161 + "$CONFIG_ARCH_LH79520" = "y" -o \
162 + "$CONFIG_ARCH_LH7A400" = "y" -o \
163 "$CONFIG_ARCH_SA1100" = "y" ]; then
164 define_bool CONFIG_ISA y
167 "$CONFIG_ARCH_TBOX" = "y" -o \
168 "$CONFIG_ARCH_CLPS7500" = "y" -o \
169 "$CONFIG_ARCH_P720T" = "y" -o \
170 + "$CONFIG_ARCH_LH79520" = "y" -o \
171 + "$CONFIG_ARCH_LH7A400" = "y" -o \
172 "$CONFIG_ARCH_ANAKIN" = "y" -o \
173 "$CONFIG_ARCH_MX1ADS" = "y" ]; then
174 define_bool CONFIG_PC_KEYMAP y
176 "$CONFIG_ARCH_TBOX" = "y" -o \
177 "$CONFIG_ARCH_SHARK" = "y" -o \
178 "$CONFIG_ARCH_SA1100" = "y" -o \
179 + "$CONFIG_ARCH_LH79520" = "y" -o \
180 + "$CONFIG_ARCH_LH7A400" = "y" -o \
181 "$CONFIG_PCI" = "y" ]; then
182 mainmenu_option next_comment
184 diff -urN linux-2.4.26/arch/arm/def-configs/lnode80 linux-2.4.26-vrs1-lnode80/arch/arm/def-configs/lnode80
185 --- linux-2.4.26/arch/arm/def-configs/lnode80 1969-12-31 20:00:00.000000000 -0400
186 +++ linux-2.4.26-vrs1-lnode80/arch/arm/def-configs/lnode80 2005-11-03 09:11:23.000000000 -0400
189 +# Automatically generated make config: don't edit
192 +# CONFIG_EISA is not set
193 +# CONFIG_SBUS is not set
194 +# CONFIG_MCA is not set
196 +CONFIG_RWSEM_GENERIC_SPINLOCK=y
197 +# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
198 +# CONFIG_GENERIC_BUST_SPINLOCK is not set
199 +# CONFIG_GENERIC_ISA_DMA is not set
202 +# Code maturity level options
204 +CONFIG_EXPERIMENTAL=y
205 +# CONFIG_OBSOLETE is not set
208 +# Loadable module support
211 +# CONFIG_MODVERSIONS is not set
212 +# CONFIG_KMOD is not set
217 +# CONFIG_ARCH_ANAKIN is not set
218 +# CONFIG_ARCH_ARCA5K is not set
219 +# CONFIG_ARCH_CLPS7500 is not set
220 +# CONFIG_ARCH_CLPS711X is not set
221 +# CONFIG_ARCH_CO285 is not set
222 +# CONFIG_ARCH_EBSA110 is not set
223 +# CONFIG_ARCH_CAMELOT is not set
224 +# CONFIG_ARCH_FOOTBRIDGE is not set
225 +# CONFIG_ARCH_INTEGRATOR is not set
226 +# CONFIG_ARCH_OMAHA is not set
227 +# CONFIG_ARCH_L7200 is not set
228 +# CONFIG_ARCH_MX1ADS is not set
229 +# CONFIG_ARCH_RPC is not set
230 +# CONFIG_ARCH_RISCSTATION is not set
231 +# CONFIG_ARCH_SA1100 is not set
232 +CONFIG_ARCH_LH79520=y
233 +# CONFIG_ARCH_LH7A400 is not set
234 +# CONFIG_ARCH_SHARK is not set
235 +# CONFIG_ARCH_AT91RM9200 is not set
238 +# Archimedes/A5000 Implementations
242 +# Archimedes/A5000 Implementations (select only ONE)
244 +# CONFIG_ARCH_ARC is not set
245 +# CONFIG_ARCH_A5K is not set
248 +# Footbridge Implementations
250 +# CONFIG_ARCH_CATS is not set
251 +# CONFIG_ARCH_PERSONAL_SERVER is not set
252 +# CONFIG_ARCH_EBSA285_ADDIN is not set
253 +# CONFIG_ARCH_EBSA285_HOST is not set
254 +# CONFIG_ARCH_NETWINDER is not set
257 +# SA11x0 Implementations
259 +# CONFIG_SA1100_ACCELENT is not set
260 +# CONFIG_SA1100_ASSABET is not set
261 +# CONFIG_ASSABET_NEPONSET is not set
262 +# CONFIG_SA1100_ADSAGC is not set
263 +# CONFIG_SA1100_ADSBITSY is not set
264 +# CONFIG_SA1100_ADSBITSYPLUS is not set
265 +# CONFIG_SA1100_BRUTUS is not set
266 +# CONFIG_SA1100_CEP is not set
267 +# CONFIG_SA1100_CERF is not set
268 +# CONFIG_SA1100_H3100 is not set
269 +# CONFIG_SA1100_H3600 is not set
270 +# CONFIG_SA1100_H3800 is not set
271 +# CONFIG_SA1100_H3XXX is not set
272 +# CONFIG_H3600_SLEEVE is not set
273 +# CONFIG_SA1100_EXTENEX1 is not set
274 +# CONFIG_SA1100_FLEXANET is not set
275 +# CONFIG_SA1100_FREEBIRD is not set
276 +# CONFIG_SA1100_FRODO is not set
277 +# CONFIG_SA1100_GRAPHICSCLIENT is not set
278 +# CONFIG_SA1100_GRAPHICSMASTER is not set
279 +# CONFIG_SA1100_HACKKIT is not set
280 +# CONFIG_SA1100_BADGE4 is not set
281 +# CONFIG_SA1100_JORNADA720 is not set
282 +# CONFIG_SA1100_HUW_WEBPANEL is not set
283 +# CONFIG_SA1100_ITSY is not set
284 +# CONFIG_SA1100_LART is not set
285 +# CONFIG_SA1100_NANOENGINE is not set
286 +# CONFIG_SA1100_OMNIMETER is not set
287 +# CONFIG_SA1100_PANGOLIN is not set
288 +# CONFIG_SA1100_PLEB is not set
289 +# CONFIG_SA1100_PT_SYSTEM3 is not set
290 +# CONFIG_SA1100_SHANNON is not set
291 +# CONFIG_SA1100_SHERMAN is not set
292 +# CONFIG_SA1100_SIMPAD is not set
293 +# CONFIG_SA1100_SIMPUTER is not set
294 +# CONFIG_SA1100_PFS168 is not set
295 +# CONFIG_SA1100_VICTOR is not set
296 +# CONFIG_SA1100_XP860 is not set
297 +# CONFIG_SA1100_YOPY is not set
298 +# CONFIG_SA1100_USB is not set
299 +# CONFIG_SA1100_USB_NETLINK is not set
300 +# CONFIG_SA1100_USB_CHAR is not set
301 +# CONFIG_SA1100_SSP is not set
304 +# AT91RM9200 Implementations
306 +# CONFIG_ARCH_AT91RM9200DK is not set
307 +# CONFIG_MACH_CSB337 is not set
310 +# CLPS711X/EP721X Implementations
312 +# CONFIG_ARCH_AUTCPU12 is not set
313 +# CONFIG_ARCH_CDB89712 is not set
314 +# CONFIG_ARCH_CLEP7312 is not set
315 +# CONFIG_ARCH_EDB7211 is not set
316 +# CONFIG_ARCH_FORTUNET is not set
317 +# CONFIG_ARCH_GUIDEA07 is not set
318 +# CONFIG_ARCH_P720T is not set
319 +# CONFIG_ARCH_EP7211 is not set
320 +# CONFIG_ARCH_EP7212 is not set
323 +# Sharp LH79520 Implementations
325 +CONFIG_LH79520_EVB=y
326 +# CONFIG_BOGON_EVB is not set
329 +# Sharp LH7A400 Implementations
331 +# CONFIG_LH7A400_EVB is not set
332 +# CONFIG_ARCH_ACORN is not set
333 +# CONFIG_PLD is not set
334 +# CONFIG_FOOTBRIDGE is not set
335 +# CONFIG_FOOTBRIDGE_HOST is not set
336 +# CONFIG_FOOTBRIDGE_ADDIN is not set
342 +# CONFIG_CPU_26 is not set
343 +# CONFIG_CPU_ARM610 is not set
344 +# CONFIG_CPU_ARM710 is not set
345 +CONFIG_CPU_ARM720T=y
346 +# CONFIG_CPU_ARM920T is not set
347 +# CONFIG_CPU_ARM922T is not set
348 +# CONFIG_CPU_ARM926T is not set
349 +# CONFIG_CPU_ARM1020 is not set
350 +# CONFIG_CPU_ARM1020E is not set
351 +# CONFIG_CPU_ARM1022 is not set
352 +# CONFIG_CPU_ARM1026 is not set
353 +# CONFIG_CPU_SA110 is not set
354 +# CONFIG_CPU_SA1100 is not set
355 +# CONFIG_CPU_32v3 is not set
359 +# Processor Features
362 +CONFIG_DISCONTIGMEM=y
367 +# CONFIG_PCI is not set
369 +# CONFIG_ISA_DMA is not set
370 +# CONFIG_ZBOOT_ROM is not set
371 +CONFIG_ZBOOT_ROM_TEXT=0
372 +CONFIG_ZBOOT_ROM_BSS=0
373 +# CONFIG_HOTPLUG is not set
374 +# CONFIG_PCMCIA is not set
377 +# CONFIG_BSD_PROCESS_ACCT is not set
381 +# At least one math emulation must be selected
384 +# CONFIG_FPE_NWFPE_XP is not set
385 +# CONFIG_FPE_FASTFPE is not set
387 +# CONFIG_KCORE_AOUT is not set
388 +CONFIG_BINFMT_AOUT=y
390 +# CONFIG_BINFMT_MISC is not set
391 +# CONFIG_PM is not set
392 +# CONFIG_ARTHUR is not set
394 +CONFIG_ALIGNMENT_TRAP=y
397 +# Parallel port support
399 +# CONFIG_PARPORT is not set
402 +# Memory Technology Devices (MTD)
405 +# CONFIG_MTD_DEBUG is not set
406 +CONFIG_MTD_PARTITIONS=y
407 +# CONFIG_MTD_CONCAT is not set
408 +# CONFIG_MTD_REDBOOT_PARTS is not set
409 +# CONFIG_MTD_CMDLINE_PARTS is not set
410 +# CONFIG_MTD_AFS_PARTS is not set
413 +# User Modules And Translation Layers
417 +# CONFIG_FTL is not set
418 +# CONFIG_NFTL is not set
421 +# RAM/ROM/Flash chip drivers
424 +CONFIG_MTD_JEDECPROBE=y
425 +CONFIG_MTD_GEN_PROBE=y
426 +CONFIG_MTD_CFI_ADV_OPTIONS=y
427 +CONFIG_MTD_CFI_NOSWAP=y
428 +# CONFIG_MTD_CFI_BE_BYTE_SWAP is not set
429 +# CONFIG_MTD_CFI_LE_BYTE_SWAP is not set
430 +# CONFIG_MTD_CFI_GEOMETRY is not set
431 +CONFIG_MTD_CFI_INTELEXT=y
432 +# CONFIG_MTD_CFI_AMDSTD is not set
433 +# CONFIG_MTD_CFI_STAA is not set
434 +# CONFIG_MTD_RAM is not set
435 +# CONFIG_MTD_ROM is not set
436 +# CONFIG_MTD_ABSENT is not set
437 +# CONFIG_MTD_OBSOLETE_CHIPS is not set
438 +# CONFIG_MTD_AMDSTD is not set
439 +# CONFIG_MTD_SHARP is not set
440 +# CONFIG_MTD_JEDEC is not set
443 +# Mapping drivers for chip access
445 +CONFIG_MTD_PHYSMAP=y
446 +CONFIG_MTD_PHYSMAP_START=40400000
447 +CONFIG_MTD_PHYSMAP_LEN=400000
448 +CONFIG_MTD_PHYSMAP_BUSWIDTH=2
449 +# CONFIG_MTD_NORA is not set
450 +# CONFIG_MTD_ARM_INTEGRATOR is not set
451 +# CONFIG_MTD_CDB89712 is not set
452 +# CONFIG_MTD_SA1100 is not set
453 +# CONFIG_MTD_DC21285 is not set
454 +# CONFIG_MTD_IQ80310 is not set
455 +# CONFIG_MTD_FORTUNET is not set
456 +# CONFIG_MTD_EPXA is not set
457 +# CONFIG_MTD_AUTCPU12 is not set
458 +# CONFIG_MTD_EDB7312 is not set
459 +# CONFIG_MTD_IMPA7 is not set
460 +# CONFIG_MTD_CEIVA is not set
461 +# CONFIG_MTD_PCI is not set
462 +# CONFIG_MTD_PCMCIA is not set
465 +# Self-contained MTD device drivers
467 +# CONFIG_MTD_PMC551 is not set
468 +# CONFIG_MTD_SLRAM is not set
469 +# CONFIG_MTD_MTDRAM is not set
470 +# CONFIG_MTD_BLKMTD is not set
473 +# Disk-On-Chip Device Drivers
475 +# CONFIG_MTD_DOC1000 is not set
476 +# CONFIG_MTD_DOC2000 is not set
477 +# CONFIG_MTD_DOC2001 is not set
478 +# CONFIG_MTD_DOCPROBE is not set
481 +# NAND Flash Device Drivers
483 +# CONFIG_MTD_NAND is not set
486 +# Plug and Play configuration
488 +# CONFIG_PNP is not set
489 +# CONFIG_ISAPNP is not set
494 +# CONFIG_BLK_DEV_FD is not set
495 +# CONFIG_BLK_DEV_XD is not set
496 +# CONFIG_PARIDE is not set
497 +# CONFIG_BLK_CPQ_DA is not set
498 +# CONFIG_BLK_CPQ_CISS_DA is not set
499 +# CONFIG_CISS_SCSI_TAPE is not set
500 +# CONFIG_CISS_MONITOR_THREAD is not set
501 +# CONFIG_BLK_DEV_DAC960 is not set
502 +# CONFIG_BLK_DEV_UMEM is not set
503 +# CONFIG_BLK_DEV_LOOP is not set
504 +# CONFIG_BLK_DEV_NBD is not set
505 +CONFIG_BLK_DEV_RAM=y
506 +CONFIG_BLK_DEV_RAM_SIZE=8192
507 +CONFIG_BLK_DEV_INITRD=y
508 +# CONFIG_BLK_STATS is not set
511 +# Multi-device support (RAID and LVM)
513 +# CONFIG_MD is not set
514 +# CONFIG_BLK_DEV_MD is not set
515 +# CONFIG_MD_LINEAR is not set
516 +# CONFIG_MD_RAID0 is not set
517 +# CONFIG_MD_RAID1 is not set
518 +# CONFIG_MD_RAID5 is not set
519 +# CONFIG_MD_MULTIPATH is not set
520 +# CONFIG_BLK_DEV_LVM is not set
523 +# Networking options
526 +# CONFIG_PACKET_MMAP is not set
527 +# CONFIG_NETLINK_DEV is not set
528 +# CONFIG_NETFILTER is not set
529 +# CONFIG_FILTER is not set
532 +# CONFIG_IP_MULTICAST is not set
533 +# CONFIG_IP_ADVANCED_ROUTER is not set
534 +# CONFIG_IP_PNP is not set
535 +# CONFIG_NET_IPIP is not set
536 +# CONFIG_NET_IPGRE is not set
537 +# CONFIG_ARPD is not set
538 +# CONFIG_INET_ECN is not set
539 +# CONFIG_SYN_COOKIES is not set
540 +# CONFIG_IPV6 is not set
541 +# CONFIG_KHTTPD is not set
544 +# SCTP Configuration (EXPERIMENTAL)
546 +# CONFIG_IP_SCTP is not set
547 +# CONFIG_ATM is not set
548 +# CONFIG_VLAN_8021Q is not set
553 +# CONFIG_IPX is not set
554 +# CONFIG_ATALK is not set
559 +# CONFIG_DEV_APPLETALK is not set
560 +# CONFIG_DECNET is not set
561 +# CONFIG_BRIDGE is not set
562 +# CONFIG_X25 is not set
563 +# CONFIG_LAPB is not set
564 +# CONFIG_LLC is not set
565 +# CONFIG_NET_DIVERT is not set
566 +# CONFIG_ECONET is not set
567 +# CONFIG_WAN_ROUTER is not set
568 +# CONFIG_NET_FASTROUTE is not set
569 +# CONFIG_NET_HW_FLOWCONTROL is not set
572 +# QoS and/or fair queueing
574 +# CONFIG_NET_SCHED is not set
579 +# CONFIG_NET_PKTGEN is not set
582 +# Network device support
584 +# CONFIG_NETDEVICES is not set
587 +# Amateur Radio support
589 +# CONFIG_HAMRADIO is not set
592 +# IrDA (infrared) support
594 +# CONFIG_IRDA is not set
597 +# ATA/ATAPI/MFM/RLL support
599 +# CONFIG_IDE is not set
600 +# CONFIG_BLK_DEV_HD is not set
605 +# CONFIG_SCSI is not set
608 +# I2O device support
610 +# CONFIG_I2O is not set
611 +# CONFIG_I2O_BLOCK is not set
612 +# CONFIG_I2O_LAN is not set
613 +# CONFIG_I2O_SCSI is not set
614 +# CONFIG_I2O_PROC is not set
619 +# CONFIG_ISDN is not set
622 +# Input core support
624 +# CONFIG_INPUT is not set
625 +# CONFIG_INPUT_KEYBDEV is not set
626 +# CONFIG_INPUT_MOUSEDEV is not set
627 +# CONFIG_INPUT_JOYDEV is not set
628 +# CONFIG_INPUT_EVDEV is not set
629 +# CONFIG_INPUT_UINPUT is not set
630 +# CONFIG_INPUT_MX1TS is not set
637 +# CONFIG_SERIAL is not set
638 +# CONFIG_SERIAL_EXTENDED is not set
639 +# CONFIG_SERIAL_NONSTANDARD is not set
644 +# CONFIG_SERIAL_ANAKIN is not set
645 +# CONFIG_SERIAL_ANAKIN_CONSOLE is not set
646 +# CONFIG_SERIAL_AMBA is not set
647 +# CONFIG_SERIAL_AMBA_CONSOLE is not set
648 +CONFIG_SERIAL_AMBA_PL011=y
649 +CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
650 +# CONFIG_SERIAL_LH7A400 is not set
651 +# CONFIG_SERIAL_CLPS711X is not set
652 +# CONFIG_SERIAL_CLPS711X_CONSOLE is not set
653 +# CONFIG_SERIAL_21285 is not set
654 +# CONFIG_SERIAL_21285_OLD is not set
655 +# CONFIG_SERIAL_21285_CONSOLE is not set
656 +# CONFIG_SERIAL_UART00 is not set
657 +# CONFIG_SERIAL_UART00_CONSOLE is not set
658 +# CONFIG_SERIAL_SA1100 is not set
659 +# CONFIG_SERIAL_SA1100_CONSOLE is not set
660 +# CONFIG_SERIAL_OMAHA is not set
661 +# CONFIG_SERIAL_OMAHA_CONSOLE is not set
662 +# CONFIG_SERIAL_AT91 is not set
663 +# CONFIG_SERIAL_AT91_CONSOLE is not set
664 +# CONFIG_SERIAL_8250 is not set
665 +# CONFIG_SERIAL_8250_CONSOLE is not set
666 +# CONFIG_SERIAL_8250_EXTENDED is not set
667 +# CONFIG_SERIAL_8250_MANY_PORTS is not set
668 +# CONFIG_SERIAL_8250_SHARE_IRQ is not set
669 +# CONFIG_SERIAL_8250_DETECT_IRQ is not set
670 +# CONFIG_SERIAL_8250_MULTIPORT is not set
671 +# CONFIG_SERIAL_8250_HUB6 is not set
672 +CONFIG_SERIAL_CORE=y
673 +CONFIG_SERIAL_CORE_CONSOLE=y
674 +CONFIG_UNIX98_PTYS=y
675 +CONFIG_UNIX98_PTY_COUNT=256
680 +# CONFIG_I2C is not set
683 +# L3 serial bus support
685 +# CONFIG_L3 is not set
686 +# CONFIG_L3_ALGOBIT is not set
687 +# CONFIG_L3_BIT_SA1100_GPIO is not set
692 +# CONFIG_L3_SA1111 is not set
693 +# CONFIG_BIT_SA1100_GPIO is not set
698 +# CONFIG_BUSMOUSE is not set
701 +# CONFIG_82C710_MOUSE is not set
702 +# CONFIG_PC110_PAD is not set
703 +# CONFIG_MK712_MOUSE is not set
708 +# CONFIG_INPUT_GAMEPORT is not set
711 +# Input core support is needed for gameports
715 +# Input core support is needed for joysticks
717 +# CONFIG_QIC02_TAPE is not set
718 +# CONFIG_IPMI_HANDLER is not set
719 +# CONFIG_IPMI_PANIC_EVENT is not set
720 +# CONFIG_IPMI_DEVICE_INTERFACE is not set
721 +# CONFIG_IPMI_KCS is not set
722 +# CONFIG_IPMI_WATCHDOG is not set
728 +# CONFIG_WATCHDOG_NOWAYOUT is not set
729 +# CONFIG_ACQUIRE_WDT is not set
730 +# CONFIG_ADVANTECH_WDT is not set
731 +# CONFIG_ALIM1535_WDT is not set
732 +# CONFIG_ALIM7101_WDT is not set
733 +# CONFIG_SC520_WDT is not set
734 +# CONFIG_PCWATCHDOG is not set
735 +# CONFIG_21285_WATCHDOG is not set
736 +# CONFIG_977_WATCHDOG is not set
737 +# CONFIG_SA1100_WATCHDOG is not set
738 +# CONFIG_LH79520_WATCHDOG is not set
739 +# CONFIG_EPXA_WATCHDOG is not set
740 +# CONFIG_OMAHA_WATCHDOG is not set
741 +# CONFIG_AT91_WATCHDOG is not set
742 +# CONFIG_EUROTECH_WDT is not set
743 +# CONFIG_IB700_WDT is not set
744 +# CONFIG_WAFER_WDT is not set
745 +# CONFIG_I810_TCO is not set
746 +# CONFIG_MIXCOMWD is not set
747 +# CONFIG_60XX_WDT is not set
748 +# CONFIG_SC1200_WDT is not set
749 +# CONFIG_SCx200_WDT is not set
750 +# CONFIG_SOFT_WATCHDOG is not set
751 +# CONFIG_W83877F_WDT is not set
752 +# CONFIG_WDT is not set
753 +# CONFIG_WDTPCI is not set
754 +# CONFIG_MACHZ_WDT is not set
755 +# CONFIG_AMD7XX_TCO is not set
756 +# CONFIG_SCx200 is not set
757 +# CONFIG_SCx200_GPIO is not set
758 +# CONFIG_LH79520_PWM is not set
759 +# CONFIG_AMD_PM768 is not set
760 +# CONFIG_NVRAM is not set
761 +# CONFIG_RTC is not set
762 +# CONFIG_DTLK is not set
763 +# CONFIG_R3964 is not set
764 +# CONFIG_APPLICOM is not set
767 +# Ftape, the floppy tape device driver
769 +# CONFIG_FTAPE is not set
770 +# CONFIG_AGP is not set
773 +# Direct Rendering Manager (XFree86 DRI support)
775 +# CONFIG_DRM is not set
778 +# Multimedia devices
780 +# CONFIG_VIDEO_DEV is not set
785 +# CONFIG_QUOTA is not set
786 +# CONFIG_QFMT_V2 is not set
787 +# CONFIG_AUTOFS_FS is not set
788 +# CONFIG_AUTOFS4_FS is not set
789 +# CONFIG_REISERFS_FS is not set
790 +# CONFIG_REISERFS_CHECK is not set
791 +# CONFIG_REISERFS_PROC_INFO is not set
792 +# CONFIG_ADFS_FS is not set
793 +# CONFIG_ADFS_FS_RW is not set
794 +# CONFIG_AFFS_FS is not set
795 +# CONFIG_HFS_FS is not set
796 +# CONFIG_HFSPLUS_FS is not set
797 +# CONFIG_BEFS_FS is not set
798 +# CONFIG_BEFS_DEBUG is not set
799 +# CONFIG_BFS_FS is not set
800 +# CONFIG_EXT3_FS is not set
801 +# CONFIG_JBD is not set
802 +# CONFIG_JBD_DEBUG is not set
804 +# CONFIG_MSDOS_FS is not set
805 +# CONFIG_UMSDOS_FS is not set
807 +# CONFIG_EFS_FS is not set
808 +# CONFIG_JFFS_FS is not set
810 +CONFIG_JFFS2_FS_DEBUG=0
811 +# CONFIG_CRAMFS is not set
812 +# CONFIG_TMPFS is not set
814 +# CONFIG_ISO9660_FS is not set
815 +# CONFIG_JOLIET is not set
816 +# CONFIG_ZISOFS is not set
817 +# CONFIG_JFS_FS is not set
818 +# CONFIG_JFS_DEBUG is not set
819 +# CONFIG_JFS_STATISTICS is not set
821 +# CONFIG_VXFS_FS is not set
822 +# CONFIG_NTFS_FS is not set
823 +# CONFIG_NTFS_RW is not set
824 +# CONFIG_HPFS_FS is not set
826 +# CONFIG_DEVFS_FS is not set
827 +# CONFIG_DEVFS_MOUNT is not set
828 +# CONFIG_DEVFS_DEBUG is not set
830 +# CONFIG_QNX4FS_FS is not set
831 +# CONFIG_QNX4FS_RW is not set
832 +# CONFIG_ROMFS_FS is not set
834 +# CONFIG_SYSV_FS is not set
835 +# CONFIG_UDF_FS is not set
836 +# CONFIG_UDF_RW is not set
837 +# CONFIG_UFS_FS is not set
838 +# CONFIG_UFS_FS_WRITE is not set
839 +# CONFIG_XFS_FS is not set
840 +# CONFIG_XFS_QUOTA is not set
841 +# CONFIG_XFS_RT is not set
842 +# CONFIG_XFS_TRACE is not set
843 +# CONFIG_XFS_DEBUG is not set
846 +# Network File Systems
848 +# CONFIG_CODA_FS is not set
849 +# CONFIG_INTERMEZZO_FS is not set
850 +# CONFIG_NFS_FS is not set
851 +# CONFIG_NFS_V3 is not set
852 +# CONFIG_NFS_DIRECTIO is not set
853 +# CONFIG_ROOT_NFS is not set
854 +# CONFIG_NFSD is not set
855 +# CONFIG_NFSD_V3 is not set
856 +# CONFIG_NFSD_TCP is not set
857 +# CONFIG_SUNRPC is not set
858 +# CONFIG_LOCKD is not set
859 +# CONFIG_SMB_FS is not set
860 +# CONFIG_NCP_FS is not set
861 +# CONFIG_NCPFS_PACKET_SIGNING is not set
862 +# CONFIG_NCPFS_IOCTL_LOCKING is not set
863 +# CONFIG_NCPFS_STRONG is not set
864 +# CONFIG_NCPFS_NFS_NS is not set
865 +# CONFIG_NCPFS_OS2_NS is not set
866 +# CONFIG_NCPFS_SMALLDOS is not set
867 +# CONFIG_NCPFS_NLS is not set
868 +# CONFIG_NCPFS_EXTRAS is not set
869 +# CONFIG_ZISOFS_FS is not set
874 +# CONFIG_PARTITION_ADVANCED is not set
875 +CONFIG_MSDOS_PARTITION=y
876 +# CONFIG_SMB_NLS is not set
880 +# Native Language Support
882 +CONFIG_NLS_DEFAULT="iso8859-1"
883 +# CONFIG_NLS_CODEPAGE_437 is not set
884 +# CONFIG_NLS_CODEPAGE_737 is not set
885 +# CONFIG_NLS_CODEPAGE_775 is not set
886 +# CONFIG_NLS_CODEPAGE_850 is not set
887 +# CONFIG_NLS_CODEPAGE_852 is not set
888 +# CONFIG_NLS_CODEPAGE_855 is not set
889 +# CONFIG_NLS_CODEPAGE_857 is not set
890 +# CONFIG_NLS_CODEPAGE_860 is not set
891 +# CONFIG_NLS_CODEPAGE_861 is not set
892 +# CONFIG_NLS_CODEPAGE_862 is not set
893 +# CONFIG_NLS_CODEPAGE_863 is not set
894 +# CONFIG_NLS_CODEPAGE_864 is not set
895 +# CONFIG_NLS_CODEPAGE_865 is not set
896 +# CONFIG_NLS_CODEPAGE_866 is not set
897 +# CONFIG_NLS_CODEPAGE_869 is not set
898 +# CONFIG_NLS_CODEPAGE_936 is not set
899 +# CONFIG_NLS_CODEPAGE_950 is not set
900 +# CONFIG_NLS_CODEPAGE_932 is not set
901 +# CONFIG_NLS_CODEPAGE_949 is not set
902 +# CONFIG_NLS_CODEPAGE_874 is not set
903 +# CONFIG_NLS_ISO8859_8 is not set
904 +# CONFIG_NLS_CODEPAGE_1250 is not set
905 +# CONFIG_NLS_CODEPAGE_1251 is not set
906 +# CONFIG_NLS_ISO8859_1 is not set
907 +# CONFIG_NLS_ISO8859_2 is not set
908 +# CONFIG_NLS_ISO8859_3 is not set
909 +# CONFIG_NLS_ISO8859_4 is not set
910 +# CONFIG_NLS_ISO8859_5 is not set
911 +# CONFIG_NLS_ISO8859_6 is not set
912 +# CONFIG_NLS_ISO8859_7 is not set
913 +# CONFIG_NLS_ISO8859_9 is not set
914 +# CONFIG_NLS_ISO8859_13 is not set
915 +# CONFIG_NLS_ISO8859_14 is not set
916 +# CONFIG_NLS_ISO8859_15 is not set
917 +# CONFIG_NLS_KOI8_R is not set
918 +# CONFIG_NLS_KOI8_U is not set
919 +# CONFIG_NLS_UTF8 is not set
925 +# CONFIG_VGA_CONSOLE is not set
928 +# Frame-buffer support
930 +# CONFIG_FB is not set
935 +# CONFIG_SOUND is not set
938 +# Multimedia Capabilities Port drivers
940 +# CONFIG_MCP is not set
941 +# CONFIG_MCP_SA1100 is not set
942 +# CONFIG_MCP_UCB1200 is not set
943 +# CONFIG_MCP_UCB1200_AUDIO is not set
944 +# CONFIG_MCP_UCB1200_TS is not set
949 +# CONFIG_TOUCHSCREEN_LH79520 is not set
950 +# CONFIG_EEPROM_LH79520 is not set
951 +# CONFIG_7SEGMENT_LH79520 is not set
956 +# CONFIG_USB is not set
959 +# Support for USB gadgets
961 +# CONFIG_USB_GADGET is not set
966 +# CONFIG_BLUEZ is not set
971 +CONFIG_FRAME_POINTER=y
974 +# CONFIG_NO_PGT_CACHE is not set
975 +CONFIG_DEBUG_KERNEL=y
976 +# CONFIG_DEBUG_SLAB is not set
977 +# CONFIG_MAGIC_SYSRQ is not set
978 +# CONFIG_DEBUG_SPINLOCK is not set
979 +# CONFIG_DEBUG_WAITQ is not set
980 +CONFIG_DEBUG_BUGVERBOSE=y
981 +CONFIG_DEBUG_ERRORS=y
983 +# CONFIG_DEBUG_DC21285_PORT is not set
984 +# CONFIG_DEBUG_CLPS711X_UART2 is not set
989 +# CONFIG_CRC32 is not set
990 +CONFIG_ZLIB_INFLATE=y
991 +CONFIG_ZLIB_DEFLATE=y
992 diff -urN linux-2.4.26/arch/arm/kernel/debug-armv.S linux-2.4.26-vrs1-lnode80/arch/arm/kernel/debug-armv.S
993 --- linux-2.4.26/arch/arm/kernel/debug-armv.S 2003-08-25 07:44:39.000000000 -0400
994 +++ linux-2.4.26-vrs1-lnode80/arch/arm/kernel/debug-armv.S 2005-11-02 17:37:31.000000000 -0400
999 +#elif defined(CONFIG_ARCH_LH79520)
1001 + .macro addruart,rx
1002 + ldr \rx, =0xfffc1000 @UART1 base
1005 + .macro senduart,rd,rx
1006 + strb \rd, [\rx] @ UART1_DR
1009 + .macro busyuart,rd,rx @ spin while busy
1010 +1001: ldr \rd, [\rx, #0x18] @ UART1_FR
1011 + tst \rd, #1 << 3 @ BUSY ?
1012 + bne 1001b @ yes, spin
1015 + .macro waituart,rd,rx @ wait for Tx FIFO room
1016 +1001: ldrb \rd, [\rx, #0x18] @ UART1_FR
1017 + tst \rd, #1 << 5 @ TXFF full?
1018 + bne 1001b @ yes, spin
1021 +#elif defined(CONFIG_ARCH_LH7A400)
1023 + .macro addruart,rx
1024 + mrc p15, 0, \rx, c1, c0
1025 + tst \rx, #1 @ MMU enabled?
1026 + ldr \rx, =UART2_PHYS @ physical base address
1027 + orrne \rx, \rx, #0xf8000000 @ virtual base
1030 + .macro senduart,rd,rx
1031 + strb \rd, [\rx] @ UART3_DR
1034 + .macro busyuart,rd,rx @ spin while busy
1035 +1001: ldr \rd, [\rx, #0x10] @ UART3_FR
1036 + tst \rd, #1 << 3 @ BUSY ?
1037 + bne 1001b @ yes, spin
1040 + .macro waituart,rd,rx @ wait for Tx FIFO room
1041 +1001: ldrb \rd, [\rx, #0x10] @ UART3_FR
1042 + tst \rd, #1 << 5 @ TXFF full?
1043 + bne 1001b @ yes, spin
1047 #error Unknown architecture
1049 diff -urN linux-2.4.26/arch/arm/kernel/entry-armv.S linux-2.4.26-vrs1-lnode80/arch/arm/kernel/entry-armv.S
1050 --- linux-2.4.26/arch/arm/kernel/entry-armv.S 2005-11-02 16:54:17.000000000 -0400
1051 +++ linux-2.4.26-vrs1-lnode80/arch/arm/kernel/entry-armv.S 2005-11-02 17:37:31.000000000 -0400
1052 @@ -615,6 +615,49 @@
1056 +#elif defined(CONFIG_ARCH_LH79520)
1057 +#include <asm/arch/hardware.h>
1059 + .macro disable_fiq
1062 + .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
1063 + ldr \irqstat, =VIC_BASE @ Virt addr IRQ regs
1064 + ldr \irqstat, [\irqstat, #0] @ get masked interrupt status
1066 +1001: tst \irqstat, #1
1067 + addeq \irqnr, \irqnr, #1
1068 + moveq \irqstat, \irqstat, lsr #1
1074 + .macro irq_prio_table
1077 +#elif defined(CONFIG_ARCH_LH7A400)
1078 +#include <asm/arch/hardware.h>
1080 + .macro disable_fiq
1083 + .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
1084 + ldr \irqstat, =IO_ADDRESS(INTC_PHYS) @ Virt addr IRQ regs
1085 + ldr \irqstat, [\irqstat, #0] @ get masked interrupt status
1087 +1001: tst \irqstat, #1
1089 + add \irqnr, \irqnr, #1
1090 + mov \irqstat, \irqstat, lsr #1
1093 +1002: /* EQ will be set if we reach 28 */
1096 + .macro irq_prio_table
1100 #error Unknown architecture
1102 diff -urN linux-2.4.26/arch/arm/kernel/irq.c linux-2.4.26-vrs1-lnode80/arch/arm/kernel/irq.c
1103 --- linux-2.4.26/arch/arm/kernel/irq.c 2005-11-02 16:54:17.000000000 -0400
1104 +++ linux-2.4.26-vrs1-lnode80/arch/arm/kernel/irq.c 2005-11-02 17:37:31.000000000 -0400
1105 @@ -216,6 +216,18 @@
1107 desc->triggered = 1;
1109 +#ifdef CONFIG_ARCH_LH79520
1110 + if( irq < 8) { /* external interrupt */
1111 + vicRegs_t *vic = (vicRegs_t *)VIC_BASE;
1112 + rcpcRegs_t *rcpc = (rcpcRegs_t *)IO_ADDRESS( RCPC_PHYS);
1114 + rcpc->control |= RCPC_CTRL_WRTLOCK_ENABLED; /* unlock RCPC registers */
1116 + rcpc->intClear = (1 << irq); /* clear corresponding IRQ */
1117 + rcpc->control &= ~RCPC_CTRL_WRTLOCK_ENABLED; /* lock RCPC registers */
1122 * Acknowledge and clear the IRQ, but (if its
1123 * a level-based IRQ, don't mask it)
1124 diff -urN linux-2.4.26/arch/arm/kernel/ptrace.c linux-2.4.26-vrs1-lnode80/arch/arm/kernel/ptrace.c
1125 --- linux-2.4.26/arch/arm/kernel/ptrace.c 2005-11-02 16:54:17.000000000 -0400
1126 +++ linux-2.4.26-vrs1-lnode80/arch/arm/kernel/ptrace.c 2005-11-02 17:37:31.000000000 -0400
1129 case PTRACE_POKETEXT:
1130 case PTRACE_POKEDATA:
1131 + if(data == 0xe7ffdefe)
1132 + data = 0xef9f0001;
1134 ret = access_process_vm(child, addr, &data,
1135 sizeof(unsigned long), 1);
1136 if (ret == sizeof(unsigned long))
1137 diff -urN linux-2.4.26/arch/arm/mach-lh79520/arch.c linux-2.4.26-vrs1-lnode80/arch/arm/mach-lh79520/arch.c
1138 --- linux-2.4.26/arch/arm/mach-lh79520/arch.c 1969-12-31 20:00:00.000000000 -0400
1139 +++ linux-2.4.26-vrs1-lnode80/arch/arm/mach-lh79520/arch.c 2005-11-03 10:30:56.000000000 -0400
1142 + * linux/arch/arm/mach-lh79520/arch.c
1144 + * Architecture specific fixups.
1146 + * Copyright (C) 2001 Lineo, Inc
1148 + * This program is free software; you can redistribute it and/or modify
1149 + * it under the terms of the GNU General Public License as published by
1150 + * the Free Software Foundation; either version 2 of the License, or
1151 + * (at your option) any later version.
1153 + * This program is distributed in the hope that it will be useful,
1154 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1155 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1156 + * GNU General Public License for more details.
1158 + * You should have received a copy of the GNU General Public License
1159 + * along with this program; if not, write to the Free Software
1160 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1162 +#include <linux/config.h>
1163 +#include <linux/types.h>
1164 +#include <linux/sched.h>
1165 +#include <linux/interrupt.h>
1166 +#include <linux/init.h>
1168 +#include <asm/hardware.h>
1169 +#include <asm/irq.h>
1170 +#include <asm/setup.h>
1171 +#include <asm/mach-types.h>
1173 +#include <asm/mach/arch.h>
1175 +extern void genarch_init_irq( void);
1176 +extern void lh79520_map_io( void);
1178 +#ifdef CONFIG_ARCH_LH79520
1181 +fixup_lh79520(struct machine_desc *desc, struct param_struct *unused,
1182 + char **cmdline, struct meminfo *mi)
1185 + mi->bank[0].start = PHYS_OFFSET;
1186 + mi->bank[0].size = (32*1024*1024);
1187 + mi->bank[0].node = 0;
1189 + ROOT_DEV = MKDEV(RAMDISK_MAJOR,0);
1190 + setup_ramdisk( 1, 0, 0, CONFIG_BLK_DEV_RAM_SIZE);
1191 + setup_initrd( __phys_to_virt(0x20400000), 3 * 1024 * 1024);
1193 + /* Serial Console on UART 1 */
1194 + strcpy( *cmdline, "console=ttyAM1,115200");
1198 +MACHINE_START(LH79520EVB, "Sharp LH79520 Evaluation Board")
1199 + MAINTAINER("Duck")
1200 + BOOT_MEM( 0x20000000, 0xff800000, 0xff800000) // pio, vio must be 8MB
1201 + FIXUP( fixup_lh79520)
1202 + MAPIO( lh79520_map_io)
1203 + INITIRQ( genarch_init_irq)
1206 diff -urN linux-2.4.26/arch/arm/mach-lh79520/dma.c linux-2.4.26-vrs1-lnode80/arch/arm/mach-lh79520/dma.c
1207 --- linux-2.4.26/arch/arm/mach-lh79520/dma.c 1969-12-31 20:00:00.000000000 -0400
1208 +++ linux-2.4.26-vrs1-lnode80/arch/arm/mach-lh79520/dma.c 2005-11-02 17:38:44.000000000 -0400
1211 + * arch/arm/mach-lh79520/dma-lh79520.c
1212 + * Copyright (C) 2002 Embedix, Inc.
1214 + * Support functions for the Sharp LH79520 internal DMA channels.
1216 + * Based on arch/arm/mach-sa1100/dma-sa1100.c, which is
1217 + * Copyright (C) 2000 Nicolas Pitre
1219 + * This program is free software; you can redistribute it and/or modify
1220 + * it under the terms of the GNU General Public License version 2 as
1221 + * published by the Free Software Foundation.
1225 +#include <linux/module.h>
1226 +#include <linux/init.h>
1227 +#include <linux/sched.h>
1228 +#include <linux/spinlock.h>
1229 +#include <linux/slab.h>
1230 +#include <linux/errno.h>
1232 +#include <asm/system.h>
1233 +#include <asm/irq.h>
1234 +#include <asm/hardware.h>
1235 +#include <asm/io.h>
1236 +#include <asm/dma.h>
1237 +#include <asm/mach/dma.h>
1238 +#include <asm/arch/iocon.h>
1244 +#define DPRINTK( s, arg... ) printk( "dma<%s>: " s, dma->device_id , ##arg )
1245 +#define DUMPREGS(r,d) \
1246 + printk( "regs=0x%x src=0x%x:%x dest=0x%x:%x count=%d control=0x%x tcnt=%d mask=0x%x status=0x%x\n", \
1247 + (u32)r, r->srcHi, r->srcLow, r->destHi, r->destLow, r->count, r->control, r->termCnt, d->mask, d->status)
1248 +#define DUMPQ(d) dumpq(d)
1250 +#define DPRINTK( x... )
1251 +#define DUMPREGS(r,d)
1256 + * DMA channel registers structure
1259 + volatile u32 srcLow; /* Source base addr, low 16 bits */
1260 + volatile u32 srcHi; /* Source base addr, hi 16 bits */
1261 + volatile u32 destLow; /* Dest base addr, low 16 bits */
1262 + volatile u32 destHi; /* Dest base addr, hi 16 bits */
1263 + volatile u32 count; /* Maximum Count */
1264 + volatile u32 control; /* Control */
1265 + volatile u32 currSrcHi; /* Current src addr, hi 16 bits*/
1266 + volatile u32 currSrcLow; /* Current src addr, low 16 bits*/
1267 + volatile u32 currDstHi; /* Curr dest addr, hi 16 bits*/
1268 + volatile u32 currDstLow; /* Curr src addr, low 16 bits*/
1269 + volatile u32 termCnt; /* Terminal Count */
1274 + * Control Register Bit Field
1276 +#define DMAC_CTRL_ENABLE _BIT(0) /* Enable DMA */
1277 +#define DMAC_CTRL_SOINC _BIT(1) /* Source Reg inc.bit */
1278 +#define DMAC_CTRL_DEINC _BIT(2) /* Dest Reg inc.bit */
1280 +#define DMAC_CTRL_SOSIZE_1BYTE _SBF(3,0)
1281 +#define DMAC_CTRL_SOSIZE_2BYTE _SBF(3,1)
1282 +#define DMAC_CTRL_SOSIZE_4BYTE _SBF(3,2)
1283 +/* Destination Size */
1284 +#define DMAC_CTRL_DESIZE_1BYTE _SBF(7,0)
1285 +#define DMAC_CTRL_DESIZE_2BYTE _SBF(7,1)
1286 +#define DMAC_CTRL_DESIZE_4BYTE _SBF(7,2)
1287 +/* Peripheral Burst Sizes */
1288 +#define DMAC_CTRL_SOBURST_SINGLE _SBF(5,0) /* Single */
1289 +#define DMAC_CTRL_SOBURST_4INC _SBF(5,1) /* 4 incrementing */
1290 +#define DMAC_CTRL_SOBURST_8INC _SBF(5,2) /* 8 incrementing */
1291 +#define DMAC_CTRL_SOBURST_16INC _SBF(5,3) /* 16 incrementing */
1292 +/* Address Modes */
1293 +#define DMAC_CTRL_ADDR_MODE_WRAP _SBF(9,0)
1294 +#define DMAC_CTRL_ADDR_MODE_INCR _SBF(9,1)
1296 +#define DMAC_CTRL_MEM2MEM _BIT(11) /* Memory to Memory */
1298 +#define DMAC_CTRL_PERIPH_SOURCE _SBF(13,0)
1299 +#define DMAC_CTRL_PERIPH_DEST _SBF(13,1)
1303 + channelRegs_t stream0; /* Data Stream 0 */
1304 + volatile u32 reserved0[5];
1305 + channelRegs_t stream1; /* Data Stream 1 */
1306 + volatile u32 reserved1[5];
1307 + channelRegs_t stream2; /* Data Stream 2 */
1308 + volatile u32 reserved2[5];
1309 + channelRegs_t stream3; /* Data Stream 3 */
1310 + volatile u32 reserved3;
1311 + volatile u32 mask;
1312 + volatile u32 clear;
1313 + volatile u32 status;
1314 + volatile u32 reserved4;
1317 +channelRegs_t *streamRegs[] = {
1318 + &((dmaRegs_t *)IO_ADDRESS(DMAC_PHYS))->stream0,
1319 + &((dmaRegs_t *)IO_ADDRESS(DMAC_PHYS))->stream1,
1320 + &((dmaRegs_t *)IO_ADDRESS(DMAC_PHYS))->stream2,
1321 + &((dmaRegs_t *)IO_ADDRESS(DMAC_PHYS))->stream3
1325 + * mask - Mask Register Bit Fields
1326 + * clear - Clear Register Bit Fields
1327 + * status - Clear Register Bit Fields
1329 + * Writing DMAC_xN to mask register enables corresponding interrupt
1330 + * Writing DMAC_xN to clear register disables corresponding interrupt
1331 + * AND'ing DMAC_xN with status register yields status
1332 + * Note: "ACTIVEx" constants are only applicable to Status Register
1334 +#define DMAC_INT0 _BIT(0) /* Stream 0 Interrupt */
1335 +#define DMAC_INT1 _BIT(1) /* Stream 1 Interrupt */
1336 +#define DMAC_INT2 _BIT(2) /* Stream 2 Interrupt */
1337 +#define DMAC_INT3 _BIT(3) /* Stream 3 Interrupt */
1338 +#define DMAC_ERRINT0 _BIT(4) /* Stream 0 Error Interrupt */
1339 +#define DMAC_ERRINT1 _BIT(5) /* Stream 1 Error Interrupt */
1340 +#define DMAC_ERRINT2 _BIT(6) /* Stream 2 Error Interrupt */
1341 +#define DMAC_ERRINT3 _BIT(7) /* Stream 3 Error Interrupt */
1342 +#define DMAC_ACTIVE0 _BIT(8) /* Stream 0 Active */
1343 +#define DMAC_ACTIVE1 _BIT(9) /* Stream 1 Active */
1344 +#define DMAC_ACTIVE2 _BIT(10) /* Stream 2 Active */
1345 +#define DMAC_ACTIVE3 _BIT(11) /* Stream 3 Active */
1347 +/* all DMA error bits */
1348 +#define DMAC_ERROR (DMAC_ERRINT0 | DMAC_ERRINT1 | DMAC_ERRINT2 | DMAC_ERRINT3 )
1350 +/* all DMA done bits */
1351 +#define DMAC_DONE (DMAC_INT0 | DMAC_INT1 | DMAC_INT2 | DMAC_INT3)
1353 +/* all the bits in the clear register */
1354 +#define DMAC_CLEAR_ALL (DMAC_DONE | DMAC_ERROR)
1359 +lh79520_dma_t dma_chan[LH79520_DMA_CHANNELS];
1362 + * Maximum physical DMA buffer size
1364 +#define MAX_DMA_SIZE 0x3ffff
1365 +#define MAX_DMA_ORDER 18
1368 +static inline void dumpq (lh79520_dma_t *dma)
1370 + dma_buf_t *p=dma->tail;
1372 + printk( "Q: curr=0x%p tail=0x%p head=0x%p bid: ", dma->curr, dma->tail, dma->head);
1375 + printk( "(0x%p 0x%p) ", p, p->id);
1383 + * DMA processing...
1386 +static inline int start_lh79520_dma(lh79520_dma_t * dma, dma_addr_t dma_ptr, int size)
1388 + dmaRegs_t *dmaRegs = (dmaRegs_t *)IO_ADDRESS(DMAC_PHYS);
1389 + cpldRegs_t *cpld = (cpldRegs_t *)CPLD_BASE;
1390 + channelRegs_t *regs = dma->regs;
1393 + status = dmaRegs->status;
1395 + /* If the DMA channel is active, there's nothing else we can do. */
1396 + if( status & (DMAC_ACTIVE0 << dma->channel)) {
1397 + DPRINTK("start: st %#x busy\n", status);
1401 + /* If there's an interrupt pending, split now
1402 + * and let it happen.
1404 + if( status & (DMAC_INT0 << dma->channel)) {
1405 + DPRINTK("start: st %#x IRQ pending\n", status);
1410 + * if we're goint to the uda1341, we have to tell the CPLD
1411 + * to start to send/receive via DMA.
1413 + switch( dma->channel) {
1415 + cpld->audio_control |= CPLD_DAC_DMA_ENABLE;
1416 + dmaRegs->mask |= DMAC_INT2;
1420 + cpld->audio_control |= (CPLD_DAC_DMA_ENABLE | CPLD_DAC_USE_REQ1 );
1421 + dmaRegs->mask |= DMAC_INT3;
1426 + * set the source or destination registers, based on which
1427 + * direction the data's going.
1429 + if( dma->direction == DMA_IN) { /* data coming from peripheral */
1430 + regs->destLow = dma_ptr & 0xffff;
1431 + regs->destHi = (dma_ptr >> 16 ) & 0xffff;
1432 + } else { /* data going to peripheral */
1433 + regs->srcLow = dma_ptr & 0xffff;
1434 + regs->srcHi = (dma_ptr >> 16 ) & 0xffff;
1437 + regs->count = size >> 2; /* DDD assumes 4-byte transfer size */
1438 + regs->control |= DMAC_CTRL_ENABLE;
1440 + DPRINTK("audio_control=0x%x\n", cpld->audio_control);
1441 + DPRINTK("jif=%d start a=%#x sz=%d st=0x%x dma=0x%p dir=%d\n",
1442 + jiffies, dma_ptr, size, status, dma, dma->direction);
1443 + DUMPREGS(regs,dmaRegs);
1447 + u32 *p = phys_to_virt(dma_ptr);
1450 + for( i=0; i<8; i++)
1451 + printk( " %08x %08x %08x %08x\n", *p++, *p++, *p++, *p++);
1459 +static int start_dma(lh79520_dma_t *dma, dma_addr_t dma_ptr, int size)
1461 + return start_lh79520_dma(dma, dma_ptr, size);
1465 +/* This must be called with IRQ disabled */
1466 +static void process_dma(lh79520_dma_t * dma)
1476 + if (!buf || dma->stopped) {
1477 + /* no more data available */
1478 + DPRINTK("process: no more buf (dma %s) buf=0x%p stopped=%d\n",
1479 + dma->curr ? "active" : "inactive", buf, dma->stopped);
1481 + * Some devices may require DMA still sending data
1482 + * at any time for clock reference, etc.
1483 + * Note: if there is still a data buffer being
1484 + * processed then the ref count is negative. This
1485 + * allows for the DMA termination to be accounted in
1486 + * the proper order.
1488 + if (dma->spin_size && dma->spin_ref >= 0) {
1489 + chunksize = dma->spin_size;
1490 + if (chunksize > MAX_DMA_SIZE)
1491 + chunksize = (1 << MAX_DMA_ORDER);
1492 + while (start_dma(dma, dma->spin_addr, chunksize) == 0)
1494 + if (dma->curr != NULL)
1495 + dma->spin_ref = -dma->spin_ref;
1501 + * Let's try to start DMA on the current buffer.
1502 + * If DMA is busy then we break here.
1504 + chunksize = buf->size;
1505 + if (chunksize > MAX_DMA_SIZE)
1506 + chunksize = (1 << MAX_DMA_ORDER);
1508 + DPRINTK("process: bid=%#x s=%d\n", (int) buf->id, buf->size);
1509 + if (start_dma(dma, buf->dma_ptr, chunksize) != 0)
1514 + DPRINTK("process: set curr %#p\n", dma->curr);
1518 + buf->dma_ptr += chunksize;
1519 + buf->size -= chunksize;
1520 + if (buf->size == 0) {
1521 + /* current buffer is done: move tail to the next one */
1522 + dma->tail = buf->next;
1523 + DPRINTK("process: set tail b=%#x\n", (int) dma->tail);
1531 +/* This must be called with IRQ disabled */
1532 +void lh79520_dma_done (lh79520_dma_t *dma)
1534 + dma_buf_t *buf = dma->curr;
1536 + if (dma->spin_ref > 0) {
1540 + if (buf->ref == 0 && buf->size == 0) {
1542 + * Current buffer is done.
1543 + * Move current reference to the next one and send
1544 + * the processed buffer to the callback function,
1545 + * then discard it.
1547 + DPRINTK("IRQ: buf done set curr=%#p\n", buf->next);
1548 + dma->curr = buf->next;
1549 + if (dma->curr == NULL)
1550 + dma->spin_ref = -dma->spin_ref;
1551 + if (dma->head == buf)
1553 + if (dma->callback) {
1554 + int size = buf->dma_ptr - buf->dma_start;
1555 + dma->callback(buf->id, size);
1565 +static void dma_irq_handler(int irq, void *dev_id, struct pt_regs *regs)
1567 + dmaRegs_t *dmaRegs = (dmaRegs_t *)IO_ADDRESS(DMAC_PHYS);
1568 + lh79520_dma_t *dma = (lh79520_dma_t *) dev_id;
1569 + int status = dmaRegs->status;
1571 + DPRINTK("jif=%d IRQ: irq=%d regs=0x%x bid=%#x st=%#x, dma=0x%p\n",
1572 + jiffies, irq, (u32)dma->regs, (int) dma->curr->id, status, dma);
1574 + if (status & (DMAC_ERROR)) {
1575 + printk(KERN_ERR "DMA on \"%s\" caused an error\n", dma->device_id);
1576 + dmaRegs->clear = DMAC_ERROR;
1579 + dmaRegs->clear = status & DMAC_DONE;
1581 + if (status & DMAC_DONE)
1582 + lh79520_dma_done (dma);
1587 + * DMA interface functions
1590 +static spinlock_t dma_list_lock;
1592 +int lh79520_request_dma (dmach_t * channel, const char *device_id, dma_device_t device)
1594 + lh79520_dma_t *dma = NULL;
1595 + cpldRegs_t *cpld = (cpldRegs_t *)CPLD_BASE;
1596 + channelRegs_t *regs;
1599 + /* DMA address (physical) of audio device */
1600 + void *cpldAudioAddr = (void *) &((cpldRegs_t *)CPLD_START)->adc_dac_left;
1604 + printk( __FUNCTION__ "(channel=0x%x, device_id=0x%x device=0x%x)\n",
1605 + (u32)channel, (u32)device_id, device);
1608 + *channel = -1; /* to be sure we catch the freeing of a misregistered channel */
1611 + spin_lock(&dma_list_lock);
1614 + * Allocate a channel. On the lh79520, channels 0 and 1
1615 + * are dedicated to the SSP. Channels 2 and 3 are general purpose,
1616 + * but channel 3 can only be used for audio if the rework described
1617 + * in the User's Guide has been performed.
1620 + case DMA_Audio_Out:
1621 + dma = &dma_chan[2];
1624 + dma->direction = DMA_OUT;
1626 + regs->destLow = (u32)cpldAudioAddr & 0xffff;
1627 + regs->destHi = ((u32)cpldAudioAddr >> 16) & 0xffff;
1628 + regs->control = DMAC_CTRL_SOINC |
1629 + DMAC_CTRL_SOSIZE_4BYTE |
1630 + DMAC_CTRL_DESIZE_4BYTE |
1631 + DMAC_CTRL_SOBURST_SINGLE |
1632 + DMAC_CTRL_ADDR_MODE_WRAP |
1633 + DMAC_CTRL_PERIPH_DEST;
1636 + case DMA_Audio_In:
1637 + dma = &dma_chan[3];
1640 + dma->direction = DMA_IN;
1642 + regs->srcLow = (u32)cpldAudioAddr & 0xffff;
1643 + regs->srcHi = ((u32)cpldAudioAddr >> 16) & 0xffff;
1644 + regs->control = DMAC_CTRL_SOINC |
1645 + DMAC_CTRL_SOSIZE_4BYTE |
1646 + DMAC_CTRL_DESIZE_4BYTE |
1647 + DMAC_CTRL_SOBURST_SINGLE |
1648 + DMAC_CTRL_ADDR_MODE_WRAP |
1649 + DMAC_CTRL_PERIPH_SOURCE;
1652 + case DMA_SSP_Rx: /* not supported */
1653 + case DMA_SSP_Tx: /* not supported */
1665 + spin_unlock(&dma_list_lock);
1669 + err = request_irq(dma->irq, dma_irq_handler, SA_INTERRUPT,
1670 + device_id, (void *) dma);
1673 + "%s: unable to request IRQ %d for DMA channel. error=0x%x\n",
1674 + device_id, dma->irq, err);
1678 + *channel = dma - dma_chan;
1679 + dma->device_id = device_id;
1680 + dma->device = device;
1681 + dma->callback = NULL;
1682 + dma->spin_size = 0;
1686 + DPRINTK( "channel=%d regs=0x%x\n", *channel, (u32)regs);
1687 + DPRINTK("requested\n");
1693 +int lh79520_dma_set_callback(dmach_t channel, dma_callback_t cb)
1695 + lh79520_dma_t *dma = &dma_chan[channel];
1697 + if ((unsigned)channel >= LH79520_DMA_CHANNELS || !dma->in_use)
1700 + dma->callback = cb;
1701 + DPRINTK("cb = %p\n", cb);
1706 +int lh79520_dma_set_spin(dmach_t channel, dma_addr_t addr, int size)
1708 + lh79520_dma_t *dma = &dma_chan[channel];
1711 + if ((unsigned)channel >= LH79520_DMA_CHANNELS || !dma->in_use)
1714 + DPRINTK("set spin %d at %#x\n", size, addr);
1715 + local_irq_save(flags);
1716 + dma->spin_addr = addr;
1717 + dma->spin_size = size;
1721 + local_irq_restore(flags);
1726 +int lh79520_dma_queue_buffer(dmach_t channel, void *buf_id,
1727 + dma_addr_t data, int size)
1729 + lh79520_dma_t *dma;
1733 + dma = &dma_chan[channel];
1734 + if ((unsigned)channel >= LH79520_DMA_CHANNELS || !dma->in_use)
1737 + buf = kmalloc(sizeof(*buf), GFP_ATOMIC);
1743 + buf->dma_ptr = buf->dma_start = data;
1747 + local_irq_save(flags);
1749 + DPRINTK("queueing bid=%#x a=%#x s=%d\n", (int) buf_id, data, size);
1752 + dma->head->next = buf;
1759 + local_irq_restore(flags);
1765 +int lh79520_dma_get_current(dmach_t channel, void **buf_id, dma_addr_t *addr)
1768 + lh79520_dma_t *dma = &dma_chan[channel];
1769 + channelRegs_t *regs;
1771 + if ((unsigned)channel >= LH79520_DMA_CHANNELS || !dma->in_use)
1775 + local_irq_save(flags);
1776 + if (dma->curr && dma->spin_ref <= 0) {
1777 + dma_buf_t *buf = dma->curr;
1780 + * If we got here, that's because there is, or recently was, a
1781 + * buffer being processed. Two possibilities: either we are
1782 + * in the middle of a buffer, or the DMA controller just
1783 + * switched to the next toggle but the interrupt hasn't been
1784 + * serviced yet. The former case is straight forward. In
1785 + * the later case, we'll do like if DMA is just at the end
1786 + * of the previous toggle since all registers haven't been
1787 + * reset yet. This goes around the edge case and since we're
1788 + * always a little behind anyways it shouldn't make a big
1789 + * difference. If DMA has been stopped prior calling this
1790 + * then the position is always exact.
1793 + *buf_id = buf->id;
1795 + if( dma->direction == DMA_IN)
1796 + *addr = (regs->currDstHi << 16 ) | (regs->currDstLow);
1798 + *addr = (regs->currSrcHi << 16 ) | (regs->currSrcLow);
1801 + * Clamp funky pointers sometimes returned by the hardware
1802 + * on completed DMA transfers
1804 + if (*addr < buf->dma_start ||
1805 + *addr > buf->dma_ptr)
1806 + *addr = buf->dma_ptr;
1807 + DPRINTK("curr_pos: b=%#x a=%#x\n", (int)dma->curr->id, *addr);
1809 + } else if (dma->tail && dma->stopped) {
1810 + dma_buf_t *buf = dma->tail;
1812 + *buf_id = buf->id;
1813 + *addr = buf->dma_ptr;
1821 + local_irq_restore(flags);
1826 +int lh79520_dma_stop(dmach_t channel)
1828 + dmaRegs_t *dmaRegs = (dmaRegs_t *)IO_ADDRESS(DMAC_PHYS);
1829 + lh79520_dma_t *dma = &dma_chan[channel];
1832 + DPRINTK( "lh79520_dma_stop channel=%d\n", channel);
1837 + local_irq_save(flags);
1841 + * Stop DMA and tweak state variables so everything could restart
1842 + * from there when resume/wakeup occurs.
1844 + dma->regs->control &= ~DMAC_CTRL_ENABLE;
1845 + dmaRegs->mask &= ~((DMAC_INT0 << channel) | (DMAC_ERRINT0 << channel));
1848 + dma_buf_t *buf = dma->curr;
1849 + if (dma->spin_ref <= 0) {
1850 + dma_addr_t curpos;
1851 + lh79520_dma_get_current(channel, NULL, &curpos);
1852 + buf->size += buf->dma_ptr - curpos;
1853 + buf->dma_ptr = curpos;
1859 + dma->spin_ref = 0;
1861 + local_irq_restore(flags);
1866 +int lh79520_dma_resume(dmach_t channel)
1868 + lh79520_dma_t *dma = &dma_chan[channel];
1870 + if ((unsigned)channel >= LH79520_DMA_CHANNELS || !dma->in_use)
1873 + if (dma->stopped) {
1875 + save_flags_cli(flags);
1877 + dma->spin_ref = 0;
1879 + restore_flags(flags);
1885 +int lh79520_dma_flush_all(dmach_t channel)
1887 + dmaRegs_t *dmaRegs = (dmaRegs_t *)IO_ADDRESS(DMAC_PHYS);
1888 + lh79520_dma_t *dma = &dma_chan[channel];
1889 + dma_buf_t *buf, *next_buf;
1892 + DPRINTK("dma_flush_all channel=%d\n", channel);
1895 + if ((unsigned)channel >= LH79520_DMA_CHANNELS || !dma->in_use)
1898 + local_irq_save(flags);
1901 + * Disable the channel, and mask off its interrupts
1903 + dma->regs->control &= ~(DMAC_CTRL_ENABLE);
1904 + dmaRegs->mask &= ~((DMAC_INT0 << channel) | (DMAC_ERRINT0 << channel));
1910 + dma->head = dma->tail = dma->curr = NULL;
1912 + dma->spin_ref = 0;
1914 + local_irq_restore(flags);
1917 + next_buf = buf->next;
1921 + DPRINTK("flushed\n");
1926 +void lh79520_free_dma(dmach_t channel)
1928 + lh79520_dma_t *dma;
1930 + if ((unsigned)channel >= LH79520_DMA_CHANNELS)
1933 + dma = &dma_chan[channel];
1934 + if (!dma->in_use) {
1935 + printk(KERN_ERR "Trying to free free DMA%d\n", channel);
1939 + lh79520_dma_set_spin(channel, 0, 0);
1940 + lh79520_dma_flush_all(channel);
1942 + free_irq(dma->irq, (void *) dma);
1945 + DPRINTK("freed\n");
1949 +EXPORT_SYMBOL(lh79520_request_dma);
1950 +EXPORT_SYMBOL(lh79520_dma_set_callback);
1951 +EXPORT_SYMBOL(lh79520_dma_set_spin);
1952 +EXPORT_SYMBOL(lh79520_dma_queue_buffer);
1953 +EXPORT_SYMBOL(lh79520_dma_get_current);
1954 +EXPORT_SYMBOL(lh79520_dma_stop);
1955 +EXPORT_SYMBOL(lh79520_dma_resume);
1956 +EXPORT_SYMBOL(lh79520_dma_flush_all);
1957 +EXPORT_SYMBOL(lh79520_free_dma);
1961 +/* Drivers should call this from their PM callback function */
1963 +int lh79520_dma_sleep(dmach_t channel)
1965 + dmaRegs_t *dmaRegs = (dmaRegs_t *)IO_ADDRESS(DMAC_PHYS);
1966 + lh79520_dma_t *dma = &dma_chan[channel];
1969 + if ((unsigned)channel >= LH79520_DMA_CHANNELS || !dma->in_use)
1972 + orig_state = dma->stopped;
1973 + lh79520_dma_stop(channel);
1974 + dma->regs->control &= ~DMAC_CTRL_ENABLE;
1975 + dmaRegs->mask &= ~((DMAC_INT0 << channel) | (DMAC_ERRINT0 << channel));
1977 + dma->stopped = orig_state;
1978 + dma->spin_ref = 0;
1982 +int lh79520_dma_wakeup(dmach_t channel)
1984 + dmaRegs_t *dmaRegs = (dmaRegs_t *)IO_ADDRESS(DMAC_PHYS);
1985 + lh79520_dma_t *dma = &dma_chan[channel];
1988 + if ((unsigned)channel >= LH79520_DMA_CHANNELS || !dma->in_use)
1991 + dma->regs->control &= ~DMAC_CTRL_ENABLE;
1992 + dmaRegs->mask &= ~((DMAC_INT0 << channel) | (DMAC_ERRINT0 << channel));
1994 + local_irq_save(flags);
1996 + local_irq_restore(flags);
2001 +EXPORT_SYMBOL(lh79520_dma_sleep);
2002 +EXPORT_SYMBOL(lh79520_dma_wakeup);
2004 +#endif /* CONFIG_PM */
2007 +static int __init lh79520_init_dma(void)
2010 + dmaRegs_t *dmaRegs = (dmaRegs_t *)IO_ADDRESS(DMAC_PHYS);
2011 + ioconRegs_t *ioconRegs = (ioconRegs_t *)IO_ADDRESS( IOCON_PHYS);
2012 + channelRegs_t *regs;
2015 + printk( __FUNCTION__ "\n");
2018 + dmaRegs->clear = DMAC_CLEAR_ALL;
2019 + dmaRegs->mask = 0;
2021 + for (channel = 0; channel < LH79520_DMA_CHANNELS; channel++) {
2022 + dma_chan[channel].regs = regs = streamRegs[channel];
2024 + regs->control = 0;
2029 + regs->destLow = 0;
2031 + dma_chan[channel].irq = IRQ_DMA;
2032 + dma_chan[channel].channel = channel;
2035 + printk( "dma channel %d at 0x%x\n", channel, (u32)regs);
2039 + /* assign pins to DMA stream 2 */
2040 + ioconRegs->DMAMux |= (DMAMUX_DCDEOT0 | DMAMUX_DCDREQ0) ;
2042 + /* assign pins to DMA Stream 3 */
2043 + // These two lines interfere with PWM Audio
2044 + // ioconRegs->MiscMux |= MISCMUX_DCDEOT1;
2045 + // ioconRegs->MiscMux &= ~MISCMUX_RCEII5;
2050 +__initcall(lh79520_init_dma);
2051 diff -urN linux-2.4.26/arch/arm/mach-lh79520/dma.h linux-2.4.26-vrs1-lnode80/arch/arm/mach-lh79520/dma.h
2052 --- linux-2.4.26/arch/arm/mach-lh79520/dma.h 1969-12-31 20:00:00.000000000 -0400
2053 +++ linux-2.4.26-vrs1-lnode80/arch/arm/mach-lh79520/dma.h 2005-11-02 17:38:44.000000000 -0400
2056 + * arch/arm/mach-lh79520/dma.h
2057 + * Copyright (C) 2002 Embedix, Inc.
2059 + * Based on arch/arm/mach-sa1100/dma.h which is
2060 + * (C) 2000 Nicolas Pitre <nico@cam.org>
2062 + * This program is free software; you can redistribute it and/or modify
2063 + * it under the terms of the GNU General Public License version 2 as
2064 + * published by the Free Software Foundation.
2067 +#include <linux/config.h>
2070 + * DMA buffer structure
2073 +typedef struct dma_buf_s {
2074 + int size; /* buffer size */
2075 + dma_addr_t dma_start; /* starting DMA address */
2076 + dma_addr_t dma_ptr; /* next DMA pointer to use */
2077 + int ref; /* number of DMA references */
2078 + void *id; /* to identify buffer from outside */
2079 + struct dma_buf_s *next; /* next buffer to process */
2088 + * DMA channel structure.
2091 + unsigned int in_use; /* Device is allocated */
2092 + const char *device_id; /* Device name */
2093 + dma_device_t device; /* ... to which this channel is attached */
2094 + dma_buf_t *head; /* where to insert buffers */
2095 + dma_buf_t *tail; /* where to remove buffers */
2096 + dma_buf_t *curr; /* buffer currently DMA'ed */
2097 + int stopped; /* 1 if DMA is stalled */
2098 + channelRegs_t *regs; /* points to appropriate DMA registers */
2099 + int irq; /* IRQ used by the channel */
2100 + dma_callback_t callback; /* ... to call when buffers are done */
2101 + int spin_size; /* > 0 when DMA should spin when no more buffer */
2102 + dma_addr_t spin_addr; /* DMA address to spin onto */
2103 + int spin_ref; /* number of spinning references */
2104 + int channel; /* channel number */
2105 + dma_direction_t direction; /* DMA direction: 0=Out / 1=In */
2108 +extern lh79520_dma_t dma_chan[LH79520_DMA_CHANNELS];
2111 +void lh79520_dma_done( lh79520_dma_t *dma);
2116 diff -urN linux-2.4.26/arch/arm/mach-lh79520/generic.c linux-2.4.26-vrs1-lnode80/arch/arm/mach-lh79520/generic.c
2117 --- linux-2.4.26/arch/arm/mach-lh79520/generic.c 1969-12-31 20:00:00.000000000 -0400
2118 +++ linux-2.4.26-vrs1-lnode80/arch/arm/mach-lh79520/generic.c 2005-11-02 17:38:09.000000000 -0400
2121 + * linux/arch/arm/mach-lh79520/generic.c
2123 + * Common code for all LH79520 based machines.
2125 + * Copyright (C) 2001 Lineo, Inc
2127 + * This program is free software; you can redistribute it and/or modify
2128 + * it under the terms of the GNU General Public License as published by
2129 + * the Free Software Foundation; either version 2 of the License, or
2130 + * (at your option) any later version.
2132 + * This program is distributed in the hope that it will be useful,
2133 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
2134 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2135 + * GNU General Public License for more details.
2137 + * You should have received a copy of the GNU General Public License
2138 + * along with this program; if not, write to the Free Software
2139 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2141 +#include <linux/config.h>
2142 +#include <linux/types.h>
2143 +#include <linux/sched.h>
2144 +#include <linux/interrupt.h>
2145 +#include <linux/init.h>
2147 +#include <asm/hardware.h>
2148 +#include <asm/irq.h>
2149 +#include <asm/setup.h>
2150 +#include <asm/mach-types.h>
2152 +#include <asm/mach/arch.h>
2153 +#include <asm/arch/rcpc.h>
2157 + * return the CPU clock frequency (FCLK) in Hz.
2160 +cpufreq_get( int cpu)
2163 + rcpcRegs_t *RCPC = (rcpcRegs_t *)IO_ADDRESS(RCPC_PHYS);
2165 + divider = RCPC->CpuClkPrescale * 2;
2168 + return PLL_CLOCK / divider;;
2170 +EXPORT_SYMBOL(cpufreq_get);
2174 + * return the bus clock frequency (HCLK) in Hz.
2177 +hclkfreq_get( void)
2180 + rcpcRegs_t *RCPC = (rcpcRegs_t *)IO_ADDRESS(RCPC_PHYS);
2182 + divider = RCPC->HCLKPrescale * 2; /* HCLK prescale value */
2184 + if( divider == 0) /* no prescalar == divide by 1 */
2187 + return PLL_CLOCK / divider;
2191 diff -urN linux-2.4.26/arch/arm/mach-lh79520/generic.h linux-2.4.26-vrs1-lnode80/arch/arm/mach-lh79520/generic.h
2192 --- linux-2.4.26/arch/arm/mach-lh79520/generic.h 1969-12-31 20:00:00.000000000 -0400
2193 +++ linux-2.4.26-vrs1-lnode80/arch/arm/mach-lh79520/generic.h 2005-11-02 17:38:09.000000000 -0400
2196 + * linux/arch/arm/mach-lh79520/generic.h
2198 + * Common code for all LH79520 based machines.
2200 + * Copyright (C) 2001 Lineo, Inc
2202 + * This program is free software; you can redistribute it and/or modify
2203 + * it under the terms of the GNU General Public License as published by
2204 + * the Free Software Foundation; either version 2 of the License, or
2205 + * (at your option) any later version.
2207 + * This program is distributed in the hope that it will be useful,
2208 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
2209 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2210 + * GNU General Public License for more details.
2212 + * You should have received a copy of the GNU General Public License
2213 + * along with this program; if not, write to the Free Software
2214 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2217 +unsigned int cpufreq_get( int cpu);
2218 +unsigned int hclkfreq_get( void);
2219 diff -urN linux-2.4.26/arch/arm/mach-lh79520/Makefile linux-2.4.26-vrs1-lnode80/arch/arm/mach-lh79520/Makefile
2220 --- linux-2.4.26/arch/arm/mach-lh79520/Makefile 1969-12-31 20:00:00.000000000 -0400
2221 +++ linux-2.4.26-vrs1-lnode80/arch/arm/mach-lh79520/Makefile 2005-11-02 17:38:09.000000000 -0400
2224 +# Makefile for the linux kernel.
2226 +# Note! Dependencies are done automagically by 'make dep', which also
2227 +# removes any old dependencies. DON'T put your own dependencies here
2228 +# unless it's something special (ie not a .c file).
2230 +USE_STANDARD_AS_RULE := true
2232 +O_TARGET := lh79520.o
2234 +# Object file lists.
2236 +obj-y := arch.o mm.o generic.o dma.o
2241 +export-objs := generic.o dma.o
2243 +# obj-$(CONFIG_LEDS) += leds.o
2244 +# obj-$(CONFIG_PCI) += pci_v3.o pci.o
2246 +include $(TOPDIR)/Rules.make
2247 diff -urN linux-2.4.26/arch/arm/mach-lh79520/mm.c linux-2.4.26-vrs1-lnode80/arch/arm/mach-lh79520/mm.c
2248 --- linux-2.4.26/arch/arm/mach-lh79520/mm.c 1969-12-31 20:00:00.000000000 -0400
2249 +++ linux-2.4.26-vrs1-lnode80/arch/arm/mach-lh79520/mm.c 2005-11-02 17:38:09.000000000 -0400
2252 + * linux/arch/arm/mach-lh79520/mm.c
2254 + * Copyright (C) 2001 Lineo, Inc.
2256 + * This program is free software; you can redistribute it and/or modify
2257 + * it under the terms of the GNU General Public License version 2 as
2258 + * published by the Free Software Foundation.
2260 +#include <linux/sched.h>
2261 +#include <linux/mm.h>
2262 +#include <linux/init.h>
2264 +#include <asm/pgtable.h>
2265 +#include <asm/page.h>
2266 +#include <asm/io.h>
2268 +#include <asm/mach/map.h>
2270 +static struct map_desc lh79520_io_desc[] __initdata = {
2271 + /* virt phys size r w c b */
2272 + { FLASH_BASE, FLASH_START, FLASH_SIZE, DOMAIN_IO, 0, 1, 0, 0 },
2273 + { CPLD_BASE, CPLD_START, CPLD_SIZE, DOMAIN_IO, 0, 1, 0, 0 },
2274 + { CS8900_BASE, CS8900_START, CS8900_SIZE, DOMAIN_IO, 0, 1, 0, 0 },
2275 + { IDE_BASE, IDE_START, IDE_SIZE, DOMAIN_IO, 0, 1, 0, 0 },
2276 + { IDE2_BASE, IDE2_START, IDE2_SIZE, DOMAIN_IO, 0, 1, 0, 0 },
2277 + { INT_SRAM_BASE, INT_SRAM_START, INT_SRAM_SIZE, DOMAIN_IO, 0, 1, 0, 0 },
2278 + { APB_BASE, APB_START, APB_SIZE, DOMAIN_IO, 0, 1, 0, 0 },
2279 + { AHB_BASE, AHB_START, AHB_SIZE, DOMAIN_IO, 0, 1, 0, 0 },
2280 + { VIC_BASE, VIC_START, VIC_SIZE, DOMAIN_IO, 0, 1, 0, 0 },
2284 +void __init lh79520_map_io(void)
2286 + iotable_init( lh79520_io_desc);
2289 diff -urN linux-2.4.26/arch/arm/Makefile linux-2.4.26-vrs1-lnode80/arch/arm/Makefile
2290 --- linux-2.4.26/arch/arm/Makefile 2005-11-02 16:54:16.000000000 -0400
2291 +++ linux-2.4.26-vrs1-lnode80/arch/arm/Makefile 2005-11-02 17:37:31.000000000 -0400
2292 @@ -160,6 +160,16 @@
2296 +ifeq ($(CONFIG_ARCH_LH79520),y)
2297 +# C0008000 is the default, so not needed -- DDD
2298 +# DDD TEXTADDR = 0xC0008000
2302 +ifeq ($(CONFIG_ARCH_LH7A400),y)
2306 ifeq ($(CONFIG_ARCH_OMAHA),y)
2309 diff -urN linux-2.4.26/arch/arm/tools/mach-types linux-2.4.26-vrs1-lnode80/arch/arm/tools/mach-types
2310 --- linux-2.4.26/arch/arm/tools/mach-types 2005-11-02 16:54:18.000000000 -0400
2311 +++ linux-2.4.26-vrs1-lnode80/arch/arm/tools/mach-types 2005-11-02 17:37:31.000000000 -0400
2313 omap_osk MACH_OMAP_OSK OMAP_OSK 515
2314 rg100v3 MACH_RG100V3 RG100V3 516
2315 mx2ads MACH_MX2ADS MX2ADS 517
2316 +lh79520evb LH79520_EVB LH79520EVB 999
2317 +lh7a400evb LH7A400_EVB LH7A400EVB 998
2318 diff -urN linux-2.4.26/Documentation/Configure.help linux-2.4.26-vrs1-lnode80/Documentation/Configure.help
2319 --- linux-2.4.26/Documentation/Configure.help 2005-11-02 16:54:16.000000000 -0400
2320 +++ linux-2.4.26-vrs1-lnode80/Documentation/Configure.help 2005-11-02 17:37:31.000000000 -0400
2321 @@ -25531,6 +25531,136 @@
2322 a debugging option; you probably do not want to set it unless you
2323 are an S390 port maintainer.
2325 +Sharp LH79520 based bords
2326 +CONFIG_ARCH_LH79520
2327 + Say Y here to support the Sharp LH79520 System on Chip.
2329 +Sharp LH79520 Evaluation Board (Isis)
2331 + Say Y here to support the Sharp LH79520 Evaluation Board.
2333 +Sharp LH79520 Watchdog Timer
2334 +CONFIG_LH79520_WATCHDOG
2335 + Say Y here to include support for the LH79520 watchdog timer.
2336 + The watchdog timer will reboot your system when the timeout is reached.
2337 + Note that once enabled, this timer cannot be disabled.
2339 + This driver is also available as a module ( = code which can be
2340 + inserted in and removed from the running kernel whenever you want).
2341 + If you want to compile it as a module, say M here and read
2342 + Documentation/modules.txt. The module will be called lh79520_wdt.o.
2346 +Sharp LH79520 PWM controller
2348 + Say Y here to include support for the PWM device.
2349 + PWM0 is for the LCD backlight intensity, and
2350 + PWM1 is for audio. The major number is dynamically assigned unless
2351 + module parameter is provided. Device nodes must exist to control
2355 + 254 may or may not be the major number for your driver.
2356 + Check /proc/devices for major number of pwm520.
2360 +Sharp LH79520 7-segment display
2361 +CONFIG_7SEGMENT_LH79520
2362 + Say Y here to include support for the LH79520 7-segment display.
2366 +Sharp LH79520 Touchscreen
2367 +CONFIG_TOUCHSCREEN_LH79520
2368 + Say Y here to include support for the LH79520 touchscreen.
2372 +Sharp LH79520 LCD EEPROM
2373 +CONFIG_EEPROM_LH79520
2374 + Say Y here to include support for the EEPROM on the LCD
2375 + board on the Sharp LH79520 EVB.
2379 +ARM PrimeCell PL011 UART
2380 +CONFIG_SERIAL_AMBA_PL011
2381 + Say Y here to include support for the ARM PrimeCell PL011 UART.
2385 +Console on ARM PL011 UART
2386 +CONFIG_SERIAL_AMBA_PL011_CONSOLE
2387 + Say Y here to support a serial console on an ARM PrimeCell PL011 UART.
2391 +ARM PrimeCell PL110 LCD Controller
2393 + Say Y here to include support the ARM PrimeCell PL110
2398 +Sharp LQ039Q2DS53-HR-TFT LCD panel
2400 + Say Y here to if you've got a Sharp LQ039Q2DS53-HR-TFT
2401 + LCD panel connected to an ARM PL110 LCD controller.
2405 +Sharp LM057QCTT03-QVGA-STN LCD panel
2407 + Say Y here to if you've got a Sharp LM057QCTT03-QVGA-STN
2408 + LCD panel connected to an ARM PL110 LCD controller.
2412 +Sharp LQ057Q3DC02-VGA/QVGA-TFT LCD panel
2414 + Say Y here to if you've got a Sharp LQ057Q3DC02-VGA/QVGA-TFT
2415 + LCD panel connected to an ARM PL110 LCD controller.
2419 +Sharp LQ121S1DG31-800x600-TFT LCD panel
2421 + Say Y here to if you've got a Sharp LQ121S1DG31-800x600-TFT
2422 + LCD panel connected to an ARM PL110 LCD controller.
2426 +Sharp LQ104V1DG11-640x480-TFT LCD panel
2428 + Say Y here to if you've got a Sharp LQ104V1DG11-640x480-TFT
2429 + LCD panel connected to an ARM PL110 LCD controller.
2433 +Sharp LH7A400 based bords
2434 +CONFIG_ARCH_LH7A400
2435 + Say Y here to support the Sharp LH7A400 System on Chip.
2437 +Sharp LH7A400 Evaluation Board (Aruba)
2439 + Say Y here to support the Sharp LH7A400 SoC Evaluation Board.
2442 +CONFIG_SERIAL_LH7A400
2443 + Say Y here to include support for the UART on the Sharp
2448 +Console on a Sharp LH7A400 Serial port
2449 +CONFIG_SERIAL_LH7A400_CONSOLE
2450 + Say Y here to support a serial console on the
2451 + Sharp LH7A400 SoC Serial port.
2458 diff -urN linux-2.4.26/drivers/char/Config.in linux-2.4.26-vrs1-lnode80/drivers/char/Config.in
2459 --- linux-2.4.26/drivers/char/Config.in 2005-11-02 16:54:20.000000000 -0400
2460 +++ linux-2.4.26-vrs1-lnode80/drivers/char/Config.in 2005-11-02 17:37:31.000000000 -0400
2462 dep_tristate ' DC21285 watchdog' CONFIG_21285_WATCHDOG $CONFIG_FOOTBRIDGE
2463 dep_tristate ' NetWinder WB83C977 watchdog' CONFIG_977_WATCHDOG $CONFIG_ARCH_NETWINDER
2464 dep_tristate ' SA1100 watchdog' CONFIG_SA1100_WATCHDOG $CONFIG_ARCH_SA1100
2465 + dep_tristate ' Sharp LH79520 watchdog' CONFIG_LH79520_WATCHDOG $CONFIG_ARCH_LH79520
2466 dep_tristate ' EPXA watchdog' CONFIG_EPXA_WATCHDOG $CONFIG_ARCH_CAMELOT
2467 dep_tristate ' Omaha watchdog' CONFIG_OMAHA_WATCHDOG $CONFIG_ARCH_OMAHA
2468 dep_tristate ' AT91RM9200 watchdog' CONFIG_AT91_WATCHDOG $CONFIG_ARCH_AT91RM9200
2469 @@ -304,6 +305,11 @@
2470 if [ "$CONFIG_X86" = "y" -o "$CONFIG_X86_64" = "y" ]; then
2471 dep_tristate 'AMD 768/8111 Random Number Generator support' CONFIG_AMD_RNG $CONFIG_PCI
2474 +if [ "$CONFIG_ARCH_LH79520" = "y" ]; then
2475 + tristate 'LH79520 PWM support' CONFIG_LH79520_PWM
2478 if [ "$CONFIG_X86" = "y" -o "$CONFIG_IA64" = "y" ]; then
2479 dep_tristate 'Intel i8x0 Random Number Generator support' CONFIG_INTEL_RNG $CONFIG_PCI
2481 diff -urN linux-2.4.26/drivers/char/console.c linux-2.4.26-vrs1-lnode80/drivers/char/console.c
2482 --- linux-2.4.26/drivers/char/console.c 2005-11-02 16:54:20.000000000 -0400
2483 +++ linux-2.4.26-vrs1-lnode80/drivers/char/console.c 2005-11-02 17:37:31.000000000 -0400
2485 int console_blanked;
2487 static int vesa_blank_mode; /* 0:none 1:suspendV 2:suspendH 3:powerdown */
2488 -static int blankinterval = 10*60*HZ;
2489 +static int blankinterval = 0; // 10*60*HZ;
2490 static int vesa_off_interval;
2492 static struct tq_struct console_callback_tq = {
2493 diff -urN linux-2.4.26/drivers/char/cradle.c linux-2.4.26-vrs1-lnode80/drivers/char/cradle.c
2494 --- linux-2.4.26/drivers/char/cradle.c 1969-12-31 20:00:00.000000000 -0400
2495 +++ linux-2.4.26-vrs1-lnode80/drivers/char/cradle.c 2005-11-02 17:37:31.000000000 -0400
2500 +** Device driver for the cradle interface on the Touchblock device.
2502 +** Copyright (C) 2002 The PTR Group, Inc. <www.theptrgroup.com>
2504 +** This program is free software; you can redistribute it and/or modify
2505 +** it under the terms of the GNU General Public License as published by
2506 +** the Free Software Foundation; either version 2 of the License, or
2507 +** (at your option) any later version.
2509 +** This program is distributed in the hope that it will be useful,
2510 +** but WITHOUT ANY WARRANTY; without even the implied warranty of
2511 +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2512 +** GNU General Public License for more details.
2514 +** You should have received a copy of the GNU General Public License
2515 +** along with this program; if not, write to the Free Software
2516 +** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2520 +#include <linux/module.h>
2521 +#include <linux/kernel.h>
2522 +#include <linux/sched.h>
2523 +#include <linux/signal.h>
2524 +#include <linux/errno.h>
2525 +#include <linux/mm.h>
2526 +#include <linux/slab.h>
2527 +#include <linux/poll.h>
2528 +#include <linux/miscdevice.h>
2529 +#include <linux/random.h>
2530 +#include <linux/init.h>
2531 +#include <asm/system.h>
2532 +#include <asm/hardware.h>
2533 +#include <asm/arch/iocon.h>
2534 +#include <asm/arch/gpio.h>
2535 +#include <asm/hardware/cradle.h>
2537 +static ssize_t cradle_read(struct file *filp, char *buf, size_t count, loff_t *f_pos);
2538 +static int cradle_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg);
2539 +static int cradle_open(struct inode *inode, struct file *filp);
2540 +static int cradle_release(struct inode *inode, struct file *filp);
2541 +static int cradle_fasync(int fd, struct file *filp, int mode );
2542 +static unsigned int cradle_poll(struct file *filp, poll_table *wait);
2545 +static char read_docking_state(void);
2546 +static inline void cradle_update_buffer(volatile char **index, int delta, char *buf, int size);
2549 +void cradle_do_tasklet_docked(unsigned long data);
2550 +DECLARE_TASKLET( cradle_tasklet_docked, cradle_do_tasklet_docked,0);
2551 +void cradle_do_tasklet_undocked(unsigned long data);
2552 +DECLARE_TASKLET( cradle_tasklet_undocked, cradle_do_tasklet_undocked,0);
2555 +//#define min(a,b) (((a)<(b))?(a):(b))
2557 +#define CRADLE_IBUF_SIZE 2
2563 + volatile char *ibuf_wp;
2564 + volatile char *ibuf_rp;
2566 + wait_queue_head_t wait_inq;
2567 + struct fasync_struct *fasync; /* asynchronous readers */
2570 +static cradle_dev_t cradle_dev;
2572 +struct file_operations cradle_fops = {
2574 +read: cradle_read, // read
2576 +// NULL, // readdir
2577 +poll: cradle_poll, // poll/select
2578 +ioctl: cradle_ioctl, // ioctl
2580 +open: cradle_open, // open
2582 +release: cradle_release, // release
2584 +fasync: cradle_fasync, // fasync
2587 +/************************************************************************
2588 +** Read the docking state from the hardware
2589 +************************************************************************/
2590 +static char read_docking_state(void)
2593 + return( (GPIOG->dr & 0x10) ? CRADLE_UNDOCKED_STATE : CRADLE_DOCKED_STATE );
2596 +/************************************************************************
2597 +** Manipulate the buffer pointers safely without using locks
2598 +************************************************************************/
2599 +static inline void cradle_update_buffer(volatile char **index, int delta, char *buf, int size)
2601 + volatile char *new = *index + delta;
2603 + *index=(new >= (buf+size)) ? buf : new;
2608 +/************************************************************************
2609 +** Enable the interrupt(s) associated with the cradle
2610 +************************************************************************/
2611 +static void cradle_enable_interrupt(void)
2613 + /* printk(KERN_INFO "cradle: interrupts enabled\n"); */
2616 +/************************************************************************
2617 +** Disable the interrupt(s) associated with the cradle
2618 +************************************************************************/
2619 +static void cradle_disable_interrupt(void)
2621 + /* printk(KERN_INFO "cradle: interrupts disabled\n"); */
2624 +/************************************************************************
2626 +************************************************************************/
2627 +static void cradle_docked_interrupt_handler(int irq, void *dev_id, struct pt_regs *regs)
2629 + cradle_dev_t *dev=dev_id;
2631 + /* printk(KERN_INFO "cradle: docked irq\n"); */
2633 + /* Reset the interrupt request */
2635 + /* Get the state */
2636 + *dev->ibuf_wp=read_docking_state();
2637 + cradle_update_buffer(&dev->ibuf_wp, 1, dev->ibuf, CRADLE_IBUF_SIZE);
2639 + /* Notify any asynchronous readers */
2642 + /* printk(KERN_INFO "cradle: kill_fasync()\n"); */
2643 + kill_fasync(dev->fasync, SIGIO, POLL_IN);
2646 + wake_up_interruptible( &dev->wait_inq );
2648 + /* Schedule the bottom-half */
2649 + /* tasklet_schedule(&cradle_tasklet_docked); */
2652 +/************************************************************************
2654 +************************************************************************/
2655 +static void cradle_undocked_interrupt_handler(int irq, void *dev_id, struct pt_regs *regs)
2657 + cradle_dev_t *dev=dev_id;
2659 + /* printk(KERN_INFO "cradle: undocked irq\n"); */
2661 + /* Reset the interrupt request */
2663 + /* Get the state */
2664 + *dev->ibuf_wp=read_docking_state();
2665 + cradle_update_buffer(&dev->ibuf_wp, 1, dev->ibuf, CRADLE_IBUF_SIZE);
2667 + /* Notify any asynchronous readers */
2670 + /* printk(KERN_INFO "cradle: kill_fasync()\n"); */
2671 + kill_fasync(dev->fasync, SIGIO, POLL_IN);
2674 + wake_up_interruptible( &dev->wait_inq );
2676 + /* Schedule the bottom-half */
2677 + /* tasklet_schedule(&cradle_tasklet_undocked); */
2680 +/*************************************************************************
2681 +** Bottom-half processing
2682 +*************************************************************************/
2683 +void cradle_do_tasklet_docked(unsigned long data)
2685 + printk(KERN_INFO "cradle: tasklet\n");
2689 +/*************************************************************************
2690 +** Bottom-half processing
2691 +*************************************************************************/
2692 +void cradle_do_tasklet_undocked(unsigned long data)
2694 + printk(KERN_INFO "cradle: tasklet undocked\n");
2698 +/************************************************************************
2699 +** Open the cradle device
2700 +************************************************************************/
2701 +static int cradle_open(struct inode *inode, struct file *filp)
2703 + cradle_dev_t *dev;
2706 + /* printk(KERN_INFO "cradle: open()\n"); */
2708 + /* Initialize the device information */
2709 + dev=(cradle_dev_t *)filp->private_data;
2713 + filp->private_data=dev;
2716 + if( dev->users++ ) return 0;
2718 + MOD_INC_USE_COUNT;
2720 + /* allocate the buffers */
2721 + dev->ibuf=(char *)kmalloc(CRADLE_IBUF_SIZE,GFP_KERNEL);
2724 + MOD_DEC_USE_COUNT;
2728 + /* clear the buffers */
2729 + dev->ibuf_wp=dev->ibuf_rp=dev->ibuf;
2731 + /* mark the device ready */
2734 + /* Install the interrupt handler(s) */
2736 + /* Enable the interrupts */
2737 + //cradle_enable_interrupt();
2743 +/************************************************************************
2744 +** Release the cradle device
2745 +************************************************************************/
2746 +static int cradle_release(struct inode *inode, struct file *filp)
2749 + cradle_dev_t *dev=(cradle_dev_t *)filp->private_data;
2751 + /* printk(KERN_INFO "cradle: release\n"); */
2753 + if( --dev->users ) return 0;
2755 + //cradle_disable_interrupt();
2759 + /* release any asynchronous readers */
2760 + cradle_fasync(-1,filp,0);
2762 + /* free up resources */
2766 + MOD_DEC_USE_COUNT;
2771 +/************************************************************************
2772 +** Read the cradle device
2774 +** This implementation supports both non-blocking and blocking i/o.
2775 +************************************************************************/
2776 +static ssize_t cradle_read(struct file *filp, char *buf, size_t count, loff_t *f_pos)
2778 + cradle_dev_t *dev=(cradle_dev_t *)filp->private_data;
2779 + wait_queue_t wait;
2781 + /* printk(KERN_INFO "cradle: read()\n"); */
2783 + /* unseekable device */
2784 + if( f_pos!=&filp->f_pos )
2788 + ** safe implementation of sleeping that avoids race conditions
2791 + /* init our local wait queue */
2792 + init_waitqueue_entry(&wait, current);
2794 + /* add out queue to the drivers queue */
2795 + add_wait_queue(&dev->wait_inq, &wait);
2799 + /* tell the schedule we are asleep (even though we aren't yet) */
2800 + set_current_state(TASK_INTERRUPTIBLE);
2802 + /* check for available data */
2803 + if( dev->ibuf_wp != dev->ibuf_rp )
2808 + if( filp->f_flags & O_NONBLOCK )
2810 + remove_wait_queue(&dev->wait_inq, &wait);
2811 + set_current_state(TASK_RUNNING);
2813 + /* return -EWOULDBLOCK; */
2816 + /* check to see if it is a signal */
2817 + if( signal_pending(current))
2819 + remove_wait_queue(&dev->wait_inq, &wait);
2820 + set_current_state(TASK_RUNNING);
2821 + return -ERESTARTSYS;
2824 + /* allow other processes to run (we'll go to sleep) */
2828 + set_current_state(TASK_RUNNING);
2829 + remove_wait_queue(&dev->wait_inq, &wait);
2831 + /* calculate how much data is available */
2832 + if( dev->ibuf_wp > dev->ibuf_rp )
2833 + count=min(count, dev->ibuf_wp - dev->ibuf_rp );
2835 + count=min(count, (dev->ibuf+CRADLE_IBUF_SIZE) - dev->ibuf_rp );
2837 + /* printk("cradle: read() %d available\n", count); */
2839 + /* copy the data to user space */
2840 + if( copy_to_user(buf, dev->ibuf_rp, count) )
2845 + /* manager the buffer pointers */
2846 + cradle_update_buffer(&dev->ibuf_rp, count, dev->ibuf, CRADLE_IBUF_SIZE);
2852 +/************************************************************************
2853 +** Poll/select the cradle device
2854 +************************************************************************/
2855 +static unsigned int cradle_poll(struct file *filp, poll_table *wait)
2857 + cradle_dev_t *dev=filp->private_data;
2858 + unsigned int mask=0;
2860 + poll_wait(filp, &dev->wait_inq, wait);
2862 + /* check for readable */
2863 + if( dev->ibuf_wp != dev->ibuf_rp )
2864 + mask |= POLLIN | POLLRDNORM;
2869 +/************************************************************************
2870 +** IOCTL interface for the cradle device
2871 +************************************************************************/
2872 +static int cradle_ioctl(struct inode *inode, struct file *filp,
2873 + unsigned int cmd, unsigned long arg)
2875 + int docking_state;
2878 + /* printk(KERN_INFO "cradle: ioct %d\n", cmd); */
2882 + case CRADLE_GET_DOCKING_STATE_IOCTL:
2883 + docking_state=read_docking_state();
2884 + //this code is here temporarily until
2885 + // a timer is added to check the state and set
2886 + // the LED automatically
2887 + if(docking_state == CRADLE_DOCKED_STATE)
2889 + // turn on dock led
2890 + GPIOF->dr |= 0x40;
2894 + // turn off dock led
2895 + GPIOF->dr &= ~0x40;
2898 + retval=put_user(docking_state, (int *)arg);
2902 + printk(KERN_INFO "cradle: unknown ioctl %d\n", cmd);
2910 +/************************************************************************
2911 +** Aynchronous i/o support for the cradle device
2912 +************************************************************************/
2913 +static int cradle_fasync(int fd, struct file *filp, int on )
2916 + cradle_dev_t *dev=filp->private_data;
2919 + printk(KERN_INFO "cradle: fasync fd=%d filp=0x%08x mode=%d\n",
2920 + fd, (unsigned int) filp, on );
2923 + retval=fasync_helper(fd, filp, on, &dev->fasync);
2930 +/************************************************************************
2931 +** Initialize the cradle interface and the hardware associated with the
2934 +** This configuration is specific to the hardware design for the
2935 +** Touchblock device. Moreover, this configuration *must* match the
2936 +** configuration of the MIPS interrupt handler.
2937 +************************************************************************/
2938 +void cradle_init(void)
2941 + int cradle_major = 0;
2943 + /* register the device */
2944 + retval=register_chrdev( cradle_major, "cradle", &cradle_fops );
2947 + printk(KERN_WARNING "cradle: Failed to register device\n");
2949 + if (cradle_major == 0)
2951 + cradle_major = retval; /* Dynamic Allocation of major number */
2952 + printk("<4>Cradle Dynamic Major Number %d\n",cradle_major);
2956 + /* initialize the device structure */
2957 + memset( &cradle_dev, 0, sizeof( cradle_dev_t ) );
2958 + init_waitqueue_head(&cradle_dev.wait_inq);
2961 + /* printk(KERN_INFO "cradle: initalized\n"); */
2964 +/************************************************************************
2966 +** Since the cradle device is statically compiled into the kernel this
2967 +** is not really used. However, when the driver switches to loadable
2968 +** modules this should be the basis of the
2969 +** module cleanup routine.
2970 +************************************************************************/
2971 +void cradle_cleanup(void)
2973 + /* unregister the device */
2974 + unregister_chrdev( CRADLE_MAJOR, "cradle");
2977 + /* printk(KERN_INFO "cradle: cleanup\n"); */
2981 +module_init(cradle_init);
2982 +module_exit(cradle_cleanup);
2983 diff -urN linux-2.4.26/drivers/char/lh79520_wdt.c linux-2.4.26-vrs1-lnode80/drivers/char/lh79520_wdt.c
2984 --- linux-2.4.26/drivers/char/lh79520_wdt.c 1969-12-31 20:00:00.000000000 -0400
2985 +++ linux-2.4.26-vrs1-lnode80/drivers/char/lh79520_wdt.c 2005-11-02 17:37:31.000000000 -0400
2988 + * Watchdog driver for the LH79520
2990 + * (c) Copyright 2000 Oleg Drokin <green@crimea.edu>
2991 + * Based on SoftDog driver by Alan Cox <alan@redhat.com>
2993 + * This program is free software; you can redistribute it and/or
2994 + * modify it under the terms of the GNU General Public License
2995 + * as published by the Free Software Foundation; either version
2996 + * 2 of the License, or (at your option) any later version.
2998 + * Neither Oleg Drokin nor iXcelerator.com admit liability nor provide
2999 + * warranty for any of this software. This material is provided
3000 + * "AS-IS" and at no charge.
3002 + * (c) Copyright 2000 Oleg Drokin <green@crimea.edu>
3004 + * 27/11/2000 Initial release
3007 +#include <linux/module.h>
3008 +#include <linux/config.h>
3009 +#include <linux/types.h>
3010 +#include <linux/kernel.h>
3011 +#include <linux/fs.h>
3012 +#include <linux/mm.h>
3013 +#include <linux/miscdevice.h>
3014 +#include <linux/watchdog.h>
3015 +#include <linux/reboot.h>
3016 +#include <linux/smp_lock.h>
3017 +#include <linux/init.h>
3018 +#include <asm/uaccess.h>
3019 +#include <asm/hardware.h>
3020 +#include <asm/bitops.h>
3022 +#include "lh79520_wdt.h"
3024 +unsigned int hclkfreq_get( void);
3026 +#define TIMER_MARGIN 60 /* default in seconds */
3028 +#define PCLK 51609600 /* ticks per second of AHB clock, 51MHz */
3030 +#define PCLK hclkfreq_get()
3032 +#define SLEEP_TIME 10 /* number of seconds between each counter reload */
3034 +static int lh79520_margin = TIMER_MARGIN; /* in seconds */
3035 +static int lh79520wdt_users; /* mutex */
3037 +static int irq = 0x1c; /* FIQ. Normally 0x18 for standard irq */
3039 +static int irq = 0x18; /* IRQ. Normally the FIQ is 0x1c */
3042 +#define WDTBase 0xFFFE3000L /* Base Address for all LH79520 Watchdog Registers */
3043 +WDTIMERREGS *wtdregs = (WDTIMERREGS *) WDTBase;
3046 +MODULE_PARM(lh79520_margin,"i");
3050 + * Allow only one person to hold it open
3053 +static int lh79520dog_open(struct inode *inode, struct file *file)
3055 + if(test_and_set_bit(1,&lh79520wdt_users))
3057 + MOD_INC_USE_COUNT;
3059 + if ((lh79520_margin > (PCLK / 0xffffffff)) || /* 83 seconds max, 20 sec min margin */
3060 + (lh79520_margin <= SLEEP_TIME * 2))
3061 + lh79520_margin = TIMER_MARGIN;
3063 +/* setting bits 7-4 of WDCTLR to 0x0 through 0xF sets the *initial* counter value upon a reset */
3064 +/* 0x0 is 2^16 tics of PCLK, or reset immediatly, 0x10 is 2^17 tics of PCLK, ... */
3065 +/* 0xF is 2^31 tics of PCLK, if PCLK is 51 MHz, 2^31 / 51 MHz = 41.6 seconds */
3066 +/* WDCTLR=0xF, the F sets initial counter to 41.6 seconds (assuming PCLK is 51 MHz) */
3067 +/* The counter will be set to the user selected margin the first time a reload occurs */
3068 + wtdregs->wdctlr |= 0xF0;
3070 + /* Activate LH79520 Watchdog timer */
3071 + wtdregs->wdctlr |= WDT_CTRL_ENABLE;
3072 + ///wtdregs->wdctlr |= WDT_CTRL_FRZ_ENABLE;
3073 + // The 1 sets the enable bit (bit 0) to 1 enabling the watchdog fuctionality
3074 + // The freeze or lock bit (bit 4) makes bit 0 read-only (to avoid accidental disabling)
3075 + // Bit 1 is left at 0 signifing that when the counter reaches 0, a machine reset occurs
3076 + // If bit 1 were 1, then the first time the counter reached 0 an interrupt occurs, and
3077 + // the second time the counter reaches 0 the machine is reset.
3079 + // Now reset Watchdog to let the above settings take effect
3080 + wtdregs->wdcntr = WDT_WDCNTR; // 0x1984 is a special reset value
3084 +static int lh79520dog_release(struct inode *inode, struct file *file)
3087 + * Shut off the timer.
3088 + * Lock it in if it's a module and we defined ...NOWAYOUT
3090 + ///wtdregs->wdctr |= 0x0; // turns off bit 4 the freeze lock so we can write to bit 0
3091 + wtdregs->wdctlr |= WDT_CTRL_DISABLE; // turns off watchdog bit 0
3093 + lh79520wdt_users = 0;
3094 + MOD_DEC_USE_COUNT;
3098 +static ssize_t lh79520dog_write(struct file *file, const char *data, size_t len, loff_t *ppos)
3100 + /* Can't seek (pwrite) on this device */
3101 + if (ppos != &file->f_pos)
3104 + /* Refresh/reload counter */
3106 + unsigned int count = (lh79520_margin * PCLK);
3107 + wtdregs->wdcnt3 = count && 0xFF000000;
3108 + wtdregs->wdcnt2 = count && 0x00FF0000;
3109 + wtdregs->wdcnt1 = count && 0x0000FF00;
3110 + wtdregs->wdcnt0 = count && 0x000000FF;
3116 +static int lh79520dog_ioctl(struct inode *inode, struct file *file,
3117 + unsigned int cmd, unsigned long arg)
3119 + static struct watchdog_info ident = {
3120 + identity: "LH79520 Watchdog",
3125 + return -ENOIOCTLCMD;
3126 + case WDIOC_GETSUPPORT:
3127 + return copy_to_user((struct watchdog_info *)arg, &ident, sizeof(ident));
3128 + case WDIOC_GETSTATUS:
3129 + return put_user(0,(int *)arg);
3130 + case WDIOC_GETBOOTSTATUS: /* 1 = last reboot was cause by watchdog, 0 means no */
3131 + return put_user( ! (wtdregs->wdtstr & WDT_WD_NWDRES), (int *)arg);
3132 + case WDIOC_KEEPALIVE:
3134 + unsigned int count = (lh79520_margin * PCLK);
3135 + wtdregs->wdcnt3 = count && 0xFF000000;
3136 + wtdregs->wdcnt2 = count && 0x00FF0000;
3137 + wtdregs->wdcnt1 = count && 0x0000FF00;
3138 + wtdregs->wdcnt0 = count && 0x000000FF;
3145 + * lh79520dog_interrupt:
3146 + * @irq: Interrupt number
3147 + * @dev_id: Unused as we don't allow multiple devices.
3150 + * Handle an interrupt from the board. These are raised when the status
3151 + * map changes in what the board considers an interesting way. That means
3152 + * a failure condition occuring.
3155 +void lh79520dog_interrupt(int irq, void *dev_id, struct pt_regs *regs)
3158 + * Read the status register see what is up and
3162 + unsigned char status=wtdregs->wdtstr;
3164 +/* status|=FEATUREMAP1;
3165 + status&=~FEATUREMAP2; */
3167 + printk(KERN_CRIT "WDT status %d\n", status);
3169 + wtdregs->wdcntr = WDT_WDCNTR; // 0x1984 is a special reset value
3171 + if(!(status&WDC_SR_TGOOD))
3172 + printk(KERN_CRIT "Overheat alarm.(%d)\n",inb_p(WDT_RT));
3173 + if(!(status&WDC_SR_PSUOVER))
3174 + printk(KERN_CRIT "PSU over voltage.\n");
3175 + if(!(status&WDC_SR_PSUUNDR))
3176 + printk(KERN_CRIT "PSU under voltage.\n");
3177 + if(!(status&WDC_SR_FANGOOD))
3178 + printk(KERN_CRIT "Possible fan fault.\n");
3179 + if(!(status&WDC_SR_WCCR))
3180 +#ifdef SOFTWARE_REBOOT
3181 +#ifdef ONLY_TESTING
3182 + printk(KERN_CRIT "Would Reboot.\n");
3184 + printk(KERN_CRIT "Initiating system reboot.\n");
3185 + machine_restart(NULL);
3188 + printk(KERN_CRIT "Reset in 5ms.\n");
3194 +static struct file_operations lh79520dog_fops=
3196 + owner: THIS_MODULE,
3197 + write: lh79520dog_write,
3198 + ioctl: lh79520dog_ioctl,
3199 + open: lh79520dog_open,
3200 + release: lh79520dog_release,
3203 +static struct miscdevice lh79520dog_miscdev=
3206 + "LH79520 watchdog",
3210 +static int __init lh79520dog_init(void)
3214 + ret = misc_register(&lh79520dog_miscdev);
3221 +// ret = request_irq(irq, lh79520dog_interrupt, SA_INTERRUPT, "lh79520wdt", NULL);
3223 +// printk(KERN_ERR "wdt: IRQ %d is not free.\n", irq);
3227 + printk("LH79520 Watchdog Timer: timer margin %d sec\n", lh79520_margin);
3234 + misc_deregister(&lh79520dog_miscdev);
3239 +static void __exit lh79520dog_exit(void)
3241 + misc_deregister(&lh79520dog_miscdev);
3244 +module_init(lh79520dog_init);
3245 +module_exit(lh79520dog_exit);
3246 diff -urN linux-2.4.26/drivers/char/lh79520_wdt.h linux-2.4.26-vrs1-lnode80/drivers/char/lh79520_wdt.h
3247 --- linux-2.4.26/drivers/char/lh79520_wdt.h 1969-12-31 20:00:00.000000000 -0400
3248 +++ linux-2.4.26-vrs1-lnode80/drivers/char/lh79520_wdt.h 2005-11-02 17:37:31.000000000 -0400
3250 +/**********************************************************************
3251 + * $Workfile: LH79520_wdt.h $
3252 + * $Revision: 1.1.1.1 $
3254 + * $Date: 2003/01/04 17:20:29 $
3256 + * Project: LH79520 headers
3259 + * This file contains the structure definitions and manifest
3260 + * constants for LH79520 component:
3264 + * (1) ARM Isis Technical Reference Manual, System on Chip Group,
3265 + * ARM SC063-TRM-0001-B
3267 + * COPYRIGHT (C) 2001 SHARP MICROELECTRONICS OF THE AMERICAS, INC.
3269 + *********************************************************************/
3271 +#ifndef LH79520_WDT_H
3272 +#define LH79520_WDT_H
3275 + * Watchdog Timer Module Register Structure
3278 + volatile unsigned int wdctlr; /* Control */
3279 + volatile unsigned int wdcntr; /* Counter Reset */
3280 + volatile unsigned int wdtstr; /* Test */
3281 + volatile unsigned int wdcnt0; /* Counter Bits [7:0] */
3282 + volatile unsigned int wdcnt1; /* Counter Bits [15:8] */
3283 + volatile unsigned int wdcnt2; /* Counter Bits [23:16] */
3284 + volatile unsigned int wdcnt3; /* Counter Bits [31:24] */
3287 +/**********************************************************************
3288 + * Watchdog Timer Register Bit Fields
3289 + *********************************************************************/
3291 +/**********************************************************************
3292 + * Watchdog Control Register Bit Fields
3293 + *********************************************************************/
3294 +#define WDT_CTRL_DISABLE 0
3295 +#define WDT_CTRL_ENABLE _SBF(0,1)
3296 +#define WDT_CTRL_RSP_FIQ _SBF(1,0)
3297 +#define WDT_CTRL_RSP_RESET _SBF(1,1)
3298 +#define WDT_CTRL_FRZ_ENABLE _BIT(3)
3299 +#define WDT_CTRL_TOP _SBF(4,((n)&0xF)
3301 +/**********************************************************************
3302 + * Watchdog Counter Reset Register Bit Fields
3303 + *********************************************************************/
3304 +#define WDT_WDCNTR (0x1984)
3306 +/**********************************************************************
3307 + * Watchdog Register Bit Fields
3308 + *********************************************************************/
3309 +#define WDT_WD_NWDFIQ _BIT(7)
3310 +#define WDT_WD_NWDRES _BIT(6)
3312 +#endif /* LH79520_WDT_H */
3313 diff -urN linux-2.4.26/drivers/char/Makefile linux-2.4.26-vrs1-lnode80/drivers/char/Makefile
3314 --- linux-2.4.26/drivers/char/Makefile 2005-11-02 16:54:20.000000000 -0400
3315 +++ linux-2.4.26-vrs1-lnode80/drivers/char/Makefile 2005-11-02 17:37:31.000000000 -0400
3320 -obj-y += mem.o tty_io.o n_tty.o tty_ioctl.o raw.o pty.o misc.o random.o
3321 +obj-y += mem.o tty_io.o n_tty.o tty_ioctl.o raw.o pty.o misc.o random.o cradle.o
3323 # All of the (potential) objects that export symbols.
3324 # This list comes from 'grep -l EXPORT_SYMBOL *.[hc]'.
3326 obj-$(CONFIG_SCx200_WDT) += scx200_wdt.o
3327 obj-$(CONFIG_WAFER_WDT) += wafer5823wdt.o
3328 obj-$(CONFIG_SA1100_WATCHDOG) += sa1100_wdt.o
3329 +obj-$(CONFIG_LH79520_WATCHDOG) += lh79520_wdt.o
3330 obj-$(CONFIG_EPXA_WATCHDOG) += epxa_wdt.o
3331 obj-$(CONFIG_OMAHA_WATCHDOG) += omaha_wdt.o
3332 obj-$(CONFIG_SOFT_WATCHDOG) += softdog.o
3333 @@ -359,6 +360,12 @@
3335 obj-$(CONFIG_I2C_DS1307) += ds1307.o
3337 +# Specific to the LH79520 Sharp dev board.
3338 +# Controls both PWM0 and PWM1
3339 +# PWM0 is the backlighting
3340 +# PWM1 is the audio
3341 +obj-$(CONFIG_LH79520_PWM) += pwm520.o
3343 subdir-$(CONFIG_MWAVE) += mwave
3344 ifeq ($(CONFIG_MWAVE),y)
3345 obj-y += mwave/mwave.o
3346 diff -urN linux-2.4.26/drivers/char/pwm520.c linux-2.4.26-vrs1-lnode80/drivers/char/pwm520.c
3347 --- linux-2.4.26/drivers/char/pwm520.c 1969-12-31 20:00:00.000000000 -0400
3348 +++ linux-2.4.26-vrs1-lnode80/drivers/char/pwm520.c 2005-11-02 17:37:31.000000000 -0400
3351 + * linux/drivers/char/pwm520.c
3353 + * Copyright (C) 2002 Lineo.
3355 + * Original code write was authored by Craig Matsuura <cmatsuura@lineo.com>
3356 + * Parts of this code are from Sharp.
3357 + * This code falls under the license of the GPL.
3359 + * This modules is for controlling the PWM audio and backlighting.
3360 + * Jumps for backlighting and audio must be set correctly on the LH79520
3361 + * Board for this module to work properly. See Sharp LH79520 Documentation
3362 + * for jumper settings.
3365 +#include <linux/config.h>
3366 +#include <linux/delay.h>
3367 +#include <linux/types.h>
3368 +#include <linux/fcntl.h>
3369 +#include <linux/fs.h>
3370 +#include <linux/init.h>
3371 +#include <linux/ioctl.h>
3372 +#include <asm/irq.h>
3373 +#include <asm/segment.h>
3374 +#include <asm/uaccess.h>
3375 +#include <linux/module.h>
3376 +//#include <limits.h>
3377 +#include <asm/arch/rcpc.h>
3378 +#include <asm/arch/iocon.h>
3379 +#include <asm/arch/hardware.h>
3381 +#include "pwm520.h"
3383 +pwmRegs_t *pwmregs = (pwmRegs_t *) IO_ADDRESS( PWM_PHYS);
3384 +ioconRegs_t *ioconregs = (ioconRegs_t *)IO_ADDRESS( IOCON_PHYS);
3385 +rcpcRegs_t *rcpcregs = (rcpcRegs_t *)IO_ADDRESS( RCPC_PHYS);
3387 +#define TYPE(dev) (MINOR(dev) >> 4) /* high nibble */
3388 +#define NUM(dev) (MINOR(dev) & 0xf) /* low nibble */
3390 +#define PCLK 51609600 /* ticks per second of AHB clock, 51MHz */
3391 +static int pwm_xtal_freq = XTAL_IN; // From hardware.h
3392 +static int pwm_clkin_freq = 0; // PLL_CLOCK? LH79520_CLKIN_FREQ;
3394 +unsigned int hclkfreq_get( void);
3397 +static int pwm_major = 0; // Major Number for Driver 0 indicates dynamic assignment
3398 +static int pwm_prescale = 1;
3400 +// Default Freq and Duty Cycles
3401 +static int pwm_audio_freq = 440; // Freq of tone
3402 +static int pwm_audio_dcycle = 50; // Duty Cycle for Audio
3403 +static int pwm_audio_duration = 100000;// Delay (udelay) for beep
3405 +static int pwm_backlight_dcycle = 100;// DC for Backlight
3406 +static int pwm_backlight_mode = 0; // Normal Mode
3407 +static int pwm_backlight_freq = BACKLIGHT_INVERTER_PWM_FREQUENCY; // Freq of backlight
3410 +MODULE_PARM(pwm_major,"i");
3411 +MODULE_PARM(pwm_prescale,"i");
3412 +MODULE_PARM(pwm_xtal_freq,"i");
3413 +MODULE_PARM(pwm_clkin_freq,"i");
3414 +MODULE_PARM(pwm_audio_freq,"i");
3415 +MODULE_PARM(pwm_audio_dcycle,"i");
3416 +MODULE_PARM(pwm_audio_duration,"i");
3417 +MODULE_PARM(pwm_backlight_dcycle,"i");
3418 +MODULE_PARM(pwm_backlight_mode,"i");
3419 +MODULE_PARM(pwm_backlight_freq,"i");
3423 +//void showPWM0Registers();
3426 +/**********************************************************************
3428 +* Function: rcpc_get_bus_clock - From Sharp Source
3431 +* return the frequency of the bus clock.
3434 +* this function returns the frequency of the bus clock in Hz
3435 +* based on the value of frequencies passed in and the value
3436 +* of the RCPC control register CLK_SEL bit.
3439 +* xtalin: the frequency at the XTALIN pin; use 0 if there is no
3440 +* crystal or external clock driving the pin.
3441 +* clkin: the frequency driving the CLKIN pin; use 0 if that pin
3447 +* The bus clock frequency in Hz
3450 +* The nominal crystal input frequency in 14745600 Hz.
3452 +**********************************************************************/
3453 +volatile unsigned long rcpc_get_bus_clock(unsigned long xtalin, unsigned long clkin)
3455 + unsigned long timebase, divider;
3457 + if ( (rcpcregs->control & RCPC_CTRL_CLKSEL_EXT)
3458 + == RCPC_CTRL_CLKSEL_EXT)
3460 + /* clock source is external clock */
3465 + /* clock source is from PLL output */
3466 + timebase = xtalin * 21;
3469 + divider = rcpcregs->HCLKPrescale * 2;
3473 + return timebase / divider;
3477 +/**********************************************************************
3479 +* Function: pwm1_enable - Taken for Sharp Driver Example code
3482 +* Enable PWM output on the PWM1 channel of the LH79520
3495 +**********************************************************************/
3496 +inline volatile void pwm1_enable(void)
3498 + pwmregs->pwm1.enable = PWM_EN_ENABLE;
3501 +/**********************************************************************
3503 +* Function: pwm1_disable - Taken for Sharp Driver Example code
3506 +* Disable PWM output on the PWM1 channel of the LH79520
3519 +**********************************************************************/
3520 +inline volatile void pwm1_disable(void)
3522 + pwmregs->pwm1.enable = ~PWM_EN_ENABLE;
3525 +/**********************************************************************
3527 +* Function: pwm0_enable - Taken for Sharp Driver Example code
3530 +* Enable PWM output on the PWM0 channel of the LH79520
3543 +**********************************************************************/
3544 +inline volatile void pwm0_enable(void)
3546 + pwmregs->pwm0.enable = PWM_EN_ENABLE;
3549 +/**********************************************************************
3551 +* Function: pwm0_disable - Taken for Sharp Driver Example code
3554 +* Disable PWM output on the PWM0 channel of the LH79520
3567 +**********************************************************************/
3568 +inline volatile void pwm0_disable(void)
3570 + pwmregs->pwm0.enable = ~PWM_EN_ENABLE;
3573 +/**********************************************************************
3575 +* Function: pwm0_normal - Taken for Sharp Driver Example code146
3578 +* Restores the normal sense of the PWM output signal on the PWM0
3579 +* channel of the LH79520
3592 +**********************************************************************/
3593 +inline volatile void pwm0_normal(void)
3595 + pwmregs->pwm0.invert = ~PWM_INV_INVERT;
3599 +/**********************************************************************
3601 +* Function: pwm1_frequency - Taken for Sharp Driver Example code
3604 +* Sets the PWM1 output frequency to the value specified
3607 +* Compute the prescale and period count to be programmed from the
3608 +* PCLK frequency. If the frequency value is too high or too low to
3609 +* be programmed within the permissible ranges of prescale and period,
3613 +* freq - Desired frequency, in Hz
3618 +* -1 - if frequency specified is zero
3619 +* -1 - if prescale is zero (an impossible condition)
3620 +* -1 - if the frequency is out of bounds
3621 +* 0 - if the frequency is changed successfully
3624 +* This function depends on the values of LH79520_XTAL_FREQ and
3625 +* LH79520_CLKIN_FREQ to be set correctly in the LH79520_evb.h file.
3626 +* If external clock is used, LH79520_CLKIN_FREQ should be set
3627 +* to the external clock frequency. Otherwise, this function will
3631 +**********************************************************************/
3632 +long pwm1_frequency(unsigned long freq)
3634 + unsigned long pclk, pwm1clk, prescale;
3635 + unsigned long div;
3642 + pclk = rcpc_get_bus_clock(pwm_xtal_freq,pwm_clkin_freq);
3644 + pclk = hclkfreq_get();
3646 + prescale = rcpcregs->PWM1Prescale;
3647 + if (prescale > 0) {
3648 + pwm1clk = pclk / (prescale * 2);
3650 + printk("<4>THIS IS BAD. SHOULD NOT GET HERE...\n");
3651 + //this should not happen
3654 + div = pwm1clk / freq;
3655 + rcpcregs->control |= RCPC_CTRL_WRTLOCK_ENABLED;
3658 + while (div > USHRT_MAX && prescale <= SHRT_MAX) {
3660 + rcpcregs->PWM1Prescale = prescale;
3661 + pwm1clk = pclk / (prescale * 2);
3662 + div = pwm1clk / freq;
3664 + rcpcregs->control &= ~RCPC_CTRL_WRTLOCK_ENABLED;
3665 + pwmregs->pwm1.tc = div;
3671 +/**********************************************************************
3673 +* Function: pwm1_duty_cycle - Taken for Sharp Driver Example code
3676 +* Sets the PWM1 duty cycle to the value specified
3679 +* Compute the duty cycle count to program into the dc register
3680 +* from the percentage specified and the tc count. Accounts for
3681 +* integer division truncation errors.
3684 +* dcpercent - Desired duty cycle as a percentage of the total period
3689 +* the previous value of the duty cycle, as a percentage
3693 +**********************************************************************/
3694 +long pwm1_duty_cycle(short dcpercent)
3696 + unsigned short period;
3697 + unsigned long duty_cycle, prev_dc, prev_dc_percent;
3698 + period = (unsigned short) pwmregs->pwm1.tc;
3699 + prev_dc = pwmregs->pwm1.dc;
3701 + prev_dc_percent = ((prev_dc * 100) + (period >> 1)) / period;
3703 + prev_dc_percent = 100;
3705 + duty_cycle = ((dcpercent * period) + 50) / 100;
3706 + pwmregs->pwm1.dc = duty_cycle;
3707 + return(long)prev_dc_percent;
3710 +/**********************************************************************
3712 +* Function: pwm0_frequency - Taken for Sharp Driver Example code
3715 +* Sets the PWM0 output frequency to the value specified
3718 +* Compute the prescale and period count to be programmed from the
3719 +* PCLK frequency. If the frequency value is too high or too low to
3720 +* be programmed within the permissible ranges of prescale and period,
3724 +* freq - Desired frequency, in Hz
3729 +* -1 - if frequency specified is zero
3730 +* -1 - if prescale is zero (an impossible condition)
3731 +* -1 - if the frequency is out of bounds
3732 +* 0 - if the frequency is changed successfully
3735 +* This function depends on the values of LH79520_XTAL_FREQ and
3736 +* LH79520_CLKIN_FREQ to be set correctly in the LH79520_evb.h file.
3737 +* If external clock is used, LH79520_CLKIN_FREQ should be set
3738 +* to the external clock frequency. Otherwise, this function will
3742 +**********************************************************************/
3743 +long pwm0_frequency(unsigned long freq)
3745 + unsigned long pclk, pwm0clk, prescale;
3746 + unsigned long div;
3753 + pclk = rcpc_get_bus_clock(pwm_xtal_freq,pwm_clkin_freq);
3755 + pclk = hclkfreq_get();
3757 + prescale = rcpcregs->PWM0Prescale;
3758 + if (prescale > 0) {
3759 + pwm0clk = pclk / (prescale * 2);
3761 + printk("<4>THIS IS BAD. SHOULD NOT GET HERE...\n");
3762 + //this should not happen
3765 + div = pwm0clk / freq;
3766 + rcpcregs->control |= RCPC_CTRL_WRTLOCK_ENABLED;
3769 + //FJB hack for orderite
3770 + rcpcregs->PWM0Prescale = 0x0a;
3772 + while (div > USHRT_MAX && prescale <= SHRT_MAX) {
3774 + rcpcregs->PWM0Prescale = prescale;
3775 + pwm0clk = pclk / (prescale * 2);
3776 + div = pwm0clk / freq;
3779 + rcpcregs->control &= ~RCPC_CTRL_WRTLOCK_ENABLED;
3780 + //pwmregs->pwm0.tc = div;
3781 + pwmregs->pwm0.tc = 0x285;
3787 +/**********************************************************************
3789 +* Function: pwm0_duty_cycle - Taken for Sharp Driver Example code
3792 +* Sets the PWM0 duty cycle to the value specified
3795 +* Compute the duty cycle count to program into the dc register
3796 +* from the percentage specified and the tc count. Accounts for
3797 +* integer division truncation errors.
3800 +* dcpercent - Desired duty cycle as a percentage of the total period
3805 +* the previous value of the duty cycle, as a percentage
3809 +**********************************************************************/
3810 +long pwm0_duty_cycle(short dcpercent)
3812 + unsigned short period;
3813 + unsigned long duty_cycle, prev_dc, prev_dc_percent;
3814 + period = (unsigned short) pwmregs->pwm0.tc;
3815 + prev_dc = pwmregs->pwm0.dc;
3817 + prev_dc_percent = ((prev_dc * 100) + (period >> 1)) / period;
3819 + prev_dc_percent = 100;
3821 + duty_cycle = ((dcpercent * period) + 50) / 100;
3822 + pwmregs->pwm0.dc = duty_cycle;
3823 + return(long)prev_dc_percent;
3826 +/**********************************************************************
3828 +* Function: backlight_decrease_brightness
3831 +* Decrease the LCD backlight brightness
3834 +* Decrement static variable holding current brightness level and
3835 +* set the PWM duty cycle.
3845 +**********************************************************************/
3846 +void backlight_increase_brightness(void)
3848 + pwm_backlight_dcycle--;
3849 + if (pwm_backlight_dcycle < 0)
3851 + pwm_backlight_dcycle = 0;
3853 + pwm0_duty_cycle(pwm_backlight_dcycle);
3856 +/**********************************************************************
3858 +* Function: backlight_increase_brightness
3861 +* Increase the LCD backlight brightness
3864 +* Increment static variable holding current brightness level and
3865 +* set the PWM duty cycle.
3875 +**********************************************************************/
3876 +void backlight_decrease_brightness(void)
3878 + pwm_backlight_dcycle++;
3879 + if (pwm_backlight_dcycle > 100)
3881 + pwm_backlight_dcycle = 100;
3883 + pwm0_duty_cycle(pwm_backlight_dcycle);
3886 +/**********************************************************************
3888 +* Function: backlight_set_brightness
3891 +* Set the LCD backlight brightness to the level specified
3897 +* bright - desired brightness level as a percentage of maximum
3906 +**********************************************************************/
3907 +void backlight_set_brightness(int bright)
3909 + //bright = 0 means least brightness
3910 + //bright = 100 means max brightness
3920 + pwm_backlight_dcycle = 100 - bright;
3921 + pwm0_duty_cycle(pwm_backlight_dcycle);
3925 +/****************************************************************************
3926 + * Open Function - Open the device either the Backlight or the Audio
3927 + * /dev/pwm0 c 254 1 is the Backlighting
3928 + * /dev/pwm1 c 254 0 is the Audio
3929 + * Keep in mind the 254 is only an example. If you do not specify a
3930 + * major code then a dynamic one will be assigned. You will have to
3931 + * look at /proc/devices to see the major code for pwm
3933 +int pwm_open(struct inode * inode, struct file * filp)
3936 + MOD_INC_USE_COUNT;
3938 +// printk("<4>open pwm... dc=%d, bl_dc=%d\n",pwmregs->pwm0.dc,pwm_backlight_dcycle);
3939 + switch (NUM(inode->i_rdev)) {
3941 + rcpcregs->control |= RCPC_CTRL_WRTLOCK_ENABLED;
3943 + rcpcregs->periphClkCtrl &= ~RCPC_CLKCTRL_PWM0_DISABLE;
3944 + rcpcregs->PWM0Prescale = ((~_BIT(15)) & pwm_prescale);
3945 + rcpcregs->control &= ~RCPC_CTRL_WRTLOCK_ENABLED;
3946 + ioconregs->MiscMux |= MISCMUX_PWM0;
3949 + case 1: // Backlight
3950 + rcpcregs->control |= RCPC_CTRL_WRTLOCK_ENABLED;
3952 + rcpcregs->periphClkCtrl &= ~RCPC_CLKCTRL_PWM1_DISABLE;
3953 + rcpcregs->PWM0Prescale = ((~_BIT(15)) & pwm_prescale);
3954 + rcpcregs->control &= ~RCPC_CTRL_WRTLOCK_ENABLED;
3955 + ioconregs->MiscMux |= MISCMUX_PWM1;
3957 + if (pwm_backlight_mode) {
3958 + pwmregs->pwm0.sync = PWM_SYNC_SYNC;
3959 + ioconregs->MiscMux |= MISCMUX_PWM0SYNC;
3963 + pwmregs->pwm0.sync = PWM_SYNC_NORMAL;
3966 + pwm0_frequency(pwm_backlight_freq);
3967 + pwm0_duty_cycle(pwm_backlight_dcycle);
3973 + printk("<4>Minor device unknown %d\n",NUM(inode->i_rdev));
3980 +/****************************************************************************
3983 +int pwm_release(struct inode *inode, struct file * filp)
3985 +// printk("<4>release pwm...\n");
3986 + switch (NUM(inode->i_rdev)) {
3988 + rcpcregs->control |= RCPC_CTRL_WRTLOCK_ENABLED;
3990 + rcpcregs->periphClkCtrl |= RCPC_CLKCTRL_PWM0_DISABLE;
3991 + rcpcregs->control &= ~RCPC_CTRL_WRTLOCK_ENABLED;
3992 + ioconregs->MiscMux &= ~MISCMUX_PWM0;
3995 + case 1: // Should be backlight of touchscreen
3996 + //rcpcregs->control |= RCPC_CTRL_WRTLOCK_ENABLED;
3998 + //rcpcregs->periphClkCtrl |= RCPC_CLKCTRL_PWM0_DISABLE;
3999 + //rcpcregs->control &= ~RCPC_CTRL_WRTLOCK_ENABLED;
4000 + //ioconregs->MiscMux &= ~MISCMUX_PWM0;
4001 + //pwmregs->pwm0.enable = ~PWM_EN_ENABLE;
4005 + printk("<4>Minor device unknown %d\n",NUM(inode->i_rdev));
4009 + MOD_DEC_USE_COUNT;
4013 +/****************************************************************************
4016 +ssize_t pwm_read(struct file * file, char * buf,
4017 + size_t count, loff_t *ppos)
4022 +/****************************************************************************
4025 +ssize_t pwm_write(struct file * file, const char * buf,
4026 + size_t count, loff_t *ppos)
4031 +/****************************************************************************
4034 +int pwm_ioctl(struct inode *inode, struct file * file,
4035 + unsigned int cmd, unsigned long arg)
4037 + //int err = 0, size = _IOC_SIZE(cmd);
4039 + if (_IOC_TYPE(cmd) != PWM520_IOC_MAGIC) {
4042 + if (_IOC_NR(cmd) > PWM520_IOC_MAXNR) {
4047 + Should check for direction bits see page 101 in "Linux Device Drivers Book"
4048 + size and err used here.
4051 + switch (NUM(inode->i_rdev)) {
4054 + case PWM520_IOCBEEP:
4055 + pwm0_frequency(pwm_audio_freq);
4056 + pwm0_duty_cycle(pwm_audio_dcycle);
4058 + udelay(pwm_audio_duration);
4062 + case PWM520_IOCSTARTSND:
4063 + pwm0_frequency(pwm_audio_freq);
4064 + pwm0_duty_cycle(pwm_audio_dcycle);
4068 + case PWM520_IOCSTOPSND:
4072 + case PWM520_IOCSETFREQ: // Set Frequency
4073 + pwm_audio_freq = arg;
4076 + case PWM520_IOCSETDCYCLE: // Set Duty Cycle
4077 + pwm_audio_dcycle = arg;
4080 + case PWM520_IOCGETFREQ: // Get Frequency
4081 + __put_user(pwm_audio_freq, (int *) arg);
4084 + case PWM520_IOCGETDCYCLE: // Get Duty Cycle
4085 + __put_user(pwm_audio_dcycle, (int *) arg);
4090 + case 1: // Should be backlight of touchscreen
4092 + case PWM520_IOCRESET:
4093 +// printk("Reset pwm0\n");
4094 + pwm_backlight_dcycle = 100;// DC for Backlight
4095 + pwm_backlight_mode = 0; // Normal Mode
4096 + pwm_backlight_freq = BACKLIGHT_INVERTER_PWM_FREQUENCY; // Freq of backlight
4098 + case PWM520_IOCSTOPPWM0: // Stop PWM0
4099 + rcpcregs->control |= RCPC_CTRL_WRTLOCK_ENABLED;
4101 + rcpcregs->periphClkCtrl |= RCPC_CLKCTRL_PWM0_DISABLE;
4102 + rcpcregs->control &= ~RCPC_CTRL_WRTLOCK_ENABLED;
4103 + ioconregs->MiscMux &= ~MISCMUX_PWM0;
4104 + pwmregs->pwm0.enable = ~PWM_EN_ENABLE;
4106 + case PWM520_IOCINCREASEBL:
4107 +// printk("Brighter\n");
4108 + backlight_increase_brightness();
4111 + case PWM520_IOCDECREASEBL:
4112 +// printk("Lighter\n");
4113 + backlight_decrease_brightness();
4116 + case PWM520_IOCSETBL:
4117 +// printk("Set to %ld\n",arg);
4118 + backlight_set_brightness(arg);
4130 +/****************************************************************************
4133 +struct file_operations pwm_fops = {
4134 + owner: THIS_MODULE,
4135 + llseek: no_llseek,
4140 + release: pwm_release,
4146 + printk("TEST CASE PLEASE REMOVE ONCE DONE\n");
4148 + rcpcregs->control |= RCPC_CTRL_WRTLOCK_ENABLED;
4150 + rcpcregs->periphClkCtrl &= ~RCPC_CLKCTRL_PWM1_DISABLE;
4151 + rcpcregs->PWM1Prescale = ((~_BIT(15)) & pwm_prescale);
4152 + rcpcregs->control &= ~RCPC_CTRL_WRTLOCK_ENABLED;
4153 + ioconregs->MiscMux |= MISCMUX_PWM1;
4155 + pwm1_frequency(pwm_audio_freq);
4156 + pwm1_duty_cycle(pwm_audio_dcycle);
4160 +void showPWM1Registers()
4162 + printk("PWM1 Registers\n");
4163 + printk("=============\n\n");
4164 + printk("pwm1.tc = %x\n",pwmregs->pwm1.tc);
4165 + printk("pwm1.dc = %x\n",pwmregs->pwm1.dc);
4166 + printk("pwm1.enable = %x\n",pwmregs->pwm1.enable);
4167 + printk("pwm1.invert = %x\n",pwmregs->pwm1.invert);
4168 + printk("pwm1.sync = %x\n",pwmregs->pwm1.sync);
4171 +void showPWM0Registers()
4173 + printk("PWM0 Registers\n");
4174 + printk("=============\n\n");
4175 + printk("pwm0.tc = %d\n",pwmregs->pwm0.tc);
4176 + printk("pwm0.dc = %d\n",pwmregs->pwm0.dc);
4177 + printk("pwm0.enable = 0x%x\n",pwmregs->pwm0.enable);
4178 + printk("pwm0.invert = 0x%x\n",pwmregs->pwm0.invert);
4179 + printk("pwm0.sync = 0x%x\n",pwmregs->pwm0.sync);
4184 +/****************************************************************************
4187 +static int __init pwm_init_module(void)
4191 + //printk("<1>Start PWM Module\n");
4192 + printk("<1>Sharp LH79520 PWM Driver Copyright 2002 Lineo\n");
4194 + result = register_chrdev(pwm_major,"pwm",&pwm_fops);
4196 + printk("<4>pwm: can't get major number %d\n",pwm_major);
4199 + if (pwm_major == 0) {
4200 + pwm_major = result; /* Dynamic Allocation of major number */
4201 + printk("<4>PWM Dynamic Major Number %d\n",pwm_major);
4207 +/****************************************************************************
4210 +static void __exit pwm_cleanup_module(void)
4214 + printk("<1>End PWM Module...\n");
4215 + result = unregister_chrdev(pwm_major,"pwm");
4218 +module_init(pwm_init_module);
4219 +module_exit(pwm_cleanup_module);
4220 diff -urN linux-2.4.26/drivers/char/pwm520.h linux-2.4.26-vrs1-lnode80/drivers/char/pwm520.h
4221 --- linux-2.4.26/drivers/char/pwm520.h 1969-12-31 20:00:00.000000000 -0400
4222 +++ linux-2.4.26-vrs1-lnode80/drivers/char/pwm520.h 2005-11-02 17:37:31.000000000 -0400
4225 + * linux/drivers/char/pwm520.h
4227 + * Copyright (C) 2002 Lineo.
4229 + * Original code write was authored by Craig Matsuura <cmatsuura@lineo.com>
4230 + * Parts of this code are from Sharp.
4231 + * This code falls under the license of the GPL.
4233 + * This modules is for controlling the PWM audio and backlighting.
4234 + * Jumps for backlighting and audio must be set correctly on the LH79520
4235 + * Board for this module to work properly. See Sharp LH79520 Documentation
4236 + * for jumper settings.
4242 + volatile unsigned int tc;
4243 + volatile unsigned int dc;
4244 + volatile unsigned int enable;
4245 + volatile unsigned int invert;
4246 + volatile unsigned int sync;
4247 + volatile unsigned int res[3];
4251 + volatile pwmXRegs_t pwm0;
4252 + volatile pwmXRegs_t pwm1;
4255 +extern pwmRegs_t *pwmregs;
4257 +#define PWM_EN_ENABLE _BIT(0)
4258 +#define PWM_INV_INVERT _BIT(0)
4259 +#define PWM_SYNC_SYNC _SBF(0,1)
4260 +#define PWM_SYNC_NORMAL _SBF(0,0)
4262 +#define BACKLIGHT_INVERTER_PWM_FREQUENCY (200) // 200Hz
4265 +#define PWM520_IOC_MAGIC 'p'
4266 +#define PWM520_IOCBEEP _IO(PWM520_IOC_MAGIC, 0)
4267 +#define PWM520_IOCSTARTSND _IO(PWM520_IOC_MAGIC, 1)
4268 +#define PWM520_IOCSTOPSND _IO(PWM520_IOC_MAGIC, 2)
4269 +#define PWM520_IOCSETFREQ _IOW(PWM520_IOC_MAGIC, 3, int)
4270 +#define PWM520_IOCSETDCYCLE _IOW(PWM520_IOC_MAGIC, 4, int)
4271 +#define PWM520_IOCGETFREQ _IOR(PWM520_IOC_MAGIC, 5, int)
4272 +#define PWM520_IOCGETDCYCLE _IOR(PWM520_IOC_MAGIC, 6, int)
4274 +#define PWM520_IOCRESET _IO(PWM520_IOC_MAGIC, 7)
4275 +#define PWM520_IOCSTOPPWM0 _IO(PWM520_IOC_MAGIC, 8)
4276 +#define PWM520_IOCINCREASEBL _IO(PWM520_IOC_MAGIC, 9)
4277 +#define PWM520_IOCDECREASEBL _IO(PWM520_IOC_MAGIC, 10)
4278 +#define PWM520_IOCSETBL _IOW(PWM520_IOC_MAGIC, 11, int)
4280 +#define PWM520_IOC_MAXNR 11
4282 diff -urN linux-2.4.26/drivers/misc/ads784x.c linux-2.4.26-vrs1-lnode80/drivers/misc/ads784x.c
4283 --- linux-2.4.26/drivers/misc/ads784x.c 1969-12-31 20:00:00.000000000 -0400
4284 +++ linux-2.4.26-vrs1-lnode80/drivers/misc/ads784x.c 2005-11-02 17:37:31.000000000 -0400
4286 +/* vi: set sw=4 ts=4 ai: */
4290 +#define TS_DATA_QTOPIA
4291 +#undef CONFIG_ADS7846
4293 +/**********************************************************************
4294 +* linux/drivers/misc/ads784x.c
4296 +* Provide ADS_784x (touchscreen) functionality for LH7x EVB boards
4298 +* Copyright (C) 2002 Lineo, Inc.
4300 +* This program is free software; you can redistribute it and/or modify
4301 +* it under the terms of the GNU General Public License (GPL) version 2
4302 +* as published by the Free Software Foundation.
4304 +**********************************************************************/
4306 +/**********************************************************************
4309 +* The driver sleeps when there is no pen on the screen. When a pen_down
4310 +* interrupt occurs, the pen_down interrupt handler wakes the polling thread.
4311 +* The polling thread polls the ADS chip SAMPLES_PER_SECOND. When the polling
4312 +* thread polls the ADS chip and the pen is no longer down, the polling
4313 +* thread goes to sleep and the pen_down interrupt handler is enabled.
4315 +* The ADS device sleeps between conversions to save power.
4317 +* The driver stores pen coordinates in a queue. An application can access
4318 +* the coordinate queue by opening and reading the associated device file
4319 +* (char major=10 minor=20). An application can poll the queue to see if
4320 +* it contains coordinates. If it does, the application can read a coordinate
4321 +* structure back. The coordinate queue is flushed when the application
4322 +* opens the device file.
4324 +**********************************************************************/
4326 +#include <linux/config.h>
4327 +#include <linux/types.h>
4328 +#include <linux/kernel.h>
4329 +#include <linux/init.h>
4330 +#include <linux/module.h>
4331 +#include <linux/delay.h>
4332 +#include <linux/proc_fs.h>
4333 +#include <linux/smp_lock.h>
4334 +#include <linux/miscdevice.h>
4335 +#include <linux/poll.h>
4339 +#define DRVNAME "ads_784x"
4340 +#include <linux/verbosedebug.h>
4342 +#include <linux/version.h>
4344 +char kernel_version[] = UTS_RELEASE;
4345 +#endif /* MODULE */
4349 +#if defined(CONFIG_ADS7846) && defined(CONFIG_PROC_FS)
4350 +# define PROC_TEMPERATURE
4351 +# define PROC_BATTERY
4354 +#ifdef PROC_BATTERY
4355 +static struct proc_dir_entry *ads_784x_proc_battery;
4357 +#ifdef PROC_TEMPERATURE
4358 +static struct proc_dir_entry *ads_784x_proc_temperature;
4361 +/*********************************************************************
4362 +* A couple of macros we use here...
4363 +*********************************************************************/
4365 +#define _BIT(n) (1 << (n))
4368 +#define _SBF(f,v) ((v) << (f))
4371 +#define _BITMASK(field_width) ( _BIT(field_width) - 1)
4374 +/**********************************************************************
4375 +* Define ADS 784x Control byte
4376 +**********************************************************************/
4378 +#define CTRL_S _BIT(7) /* Start bit (REQUIRED) */
4380 +// #define CTRL_ADDR(n) _SBF(4,(n&0x7))
4381 +#define CTRL_X _SBF(4,0x1) /* Read X value */
4382 +#define CTRL_Y _SBF(4,0x5) /* Read Y value */
4383 +#ifdef CONFIG_ADS7846
4384 +#define CTRL_P1 _SBF(4,0x3) /* Read P1 value */
4385 +#define CTRL_P2 _SBF(4,0x4) /* Read P2 value */
4386 +#define CTRL_BATTERY _SBF(4,0x2) /* Read BATTERY value */
4387 +#define CTRL_TEMP0 _SBF(4,0x0) /* Read Temperature-0 value */
4388 +#define CTRL_TEMP1 _SBF(4,0x7) /* Read Temperature-1 value */
4389 +#endif // CONFIG_ADS7846
4391 +// #define CTRL_MODE(n) _SBF(3,(n&0x1))
4392 +#define CTRL_12BIT _SBF(3,0x0) /* 12-Bit conversions */
4393 +#define CTRL_8BIT _SBF(3,0x1) /* 8-Bit conversions */
4395 +// #define CTRL_SER_DFR(n) _SBF(2,(n&0x1))
4396 +#define CTRL_SER _SBF(2,0x1) /* Single-Ended reference */
4397 +#define CTRL_DFR _SBF(2,0x0) /* Differential reference */
4399 +// #define CTRL_PD(n) (n&0x3)
4400 +#define CTRL_PD_ZERO (0x0) /* PenIRQ enabled - PowerDown after */
4401 +#define CTRL_PD_ONE (0x1) /* PenIRQ disabled - PowerDown after */
4402 +#define CTRL_PD_TWO (0x2) /* PenIRQ disabled - RESERVED */
4403 +#define CTRL_PD_THREE (0x3) /* PenIRQ disabled - Powered ON */
4405 +/**********************************************************************
4406 +* Define Simplified ADS 784x Control Codes
4407 +**********************************************************************/
4409 +//#define ADS_784x_PD 0 /* Power Down Settings */
4410 +//#define ADS_784x_PD_INIT 0 /* Init setting reference and ADC Off */
4412 +#define ADS_784x_INIT \
4413 + ( CTRL_S | CTRL_X | CTRL_12BIT | CTRL_DFR | CTRL_PD_ZERO)
4414 +#define ADS_784x_READ_X \
4415 + ( CTRL_S | CTRL_X | CTRL_12BIT | CTRL_DFR | CTRL_PD_ZERO)
4416 +#define ADS_784x_READ_Y \
4417 + ( CTRL_S | CTRL_Y | CTRL_12BIT | CTRL_DFR | CTRL_PD_ZERO)
4418 +#ifdef CONFIG_ADS7846
4419 +#define ADS_784x_READ_P1 \
4420 + ( CTRL_S | CTRL_P1 | CTRL_12BIT | CTRL_DFR | CTRL_PD_ZERO)
4421 +#define ADS_784x_READ_P2 \
4422 + ( CTRL_S | CTRL_P2 | CTRL_12BIT | CTRL_DFR | CTRL_PD_ZERO)
4423 +#define ADS_784x_READ_BATTERY \
4424 + ( CTRL_S | CTRL_BATTERY | CTRL_12BIT | CTRL_SER | CTRL_PD_ZERO)
4425 +#define ADS_784x_READ_TEMP0 \
4426 + ( CTRL_S | CTRL_TEMP0 | CTRL_12BIT | CTRL_SER | CTRL_PD_ZERO)
4427 +#define ADS_784x_READ_TEMP1 \
4428 + ( CTRL_S | CTRL_TEMP1 | CTRL_12BIT | CTRL_SER | CTRL_PD_ZERO)
4429 +#endif // CONFIG_ADS7846
4431 +/**********************************************************************
4432 +* Define our touchscreen data type
4434 +* This structure is nonsense - millisecs is not very useful
4435 +* since the field size is too small. Also, we SHOULD NOT
4436 +* be exposing jiffies to user space directly.
4437 +**********************************************************************/
4438 +typedef struct tsData_t tsData_t;
4440 +#ifdef TS_DATA_COLLIE
4441 +#define TS_DATA_STRUCT
4442 +#define PROVIDE_TS_MILLISECS
4447 + long long millisecs;
4451 +#ifdef TS_DATA_IPAQ
4452 +#define TS_DATA_STRUCT
4454 + unsigned short pressure;
4457 + unsigned short pad;
4461 +#ifdef TS_DATA_LH79X
4462 +#define TS_DATA_STRUCT
4464 + uint16_t pressure;
4465 + uint16_t y; /* Will be read as X */
4466 + uint16_t x; /* Will be read as Y */
4472 +QTopia data format:
4473 +unsigned char data2[5];
4474 +data.status=data2[0]; // bit 0x40 is "touch"/left mouse
4475 +data.xpos=(data2[1] << 8) | data2[2];
4476 +data.ypos=(data2[3] << 8) | data2[4];
4479 +#ifdef TS_DATA_QTOPIA
4480 +#define TS_DATA_STRUCT
4482 + unsigned char pressure;
4483 + unsigned char xhigh;
4484 + unsigned char xlow;
4485 + unsigned char yhigh;
4486 + unsigned char ylow;
4487 +} __attribute__ ((packed));
4490 +#ifndef TS_DATA_STRUCT
4491 +#define TS_DATA_DEFAULT
4492 +#define PROVIDE_TS_TIMESTAMP
4494 + uint16_t pressure;
4498 + struct timeval stamp;
4502 +#define MAX_TS_DATA 16
4504 +#define X_DELTA_MAX 10
4505 +#define Y_DELTA_MAX 10
4507 +/* Define the readings we are to take per second (default to 50) */
4508 +#define SAMPLES_PER_SECOND 10
4511 +* Define the pen down debounce we are to take.
4512 +* (default of 20 == 1/20 of a second)
4514 +#define DEBOUNCE_FRACTION_OF_A_SECOND 50
4516 +/**********************************************************************
4517 +* Define our ADS context structure
4518 +**********************************************************************/
4519 +typedef struct adsContext_t adsContext_t;
4520 +struct adsContext_t {
4523 + void (*write) (void *sspContext, unsigned int data);
4524 + unsigned int (*read) (void *sspContext);
4525 + int (*enable_pen_down_irq)(void *sspContext);
4526 + int (*disable_pen_down_irq)(void *sspContext);
4527 + int (*is_pen_down)(void *sspContext);
4528 + int (*lock)(void *sspContext, int device);
4529 + int (*unlock)(void *sspContext, int device);
4530 + void (*chipselect_enable)(void);
4531 + void (*chipselect_disable)(void);
4532 + void (*chipselect_manual)(void);
4534 + struct fasync_struct *fasync;
4535 + struct completion complete;
4536 + struct task_struct *rtask;
4538 + wait_queue_head_t read_wait;
4539 + wait_queue_head_t irq_wait;
4543 + tsData_t tsData[MAX_TS_DATA];
4545 +static adsContext_t adsContext_l;
4547 +/**********************************************************************
4548 +* Macro: ads_784x_tsData_pending
4549 +**********************************************************************/
4550 +#define ads_784x_tsData_pending(adsContext) \
4551 + ((adsContext)->tsDataHead != (adsContext)->tsDataTail)
4553 +/**********************************************************************
4554 +* Macro: ads_784x_tsData_get
4555 +**********************************************************************/
4556 +#define ads_784x_tsData_get(adsContext) \
4557 + ((adsContext)->tsData + (adsContext)->tsDataTail)
4559 +/**********************************************************************
4560 +* Macro: ads_784x_tsData_pull
4561 +**********************************************************************/
4562 +#define ads_784x_tsData_pull(adsContext) \
4563 + ((adsContext)->tsDataTail = \
4564 + ((adsContext)->tsDataTail + 1) & (MAX_TS_DATA - 1))
4566 +/**********************************************************************
4567 +* Macro: ads_784x_tsData_flush
4568 +**********************************************************************/
4569 +#define ads_784x_tsData_flush(adsContext) \
4570 + ((adsContext)->tsDataTail = (adsContext)->tsDataHead)
4572 +/**********************************************************************
4573 +* Function: ads_784x_tsData_add
4574 +**********************************************************************/
4575 +static inline void ads_784x_tsData_add(
4576 + adsContext_t *adsContext,
4577 + unsigned int pressure,
4582 + long xcoff, ycoff;
4584 + vdprintk("ENTER: ads_784x_tsData_add()\n");
4585 + next_head = (adsContext->tsDataHead + 1) & (MAX_TS_DATA - 1);
4586 + if (next_head != adsContext->tsDataTail) {
4587 +#ifndef TS_DATA_QTOPIA
4588 + adsContext->tsData[adsContext->tsDataHead].pressure = pressure;
4589 + adsContext->tsData[adsContext->tsDataHead].x = x;
4590 + adsContext->tsData[adsContext->tsDataHead].y = y;
4591 +#ifdef PROVIDE_TS_TIMESTAMP
4592 + get_fast_time(&adsContext->tsData[adsContext->tsDataHead].stamp);
4594 +#else // TS_DATA_QTOPIA
4595 + adsContext->tsData[adsContext->tsDataHead].pressure = pressure ? 0x40 : 0;
4596 + adsContext->tsData[adsContext->tsDataHead].xlow = x & 0xFF;
4597 + adsContext->tsData[adsContext->tsDataHead].xhigh = x >> 8;
4598 + adsContext->tsData[adsContext->tsDataHead].ylow = y & 0xFF;
4599 + adsContext->tsData[adsContext->tsDataHead].yhigh = y >> 8;
4600 +#endif // TS_DATA_QTOPIA
4601 + adsContext->tsDataHead = next_head;
4602 + if (adsContext->fasync)
4603 + kill_fasync(&adsContext->fasync, SIGIO, POLL_IN);
4604 + wake_up_interruptible(&adsContext->read_wait);
4606 + vdprintk("LEAVE: ads_784x_tsData_add()\n");
4610 +/**********************************************************************
4611 +* Function: ads_784x_Read_tsData
4612 +**********************************************************************/
4613 +static int x_last, y_last;
4614 +static int ads_784x_Read_tsData(adsContext_t *adsContext)
4616 + void *sspContext = adsContext->sspContext;
4617 + int x=0, x_1=0, x_2=0;
4618 + int y=0, y_1=0, y_2=0;
4621 +#ifdef CONFIG_ADS7846
4622 + int p1=0, p1_1=0, p1_2=0;
4623 + int p2=0, p2_1=0, p2_2=0;
4626 + vdprintk("ENTER: ads_784x_Read_tsData()\n");
4628 +#define TS_AVG_ITERS 8
4631 + * Filtering is policy. Policy belongs in user space. We
4632 + * therefore leave it to user space to do any filtering
4635 + * We do however, read twice and check against maximum x & y deltas
4636 + * to reduce the amount of garbage returned.
4638 + * Note: There will be one reading with p=0 given when the pen is raised.
4641 + /* Read the pen_down data first as it jitters after the other reads */
4642 + /* MUST lock the SSP before accessing it */
4643 + adsContext->lock(sspContext, SSP_DEV_TOUCHSCREEN);
4644 + pen_down = adsContext->is_pen_down(sspContext);
4645 + /* MUST unlock the SSP after it has been locked */
4646 + adsContext->unlock(sspContext, SSP_DEV_TOUCHSCREEN);
4649 + /* MUST lock the SSP before accessing it */
4650 + adsContext->lock(sspContext, SSP_DEV_TOUCHSCREEN);
4652 + * Read the pressure, X position, and Y position.
4653 + * Interleave them for better performance
4656 + adsContext->chipselect_enable();
4657 +#ifdef CONFIG_ADS7846
4658 + adsContext->write(sspContext, ADS_784x_READ_P1);
4659 + adsContext->write(sspContext, ADS_784x_READ_P2);
4660 + p1_1 = adsContext->read(sspContext);
4661 + p2_1 = adsContext->read(sspContext);
4663 + adsContext->write(sspContext, ADS_784x_READ_X);
4664 + x_1 = adsContext->read(sspContext);
4665 + adsContext->write(sspContext, ADS_784x_READ_Y);
4666 + y_1 = adsContext->read(sspContext);
4670 + * Read the pressure, X position, and Y position.
4671 + * Interleave them for better performance
4673 +#ifdef CONFIG_ADS7846
4674 + adsContext->write(sspContext, ADS_784x_READ_P1);
4675 + adsContext->write(sspContext, ADS_784x_READ_P2);
4676 + p1_2 = adsContext->read(sspContext);
4677 + p2_2 = adsContext->read(sspContext);
4679 + adsContext->write(sspContext, ADS_784x_READ_X);
4680 + x_2 = adsContext->read(sspContext);
4681 + adsContext->write(sspContext, ADS_784x_READ_Y);
4682 + y_2 = adsContext->read(sspContext);
4685 + adsContext->chipselect_disable();
4687 + /* MUST unlock the SSP after it has been locked */
4688 + adsContext->unlock(sspContext, SSP_DEV_TOUCHSCREEN);
4690 + } while ((x_1 > (x_2+X_DELTA_MAX)) || (x_2 > (x_1+X_DELTA_MAX))
4691 + || (y_1 > (y_2+Y_DELTA_MAX)) || (y_2 > (y_1+Y_DELTA_MAX))
4692 + || (x_1 == 0) || (y_1 == 0) || (x_2 == 0) || (y_2 == 0));
4695 +#ifdef CONFIG_ADS7846
4696 + p1 = (p1_1 + p1_2) / 2;
4697 + p2 = (p2_1 + p2_2) / 2;
4702 + x = (x_1 + x_2) / 2;
4703 + y = (y_1 + y_2) / 2;
4705 + // normalize values
4706 + // very subject to experimentation
4709 + if((x == 0) || (y == 0))
4721 + y = (1 << 12) - y;
4722 + vdprintk("LEAVE: ads_784x_Read_tsData(x=0x%03x, y=0x%03x)\n", x, y);
4723 + ads_784x_tsData_add(adsContext, 0x40, x, y); // generate pen up/pen down sequence
4724 + ads_784x_tsData_add(adsContext, 0x00, x, y);
4729 +/**********************************************************************
4730 +* Function: ads_784x_thread
4732 +* This is a RT kernel thread that handles the ADC accesses
4733 +* (mainly so we can use semaphores to serialise accesses to the ADC).
4734 +**********************************************************************/
4735 +static int ads_784x_thread(void *_adsContext)
4737 + adsContext_t *adsContext = _adsContext;
4738 + void *sspContext = adsContext->sspContext;
4739 + struct task_struct *tsk = current;
4740 + DECLARE_WAITQUEUE(wait, tsk);
4743 + vdprintk("ENTER: ads_784x_thread()\n");
4744 + adsContext->rtask = tsk;
4748 + strcpy(tsk->comm, "ktsd");
4750 + /* only want to receive SIGKILL */
4751 + spin_lock_irq(&tsk->sigmask_lock);
4752 + siginitsetinv(&tsk->blocked, sigmask(SIGKILL));
4753 + recalc_sigpending(tsk);
4754 + spin_unlock_irq(&tsk->sigmask_lock);
4756 + add_wait_queue(&adsContext->irq_wait, &wait);
4758 + complete(&adsContext->complete);
4760 + /* MUST lock the SSP before accessing it */
4761 + adsContext->lock(sspContext, SSP_DEV_TOUCHSCREEN);
4762 + pen_down = adsContext->is_pen_down(sspContext);
4763 + vdprintk("TSThrPD: %d\t", pen_down);
4764 + /* MUST unlock the SSP after it has been locked */
4765 + adsContext->unlock(sspContext, SSP_DEV_TOUCHSCREEN);
4767 + signed long interval;
4770 + * Set to interrupt mode and wait a settling time.
4772 + set_task_state(tsk, TASK_INTERRUPTIBLE);
4773 + if (sspContext == NULL) {
4774 + interval = HZ; /* Check for change once per second */
4775 + } else if (pen_down) {
4776 + /* If pen is down then periodically read pen position */
4777 + /* MUST lock the SSP before accessing it */
4778 + adsContext->lock(sspContext, SSP_DEV_TOUCHSCREEN);
4779 + adsContext->disable_pen_down_irq(sspContext);
4780 + /* MUST unlock the SSP after it has been locked */
4781 + adsContext->unlock(sspContext, SSP_DEV_TOUCHSCREEN);
4782 + interval = HZ/SAMPLES_PER_SECOND;
4784 + /* If pen is not down then sleep until pen down interrupt */
4785 + /* MUST lock the SSP before accessing it */
4786 + adsContext->lock(sspContext, SSP_DEV_TOUCHSCREEN);
4787 + adsContext->enable_pen_down_irq(sspContext);
4788 + /* MUST unlock the SSP after it has been locked */
4789 + adsContext->unlock(sspContext, SSP_DEV_TOUCHSCREEN);
4790 + interval = MAX_SCHEDULE_TIMEOUT;
4792 + schedule_timeout(interval);
4793 + if (signal_pending(tsk)) {
4797 + if (pen_down == 0) {
4799 + * On pen down there is some bounce.
4800 + * Wait a debounce period and read it again.
4802 + schedule_timeout(HZ/DEBOUNCE_FRACTION_OF_A_SECOND);
4803 + if (signal_pending(tsk)) {
4807 + * If the pen is not down after the debounce period,
4808 + * ignore the pen down signal.
4810 + /* MUST lock the SSP before accessing it */
4811 + adsContext->lock(sspContext, SSP_DEV_TOUCHSCREEN);
4812 + pen_down = adsContext->is_pen_down(sspContext);
4813 + /* MUST unlock the SSP after it has been locked */
4814 + adsContext->unlock(sspContext, SSP_DEV_TOUCHSCREEN);
4815 + if (pen_down == 0)
4819 + adsContext->disable_pen_down_irq(sspContext);
4821 + * We got an IRQ, which works us up. Process the touchscreen.
4823 + pen_down = ads_784x_Read_tsData(adsContext);
4826 + remove_wait_queue(&adsContext->irq_wait, &wait);
4827 + adsContext->rtask = NULL;
4828 + vdprintk("LEAVE: ads_784x_thread()\n");
4833 +/**********************************************************************
4834 +* Function: ads_784x_read
4836 +* ***********************************
4837 +* *** User space driver interface ***
4838 +* ***********************************
4839 +**********************************************************************/
4840 +static ssize_t ads_784x_read(struct file *filp, char *buffer, size_t _count, loff_t *ppos)
4842 + DECLARE_WAITQUEUE(wait, current);
4843 + adsContext_t *adsContext = filp->private_data;
4844 + char *ptr = buffer;
4846 + int count = (int)_count; /* Force a sigened value to be used */
4848 + vdprintk("ENTER: ads_784x_read()\n");
4849 + add_wait_queue(&adsContext->read_wait, &wait);
4850 + while (count >= sizeof(tsData_t)) {
4851 + err = -ERESTARTSYS;
4852 + if (signal_pending(current))
4855 + if (ads_784x_tsData_pending(adsContext)) {
4856 + tsData_t *tsData = ads_784x_tsData_get(adsContext);
4858 + err = copy_to_user(ptr, tsData, sizeof(tsData_t));
4859 + ads_784x_tsData_pull(adsContext);
4865 + printk("ads_784x_read: P: %02X X: %4d Y: %4d\n",
4866 + tsData->pressure & 0x40, (tsData->xhigh << 8) + tsData->xlow, (tsData->yhigh << 8) + tsData->ylow);
4869 + ptr += sizeof(tsData_t);
4870 + count -= sizeof(tsData_t);
4874 + set_current_state(TASK_INTERRUPTIBLE);
4876 + if (filp->f_flags & O_NONBLOCK)
4880 + current->state = TASK_RUNNING;
4881 + remove_wait_queue(&adsContext->read_wait, &wait);
4882 + vdprintk("LEAVE: ads_784x_read()\n");
4884 + return(ptr == buffer ? err : ptr - buffer);
4887 +/**********************************************************************
4888 +* Function: ads_784x_poll
4890 +* ***********************************
4891 +* *** User space driver interface ***
4892 +* ***********************************
4893 +**********************************************************************/
4894 +static unsigned int ads_784x_poll(struct file *filp, poll_table *wait)
4896 + adsContext_t *adsContext = filp->private_data;
4899 + vdprintk("ENTER: ads_784x_poll()\n");
4900 + poll_wait(filp, &adsContext->read_wait, wait);
4901 + if (ads_784x_tsData_pending(adsContext))
4902 + ret = POLLIN | POLLRDNORM;
4903 + vdprintk("LEAVE: ads_784x_poll()\n");
4908 +/**********************************************************************
4909 +* Function: ads_784x_open
4911 +* ***********************************
4912 +* *** User space driver interface ***
4913 +* ***********************************
4914 +**********************************************************************/
4915 +static int ads_784x_open(struct inode *inode, struct file *filp)
4917 + adsContext_t *adsContext = &adsContext_l;
4920 + vdprintk("ENTER: ads_784x_open()\n");
4922 + filp->private_data = adsContext;
4924 + /* Flush the ts data queue here */
4925 + ads_784x_tsData_flush(adsContext);
4927 + vdprintk("LEAVE: ads_784x_open()\n");
4931 +/**********************************************************************
4932 +* Function: ads_784x_fasync
4934 +* ***********************************
4935 +* *** User space driver interface ***
4936 +* ***********************************
4937 +**********************************************************************/
4938 +static int ads_784x_fasync(int fd, struct file *filp, int on)
4941 + adsContext_t *adsContext = filp->private_data;
4943 + vdprintk("ENTER: ads_784x_fasync()\n");
4944 + sts = fasync_helper(fd, filp, on, &adsContext->fasync);
4945 + vdprintk("LEAVE: ads_784x_fasync()\n");
4950 +/**********************************************************************
4951 +* Function: ads_784x_release
4953 +* ***********************************
4954 +* *** User space driver interface ***
4955 +* ***********************************
4957 +* Release touchscreen resources. Disable IRQs.
4958 +**********************************************************************/
4959 +static int ads_784x_release(struct inode *inode, struct file *filp)
4961 + // adsContext_t *adsContext = filp->private_data;
4963 + vdprintk("ENTER: ads_784x_release()\n");
4965 + ads_784x_fasync(-1, filp, 0);
4967 + vdprintk("LEAVE: ads_784x_release()\n");
4972 +/**********************************************************************
4973 +* Define (fill in) the user space file operations for this driver
4974 +* and initialize the ADS touchscreen driver as a "miscdevice":
4976 +* Major(10) --- Non-serial mice, misc features
4977 +* Minor(20) --- /dev/touchscreen/ads_784x
4978 +**********************************************************************/
4979 +static struct file_operations ads_784x_fops = {
4980 + owner: THIS_MODULE,
4981 + read: ads_784x_read,
4982 + poll: ads_784x_poll,
4983 + open: ads_784x_open,
4984 + fasync: ads_784x_fasync,
4985 + release: ads_784x_release,
4988 +static struct miscdevice ads_784x_dev = {
4990 + name: "touchscreen/ads_784x",
4991 + fops: &ads_784x_fops,
4994 +#ifdef PROC_BATTERY
4995 +/**********************************************************************
4996 +* ads_784x_proc_battery_read
4997 +**********************************************************************/
4998 +static int ads_784x_proc_battery_read(char *buf, char **start, off_t offset,
4999 + int len, int *eof, void *unused)
5001 + adsContext_t *adsContext = &adsContext_l;
5002 + void *ads784x_sspContext = adsContext->sspContext;
5005 + int hundredthsVolts;
5009 + int last_irq_state;
5011 + vdprintk("ENTER: ads_784x_proc_battery_read(len=%d)\n", len);
5013 + * Reading the ADS784X takes the part out of pen down interrupt mode
5014 + * causing spurious pen down interrupts. So we must disable
5015 + * pen down interrupts while reading battery voltage.
5017 + last_irq_state = adsContext->disable_pen_down_irq(ads784x_sspContext);
5019 + /* Do a dummy read to turn on the internal reference voltage */
5020 + /* MUST lock the SSP before accessing it */
5021 + adsContext->lock(ads784x_sspContext, SSP_DEV_TOUCHSCREEN);
5024 + adsContext->chipselect_enable();
5026 + adsContext->write(ads784x_sspContext, ADS_784x_READ_BATTERY);
5027 + sample = adsContext->read(ads784x_sspContext);
5028 + /* MUST unlock the SSP after it has been locked */
5029 + adsContext->unlock(ads784x_sspContext, SSP_DEV_TOUCHSCREEN);
5030 + udelay(100); /* wait until the reference voltage settle */
5033 + for (count = 0; count < 3; count++) {
5034 + /* MUST lock the SSP before accessing it */
5035 + adsContext->lock(ads784x_sspContext, SSP_DEV_TOUCHSCREEN);
5036 + adsContext->write(ads784x_sspContext, ADS_784x_READ_BATTERY);
5037 + sample += adsContext->read(ads784x_sspContext);
5038 + /* MUST unlock the SSP after it has been locked */
5039 + adsContext->unlock(ads784x_sspContext, SSP_DEV_TOUCHSCREEN);
5042 + milliVolts = (sample * 1000 * 10) / 4096;
5043 + volts = milliVolts / 1000;
5044 + hundredthsVolts = (milliVolts - (volts * 1000)) / 10;
5045 + size = sprintf(buf, "battery: %i %i.%02iV\n", sample, volts, hundredthsVolts);
5047 + /* Do a dummy read to turn off the internal reference voltage */
5048 + /* MUST lock the SSP before accessing it */
5049 + adsContext->lock(ads784x_sspContext, SSP_DEV_TOUCHSCREEN);
5050 + adsContext->write(ads784x_sspContext, ADS_784x_READ_X);
5051 + sample = adsContext->read(ads784x_sspContext);
5054 + adsContext->chipselect_disable();
5056 + /* MUST unlock the SSP after it has been locked */
5057 + adsContext->unlock(ads784x_sspContext, SSP_DEV_TOUCHSCREEN);
5059 + /* Restore the interrupt enable state */
5060 + if (last_irq_state) {
5061 + udelay(100); /* Wait until the pen down interrupt settles */
5062 + /* MUST lock the SSP before accessing it */
5063 + adsContext->lock(ads784x_sspContext, SSP_DEV_TOUCHSCREEN);
5064 + adsContext->enable_pen_down_irq(ads784x_sspContext);
5065 + /* MUST unlock the SSP after it has been locked */
5066 + adsContext->unlock(ads784x_sspContext, SSP_DEV_TOUCHSCREEN);
5068 + vdprintk("LEAVE: ads_784x_proc_battery_read(len=%d)\n", len);
5074 +#ifdef PROC_TEMPERATURE
5075 +/**********************************************************************
5076 +* ads_784x_proc_temperature_read
5077 +**********************************************************************/
5078 +static int ads_784x_proc_temperature_read(char *buf, char **start,
5079 + off_t offset, int len, int *eof, void *unused)
5081 + adsContext_t *adsContext = &adsContext_l;
5082 + void *ads784x_sspContext = adsContext->sspContext;
5088 + int last_irq_state;
5090 + vdprintk("ENTER: ads_784x_proc_temperature_read(len=%d)\n", len);
5092 + * Reading the ADS784X takes the part out of pen down interrupt mode
5093 + * causing spurious pen down interrupts. So we must disable
5094 + * pen down interrupts while reading temperature.
5096 + last_irq_state = adsContext->disable_pen_down_irq(ads784x_sspContext);
5098 + /* do a dummy read to turn on the internal reference voltage */
5099 + /* MUST lock the SSP before accessing it */
5100 + adsContext->lock(ads784x_sspContext, SSP_DEV_TOUCHSCREEN);
5103 + adsContext->chipselect_enable();
5105 + adsContext->write(ads784x_sspContext, ADS_784x_READ_TEMP0);
5106 + sample1 = adsContext->read(ads784x_sspContext);
5107 + /* MUST unlock the SSP after it has been locked */
5108 + adsContext->unlock(ads784x_sspContext, SSP_DEV_TOUCHSCREEN);
5109 + udelay(100); /* wait until the reference voltage settle */
5113 + /* read the temperature values */
5114 + for (count = 0; count < 3; count++) {
5115 + /* MUST lock the SSP before accessing it */
5116 + adsContext->lock(ads784x_sspContext, SSP_DEV_TOUCHSCREEN);
5117 + adsContext->write(ads784x_sspContext, ADS_784x_READ_TEMP0);
5118 + sample1 += adsContext->read(ads784x_sspContext);
5119 + adsContext->write(ads784x_sspContext, ADS_784x_READ_TEMP1);
5120 + sample91 += adsContext->read(ads784x_sspContext);
5121 + /* MUST unlock the SSP after it has been locked */
5122 + adsContext->unlock(ads784x_sspContext, SSP_DEV_TOUCHSCREEN);
5124 + /* average values */
5126 + sample91 /= count;
5128 + C10 = (((sample91 - sample1) * (25 * 2573)) / 4095) - 2730;
5129 + F10 = (C10*9)/5 + 320;
5131 + size = sprintf(buf, "Temperature: %iC, %iF\n", (C10+5)/10, (F10+5)/10);
5133 + /* do a dummy read to turn off the internal reference voltage */
5134 + /* MUST lock the SSP before accessing it */
5135 + adsContext->lock(ads784x_sspContext, SSP_DEV_TOUCHSCREEN);
5136 + adsContext->write(ads784x_sspContext, ADS_784x_READ_X);
5137 + sample1 = adsContext->read(ads784x_sspContext);
5140 + adsContext->chipselect_disable();
5142 + /* MUST unlock the SSP after it has been locked */
5143 + adsContext->unlock(ads784x_sspContext, SSP_DEV_TOUCHSCREEN);
5145 + /* restore the interrupt enable state */
5146 + if (last_irq_state) {
5147 + udelay(100); /* wait until the pen down interrupt settles */
5148 + /* MUST lock the SSP before accessing it */
5149 + adsContext->lock(ads784x_sspContext, SSP_DEV_TOUCHSCREEN);
5150 + adsContext->enable_pen_down_irq(ads784x_sspContext);
5151 + /* MUST unlock the SSP after it has been locked */
5152 + adsContext->unlock(ads784x_sspContext, SSP_DEV_TOUCHSCREEN);
5154 + vdprintk("LEAVE: ads_784x_proc_temperature_read(len=%d)\n", len);
5160 +/**********************************************************************
5161 +* Function: ads_784x_make_ssp_association
5164 +* Make the association between the eeprom driver and the ssp driver
5165 +**********************************************************************/
5166 +static int ads_784x__make_ssp_association(adsContext_t *adsContext)
5171 +/* NOTE: -EOPNOTSUPP == Operation not supported on transport endpoint */
5172 +#define ASSOCIATION_ERROR -EOPNOTSUPP
5174 + dprintk("ENTER: ads_784x_make_ssp_association()\n");
5176 + vp = ssp_request_pointer(SSP_DEV_TOUCHSCREEN, "sspContext");
5178 + sts = ASSOCIATION_ERROR;
5179 + adsContext->sspContext = vp;
5181 + vp = ssp_request_pointer(SSP_DEV_TOUCHSCREEN, "write");
5183 + sts = ASSOCIATION_ERROR;
5184 + adsContext->write = vp;
5186 + vp = ssp_request_pointer(SSP_DEV_TOUCHSCREEN, "read");
5188 + sts = ASSOCIATION_ERROR;
5189 + adsContext->read = vp;
5191 + vp = ssp_request_pointer(SSP_DEV_TOUCHSCREEN, "enable_pen_down_irq");
5193 + sts = ASSOCIATION_ERROR;
5194 + adsContext->enable_pen_down_irq = vp;
5196 + vp = ssp_request_pointer(SSP_DEV_TOUCHSCREEN, "disable_pen_down_irq");
5198 + sts = ASSOCIATION_ERROR;
5199 + adsContext->disable_pen_down_irq = vp;
5201 + vp = ssp_request_pointer(SSP_DEV_TOUCHSCREEN, "is_pen_down");
5203 + sts = ASSOCIATION_ERROR;
5204 + adsContext->is_pen_down = vp;
5206 + vp = ssp_request_pointer(SSP_DEV_TOUCHSCREEN, "lock");
5208 + sts = ASSOCIATION_ERROR;
5209 + adsContext->lock = vp;
5211 + vp = ssp_request_pointer(SSP_DEV_TOUCHSCREEN, "unlock");
5213 + sts = ASSOCIATION_ERROR;
5214 + adsContext->unlock = vp;
5216 + vp = ssp_request_pointer(SSP_DEV_TOUCHSCREEN, "chipselect_enable");
5218 + sts = ASSOCIATION_ERROR;
5219 + adsContext->chipselect_enable = vp;
5221 + vp = ssp_request_pointer(SSP_DEV_TOUCHSCREEN, "chipselect_disable");
5223 + sts = ASSOCIATION_ERROR;
5224 + adsContext->chipselect_disable = vp;
5226 + vp = ssp_request_pointer(SSP_DEV_TOUCHSCREEN, "chipselect_manual");
5228 + sts = ASSOCIATION_ERROR;
5229 + adsContext->chipselect_manual = vp;
5231 + /* Note: The following need reset to NULL when we are finished */
5233 + vp = ssp_provide_pointer(SSP_DEV_TOUCHSCREEN, "irq_wait_ptr",
5234 + &(adsContext->irq_wait));
5236 + sts = ASSOCIATION_ERROR;
5238 + dprintk("LEAVE: ads_784x_make_ssp_association(%d)\n", sts);
5243 +/**********************************************************************
5244 +* Function: ads_784x_init
5247 +* Register & Initialize the module
5248 +**********************************************************************/
5249 +static int __init ads_784x_init(void)
5251 + adsContext_t *adsContext = &adsContext_l;
5252 + int sts = -ENODEV;
5254 + vdprintk("ENTER: ads_784x_init()\n");
5255 + init_waitqueue_head(&adsContext->read_wait);
5256 + /* Retrieve the service information from the SSP driver */
5257 + sts = ads_784x__make_ssp_association(adsContext);
5259 + void *sspContext = adsContext->sspContext;
5261 + /* Start the ADS polling thread */
5263 + if (adsContext->rtask == NULL) {
5264 + init_completion(&adsContext->complete);
5265 + init_waitqueue_head(&adsContext->irq_wait);
5266 + sts = kernel_thread(ads_784x_thread, adsContext,
5267 + CLONE_FS | CLONE_FILES);
5270 + /* Only do this is the tread started correctly */
5271 + wait_for_completion(&adsContext->complete);
5276 + /* MUST lock the SSP before accessing it */
5277 + adsContext->lock(sspContext, SSP_DEV_TOUCHSCREEN);
5278 + adsContext->chipselect_manual();
5279 + adsContext->write(sspContext, ADS_784x_INIT);
5280 + adsContext->read(sspContext); /* dummy read */
5281 + /* MUST unlock the SSP after it has been locked */
5282 + adsContext->unlock(sspContext, SSP_DEV_TOUCHSCREEN);
5284 + sts = misc_register(&ads_784x_dev);
5286 +#ifdef PROC_BATTERY
5287 + ads_784x_proc_battery = create_proc_entry("battery", 0, 0);
5288 + if (ads_784x_proc_battery) {
5289 + ads_784x_proc_battery->read_proc = ads_784x_proc_battery_read;
5291 + printk(KERN_ERR "%s: unable to register /proc/battery\n", DRVNAME);
5294 +#ifdef PROC_TEMPERATURE
5295 + ads_784x_proc_temperature = create_proc_entry("temperature", 0, 0);
5296 + if (ads_784x_proc_temperature) {
5297 + ads_784x_proc_temperature->read_proc = ads_784x_proc_temperature_read;
5299 + printk(KERN_ERR "%s: unable to register /proc/temperature\n", DRVNAME);
5304 + vdprintk("LEAVE: ads_784x_init()\n");
5308 +/**********************************************************************
5309 +* Function: ads_784x_exit
5312 +* Un-Register & Cleanup the module
5313 +**********************************************************************/
5314 +static void ads_784x_exit(void)
5316 + adsContext_t *adsContext = &adsContext_l;
5318 + vdprintk("ENTER: ads_784x_exit()\n");
5320 + if (adsContext->rtask) {
5321 + send_sig(SIGKILL, adsContext->rtask, 1);
5325 + vdprintk("ads_784x_exit(): misc_deregister()\n");
5326 + misc_deregister(&ads_784x_dev);
5328 + /* Back out the pointer(s) we gave to the SSP driver */
5329 + (void) ssp_provide_pointer(SSP_DEV_TOUCHSCREEN, "irq_wait_ptr", NULL);
5331 +#ifdef PROC_BATTERY
5332 + remove_proc_entry("battery", NULL);
5334 +#ifdef PROC_TEMPERATURE
5335 + remove_proc_entry("temperature", NULL);
5338 + vdprintk("LEAVE: ads_784x_exit()\n");
5343 +module_init(ads_784x_init);
5344 +module_exit(ads_784x_exit);
5346 +MODULE_AUTHOR("Jim Gleason");
5347 +MODULE_DESCRIPTION("ADS 784x Driver for Sharp LH7x EVB");
5348 +MODULE_LICENSE("Copyright (c) 2002 Lineo, Inc.");
5350 diff -urN linux-2.4.26/drivers/misc/Config.in linux-2.4.26-vrs1-lnode80/drivers/misc/Config.in
5351 --- linux-2.4.26/drivers/misc/Config.in 2005-11-02 16:54:22.000000000 -0400
5352 +++ linux-2.4.26-vrs1-lnode80/drivers/misc/Config.in 2005-11-02 17:37:31.000000000 -0400
5354 dep_tristate ' Touchscreen interface support' CONFIG_MCP_UCB1200_TS $CONFIG_MCP_UCB1200
5357 +mainmenu_option next_comment
5359 +comment 'Misc devices'
5361 +if [ "$CONFIG_ARCH_LH79520" = "y" ]; then
5362 + tristate 'LH79590 touchscreen support' CONFIG_TOUCHSCREEN_LH79520
5363 + tristate 'LH79590 serial eeprom support' CONFIG_EEPROM_LH79520
5364 + tristate 'LH79590 7-segment support' CONFIG_7SEGMENT_LH79520
5368 diff -urN linux-2.4.26/drivers/misc/eeprom-lh7x.c linux-2.4.26-vrs1-lnode80/drivers/misc/eeprom-lh7x.c
5369 --- linux-2.4.26/drivers/misc/eeprom-lh7x.c 1969-12-31 20:00:00.000000000 -0400
5370 +++ linux-2.4.26-vrs1-lnode80/drivers/misc/eeprom-lh7x.c 2005-11-02 17:37:31.000000000 -0400
5372 +/* vi: set sw=4 ts=4 ai: */
5376 +#define READ_AFTER_WRITE
5378 +/**********************************************************************
5379 +* linux/drivers/misc/eeprom-lh79x.c
5381 +* Provide Microchip 93LC46B 64 x 16 EEPROM access for LH7x EVB boards
5383 +* Copyright (C) 2002 Lineo, Inc.
5385 +* This program is free software; you can redistribute it and/or modify
5386 +* it under the terms of the GNU General Public License (GPL) version 2
5387 +* as published by the Free Software Foundation.
5390 +* SHARP_EVB_DISPLAY_BOARD_REV2.pdf
5391 +* 93LC46.pdf (Microchip 1K Microwire(R) EEPROM chip spec)
5393 +**********************************************************************/
5395 +#include <linux/config.h>
5396 +#include <linux/types.h>
5397 +#include <linux/kernel.h>
5398 +#include <linux/init.h>
5399 +#include <linux/module.h>
5400 +#include <linux/fs.h>
5401 +#include <linux/proc_fs.h>
5402 +#include <linux/smp_lock.h>
5403 +#include <linux/miscdevice.h>
5404 +#include <linux/poll.h>
5405 +#include <linux/delay.h>
5409 +#define DRVNAME "eeprom-lh79x"
5410 +#include <linux/verbosedebug.h>
5412 +#include <linux/version.h>
5414 +char kernel_version[] = UTS_RELEASE;
5415 +#endif /* MODULE */
5417 +#include <asm/arch/hardware.h>
5421 +#define SIXmsJIFFIES (((HZ*6)/1000)+2)
5423 +/**********************************************************************
5424 +* Define EEPROM Control macros for "Microchip 93LC46B Microwire Serial EEPROM"
5425 +**********************************************************************/
5427 +/* Erase one 16 bit word at addr */
5428 +#define EEPROM_ERASE(addr) (0x01C0 | (addr & 0x3F))
5429 +/* Erase entire eeprom */
5430 +#define EEPROM_ERAL() (0x0120)
5431 +/* Erase/Write disable */
5432 +#define EEPROM_EWDS() (0x0100)
5433 +/* Erase/Write enable */
5434 +#define EEPROM_EWEN() (0x0130)
5435 +/* Read one 16 bit word at addr */
5436 +#define EEPROM_READ(addr) (0x0180 | (addr & 0x3F))
5437 +/* (Erase and) Write one 16 bit word at addr */
5438 +#define EEPROM_WRITE(addr) (0x0140 | (addr & 0x3F))
5439 +/* Write one 16 bit value throught entire eeprom */
5440 +#define EEPROM_WRAL() (0x0110)
5442 +/**********************************************************************
5443 +* Define our eeprom context structure
5444 +**********************************************************************/
5446 +#define EEPROM_SIZE_16BIT 64
5447 +#define EEPROM_SIZE_8BIT 128
5449 +typedef struct eepromContext_t eepromContext_t;
5450 +struct eepromContext_t {
5452 + uint16_t w[EEPROM_SIZE_16BIT]; /* Actual device size */
5453 + u_char c[EEPROM_SIZE_8BIT];
5456 + uint16_t w[EEPROM_SIZE_16BIT]; /* Actual device size */
5457 + u_char c[EEPROM_SIZE_8BIT];
5459 + wait_queue_head_t read_and_write_wait;
5462 + void (*write) (void *sspContext, unsigned int data);
5463 + unsigned int (*read) (void *sspContext);
5464 + int (*lock)(void *sspContext, int device);
5465 + int (*unlock)(void *sspContext, int device);
5466 + void (*ssp_chipselect_automatic)(void);
5467 + void (*ssp_chipselect_manual)(void);
5468 + void (*ssp_chipselect_enable)(void);
5469 + void (*ssp_chipselect_disable)(void);
5470 + void (*ssp_flush_tx_fifo)(void *sspContext);
5471 + void (*ssp_flush_rx_fifo)(void *sspContext);
5472 + void (*ssp_busy_wait)(void);
5474 +static eepromContext_t eepromContext_l;
5476 +#define CACHE_STATE_VALID_8 0x01
5477 +#define CACHE_STATE_MODIFIED_8 0x02
5479 +#define CACHE_STATE_VALID_16 0x0101
5480 +#define CACHE_STATE_MODIFIED_16 0x0202
5482 +/**********************************************************************
5483 +* Function: eeprom_lh79x_erase_write_enable
5484 +* Function: eeprom_lh79x_erase_write_disable
5485 +**********************************************************************/
5487 +eeprom_lh79x_erase_write_enable(eepromContext_t *eepromContext)
5489 + void *sspContext = eepromContext->sspContext;
5491 + /* Lock the SSP before accessing it */
5492 + eepromContext->lock(sspContext, SSP_DEV_EEPROM);
5494 + eepromContext->ssp_busy_wait(); /* Wait for the SSP to not be busy */
5495 + eepromContext->ssp_flush_rx_fifo(sspContext);
5497 + /* EEPROM Writes must be done using manual control of the ChipSelect */
5498 + eepromContext->ssp_chipselect_manual();
5499 + eepromContext->ssp_chipselect_enable();
5501 + eepromContext->write(sspContext, EEPROM_EWEN()); /* Enable Erase/Write */
5503 + eepromContext->ssp_busy_wait(); /* Wait for the SSP to not be busy */
5504 + eepromContext->ssp_flush_rx_fifo(sspContext);
5506 + /* Reset back to automatic control of the EEPROM ChipSelect */
5507 + eepromContext->ssp_chipselect_disable();
5508 + eepromContext->ssp_chipselect_automatic();
5510 + /* Unlock the SSP after it has been locked */
5511 + eepromContext->unlock(sspContext, SSP_DEV_EEPROM);
5517 +eeprom_lh79x_erase_write_disable(eepromContext_t *eepromContext)
5519 + void *sspContext = eepromContext->sspContext;
5521 + /* Lock the SSP before accessing it */
5522 + eepromContext->lock(sspContext, SSP_DEV_EEPROM);
5524 + eepromContext->ssp_busy_wait(); /* Wait for the SSP to not be busy */
5525 + eepromContext->ssp_flush_rx_fifo(sspContext);
5527 + /* EEPROM Writes must be done using manual control of the ChipSelect */
5528 + eepromContext->ssp_chipselect_manual();
5529 + eepromContext->ssp_chipselect_enable();
5531 + eepromContext->write(sspContext, EEPROM_EWDS()); /* Disable Erase/Write */
5533 + eepromContext->ssp_busy_wait(); /* Wait for the SSP to not be busy */
5534 + eepromContext->ssp_flush_rx_fifo(sspContext);
5536 + /* Reset back to automatic control of the EEPROM ChipSelect */
5537 + eepromContext->ssp_chipselect_disable();
5538 + eepromContext->ssp_chipselect_automatic();
5540 + /* Unlock the SSP after it has been locked */
5541 + eepromContext->unlock(sspContext, SSP_DEV_EEPROM);
5546 +/**********************************************************************
5547 +* Function: eeprom_lh79x_read_device_word
5548 +**********************************************************************/
5550 +eeprom_lh79x_read_device_word(eepromContext_t *eepromContext, int offset_w)
5552 + void *sspContext = eepromContext->sspContext;
5553 + uint16_t word = 0;
5555 + /* Lock the SSP before accessing it */
5556 + eepromContext->lock(sspContext, SSP_DEV_EEPROM);
5558 + eepromContext->ssp_busy_wait(); /* Wait for the SSP to not be busy */
5559 + eepromContext->ssp_flush_rx_fifo(sspContext);
5561 + /* EEPROM Reads must be done using manual control of the ChipSelect */
5562 + eepromContext->ssp_chipselect_manual();
5563 + eepromContext->ssp_chipselect_enable();
5565 + /* Read eeprom into cache */
5566 + /* Note: We shift to take care of the "dummy 0" the eeprom sends */
5567 + eepromContext->write(sspContext, (EEPROM_READ(offset_w))<<1);
5568 + /* Following is a Dummy/Invalid command to allow the eeprom to be read */
5569 + eepromContext->write(sspContext, 0);
5570 + eepromContext->ssp_busy_wait(); /* Wait for the SSP to not be busy */
5571 + word = eepromContext->read(sspContext); /* Dummy Word */
5572 + word = eepromContext->read(sspContext); /* Real Word */
5574 + /* Reset back to automatic control of the EEPROM ChipSelect */
5575 + eepromContext->ssp_chipselect_disable();
5576 + eepromContext->ssp_chipselect_automatic();
5578 + /* Unlock the SSP after it has been locked */
5579 + eepromContext->unlock(sspContext, SSP_DEV_EEPROM);
5581 + /* Modify the state of the cache data */
5582 + eepromContext->cache.w[offset_w] = word;
5583 + eepromContext->state.w[offset_w] |= CACHE_STATE_VALID_16;
5585 + schedule(); /* Give the rest of the system a chance to work */
5590 +/**********************************************************************
5591 +* Function: eeprom_lh79x_write_device_word
5592 +**********************************************************************/
5594 +eeprom_lh79x_write_device_word(eepromContext_t *eepromContext, int offset_w)
5596 + void *sspContext = eepromContext->sspContext;
5598 + long timeoutJiffies;
5600 + /* Get the modified cache data to write to the eeprom */
5601 + word = eepromContext->cache.w[offset_w];
5603 + /* Lock the SSP before accessing it */
5604 + eepromContext->lock(sspContext, SSP_DEV_EEPROM);
5606 + eepromContext->ssp_busy_wait(); /* Wait for the SSP to not be busy */
5607 + eepromContext->ssp_flush_rx_fifo(sspContext);
5609 + /* EEPROM Writes must be done using manual control of the ChipSelect */
5610 + eepromContext->ssp_chipselect_manual();
5611 + eepromContext->ssp_chipselect_enable();
5613 + /* Write modified cache data to the eeprom */
5614 + eepromContext->write(sspContext, EEPROM_WRITE(offset_w));
5615 + eepromContext->write(sspContext, word);
5617 + /* Reset back to automatic control of the EEPROM ChipSelect */
5618 + eepromContext->ssp_chipselect_disable();
5619 + eepromContext->ssp_chipselect_automatic();
5621 + eepromContext->ssp_busy_wait(); /* Wait for the SSP to not be busy */
5622 + eepromContext->ssp_flush_rx_fifo(sspContext);
5624 + /* Unlock the SSP after it has been locked */
5625 + eepromContext->unlock(sspContext, SSP_DEV_EEPROM);
5627 + /* Modify the state of the cache data */
5628 + eepromContext->state.w[offset_w] &= ~CACHE_STATE_MODIFIED_16;
5630 +#ifdef READ_AFTER_WRITE
5631 + /* Force the modified cache data to be reread from the eeprom */
5632 + eepromContext->state.w[offset_w] &= ~CACHE_STATE_VALID_16;
5633 +#endif /* READ_AFTER_WRITE */
5635 + /* Cause ~ 6ms delay (actually does 10 on the Sharp LH79520) */
5636 + timeoutJiffies = SIXmsJIFFIES;
5637 + while (timeoutJiffies > 0) {
5638 + __set_current_state(TASK_UNINTERRUPTIBLE);
5639 + timeoutJiffies = schedule_timeout(timeoutJiffies);
5641 + // __set_current_state(TASK_RUNNING);
5643 + schedule(); /* Give the rest of the system a chance to work */
5648 +/**********************************************************************
5649 +* Function: eeprom_lh79x_read_device
5650 +**********************************************************************/
5652 +eeprom_lh79x_read_device(eepromContext_t *eepromContext)
5657 + scwp = eepromContext->state.w;
5658 + for (offset_w = 0; offset_w < EEPROM_SIZE_16BIT; offset_w++) {
5659 + if ((*scwp & CACHE_STATE_VALID_16) != CACHE_STATE_VALID_16) {
5660 + eeprom_lh79x_read_device_word(eepromContext, offset_w);
5668 +/**********************************************************************
5669 +* Function: eeprom_lh79x_write_device
5670 +**********************************************************************/
5672 +eeprom_lh79x_write_device(eepromContext_t *eepromContext)
5676 + int timeoutJiffies;
5678 + /* Enable erase/write of the eeprom */
5679 + eeprom_lh79x_erase_write_enable(eepromContext);
5681 + /* Just to get the timeouts in a desirable sequence */
5682 + /* and so we don't get a "partial" timeout we do the following... */
5683 + /* Cause ~ 6ms delay (actually does 10 on the Sharp LH79520) */
5684 + timeoutJiffies = SIXmsJIFFIES;
5685 + while (timeoutJiffies > 0) {
5686 + __set_current_state(TASK_UNINTERRUPTIBLE);
5687 + timeoutJiffies = schedule_timeout(timeoutJiffies);
5689 + // __set_current_state(TASK_RUNNING);
5691 + scwp = eepromContext->state.w;
5692 + for (offset_w = 0; offset_w < EEPROM_SIZE_16BIT; offset_w++) {
5693 + if (*scwp & CACHE_STATE_MODIFIED_16) {
5694 + eeprom_lh79x_write_device_word(eepromContext, offset_w);
5699 + /* Disable erase/write of the eeprom */
5700 + eeprom_lh79x_erase_write_disable(eepromContext);
5702 +#ifdef READ_AFTER_WRITE
5704 + * NOW ... Update the eeprom cache.
5705 + * ( Read the actual contents of the eeprom that were
5706 + * modified instead of relying on what we wrote. )
5708 + eeprom_lh79x_read_device(eepromContext);
5709 +#endif /* READ_AFTER_WRITE */
5714 +/**********************************************************************
5715 +* *****************************************************
5716 +* *** User space "file operation" driver interfaces ***
5717 +* *****************************************************
5718 +* Function: lh79x_eeprom_llseek
5719 +* Function: lh79x_eeprom_read
5720 +* Function: lh79x_eeprom_write
5721 +* Function: lh79x_eeprom_poll ( NOT USED --- YET )
5722 +* Function: lh79x_eeprom_ioctl ( NOT USED --- YET )
5723 +* Function: lh79x_eeprom_open
5724 +* Function: lh79x_eeprom_flush ( NOT USED --- YET )
5725 +* Function: lh79x_eeprom_release ( NOT USED --- YET )
5726 +* Function: lh79x_eeprom_fsync ( NOT USED --- YET )
5727 +* Function: lh79x_eeprom_fasync ( NOT USED --- YET )
5728 +* Function: lh79x_eeprom_lock ( NOT USED --- YET )
5729 +**********************************************************************/
5732 +lh79x_eeprom_llseek(struct file *filp, loff_t offset, int origin)
5734 + // eepromContext_t *eepromContext = filp->private_data;
5735 + loff_t new_offset = -EINVAL;
5738 + case 0: /* SEEK_SET == 0, Offset from the start */
5739 + new_offset = offset;
5741 + case 1: /* SEEK_CUR == 1, Offset from the current position */
5742 + new_offset = filp->f_pos + offset;
5744 + case 2: /* SEEK_END == 2, Offset from the end */
5745 + new_offset = EEPROM_SIZE_8BIT - offset;
5748 + if ((new_offset < 0) || (new_offset > EEPROM_SIZE_8BIT)) {
5749 + new_offset = -EINVAL;
5751 + filp->f_pos = new_offset;
5754 + return(new_offset);
5758 +lh79x_eeprom_read(struct file *filp, char *buffer,
5759 + size_t count, loff_t *offsetp)
5761 + eepromContext_t *eepromContext = filp->private_data;
5765 + vdprintk("ENTER: lh79x_eeprom_read(%d:%d)\n", *offsetp, count);
5766 + /* Ensure we still have data to read (relative to the offset we are at) */
5767 + if (*offsetp < EEPROM_SIZE_8BIT) {
5768 + /* Adjust the size to be read if necessary */
5769 + if ((*offsetp + count) > EEPROM_SIZE_8BIT) {
5770 + count = EEPROM_SIZE_8BIT - *offsetp;
5772 + /* Ensure the eeprom cache is valid */
5773 + eeprom_lh79x_read_device(eepromContext);
5774 + /* Return the contents of the eeprom cache */
5775 + err = copy_to_user(buffer, &eepromContext->cache.c[*offsetp], count);
5777 + *offsetp += count;
5783 + vdprintk("LEAVE: lh79x_eeprom_read(%d)\n", sts);
5789 +lh79x_eeprom_write(struct file *filp, const char *buffer,
5790 + size_t count, loff_t *offsetp)
5792 + eepromContext_t *eepromContext = filp->private_data;
5793 + u_char newcache_c[EEPROM_SIZE_8BIT];
5797 + vdprintk("ENTER: lh79x_eeprom_write(%d:%d)\n", *offsetp, count);
5798 + /* Ensure we still have room to write (relative to the offset we are at) */
5799 + if (*offsetp < EEPROM_SIZE_8BIT) {
5800 + /* Adjust the size to be written if necessary */
5801 + if ((*offsetp + count) > EEPROM_SIZE_8BIT) {
5802 + count = EEPROM_SIZE_8BIT - *offsetp;
5804 + /* Ensure the eeprom cache is valid to start with */
5805 + eeprom_lh79x_read_device(eepromContext);
5806 + /* Get the new contents of the eeprom cache */
5807 + err = copy_from_user(&newcache_c[*offsetp], buffer, count);
5809 + u_char *ccp, *nccp, *sccp;
5812 + * Transfer the new cache contents into the cache
5813 + * marking what has changed.
5815 + ccp = &eepromContext->cache.c[*offsetp];
5816 + nccp = &newcache_c[*offsetp];
5817 + sccp = &eepromContext->state.c[*offsetp];
5818 + for (i = 0; i < count; i++) {
5819 + if (*ccp != *nccp) {
5821 + *sccp |= CACHE_STATE_MODIFIED_8;
5827 + /* Write the modified cache into the eeprom */
5828 + eeprom_lh79x_write_device(eepromContext);
5829 + *offsetp += count;
5835 + vdprintk("LEAVE: lh79x_eeprom_write(%d)\n", sts);
5840 +#if (0) /* NOT USED --- YET */
5841 +static unsigned int
5842 +lh79x_eeprom_poll(struct file *filp, struct poll_table_struct *wait)
5844 + eepromContext_t *eepromContext = filp->private_data;
5849 +#endif /* NOT USED --- YET */
5851 +#if (0) /* NOT USED --- YET */
5853 +lh79x_eeprom_ioctl(struct inode *, struct file *filp, unsigned int cmd, unsigned long arg)
5855 + eepromContext_t *eepromContext = filp->private_data;
5860 +#endif /* NOT USED --- YET */
5863 +lh79x_eeprom_open(struct inode *inode, struct file *filp)
5865 + eepromContext_t *eepromContext = &eepromContext_l;
5868 + filp->private_data = eepromContext;
5873 +#if (0) /* NOT USED --- YET */
5875 +lh79x_eeprom_flush(struct file *filp)
5877 + eepromContext_t *eepromContext = filp->private_data;
5882 +#endif /* NOT USED --- YET */
5884 +#if (0) /* NOT USED --- YET */
5886 +lh79x_eeprom_release(struct inode *inode, struct file *filp)
5888 + eepromContext_t *eepromContext = filp->private_data;
5893 +#endif /* NOT USED --- YET */
5895 +#if (0) /* NOT USED --- YET */
5897 +lh79x_eeprom_fsync(struct file *filp, struct dentry *dentry, int datasync)
5899 + eepromContext_t *eepromContext = filp->private_data;
5904 +#endif /* NOT USED --- YET */
5906 +#if (0) /* NOT USED --- YET */
5908 +lh79x_eeprom_fasync(int fd, struct file *filp, int on)
5910 + eepromContext_t *eepromContext = filp->private_data;
5915 +#endif /* NOT USED --- YET */
5917 +#if (0) /* NOT USED --- YET */
5919 +lh79x_eeprom_lock(struct file *filp, int XXX, struct file_lock *file_lock)
5921 + eepromContext_t *eepromContext = filp->private_data;
5926 +#endif /* NOT USED --- YET */
5928 +/**********************************************************************
5929 +* Define (fill in) the user space file operations for this driver
5930 +* and initialize the eeprom driver as a "miscdevice":
5932 +* Major(10) --- Non-serial mice, misc features
5933 +* Minor(22) --- /dev/eeprom ( Microchip 93LC46B 64 x 16 EEPROM )
5934 +**********************************************************************/
5935 +static struct file_operations lh79x_eeprom_fops = {
5936 + owner: THIS_MODULE,
5937 + llseek: lh79x_eeprom_llseek,
5938 + read: lh79x_eeprom_read,
5939 + write: lh79x_eeprom_write,
5940 +// poll: lh79x_eeprom_poll,
5941 +// ioctl: lh79x_eeprom_ioctl,
5942 + open: lh79x_eeprom_open,
5943 +// flush: lh79x_eeprom_flush,
5944 +// release: lh79x_eeprom_release,
5945 +// fsync: lh79x_eeprom_fsync,
5946 +// fasync: lh79x_eeprom_fasync,
5947 +// lock: lh79x_eeprom_lock,
5950 +static struct miscdevice lh79x_eeprom_dev = {
5953 +fops: &lh79x_eeprom_fops,
5956 +/**********************************************************************
5957 +* Function: lh79x_eeprom_make_ssp_association
5960 +* Make the association between the eeprom driver and the ssp driver
5961 +**********************************************************************/
5962 +static int lh79x_eeprom_make_ssp_association(eepromContext_t *eepromContext)
5967 +/* NOTE: -EOPNOTSUPP == Operation not supported on transport endpoint */
5968 +#define ASSOCIATION_ERROR -EOPNOTSUPP
5970 + dprintk("ENTER: lh79x_eeprom_make_ssp_association()\n");
5972 + vp = ssp_request_pointer(SSP_DEV_EEPROM, "sspContext");
5974 + sts = ASSOCIATION_ERROR;
5975 + eepromContext->sspContext = vp;
5977 + vp = ssp_request_pointer(SSP_DEV_EEPROM, "write");
5979 + sts = ASSOCIATION_ERROR;
5980 + eepromContext->write = vp;
5982 + vp = ssp_request_pointer(SSP_DEV_EEPROM, "read");
5984 + sts = ASSOCIATION_ERROR;
5985 + eepromContext->read = vp;
5987 + vp = ssp_request_pointer(SSP_DEV_EEPROM, "lock");
5989 + sts = ASSOCIATION_ERROR;
5990 + eepromContext->lock = vp;
5992 + vp = ssp_request_pointer(SSP_DEV_EEPROM, "unlock");
5994 + sts = ASSOCIATION_ERROR;
5995 + eepromContext->unlock = vp;
5997 + vp = ssp_request_pointer(SSP_DEV_EEPROM, "chipselect_enable");
5999 + sts = ASSOCIATION_ERROR;
6000 + eepromContext->ssp_chipselect_enable = vp;
6002 + vp = ssp_request_pointer(SSP_DEV_EEPROM, "chipselect_disable");
6004 + sts = ASSOCIATION_ERROR;
6005 + eepromContext->ssp_chipselect_disable = vp;
6007 + vp = ssp_request_pointer(SSP_DEV_EEPROM, "chipselect_manual");
6009 + sts = ASSOCIATION_ERROR;
6010 + eepromContext->ssp_chipselect_manual = vp;
6012 + vp = ssp_request_pointer(SSP_DEV_EEPROM, "chipselect_automatic");
6014 + sts = ASSOCIATION_ERROR;
6015 + eepromContext->ssp_chipselect_automatic = vp;
6017 + vp = ssp_request_pointer(SSP_DEV_EEPROM, "flush_tx_fifo");
6019 + sts = ASSOCIATION_ERROR;
6020 + eepromContext->ssp_flush_tx_fifo = vp;
6022 + vp = ssp_request_pointer(SSP_DEV_EEPROM, "flush_rx_fifo");
6024 + sts = ASSOCIATION_ERROR;
6025 + eepromContext->ssp_flush_rx_fifo = vp;
6027 + vp = ssp_request_pointer(SSP_DEV_EEPROM, "ssp_busy_wait");
6029 + sts = ASSOCIATION_ERROR;
6030 + eepromContext->ssp_busy_wait = vp;
6032 + dprintk("LEAVE: lh79x_eeprom_make_ssp_association(%d)\n", sts);
6037 +/**********************************************************************
6038 +* Function: lh79x_eeprom_init
6041 +* Register & Initialize the module
6042 +**********************************************************************/
6043 +static int lh79x_eeprom_init(void)
6045 + eepromContext_t *eepromContext = &eepromContext_l;
6047 + dprintk("ENTER: lh79x_eeprom_init()\n");
6048 + init_waitqueue_head(&eepromContext->read_and_write_wait);
6049 + /* Retrieve the service information from the SSP driver */
6050 + sts = lh79x_eeprom_make_ssp_association(eepromContext);
6052 + /* Ensure the eeprom cache is valid */
6053 + eeprom_lh79x_read_device(eepromContext);
6054 + sts = misc_register(&lh79x_eeprom_dev);
6056 + dprintk("LEAVE: lh79x_eeprom_init(%d)\n", sts);
6060 +/**********************************************************************
6061 +* Function: lh79x_eeprom_exit
6064 +* Un-Register & Cleanup the module
6065 +**********************************************************************/
6066 +static void lh79x_eeprom_exit(void)
6068 + dprintk("ENTER: lh79x_eeprom_exit()\n");
6069 + misc_deregister(&lh79x_eeprom_dev);
6070 + dprintk("LEAVE: lh79x_eeprom_exit()\n");
6074 +module_init(lh79x_eeprom_init);
6075 +module_exit(lh79x_eeprom_exit);
6077 +MODULE_AUTHOR("Jim Gleason / Lineo, Inc.");
6078 +MODULE_DESCRIPTION("Microchip 93LC46B 64 x 16 EEPROM access for LH7x EVB");
6079 +MODULE_LICENSE("Copyright (c) 2002 Lineo, Inc.");
6081 diff -urN linux-2.4.26/drivers/misc/lh7x-7seg.c linux-2.4.26-vrs1-lnode80/drivers/misc/lh7x-7seg.c
6082 --- linux-2.4.26/drivers/misc/lh7x-7seg.c 1969-12-31 20:00:00.000000000 -0400
6083 +++ linux-2.4.26-vrs1-lnode80/drivers/misc/lh7x-7seg.c 2005-11-02 17:37:31.000000000 -0400
6085 +/* vi: set sw=4 ts=4 ai: */
6089 +/**********************************************************************
6090 +* linux/drivers/misc/lh7x-7seg.c
6092 +* Provide ADS_784x 7-Segment access for LH7x EVB boards
6094 +* Copyright (C) 2002 Lineo, Inc.
6096 +* This program is free software; you can redistribute it and/or modify
6097 +* it under the terms of the GNU General Public License (GPL) version 2
6098 +* as published by the Free Software Foundation.
6100 +**********************************************************************/
6102 +/**********************************************************************
6103 +* To light up the 7-segment display, write a 16-bit value to
6107 +* The high-order byte is the most significant 7-segment digit,
6108 +* and the low-order byte is the lsb.
6110 +* NOTE: The 7-segment display bars are bit-mapped.
6111 +* NOTE: The 7-segment display bars are ACTIVE LOW.
6126 +* dot 0x80 (also known as dp)
6128 +* The data to write looks like this:
6130 +* static u_char lednum[] =
6131 +* { 0xC0, 0xF9, 0xA4, 0xB0, 0x99, 0x92, 0x82, 0xF8, // 0-7
6132 +* 0x80, 0x98, 0x88, 0x83, 0xC6, 0xA1, 0x86, 0x8E, // 8-F
6137 +* SO - to make "7F" show up, do this:
6139 +* cpld->seven_seg = 0xf88e;
6141 +* NOTE: When read, the 7-segment display does not return valid data.
6143 +**********************************************************************/
6145 +#include <linux/config.h>
6146 +#include <linux/types.h>
6147 +#include <linux/kernel.h>
6148 +#include <linux/init.h>
6149 +#include <linux/module.h>
6150 +#include <linux/fs.h>
6151 +#include <linux/proc_fs.h>
6152 +#include <linux/smp_lock.h>
6153 +#include <linux/miscdevice.h>
6154 +#include <linux/poll.h>
6158 +#define DRVNAME "lh7x-7seg"
6159 +#include <linux/verbosedebug.h>
6161 +#include <linux/version.h>
6163 +char kernel_version[] = UTS_RELEASE;
6164 +#endif /* MODULE */
6166 +#include <asm/arch/hardware.h>
6167 +#include <asm/arch/cpld.h>
6168 +#include <asm/arch/lh7x-7seg.h>
6170 +static cpldRegs_t *cpld = (cpldRegs_t *)CPLD_BASE;
6172 +/**********************************************************************
6173 +* Define our Seven Segment context structure
6174 +**********************************************************************/
6175 +typedef struct sevenSegmentContext_t sevenSegmentContext_t;
6176 +struct sevenSegmentContext_t {
6177 + struct fasync_struct *fasync;
6178 + wait_queue_head_t read_and_write_wait;
6180 + int inEscape; /* 1 == We are in an escape sequence, 0 == NOT */
6181 + int accessMode; /* See ACCESSMODE_xxx definitions below */
6182 + int rawData; /* Raw == 1, Cooked == 0 */
6183 + uint16_t currentRawVal;
6185 +static sevenSegmentContext_t sevenSegmentContext_l;
6189 +#define ACCESSMODE_SHIFT 0
6190 +#define ACCESSMODE_LSB 1
6191 +#define ACCESSMODE_MSB 2
6192 +#define ACCESSMODE_DAFAULT ACCESSMODE_SHIFT
6194 +/**********************************************************************
6195 +* Define our Seven Segment Data
6196 +**********************************************************************/
6198 +typedef struct sevenSegmentData_t sevenSegmentData_t;
6199 +struct sevenSegmentData_t {
6204 +#define SSD_BLANK ((u_char)~(0x00))
6206 +static sevenSegmentData_t sevenSegmentData[] = {
6207 + {'0', (u_char)~(SSD_A | SSD_B | SSD_C | SSD_D | SSD_E | SSD_F) },
6208 + {'1', (u_char)~(SSD_B | SSD_C) },
6209 + {'2', (u_char)~(SSD_A | SSD_B | SSD_G | SSD_E | SSD_D) },
6210 + {'3', (u_char)~(SSD_A | SSD_B | SSD_G | SSD_C | SSD_D) },
6211 + {'4', (u_char)~(SSD_F | SSD_G | SSD_B | SSD_C) },
6212 + {'5', (u_char)~(SSD_A | SSD_F | SSD_G | SSD_C | SSD_D) },
6213 + {'6', (u_char)~(SSD_A | SSD_F | SSD_E | SSD_D | SSD_C | SSD_G) },
6214 + {'7', (u_char)~(SSD_A | SSD_B | SSD_C) },
6215 + {'8', (u_char)~(SSD_A | SSD_B | SSD_C | SSD_D | SSD_E | SSD_F | SSD_G) },
6216 + {'9', (u_char)~(SSD_G | SSD_F | SSD_A | SSD_B | SSD_C) },
6217 + {'A', (u_char)~(SSD_E | SSD_F | SSD_A | SSD_B | SSD_C | SSD_G) },
6218 + {'a', (u_char)~(SSD_E | SSD_F | SSD_A | SSD_B | SSD_C | SSD_G) },
6219 + {'B', (u_char)~(SSD_F | SSD_E | SSD_D | SSD_C | SSD_G) },
6220 + {'b', (u_char)~(SSD_F | SSD_E | SSD_D | SSD_C | SSD_G) },
6221 + {'C', (u_char)~(SSD_A | SSD_F | SSD_E | SSD_D) },
6222 + {'c', (u_char)~(SSD_A | SSD_F | SSD_E | SSD_D) },
6223 + {'D', (u_char)~(SSD_B | SSD_C | SSD_D | SSD_E | SSD_G) },
6224 + {'d', (u_char)~(SSD_B | SSD_C | SSD_D | SSD_E | SSD_G) },
6225 + {'E', (u_char)~(SSD_A | SSD_F | SSD_G | SSD_E | SSD_D) },
6226 + {'e', (u_char)~(SSD_A | SSD_F | SSD_G | SSD_E | SSD_D) },
6227 + {'F', (u_char)~(SSD_A | SSD_F | SSD_G | SSD_E) },
6228 + {'f', (u_char)~(SSD_A | SSD_F | SSD_G | SSD_E) },
6229 + {'H', (u_char)~(SSD_F | SSD_E | SSD_G | SSD_B | SSD_C) },
6230 + {'h', (u_char)~(SSD_F | SSD_E | SSD_G | SSD_B | SSD_C) },
6231 + {'I', (u_char)~(SSD_F | SSD_E) },
6232 + {'i', (u_char)~(SSD_F | SSD_E) },
6233 + {'Y', (u_char)~(SSD_F | SSD_G | SSD_B | SSD_C | SSD_D) },
6234 + {'y', (u_char)~(SSD_F | SSD_G | SSD_B | SSD_C | SSD_D) },
6235 + {'-', (u_char)~(SSD_G) },
6236 + {'_', (u_char)~(SSD_D) },
6237 + {'.', (u_char)~(SSD_DOT) },
6238 + {' ', SSD_BLANK },
6239 + {0x00, SSD_BLANK },
6240 + { -1, (u_char)~(0x00) } /* End Of Data --- Must Be Last */
6243 +/**********************************************************************
6244 +* Function: val_to_raw_val
6245 +**********************************************************************/
6246 +static u_char val_to_raw_val(u_char val)
6248 + sevenSegmentData_t *data;
6249 + u_char raw_val = 0xFF; /* Assume a blank if not found */
6250 + for (data = sevenSegmentData; data->val != -1; data++) {
6251 + if (val == data->val) {
6252 + raw_val = data->raw_val;
6259 +/**********************************************************************
6260 +* Function: raw_val_to_val
6261 +**********************************************************************/
6262 +static u_char raw_val_to_val(u_char raw_val)
6264 + sevenSegmentData_t *data;
6265 + u_char val = ' '; /* Assume a blank if not found */
6266 + for (data = sevenSegmentData; data->val != -1; data++) {
6267 + if (raw_val == data->raw_val) {
6275 +/**********************************************************************
6276 +* Function: lh79x_7seg_read_raw_display
6277 +* Function: lh79x_7seg_read_raw_display_lsb
6278 +* Function: lh79x_7seg_read_raw_display_msb
6279 +**********************************************************************/
6280 +uint16_t lh79x_7seg_read_raw_display(void)
6282 + sevenSegmentContext_t *sevenSegmentContext = &sevenSegmentContext_l;
6286 + * NOTE: The device does not read so we have to remember...
6288 + raw_val = sevenSegmentContext->currentRawVal;
6289 + vdprintk("lh79x_7seg_read_raw_display(0x%04X)\n", raw_val);
6294 +u_char lh79x_7seg_read_raw_display_lsb(void)
6299 + raw_val = lh79x_7seg_read_raw_display();
6300 + raw_lsb = (u_char)(raw_val & 0xFF);
6305 +u_char lh79x_7seg_read_raw_display_msb(void)
6310 + raw_val = lh79x_7seg_read_raw_display();
6311 + raw_msb = (u_char)((raw_val >> 8) & 0xFF);
6316 +/**********************************************************************
6317 +* Function: lh79x_7seg_read_display
6318 +* Function: lh79x_7seg_read_display_lsb
6319 +* Function: lh79x_7seg_read_display_msb
6320 +**********************************************************************/
6321 +uint16_t lh79x_7seg_read_display(void)
6323 + uint16_t raw_val, val;
6324 + u_char raw_lsb, lsb;
6325 + u_char raw_msb, msb;
6327 + raw_val = lh79x_7seg_read_raw_display();
6328 + raw_lsb = (u_char)( raw_val & 0xFF);
6329 + raw_msb = (u_char)((raw_val >> 8) & 0xFF);
6330 + lsb = raw_val_to_val(raw_lsb);
6331 + msb = raw_val_to_val(raw_msb);
6332 + val = (uint16_t)((msb << 8) | lsb);
6337 +u_char lh79x_7seg_read_display_lsb(void)
6339 + u_char raw_lsb, lsb;
6341 + raw_lsb = lh79x_7seg_read_raw_display_lsb();
6342 + lsb = raw_val_to_val(raw_lsb);
6347 +u_char lh79x_7seg_read_display_msb(void)
6349 + u_char raw_msb, msb;
6351 + raw_msb = lh79x_7seg_read_raw_display_msb();
6352 + msb = raw_val_to_val(raw_msb);
6357 +/**********************************************************************
6358 +* Function: lh79x_7seg_write_raw_display
6359 +* Function: lh79x_7seg_write_raw_display_lsb
6360 +* Function: lh79x_7seg_write_raw_display_msb
6361 +**********************************************************************/
6362 +void lh79x_7seg_write_raw_display(uint16_t raw_val)
6364 + sevenSegmentContext_t *sevenSegmentContext = &sevenSegmentContext_l;
6366 + vdprintk("lh79x_7seg_write_raw_display(0x%04X)\n", raw_val);
6368 + * NOTE: The device does not read so we have to remember...
6370 + sevenSegmentContext->currentRawVal = raw_val;
6371 + cpld->seven_seg = raw_val;
6376 +void lh79x_7seg_write_raw_display_lsb(u_char raw_lsb)
6380 + raw_val = lh79x_7seg_read_raw_display();
6381 + raw_val &= 0xFF00;
6382 + raw_val &= ((uint16_t)raw_lsb) & 0x00FF;
6383 + lh79x_7seg_write_raw_display(raw_val);
6388 +void lh79x_7seg_write_raw_display_msb(u_char raw_msb)
6392 + raw_val = lh79x_7seg_read_raw_display();
6393 + raw_val &= 0x00FF;
6394 + raw_val &= (((uint16_t)raw_msb) << 8) & 0xFF00;
6395 + lh79x_7seg_write_raw_display(raw_val);
6400 +/**********************************************************************
6401 +* Function: lh79x_7seg_write_display
6402 +* Function: lh79x_7seg_write_display_lsb
6403 +* Function: lh79x_7seg_write_display_msb
6404 +* Function: lh79x_7seg_write_display_str
6405 +**********************************************************************/
6406 +void lh79x_7seg_write_display(uint16_t val)
6408 + u_char raw_lsb, lsb;
6409 + u_char raw_msb, msb;
6412 + lsb = (u_char)( val & 0xFF);
6413 + msb = (u_char)((val >> 8) & 0xFF);
6414 + raw_lsb = val_to_raw_val(lsb);
6415 + raw_msb = val_to_raw_val(msb);
6416 + raw_val = (uint16_t)((raw_msb << 8) | raw_lsb);
6417 + lh79x_7seg_write_raw_display(raw_val);
6422 +void lh79x_7seg_write_display_lsb(u_char lsb)
6426 + raw_lsb = val_to_raw_val(lsb);
6427 + lh79x_7seg_write_raw_display_lsb(raw_lsb);
6432 +void lh79x_7seg_write_display_msb(u_char msb)
6436 + raw_msb = val_to_raw_val(msb);
6437 + lh79x_7seg_write_raw_display_msb(raw_msb);
6442 +void lh79x_7seg_write_display_str(u_char *str)
6449 + /* This is basically a read, shift, write lsb loop */
6450 + for ( ; *str; str++) {
6452 + if (c == '\n') continue;
6453 + if (c == '\r') continue;
6454 + val = lh79x_7seg_read_display();
6459 + lh79x_7seg_write_display(val);
6465 +/**********************************************************************
6466 +* Function: sevenSegment_read
6467 +* Function: sevenSegment_poll
6468 +* Function: sevenSegment_open
6469 +* Function: sevenSegment_fasync
6470 +* Function: sevenSegment_release
6471 +* ************************************
6472 +* *** User space driver interfaces ***
6473 +* ************************************
6474 +**********************************************************************/
6477 +* NOTE: The read algorithm is wide open for interpretation.
6478 +* I am not sure what the behaviour ought to be here.
6480 +static ssize_t sevenSegment_read(struct file *filp, char *buffer,
6481 + size_t _count, loff_t *ppos)
6483 + sevenSegmentContext_t *sevenSegmentContext = filp->private_data;
6484 + DECLARE_WAITQUEUE(wait, current);
6485 + ssize_t sizeRead = 0;
6486 + char *ptr = buffer;
6488 + int count = (int)_count;
6492 + int dataByteCount;
6494 + switch (sevenSegmentContext->accessMode) {
6495 + case ACCESSMODE_LSB:
6496 + case ACCESSMODE_MSB:
6499 + case ACCESSMODE_SHIFT:
6504 + dataByteCount = dataSize / 8;
6506 + add_wait_queue(&sevenSegmentContext->read_and_write_wait, &wait);
6507 + while (count >= dataByteCount) {
6508 + err = -ERESTARTSYS;
6509 + if (signal_pending(current))
6511 + /* NOTE: We always have data */
6512 + switch (sevenSegmentContext->accessMode) {
6513 + case ACCESSMODE_LSB:
6514 + c = lh79x_7seg_read_display_lsb();
6516 + case ACCESSMODE_MSB:
6517 + c = lh79x_7seg_read_display_msb();
6519 + case ACCESSMODE_SHIFT:
6521 + c16 = lh79x_7seg_read_display();
6522 + /* Flip the bytes so they get returned in the correct order */
6523 + c = (u_char)(c16 >> 8);
6524 + c16 = ((c16 << 8) & 0xFF00) | ((uint16_t)c);
6527 + if (dataSize == 8) {
6528 + err = copy_to_user(ptr, &c, sizeof(c));
6532 + count -= sizeof(c);
6533 + } else /* (dataSize == 16) */ {
6534 + err = copy_to_user(ptr, &c16, sizeof(c16));
6537 + ptr += sizeof(c16);
6538 + count -= sizeof(c16);
6541 + remove_wait_queue(&sevenSegmentContext->read_and_write_wait, &wait);
6542 + sizeRead = (ptr == buffer ? err : ptr - buffer);
6546 +static ssize_t sevenSegment_write(struct file *filp, const char *buffer,
6547 + size_t _count, loff_t *ppos)
6549 + sevenSegmentContext_t *sevenSegmentContext = filp->private_data;
6550 + ssize_t sizeWritten = 0;
6551 + const char *ptr = buffer;
6558 + for (count = (int)_count; count > 0; count--) {
6559 + /* NOTE: We always have room for the data */
6560 + get_user(c, ptr++);
6561 + /* Ignore new_line or carriage_return characters */
6562 + if (c == '\n') continue;
6563 + if (c == '\r') continue;
6564 + vdprintk("JMG: (e:%d, r:%d, a:%d) Attempting to write (%c) == (0x%02X)\n",
6565 + sevenSegmentContext->inEscape,
6566 + sevenSegmentContext->rawData,
6567 + sevenSegmentContext->accessMode,
6569 + if (sevenSegmentContext->inEscape) {
6570 + sevenSegmentContext->inEscape = 0;
6571 + if ( c != ESCAPE ) {
6573 + case 'r': /* Raw Data */
6574 + case 'R': /* Raw Data */
6575 + sevenSegmentContext->rawData = 1;
6577 + case 'c': /* Coooked Data */
6578 + case 'C': /* Coooked Data */
6579 + sevenSegmentContext->rawData = 0;
6581 + case 'l': /* LSB */
6582 + case 'L': /* LSB */
6583 + sevenSegmentContext->accessMode = ACCESSMODE_LSB;
6585 + case 'm': /* MSB */
6586 + case 'M': /* MSB */
6587 + sevenSegmentContext->accessMode = ACCESSMODE_MSB;
6589 + case 's': /* Shift */
6590 + case 'S': /* Shift */
6591 + case 'n': /* Normal */
6592 + case 'N': /* Normal */
6594 + sevenSegmentContext->accessMode = ACCESSMODE_SHIFT;
6598 + } else if ( c == ESCAPE ) {
6599 + sevenSegmentContext->inEscape = 1;
6602 + if (sevenSegmentContext->rawData) {
6603 + val = lh79x_7seg_read_raw_display();
6605 + val = lh79x_7seg_read_display();
6607 + switch (sevenSegmentContext->accessMode) {
6608 + case ACCESSMODE_LSB:
6613 + case ACCESSMODE_MSB:
6615 + c16 = ((uint16_t)c << 8) & 0xFF00;
6618 + case ACCESSMODE_SHIFT:
6626 + vdprintk("JMG: Writing (0x%04X)\n", val);
6627 + if (sevenSegmentContext->rawData) {
6628 + lh79x_7seg_write_raw_display(val);
6630 + lh79x_7seg_write_display(val);
6633 + filp->f_dentry->d_inode->i_mtime = CURRENT_TIME;
6634 + sizeWritten = (ptr == buffer ? err : ptr - buffer);
6635 + return(sizeWritten);
6638 +static unsigned int sevenSegment_poll(struct file *filp, poll_table *wait)
6640 + sevenSegmentContext_t *sevenSegmentContext = filp->private_data;
6641 + /* We ALWAYS have data waiting ;) */
6642 + int sts = POLLIN | POLLRDNORM;
6643 + poll_wait(filp, &sevenSegmentContext->read_and_write_wait, wait);
6647 +static int sevenSegment_open(struct inode *inode, struct file *filp)
6649 + sevenSegmentContext_t *sevenSegmentContext = &sevenSegmentContext_l;
6651 + filp->private_data = sevenSegmentContext;
6655 +static int sevenSegment_fasync(int fd, struct file *filp, int on)
6657 + sevenSegmentContext_t *sevenSegmentContext = filp->private_data;
6659 + sts = fasync_helper(fd, filp, on, &sevenSegmentContext->fasync);
6663 +static int sevenSegment_release(struct inode *inode, struct file *filp)
6666 + sevenSegment_fasync(-1, filp, 0);
6671 +/**********************************************************************
6672 +* Define (fill in) the user space file operations for this driver
6673 +* and initialize the Seven Segment driver as a "miscdevice":
6675 +* Major(10) --- Non-serial mice, misc features
6676 +* Minor(21) --- /dev/7seg (7-segment display)
6677 +**********************************************************************/
6678 +static struct file_operations sevenSegment_fops = {
6679 +owner: THIS_MODULE,
6680 +read: sevenSegment_read,
6681 +write: sevenSegment_write,
6682 +poll: sevenSegment_poll,
6683 +open: sevenSegment_open,
6684 +fasync: sevenSegment_fasync,
6685 +release: sevenSegment_release,
6688 +static struct miscdevice sevenSegment_dev = {
6691 +fops: &sevenSegment_fops,
6694 +/**********************************************************************
6695 +* Function: lh79x_7seg_init
6698 +* Register & Initialize the module
6699 +**********************************************************************/
6700 +static int lh79x_7seg_init(void)
6702 + sevenSegmentContext_t *sevenSegmentContext = &sevenSegmentContext_l;
6704 + dprintk("ENTER: lh79x_7seg_init()\n");
6705 + init_waitqueue_head(&sevenSegmentContext->read_and_write_wait);
6706 + sts = misc_register(&sevenSegment_dev);
6707 + lh79x_7seg_write_display_str((u_char *)"HI");
6708 + dprintk("LEAVE: lh79x_7seg_init(%d)\n", sts);
6712 +/**********************************************************************
6713 +* Function: lh79x_7seg_exit
6716 +* Un-Register & Cleanup the module
6717 +**********************************************************************/
6718 +static void lh79x_7seg_exit(void)
6720 + dprintk("ENTER: lh79x_7seg_exit()\n");
6721 + misc_deregister(&sevenSegment_dev);
6722 + lh79x_7seg_write_display_str((u_char *)"BY");
6723 + dprintk("LEAVE: lh79x_7seg_exit()\n");
6727 +module_init(lh79x_7seg_init);
6728 +module_exit(lh79x_7seg_exit);
6730 +MODULE_AUTHOR("Jim Gleason / Lineo, Inc.");
6731 +MODULE_DESCRIPTION("Seven Segment Display Driver for Sharp LH7x EVB");
6732 +MODULE_LICENSE("Copyright (c) 2002 Lineo, Inc.");
6734 diff -urN linux-2.4.26/drivers/misc/Makefile linux-2.4.26-vrs1-lnode80/drivers/misc/Makefile
6735 --- linux-2.4.26/drivers/misc/Makefile 2005-11-02 16:54:22.000000000 -0400
6736 +++ linux-2.4.26-vrs1-lnode80/drivers/misc/Makefile 2005-11-02 17:37:31.000000000 -0400
6738 obj-$(CONFIG_MCP_UCB1200) += ucb1x00-core.o
6739 obj-$(CONFIG_MCP_UCB1200_AUDIO) += ucb1x00-audio.o
6740 obj-$(CONFIG_MCP_UCB1200_TS) += ucb1x00-ts.o
6741 +obj-$(CONFIG_TOUCHSCREEN_LH79520) += ads784x.o marm-lh7x.o
6742 +obj-$(CONFIG_EEPROM_LH79520) += eeprom-lh7x.o
6743 +obj-$(CONFIG_7SEGMENT_LH79520) += lh7x-7seg.o
6745 include $(TOPDIR)/Rules.make
6747 diff -urN linux-2.4.26/drivers/misc/marm-lh7x.c linux-2.4.26-vrs1-lnode80/drivers/misc/marm-lh7x.c
6748 --- linux-2.4.26/drivers/misc/marm-lh7x.c 1969-12-31 20:00:00.000000000 -0400
6749 +++ linux-2.4.26-vrs1-lnode80/drivers/misc/marm-lh7x.c 2005-11-02 17:37:31.000000000 -0400
6751 +/* vi: set sw=4 ts=4 ai: */
6755 +/**********************************************************************
6756 +* linux/drivers/misc/ssp-lh7x.c
6758 +* Provide SSP (synchronous Serial Port) functionality for LH7x EVB boards
6760 +* Copyright (C) 2002 Lineo, Inc.
6762 +* This program is free software; you can redistribute it and/or modify
6763 +* it under the terms of the GNU General Public License (GPL) version 2
6764 +* as published by the Free Software Foundation.
6766 +**********************************************************************/
6768 +#include <linux/config.h>
6769 +#include <linux/types.h>
6770 +#include <linux/kernel.h>
6771 +#include <linux/init.h>
6772 +#include <linux/module.h>
6773 +#include <linux/wait.h>
6774 +#include <linux/sched.h>
6775 +#include <linux/smp_lock.h>
6776 +#include <linux/spinlock.h>
6777 +#include <linux/delay.h>
6781 +#define DRVNAME "marm_lh7x"
6782 +#include <linux/verbosedebug.h>
6784 +#include <linux/version.h>
6786 +char kernel_version[] = UTS_RELEASE;
6787 +#endif /* MODULE */
6789 +#include <asm/irq.h>
6790 +#include <asm/mach/irq.h>
6791 +#include <asm/arch/irq.h>
6792 +#include <asm/arch/iocon.h>
6793 +#include <asm/arch/hardware.h>
6794 +#include <asm/arch/gpio.h>
6795 +#include <asm/arch/ssp_lh7x.h>
6796 +#include <lh79520.h>
6799 +// global set by pl110fb driver
6800 +unsigned short marm_backlight;
6803 +#define BACKLIGHT marm_backlight
6805 +#define MARM_TS_INT 3
6806 +#define MARM_TS_IOBIT 6
6808 +static volatile u16 *gpioa = (volatile u16 *) GPOUT16_BASE;
6809 +static gpioARegs_t *gpioadr = (gpioARegs_t *) GPIO0_BASE;
6810 +static ioconRegs_t *iocon = (ioconRegs_t *)IOCON_PHYS;
6811 +static vicRegs_t *vic = (vicRegs_t *)VIC_BASE;
6812 +static rcpcRegs_t *rcpc = (rcpcRegs_t *) RCPC_PHYS;
6814 +/**********************************************************************
6815 +* Function: ssp_busy_wait
6818 +* Wait until the state of the SSP busy bit from the status register
6819 +* indicates the SSP is no longer busy.
6823 +**********************************************************************/
6824 +static void ssp_busy_wait(void)
6826 + vdprintk("ENTER: ssp_busy_wait()\n");
6829 +/**********************************************************************
6830 +* Function: ssp_flush_tx_fifo
6831 +* Function: ssp_flush_rx_fifo
6834 +* Flush the transmit (tx) and receive (rx) fifo buffer
6838 +**********************************************************************/
6839 +static void ssp_flush_tx_fifo(sspContext_t *sspContext)
6841 + vdprintk("ENTER: ssp_flush_tx_fifo()\n");
6844 +static void ssp_flush_rx_fifo(sspContext_t *sspContext)
6846 + vdprintk("ENTER: ssp_flush_rx_fifo()\n");
6849 +/**********************************************************************
6850 +* Function: ssp_chipselect_enable
6851 +* Function: ssp_chipselect_disable
6852 +* Function: ssp_chipselect_manual
6853 +* Function: ssp_chipselect_automatic
6856 +* Controls the chipselect pin associated with the SSP
6861 +**********************************************************************/
6862 +static void ssp_chipselect_enable(void)
6864 + vdprintk("ENTER: ssp_chipselect_enable()\n");
6867 +static void ssp_chipselect_disable(void)
6869 + vdprintk("ENTER: ssp_chipselect_disable()\n");
6872 +static void ssp_chipselect_manual(void)
6874 + vdprintk("ENTER: ssp_chipselect_manual()\n");
6876 + gpioadr->ddr &= ~(1 << MARM_TS_IOBIT); // make sure PA is input
6877 + iocon->MiscMux &= ~(MISCMUX_RCEII0); // make it PA6 instead of IRQ0
6879 + // ensure TS IRQ pin is interrupt
6880 + iocon->LCDMux &= ~(MISCMUX_PWM0SYNC); // assumes irq 3
6883 +static void ssp_chipselect_automatic(void)
6885 + vdprintk("ENTER: ssp_chipselect_automatic()\n");
6886 + ssp_chipselect_manual();
6889 +/**********************************************************************
6890 +* Function: ssp_lh7x_write16
6893 +* Write the LH7x SSP data register
6894 +**********************************************************************/
6895 +static void ssp_lh7x_write16(sspContext_t *sspContext,
6896 + unsigned int data)
6899 + int ndata = data & 0xFF;
6902 + vdprintk("ENTER: ssp_lh7x_write16() 0x%04X\n", data);
6905 + pdata = BACKLIGHT; // keep on backlight
6906 + *gpioa = pdata; // assert nCS
6908 + for (i = 8; i > 0; i--)
6910 + *gpioa = qdata = pdata | ((ndata & 0x80) ? TS_DIN : 0); // strobe out bit
6912 + *gpioa = qdata | TS_DCLK | nLED; // raise clock
6914 + *gpioa = qdata; // lower clock
6919 + udelay(50); // leave enough time for conversion
6924 +/**********************************************************************
6925 +* Function: ssp_lh7x_read16
6928 +* Read the LH7x SSP data register
6929 +**********************************************************************/
6930 +static unsigned int ssp_lh7x_read16(sspContext_t *sspContext)
6935 + pdata = BACKLIGHT;
6938 + for (i = 16; i > 0; i--)
6942 + *gpioa = pdata | TS_DCLK | nLED;
6945 + if (gpioadr->dr & (1 << MARM_TS_IOBIT))
6951 + vdprintk("LEAVE: ssp_lh7x_read16() 0x%04X (%04d norm) raw\n", ndata, ndata >> 4);
6952 + return(ndata >> 4);
6955 +/**********************************************************************
6956 +* Macro: ssp_lh7x_ts_pen_down
6957 +**********************************************************************/
6958 +static int ssp_lh7x_ts_pen_down(sspContext_t *sspContext)
6960 + int pen_down = vic->RawIntr & (1 << MARM_TS_INT); //look for IRQ
6961 + vdprintk("ssp_lh7x_ts_pen_down(%d)\n", pen_down);
6962 + return (pen_down);
6965 +/**********************************************************************
6966 +* Macro: ssp_lh7x_ts_pen_down_irq_enable
6967 +**********************************************************************/
6968 +static int ssp_lh7x_ts_pen_down_irq_enable(sspContext_t *sspContext)
6970 + int lastState = vic->IntEnable & (1 << MARM_TS_INT);
6971 + vdprintk("ssp_lh7x_ts_pen_down_irq_enable: lastState %d\n", lastState);
6973 + //enable_irq(MARM_TS_INT);
6974 + rcpc->control |= RCPC_CTRL_WRTLOCK_ENABLED;
6976 + rcpc->control &= ~RCPC_CTRL_WRTLOCK_ENABLED;
6978 + sspContext->irq_state = 1;
6979 + return(lastState);
6982 +/**********************************************************************
6983 +* Macro: ssp_lh7x_ts_pen_down_irq_disable
6984 +**********************************************************************/
6985 +static int ssp_lh7x_ts_pen_down_irq_disable(
6986 + sspContext_t *sspContext)
6988 + int lastState = vic->IntEnable & (1 << MARM_TS_INT);
6989 + vdprintk("ssp_lh7x_ts_pen_down_irq_disable: lastState %d\n", lastState);
6990 + //disable_irq(MARM_TS_INT);
6991 + rcpc->control |= RCPC_CTRL_WRTLOCK_ENABLED;
6993 + rcpc->intClear = (1 << MARM_TS_INT);
6994 + rcpc->control &= ~RCPC_CTRL_WRTLOCK_ENABLED;
6995 + sspContext->irq_state = 0;
6996 + return(lastState);
6999 +/**********************************************************************
7000 +* Function: ssp_lh7x_ts_pen_down_irq
7002 +* We only detect touch screen _touches_ (pen down) with this interrupt
7003 +* handler, and even then we just schedule our task.
7005 +* Note: It has already been determined that this is our interrupt
7006 +* before we ever get it here so checking is minimal to non-existant.
7007 +**********************************************************************/
7008 +static void ssp_lh7x_ts_pen_down_irq(int irq, sspContext_t *sspContext,
7009 + struct pt_regs * regs)
7012 + * Disable the touchscreen interrupts
7013 + * by disabling the touchscreen IRQ
7015 + * Enable regular polling of the touchscreen device
7016 + * (The touchscreen IRQ will be re-enabled and polling
7017 + * will be disabled when it is detected that the
7018 + * pen is no longer down.)
7020 + /* Disable touch screen IRQ */
7021 + vdprintk("ENTER: ssp_lh7x_ts_pen_down_irq()\n");
7022 + ssp_lh7x_ts_pen_down_irq_disable(sspContext);
7023 + vdprintk("ENTER: wake_up()\n");
7024 + wake_up(sspContext->irq_wait_ptr);
7025 + vdprintk("LEAVE: ssp_lh7x_ts_pen_down_irq()\n");
7029 +/**********************************************************************
7030 +* Function: ssp_lh7x_irq_handler
7032 +* This interrupt handler only directs traffic for the interrupts
7033 +* by forwarding on the call to the appropriate interrupt handler.
7034 +**********************************************************************/
7035 +static void ssp_lh7x_irq_handler(int irq, void *_sspContext,
7036 + struct pt_regs * regs)
7038 + sspContext_t *sspContext = _sspContext;
7040 + vdprintk("ENTER: ssp_lh7x_irq_handler()\n");
7041 + if ((sspContext) && (sspContext->irq_wait_ptr)) {
7042 + if (ssp_lh7x_ts_pen_down(sspContext))
7043 + ssp_lh7x_ts_pen_down_irq(irq, sspContext, regs);
7045 +#if defined(VERBOSE) && defined(DEBUG)
7046 + printk("ssp_lh7x_irq_handler() --- Not our interrupt\n");
7050 + } // if(sspContext) ...
7051 +#if defined(VERBOSE) && defined(DEBUG)
7053 + printk("ssp_lh7x_irq_handler( NO ACTION )\n");
7059 +/**********************************************************************
7060 +* Function: ssp_lh7x_lock
7061 +* Function: ssp_lh7x_unlock
7064 +* Lock/UnLock the SSP for a particular device (ts/ee)
7065 +**********************************************************************/
7066 +static int ssp_lh7x_lock(sspContext_t *sspContext, int device)
7068 + vdprintk("ENTER: ssp_lh7x_lock()\n");
7072 +static int ssp_lh7x_unlock(sspContext_t *sspContext, int device)
7074 + vdprintk("ENTER: ssp_lh7x_unlock()\n");
7078 +/**********************************************************************
7079 +* Function: ssp_lh7x_disable
7082 +* Disconnect I/O pins from the SSP module
7083 +* and disable the SSP peripheral and its clocks.
7084 +**********************************************************************/
7085 +static void ssp_lh7x_disable(void)
7087 + vdprintk("ENTER: ssp_lh7x_disable()\n");
7090 +/**********************************************************************
7091 +* Function: ssp_lh7x_enable
7094 +* Disconnect I/O pins from the SSP module
7095 +* and disable the SSP peripheral and its clocks.
7096 +**********************************************************************/
7097 +static void ssp_lh7x_enable(void)
7099 + vdprintk("ENTER: ssp_lh7x_enable()\n");
7103 +/**********************************************************************
7104 +* Fill in our context structures
7105 +**********************************************************************/
7107 +static sspContext_t sspContext_l = {
7108 + ts_txTimeout: 10000,
7109 + ts_rxTimeout: 10000,
7110 + ee_txTimeout: 10000,
7111 + ee_rxTimeout: 10000,
7115 +/**********************************************************************
7116 +* Function: ssp_request_pointer
7117 +* Function: ssp_provide_pointer
7120 +* Register & Initialize the module
7121 +**********************************************************************/
7122 +void *ssp_request_pointer(int device, char *request)
7124 + sspContext_t *sspContext = &sspContext_l;
7127 + vdprintk("ENTER: ssp_request_pointer(\"%d\":\"%s\")\n", device, request);
7128 + if (device == SSP_DEV_TOUCHSCREEN) {
7129 + if (strcmp(request, "write") == 0) {
7130 + vp = ssp_lh7x_write16;
7131 + } else if (strcmp(request, "read") == 0) {
7132 + vp = ssp_lh7x_read16;
7133 + } else if (strcmp(request, "enable_pen_down_irq") == 0) {
7134 + vp = ssp_lh7x_ts_pen_down_irq_enable;
7135 + } else if (strcmp(request, "disable_pen_down_irq") == 0) {
7136 + vp = ssp_lh7x_ts_pen_down_irq_disable;
7137 + } else if (strcmp(request, "is_pen_down") == 0) {
7138 + vp = ssp_lh7x_ts_pen_down;
7139 + } else if (strcmp(request, "lock") == 0) {
7140 + vp = ssp_lh7x_lock;
7141 + } else if (strcmp(request, "unlock") == 0) {
7142 + vp = ssp_lh7x_unlock;
7143 + } else if (strcmp(request, "sspContext") == 0) {
7145 + } else if (strcmp(request, "flush_tx_fifo") == 0) {
7146 + vp = ssp_flush_tx_fifo;
7147 + } else if (strcmp(request, "flush_rx_fifo") == 0) {
7148 + vp = ssp_flush_rx_fifo;
7149 + } else if (strcmp(request, "ssp_busy_wait") == 0) {
7150 + vp = ssp_busy_wait;
7151 + } else if (strcmp(request, "chipselect_enable") == 0) {
7152 + vp = ssp_chipselect_enable;
7153 + } else if (strcmp(request, "chipselect_disable") == 0) {
7154 + vp = ssp_chipselect_disable;
7155 + } else if (strcmp(request, "chipselect_manual") == 0) {
7156 + vp = ssp_chipselect_manual;
7158 + } else if (device == SSP_DEV_EEPROM) {
7161 + vdprintk("LEAVE: ssp_request_pointer(0x%08X)\n", (unsigned int)vp);
7166 +void *ssp_provide_pointer(int device, char *request, void *vp)
7168 + sspContext_t *sspContext = &sspContext_l;
7170 + vdprintk("ENTER: ssp_provide_pointer(\"%d\":\"%s\":0x%08X)\n",
7171 + device, request, (unsigned int)vp);
7172 + if (device == SSP_DEV_TOUCHSCREEN) {
7173 + if (strcmp(request, "irq_wait_ptr") == 0) {
7174 + sspContext->irq_wait_ptr = vp;
7178 + } else if (device == SSP_DEV_EEPROM) {
7183 + vdprintk("LEAVE: ssp_provide_pointer(0x%08X)\n", (unsigned int)vp);
7188 +/**********************************************************************
7189 +* Function: ssp_lh7x_init
7192 +* Register & Initialize the module
7193 +**********************************************************************/
7194 +static int __init ssp_lh7x_init(void)
7196 + sspContext_t *sspContext = &sspContext_l;
7200 + vdprintk("ENTER: ssp_lh7x_init()\n");
7203 + * Disconnect I/O pins from the SSP module
7204 + * and disable the SSP peripheral and its clocks.
7206 + ssp_lh7x_disable();
7208 + /* Flush the transmit FIFO */
7209 + ssp_flush_tx_fifo(sspContext);
7211 + /* Flush the receive FIFO */
7212 + ssp_flush_rx_fifo(sspContext);
7214 + ssp_chipselect_automatic();
7216 + * Connect I/O pins from the SSP module
7217 + * and enable the SSP peripheral and its clocks.
7219 + ssp_lh7x_enable();
7222 + * Request IRQ and attach it to the touchscreen pen_down line and enable it
7224 + sspContext->haveIrq = 0;
7225 + result = request_irq(MARM_TS_INT, ssp_lh7x_irq_handler,
7226 + SA_SAMPLE_RANDOM, DRVNAME, sspContext);
7228 + printk("%s: cannot get requested IRQ(MARM_TS_INT)\n", DRVNAME);
7230 + sspContext->haveIrq = 1;
7231 + vdprintk("%s: got requested IRQ(MARM_TS_INT)\n", DRVNAME);
7233 + ssp_lh7x_ts_pen_down_irq_enable(sspContext);
7235 + vdprintk("LEAVE: ssp_lh7x_init()\n");
7239 +/**********************************************************************
7240 +* Function: ssp_lh7x_exit
7243 +* Un-Register & Cleanup the module
7244 +**********************************************************************/
7245 +static void ssp_lh7x_exit(void)
7247 + sspContext_t *sspContext = &sspContext_l;
7249 + vdprintk("ENTER: ssp_lh7x_exit()\n");
7252 + * Disable & Return IRQ
7255 + ssp_lh7x_ts_pen_down_irq_disable(sspContext);
7256 + if (sspContext->haveIrq) {
7257 + free_irq(MARM_TS_INT, sspContext);
7258 + sspContext->haveIrq = 0;
7262 + vdprintk("LEAVE: ssp_lh7x_exit()\n");
7266 +module_init(ssp_lh7x_init);
7267 +module_exit(ssp_lh7x_exit);
7269 +MODULE_AUTHOR("Jim Gleason / Lineo, Inc.");
7270 +MODULE_DESCRIPTION("SSP Driver for Sharp LH7x EVB");
7271 +MODULE_LICENSE("Copyright (c) 2002 Lineo, Inc.");
7272 diff -urN linux-2.4.26/drivers/misc/ssp.h linux-2.4.26-vrs1-lnode80/drivers/misc/ssp.h
7273 --- linux-2.4.26/drivers/misc/ssp.h 1969-12-31 20:00:00.000000000 -0400
7274 +++ linux-2.4.26-vrs1-lnode80/drivers/misc/ssp.h 2005-11-02 17:37:31.000000000 -0400
7276 +/* vi: set sw=4 ts=4 ai: */
7278 +/**********************************************************************
7279 +* linux/drivers/misc/ssp.h
7281 +* Copyright (C) 2002 Lineo, Inc.
7283 +* Provide SSP types & definitions
7285 +* This program is free software; you can redistribute it and/or modify
7286 +* it under the terms of the GNU General Public License (GPL) version 2
7287 +* as published by the Free Software Foundation.
7289 +**********************************************************************/
7294 +/*********************************************************************
7295 +* Global Function Declarations
7296 +*********************************************************************/
7297 +extern void *ssp_request_pointer(int device, char *request);
7298 +extern void *ssp_provide_pointer(int device, char *request, void *vp);
7300 +#define SSP_DEV_TOUCHSCREEN 1
7301 +#define SSP_DEV_EEPROM 2
7303 +#endif /* _SSP_h */
7305 diff -urN linux-2.4.26/drivers/misc/ssp-lh7x.c linux-2.4.26-vrs1-lnode80/drivers/misc/ssp-lh7x.c
7306 --- linux-2.4.26/drivers/misc/ssp-lh7x.c 1969-12-31 20:00:00.000000000 -0400
7307 +++ linux-2.4.26-vrs1-lnode80/drivers/misc/ssp-lh7x.c 2005-11-02 17:37:31.000000000 -0400
7309 +/* vi: set sw=4 ts=4 ai: */
7313 +/**********************************************************************
7314 +* linux/drivers/misc/ssp-lh7x.c
7316 +* Provide SSP (synchronous Serial Port) functionality for LH7x EVB boards
7318 +* Copyright (C) 2002 Lineo, Inc.
7320 +* This program is free software; you can redistribute it and/or modify
7321 +* it under the terms of the GNU General Public License (GPL) version 2
7322 +* as published by the Free Software Foundation.
7324 +**********************************************************************/
7326 +#include <linux/config.h>
7327 +#include <linux/types.h>
7328 +#include <linux/kernel.h>
7329 +#include <linux/init.h>
7330 +#include <linux/module.h>
7331 +//#include <linux/wait.h>
7332 +#include <linux/sched.h>
7333 +#include <linux/smp_lock.h>
7334 +#include <linux/spinlock.h>
7335 +//#include <linux/interrupt.h>
7336 +//#include <linux/irq.h>
7340 +#undef DRVNAME //"ssp_lh7x"
7341 +#include <linux/verbosedebug.h>
7343 +#include <linux/version.h>
7345 +char kernel_version[] = UTS_RELEASE;
7346 +#endif /* MODULE */
7348 +#include <asm/irq.h>
7349 +#include <asm/mach/irq.h>
7350 +#include <asm/arch/irq.h>
7351 +#include <asm/arch/iocon.h>
7352 +#include <asm/arch/hardware.h>
7353 +#include <asm/arch/gpio.h>
7354 +//#include <asm/arch/cpld.h>
7355 +#include <asm/arch/rcpc.h>
7356 +#include <asm/arch/ssp_lh7x.h>
7359 +unsigned int hclkfreq_get( void);
7361 +static gpioARegs_t *gpioa = (gpioARegs_t *)GPIO0_PHYS;
7362 +static ioconRegs_t *iocon = (ioconRegs_t *)IOCON_PHYS;
7363 +static rcpcRegs_t *rcpc = (rcpcRegs_t *)RCPC_PHYS;
7364 +//static cpldRegs_t *cpld = (cpldRegs_t *)CPLD_BASE;
7365 +static sspRegs_t *ssp = (sspRegs_t *)SSP_BASE;
7366 +static vicRegs_t *vic = (vicRegs_t *)VIC_BASE;
7369 +* The frequency of the clock that feeds the SSP clock prescaler in the RCPC
7370 +* The frequency is in Hz
7372 +static unsigned int hclk_freq = 0;
7374 +/**********************************************************************
7375 +* Additional RCPC defines
7376 +**********************************************************************/
7377 +#define rcpc_sspClkControl spareClkCtrl
7378 +#define rcpc_sspClkPrescale spare1Prescale
7380 +#define RCPC_LOCK 1
7381 +#define RCPC_LOCKED RCPC_LOCK
7382 +#define RCPC_UNLOCK 0
7383 +#define RCPC_UNLOCKED RCPC_UNLOCK
7385 +/**********************************************************************
7386 +* Function: ssp_busy_wait
7389 +* Wait until the state of the SSP busy bit from the status register
7390 +* indicates the SSP is no longer busy.
7394 +**********************************************************************/
7395 +static void ssp_busy_wait(void)
7397 + while ( ssp->sr & SSP_SR_BSY ) {
7403 +/**********************************************************************
7404 +* Function: ssp_flush_tx_fifo
7405 +* Function: ssp_flush_rx_fifo
7408 +* Flush the transmit (tx) and receive (rx) fifo buffer
7412 +**********************************************************************/
7413 +static void ssp_flush_tx_fifo(sspContext_t *sspContext)
7417 + for (i = sspContext->ts_txTimeout; ((i > 0) && (ssp->sr & SSP_SR_TFE)); i--)
7424 +static void ssp_flush_rx_fifo(sspContext_t *sspContext)
7427 + unsigned int junk;
7429 + for (i = sspContext->ts_rxTimeout; ((i > 0) && (ssp->sr & SSP_SR_RNE)); i--)
7433 + //printk("ssp_flush_rx_fifo(0x%04X)\n", junk);
7438 +/**********************************************************************
7439 +* Function: ssp_chipselect_enable
7440 +* Function: ssp_chipselect_disable
7441 +* Function: ssp_chipselect_manual
7442 +* Function: ssp_chipselect_automatic
7445 +* Controls the chipselect pin associated with the SSP
7450 +**********************************************************************/
7451 +static void ssp_chipselect_enable(void)
7453 + /* Make the SSPFRM signal (ChipSelect) high (enabled) */
7454 + /* Note: This must have had ssp_chipselect_manual() called first */
7455 + //printk("ssp_chipselect_enable()\n");
7456 +#ifdef ORDERITE_REV4
7457 + //FJBgpioa->dr &= ~(SSPFRM_GPIO_BIT); /* LOW == Enabled */
7458 + gpioa->dr &= ~(SSPEN_GPIO_BIT); /* LOW == Enabled */
7460 + gpioa->dr &= ~(SSPFRM_GPIO_BIT); /* LOW == Enabled */
7465 +static void ssp_chipselect_disable(void)
7467 + /* Make the SSPFRM signal (ChipSelect) low (disabled) */
7468 + /* Note: This must have had ssp_chipselect_manual() called first */
7469 + //printk("ssp_chipselect_disable()\n");
7470 +#ifdef ORDERITE_REV4
7471 + //FJBgpioa->dr |= SSPFRM_GPIO_BIT; /* HIGH == Disabled */
7472 + gpioa->dr |= SSPEN_GPIO_BIT; /* HIGH == Disabled */
7474 + gpioa->dr |= SSPFRM_GPIO_BIT; /* HIGH == Disabled */
7479 +static void ssp_chipselect_manual(void)
7481 + /* First, disable the ChipSelect */
7482 + //JMG ssp_chipselect_disable();
7483 + /* Set up muxing so that we manually control the ChipSelect pin */
7484 + /* via GPIO port A bit 2 */
7485 +#ifdef ORDERITE_REV4
7486 + //FJBgpioa->ddr |= SSPFRM_GPIO_BIT; /* Make GPIO an output */
7487 + gpioa->ddr |= SSPEN_GPIO_BIT; /* Make GPIO an output */
7488 + //FJBiocon->SSIMux &= ~SSIMUX_SSPFRM;
7489 + iocon->SSIMux &= ~SSIMUX_SSPENB;
7491 + gpioa->ddr |= SSPFRM_GPIO_BIT; /* Make GPIO an output */
7492 + iocon->SSIMux &= ~SSIMUX_SSPFRM;
7494 + ssp_chipselect_disable();
7498 +static void ssp_chipselect_automatic(void)
7500 + /* First, disable the ChipSelect */
7501 + ssp_chipselect_disable();
7502 +#ifdef ORDERITE_REV4
7503 + /* Set up muxing so the SSP automatically controls the ChipSelect pin */
7504 + //FJBiocon->SSIMux |= SSIMUX_SSPFRM;
7505 + iocon->SSIMux |= SSIMUX_SSPENB;
7507 + iocon->SSIMux |= SSIMUX_SSPFRM;
7512 +/**********************************************************************
7513 +* Function: rcpc_lh7x_locked
7516 +* Determine write access to the RCPC
7519 +* The lock state of the RCPC
7521 +**********************************************************************/
7522 +static int rcpc_lh7x_locked(void)
7526 + vdprintk("ENTER: rcpc_lh7x_locked()\n");
7527 + if (rcpc->control & RCPC_CTRL_WRTLOCK_ENABLED) {
7528 + lockState = RCPC_LOCKED;
7530 + lockState = RCPC_UNLOCKED;
7532 + vdprintk("LEAVE: rcpc_lh7x_locked(%s)\n",
7533 + (lockState==RCPC_LOCKED)?"Locked":"UnLocked");
7535 + return(lockState);
7538 +/**********************************************************************
7539 +* Function: rcpc_lh7x_lock
7542 +* Control write access to the RCPC
7545 +* action: RCPC_UNLOCK == can write to RCPC
7546 +* RCPC_LOCK == cannot write to RCPC
7549 +* The previous lock state of the RCPC
7551 +**********************************************************************/
7552 +static int rcpc_lh7x_lock(int action)
7556 + vdprintk("ENTER: rcpc_lh7x_lock(%s)\n",
7557 + (action==RCPC_LOCK)?"Lock":"UnLock");
7558 + priorState = rcpc_lh7x_locked();
7559 + if (action == RCPC_UNLOCK) {
7560 + rcpc->control |= RCPC_CTRL_WRTLOCK_ENABLED;
7561 + } else /* (action == RCPC_LOCK) */ {
7562 + rcpc->control &= ~RCPC_CTRL_WRTLOCK_ENABLED;
7564 + vdprintk("LEAVE: rcpc_lh7x_lock(%s)\n",
7565 + (action==RCPC_LOCK)?"Lock":"UnLock");
7567 + return(priorState);
7571 +/**********************************************************************
7572 +* Function: ssp_lh7x_get_hclk_freq
7575 +* Get the HCLK (bus clock) frequency in Hz
7576 +**********************************************************************/
7577 +static unsigned int ssp_lh7x_get_hclk_freq(void)
7579 +#define XTAL_IN 14745600 /* 14.7456 MHz crystal */
7580 +#define PLL_CLOCK (XTAL_IN * 21) /* 309 MHz PLL clock */
7582 + unsigned int _hclk_freq;
7584 + vdprintk("ENTER: ssp_lh7x_get_hclk_freq()\n");
7585 + divider = rcpc->HCLKPrescale * 2; /* HCLK prescale value */
7586 + if( divider == 0) /* No prescalar == divide by 1 */
7588 + _hclk_freq = PLL_CLOCK / divider;
7589 + vdprintk("LEAVE: ssp_lh7x_get_hclk_freq(%u)\n", _hclk_freq);
7591 + return(_hclk_freq);
7596 +/**********************************************************************
7597 +* Function: ssp_lh7x_get_speed
7600 +* Get the SSP speed in bits per second
7601 +**********************************************************************/
7602 +static int ssp_lh7x_get_speed(void)
7605 + int rcpc_prescale;
7609 + vdprintk("ENTER: ssp_lh7x_get_speed()\n");
7610 + rcpc_prescale = rcpc->rcpc_sspClkPrescale;
7611 + if (rcpc_prescale == 0) rcpc_prescale = 1;
7612 + else rcpc_prescale <<= 1;
7613 + ssp_prescale = ssp->cpsr;
7614 + ssp_divider = (ssp->cr0 & _SBF(8,_BITMASK(8) ) ) >> 8;
7615 + bps = hclk_freq / (rcpc_prescale * (ssp_prescale) * (ssp_divider + 1) );
7616 + vdprintk("LEAVE: ssp_lh7x_get_speed(%d bps)\n", bps);
7621 +/**********************************************************************
7622 +* Function: ssp_lh7x_set_speed
7625 +* Set the SSP speed in bits per second
7628 +* If the requested_bits_per_second is negaitve, return 0
7629 +* If the requested_bits_per_second is too fast, set the bit rate
7630 +* as fast as possible.
7631 +* If the requested_bits_per_second is too slow, set the bit rate as
7632 +* slow as possible.
7633 +* If the requested_bits_per_second is in range, set the RCPC
7634 +* SSP clock prescaler register, SSP prescaler, and SSP divider
7635 +* to obtain the clock as close as possible.
7638 +* bps: The desired bits per second
7641 +* The actual bps obtained or 0 if the requested bps is not obtainable.
7644 +* The mode (SPI/uWire/TI) must be set first for this function to work!
7646 +**********************************************************************/
7647 +static int ssp_lh7x_set_speed(int bps)
7649 + int rcpcLockState;
7650 + int32_t ssp_prescale;
7651 + int32_t ssp_divider;
7652 + int32_t rcpc_prescale;
7653 + int32_t new_prescale;
7654 + int32_t new_divider;
7658 + int32_t min_error;
7659 + int32_t new_error;
7660 +# define MAX_SSP_FREQ (hclk_freq / SSP_PRESCALE_MIN)
7662 + vdprintk("ENTER: ssp_lh7x_set_speed(%d bps)\n", bps);
7664 + /* Ensure we are dealing with a legal BPS */
7666 + printk("%s: requested ssp speed (%d bps) is to slow\n", DRVNAME, bps);
7667 + printk("%s: making ssp speed as slow as possible\n", DRVNAME);
7668 + /* The request bps is slower than the minimum possible */
7669 + /* ... make it as slow as possible */
7670 + /* Don't bother calculating the divider values as we know them */
7671 + rcpc_prescale = RCPC_SSP_PRESCALE_MAX;
7672 + ssp_prescale = SSP_PRESCALE_MAX;
7673 + ssp_divider = SSP_DIVIDER_MAX;
7674 + } else if (bps >= MAX_SSP_FREQ) {
7675 + printk("%s: requested ssp speed (%d bps) is to fast\n", DRVNAME, bps);
7676 + printk("%s: making ssp speed as fast as possible\n", DRVNAME);
7677 + /* Don't bother calculating the divider values as we know them */
7678 + bps = MAX_SSP_FREQ;
7679 + ssp_prescale = SSP_PRESCALE_MIN;
7681 + rcpc_prescale = 1;
7683 + /* Calculate the divider values as close as we can */
7684 + quotient = hclk_freq / bps;
7685 + if (quotient <= 0)
7687 + /* round the quotient */
7688 + delta1 = bps - (hclk_freq / quotient );
7691 + delta2 = bps - (hclk_freq / (quotient + 1));
7694 + if (delta1 > delta2)
7697 + (SSP_PRESCALE_MAX * RCPC_SSP_PRESCALE_MAX * SSP_DIVIDER_MAX))
7699 + printk("%s: requested ssp speed (%d bps) is to slow\n",
7701 + printk("%s: making ssp speed as slow as possible\n", DRVNAME);
7702 + /* The request bps is slower than the minimum possible */
7703 + /* ... make it as slow as possible */
7704 + /* Don't bother calculating the divider values as we know them */
7705 + rcpc_prescale = RCPC_SSP_PRESCALE_MAX;
7706 + ssp_prescale = SSP_PRESCALE_MAX;
7707 + ssp_divider = SSP_DIVIDER_MAX;
7710 + * The computed quotient is in range.
7711 + * Quotient is the target clock divide frequency.
7712 + * Get as close as possible.
7714 + rcpc_prescale = 1;
7716 + * Try to reduce power by using RCPC prescaler.
7717 + * Note that the ssp prescaler minimum is two
7718 + * so can only prescale and maintain accuracy
7719 + * if quotient is divisible by 4.
7721 + while ( ((quotient & 0x3) == 0)
7722 + && (rcpc_prescale < RCPC_SSP_PRESCALE_MAX) )
7725 + rcpc_prescale <<= 1;
7728 + * Make sure the requested frequency is within range
7729 + * of the SPP's prescaler and divider.
7730 + * Hopefully, this loop never executes.
7731 + * If it does, accuracy suffers.
7733 + while (quotient > (SSP_PRESCALE_MAX * SSP_DIVIDER_MAX) ) {
7734 + rcpc_prescale <<= 1;
7738 + * Factor the quotient into the divider and prescaler combo
7739 + * that minimizes the error in the quotient by exhaustively
7740 + * searching all legal ssp prescaler values.
7742 + ssp_prescale = SSP_PRESCALE_MIN;
7743 + ssp_divider = (quotient / ssp_prescale);
7744 + ssp_divider = (ssp_divider > SSP_DIVIDER_MAX)
7745 + ? SSP_DIVIDER_MAX : ssp_divider;
7746 + min_error = quotient - (ssp_divider * ssp_prescale);
7747 + min_error = (min_error < 0) ? -min_error : min_error;
7748 + for (new_prescale = SSP_PRESCALE_MIN + 2;
7749 + new_prescale < SSP_PRESCALE_MAX;
7750 + new_prescale += 2)
7752 + new_divider = (quotient / new_prescale);
7753 + new_divider = (new_divider > SSP_DIVIDER_MAX)
7754 + ? SSP_DIVIDER_MAX : new_divider;
7755 + new_error = quotient - (new_divider * new_prescale);
7756 + new_error = (new_error < 0) ? -new_error : new_error;
7757 + if (new_error < min_error) {
7758 + min_error = new_error;
7759 + ssp_prescale = new_prescale;
7760 + ssp_divider = new_divider;
7765 + /* Set up the necessary registers to get the desired BSP */
7766 + rcpcLockState = rcpc_lh7x_lock(RCPC_UNLOCK);
7767 + rcpc->rcpc_sspClkPrescale = rcpc_prescale >> 1;
7768 + (void) rcpc_lh7x_lock(rcpcLockState);
7769 + ssp->cpsr = ssp_prescale;
7770 + ssp->cr0 &= 0xff; /* clear old divider value */
7771 + ssp->cr0 |= SSP_CR0_SCR(ssp_divider - 1);
7773 + vdprintk("LEAVE: ssp_lh7x_set_speed(%d bps)\n", bps);
7775 + return(ssp_lh7x_get_speed());
7778 +/**********************************************************************
7779 +* Function: ssp_lh7x_write16
7782 +* Write the LH7x SSP data register
7783 +**********************************************************************/
7784 +static void ssp_lh7x_write16(sspContext_t *sspContext,
7785 + unsigned int data)
7789 + //if (sspContext->ssp_dev_sel == SSP_EEPROM) { //JMG
7790 + //printk("ENTER: ssp_lh7x_write16(0x%04X)\n", (uint16_t)data);
7792 + for (i=sspContext->ts_txTimeout; ((i>0) && ((ssp->sr&SSP_SR_TNF) == 0)); i--) {
7795 + if (ssp->sr & SSP_SR_TNF) {
7796 + ssp->dr = (uint16_t)data;
7798 + printk("%s: write timout\n", DRVNAME);
7800 + //vdprintk("LEAVE: ssp_lh7x_write16(0x%04X)\n", (uint16_t)data);
7804 +/**********************************************************************
7805 +* Function: ssp_lh7x_read16
7808 +* Read the LH7x SSP data register
7809 +**********************************************************************/
7810 +static unsigned int ssp_lh7x_read16(sspContext_t *sspContext)
7813 + unsigned int data = -1;
7815 + //vdprintk("ENTER: ssp_lh7x_read16()\n");
7816 + for (i=sspContext->ts_txTimeout; ((i>0) && ((ssp->sr&SSP_SR_RNE) == 0)); i--) {
7819 + if (ssp->sr & SSP_SR_RNE) {
7820 + if (sspContext->ssp_dev_sel == SSP_EEPROM) {
7821 + data = (unsigned int)ssp->dr; /* EEPROM */
7822 + //printk("LEAVE: ssp_lh7x_read16(ee: 0x%04X)\n", data);
7824 + data = (((unsigned int)ssp->dr) >> 4) & 0x0FFF; /* TOUCHSCREEN */
7825 + //printk("LEAVE: ssp_lh7x_read16(ts: 0x%04X)\n", data);
7828 + //printk("%s: read timout\n", DRVNAME);
7834 +/**********************************************************************
7835 +* Macro: ssp_lh7x_ts_pen_down
7836 +**********************************************************************/
7837 +static int ssp_lh7x_ts_pen_down(sspContext_t *sspContext)
7840 + //int pen_down = vic->IRQStatus & 0x01; //look for IRQ0
7841 + int pen_down = vic->RawIntr & 0x01; //look for IRQ0
7842 + dprintk("ssp_lh7x_ts_pen_down(%d)\n", pen_down);
7843 + return (pen_down);
7846 +/**********************************************************************
7847 +* Macro: ssp_lh7x_ts_pen_down_irq_enable
7848 +**********************************************************************/
7849 +static int ssp_lh7x_ts_pen_down_irq_enable(sspContext_t *sspContext)
7851 + int lastState = vic->IntEnable & 1;
7852 + dprintk("ssp_lh7x_ts_pen_down_irq_enable\n");
7853 + //vic->IntEnable = 1;
7855 + sspContext->irq_state = 1;
7856 + return(lastState);
7859 +/**********************************************************************
7860 +* Macro: ssp_lh7x_ts_pen_down_irq_disable
7861 +**********************************************************************/
7862 +static int ssp_lh7x_ts_pen_down_irq_disable(
7863 + sspContext_t *sspContext)
7865 + int lastState = vic->IntEnable & 1;
7866 + dprintk("ssp_lh7x_ts_pen_down_irq_disable\n");
7867 + //vic->IntEnClear = 1;
7869 + sspContext->irq_state = 0;
7870 + return(lastState);
7873 +/**********************************************************************
7874 +* Function: ssp_lh7x_ts_pen_down_irq
7876 +* We only detect touch screen _touches_ (pen down) with this interrupt
7877 +* handler, and even then we just schedule our task.
7879 +* Note: It has already been determined that this is our interrupt
7880 +* before we ever get it here so checking is minimal to non-existant.
7881 +**********************************************************************/
7882 +static void ssp_lh7x_ts_pen_down_irq(int irq, sspContext_t *sspContext,
7883 + struct pt_regs * regs)
7886 + * Disable the touchscreen interrupts
7887 + * by disabling the touchscreen IRQ
7889 + * Enable regular polling of the touchscreen device
7890 + * (The touchscreen IRQ will be re-enabled and polling
7891 + * will be disabled when it is detected that the
7892 + * pen is no longer down.)
7894 + /* Disable touch screen IRQ */
7895 + dprintk("ENTER: ssp_lh7x_ts_pen_down_irq()\n");
7896 + ssp_lh7x_ts_pen_down_irq_disable(sspContext);
7897 + dprintk("ENTER: wake_up()\n");
7898 + wake_up(sspContext->irq_wait_ptr);
7899 + vdprintk("LEAVE: ssp_lh7x_ts_pen_down_irq()\n");
7903 +/**********************************************************************
7904 +* Function: ssp_lh7x_irq_handler
7906 +* This interrupt handler only directs traffic for the interrupts
7907 +* by forwarding on the call to the appropriate interrupt handler.
7908 +**********************************************************************/
7909 +static void ssp_lh7x_irq_handler(int irq, void *_sspContext,
7910 + struct pt_regs * regs)
7912 + sspContext_t *sspContext = _sspContext;
7913 + if ((sspContext) && (sspContext->irq_wait_ptr)) {
7914 + //if (ssp_lh7x_ts_pen_down(sspContext)) {
7916 + ssp_lh7x_ts_pen_down_irq(irq, sspContext, regs);
7918 +#if defined(VERBOSE) && defined(DEBUG)
7920 + vdprintk("ssp_lh7x_irq_handler() --- Not our interrupt\n");
7924 +#if defined(VERBOSE) && defined(DEBUG)
7926 + vdprintk("ssp_lh7x_irq_handler( NO ACTION )\n");
7932 +/**********************************************************************
7933 +* Function: ssp_lh7x_lock
7934 +* Function: ssp_lh7x_unlock
7937 +* Lock/UnLock the SSP for a particular device (ts/ee)
7938 +**********************************************************************/
7939 +static int ssp_lh7x_lock(sspContext_t *sspContext, int device)
7944 + spin_lock_irq(&sspContext->sspLock);
7945 + if (device == SSP_DEV_TOUCHSCREEN) {
7946 + /* Select the touchscreen */
7947 + sspContext->ssp_dev_sel = SSP_TOUCHSCREEN;
7950 + /* National Microwire frame format --- SPI Polarity High */
7951 + /* Don't mess with data size or clock rate */
7952 + cr0 |= (SSP_CR0_FRF_NS | SSP_CR0_SPH);
7954 + vdprintk("ssp_lh7x_lock(SSP_DEV_TOUCHSCREEN)\n");
7956 + } else if (device == SSP_DEV_EEPROM) {
7957 + /* Select the eeprom */
7958 + sspContext->ssp_dev_sel = SSP_EEPROM;
7961 + /* Motorola SPI frame --- w/SPH & w/SPO */
7962 + /* Don't mess with data size or clock rate */
7963 + cr0 |= (SSP_CR0_FRF_MOT | SSP_CR0_SPH | SSP_CR0_SPO);
7965 + vdprintk("ssp_lh7x_lock(SSP_DEV_EEPROM)\n");
7968 + //cpld->ssp_dev_sel = sspContext->ssp_dev_sel;
7973 +static int ssp_lh7x_unlock(sspContext_t *sspContext, int device)
7976 +// #define SSP_DEFAULT_DEVICE SSP_TOUCHSCREEN
7977 +#define SSP_DEFAULT_DEVICE SSP_INVALID_DEVICE
7979 + spin_unlock_irq(&sspContext->sspLock);
7980 + if (device == SSP_DEV_TOUCHSCREEN) {
7981 + /* Select the default device */
7982 + sspContext->ssp_dev_sel = SSP_DEFAULT_DEVICE;
7983 + vdprintk("ssp_lh7x_unlock(SSP_DEV_TOUCHSCREEN)\n");
7985 + } else if (device == SSP_DEV_EEPROM) {
7986 + /* Select the default device */
7987 + sspContext->ssp_dev_sel = SSP_DEFAULT_DEVICE;
7988 + vdprintk("ssp_lh7x_unlock(SSP_DEV_EEPROM)\n");
7991 + //cpld->ssp_dev_sel = sspContext->ssp_dev_sel;
7996 +/**********************************************************************
7997 +* Function: ssp_lh7x_disable
8000 +* Disconnect I/O pins from the SSP module
8001 +* and disable the SSP peripheral and its clocks.
8002 +**********************************************************************/
8003 +static void ssp_lh7x_disable(void)
8005 + int rcpcLockState;
8007 + vdprintk("ENTER: ssp_lh7x_disable()\n");
8009 + /* Switch all muxed I/O away from the SSP */
8010 + iocon->SSIMux &= ~(
8018 + /* Disable ssp clock */
8019 + rcpcLockState = rcpc_lh7x_lock(RCPC_UNLOCK);
8020 + rcpc->rcpc_sspClkControl |= RCPC_SCLKSEL_SSPCLK;
8021 + (void) rcpc_lh7x_lock(rcpcLockState);
8023 + /* Set control register to their reset defaults */
8027 + /* clear any receive overruns */
8028 + ssp->u.icr = SSP_IIR_RORIS;
8030 + //JMG /* disable the ssp DMA streams */
8031 + //JMG dmac->stream0.max = 0;
8032 + //JMG dmac->stream0.ctrl = 0;
8033 + //JMG dmac->stream1.max = 0;
8034 + //JMG dmac->stream1.ctrl = 0;
8035 + //JMG /* clear any previous SSP DMA completions */
8036 + //JMG dmac->clear = DMAC_EOT0 | DMAC_EOT1;
8038 + vdprintk("LEAVE: ssp_lh7x_disable()\n");
8043 +/**********************************************************************
8044 +* Function: ssp_lh7x_enable
8047 +* Disconnect I/O pins from the SSP module
8048 +* and disable the SSP peripheral and its clocks.
8049 +**********************************************************************/
8050 +static void ssp_lh7x_enable(void)
8053 + vdprintk("ENTER: ssp_lh7x_enable()\n");
8055 + /* Enable the SSP */
8056 + ssp->cr1 |= SSP_CR1_SSE; /* Synchronous serial port enable */
8058 + /* Switch all muxed I/O to the SSP */
8059 + /* Note that SSPENB is not required for spi */
8069 + vdprintk("LEAVE: ssp_lh7x_enable()\n");
8074 +/**********************************************************************
8075 +* Fill in our context structures
8076 +**********************************************************************/
8078 +static sspContext_t sspContext_l = {
8079 + ts_txTimeout: 10000,
8080 + ts_rxTimeout: 10000,
8081 + ee_txTimeout: 10000,
8082 + ee_rxTimeout: 10000,
8086 +/**********************************************************************
8087 +* Function: ssp_request_pointer
8088 +* Function: ssp_provide_pointer
8091 +* Register & Initialize the module
8092 +**********************************************************************/
8093 +void *ssp_request_pointer(int device, char *request)
8095 + sspContext_t *sspContext = &sspContext_l;
8098 + dprintk("ENTER: ssp_request_pointer(\"%d\":\"%s\")\n", device, request);
8099 + if (device == SSP_DEV_TOUCHSCREEN) {
8100 + if (strcmp(request, "write") == 0) {
8101 + vp = ssp_lh7x_write16;
8102 + } else if (strcmp(request, "read") == 0) {
8103 + vp = ssp_lh7x_read16;
8104 + } else if (strcmp(request, "enable_pen_down_irq") == 0) {
8105 + vp = ssp_lh7x_ts_pen_down_irq_enable;
8106 + } else if (strcmp(request, "disable_pen_down_irq") == 0) {
8107 + vp = ssp_lh7x_ts_pen_down_irq_disable;
8108 + } else if (strcmp(request, "is_pen_down") == 0) {
8109 + vp = ssp_lh7x_ts_pen_down;
8110 + } else if (strcmp(request, "lock") == 0) {
8111 + vp = ssp_lh7x_lock;
8112 + } else if (strcmp(request, "unlock") == 0) {
8113 + vp = ssp_lh7x_unlock;
8114 + } else if (strcmp(request, "sspContext") == 0) {
8116 + } else if (strcmp(request, "flush_tx_fifo") == 0) {
8117 + vp = ssp_flush_tx_fifo;
8118 + } else if (strcmp(request, "flush_rx_fifo") == 0) {
8119 + vp = ssp_flush_rx_fifo;
8120 + } else if (strcmp(request, "ssp_busy_wait") == 0) {
8121 + vp = ssp_busy_wait;
8122 + } else if (strcmp(request, "chipselect_enable") == 0) {
8123 + vp = ssp_chipselect_enable;
8124 + } else if (strcmp(request, "chipselect_disable") == 0) {
8125 + vp = ssp_chipselect_disable;
8126 + } else if (strcmp(request, "chipselect_manual") == 0) {
8127 + vp = ssp_chipselect_manual;
8129 + } else if (device == SSP_DEV_EEPROM) {
8130 + if (strcmp(request, "write") == 0) {
8131 + vp = ssp_lh7x_write16;
8132 + } else if (strcmp(request, "read") == 0) {
8133 + vp = ssp_lh7x_read16;
8134 + } else if (strcmp(request, "lock") == 0) {
8135 + vp = ssp_lh7x_lock;
8136 + } else if (strcmp(request, "unlock") == 0) {
8137 + vp = ssp_lh7x_unlock;
8138 + } else if (strcmp(request, "sspContext") == 0) {
8140 + } else if (strcmp(request, "chipselect_enable") == 0) {
8141 + vp = ssp_chipselect_enable;
8142 + } else if (strcmp(request, "chipselect_disable") == 0) {
8143 + vp = ssp_chipselect_disable;
8144 + } else if (strcmp(request, "chipselect_manual") == 0) {
8145 + vp = ssp_chipselect_manual;
8146 + } else if (strcmp(request, "chipselect_automatic") == 0) {
8147 + vp = ssp_chipselect_automatic;
8148 + } else if (strcmp(request, "flush_tx_fifo") == 0) {
8149 + vp = ssp_flush_tx_fifo;
8150 + } else if (strcmp(request, "flush_rx_fifo") == 0) {
8151 + vp = ssp_flush_rx_fifo;
8152 + } else if (strcmp(request, "ssp_busy_wait") == 0) {
8153 + vp = ssp_busy_wait;
8156 + dprintk("LEAVE: ssp_request_pointer(0x%08X)\n", (unsigned int)vp);
8161 +void *ssp_provide_pointer(int device, char *request, void *vp)
8163 + sspContext_t *sspContext = &sspContext_l;
8165 + dprintk("ENTER: ssp_provide_pointer(\"%d\":\"%s\":0x%08X)\n",
8166 + device, request, (unsigned int)vp);
8167 + if (device == SSP_DEV_TOUCHSCREEN) {
8168 + if (strcmp(request, "irq_wait_ptr") == 0) {
8169 + sspContext->irq_wait_ptr = vp;
8173 + } else if (device == SSP_DEV_EEPROM) {
8178 + dprintk("LEAVE: ssp_provide_pointer(0x%08X)\n", (unsigned int)vp);
8183 +/**********************************************************************
8184 +* Function: ssp_lh7x_init
8187 +* Register & Initialize the module
8188 +**********************************************************************/
8189 +static int __init ssp_lh7x_init(void)
8191 + sspContext_t *sspContext = &sspContext_l;
8193 + int rcpcLockState;
8196 + vdprintk("ENTER: ssp_lh7x_init()\n");
8198 + vdprintk("ssp = 0x%08X\n", (unsigned int)ssp);
8200 + /* Determine the HCLK (bus clock) frequency in Hz */
8202 + hclk_freq = ssp_lh7x_get_hclk_freq();
8204 + hclk_freq = hclkfreq_get();
8208 + * Disconnect I/O pins from the SSP module
8209 + * and disable the SSP peripheral and its clocks.
8211 + ssp_lh7x_disable();
8213 + /* Initialize the RCPC SSP clock & prescaler */
8214 + rcpcLockState = rcpc_lh7x_lock(RCPC_UNLOCK);
8215 + rcpc->rcpc_sspClkPrescale = 0; /* As fast as possible */
8216 + rcpc->rcpc_sspClkControl &= ~RCPC_SCLKSEL_SSPCLK; /* Enable SSP clock */
8217 + (void) rcpc_lh7x_lock(rcpcLockState);
8219 + ssp->cpsr = SSP_CPSR_CPDVSR(SSP_PRESCALE_MIN);
8221 + /* Initialize CR0 */
8223 + SSP_CR0_DSS(16) /* 16-bit data */
8224 + | SSP_CR0_FRF_NS /* National Microwire frame format */
8225 + | SSP_CR0_SPH /* SPI Polarity */
8226 + | SSP_CR0_SCR(1) /* Serial clock rate (~922kbps) */
8229 + /* Initialize CR1 */
8231 + SSP_CR1_SSE /* Synchronous serial port enable */
8234 + /* Set the SSP speed in bits per second */
8235 + /* Note this MUST be done after the SSP_CR0_FRF_xxx mode is set */
8236 + (void) ssp_lh7x_set_speed(LH7x_TS_BPS);
8238 + /* Select the touchscreen */
8239 + sspContext->ssp_dev_sel = SSP_TOUCHSCREEN;
8240 + //cpld->ssp_dev_sel = sspContext->ssp_dev_sel;
8242 + /* Flush the transmit FIFO */
8243 + ssp_flush_tx_fifo(sspContext);
8245 + /* Flush the receive FIFO */
8246 + ssp_flush_rx_fifo(sspContext);
8248 + /* clear any receive overruns */
8249 + ssp->u.icr = SSP_IIR_RORIS;
8251 + //printk("ssp->cr0 = 0x%04X\n", ssp->cr0);
8252 + //printk("ssp->cr1 = 0x%04X\n", ssp->cr1);
8253 + //printk("ssp->sr = 0x%04X\n", ssp->sr);
8254 + //printk("ssp->cpsr = 0x%04X\n", ssp->cpsr);
8255 + //printk("ssp->u.icr | u.iir = 0x%04X\n", ssp->u.icr);
8257 + ssp_chipselect_automatic();
8259 + * Connect I/O pins from the SSP module
8260 + * and enable the SSP peripheral and its clocks.
8262 + ssp_lh7x_enable();
8265 + * Request IRQ2 and attach it to the touchscreen pen_down line and enable it
8267 + sspContext->haveIrq = 0;
8268 + result = request_irq(0, ssp_lh7x_irq_handler,
8269 + SA_SAMPLE_RANDOM, DRVNAME, sspContext);
8271 + printk("%s: cannot get requested IRQ(0)\n", DRVNAME);
8273 + sspContext->haveIrq = 1;
8274 + dprintk("%s: got requested IRQ(0)\n", DRVNAME);
8276 + ssp_lh7x_ts_pen_down_irq_enable(sspContext);
8278 + vdprintk("LEAVE: ssp_lh7x_init()\n");
8282 +/**********************************************************************
8283 +* Function: ssp_lh7x_exit
8286 +* Un-Register & Cleanup the module
8287 +**********************************************************************/
8288 +static void ssp_lh7x_exit(void)
8290 + sspContext_t *sspContext = &sspContext_l;
8291 + int rcpcLockState;
8293 + vdprintk("ENTER: ssp_lh7x_exit()\n");
8295 + //printk("ssp->cr0 = 0x%04X\n", ssp->cr0);
8296 + //printk("ssp->cr1 = 0x%04X\n", ssp->cr1);
8297 + //printk("ssp->sr = 0x%04X\n", ssp->sr);
8298 + //printk("ssp->cpsr = 0x%04X\n", ssp->cpsr);
8299 + //printk("ssp->u.icr | u.iir = 0x%04X\n", ssp->u.icr);
8302 + * Disable & Return IRQ 2
8305 + ssp_lh7x_ts_pen_down_irq_disable(sspContext);
8306 + if (sspContext->haveIrq) {
8307 + free_irq(0, sspContext);
8308 + sspContext->haveIrq = 0;
8314 + ssp->u.icr = SSP_IIR_RORIS; /* clear any receive overruns */
8315 + ssp->cpsr = SSP_CPSR_CPDVSR(SSP_PRESCALE_MIN);
8317 + /* Turn off the RCPC SSP clock */
8318 + rcpcLockState = rcpc_lh7x_lock(RCPC_UNLOCK);
8319 + rcpc->rcpc_sspClkControl |= RCPC_SCLKSEL_SSPCLK; /* Disable SSP clock */
8320 + (void) rcpc_lh7x_lock(rcpcLockState);
8322 + vdprintk("LEAVE: ssp_lh7x_exit()\n");
8326 +module_init(ssp_lh7x_init);
8327 +module_exit(ssp_lh7x_exit);
8329 +MODULE_AUTHOR("Jim Gleason / Lineo, Inc.");
8330 +MODULE_DESCRIPTION("SSP Driver for Sharp LH7x EVB");
8331 +MODULE_LICENSE("Copyright (c) 2002 Lineo, Inc.");
8333 diff -urN linux-2.4.26/drivers/serial/amba_pl011.c linux-2.4.26-vrs1-lnode80/drivers/serial/amba_pl011.c
8334 --- linux-2.4.26/drivers/serial/amba_pl011.c 1969-12-31 20:00:00.000000000 -0400
8335 +++ linux-2.4.26-vrs1-lnode80/drivers/serial/amba_pl011.c 2005-11-02 17:37:32.000000000 -0400
8338 + * linux/drivers/char/serial_amba_pl011.c
8340 + * Driver for AMBA PrimeCell PL011 serial ports
8341 + * Copyright (C) 2002 Lineo, Inc.
8343 + * Based on drivers/char/serial_amba.c, which is:
8344 + * Copyright 1999 ARM Limited
8345 + * Copyright (C) 2000 Deep Blue Solutions Ltd.
8347 + * This program is free software; you can redistribute it and/or modify
8348 + * it under the terms of the GNU General Public License as published by
8349 + * the Free Software Foundation; either version 2 of the License, or
8350 + * (at your option) any later version.
8352 + * This program is distributed in the hope that it will be useful,
8353 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
8354 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8355 + * GNU General Public License for more details.
8357 + * You should have received a copy of the GNU General Public License
8358 + * along with this program; if not, write to the Free Software
8359 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
8362 +#include <linux/config.h>
8363 +#include <linux/module.h>
8364 +#include <linux/tty.h>
8365 +#include <linux/ioport.h>
8366 +#include <linux/init.h>
8367 +#include <linux/sched.h>
8368 +#include <linux/serial.h>
8369 +#include <linux/console.h>
8370 +#include <linux/sysrq.h>
8372 +#include <asm/io.h>
8373 +#include <asm/irq.h>
8375 +#if defined(CONFIG_SERIAL_AMBA_PL011_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
8376 +#define SUPPORT_SYSRQ
8379 +#include <linux/serial_core.h>
8381 +#include <asm/hardware/serial_amba_pl011.h>
8383 +#ifdef CONFIG_ARCH_LH79520
8384 +#include <asm/arch/rcpc.h>
8385 +#include <asm/arch/iocon.h>
8386 +#include <asm/arch/gpio.h>
8391 +#define SERIAL_AMBA_MAJOR 204
8392 +#define SERIAL_AMBA_MINOR 16
8393 +#define SERIAL_AMBA_NR UART_NR
8395 +#define CALLOUT_AMBA_NAME "cuaam"
8396 +#define CALLOUT_AMBA_MAJOR 205
8397 +#define CALLOUT_AMBA_MINOR 16
8398 +#define CALLOUT_AMBA_NR UART_NR
8400 +static struct tty_driver normal, callout;
8401 +static struct tty_struct *amba11_table[UART_NR];
8402 +static struct termios *amba11_termios[UART_NR], *amba11_termios_locked[UART_NR];
8403 +#ifdef SUPPORT_SYSRQ
8404 +static struct console amba11_console;
8406 +static void amba11uart_tx_chars(struct uart_port *port);
8408 +#define AMBA_ISR_PASS_LIMIT 256
8411 + * Access macros for the AMBA UARTs
8413 +#define UART_PUT_ICR(p, c) writel((c), (p)->membase + AMBA_UARTICR)
8414 +#define UART_GET_CHAR(p) readb((p)->membase + AMBA_UARTDR)
8415 +#define UART_PUT_CHAR(p, c) writel((c), (p)->membase + AMBA_UARTDR)
8416 +#define UART_GET_RSR(p) readb((p)->membase + AMBA_UARTRSR)
8417 +#define UART_GET_LCRH(p) readb((p)->membase + AMBA_UARTLCR_H)
8418 +#define UART_PUT_LCRH(p,c) writel((c), (p)->membase + AMBA_UARTLCR_H)
8420 +#define UART_RX_DATA(s) (((s) & AMBA_UARTFR_RXFE) == 0)
8421 +#define UART_TX_READY(s) (((s) & AMBA_UARTFR_TXFF) == 0)
8422 +#define UART_TX_EMPTY(p) ((UART_GET_FR(p) & AMBA_UARTFR_TMSK) == 0)
8424 +#define UART_GET_INT_STATUS(p) readw((p)->membase + AMBA_UARTMIS)
8425 +#define UART_GET_FR(p) readw((p)->membase + AMBA_UARTFR)
8426 +#define UART_GET_CR(p) readl((p)->membase + AMBA_UARTCR)
8427 +#define UART_PUT_CR(p,c) writel((c), (p)->membase + AMBA_UARTCR)
8428 +#define UART_GET_IMSC(p) readl((p)->membase + AMBA_UARTIMSC)
8429 +#define UART_PUT_IMSC(p,c) writel((c), (p)->membase + AMBA_UARTIMSC)
8430 +#define UART_GET_IBRD(p) readl((p)->membase + AMBA_UARTIBRD)
8431 +#define UART_PUT_IBRD(p,c) writel((c), (p)->membase + AMBA_UARTIBRD)
8434 +#define UART_DUMMY_RSR_RX 256
8435 +#define UART_PORT_SIZE 64
8438 + * Our private driver data mappings.
8440 +#define drv_old_status driver_priv
8442 +struct uart_amba11_port {
8443 + struct uart_port port;
8444 + unsigned int old_status;
8447 +static void amba11uart_stop_tx(struct uart_port *port, unsigned int tty_stop)
8449 + unsigned int mask;
8451 + mask = UART_GET_IMSC( port);
8452 + mask &= ~AMBA_UARTIMSC_TXIM;
8453 + UART_PUT_IMSC( port, mask); /* disable Tx interrupts */
8457 +static void amba11uart_start_tx(struct uart_port *port, unsigned int tty_start)
8459 + unsigned int mask;
8461 + mask = UART_GET_IMSC(port);
8462 + if( (mask & AMBA_UARTIMSC_TXIM) == 0) { /* not already enabled */
8463 + mask |= AMBA_UARTIMSC_TXIM; /* enable Tx interrupts */
8464 + UART_PUT_IMSC(port, mask);
8466 + amba11uart_tx_chars(port); /* start transmiting */
8472 +static void amba11uart_stop_rx(struct uart_port *port)
8474 + unsigned int mask;
8476 + mask = UART_GET_IMSC(port);
8477 + mask &= ~(AMBA_UARTIMSC_RXIM | AMBA_UARTIMSC_RTIM);
8478 + UART_PUT_IMSC(port, mask); /* disable Rx interrupts */
8482 +static void amba11uart_enable_ms(struct uart_port *port)
8484 + unsigned int mask;
8486 + mask = UART_GET_IMSC( port);
8487 + mask |= AMBA_UARTIMSC_Modem;
8488 + UART_PUT_IMSC(port, mask); /* Disable modem interrupts */
8492 +#ifdef SUPPORT_SYSRQ
8493 +amba11uart_rx_chars(struct uart_port *port, struct pt_regs *regs)
8495 +amba11uart_rx_chars(struct uart_port *port)
8498 + struct tty_struct *tty = port->info->tty;
8499 + unsigned int status, ch, rsr, max_count = 256;
8501 + status = UART_GET_FR(port);
8502 + while (UART_RX_DATA(status) && max_count--) {
8503 + if (tty->flip.count >= TTY_FLIPBUF_SIZE) {
8504 + tty->flip.tqueue.routine((void *)tty);
8505 + if (tty->flip.count >= TTY_FLIPBUF_SIZE) {
8506 + printk(KERN_WARNING "TTY_DONT_FLIP set\n");
8511 + ch = UART_GET_CHAR(port);
8513 + *tty->flip.char_buf_ptr = ch;
8514 + *tty->flip.flag_buf_ptr = TTY_NORMAL;
8515 + port->icount.rx++;
8518 + * Note that the error handling code is
8519 + * out of the main execution path
8521 + rsr = UART_GET_RSR(port) | UART_DUMMY_RSR_RX;
8522 + if (rsr & AMBA_UARTRSR_ANY) {
8523 + if (rsr & AMBA_UARTRSR_BE) {
8524 + rsr &= ~(AMBA_UARTRSR_FE | AMBA_UARTRSR_PE);
8525 + port->icount.brk++;
8526 + if (uart_handle_sysrq_char(port, ch, regs))
8528 + } else if (rsr & AMBA_UARTRSR_PE)
8529 + port->icount.parity++;
8530 + else if (rsr & AMBA_UARTRSR_FE)
8531 + port->icount.frame++;
8532 + if (rsr & AMBA_UARTRSR_OE)
8533 + port->icount.overrun++;
8535 + rsr &= port->read_status_mask;
8537 + if (rsr & AMBA_UARTRSR_BE)
8538 + *tty->flip.flag_buf_ptr = TTY_BREAK;
8539 + else if (rsr & AMBA_UARTRSR_PE)
8540 + *tty->flip.flag_buf_ptr = TTY_PARITY;
8541 + else if (rsr & AMBA_UARTRSR_FE)
8542 + *tty->flip.flag_buf_ptr = TTY_FRAME;
8545 + if (uart_handle_sysrq_char(port, ch, regs))
8548 + if ((rsr & port->ignore_status_mask) == 0) {
8549 + tty->flip.flag_buf_ptr++;
8550 + tty->flip.char_buf_ptr++;
8551 + tty->flip.count++;
8553 + if ((rsr & AMBA_UARTRSR_OE) &&
8554 + tty->flip.count < TTY_FLIPBUF_SIZE) {
8556 + * Overrun is special, since it's reported
8557 + * immediately, and doesn't affect the current
8560 + *tty->flip.char_buf_ptr++ = 0;
8561 + *tty->flip.flag_buf_ptr++ = TTY_OVERRUN;
8562 + tty->flip.count++;
8565 + status = UART_GET_FR(port);
8567 + tty_flip_buffer_push(tty);
8571 +static void amba11uart_tx_chars(struct uart_port *port)
8573 + struct circ_buf *xmit = &port->info->xmit;
8577 + if (port->x_char) {
8578 + UART_PUT_CHAR(port, port->x_char);
8579 + port->icount.tx++;
8583 + if (uart_circ_empty(xmit) || uart_tx_stopped(port)) {
8584 + amba11uart_stop_tx(port, 0);
8588 + count = port->fifosize >> 1;
8590 + UART_PUT_CHAR(port, xmit->buf[xmit->tail]);
8591 + xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
8592 + port->icount.tx++;
8593 + if (uart_circ_empty(xmit))
8595 + status = UART_GET_FR(port);
8596 + } while (UART_TX_READY(status));
8597 + //FJBwhile (--count > 0);
8599 + if (uart_circ_chars_pending(xmit) <
8601 + uart_write_wakeup(port);
8603 + if (uart_circ_empty(xmit))
8604 + amba11uart_stop_tx(port, 0);
8607 +static void amba11uart_modem_status(struct uart_port *port)
8609 + struct uart_amba11_port *uap = (struct uart_amba11_port *) port;
8610 + unsigned int status, delta;
8612 + UART_PUT_ICR(&uap->port, 0x3ff);
8614 + status = UART_GET_FR(&uap->port) & AMBA_UARTFR_MODEM_ANY;
8615 + //FJB - check CTS on modem port only (port 1)
8616 + if(port == (struct uart_port *)UART1_PHYS)
8618 + if(GPIOG->dr & 0x01)
8620 + //CTS is high meaning STOP SENDING
8621 + status |= AMBA_UARTFR_CTS;
8625 + delta = status ^ uap->old_status;
8626 + uap->old_status = status;
8631 + if (delta & AMBA_UARTFR_DCD)
8632 + uart_handle_dcd_change(&uap->port, (status & AMBA_UARTFR_DCD) == 0);
8634 + if ((delta & AMBA_UARTFR_DSR) == 0)
8635 + uap->port.icount.dsr++;
8637 + if (delta & AMBA_UARTFR_CTS)
8638 + uart_handle_cts_change(&uap->port, (status & AMBA_UARTFR_CTS) == 0);
8640 + wake_up_interruptible(&uap->port.info->delta_msr_wait);
8643 +static void amba11uart_int(int irq, void *dev_id, struct pt_regs *regs)
8645 + struct uart_port *port = dev_id;
8646 + unsigned int status, pass_counter = AMBA_ISR_PASS_LIMIT;
8648 + status = UART_GET_INT_STATUS(port);
8650 + if (status & (AMBA_UART_IS_RT | AMBA_UART_IS_RX))
8652 +#ifdef SUPPORT_SYSRQ
8653 + amba11uart_rx_chars(port, regs);
8655 + amba11uart_rx_chars(port);
8658 + if (status & AMBA_UART_IS_TX)
8659 + amba11uart_tx_chars(port);
8662 + if (status & AMBA_UART_IS_MI)
8663 + amba11uart_modem_status(port);
8665 + if (pass_counter-- == 0)
8668 + status = UART_GET_INT_STATUS(port);
8669 + } while (status & (AMBA_UART_IS_RT | AMBA_UART_IS_RX |
8670 + AMBA_UART_IS_TX));
8673 +static unsigned int amba11uart_tx_empty(struct uart_port *port)
8675 + return UART_GET_FR(port) & AMBA_UARTFR_BUSY ? 0 : TIOCSER_TEMT;
8678 +static unsigned int amba11uart_get_mctrl(struct uart_port *port)
8680 + unsigned int result = 0;
8681 + unsigned int status;
8683 + status = UART_GET_FR(port);
8684 + if ((status & AMBA_UARTFR_DCD) == 0)
8685 + result |= TIOCM_CAR;
8686 + if ((status & AMBA_UARTFR_DSR) == 0)
8687 + result |= TIOCM_DSR;
8688 + if ((status & AMBA_UARTFR_CTS) == 0)
8689 + result |= TIOCM_CTS;
8694 +static void amba11uart_set_mctrl(struct uart_port *port, unsigned int mctrl)
8698 + cr = UART_GET_CR( port);
8700 + if (mctrl & TIOCM_RTS)
8701 + cr &= ~AMBA_UARTCR_RTS;
8703 + cr |= AMBA_UARTCR_RTS;
8705 + if (mctrl & TIOCM_DTR)
8706 + cr &= ~AMBA_UARTCR_DTR;
8708 + cr |= AMBA_UARTCR_DTR;
8710 + UART_PUT_CR( port, cr);
8714 +static void amba11uart_break_ctl(struct uart_port *port, int break_state)
8716 + unsigned int lcr_h;
8717 + unsigned long flags;
8719 + spin_lock_irqsave(&port->lock, flags);
8720 + lcr_h = UART_GET_LCRH(port);
8721 + if (break_state == -1)
8722 + lcr_h |= AMBA_UARTLCR_H_BRK;
8724 + lcr_h &= ~AMBA_UARTLCR_H_BRK;
8725 + UART_PUT_LCRH(port, lcr_h);
8726 + spin_unlock_irqrestore(&port->lock, flags);
8729 +static int amba11uart_startup(struct uart_port *port)
8732 + struct uart_amba11_port *uap = (struct uart_amba11_port *)port;
8735 + * Allocate the IRQ
8737 + retval = request_irq(port->irq, amba11uart_int, 0, "amba", port);
8742 + * initialise the old status of the modem signals
8744 + uap->old_status = UART_GET_FR(port) & AMBA_UARTFR_MODEM_ANY;
8747 + * Finally, enable interrupts
8749 +#ifdef CONFIG_ARCH_LH79520
8752 + * enable the clock to the serial ports
8754 + rcpcRegs_t *rcpc = (rcpcRegs_t *)IO_ADDRESS( RCPC_PHYS);
8755 + ioconRegs_t *iocon = (ioconRegs_t *)IO_ADDRESS( IOCON_PHYS);
8757 + rcpc->control |= RCPC_CTRL_WRTLOCK_ENABLED; /* unlock RCPC registers */
8760 + rcpc->periphClkCtrl &= ~(RCPC_CLKCTRL_U0_DISABLE | RCPC_CLKCTRL_U1_DISABLE | RCPC_CLKCTRL_U2_DISABLE) ;
8761 + rcpc->control &= ~RCPC_CTRL_WRTLOCK_ENABLED; /* lock RCPC registers */
8763 + /* set multiplexed pins for UART0 use */
8764 + iocon->UARTMux |= (UARTMUX_UT0TXD | UARTMUX_UT0RXD);
8766 +#endif /* CONFIG_ARCH_LH79520 */
8769 + * Use iobase to store a pointer to info. We need this to start a
8770 + * transmission as the tranmittr interrupt is only generated on
8771 + * the transition to the idle state
8774 + UART_PUT_IMSC( port, (AMBA_UARTIMSC_RXIM | AMBA_UARTIMSC_RTIM) );
8775 + UART_PUT_CR( port, (AMBA_UARTCR_UARTEN | AMBA_UARTCR_RXE | AMBA_UARTCR_TXE));
8780 +static void amba11uart_shutdown(struct uart_port *port)
8783 + * Free the interrupt
8785 + free_irq(port->irq, port);
8788 + * disable all interrupts, disable the port
8790 + UART_PUT_CR(port, 0);
8792 + /* disable break condition and fifos */
8793 + UART_PUT_LCRH(port, UART_GET_LCRH(port) &
8794 + ~(AMBA_UARTLCR_H_BRK | AMBA_UARTLCR_H_FEN));
8797 +static void amba11uart_change_speed(struct uart_port *port, u_int cflag, u_int iflag, u_int quot)
8799 + unsigned int lcr_h, old_cr;
8800 + unsigned long flags;
8801 + unsigned long old_imsc;
8804 + printk("amba11uart_set_cflag(0x%x) called\n", cflag);
8806 + /* byte size and parity */
8807 + switch (cflag & CSIZE) {
8808 + case CS5: lcr_h = AMBA_UARTLCR_H_WLEN_5; break;
8809 + case CS6: lcr_h = AMBA_UARTLCR_H_WLEN_6; break;
8810 + case CS7: lcr_h = AMBA_UARTLCR_H_WLEN_7; break;
8811 + default: lcr_h = AMBA_UARTLCR_H_WLEN_8; break; // CS8
8813 + if (cflag & CSTOPB)
8814 + lcr_h |= AMBA_UARTLCR_H_STP2;
8815 + if (cflag & PARENB) {
8816 + lcr_h |= AMBA_UARTLCR_H_PEN;
8817 + if (!(cflag & PARODD))
8818 + lcr_h |= AMBA_UARTLCR_H_EPS;
8820 + if (port->fifosize > 1)
8821 + lcr_h |= AMBA_UARTLCR_H_FEN;
8823 + spin_lock_irqsave(&port->lock, flags);
8825 + port->read_status_mask = AMBA_UARTRSR_OE;
8826 + if (iflag & INPCK)
8827 + port->read_status_mask |= AMBA_UARTRSR_FE | AMBA_UARTRSR_PE;
8828 + if (iflag & (BRKINT | PARMRK))
8829 + port->read_status_mask |= AMBA_UARTRSR_BE;
8832 + * Characters to ignore
8834 + port->ignore_status_mask = 0;
8835 + if (iflag & IGNPAR)
8836 + port->ignore_status_mask |= AMBA_UARTRSR_FE | AMBA_UARTRSR_PE;
8837 + if (iflag & IGNBRK) {
8838 + port->ignore_status_mask |= AMBA_UARTRSR_BE;
8840 + * If we're ignoring parity and break indicators,
8841 + * ignore overruns too (for real raw support).
8843 + if (iflag & IGNPAR)
8844 + port->ignore_status_mask |= AMBA_UARTRSR_OE;
8848 + * Ignore all characters if CREAD is not set.
8850 + if ((cflag & CREAD) == 0)
8851 + port->ignore_status_mask |= UART_DUMMY_RSR_RX;
8853 + old_cr = UART_GET_CR( port);
8854 + old_imsc = UART_GET_IMSC( port) & ~AMBA_UARTIMSC_Modem;
8856 + if (UART_ENABLE_MS(port, cflag))
8857 + old_imsc |= AMBA_UARTIMSC_Modem;
8859 + /* Set baud rate */
8860 + UART_PUT_IBRD( port, quot);
8863 + * ----------v----------v----------v----------v-----
8864 + * NOTE: MUST BE WRITTEN AFTER UARTLCR_M & UARTLCR_L
8865 + * ----------^----------^----------^----------^-----
8867 + UART_PUT_LCRH(port, lcr_h);
8868 + UART_PUT_IMSC( port, old_imsc);
8869 + UART_PUT_CR(port, old_cr);
8871 + spin_unlock_irqrestore(&port->lock, flags);
8874 +static const char *amba11uart_type(struct uart_port *port)
8876 + return port->type == PORT_AMBA_PL011 ? "AMBA PrimeCell PL011" : NULL;
8880 + * Release the memory region(s) being used by 'port'
8882 +static void amba11uart_release_port(struct uart_port *port)
8884 + release_mem_region(port->mapbase, UART_PORT_SIZE);
8888 + * Request the memory region(s) being used by 'port'
8890 +static int amba11uart_request_port(struct uart_port *port)
8892 + return request_mem_region(port->mapbase, UART_PORT_SIZE, "serial_amba")
8893 + != NULL ? 0 : -EBUSY;
8897 + * Configure/autoconfigure the port.
8899 +static void amba11uart_config_port(struct uart_port *port, int flags)
8901 + if (flags & UART_CONFIG_TYPE) {
8902 + port->type = PORT_AMBA_PL011;
8903 + amba11uart_request_port(port);
8908 + * verify the new serial_struct (for TIOCSSERIAL).
8910 +static int amba11uart_verify_port(struct uart_port *port, struct serial_struct *ser)
8913 + if (ser->type != PORT_UNKNOWN && ser->type != PORT_AMBA_PL011)
8915 + if (ser->irq < 0 || ser->irq >= NR_IRQS)
8917 + if (ser->baud_base < 9600)
8922 +static struct uart_ops amba11_pops = {
8923 + tx_empty: amba11uart_tx_empty,
8924 + set_mctrl: amba11uart_set_mctrl,
8925 + get_mctrl: amba11uart_get_mctrl,
8926 + stop_tx: amba11uart_stop_tx,
8927 + start_tx: amba11uart_start_tx,
8928 + stop_rx: amba11uart_stop_rx,
8929 + enable_ms: amba11uart_enable_ms,
8930 + break_ctl: amba11uart_break_ctl,
8931 + startup: amba11uart_startup,
8932 + shutdown: amba11uart_shutdown,
8933 + change_speed: amba11uart_change_speed,
8934 + type: amba11uart_type,
8935 + release_port: amba11uart_release_port,
8936 + request_port: amba11uart_request_port,
8937 + config_port: amba11uart_config_port,
8938 + verify_port: amba11uart_verify_port,
8941 +static struct uart_amba11_port amba11_ports[UART_NR] = {
8944 + .membase= (void *)IO_ADDRESS(UART0_PHYS), // VA
8945 + .mapbase= UART0_PHYS,
8946 + .iotype= SERIAL_IO_MEM,
8948 + .uartclk= 14745600,
8950 + .ops= &amba11_pops,
8951 + .flags= ASYNC_BOOT_AUTOCONF,
8957 + .membase= (void *)IO_ADDRESS(UART1_PHYS),
8958 + .mapbase= UART1_PHYS,
8959 + .iotype= SERIAL_IO_MEM,
8961 + .uartclk= 14745600,
8963 + .ops= &amba11_pops,
8964 + .flags= ASYNC_BOOT_AUTOCONF,
8970 + .membase= (void *)IO_ADDRESS(UART2_PHYS),
8971 + .mapbase= UART2_PHYS,
8972 + .iotype= SERIAL_IO_MEM,
8974 + .uartclk= 14745600,
8976 + .ops= &amba11_pops,
8977 + .flags= ASYNC_BOOT_AUTOCONF,
8984 +#ifdef CONFIG_SERIAL_AMBA_PL011_CONSOLE
8985 +#ifdef used_and_not_const_char_pointer
8986 +static int amba11uart_console_read(struct uart_port *port, char *s, u_int count)
8988 + unsigned int status;
8991 + printk("amba11uart_console_read() called\n");
8995 + while (c < count) {
8996 + status = UART_GET_FR(port);
8997 + if (UART_RX_DATA(status)) {
8998 + *s++ = UART_GET_CHAR(port);
9001 + // nothing more to get, return
9005 + // return the count
9010 +static void amba11uart_console_write(struct console *co, const char *s, u_int count)
9012 + struct uart_port *port = &amba11_ports[co->index].port;
9013 + unsigned int status;
9017 + * First save the CR then disable the interrupts
9019 + unsigned int old_imsc;
9020 + old_imsc = UART_GET_IMSC( port);
9021 + UART_PUT_IMSC( port, 0);
9024 + * Now, do each character
9026 + for (i = 0; i < count; i++) {
9028 + status = UART_GET_FR(port);
9029 + } while (!UART_TX_READY(status));
9030 + UART_PUT_CHAR(port, s[i]);
9031 + if (s[i] == '\n') {
9033 + status = UART_GET_FR(port);
9034 + } while (!UART_TX_READY(status));
9035 + UART_PUT_CHAR(port, '\r');
9040 + * Finally, wait for transmitter to become empty
9041 + * and restore the TCR
9044 + status = UART_GET_FR(port);
9045 + } while (status & AMBA_UARTFR_BUSY);
9046 + UART_PUT_IMSC( port, old_imsc);
9049 +static kdev_t amba11uart_console_device(struct console *co)
9051 + return MKDEV(SERIAL_AMBA_MAJOR, SERIAL_AMBA_MINOR + co->index);
9054 +static int amba11uart_console_wait_key(struct console *co)
9056 + struct uart_port *port = &amba11_ports[co->index].port;
9057 + unsigned int status;
9060 + status = UART_GET_FR(port);
9061 + } while (!UART_RX_DATA(status));
9062 + return UART_GET_CHAR(port);
9066 +amba11uart_console_get_options(struct uart_port *port, int *baud, int *parity, int *bits)
9068 + if (UART_GET_CR(port) & AMBA_UARTCR_UARTEN) {
9069 + unsigned int lcr_h, quot;
9070 + lcr_h = UART_GET_LCRH(port);
9073 + if (lcr_h & AMBA_UARTLCR_H_PEN) {
9074 + if (lcr_h & AMBA_UARTLCR_H_EPS)
9080 + if ((lcr_h & 0x60) == AMBA_UARTLCR_H_WLEN_7)
9085 + quot = UART_GET_IBRD(port);
9086 + *baud = port->uartclk / (16 * quot );
9090 +static int __init amba11uart_console_setup(struct console *co, char *options)
9092 + struct uart_port *port;
9099 + * Check whether an invalid uart number has been specified, and
9100 + * if so, search for the first available port that does have
9101 + * console support.
9103 + if (co->index >= UART_NR)
9105 + port = &amba11_ports[co->index].port;
9108 + uart_parse_options(options, &baud, &parity, &bits, &flow);
9110 + amba11uart_console_get_options(port, &baud, &parity, &bits);
9112 + return uart_set_options(port, co, baud, parity, bits, flow);
9115 +static struct console amba11_console = {
9117 + write: amba11uart_console_write,
9118 +#ifdef used_and_not_const_char_pointer
9119 + read: amba11uart_console_read,
9121 + device: amba11uart_console_device,
9122 + setup: amba11uart_console_setup,
9123 + flags: CON_PRINTBUFFER,
9127 +void __init amba11uart_console_init(void)
9129 + register_console(&amba11_console);
9132 +#define AMBA_CONSOLE &amba11_console
9134 +#define AMBA_CONSOLE NULL
9137 +static struct uart_driver amba11_reg = {
9138 + owner: THIS_MODULE,
9139 + normal_major: SERIAL_AMBA_MAJOR,
9140 +#ifdef CONFIG_DEVFS_FS
9141 + normal_name: "ttyAM%d",
9142 + callout_name: "cuaam%d",
9144 + normal_name: "ttyAM",
9145 + callout_name: "cuaam",
9147 + normal_driver: &normal,
9148 + callout_major: CALLOUT_AMBA_MAJOR,
9149 + callout_driver: &callout,
9150 + table: amba11_table,
9151 + termios: amba11_termios,
9152 + termios_locked: amba11_termios_locked,
9153 + minor: SERIAL_AMBA_MINOR,
9155 + cons: AMBA_CONSOLE,
9158 +static int __init amba11uart_init(void)
9162 + ret = uart_register_driver(&amba11_reg);
9166 + for (i = 0; i < UART_NR; i++)
9167 + uart_add_one_port(&amba11_reg, &amba11_ports[i].port);
9172 +static void __exit amba11uart_exit(void)
9176 + for (i = 0; i < UART_NR; i++)
9177 + uart_remove_one_port(&amba11_reg, &amba11_ports[i].port);
9179 + uart_unregister_driver(&amba11_reg);
9182 +module_init(amba11uart_init);
9183 +module_exit(amba11uart_exit);
9187 +MODULE_AUTHOR("Lineo, Inc.");
9188 +MODULE_DESCRIPTION("ARM AMBA PrimeCell PL011 serial port driver");
9189 +MODULE_LICENSE("GPL");
9191 diff -urN linux-2.4.26/drivers/serial/Config.in linux-2.4.26-vrs1-lnode80/drivers/serial/Config.in
9192 --- linux-2.4.26/drivers/serial/Config.in 2005-11-02 16:54:25.000000000 -0400
9193 +++ linux-2.4.26-vrs1-lnode80/drivers/serial/Config.in 2005-11-02 17:37:31.000000000 -0400
9195 define_bool CONFIG_SERIAL_INTEGRATOR y
9198 + dep_tristate 'ARM PL011 PrimeCell serial port support' CONFIG_SERIAL_AMBA_PL011 $CONFIG_ARCH_LH79520
9200 + if [ "$CONFIG_SERIAL_AMBA" = "y" ]; then
9201 + bool ' Support for console on AMBA serial port' CONFIG_SERIAL_AMBA_CONSOLE
9204 + if [ "$CONFIG_SERIAL_AMBA_PL011" = "y" ]; then
9205 + bool ' Support for console on ARM PrimeCell PL011 serial port' CONFIG_SERIAL_AMBA_PL011_CONSOLE
9208 + dep_tristate 'Sharp LH7A400 serial port support' CONFIG_SERIAL_LH7A400 $CONFIG_ARCH_LH7A400
9210 + if [ "$CONFIG_SERIAL_LH7A400" = "y" ]; then
9211 + bool ' Support for console on LH7A400 serial port' CONFIG_SERIAL_LH7A400_CONSOLE
9214 dep_tristate 'CLPS711X serial port support' CONFIG_SERIAL_CLPS711X $CONFIG_ARCH_CLPS711X
9215 dep_bool ' Support for console on CLPS711X serial port' CONFIG_SERIAL_CLPS711X_CONSOLE $CONFIG_SERIAL_CLPS711X
9218 dep_bool ' Support Bell Technologies HUB6 card' CONFIG_SERIAL_8250_HUB6 $CONFIG_SERIAL_8250_EXTENDED
9220 if [ "$CONFIG_SERIAL_AMBA" = "y" -o \
9221 + "$CONFIG_SERIAL_AMBA_PL011" = "y" -o \
9222 + "$CONFIG_SERIAL_LH7A400" = "y" -o \
9223 "$CONFIG_SERIAL_CLPS711X" = "y" -o \
9224 "$CONFIG_SERIAL_SA1100" = "y" -o \
9225 "$CONFIG_SERIAL_ANAKIN" = "y" -o \
9227 define_bool CONFIG_SERIAL_CORE y
9229 if [ "$CONFIG_SERIAL_AMBA" = "m" -o \
9230 + "$CONFIG_SERIAL_AMBA_PL011" = "m" -o \
9231 + "$CONFIG_SERIAL_LH7A400" = "m" -o \
9232 "$CONFIG_SERIAL_CLPS711X" = "m" -o \
9233 "$CONFIG_SERIAL_SA1100" = "m" -o \
9234 "$CONFIG_SERIAL_ANAKIN" = "m" -o \
9238 if [ "$CONFIG_SERIAL_AMBA_CONSOLE" = "y" -o \
9239 + "$CONFIG_SERIAL_AMBA_PL011_CONSOLE" = "y" -o \
9240 + "$CONFIG_SERIAL_LH7A400_CONSOLE" = "y" -o \
9241 "$CONFIG_SERIAL_CLPS711X_CONSOLE" = "y" -o \
9242 "$CONFIG_SERIAL_SA1100_CONSOLE" = "y" -o \
9243 "$CONFIG_SERIAL_ANAKIN_CONSOLE" = "y" -o \
9244 diff -urN linux-2.4.26/drivers/serial/core.c linux-2.4.26-vrs1-lnode80/drivers/serial/core.c
9245 --- linux-2.4.26/drivers/serial/core.c 2005-11-02 16:54:25.000000000 -0400
9246 +++ linux-2.4.26-vrs1-lnode80/drivers/serial/core.c 2005-11-02 17:37:32.000000000 -0400
9247 @@ -1938,6 +1938,7 @@
9250 extern void ambauart_console_init(void);
9251 +extern void amba11uart_console_init(void);
9252 extern void anakin_console_init(void);
9253 extern void clps711xuart_console_init(void);
9254 extern void sa1100_rs_console_init(void);
9255 @@ -1970,6 +1971,12 @@
9256 #ifdef CONFIG_SERIAL_UART00_CONSOLE
9257 uart00_console_init();
9259 +#ifdef CONFIG_SERIAL_AMBA_PL011_CONSOLE
9260 + amba11uart_console_init();
9262 +#ifdef CONFIG_SERIAL_LH7A400_CONSOLE
9263 + lh7a400uart_console_init();
9266 #endif /* CONFIG_SERIAL_CORE_CONSOLE */
9268 diff -urN linux-2.4.26/drivers/serial/Makefile linux-2.4.26-vrs1-lnode80/drivers/serial/Makefile
9269 --- linux-2.4.26/drivers/serial/Makefile 2005-11-02 16:54:25.000000000 -0400
9270 +++ linux-2.4.26-vrs1-lnode80/drivers/serial/Makefile 2005-11-02 17:37:31.000000000 -0400
9272 obj-$(CONFIG_SERIAL_8250) += 8250.o $(serial-8250-y)
9273 obj-$(CONFIG_SERIAL_ANAKIN) += anakin.o
9274 obj-$(CONFIG_SERIAL_AMBA) += amba.o
9275 +obj-$(CONFIG_SERIAL_AMBA_PL011) += amba_pl011.o
9276 +obj-$(CONFIG_SERIAL_LH7A400) += serial_lh7a400.o
9277 obj-$(CONFIG_SERIAL_CLPS711X) += clps711x.o
9278 obj-$(CONFIG_SERIAL_SA1100) += sa1100.o
9279 obj-$(CONFIG_SERIAL_UART00) += uart00.o
9280 diff -urN linux-2.4.26/drivers/video/Config.in linux-2.4.26-vrs1-lnode80/drivers/video/Config.in
9281 --- linux-2.4.26/drivers/video/Config.in 2005-11-02 16:54:25.000000000 -0400
9282 +++ linux-2.4.26-vrs1-lnode80/drivers/video/Config.in 2005-11-02 17:37:32.000000000 -0400
9284 dep_bool ' CLPS711X LCD support' CONFIG_FB_CLPS711X $CONFIG_ARCH_CLPS711X
9285 dep_bool ' SA-1100 LCD support' CONFIG_FB_SA1100 $CONFIG_ARCH_SA1100
9286 dep_bool ' MX1ADS LCD support' CONFIG_FB_DBMX1 $CONFIG_ARCH_MX1ADS
9287 + if [ "$CONFIG_ARCH_LH79520" = "y" -o \
9288 + "$CONFIG_ARCH_LH7A400" = "y" ];then
9289 + bool ' ARM PL110 LCD support' CONFIG_FB_PL110
9292 if [ "$CONFIG_FB_SA1100" = "y" -a "$CONFIG_SA1100_CERF" = "y" ]; then
9293 choice 'CerfBoard LCD Display Size' \
9294 "3.8_Color CONFIG_CERF_LCD_38_A \
9296 if [ "$CONFIG_FB_SA1100" = "y" -a "$CONFIG_SA1100_CERF_CPLD" = "y" ]; then
9297 bool 'Cerfboard Backlight (CerfPDA)' CONFIG_SA1100_CERF_LCD_BACKLIGHT
9299 + if [ "$CONFIG_FB_PL110" = "y" ]; then
9300 + choice 'LCD Display panel' \
9301 + "Panasonic CONFIG_PL110_PAN78 \
9302 + Sharp_LQ039Q2DS53-HR-TFT CONFIG_PL110_LQ39 \
9303 + Sharp_LM057QCTT03-QVGA-STN CONFIG_PL110_LM57 \
9304 + Sharp_LQ057Q3DC02-VGA/QVGA-TFT CONFIG_PL110_LQ57 \
9305 + Sharp_LQ121S1DG31-800x600-TFT CONFIG_PL110_LQ121 \
9306 + Sharp_LQ104V1DG11-640x480-TFT CONFIG_PL110_LQ104" Sharp_LQ039Q2DS53-HR-TFT
9309 dep_tristate ' CyberPro 2000/2010/5000 support' CONFIG_FB_CYBER2000 $CONFIG_PCI
9310 if [ "$CONFIG_APOLLO" = "y" ]; then
9312 "$CONFIG_FB_MAC" = "y" -o "$CONFIG_FB_RETINAZ3" = "y" -o \
9313 "$CONFIG_FB_VIRGE" = "y" -o "$CONFIG_FB_VIRTUAL" = "y" -o \
9314 "$CONFIG_FB_BWTWO" = "y" -o "$CONFIG_FB_CLGEN" = "y" -o \
9315 - "$CONFIG_FB_TX3912" = "y" -o "$CONFIG_FB_CLPS711X" = "y" ]; then
9316 + "$CONFIG_FB_TX3912" = "y" -o "$CONFIG_FB_CLPS711X" = "y" -o \
9317 + "$CONFIG_FB_PL110" = "y" ]; then
9318 define_tristate CONFIG_FBCON_MFB y
9320 if [ "$CONFIG_FB_ACORN" = "m" -o "$CONFIG_FB_AMIGA" = "m" -o \
9321 @@ -288,20 +303,22 @@
9322 "$CONFIG_FB_MAC" = "m" -o "$CONFIG_FB_RETINAZ3" = "m" -o \
9323 "$CONFIG_FB_VIRGE" = "m" -o "$CONFIG_FB_VIRTUAL" = "m" -o \
9324 "$CONFIG_FB_BWTWO" = "m" -o "$CONFIG_FB_CLGEN" = "m" -o \
9325 - "$CONFIG_FB_TX3912" = "m" -o "$CONFIG_FB_CLPS711X" = "m" ]; then
9326 + "$CONFIG_FB_TX3912" = "m" -o "$CONFIG_FB_CLPS711X" = "m" -o \
9327 + "$CONFIG_FB_PL110" = "m" ]; then
9328 define_tristate CONFIG_FBCON_MFB m
9331 if [ "$CONFIG_FB_ACORN" = "y" -o "$CONFIG_FB_MAC" = "y" -o \
9332 "$CONFIG_FB_SA1100" = "y" -o "$CONFIG_FB_VIRTUAL" = "y" -o \
9333 "$CONFIG_FB_TX3912" = "y" -o "$CONFIG_FB_CLPS711X" = "y" -o \
9334 - "$CONFIG_FB_DBMX1" = "y" ]; then
9335 + "$CONFIG_FB_DBMX1" = "y" -o "$CONFIG_FB_PL110" = "y"]; then
9336 define_tristate CONFIG_FBCON_CFB2 y
9337 define_tristate CONFIG_FBCON_CFB4 y
9339 if [ "$CONFIG_FB_ACORN" = "m" -o "$CONFIG_FB_MAC" = "m" -o \
9340 "$CONFIG_FB_SA1100" = "m" -o "$CONFIG_FB_VIRTUAL" = "m" -o \
9341 - "$CONFIG_FB_TX3912" = "m" -o "$CONFIG_FB_CLPS711X" = "m" ]; then
9342 + "$CONFIG_FB_TX3912" = "m" -o "$CONFIG_FB_CLPS711X" = "m" -o \
9343 + "$CONFIG_FB_PL110" = "m" ]; then
9344 define_tristate CONFIG_FBCON_CFB2 m
9345 define_tristate CONFIG_FBCON_CFB4 m
9348 "$CONFIG_FB_SIS" = "y" -o "$CONFIG_FB_NEOMAGIC" = "y" -o \
9349 "$CONFIG_FB_STI" = "y" -o "$CONFIG_FB_HP300" = "y" -o \
9350 "$CONFIG_FB_INTEL" = "y" -o \
9351 + "$CONFIG_FB_PL110" = "y" -o \
9352 "$CONFIG_FB_DBMX1" = "y" ]; then
9353 define_tristate CONFIG_FBCON_CFB8 y
9356 "$CONFIG_FB_RADEON" = "m" -o "$CONFIG_FB_INTEL" = "m" -o \
9357 "$CONFIG_FB_SA1100" = "m" -o "$CONFIG_FB_SIS" = "m" -o \
9358 "$CONFIG_FB_TX3912" = "m" -o "$CONFIG_FB_NEOMAGIC" = "m" -o \
9359 + "$CONFIG_FB_PL110" = "m" -o \
9360 "$CONFIG_FB_STI" = "m" -o "$CONFIG_FB_INTEL" = "m" ]; then
9361 define_tristate CONFIG_FBCON_CFB8 m
9364 "$CONFIG_FB_PVR2" = "y" -o "$CONFIG_FB_VOODOO1" = "y" -o \
9365 "$CONFIG_FB_NEOMAGIC" = "y" -o "$CONFIG_FB_INTEL" = "y" -o \
9366 "$CONFIG_FB_ANAKIN" = "y" -o \
9367 + "$CONFIG_FB_PL110" = "y" -o \
9368 "$CONFIG_FB_DBMX1" = "y" ]; then
9369 define_tristate CONFIG_FBCON_CFB16 y
9372 "$CONFIG_FB_CYBER2000" = "m" -o "$CONFIG_FB_SIS" = "m" -o \
9373 "$CONFIG_FB_SA1100" = "m" -o "$CONFIG_FB_RADEON" = "m" -o \
9374 "$CONFIG_FB_INTEL" = "m" -o \
9375 + "$CONFIG_FB_PL110" = "m" -o \
9376 "$CONFIG_FB_PVR2" = "m" -o "$CONFIG_FB_VOODOO1" = "m" -o \
9377 "$CONFIG_FB_NEOMAGIC" = "m" -o "$CONFIG_FB_INTEL" = "m" ]; then
9378 define_tristate CONFIG_FBCON_CFB16 m
9379 diff -urN linux-2.4.26/drivers/video/fbcon.c linux-2.4.26-vrs1-lnode80/drivers/video/fbcon.c
9380 --- linux-2.4.26/drivers/video/fbcon.c 2003-08-25 07:44:42.000000000 -0400
9381 +++ linux-2.4.26-vrs1-lnode80/drivers/video/fbcon.c 2005-11-02 17:37:32.000000000 -0400
9382 @@ -2401,9 +2401,9 @@
9383 p->type == FB_TYPE_INTERLEAVED_PLANES)) {
9386 - unsigned char inverse = p->inverse || p->visual == FB_VISUAL_MONO01
9389 + //FJBunsigned char inverse = p->inverse || p->visual == FB_VISUAL_MONO01
9390 + //FJB ? 0x00 : 0xff;
9391 + unsigned char inverse = 0;
9392 int is_hga = !strncmp(p->fb_info->modename, "HGA", 3);
9393 /* can't use simply memcpy because need to apply inverse */
9394 for( y1 = 0; y1 < LOGO_H; y1++ ) {
9395 diff -urN linux-2.4.26/drivers/video/fbmem.c linux-2.4.26-vrs1-lnode80/drivers/video/fbmem.c
9396 --- linux-2.4.26/drivers/video/fbmem.c 2005-11-02 16:54:25.000000000 -0400
9397 +++ linux-2.4.26-vrs1-lnode80/drivers/video/fbmem.c 2005-11-02 17:37:32.000000000 -0400
9399 extern int chips_init(void);
9400 extern int g364fb_init(void);
9401 extern int sa1100fb_init(void);
9402 +extern int pl110fb_init(void);
9403 extern int fm2fb_init(void);
9404 extern int fm2fb_setup(char*);
9405 extern int q40fb_init(void);
9407 #ifdef CONFIG_FB_SA1100
9408 { "sa1100", sa1100fb_init, NULL },
9410 +#ifdef CONFIG_FB_PL110
9411 + { "pl110", pl110fb_init, NULL },
9413 #ifdef CONFIG_FB_SUN3
9414 { "sun3", sun3fb_init, sun3fb_setup },
9416 diff -urN linux-2.4.26/drivers/video/Makefile linux-2.4.26-vrs1-lnode80/drivers/video/Makefile
9417 --- linux-2.4.26/drivers/video/Makefile 2005-11-02 16:54:25.000000000 -0400
9418 +++ linux-2.4.26-vrs1-lnode80/drivers/video/Makefile 2005-11-02 17:37:32.000000000 -0400
9424 +# The following is VERY IMPORTANT for the pl110; newer gccs won't compile the driver
9425 +# properly and it will hang at "Console: switching to colour frame buffer device ..."
9427 +ifeq ($(CONFIG_FB_PL110),y)
9431 mod-subdirs := matrox sti
9433 # All of the (potential) objects that export symbols.
9435 fbcon-iplan2p8.o fbcon-vga-planes.o fbcon-cfb16.o \
9436 fbcon-cfb2.o fbcon-cfb24.o fbcon-cfb32.o fbcon-cfb4.o \
9437 fbcon-cfb8.o fbcon-mac.o fbcon-mfb.o \
9438 - cyber2000fb.o sa1100fb.o fbcon-hga.o fbgen.o
9439 + cyber2000fb.o sa1100fb.o fbcon-hga.o fbgen.o pl110fb.o
9441 # Each configuration option enables a list of files.
9444 obj-$(CONFIG_FB_PVR2) += pvr2fb.o
9445 obj-$(CONFIG_FB_VOODOO1) += sstfb.o
9446 obj-$(CONFIG_FB_ANAKIN) += anakinfb.o
9447 +obj-$(CONFIG_FB_PL110) += pl110fb.o
9449 # Generic Low Level Drivers
9451 diff -urN linux-2.4.26/drivers/video/pl110fb.c linux-2.4.26-vrs1-lnode80/drivers/video/pl110fb.c
9452 --- linux-2.4.26/drivers/video/pl110fb.c 1969-12-31 20:00:00.000000000 -0400
9453 +++ linux-2.4.26-vrs1-lnode80/drivers/video/pl110fb.c 2005-11-02 17:37:32.000000000 -0400
9456 + * linux/drivers/video/pl110fb.c
9458 + * ARM PrimeCell PL110 LCD Controller Frame Buffer Driver
9460 + * Copyright (C) 2002 Lineo, Inc.
9461 + * Based on sa1100fb.c, which is Copyright (C) Eric A. Thomas
9463 + * This file is subject to the terms and conditions of the GNU General Public
9464 + * License. See the file COPYING in the main directory of this archive for
9468 +#include <linux/config.h>
9469 +#include <linux/module.h>
9470 +#include <linux/kernel.h>
9471 +#include <linux/sched.h>
9472 +#include <linux/errno.h>
9473 +#include <linux/string.h>
9474 +#include <linux/interrupt.h>
9475 +#include <linux/slab.h>
9476 +#include <linux/fb.h>
9477 +#include <linux/delay.h>
9478 +#include <linux/pm.h>
9479 +#include <linux/init.h>
9480 +#include <linux/cpufreq.h>
9482 +#include <asm/hardware.h>
9483 +#include <asm/io.h>
9484 +#include <asm/irq.h>
9485 +#include <asm/mach-types.h>
9486 +#include <asm/uaccess.h>
9488 +#include <video/fbcon.h>
9489 +#include <video/fbcon-mfb.h>
9490 +#include <video/fbcon-cfb4.h>
9491 +#include <video/fbcon-cfb8.h>
9492 +#include <video/fbcon-cfb16.h>
9494 +#ifdef CONFIG_ARCH_LH79520
9495 +#include <asm/arch/rcpc.h>
9496 +#include <asm/arch/cpld.h>
9497 +#include <asm/arch/iocon.h>
9500 +#ifdef CONFIG_ARCH_LH7A400
9501 +#include <asm/arch/cpld.h>
9502 +#include <asm/arch/gpio.h>
9510 + * Complain if VAR is out of range.
9512 +#define DEBUG_VAR 1
9513 +#define BACKLIGHT _BIT(15)
9514 +//#define GPOUT16 (*(volatile u16*)GPOUT16_BASE)
9516 +//#define GPOUT16 (*(volatile u16*)GPOUT16_BASE)
9518 +// global defined in marm-lh7x.c -- driver
9519 +extern unsigned short marm_backlight;
9520 +#define GPOUT16 marm_backlight
9522 +#include "pl110fb.h"
9524 +extern unsigned int hclkfreq_get( void);
9526 +void (*pl110fb_blank_helper)(int blank);
9527 +EXPORT_SYMBOL(pl110fb_blank_helper);
9534 +static struct pl110fb_rgb rgb_8 = {
9535 + red: { offset: 0, length: 4, },
9536 + green: { offset: 0, length: 4, },
9537 + blue: { offset: 0, length: 4, },
9538 + transp: { offset: 0, length: 0, },
9541 +static struct pl110fb_rgb rgb_8 = {
9542 + red: { offset: 0, length: 5, },
9543 + green: { offset: 0, length: 5, },
9544 + blue: { offset: 0, length: 5, },
9545 + transp: { offset: 0, length: 0, },
9548 +#error define _444 or _555
9553 +static struct pl110fb_rgb def_rgb_16 = {
9554 + red: { offset: 11, length: 5, },
9555 + green: { offset: 5, length: 6, },
9556 + blue: { offset: 0, length: 5, },
9557 + transp: { offset: 0, length: 0, },
9560 +static struct pl110fb_rgb def_rgb_16 = {
9561 + red: { offset: 10, length: 5, },
9562 + green: { offset: 5, length: 5, },
9563 + blue: { offset: 0, length: 5, },
9564 + transp: { offset: 0, length: 0, },
9569 +#define VERTICAL_REFRESH 70 /* optimum refresh rate, in Hz. */
9572 +#if defined(CONFIG_ARCH_LH79520) || defined(CONFIG_ARCH_LH7A400)
9573 +static struct pl110fb_mach_info lh_info __initdata = {
9575 +#if defined(CONFIG_PL110_LQ39)
9577 + xres: 640, yres: 480,
9578 + hsync_len: 13, /* hsw */ vsync_len: 2, /* vsw */
9579 + left_margin: 21, /* hbp */ upper_margin: 5, /* vbp */
9580 + right_margin: 11, /* hfp */ lower_margin: 5, /* vfp */
9582 + sync: FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT,
9588 + LCDcontrol: LCD_CTRL_BW_COLOR | LCD_CTRL_WATERMARK ,
9590 + LCDICPcontrol: 0, //LCDICP_CONTROL_CLSEN | LCDICP_CONTROL_SPSEN,
9592 + LCDICPsetup: LCDICP_SETUP_VERT_NORMAL | LCDICP_SETUP_HORIZ_NORMAL,
9594 + LCDICPtiming1: LCDICP_TIMING1_PSDEL(9) | LCDICP_TIMING1_REVDEL(3) | LCDICP_TIMING1_LPDEL(14),
9596 + LCDICPtiming2: LCDICP_TIMING2_PSDEL2(209) | LCDICP_TIMING2_SPLVALUE(34),
9599 + * The Sharp LQ039Q2DS53 panel takes an RGB666 signal,
9600 + * but we provide it with an RGB555 signal instead (def_rgb_16).
9603 + /* bpp set based on DIP switches on LCD board */
9605 +// xres: 320, yres: 240,
9606 +// hsync_len: 13, /* hsw */ vsync_len: 2, /* vsw */
9607 +// left_margin: 21, /* hbp */ upper_margin: 5, /* vbp */
9608 +// right_margin: 11, /* hfp */ lower_margin: 5, /* vfp */
9610 +// sync: FB_SYNC_VERT_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
9612 +// LCDtiming2: LCD_TIMING2_IPC,
9616 +// LCDcontrol: LCD_CTRL_TFT | LCD_CTRL_BW_COLOR | LCD_CTRL_WATERMARK,
9618 +// LCDICPcontrol: LCDICP_CONTROL_CLSEN | LCDICP_CONTROL_SPSEN,
9620 +// LCDICPsetup: LCDICP_SETUP_MODE_HRTFT | LCDICP_SETUP_VERT_NORMAL | LCDICP_SETUP_HORIZ_NORMAL,
9622 +// LCDICPtiming1: LCDICP_TIMING1_PSDEL(9) | LCDICP_TIMING1_REVDEL(3) | LCDICP_TIMING1_LPDEL(14),
9624 +// LCDICPtiming2: LCDICP_TIMING2_PSDEL2(209) | LCDICP_TIMING2_SPLVALUE(34),
9627 +#elif defined(CONFIG_PL110_PAN78)
9629 + xres: 640, yres: 480,
9630 + hsync_len: 13, /* hsw */ vsync_len: 2, /* vsw */
9631 + left_margin: 21, /* hbp */ upper_margin: 5, /* vbp */
9632 + right_margin: 11, /* hfp */ lower_margin: 5, /* vfp */
9634 + sync: FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT,
9640 + LCDcontrol: LCD_CTRL_BW_COLOR | LCD_CTRL_WATERMARK,
9642 + LCDICPcontrol: 0, //LCDICP_CONTROL_CLSEN | LCDICP_CONTROL_SPSEN,
9644 + LCDICPsetup: LCDICP_SETUP_VERT_NORMAL | LCDICP_SETUP_HORIZ_NORMAL,
9646 + LCDICPtiming1: LCDICP_TIMING1_PSDEL(9) | LCDICP_TIMING1_REVDEL(3) | LCDICP_TIMING1_LPDEL(14),
9648 + LCDICPtiming2: LCDICP_TIMING2_PSDEL2(209) | LCDICP_TIMING2_SPLVALUE(34),
9650 +#elif defined(CONFIG_PL110_LM57)
9652 + xres: 320, yres: 240,
9653 +#elif defined(CONFIG_PL110_LQ57)
9655 + xres: 240, yres: 320,
9656 +#elif defined(CONFIG_PL110_LQ121)
9658 + xres: 320, yres: 240,
9659 +#elif defined(CONFIG_PL110_LQ101)
9661 +#error "You must have an LCD panel configured"
9664 +#endif // CONFIG_ARCH_LH79520 || CONFIG_ARCH_LH7A400
9668 +static struct pl110fb_mach_info * __init
9669 +pl110fb_get_machine_info(struct pl110fb_info *fbi)
9671 + struct pl110fb_mach_info *inf = NULL;
9673 +#if defined(CONFIG_ARCH_LH79520)
9674 + cpldRegs_t *cpld = (cpldRegs_t *)CPLD_BASE;
9675 + u8 dipSw = (u8)~(cpld->display_dip_sw & 0xff);
9677 + if( machine_is_lh79520evb()) {
9680 + /* set bpp based on LCD board dip switch 0 */
9681 + inf->bpp = 8; //(dipSw & 1 ? 8 : 16);
9684 +#if defined(CONFIG_ARCH_LH7A400)
9685 + cpldRegs_t *cpld = (cpldRegs_t *)CPLD_BASE;
9686 + u8 dipSw = (u8)~(cpld->u3.dispDipSw & 0xff);
9688 + if( machine_is_lh7a400evb()) {
9691 + /* set bpp based on LCD board dip switch 0 */
9692 + inf->bpp = (dipSw & 1 ? 8 : 16);
9699 +static int pl110fb_activate_var(struct fb_var_screeninfo *var, struct pl110fb_info *);
9700 +static void set_ctrlr_state(struct pl110fb_info *fbi, u_int state);
9704 +pl110fb_schedule_task(struct pl110fb_info *fbi, u_int state)
9706 + unsigned long flags;
9708 + local_irq_save(flags);
9710 + * We need to handle two requests being made at the same time.
9711 + * There are two important cases:
9712 + * 1. When we are changing VT (C_REENABLE) while unblanking (C_ENABLE)
9713 + * We must perform the unblanking, which will do our REENABLE for us.
9714 + * 2. When we are blanking, but immediately unblank before we have
9715 + * blanked. We do the "REENABLE" thing here as well, just to be sure.
9717 + if (fbi->task_state == C_ENABLE && state == C_REENABLE)
9718 + state = (u_int) -1;
9719 + if (fbi->task_state == C_DISABLE && state == C_ENABLE)
9720 + state = C_REENABLE;
9722 + if (state != (u_int)-1) {
9723 + fbi->task_state = state;
9724 + schedule_task(&fbi->task);
9726 + local_irq_restore(flags);
9730 + * Get the VAR structure pointer for the specified console
9732 +static inline struct fb_var_screeninfo *
9733 +get_con_var(struct fb_info *info, int con)
9735 + struct pl110fb_info *fbi = (struct pl110fb_info *)info;
9736 + return (con == fbi->currcon || con == -1) ? &fbi->fb.var : &fb_display[con].var;
9740 + * Get the DISPLAY structure pointer for the specified console
9742 +static inline struct display *
9743 +get_con_display(struct fb_info *info, int con)
9745 + struct pl110fb_info *fbi = (struct pl110fb_info *)info;
9746 + return (con < 0) ? fbi->fb.disp : &fb_display[con];
9750 + * Get the CMAP pointer for the specified console
9752 +static inline struct fb_cmap *
9753 +get_con_cmap(struct fb_info *info, int con)
9755 + struct pl110fb_info *fbi = (struct pl110fb_info *)info;
9757 + return (con == fbi->currcon || con == -1) ? &fbi->fb.cmap : &fb_display[con].cmap;
9760 +static inline u_int
9761 +chan_to_field(u_int chan, struct fb_bitfield *bf)
9764 + chan >>= 16 - bf->length;
9765 + return chan << bf->offset;
9770 +pl110fb_setpalettereg(u_int regno, u_int red, u_int green, u_int blue,
9771 + u_int trans, struct fb_info *info)
9773 + struct pl110fb_info *fbi = (struct pl110fb_info *)info;
9774 + u_int val, ret = 1;
9775 + lcdRegs_t *LCD = (lcdRegs_t *)IO_ADDRESS(LCD_PHYS);
9777 + if (regno < fbi->palette_size) {
9780 + val = ((red >> 4) & 0x0F00) >> 7; // bits 4:0
9781 + val |= ((green >> 8) & 0x00F0) << 2; // bits 9:5
9782 + val |= ((blue >> 12) & 0x000F) << 11; // bits 14:10
9784 + val = (red & 0xF800) >> 11; // bits 4:0
9785 + val |= (green & 0xF800) >> 6; // bits 9:5
9786 + val |= (blue & 0xF800) >> 1; // bits 14:10
9787 + val |= 0x8000; // always set intensity bit
9790 + if( regno & 1) /* setting higher number entry */
9791 + LCD->palette[regno >> 1] = (LCD->palette[regno >> 1] & 0x0000ffff) | (val << 16);
9792 + else /* setting lower number entry */
9793 + LCD->palette[regno >> 1] = (LCD->palette[regno >> 1] & 0xffff0000) | val;
9796 +// DPRINTK( "reg=%x r=%x g=%x b=%x t=%x addr=%x val=%x entry=%x\n",
9797 +// regno, red, green, blue, trans, &LCD->palette[regno >> 1], val,
9798 +// LCD->palette[regno >> 1]);
9807 +pl110fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
9808 + u_int trans, struct fb_info *info)
9810 + struct pl110fb_info *fbi = (struct pl110fb_info *)info;
9811 + struct display *disp = get_con_display(info, fbi->currcon);
9816 + * If inverse mode was selected, invert all the colours
9817 + * rather than the register number. The register number
9818 + * is what you poke into the framebuffer to produce the
9819 + * colour you requested.
9821 + if (disp->inverse) {
9822 + red = 0xffff - red;
9823 + green = 0xffff - green;
9824 + blue = 0xffff - blue;
9828 + * If greyscale is true, then we convert the RGB value
9829 + * to greyscale no mater what visual we are using.
9831 + if (fbi->fb.var.grayscale)
9832 + red = green = blue = (19595 * red + 38470 * green +
9833 + 7471 * blue) >> 16;
9835 + switch (fbi->fb.disp->visual) {
9836 + case FB_VISUAL_TRUECOLOR:
9838 + * 12 or 16-bit True Colour. We encode the RGB value
9839 + * according to the RGB bitfield information.
9842 + u16 *pal = fbi->fb.pseudo_palette;
9844 + val = chan_to_field(red, &fbi->fb.var.red);
9845 + val |= chan_to_field(green, &fbi->fb.var.green);
9846 + val |= chan_to_field(blue, &fbi->fb.var.blue);
9853 + case FB_VISUAL_STATIC_PSEUDOCOLOR:
9854 + case FB_VISUAL_PSEUDOCOLOR:
9855 + ret = pl110fb_setpalettereg(regno, red, green, blue, trans, info);
9863 + * pl110fb_display_dma_period()
9864 + * Calculate the minimum period (in picoseconds) between two DMA
9865 + * requests for the LCD controller.
9867 +static unsigned int
9868 +pl110fb_display_dma_period(struct fb_var_screeninfo *var)
9870 + unsigned int mem_bits_per_pixel;
9872 + mem_bits_per_pixel = var->bits_per_pixel;
9873 + if (mem_bits_per_pixel == 12)
9874 + mem_bits_per_pixel = 16;
9877 + * Period = pixclock * bits_per_byte * bytes_per_transfer
9878 + * / memory_bits_per_pixel;
9880 + return var->pixclock * 8 * 16 / mem_bits_per_pixel;
9884 + * pl110fb_decode_var():
9885 + * Get the video params out of 'var'. If a value doesn't fit, round it up,
9886 + * if it's too big, return -EINVAL.
9888 + * Suggestion: Round up in the following order: bits_per_pixel, xres,
9889 + * yres, xres_virtual, yres_virtual, xoffset, yoffset, grayscale,
9890 + * bitfields, horizontal timing, vertical timing.
9893 +pl110fb_validate_var(struct fb_var_screeninfo *var,
9894 + struct pl110fb_info *fbi)
9896 + int ret = -EINVAL;
9898 + if (var->xres < MIN_XRES)
9899 + var->xres = MIN_XRES;
9900 + if (var->yres < MIN_YRES)
9901 + var->yres = MIN_YRES;
9902 + if (var->xres > fbi->max_xres)
9903 + var->xres = fbi->max_xres;
9904 + if (var->yres > fbi->max_yres)
9905 + var->yres = fbi->max_yres;
9906 + var->xres_virtual =
9907 + var->xres_virtual < var->xres ? var->xres : var->xres_virtual;
9908 + var->yres_virtual =
9909 + var->yres_virtual < var->yres ? var->yres : var->yres_virtual;
9911 + DPRINTK("var->bits_per_pixel=%d\n", var->bits_per_pixel);
9912 + switch (var->bits_per_pixel) {
9913 +#ifdef FBCON_HAS_CFB4
9914 + case 4: ret = 0; break;
9916 +#ifdef FBCON_HAS_CFB8
9917 + case 8: ret = 0; break;
9919 +#ifdef FBCON_HAS_CFB16
9920 + case 16: ret = 0; break;
9926 +#ifdef CONFIG_CPU_FREQ
9927 + printk(KERN_DEBUG "dma period = %d ps, clock = %d kHz\n",
9928 + pl110fb_display_dma_period(var),
9929 + cpufreq_get(smp_processor_id()));
9937 +pl110fb_hw_set_var(struct fb_var_screeninfo *var, struct pl110fb_info *fbi)
9939 + u_long palette_mem_size;
9941 + fbi->palette_size = var->bits_per_pixel == 8 ? 256 : 16;
9943 + palette_mem_size = fbi->palette_size * sizeof(u16);
9945 + DPRINTK("palette_mem_size = 0x%08lx\n", (u_long) palette_mem_size);
9947 + fb_set_cmap(&fbi->fb.cmap, 1, pl110fb_setcolreg, &fbi->fb);
9949 + pl110fb_activate_var(var, fbi);
9953 + * pl110fb_set_var():
9954 + * Set the user defined part of the display for the specified console
9957 +pl110fb_set_var(struct fb_var_screeninfo *var, int con, struct fb_info *info)
9959 + struct pl110fb_info *fbi = (struct pl110fb_info *)info;
9960 + struct fb_var_screeninfo *dvar = get_con_var(&fbi->fb, con);
9961 + struct display *display = get_con_display(&fbi->fb, con);
9962 + int err, chgvar = 0, rgbidx;
9964 + DPRINTK("called\n");
9967 + * Decode var contents into a par structure, adjusting any
9968 + * out of range values.
9970 + err = pl110fb_validate_var(var, fbi);
9972 + DPRINTK( "pl110fb_validate_var returned err=%d\n", err);
9976 + if (var->activate & FB_ACTIVATE_TEST)
9979 + if ((var->activate & FB_ACTIVATE_MASK) != FB_ACTIVATE_NOW)
9982 + if (dvar->xres != var->xres)
9984 + if (dvar->yres != var->yres)
9986 + if (dvar->xres_virtual != var->xres_virtual)
9988 + if (dvar->yres_virtual != var->yres_virtual)
9990 + if (dvar->bits_per_pixel != var->bits_per_pixel)
9995 + switch (var->bits_per_pixel) {
9996 +#ifdef FBCON_HAS_CFB4
9998 + if (fbi->cmap_static)
9999 + display->visual = FB_VISUAL_STATIC_PSEUDOCOLOR;
10001 + display->visual = FB_VISUAL_PSEUDOCOLOR;
10002 + display->line_length = var->xres / 2;
10003 + display->dispsw = &fbcon_cfb4;
10007 +#ifdef FBCON_HAS_CFB8
10009 + if (fbi->cmap_static)
10010 + display->visual = FB_VISUAL_STATIC_PSEUDOCOLOR;
10012 + display->visual = FB_VISUAL_PSEUDOCOLOR;
10013 + display->line_length = var->xres;
10014 + display->dispsw = &fbcon_cfb8;
10018 +#ifdef FBCON_HAS_CFB16
10020 + display->visual = FB_VISUAL_TRUECOLOR;
10021 + display->line_length = var->xres * 2;
10022 + display->dispsw = &fbcon_cfb16;
10023 + display->dispsw_data = fbi->fb.pseudo_palette;
10029 + display->dispsw = &fbcon_dummy;
10033 + display->screen_base = fbi->screen_cpu;
10034 + display->next_line = display->line_length;
10035 + display->type = fbi->fb.fix.type;
10036 + display->type_aux = fbi->fb.fix.type_aux;
10037 + display->ypanstep = fbi->fb.fix.ypanstep;
10038 + display->ywrapstep = fbi->fb.fix.ywrapstep;
10039 + display->can_soft_blank = 1;
10040 + display->inverse = fbi->cmap_inverse;
10043 + dvar->activate &= ~FB_ACTIVATE_ALL;
10046 + * Copy the RGB parameters for this display
10047 + * from the machine specific parameters.
10049 + dvar->red = fbi->rgb[rgbidx]->red;
10050 + dvar->green = fbi->rgb[rgbidx]->green;
10051 + dvar->blue = fbi->rgb[rgbidx]->blue;
10052 + dvar->transp = fbi->rgb[rgbidx]->transp;
10054 + DPRINTK("RGBT length = %d:%d:%d:%d\n",
10055 + dvar->red.length, dvar->green.length, dvar->blue.length,
10056 + dvar->transp.length);
10058 + DPRINTK("RGBT offset = %d:%d:%d:%d\n",
10059 + dvar->red.offset, dvar->green.offset, dvar->blue.offset,
10060 + dvar->transp.offset);
10063 + * Update the old var. The fbcon drivers still use this.
10064 + * Once they are using fbi->fb.var, this can be dropped.
10066 + display->var = *dvar;
10069 + * If we are setting all the virtual consoles, also set the
10070 + * defaults used to create new consoles.
10072 + if (var->activate & FB_ACTIVATE_ALL)
10073 + fbi->fb.disp->var = *dvar;
10076 + * If the console has changed and the console has defined
10077 + * a changevar function, call that function.
10079 + if (chgvar && info && fbi->fb.changevar)
10080 + fbi->fb.changevar(con);
10082 + /* If the current console is selected, activate the new var. */
10083 + if (con != fbi->currcon)
10086 + pl110fb_hw_set_var(dvar, fbi);
10092 +__do_set_cmap(struct fb_cmap *cmap, int kspc, int con,
10093 + struct fb_info *info)
10095 + struct pl110fb_info *fbi = (struct pl110fb_info *)info;
10096 + struct fb_cmap *dcmap = get_con_cmap(info, con);
10100 + con = fbi->currcon;
10102 + /* no colormap allocated? (we always have "this" colour map allocated) */
10104 + err = fb_alloc_cmap(&fb_display[con].cmap, fbi->palette_size, 0);
10106 + if (!err && con == fbi->currcon)
10107 + err = fb_set_cmap(cmap, kspc, pl110fb_setcolreg, info);
10110 + fb_copy_cmap(cmap, dcmap, kspc ? 0 : 1);
10116 +pl110fb_set_cmap(struct fb_cmap *cmap, int kspc, int con,
10117 + struct fb_info *info)
10119 + struct display *disp = get_con_display(info, con);
10121 + if (disp->visual == FB_VISUAL_TRUECOLOR ||
10122 + disp->visual == FB_VISUAL_STATIC_PSEUDOCOLOR)
10125 + return __do_set_cmap(cmap, kspc, con, info);
10129 +pl110fb_get_fix(struct fb_fix_screeninfo *fix, int con, struct fb_info *info)
10131 + struct display *display = get_con_display(info, con);
10133 + *fix = info->fix;
10135 + fix->line_length = display->line_length;
10136 + fix->visual = display->visual;
10141 +pl110fb_get_var(struct fb_var_screeninfo *var, int con, struct fb_info *info)
10143 + *var = *get_con_var(info, con);
10148 +pl110fb_get_cmap(struct fb_cmap *cmap, int kspc, int con, struct fb_info *info)
10150 + struct fb_cmap *dcmap = get_con_cmap(info, con);
10151 + fb_copy_cmap(dcmap, cmap, kspc ? 0 : 2);
10155 +static struct fb_ops pl110fb_ops = {
10156 + owner: THIS_MODULE,
10157 + fb_get_fix: pl110fb_get_fix,
10158 + fb_get_var: pl110fb_get_var,
10159 + fb_set_var: pl110fb_set_var,
10160 + fb_get_cmap: pl110fb_get_cmap,
10161 + fb_set_cmap: pl110fb_set_cmap,
10165 + * pl110fb_switch():
10166 + * Change to the specified console. Palette and video mode
10167 + * are changed to the console's stored parameters.
10169 + * Uh oh, this can be called from a tasklet (IRQ)
10172 +pl110fb_switch(int con, struct fb_info *info)
10174 + struct pl110fb_info *fbi = (struct pl110fb_info *)info;
10175 + struct display *disp;
10176 + struct fb_cmap *cmap;
10178 + DPRINTK("con=%d info->modename=%s\n", con, fbi->fb.modename);
10180 + if (con == fbi->currcon)
10183 + if (fbi->currcon >= 0) {
10184 + disp = fb_display + fbi->currcon;
10187 + * Save the old colormap and video mode.
10189 + disp->var = fbi->fb.var;
10191 + if (disp->cmap.len)
10192 + fb_copy_cmap(&fbi->fb.cmap, &disp->cmap, 0);
10195 + fbi->currcon = con;
10196 + disp = fb_display + con;
10199 + * Make sure that our colourmap contains 256 entries.
10201 + fb_alloc_cmap(&fbi->fb.cmap, 256, 0);
10203 + if (disp->cmap.len)
10204 + cmap = &disp->cmap;
10206 + cmap = fb_default_cmap(1 << disp->var.bits_per_pixel);
10208 + fb_copy_cmap(cmap, &fbi->fb.cmap, 0);
10210 + fbi->fb.var = disp->var;
10211 + fbi->fb.var.activate = FB_ACTIVATE_NOW;
10213 + pl110fb_set_var(&fbi->fb.var, con, info);
10218 + * Formal definition of the VESA spec:
10220 + * This refers to the state of the display when it is in full operation
10222 + * This defines an optional operating state of minimal power reduction with
10223 + * the shortest recovery time
10225 + * This refers to a level of power management in which substantial power
10226 + * reduction is achieved by the display. The display can have a longer
10227 + * recovery time from this state than from the Stand-by state
10229 + * This indicates that the display is consuming the lowest level of power
10230 + * and is non-operational. Recovery from this state may optionally require
10231 + * the user to manually power on the monitor
10233 + * Now, the fbdev driver adds an additional state, (blank), where they
10234 + * turn off the video (maybe by colormap tricks), but don't mess with the
10235 + * video itself: think of it semantically between on and Stand-By.
10237 + * So here's what we should do in our fbdev blank routine:
10239 + * VESA_NO_BLANKING (mode 0) Video on, front/back light on
10240 + * VESA_VSYNC_SUSPEND (mode 1) Video on, front/back light off
10241 + * VESA_HSYNC_SUSPEND (mode 2) Video on, front/back light off
10242 + * VESA_POWERDOWN (mode 3) Video off, front/back light off
10244 + * This will match the matrox implementation.
10247 + * pl110fb_blank():
10248 + * Blank the display by setting all palette values to zero. Note, the
10249 + * 12 and 16 bpp modes don't really use the palette, so this will not
10250 + * blank the display in all modes.
10253 +pl110fb_blank(int blank, struct fb_info *info)
10255 + struct pl110fb_info *fbi = (struct pl110fb_info *)info;
10258 + DPRINTK("pl110fb_blank: blank=%d info->modename=%s\n", blank,
10259 + fbi->fb.modename);
10262 + case VESA_POWERDOWN:
10263 + case VESA_VSYNC_SUSPEND:
10264 + case VESA_HSYNC_SUSPEND:
10265 + if (fbi->fb.disp->visual == FB_VISUAL_PSEUDOCOLOR ||
10266 + fbi->fb.disp->visual == FB_VISUAL_STATIC_PSEUDOCOLOR)
10267 + for (i = 0; i < fbi->palette_size; i++)
10268 + pl110fb_setpalettereg(i, 0, 0, 0, 0, info);
10269 + pl110fb_schedule_task(fbi, C_DISABLE);
10270 + if (pl110fb_blank_helper)
10271 + pl110fb_blank_helper(blank);
10274 + case VESA_NO_BLANKING:
10275 + if (pl110fb_blank_helper)
10276 + pl110fb_blank_helper(blank);
10277 + if (fbi->fb.disp->visual == FB_VISUAL_PSEUDOCOLOR ||
10278 + fbi->fb.disp->visual == FB_VISUAL_STATIC_PSEUDOCOLOR)
10279 + fb_set_cmap(&fbi->fb.cmap, 1, pl110fb_setcolreg, info);
10280 + pl110fb_schedule_task(fbi, C_ENABLE);
10285 +pl110fb_updatevar(int con, struct fb_info *info)
10287 + DPRINTK("entered\n");
10292 + * Calculate the PCD value from the clock rate (in picoseconds).
10293 + * We take account of the PPCR clock setting.
10296 +get_pcd(unsigned int pixclock)
10298 + unsigned int pcd;
10301 + pcd = hclkfreq_get() / 100000;
10304 + pcd += 1; /* make up for integer math truncations */
10307 + * People seem to be missing this message. Make it big.
10308 + * Make it stand out. Make sure people see it.
10310 + printk(KERN_WARNING "******************************************************\n");
10311 + printk(KERN_WARNING "** ZERO PIXEL CLOCK DETECTED **\n");
10312 + printk(KERN_WARNING "** You are using a zero pixclock. This means that **\n");
10313 + printk(KERN_WARNING "** clock scaling will not be able to adjust your **\n");
10314 + printk(KERN_WARNING "** your timing parameters appropriately, and the **\n");
10315 + printk(KERN_WARNING "** bandwidth calculations will fail to work. This **\n");
10316 + printk(KERN_WARNING "** will shortly become an error condition, which **\n");
10317 + printk(KERN_WARNING "** will prevent your LCD display working. Please **\n");
10318 + printk(KERN_WARNING "** send your patches in as soon as possible to shut **\n");
10319 + printk(KERN_WARNING "** this message up. **\n");
10320 + printk(KERN_WARNING "******************************************************\n");
10324 + DPRINTK( "pcd=%d\n", pcd);
10330 + * pl110fb_activate_var():
10331 + * Configures LCD Controller based on entries in var parameter. Settings are
10332 + * only written to the controller if changes were made.
10335 +pl110fb_activate_var(struct fb_var_screeninfo *var, struct pl110fb_info *fbi)
10337 + struct pl110fb_lcd_reg new_regs;
10338 + u_int half_screen_size, yres, pcd = get_pcd( var->pixclock);
10340 + lcdRegs_t *LCD = (lcdRegs_t *)IO_ADDRESS(LCD_PHYS);
10341 + lcdicpRegs_t *LCDICP = (lcdicpRegs_t *)IO_ADDRESS(LCDICP_PHYS);
10343 + DPRINTK("Configuring pl110 LCD\n");
10344 + DPRINTK( "LCD=%p LCDICP=%p\n", LCD, LCDICP);
10346 + DPRINTK("var: xres=%d hslen=%d lm=%d rm=%d\n",
10347 + var->xres, var->hsync_len,
10348 + var->left_margin, var->right_margin);
10349 + DPRINTK("var: yres=%d vslen=%d um=%d bm=%d\n",
10350 + var->yres, var->vsync_len,
10351 + var->upper_margin, var->lower_margin);
10354 + if (var->xres < 16 || var->xres > 1024)
10355 + printk(KERN_ERR "%s: invalid xres %d\n",
10356 + fbi->fb.fix.id, var->xres);
10357 + if (var->hsync_len < 1 || var->hsync_len > 64)
10358 + printk(KERN_ERR "%s: invalid hsync_len %d\n",
10359 + fbi->fb.fix.id, var->hsync_len);
10360 + if (var->left_margin < 1 || var->left_margin > 255)
10361 + printk(KERN_ERR "%s: invalid left_margin %d\n",
10362 + fbi->fb.fix.id, var->left_margin);
10363 + if (var->right_margin < 1 || var->right_margin > 255)
10364 + printk(KERN_ERR "%s: invalid right_margin %d\n",
10365 + fbi->fb.fix.id, var->right_margin);
10366 + if (var->yres < 1 || var->yres > 1024)
10367 + printk(KERN_ERR "%s: invalid yres %d\n",
10368 + fbi->fb.fix.id, var->yres);
10369 + if (var->vsync_len < 1 || var->vsync_len > 64)
10370 + printk(KERN_ERR "%s: invalid vsync_len %d\n",
10371 + fbi->fb.fix.id, var->vsync_len);
10372 + if (var->upper_margin < 0 || var->upper_margin > 255)
10373 + printk(KERN_ERR "%s: invalid upper_margin %d\n",
10374 + fbi->fb.fix.id, var->upper_margin);
10375 + if (var->lower_margin < 0 || var->lower_margin > 255)
10376 + printk(KERN_ERR "%s: invalid lower_margin %d\n",
10377 + fbi->fb.fix.id, var->lower_margin);
10379 + if( var->bits_per_pixel == 8) {
10380 + new_regs.LCDcontrol = LCD_CTRL_BPP8;
10381 + } else if( var->bits_per_pixel == 16) {
10382 + new_regs.LCDcontrol = LCD_CTRL_BPP16 | LCD_CTRL_BGR;
10385 + new_regs.LCDcontrol |= fbi->LCDcontrol | LCD_CTRL_ENABLE;
10387 + new_regs.LCDtiming0 =
10388 + LCD_TIMING0_HFP(var->right_margin) +
10389 + LCD_TIMING0_HBP(var->left_margin) +
10390 + LCD_TIMING0_HSW(var->hsync_len) +
10391 + LCD_TIMING0_PPL(var->xres);
10394 + * If we have a dual scan LCD, then we need to halve
10395 + * the YRES parameter.
10397 + yres = var->yres;
10398 + if( fbi->LCDcontrol & LCD_CTRL_DUAL)
10401 + new_regs.LCDtiming1 =
10402 + LCD_TIMING1_VBP(var->upper_margin) +
10403 + LCD_TIMING1_VFP(var->lower_margin) +
10404 + LCD_TIMING1_VSW(var->vsync_len) +
10405 + LCD_TIMING1_LPP(yres);
10407 + new_regs.LCDtiming2 = fbi->LCDtiming2 |
10408 + LCD_TIMING2_CPL (480) | //(var->xres) |
10409 + LCD_TIMING2_PCD(pcd) |
10410 + (var->sync & FB_SYNC_HOR_HIGH_ACT ? 0 : LCD_TIMING2_IHS) |
10411 + (var->sync & FB_SYNC_VERT_HIGH_ACT ? 0 : LCD_TIMING2_IVS);
10413 + new_regs.LCDtiming3 = fbi->LCDtiming3;
10414 + new_regs.LCDICPsetup = fbi->LCDICPsetup | LCDICP_SETUP_PPL(var->xres);
10415 +#if defined(CONFIG_ARCH_LH7A400)
10416 + new_regs.LCDICPsetup |= LCDICP_SETUP_POWER;
10419 + new_regs.LCDICPcontrol = fbi->LCDICPcontrol;
10420 + new_regs.LCDICPtiming1 = fbi->LCDICPtiming1;
10421 + new_regs.LCDICPtiming2 = fbi->LCDICPtiming2;
10423 + DPRINTK("new LCDtiming0 = 0x%08x\n", (u32)new_regs.LCDtiming0);
10424 + DPRINTK("new LCDtiming1 = 0x%08x\n", (u32)new_regs.LCDtiming1);
10425 + DPRINTK("new LCDtiming2 = 0x%08x\n", (u32)new_regs.LCDtiming2);
10426 + DPRINTK("new LCDtiming3 = 0x%08x\n", (u32)new_regs.LCDtiming3);
10427 + DPRINTK("new LCDcontrol = 0x%08x\n", (u32)new_regs.LCDcontrol);
10428 + DPRINTK("new LCDICPsetup = 0x%08x\n", (u32)new_regs.LCDICPsetup);
10429 + DPRINTK("new LCDICPcontrol = 0x%08x\n", (u32)new_regs.LCDICPcontrol);
10430 + DPRINTK("new LCDICPtiming1 = 0x%08x\n", (u32)new_regs.LCDICPtiming1);
10431 + DPRINTK("new LCDICPtiming2 = 0x%08x\n", (u32)new_regs.LCDICPtiming2);
10434 + /* Update shadow copy atomically */
10435 + local_irq_save(flags);
10436 + fbi->upbase = fbi->screen_dma;
10438 + fbi->reg_LCDtiming0 = new_regs.LCDtiming0;
10439 + fbi->reg_LCDtiming1 = new_regs.LCDtiming1;
10440 + fbi->reg_LCDtiming2 = new_regs.LCDtiming2;
10441 + fbi->reg_LCDtiming3 = new_regs.LCDtiming3;
10442 + fbi->reg_LCDcontrol = new_regs.LCDcontrol;
10443 + fbi->reg_LCDICPsetup = new_regs.LCDICPsetup;
10444 + fbi->reg_LCDICPcontrol = new_regs.LCDICPcontrol;
10445 + fbi->reg_LCDICPtiming1 = new_regs.LCDICPtiming1;
10446 + fbi->reg_LCDICPtiming2 = new_regs.LCDICPtiming2;
10447 + local_irq_restore(flags);
10450 + * Only update the registers if the controller is enabled
10451 + * and something has changed.
10453 + if ((LCD->timing0 != fbi->reg_LCDtiming0) || (LCD->timing1 != fbi->reg_LCDtiming1) ||
10454 + (LCD->timing2 != fbi->reg_LCDtiming2) || (LCD->timing3 != fbi->reg_LCDtiming2) ||
10455 + (LCD->control != fbi->reg_LCDcontrol) || (LCDICP->setup != fbi->reg_LCDICPsetup) ||
10456 + (LCDICP->timing1 != fbi->reg_LCDICPtiming1) || (LCDICP->timing2 != fbi->reg_LCDICPtiming2) ||
10457 + (LCD->upbase != fbi->upbase) || (LCD->lpbase != fbi->lpbase))
10458 + pl110fb_schedule_task(fbi, C_REENABLE);
10464 + * NOTE! The following functions are purely helpers for set_ctrlr_state.
10465 + * Do not call them directly; set_ctrlr_state does the correct serialisation
10466 + * to ensure that things happen in the right way 100% of time time.
10471 +pl110fb_backlight_on(struct pl110fb_info *fbi)
10473 + DPRINTK("backlight on\n");
10475 +#ifdef CONFIG_ARCH_LH79520
10476 + if( machine_is_lh79520evb()) {
10477 + //cpldRegs_t *cpld = (cpldRegs_t *)CPLD_BASE;
10478 + GPOUT16 |= BACKLIGHT;
10480 + //cpld->lcd_pwr_cntl |= CPLD_BACKLIGHT_ON;
10484 +#ifdef CONFIG_ARCH_LH7A400
10485 + if( machine_is_lh7a400evb()) {
10486 + cpldRegs_t *cpld = (cpldRegs_t *)CPLD_BASE;
10488 + cpld->lcd_pwr_cntl |= CPLD_BACKLIGHT_ON;
10494 +pl110fb_backlight_off(struct pl110fb_info *fbi)
10496 + DPRINTK("backlight off\n");
10498 +#ifdef CONFIG_ARCH_LH79520
10499 + if( machine_is_lh79520evb()) {
10500 + //cpldRegs_t *cpld = (cpldRegs_t *)CPLD_BASE;
10501 + GPOUT16 &= ~BACKLIGHT;
10502 + //cpld->lcd_pwr_cntl &= ~CPLD_BACKLIGHT_ON;
10505 +#ifdef CONFIG_ARCH_LH7A400
10506 + if( machine_is_lh7a400evb()) {
10507 + cpldRegs_t *cpld = (cpldRegs_t *)CPLD_BASE;
10509 + cpld->lcd_pwr_cntl &= ~CPLD_BACKLIGHT_ON;
10515 +pl110fb_power_up_lcd(struct pl110fb_info *fbi)
10517 + DPRINTK("LCD power on\n");
10519 +#ifdef CONFIG_ARCH_LH79520
10520 + if( machine_is_lh79520evb()) {
10521 + cpldRegs_t *cpld = (cpldRegs_t *)CPLD_BASE;
10523 + cpld->lcd_pwr_cntl |= CPLD_LCDP_EN;
10526 +#ifdef CONFIG_ARCH_LH7A400
10527 + if( machine_is_lh7a400evb()) {
10528 + cpldRegs_t *cpld = (cpldRegs_t *)CPLD_BASE;
10530 + cpld->lcd_pwr_cntl |= CPLD_LCDP_EN;
10536 +pl110fb_power_down_lcd(struct pl110fb_info *fbi)
10538 + DPRINTK("LCD power off\n");
10539 +#ifdef CONFIG_ARCH_LH79520
10540 + if( machine_is_lh79520evb()) {
10541 + cpldRegs_t *cpld = (cpldRegs_t *)CPLD_BASE;
10543 + cpld->lcd_pwr_cntl &= ~CPLD_LCDP_EN;
10546 +#ifdef CONFIG_ARCH_LH7A400
10547 + if( machine_is_lh7a400evb()) {
10548 + cpldRegs_t *cpld = (cpldRegs_t *)CPLD_BASE;
10550 + cpld->lcd_pwr_cntl &= ~CPLD_LCDP_EN;
10557 +pl110fb_setup_hw(struct pl110fb_info *fbi)
10559 +#ifdef CONFIG_ARCH_LH79520
10560 + rcpcRegs_t *rcpc = (rcpcRegs_t *)IO_ADDRESS( RCPC_PHYS);
10561 + ioconRegs_t *iocon = (ioconRegs_t *)IO_ADDRESS( IOCON_PHYS);
10563 + rcpc->control |= RCPC_CTRL_WRTLOCK_ENABLED; /* unlock RCPC registers */
10567 + * use HCLK for the LCD clock.
10569 + rcpc->spareClkCtrl &= ~RCPC_SPARE_CLKCTRL_LCDCLK_DISABLE; /* enable LCDCLK */
10570 + rcpc->spareClkSel &= ~RCPC_SCLKSEL_LCDCLK; /* LCDCLK from HCLK */
10571 + rcpc->spare0Prescale &= 0;
10572 + rcpc->AHBClkCtrl &= ~RCPC_CLKCTRL_DMAC_DISABLE; /* ensure DMA gets a clock */
10573 + rcpc->control &= ~RCPC_CTRL_WRTLOCK_ENABLED; /* lock RCPC registers */
10575 + /* set the pin mux to enable all required LCD signals and disable the rest */
10579 +// | LCDMUX_CLXCLK
10580 +// | LCDMUX_CLSPL /* SPL */
10581 +// | LCDMUX_CLS /* CLS */
10582 + | LCDMUX_PIOC2 /* don't need external LCD clock */
10583 + | LCDMUX_CLCP /* DCLK */
10584 + | LCDMUX_CLLP /* LP */
10596 + | LCDMUX_CLD2 /* red[1] */
10597 + | LCDMUX_CLD3 /* red[2] */
10598 + | LCDMUX_CLD4 /* red[3] */
10599 + | LCDMUX_CLD5 /* red[4] */
10600 + | LCDMUX_CLD7 /* green[0] */
10601 + | LCDMUX_CLD6; /* green[1] */
10603 +// iocon->LCDMux = LCDMUX_CLREV
10604 +// | LCDMUX_CLXCLK
10605 +// | LCDMUX_CLD13 /* blue[0] */
10606 +// | LCDMUX_CLD14 /* blue[1] */
10607 +// | LCDMUX_CLD15 /* blue[2] */
10608 +// | LCDMUX_CLD16 /* blue[3] */
10609 +// | LCDMUX_CLD17 /* blue[4] */
10610 +// | LCDMUX_CLSPL /* SPL */
10611 +// | LCDMUX_CLS /* CLS */
10612 +// | LCDMUX_PIOC2 /* don't need external LCD clock */
10613 +// | LCDMUX_CLCP /* DCLK */
10614 +// | LCDMUX_CLP /* LP */
10615 +// | LCDMUX_CLSPS /* SPS */
10616 +// | LCDMUX_CLD2 /* red[1] */
10617 +// | LCDMUX_CLD3 /* red[2] */
10618 +// | LCDMUX_CLD4 /* red[3] */
10619 +// | LCDMUX_CLD5 /* red[4] */
10620 +// | LCDMUX_CPS /* PS */
10621 +// | LCDMUX_CLD7 /* green[0] */
10622 +// | LCDMUX_CLD8 /* green[1] */
10623 +// | LCDMUX_CLD9 /* green[2] */
10624 +// | LCDMUX_CLD10 /* green[3] */
10625 +// | LCDMUX_CLD11; /* green[4] */
10627 + DPRINTK( "IOCON->LCDMux=%x\n", iocon->LCDMux);
10629 +#ifdef CONFIG_ARCH_LH7A400
10630 + gpioRegs_t *gpio = (gpioRegs_t *)IO_ADDRESS(GPIO_PHYS);
10632 + gpio->pinmux |= (GPIO_PINMUX_PEOCON | GPIO_PINMUX_PDOCON); /* route LCD data bits */
10634 + DPRINTK( "gpio: pinmux=%x pdddr=0x%x peddr=0x%x\n",
10635 + gpio->pinmux, gpio->pdddr, gpio->peddr); // DDD
10640 +pl110fb_enable_controller(struct pl110fb_info *fbi)
10642 + lcdRegs_t *LCD = (lcdRegs_t *)IO_ADDRESS(LCD_PHYS);
10643 + lcdicpRegs_t *LCDICP = (lcdicpRegs_t *)IO_ADDRESS(LCDICP_PHYS);
10645 +#if defined(CONFIG_ARCH_LH79520) || defined(CONFIG_ARCH_LH7A400)
10646 + cpldRegs_t *cpld = (cpldRegs_t *)CPLD_BASE;
10648 + DPRINTK("Enabling LCD controller\n");
10650 + LCDICP->control = fbi->reg_LCDICPcontrol;
10651 + LCDICP->setup = fbi->reg_LCDICPsetup;
10652 + LCDICP->timing1 = fbi->reg_LCDICPtiming1;
10653 + LCDICP->timing2 = fbi->reg_LCDICPtiming2;
10654 + LCD->timing0 = fbi->reg_LCDtiming0;
10655 + LCD->timing1 = fbi->reg_LCDtiming1;
10656 + LCD->timing2 = fbi->reg_LCDtiming2;
10657 + LCD->timing3 = fbi->reg_LCDtiming3;
10658 + LCD->upbase = fbi->upbase;
10659 +#if defined(CONFIG_ARCH_LH7A400)
10660 + LCD->lpoverflow = fbi->upbase;
10662 + LCD->intrEnable = 0;
10663 + LCD->control = fbi->reg_LCDcontrol;
10666 + * enable lcd output
10668 +#if defined(CONFIG_ARCH_LH79520) || defined(CONFIG_ARCH_LH7A400)
10669 + cpld->lcd_pwr_cntl |= CPLD_LCD_OE;
10672 + set_current_state(TASK_UNINTERRUPTIBLE);
10673 + schedule_timeout(20 * HZ / 1000);
10675 + LCD->control |= LCD_CTRL_PWR;
10678 +#if defined(CONFIG_ARCH_LH7A400)
10679 + DPRINTK("real LCDoverflow = %p\n", (void *)LCD->lpoverflow);
10681 + DPRINTK("real LCDupbase = %p\n", (void *)LCD->upbase);
10682 + DPRINTK("real LCDlpbase = %p\n", (void *)LCD->lpbase);
10683 + DPRINTK("real LCDtiming0 = 0x%08x\n", LCD->timing0);
10684 + DPRINTK("real LCDtiming1 = 0x%08x\n", LCD->timing1);
10685 + DPRINTK("real LCDtiming2 = 0x%08x\n", LCD->timing2);
10686 + DPRINTK("real LCDtiming3 = 0x%08x\n", LCD->timing3);
10687 + DPRINTK("real LCDcontrol = 0x%08x\n", LCD->control);
10688 + DPRINTK("real LCDICPsetup = 0x%08x\n", LCDICP->setup);
10689 + DPRINTK("real LCDICPcontrol = 0x%08x\n", LCDICP->control);
10690 + DPRINTK("real LCDICPtiming1 = 0x%08x\n", LCDICP->timing1);
10691 + DPRINTK("real LCDICPtiming2 = 0x%08x\n", LCDICP->timing2);
10696 +pl110fb_disable_controller(struct pl110fb_info *fbi)
10698 + lcdRegs_t *LCD = (lcdRegs_t *)IO_ADDRESS(LCD_PHYS);
10699 + lcdicpRegs_t *LCDICP = (lcdicpRegs_t *)IO_ADDRESS(LCDICP_PHYS);
10701 +#if defined(CONFIG_ARCH_LH79520) || defined(CONFIG_ARCH_LH7A400)
10702 + cpldRegs_t *cpld = (cpldRegs_t *)CPLD_BASE;
10705 + DECLARE_WAITQUEUE(wait, current);
10707 + DPRINTK("Disabling LCD controller\n");
10709 + add_wait_queue(&fbi->ctrlr_wait, &wait);
10710 + set_current_state(TASK_UNINTERRUPTIBLE);
10712 + LCD->intrEnable |= LCD_STATUS_VCOMP; /* allow VCOMP interrupts */
10714 + /* turn off LCD power, wait a bit, then disable the controller */
10715 + LCD->control &= ~LCD_CTRL_PWR;
10717 + set_current_state(TASK_UNINTERRUPTIBLE);
10718 + schedule_timeout(20 * HZ / 1000);
10720 + LCD->control = 0;
10721 + LCDICP->control = 0;
10723 +#if defined(CONFIG_ARCH_LH79520) || defined(CONFIG_ARCH_LH7A400)
10724 + cpld->lcd_pwr_cntl &= ~CPLD_LCD_OE;
10727 + schedule_timeout(20 * HZ / 1000);
10728 + current->state = TASK_RUNNING;
10729 + remove_wait_queue(&fbi->ctrlr_wait, &wait);
10734 + * pl110fb_handle_irq: Handle 'LCD DONE' interrupts.
10737 +pl110fb_handle_irq(int irq, void *dev_id, struct pt_regs *regs)
10739 + struct pl110fb_info *fbi = dev_id;
10740 + lcdRegs_t *LCD = (lcdRegs_t *)IO_ADDRESS(LCD_PHYS);
10742 + unsigned int intr = LCD->maskedIntrStatus;
10744 + DPRINTK("IRQ: status=0x%x\n", intr);
10746 + if( intr & LCD_STATUS_VCOMP) { /* vertical compare interrupt */
10747 + LCD->intrEnable = 0; /* only want one interrupt */
10748 + wake_up(&fbi->ctrlr_wait);
10751 + LCD->rawIntrStatus = 0; /* clear interrupt */
10755 + * This function must be called from task context only, since it will
10756 + * sleep when disabling the LCD controller, or if we get two contending
10757 + * processes trying to alter state.
10760 +set_ctrlr_state(struct pl110fb_info *fbi, u_int state)
10764 + down(&fbi->ctrlr_sem);
10766 + old_state = fbi->state;
10769 + case C_DISABLE_CLKCHANGE:
10771 + * Disable controller for clock change. If the
10772 + * controller is already disabled, then do nothing.
10774 + if (old_state != C_DISABLE && old_state != C_DISABLE_PM) {
10775 + fbi->state = state;
10776 + pl110fb_disable_controller(fbi);
10780 + case C_DISABLE_PM:
10783 + * Disable controller
10785 + if (old_state != C_DISABLE) {
10786 + fbi->state = state;
10788 + pl110fb_backlight_off(fbi);
10789 + if (old_state != C_DISABLE_CLKCHANGE)
10790 + pl110fb_disable_controller(fbi);
10791 + pl110fb_power_down_lcd(fbi);
10795 + case C_ENABLE_CLKCHANGE:
10797 + * Enable the controller after clock change. Only
10798 + * do this if we were disabled for the clock change.
10800 + if (old_state == C_DISABLE_CLKCHANGE) {
10801 + fbi->state = C_ENABLE;
10802 + pl110fb_enable_controller(fbi);
10808 + * Re-enable the controller only if it was already
10809 + * enabled. This is so we reprogram the control
10812 + if (old_state == C_ENABLE) {
10813 + pl110fb_disable_controller(fbi);
10814 + pl110fb_setup_hw(fbi);
10815 + pl110fb_enable_controller(fbi);
10819 + case C_ENABLE_PM:
10821 + * Re-enable the controller after PM. This is not
10822 + * perfect - think about the case where we were doing
10823 + * a clock change, and we suspended half-way through.
10825 + if (old_state != C_DISABLE_PM)
10827 + /* fall through */
10831 + * Power up the LCD screen, enable controller, and
10832 + * turn on the backlight.
10834 + if (old_state != C_ENABLE) {
10835 + fbi->state = C_ENABLE;
10836 + pl110fb_setup_hw(fbi);
10837 + pl110fb_power_up_lcd(fbi);
10838 + pl110fb_enable_controller(fbi);
10839 + pl110fb_backlight_on(fbi);
10843 + up(&fbi->ctrlr_sem);
10848 + * Our LCD controller task (which is called when we blank or unblank)
10852 +pl110fb_task(void *dummy)
10854 + struct pl110fb_info *fbi = dummy;
10855 + u_int state = xchg(&fbi->task_state, -1);
10857 + set_ctrlr_state(fbi, state);
10860 +#ifdef CONFIG_CPU_FREQ
10862 + * Calculate the minimum DMA period over all displays that we own.
10863 + * This, together with the SDRAM bandwidth defines the slowest CPU
10864 + * frequency that can be selected.
10866 +static unsigned int
10867 +pl110fb_min_dma_period(struct pl110fb_info *fbi)
10869 + unsigned int min_period = (unsigned int)-1;
10872 + for (i = 0; i < MAX_NR_CONSOLES; i++) {
10873 + unsigned int period;
10876 + * Do we own this display?
10878 + if (fb_display[i].fb_info != &fbi->fb)
10882 + * Ok, calculate its DMA period
10884 + period = pl110fb_display_dma_period(get_con_var(&fbi->fb, i));
10885 + if (period < min_period)
10886 + min_period = period;
10889 + return min_period;
10893 + * CPU clock speed change handler. We need to adjust the LCD timing
10894 + * parameters when the CPU clock is adjusted by the power management
10898 +pl110fb_clkchg_notifier(struct notifier_block *nb, unsigned long val,
10901 + struct pl110fb_info *fbi = TO_INF(nb, clockchg);
10902 + struct cpufreq_minmax *mm = data;
10906 + case CPUFREQ_MINMAX:
10907 + printk(KERN_DEBUG "min dma period: %d ps, old clock %d kHz, "
10908 + "new clock %d kHz\n", pl110fb_min_dma_period(fbi),
10909 + mm->cur_freq, mm->new_freq);
10910 + /* todo: fill in min/max values */
10913 + case CPUFREQ_PRECHANGE:
10914 + set_ctrlr_state(fbi, C_DISABLE_CLKCHANGE);
10917 + case CPUFREQ_POSTCHANGE:
10918 + pcd = get_pcd(fbi->fb.var.pixclock);
10919 + fbi->reg_lccr3 = (fbi->reg_lccr3 & ~0xff) | LCCR3_PixClkDiv(pcd); // DDD
10920 + set_ctrlr_state(fbi, C_ENABLE_CLKCHANGE);
10929 + * Power management hook. Note that we won't be called from IRQ context,
10930 + * unlike the blank functions above, so we may sleep.
10933 +pl110fb_pm_callback(struct pm_dev *pm_dev, pm_request_t req, void *data)
10935 + struct pl110fb_info *fbi = pm_dev->data;
10937 + DPRINTK("pm_callback: %d\n", req);
10939 + if (req == PM_SUSPEND || req == PM_RESUME) {
10940 + int state = (int)data;
10942 + if (state == 0) {
10944 + set_ctrlr_state(fbi, C_ENABLE_PM);
10946 + /* Enter D1-D3. Disable the LCD controller. */
10947 + set_ctrlr_state(fbi, C_DISABLE_PM);
10950 + DPRINTK("done\n");
10956 + * pl110fb_map_video_memory():
10957 + * Allocates the DRAM memory for the frame buffer. This buffer is
10958 + * remapped into a non-cached, non-buffered, memory region to
10959 + * allow palette and pixel writes to occur without flushing the
10960 + * cache. Once this area is remapped, all virtual memory
10961 + * access to the video memory should occur at the new region.
10964 +pl110fb_map_video_memory(struct pl110fb_info *fbi)
10967 + * We reserve one page for the palette, plus the size
10968 + * of the framebuffer.
10970 + fbi->map_size = PAGE_ALIGN(fbi->fb.fix.smem_len);
10971 + fbi->map_cpu = consistent_alloc(GFP_KERNEL, fbi->map_size,
10974 + if (fbi->map_cpu) {
10975 + fbi->screen_cpu = fbi->map_cpu;
10976 + fbi->screen_dma = fbi->map_dma;
10977 + fbi->fb.fix.smem_start = fbi->screen_dma;
10980 + DPRINTK( "fix.smem_len = %d map_cpu = 0x%x screen_cpu = 0x%x screen_dma = 0x%x\n",
10981 + fbi->fb.fix.smem_len, fbi->map_cpu, fbi->screen_cpu, fbi->screen_dma);
10983 + return fbi->map_cpu ? 0 : -ENOMEM;
10986 +/* Fake monspecs to fill in fbinfo structure */
10987 +static struct fb_monspecs monspecs __initdata = {
10988 + 30000, 70000, 50, 65, 0 /* Generic */
10992 +static struct pl110fb_info * __init
10993 +pl110fb_init_fbinfo(void)
10995 + struct pl110fb_mach_info *inf;
10996 + struct pl110fb_info *fbi;
10997 + int pixelsPerSecond;
10999 + fbi = kmalloc(sizeof(struct pl110fb_info) + sizeof(struct display) +
11000 + sizeof(u16) * 16, GFP_KERNEL);
11004 + memset(fbi, 0, sizeof(struct pl110fb_info) + sizeof(struct display));
11006 + fbi->currcon = -1;
11008 + strcpy(fbi->fb.fix.id, PL110_NAME);
11010 + fbi->fb.fix.type = FB_TYPE_PACKED_PIXELS;
11011 + fbi->fb.fix.type_aux = 0;
11012 + fbi->fb.fix.xpanstep = 0;
11013 + fbi->fb.fix.ypanstep = 0;
11014 + fbi->fb.fix.ywrapstep = 0;
11015 + fbi->fb.fix.accel = FB_ACCEL_NONE;
11017 + fbi->fb.var.nonstd = 0;
11018 + fbi->fb.var.activate = FB_ACTIVATE_NOW;
11019 + fbi->fb.var.height = -1;
11020 + fbi->fb.var.width = -1;
11021 + fbi->fb.var.accel_flags = 0;
11022 + fbi->fb.var.vmode = FB_VMODE_NONINTERLACED;
11024 + strcpy(fbi->fb.modename, PL110_NAME);
11025 + strcpy(fbi->fb.fontname, "Acorn8x8");
11027 + fbi->fb.fbops = &pl110fb_ops;
11028 + fbi->fb.changevar = NULL;
11029 + fbi->fb.switch_con = pl110fb_switch;
11030 + fbi->fb.updatevar = pl110fb_updatevar;
11031 + fbi->fb.blank = pl110fb_blank;
11032 + fbi->fb.flags = FBINFO_FLAG_DEFAULT;
11033 + fbi->fb.node = -1;
11034 + fbi->fb.monspecs = monspecs;
11035 + fbi->fb.disp = (struct display *)(fbi + 1);
11036 + fbi->fb.pseudo_palette = (void *)(fbi->fb.disp + 1);
11038 + fbi->rgb[RGB_8] = &rgb_8;
11039 + fbi->rgb[RGB_16] = &def_rgb_16;
11041 + inf = pl110fb_get_machine_info(fbi);
11044 + * Calculate pixclock. pixclock is the time in picoseconds spent
11045 + * drawing a pixel. The time (in seconds) to draw a pixel is
11046 + * the inverse of how many pixels we draw in a second (pixelsPerSecond).
11048 + * pixelsPerSecond is xres*yres*refresh, plus all the overhead time
11049 + * (horizontal and vertical front and back porches, plus horizontal
11050 + * and vertical sync lengths).
11054 + pixelsPerSecond =
11055 + (inf->xres + inf->hsync_len + inf->left_margin + inf->right_margin) *
11056 + (inf->yres + inf->vsync_len + inf->upper_margin + inf->lower_margin) *
11057 + VERTICAL_REFRESH;
11059 + inf->pixclock = 1000000000 / (pixelsPerSecond / 1000);
11061 + DPRINTK( "pixelsPerSecond=%d pixclock=%d\n", pixelsPerSecond, inf->pixclock);
11064 + fbi->max_xres = inf->xres;
11065 + fbi->fb.var.xres = inf->xres;
11066 + fbi->fb.var.xres_virtual = inf->xres;
11067 + fbi->max_yres = inf->yres;
11068 + fbi->fb.var.yres = inf->yres;
11069 + fbi->fb.var.yres_virtual = inf->yres;
11070 + fbi->max_bpp = inf->bpp;
11071 + fbi->fb.var.bits_per_pixel = inf->bpp;
11072 + fbi->fb.var.pixclock = inf->pixclock;
11073 + fbi->fb.var.hsync_len = inf->hsync_len;
11074 + fbi->fb.var.left_margin = inf->left_margin;
11075 + fbi->fb.var.right_margin = inf->right_margin;
11076 + fbi->fb.var.vsync_len = inf->vsync_len;
11077 + fbi->fb.var.upper_margin = inf->upper_margin;
11078 + fbi->fb.var.lower_margin = inf->lower_margin;
11079 + fbi->fb.var.sync = inf->sync;
11080 + fbi->fb.var.grayscale = inf->cmap_greyscale;
11081 + fbi->cmap_inverse = inf->cmap_inverse;
11082 + fbi->cmap_static = inf->cmap_static;
11083 + fbi->LCDtiming2 = inf->LCDtiming2;
11084 + fbi->LCDtiming3 = inf->LCDtiming3;
11085 + fbi->LCDcontrol = inf->LCDcontrol;
11086 + fbi->LCDICPsetup = inf->LCDICPsetup;
11087 + fbi->LCDICPcontrol = inf->LCDICPcontrol;
11088 + fbi->LCDICPtiming1 = inf->LCDICPtiming1;
11089 + fbi->LCDICPtiming2 = inf->LCDICPtiming2;
11090 + fbi->state = C_DISABLE;
11091 + fbi->task_state = (u_char)-1;
11092 + fbi->fb.fix.smem_len = fbi->max_xres * fbi->max_yres *
11093 + fbi->max_bpp / 8;
11095 + init_waitqueue_head(&fbi->ctrlr_wait);
11096 + INIT_TQUEUE(&fbi->task, pl110fb_task, fbi);
11097 + init_MUTEX(&fbi->ctrlr_sem);
11103 +pl110fb_init(void)
11105 + struct pl110fb_info *fbi;
11108 + DPRINTK( "\n\npl110fb_init\n");
11110 + DPRINTK( "cpu clock = %d HCLK = %d\n", cpufreq_get(0), hclkfreq_get());
11112 + fbi = pl110fb_init_fbinfo();
11117 + /* Initialize video memory */
11118 + ret = pl110fb_map_video_memory(fbi);
11122 + ret = request_irq(IRQ_LCD, pl110fb_handle_irq, SA_INTERRUPT,
11123 + fbi->fb.fix.id, fbi);
11125 + printk(KERN_ERR "pl110fb: request_irq failed: ret=%d\n", ret);
11129 + pl110fb_set_var(&fbi->fb.var, -1, &fbi->fb);
11131 + ret = register_framebuffer(&fbi->fb);
11137 + * Note that the console registers this as well, but we want to
11138 + * power down the display prior to sleeping.
11140 + fbi->pm = pm_register(PM_SYS_DEV, PM_SYS_VGA, pl110fb_pm_callback);
11142 + fbi->pm->data = fbi;
11144 +#ifdef CONFIG_CPU_FREQ
11145 + fbi->clockchg.notifier_call = pl110fb_clkchg_notifier;
11146 + cpufreq_register_notifier(&fbi->clockchg);
11150 + * Ok, now enable the LCD controller
11152 + set_ctrlr_state(fbi, C_ENABLE);
11154 + /* This driver cannot be unloaded at the moment */
11155 + MOD_INC_USE_COUNT;
11166 +pl110fb_setup(char *options)
11171 +MODULE_DESCRIPTION("ARM PL110 framebuffer driver");
11172 +MODULE_LICENSE("GPL");
11174 diff -urN linux-2.4.26/drivers/video/pl110fb.h linux-2.4.26-vrs1-lnode80/drivers/video/pl110fb.h
11175 --- linux-2.4.26/drivers/video/pl110fb.h 1969-12-31 20:00:00.000000000 -0400
11176 +++ linux-2.4.26-vrs1-lnode80/drivers/video/pl110fb.h 2005-11-02 17:37:32.000000000 -0400
11179 + * linux/drivers/video/pl110fb.h
11180 + * -- ARM PrimeCell PL110 LCD controller frame buffer device
11182 + * Copyright (C) 2002 Lineo, Inc.
11184 + * Portions Copyright (C) 2001 Sharp Microelectronics of the Americas, Inc.
11187 + * based in part on sa1100fb.h, which is Copyright (C) Eric A. Thomas
11189 + * This file is subject to the terms and conditions of the GNU General Public
11190 + * License. See the file COPYING in the main directory of this archive
11191 + * for more details.
11195 + * Color LCD Controller registers
11198 + volatile u32 timing0; /* Horizontal axis panel control */
11199 + volatile u32 timing1; /* Vertical axis panel control */
11200 + volatile u32 timing2; /* clock and signal polarity control */
11201 + volatile u32 timing3; /* line end control */
11202 + volatile dma_addr_t upbase; /* upper panel frame base address */
11203 + volatile dma_addr_t lpbase; /* lower panel frame base address */
11204 + volatile u32 intrEnable; /* interrupt enable mask */
11205 + volatile u32 control; /* LCD panel pixel parameters */
11206 + volatile u32 rawIntrStatus; /* raw interrupt status */
11207 + volatile u32 maskedIntrStatus; /* masked interrupt status */
11208 + volatile dma_addr_t upcurr; /* upper panel current address */
11209 + volatile dma_addr_t lpcurr; /* lower panel current address */
11210 + volatile dma_addr_t lpoverflow; /* SDRAM fb base */
11211 + volatile u32 reservedcc[115]; /* reserved */
11212 + volatile u32 palette[128]; /* 256 x 16-bit color palette */
11217 + * LCDTiming0 Register Bit Field constants
11219 + * NOTE: Ensure the argument to the following macros is greater
11222 +#define LCD_TIMING0_HBP(n) _SBF(24,((n)-1)) /* Horiz Back Porch */
11223 +#define LCD_TIMING0_HFP(n) _SBF(16,((n)-1)) /* Horiz Front Porch */
11224 +#define LCD_TIMING0_HSW(n) _SBF(8,((n)-1)) /* Horiz sync Pulse Width */
11225 +#define LCD_TIMING0_PPL(n) _SBF(2,((((n)/16)-1)&0x3F)) /* Pixels per line */
11228 + * LCDTiming1 Register Bit Field constants
11230 + * NOTE: Ensure the argument to the following macros is greater
11233 +#define LCD_TIMING1_VBP(n) _SBF(24,(n)) /* Vertical Back Porch */
11234 +#define LCD_TIMING1_VFP(n) _SBF(16,(n)) /* Vertical Front Porch */
11235 +#define LCD_TIMING1_VSW(n) _SBF(10,(n)) /* Vertical Synchronization Pulse */
11236 +#define LCD_TIMING1_LPP(n) _SBF(0,((n)-1)) /* Lines per Panel */
11239 + * LCDTiming2 Register Bit Field constants
11241 + * NOTE: Ensure the argument to the following macros is greater
11244 +#define LCD_TIMING2_BCD _BIT(26) /* Bypass Pixel Clock Divider */
11245 +#define LCD_TIMING2_CPL(n) _SBF(16,((n)-1)&0x3FF) /* Clocks Per Line */
11246 +#define LCD_TIMING2_IOE _BIT(14) /* Invert Output Enable */
11247 +#define LCD_TIMING2_IPC _BIT(13) /* Invert Panel Clock */
11248 +#define LCD_TIMING2_IHS _BIT(12) /* Invert Horizontal Synchronization */
11249 + /* set == HSYNC is active low */
11250 +#define LCD_TIMING2_IVS _BIT(11) /* Invert Vertical Synchronization */
11251 + /* set == VSYNC is active low */
11252 +#define LCD_TIMING2_ACB(n) _SBF(6,((n)-1)) /* AC Bias Pin Frequency */
11253 +#define LCD_TIMING2_CLKSEL _BIT(5) /* Clock Selector */
11254 +#define LCD_TIMING2_PCD(n) _SBF(0,((n)-2)) /* Panel Clock Divisor */
11258 + * LCDTiming3 Register Bit Field constants
11260 + * NOTE: Ensure the argument to the following macros is greater
11263 +#define LCD_TIMING3_LEE _BIT(16) /* Line End Enable */
11264 +#define LCD_TIMING3_LED(n) _SBF(0,((n)-1)) /* Line End Signal Delay */
11268 + * intrEnable, rawIntrStatus, maskedIntrStatus bit field positions
11270 +#define LCD_STATUS_MBERROR _BIT(4) /* Master Bus Error */
11271 +#define LCD_STATUS_VCOMP _BIT(3) /* Vertical Compare */
11272 +#define LCD_STATUS_LNBU _BIT(2) /* LCD Next addr. Base Update*/
11273 +#define LCD_STATUS_FUF _BIT(1) /* FIFO underflow */
11277 + * Control Register Bit Field constants
11279 +#define LCD_CTRL_WATERMARK _BIT(16) /* LCD DMA FIFO Watermark Level */
11280 +#define LCD_CTRL_LDMAFIFOTME _BIT(15) /* LCD DMA FIFO Test Mode Enable */
11282 +#define LCD_CTRL_VCOMP(n) _SBF(12,((n)&0x3)) /* Generate interrupt at: */
11283 +#define LCD_CTRL_VCOMP_SVS _SBF(12,0) /* start of vertical sync */
11284 +#define LCD_CTRL_VCOMP_SBP _SBF(12,1) /* start of back porch */
11285 +#define LCD_CTRL_VCOMP_SAV _SBF(12,2) /* start of active video */
11286 +#define LCD_CTRL_VCOMP_SFP _SBF(12,3) /* start of front porch */
11288 +#define LCD_CTRL_PWR _BIT(11) /* LCD Power Enable */
11289 +#define LCD_CTRL_BEPO _BIT(10) /* Big Endian Pixel Order */
11290 +#define LCD_CTRL_BEBO _BIT(9) /* Big Endian Byte Order */
11291 +#define LCD_CTRL_BGR _BIT(8) /* Swap Red and Blue (RGB to BGR) */
11292 +#define LCD_CTRL_DUAL _BIT(7) /* Dual Panel STN */
11293 +#define LCD_CTRL_MON8 _BIT(6) /* Monochrome LCD has 8-bit interface */
11294 +#define LCD_CTRL_TFT _BIT(5) /* TFT LCD */
11296 +#define LCD_CTRL_BW_COLOR _SBF(4,0) /* STN LCD is Color */
11297 +#define LCD_CTRL_BW_MONO _SBF(4,1) /* STN LCD is Monochrome */
11299 +#define LCD_CTRL_BPP1 _SBF(1,0) /* Bits per pixel */
11300 +#define LCD_CTRL_BPP2 _SBF(1,1)
11301 +#define LCD_CTRL_BPP4 _SBF(1,2)
11302 +#define LCD_CTRL_BPP8 _SBF(1,3)
11303 +#define LCD_CTRL_BPP16 _SBF(1,4)
11304 +#define LCD_CTRL_BPP24 _SBF(1,5)
11306 +#define LCD_CTRL_ENABLE _BIT(0) /* LCD Controller Enable */
11311 + volatile u32 setup; /* Setup */
11312 + volatile u32 control; /* Control */
11313 + volatile u32 timing1; /* HR-TFT Timing 1 */
11314 + volatile u32 timing2; /* HR-TFT Timing 2 */
11320 + * LCDICP Setup Register Bit Fields
11322 + * NOTE: Ensure the argument to the following macros is greater
11325 +#define LCDICP_SETUP_MODE_BYPASS _SBF(0,0)
11326 +#define LCDICP_SETUP_MODE_HRTFT _SBF(0,1)
11327 +#define LCDICP_SETUP_MODE_DMTN _SBF(0,2)
11328 +#define LCDICP_SETUP_HORIZ_REVERSE _SBF(2,0)
11329 +#define LCDICP_SETUP_HORIZ_NORMAL _SBF(2,1)
11330 +#define LCDICP_SETUP_VERT_REVERSE _SBF(3,0)
11331 +#define LCDICP_SETUP_VERT_NORMAL _SBF(3,1)
11332 +/* Calculates bit field value from actual pixels per line */
11333 +#define LCDICP_SETUP_PPL(n) _SBF(4,((n)-1))
11334 +#define LCDICP_SETUP_POWER _BIT(13) /* lh7a400 only */
11338 + * LCDICP Control Register Bit Fields
11340 +#define LCDICP_CONTROL_SPSEN _BIT(0)
11341 +#define LCDICP_CONTROL_CLSEN _BIT(1)
11342 +#define LCDICP_CONTROL_UBLEN _BIT(2)
11343 +#define LCDICP_CONTROL_DISP _BIT(3)
11344 +#define LCDICP_CONTROL_EN0 _BIT(4)
11345 +#define LCDICP_CONTROL_EN1 _BIT(5)
11346 +#define LCDICP_CONTROL_EN2 _BIT(6)
11347 +#define LCDICP_CONTROL_EN3 _BIT(7)
11351 + * LCDICP Timing 1 Register Bit Fields
11353 + * NOTE: Ensure the argument to the following macros is greater
11356 +#define LCDICP_TIMING1_LPDEL(n) _SBF(0,((n)-1)&0xF)
11357 +#define LCDICP_TIMING1_REVDEL(n) _SBF(4,((n)-1)&0xF)
11358 +#define LCDICP_TIMING1_PSDEL(n) _SBF(8,((n)-1)&0xF)
11359 +#define LCDICP_TIMING1_CLSDEL(n) _SBF(8,((n)-1)&0xF)
11363 + * LCDICP Timing 2 Register Bit Fields
11365 + * NOTE: Ensure the argument to the following macros is greater
11368 +#define LCDICP_TIMING2_PSDEL2(n) _SBF(0,((n)-1)&0x1FF)
11369 +#define LCDICP_TIMING2_CLSDEL2(n) _SBF(0,((n)-1)&0x1FF)
11370 +#define LCDICP_TIMING2_SPLVALUE(n) _SBF(9,((n)-1)&0x7F)
11374 + * These are the bitfields for each
11375 + * display depth that we support.
11377 +struct pl110fb_rgb {
11378 + struct fb_bitfield red;
11379 + struct fb_bitfield green;
11380 + struct fb_bitfield blue;
11381 + struct fb_bitfield transp;
11385 + * This structure describes the machine which we are running on.
11387 +struct pl110fb_mach_info {
11394 + u_char hsync_len; /* horiz sync pulse width */
11395 + u_char left_margin; /* horiz back porch */
11396 + u_char right_margin; /* horiz front porch */
11398 + u_char vsync_len; /* vertical sync pulse width */
11399 + u_char upper_margin; /* vertical back porch */
11400 + u_char lower_margin; /* vertical front porch */
11403 + u_int cmap_greyscale:1,
11408 + u_long LCDtiming2;
11409 + u_long LCDtiming3;
11410 + u_long LCDcontrol;
11411 + u_long LCDICPsetup;
11412 + u_long LCDICPcontrol;
11413 + u_long LCDICPtiming1;
11414 + u_long LCDICPtiming2;
11418 +/* Shadows for LCD/LCDICP controller registers */
11419 +struct pl110fb_lcd_reg {
11420 + u_long LCDtiming0;
11421 + u_long LCDtiming1;
11422 + u_long LCDtiming2;
11423 + u_long LCDtiming3;
11424 + u_long LCDcontrol;
11425 + u_long LCDICPsetup;
11426 + u_long LCDICPcontrol;
11427 + u_long LCDICPtiming1;
11428 + u_long LCDICPtiming2;
11432 +#define RGB_16 (1)
11435 +struct pl110fb_info {
11436 + struct fb_info fb;
11437 + signed int currcon;
11439 + struct pl110fb_rgb *rgb[NR_RGB];
11446 + * These are the addresses we mapped
11447 + * the framebuffer memory region to.
11449 + dma_addr_t map_dma;
11450 + u_char * map_cpu;
11453 + u_char * screen_cpu;
11454 + dma_addr_t screen_dma;
11455 + u_int palette_size;
11457 + dma_addr_t upbase;
11458 + dma_addr_t lpbase;
11460 + u_long LCDtiming2;
11461 + u_long LCDtiming3;
11462 + u_long LCDcontrol;
11463 + u_long LCDICPsetup;
11464 + u_long LCDICPcontrol;
11465 + u_long LCDICPtiming1;
11466 + u_long LCDICPtiming2;
11468 + u_int cmap_inverse:1,
11472 + u_long reg_LCDtiming0;
11473 + u_long reg_LCDtiming1;
11474 + u_long reg_LCDtiming2;
11475 + u_long reg_LCDtiming3;
11476 + u_long reg_LCDcontrol;
11477 + u_long reg_LCDICPsetup;
11478 + u_long reg_LCDICPcontrol;
11479 + u_long reg_LCDICPtiming1;
11480 + u_long reg_LCDICPtiming2;
11482 + volatile u_char state;
11483 + volatile u_char task_state;
11484 + struct semaphore ctrlr_sem;
11485 + wait_queue_head_t ctrlr_wait;
11486 + struct tq_struct task;
11489 + struct pm_dev *pm;
11491 +#ifdef CONFIG_CPU_FREQ
11492 + struct notifier_block clockchg;
11496 +#define __type_entry(ptr,type,member) ((type *)((char *)(ptr)-offsetof(type,member)))
11498 +#define TO_INF(ptr,member) __type_entry(ptr,struct pl110fb_info,member)
11501 + * These are the actions for set_ctrlr_state
11503 +#define C_DISABLE (0)
11504 +#define C_ENABLE (1)
11505 +#define C_DISABLE_CLKCHANGE (2)
11506 +#define C_ENABLE_CLKCHANGE (3)
11507 +#define C_REENABLE (4)
11508 +#define C_DISABLE_PM (5)
11509 +#define C_ENABLE_PM (6)
11511 +#define PL110_NAME "PL110"
11517 +# define DPRINTK(fmt, args...) printk("%s: " fmt, __FUNCTION__ , ## args)
11519 +# define DPRINTK(fmt, args...)
11523 + * Minimum X and Y resolutions
11525 +#define MIN_XRES 64
11526 +#define MIN_YRES 64
11528 diff -urN linux-2.4.26/include/asm-arm/arch-lh79520/ads_784x.h linux-2.4.26-vrs1-lnode80/include/asm-arm/arch-lh79520/ads_784x.h
11529 --- linux-2.4.26/include/asm-arm/arch-lh79520/ads_784x.h 1969-12-31 20:00:00.000000000 -0400
11530 +++ linux-2.4.26-vrs1-lnode80/include/asm-arm/arch-lh79520/ads_784x.h 2005-11-02 17:37:32.000000000 -0400
11532 +/* vi: set sw=4 ts=4 ai: */
11535 +* linux/include/asm-arm/arch-lh79520/ads_784x.h
11537 +* Copyright (C) 2002 Lineo, Inc.
11539 +* Provide ADS_784x (touchscreen) types & definitions for LH7x EVB boards
11543 +#ifndef _ADS_784X_h
11544 +#define _ADS_784X_h
11546 +#include <asm-arm/arch-lh79520/ssp_lh7x.h>
11548 +/*********************************************************************
11549 +* Global Function Declarations
11550 +*********************************************************************/
11551 +extern int ads_784x_register(sspContext_t *sspContext);
11552 +extern int ads_784x_deregister(void);
11555 +#endif /* _ADS_784X_h */
11557 diff -urN linux-2.4.26/include/asm-arm/arch-lh79520/cpld.h linux-2.4.26-vrs1-lnode80/include/asm-arm/arch-lh79520/cpld.h
11558 --- linux-2.4.26/include/asm-arm/arch-lh79520/cpld.h 1969-12-31 20:00:00.000000000 -0400
11559 +++ linux-2.4.26-vrs1-lnode80/include/asm-arm/arch-lh79520/cpld.h 2005-11-02 17:37:32.000000000 -0400
11562 + * linux/include/asm-arm/arch-lh79520/cpld.h
11564 + * Copyright (C) 2002 Lineo, Inc.
11566 + * This program is free software; you can redistribute it and/or modify
11567 + * it under the terms of the GNU General Public License version 2 as
11568 + * published by the Free Software Foundation.
11572 +#ifndef _LH79520_CPLD_H
11573 +#define _LH79520_CPLD_H
11575 +typedef __attribute((packed)) struct {
11576 + volatile u16 keys_status;
11577 + volatile u16 reserved1;
11578 + volatile u16 l3_reg;
11579 + volatile u16 reserved2;
11580 + volatile u16 lcd_pwr_cntl;
11581 + volatile u16 reserved3;
11582 + volatile u16 l3_mode;
11583 + volatile u16 reserved4;
11584 + volatile u16 gpi;
11585 + volatile u16 reserved5;
11586 + volatile u16 gpo;
11587 + volatile u16 reserved6;
11588 + volatile u16 adc_dac_left;
11589 + volatile u16 adc_dac_right;
11590 + volatile u16 audio_control;
11591 + volatile u16 reserved7;
11592 + volatile u16 display_dip_sw;
11593 + volatile u16 reserved8;
11594 + volatile u16 seven_seg;
11595 + volatile u16 reserved9;
11596 + volatile u16 misc_stat;
11597 + volatile u16 reserved10;
11598 + volatile u16 gpio_data_dir;
11599 + volatile u16 reserved11;
11600 + volatile u16 ssp_dev_sel;
11601 + volatile u16 reserved12;
11602 + volatile u16 ser_port1_rts;
11603 + volatile u16 reserved13;
11604 + volatile u16 cf_reset;
11605 + volatile u16 reserved14;
11606 + volatile u16 cpu_dip_sw;
11607 + volatile u16 reserved15;
11608 + volatile u16 intr_mask;
11609 + volatile u16 reserved16;
11610 + volatile u16 reserved17;
11611 + volatile u16 reserved18;
11612 + volatile u16 reserved19;
11613 + volatile u16 reserved20;
11614 + volatile u16 reserved21;
11615 + volatile u16 reserved22;
11616 + volatile u16 nio_reg_clk;
11617 + volatile u16 reserved23;
11621 +/* LCD power bits */
11622 +#define CPLD_EN26V _BIT(0) /* turn on the 26V supply */
11623 +#define CPLD_BACKLIGHT_ON _BIT(1) /* turn on the backlight */
11624 +#define CPLD_DISP_EN _BIT(2) /* note DISP_EN is not wired on the Sharp EVB display board */
11625 +#define CPLD_LCD_OE _BIT(3) /* enable the LCD drive signals */
11626 +#define CPLD_LCD_PWR _BIT(4)
11629 + * enable the LCD 3.3V or 5V power supply;
11630 + * does not effect HR-TFT power on the Sharp EVB display board.
11632 +#define CPLD_LCDP_EN _BIT(4)
11635 +/* intr_mask bits */
11636 +#define CPLD_TS_INTR_ENABLE _BIT(7) /* Enable touch screen IRQ */
11637 +#define CPLD_CTS_INTR_ENABLE _BIT(6)
11638 +#define CPLD_RI_INTR_ENABLE _BIT(5)
11640 +/* misc_status bits */
11641 +#define CPLD_MISCSTS_TS_IRQ _BIT(4) /* Touch Screen caused IRQ */
11642 +#define CPLD_MISCSTS_TS_BUSY _BIT(5) /* Touch Screen busy */
11644 +/* L3 mode bits */
11646 +#define CPLD_L3_MODE_HI (cpld->l3_mode |= _BIT(0))
11647 +#define CPLD_L3_MODE_LOW (cpld->l3_mode |= ~(_BIT(0)))
11649 +#define CPLD_L3_MODE_HI cpld->l3_mode = _BIT(0) ; barrier()
11650 +#define CPLD_L3_MODE_LOW cpld->l3_mode = 0; barrier()
11653 +/* I2S audio control register bits */
11654 +#define CPLD_DAC_USE_REQ1 _BIT(12)
11655 +#define CPLD_ADC_DMA_ENABLE _BIT(7)
11656 +#define CPLD_DAC_DMA_ENABLE _BIT(6)
11657 +#define CPLD_ADC_DMA_AUTO _BIT(5)
11658 +#define CPLD_DAC_DMA_AUTO _BIT(4)
11659 +#define CPLD_ADC_IRQ_ENABLE _BIT(3)
11660 +#define CPLD_DAC_IRQ_ENABLE _BIT(2)
11661 +#define CPLD_ADC_IRQ_STATUS _BIT(1)
11662 +#define CPLD_DAC_IRQ_STATUS _BIT(0)
11663 +#define CPLD_AUDIO_DAC_INT_PENDING _BIT(0)
11664 +#define CPLD_AUDIO_ADC_INT_PENDING _BIT(1)
11665 +#define CPLD_AUDIO_DAC_INT_ENALBED _BIT(2)
11666 +#define CPLD_AUDIO_ADC_INT_ENABLED _BIT(3)
11667 +#define CPLD_AUDIO_DAC_INT_MASK \
11668 + (CPLD_AUDIO_DAC_INT_PENDING | CPLD_AUDIO_DAC_INT_ENALBED)
11669 +#define CPLD_AUDIO_ADC_INT_MASK \
11670 + (CPLD_AUDIO_ADC_INT_PENDING | CPLD_AUDIO_ADC_INT_ENABLED)
11672 +#define CPLD_ALL_ADC_BITS (CPLD_ADC_IRQ_STATUS | \
11673 + CPLD_ADC_IRQ_ENABLE | \
11674 + CPLD_ADC_DMA_AUTO | \
11675 + CPLD_ADC_DMA_ENABLE)
11677 +#define CPLD_ALL_DAC_BITS (CPLD_DAC_IRQ_STATUS | \
11678 + CPLD_DAC_IRQ_ENABLE | \
11679 + CPLD_DAC_DMA_AUTO | \
11680 + CPLD_DAC_DMA_ENABLE | \
11681 + CPLD_DAC_USE_REQ1)
11683 +#define CPLD_ALL_AUDIO_BITS (CPLD_ALL_DAC_BITS | CPLD_ALL_DAC_BITS)
11685 +#define CPLD_FS_BIT_FIELD 8
11686 +#define CPLD_FS_BITS _SBF(CPLD_FS_BIT_FIELD, _BITMASK(4) );
11687 +#define CPLD_FS_8000 0
11688 +#define CPLD_FS_11025 1
11689 +#define CPLD_FS_12000 2
11690 +#define CPLD_FS_16000 3
11691 +#define CPLD_FS_22050 4
11692 +#define CPLD_FS_24000 5
11693 +#define CPLD_FS_32000 6
11694 +#define CPLD_FS_44100 7
11695 +#define CPLD_FS_48000 8
11697 +#endif // _LH79520_CPLD_H
11699 diff -urN linux-2.4.26/include/asm-arm/arch-lh79520/dma.h linux-2.4.26-vrs1-lnode80/include/asm-arm/arch-lh79520/dma.h
11700 --- linux-2.4.26/include/asm-arm/arch-lh79520/dma.h 1969-12-31 20:00:00.000000000 -0400
11701 +++ linux-2.4.26-vrs1-lnode80/include/asm-arm/arch-lh79520/dma.h 2005-11-02 17:42:49.000000000 -0400
11704 + * linux/include/asm-arm/arch-lh79520/dma.h
11706 + * Copyright (C) 2002 Lineo, Inc.
11708 + * This program is free software; you can redistribute it and/or modify
11709 + * it under the terms of the GNU General Public License as published by
11710 + * the Free Software Foundation; either version 2 of the License, or
11711 + * (at your option) any later version.
11713 + * This program is distributed in the hope that it will be useful,
11714 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
11715 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11716 + * GNU General Public License for more details.
11718 + * You should have received a copy of the GNU General Public License
11719 + * along with this program; if not, write to the Free Software
11720 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
11722 +#ifndef __ASM_ARCH_DMA_H
11723 +#define __ASM_ARCH_DMA_H
11725 +#include <asm/hardware.h>
11726 +#include <asm/arch/cpld.h>
11728 +#define MAX_DMA_ADDRESS 0xfffc0000
11730 +#define MAX_DMA_CHANNELS 0
11731 +#define LH79520_DMA_CHANNELS 4
11734 + * All possible LH79520 devices a DMA channel can be attached to.
11746 +typedef void (*dma_callback_t)( void *buf_id, int size );
11749 +/* LH79520 DMA API */
11750 +extern int lh79520_request_dma( dmach_t *channel, const char *device_id,
11751 + dma_device_t device );
11752 +extern int lh79520_dma_set_callback( dmach_t channel, dma_callback_t cb );
11753 +extern int lh79520_dma_set_spin( dmach_t channel, dma_addr_t addr, int size );
11754 +extern int lh79520_dma_queue_buffer( dmach_t channel, void *buf_id,
11755 + dma_addr_t data, int size );
11756 +extern int lh79520_dma_get_current( dmach_t channel, void **buf_id, dma_addr_t *addr );
11757 +extern int lh79520_dma_stop( dmach_t channel );
11758 +extern int lh79520_dma_resume( dmach_t channel );
11759 +extern int lh79520_dma_flush_all( dmach_t channel );
11760 +extern void lh79520_free_dma( dmach_t channel );
11761 +extern int lh79520_dma_sleep( dmach_t channel );
11762 +extern int lh79520_dma_wakeup( dmach_t channel );
11764 +#endif /* _ASM_ARCH_DMA_H */
11766 diff -urN linux-2.4.26/include/asm-arm/arch-lh79520/gpio.h linux-2.4.26-vrs1-lnode80/include/asm-arm/arch-lh79520/gpio.h
11767 --- linux-2.4.26/include/asm-arm/arch-lh79520/gpio.h 1969-12-31 20:00:00.000000000 -0400
11768 +++ linux-2.4.26-vrs1-lnode80/include/asm-arm/arch-lh79520/gpio.h 2005-11-02 17:37:32.000000000 -0400
11771 + * linux/include/asm-arm/arch-lh79520/gpio.h
11773 + * Copyright (C) 2002 Lineo, Inc.
11775 + * This program is free software; you can redistribute it and/or modify
11776 + * it under the terms of the GNU General Public License version 2 as
11777 + * published by the Free Software Foundation.
11779 + * Original Author: BarnettH
11780 + * Date: May 17 2001 17:47:58
11782 + * Project: ARM IP headers
11785 + * This file contains the structure definitions and manifest
11786 + * constants for ARM IP component:
11787 + * General Purpose Input/Output PrimeCell PL060
11789 + * Each GPIO Module has two GPIO (digital IO) ports which are
11790 + * designated PORTA and PORTB.
11792 + * Multiple instances of a GPIO module, and thus port pairs,
11793 + * may be implemented in a single SOC.
11795 + * Each port has eight bits, PORTx[7:0].
11797 + * Each port has two 8-bit registers associated with it:
11798 + * GPIOPxDR - Data register (dr)
11799 + * GPIOPxDDR - Data Direction register (ddr)
11801 + * The specific SOC will have its own unique name for the port.
11802 + * Each port pair will have its own unique base address for the
11805 + * This include file is designed to permit the definition of
11806 + * pointers in the SOC map include file to distinct 8-bit ports
11807 + * using the name designation is suitable for the SOC
11808 + * implementation.
11811 + * A map file that includes this file should specify a
11812 + * base address for each GPIO module, e.g.:
11814 + * #define GPIO0_BASE (0xFFFDF000)
11815 + * #define GPIO1_BASE (0xFFFDE000)
11820 + * The SOC map file will use these base addresses to define
11821 + * pointers to GPIO port A, B, C, D, E, ... thusly:
11823 + * #define GPIOPA ((volatile GPIOAREGS *)(GPIO0_BASE))
11824 + * #define GPIOPB ((volatile GPIOBREGS *)(GPIO0_BASE))
11825 + * #define GPIOPC ((volatile GPIOAREGS *)(GPIO1_BASE))
11826 + * #define GPIOPD ((volatile GPIOBREGS *)(GPIO1_BASE))
11827 + * #define GPIOPE ((volatile GPIOAREGS *)(GPIO2_BASE))
11832 + * Example usage of these definitions in user code for Port C:
11834 + * unsigned int data;
11836 + * GPIOC->ddr = 0xF; sets bits [7:4] as outputs
11837 + * and bits [3:0] as inputs
11838 + * GPIOC->dr = 0xF0; sets bits [7:4] to "1"
11840 + * data = GPIOC->dr; sets data to the value of
11843 + * Note: If it is desired to use the type qualifier "__packed"
11844 + * to enable packing of structures, the manifest constant
11845 + * "PACKED" must be defined as follows or as a
11846 + * predefine at compilation (ARM-specific notation):
11848 + * #define PACKED __packed
11850 + * If a different compiler/preprocessor is used, the appropriate
11851 + * notation must be substituted for "__packed".
11853 + * Reference: ARM PrimeCell General Purpose Input/Output (PL060)
11854 + * Technical Reference Manual, ARM DDI 0142B.
11856 + * Revision History:
11858 + * Rev 1.1 May 17 2001 17:47:58 BarnettH
11859 + * Changed structure component types to reflect 32-bit access requirements.
11861 + * Rev 1.0 Mar 30 2001 16:03:30 BarnettH
11862 + * Initial revision.
11864 + * COPYRIGHT (C) 2001 SHARP MICROELECTRONICS OF THE AMERICAS, INC.
11866 + *********************************************************************/
11868 +#ifndef ARM_GPIO_PL060_H
11869 +#define ARM_GPIO_PL060_H
11871 +/* GPIO Register Structures */
11872 +//typedef __attribute((packed)) struct {
11874 + volatile unsigned int dr;
11875 + volatile unsigned int reserveda1;
11876 + volatile unsigned int ddr;
11877 + volatile unsigned int reserveda2;
11880 +//typedef __attribute((packed)) struct {
11882 + volatile unsigned int reservedb1;
11883 + volatile unsigned int dr;
11884 + volatile unsigned int reservedb2;
11885 + volatile unsigned int ddr;
11889 + * The names and usage of the bit fields in these registers is
11890 + * implementation specific, so few bit field constants are defined.
11894 +#define _BIT(n) (1 << (n))
11898 +#define _SBF(f,v) ((v) << (f))
11901 +#define SSPFRM_GPIO_BIT _BIT(2)
11902 +#define SSPEN_GPIO_BIT _BIT(0)
11904 +#define GPIOPAREGS gpioARegs_t
11905 +#define GPIOPBREGS gpioBRegs_t
11907 +#endif /* ARM_GPIO_PL060_H */
11909 diff -urN linux-2.4.26/include/asm-arm/arch-lh79520/hardware.h linux-2.4.26-vrs1-lnode80/include/asm-arm/arch-lh79520/hardware.h
11910 --- linux-2.4.26/include/asm-arm/arch-lh79520/hardware.h 1969-12-31 20:00:00.000000000 -0400
11911 +++ linux-2.4.26-vrs1-lnode80/include/asm-arm/arch-lh79520/hardware.h 2005-11-02 17:37:32.000000000 -0400
11914 + * linux/include/asm-arm/arch-lh79520/hardware.h
11916 + * Copyright (C) 2001 Sharp Microelectronics of the Americas, Inc.
11918 + * Portions Copyright (C) 2002 Lineo, Inc.
11920 + * This program is free software; you can redistribute it and/or modify
11921 + * it under the terms of the GNU General Public License version 2 as
11922 + * published by the Free Software Foundation.
11925 + * (1) Sharp LH79520 Universal Microcontroller User's Guide,
11926 + * Version 1.x, Sharp Microelectronics of the Americas, Inc.
11931 +#define _BIT(n) (1 << (n))
11935 +#define _SBF(f,v) ((v) << (f))
11939 +#define _BITMASK(field_width) ( _BIT(field_width) - 1)
11942 +/* Hardware addresses of major areas.
11943 + * *_START is the physical address
11944 + * *_SIZE is the size of the region
11945 + * *_BASE is the virtual address
11949 + * we can do an identity mapping (V=P) of all of I/O
11950 + * space, except for the VIC.
11952 + * One of the places you can find the VIC is at 0xffff0000,
11953 + * which is the same place the interrupt vectors want to live,
11954 + * so we'll leave a hole there, and use the VIC at it's other
11955 + * address: 0xfffff000.
11958 +#define APB_START 0xfffc0000 /* Physical address of APB I/O space */
11959 +#define APB_BASE 0xfffc0000 /* Virtual address of APB I/O space */
11960 +#define APB_SIZE 0x00026000 /* its size (up to 0xfffe6000) */
11962 +#define AHB_START 0xffff1000 /* Physical address of AHB I/O space */
11963 +#define AHB_BASE 0xffff1000 /* Virtual address of AHB I/O space */
11964 +#define AHB_SIZE 0x00004000 /* its size (up to 0xffff5000) */
11966 +#define VIC_START VIC_PHYS /* Physical address of VIC */
11967 +#define VIC_BASE 0xfffff000 /* Virtual address of VIC */
11968 +#define VIC_SIZE 0x1000 /* its size */
11972 +#define FLASH_START 0x40000000 /* Flash on SMC bank 0 */
11973 +#define FLASH_BASE 0xf4000000
11974 +#define FLASH_SIZE (4 * 1024 * 1024)
11976 +#define EXT_SRAM_START 0x44000000 /* External SRAM on SMC bank 1 */
11977 +#define EXT_SRAM_BASE 0xf4400000
11978 +#define EXT_SRAM_SIZE (2 * 1024 * 1024)
11981 +// not used, but there is still code that breaks without it
11982 +#define CPLD_START 0x48000000 /* CPLD on SMC bank 2 */
11983 +#define CPLD_BASE 0xf4800000
11984 +#define CPLD_SIZE 4096
11986 +#define CS8900_START 0x48000000 /* Ethernet on SMC bank 2 */
11987 +#define CS8900_BASE 0xf4800000
11988 +#define CS8900_SIZE 4096
11990 +#define GPOUT16_START 0x4c000000 /* latch on bank 3 */
11991 +#define GPOUT16_BASE 0xf4c00000
11992 +#define GPOUT16_SIZE 4096
11995 +#define IDE_START 0x50000000 /* CF/IDE on SMC bank 4 */
11996 +#define IDE_BASE 0xf5000000
11997 +#define IDE_SIZE 4096
11999 +#define IDE2_START 0x54000000 /* CF/IDE on SMC bank 5 */
12000 +#define IDE2_BASE 0xf5400000
12001 +#define IDE2_SIZE 4096
12003 +#define UNUSED_START 0x58000000 /* unused on SMC bank 6 */
12004 +#define RESERVED_START 0x5C000000 /* reserved on SMC bank 7 */
12006 +#define INT_SRAM_START 0x60000000 /* on-chip SRAM */
12007 +#define INT_SRAM_BASE 0xf6000000
12008 +#define INT_SRAM_SIZE (32 * 1024)
12011 +#define IO_START APB_START
12012 +#define IO_BASE APB_BASE
12014 +/* macro to get at IO space when running virtually */
12015 +#define IO_ADDRESS(phys) (phys)
12017 +#define PCIO_BASE IO_BASE
12020 +/**********************************************************************
12022 + *********************************************************************/
12023 +#define AHB_PHYS (0xFFFF0000)
12024 +#define VIC_PHYS_MIRROR (AHB_PHYS + 0x0000)
12025 +#define SMC_REGS_PHYS (AHB_PHYS + 0x1000)
12026 +#define SDRAM_REGS_PHYS (AHB_PHYS + 0x2000)
12027 +#define LCD_PHYS (AHB_PHYS + 0x4000)
12028 +#define VIC_PHYS (AHB_PHYS + 0xF000)
12030 +/**********************************************************************
12032 + *********************************************************************/
12033 +#define APB_PHYS (0xFFFC0000)
12034 +#define UART0_PHYS (APB_PHYS + 0x00000)
12035 +#define UART1_PHYS (APB_PHYS + 0x01000)
12036 +#define UART2_PHYS (APB_PHYS + 0x02000)
12037 +#define PWM_PHYS (APB_PHYS + 0x03000)
12038 +#define TIMER0_PHYS (APB_PHYS + 0x04000)
12039 +#define TIMER1_PHYS (APB_PHYS + 0x05000)
12040 +#define SSP_PHYS (APB_PHYS + 0x06000)
12041 +#define GPIO3_PHYS (APB_PHYS + 0x1C000)
12042 +#define GPIO2_PHYS (APB_PHYS + 0x1D000)
12043 +#define GPIO1_PHYS (APB_PHYS + 0x1E000)
12044 +#define GPIO0_PHYS (APB_PHYS + 0x1F000)
12045 +#define RTC_PHYS (APB_PHYS + 0x20000)
12046 +#define DMAC_PHYS (APB_PHYS + 0x21000)
12047 +#define RCPC_PHYS (APB_PHYS + 0x22000)
12048 +#define WDTIMER_PHYS (APB_PHYS + 0x23000)
12049 +#define LCDICP_PHYS (APB_PHYS + 0x24000)
12050 +#define IOCON_PHYS (APB_PHYS + 0x25000)
12052 +/**********************************************************************
12054 + *********************************************************************/
12055 +#define SDRAM_MEM_PHYS (0x20000000)
12056 +#define SMC_MEM_PHYS (0x40000000)
12057 +#define INTERNAL_MEM_PHYS (0x60000000)
12059 +// DDD #if REMAP == 0
12060 +#define SMC_MIRROR_MEM_PHYS (0x00000000)
12061 +// DDD #elif REMAP == 1
12062 +// DDD #define SDRAM_MIRROR_MEM_PHYS (0x00000000)
12063 +// DDD #elif REMAP == 2
12064 +// DDD #define INTERNAL_MIRROR_MEM_PHYS (0x00000000)
12066 +// DDD #error REMAP must be defined as 0, 1, or 2
12069 +/**********************************************************************
12071 + *********************************************************************/
12072 +#define CORE_IRQ _BIT(7)
12073 +#define CORE_FIQ _BIT(6)
12075 +/**********************************************************************
12076 + * SMC Memory Bank Address Space Bases
12077 + *********************************************************************/
12079 +#define SMC_BANK0_PHYS (SMC_MEM_PHYS + 0x00000000)
12080 +#define SMC_BANK1_PHYS (SMC_MEM_PHYS + 0x04000000)
12081 +#define SMC_BANK2_PHYS (SMC_MEM_PHYS + 0x08000000)
12082 +#define SMC_BANK3_PHYS (SMC_MEM_PHYS + 0x0C000000)
12083 +#define SMC_BANK4_PHYS (SMC_MEM_PHYS + 0x10000000)
12084 +#define SMC_BANK5_PHYS (SMC_MEM_PHYS + 0x14000000)
12085 +#define SMC_BANK6_PHYS (SMC_MEM_PHYS + 0x18000000)
12086 +#define SMC_BANK7_PHYS (SMC_MEM_PHYS + 0x1C000000)
12088 +/**********************************************************************
12089 + * SDRAMC Memory Bank Address Space Bases
12090 + *********************************************************************/
12092 +#define SDRAM_BANK0_PHYS (SDRAM_MEM_PHYS + 0x00000000)
12093 +#define SDRAM_BANK1_PHYS (SDRAM_MEM_PHYS + 0x08000000)
12095 +/**********************************************************************
12096 + * Vectored Interrupt Controller (VIC)
12097 + *********************************************************************/
12098 +#define VICID_OFFSET (0xFE0)
12099 +// DDD #define VIC ((VICREGS *)(VIC_PHYS))
12100 +// DDD #define VICID ((VICIDREGS *)(VIC_PHYS + VICID_OFFSET))
12101 +#define VIC_INT_TYPE_IRQ 0
12102 +#define VIC_INT_TYPE_FIQ 1
12104 +/* VIC Interrupt Sources */
12105 +#define VIC_EXTINT0 0
12106 +#define VIC_EXTINT1 1
12107 +#define VIC_EXTINT2 2
12108 +#define VIC_EXTINT3 3
12109 +#define VIC_EXTINT4 4
12110 +#define VIC_EXTINT5 5
12111 +#define VIC_EXTINT6 6
12112 +#define VIC_EXTINT7 7
12113 +#define VIC_SPEXTINT0 8
12114 +#define VIC_SPEXTINT1 9
12115 +#define VIC_SPEXTINT2 10
12116 +#define VIC_SPEXTINT3 11
12117 +#define VIC_CLCDC 12
12118 +#define VIC_SSPTXINTR 13
12119 +#define VIC_SSPRXINTR 14
12120 +#define VIC_SSPRORINTR 15
12121 +#define VIC_SSPINTR 16
12122 +#define VIC_TIMER0 17
12123 +#define VIC_TIMER1 18
12124 +#define VIC_TIMER2 19
12125 +#define VIC_TIMER3 20
12126 +#define VIC_UART0_RX 21
12127 +#define VIC_UART0_TX 22
12128 +#define VIC_UART0 23
12129 +#define VIC_UART1 24
12130 +#define VIC_UART2 25
12131 +#define VIC_DMA0 26
12132 +#define VIC_DMA1 27
12133 +#define VIC_DMA2 28
12134 +#define VIC_DMA3 29
12135 +#define VIC_RTC 30
12136 +#define VIC_WDT 31
12139 +#define VIC_VECT_0 0
12140 +#define VIC_VECT_1 1
12141 +#define VIC_VECT_2 2
12142 +#define VIC_VECT_3 3
12143 +#define VIC_VECT_4 4
12144 +#define VIC_VECT_5 5
12145 +#define VIC_VECT_6 6
12146 +#define VIC_VECT_7 7
12147 +#define VIC_VECT_8 8
12148 +#define VIC_VECT_9 9
12149 +#define VIC_VECT_10 10
12150 +#define VIC_VECT_11 11
12151 +#define VIC_VECT_12 12
12152 +#define VIC_VECT_13 13
12153 +#define VIC_VECT_14 14
12154 +#define VIC_VECT_15 15
12155 +#define VIC_VECT_MAX VIC_VECT_15
12156 +#define VIC_VECT_DEFAULT ~(0)
12159 +#define XTAL_IN 14745600 /* 14.7456 MHz crystal */
12160 +#define PLL_CLOCK (XTAL_IN * 21) /* 309 MHz PLL clock */
12164 +/**********************************************************************
12166 + *********************************************************************/
12167 +#define UARTID_OFFSET (0xFE0)
12168 +// DDD #define UART0 ((UARTREGS *)(UART0_PHYS))
12169 +// DDD #define UART1 ((UARTREGS *)(UART1_PHYS))
12170 +// DDD #define UART2 ((UARTREGS *)(UART2_PHYS))
12171 +// DDD #define UART0ID ((UARTIDREGS *)(UART0_PHYS + UARTID_OFFSET))
12172 +// DDD #define UART1ID ((UARTIDREGS *)(UART1_PHYS + UARTID_OFFSET))
12173 +// DDD #define UART2ID ((UARTIDREGS *)(UART2_PHYS + UARTID_OFFSET))
12175 +/**********************************************************************
12177 + *********************************************************************/
12178 +// DDD #define IRDA0 ((UARTREGS *)(UART0_PHYS))
12179 +// DDD #define IRDA1 ((UARTREGS *)(UART1_PHYS))
12180 +// DDD #define IRDA2 ((UARTREGS *)(UART2_PHYS))
12182 +/**********************************************************************
12183 + * Pulse Width Modulator (PWM)
12184 + *********************************************************************/
12185 +// DDD #define PWMX_OFFSET (0x20)
12186 +// DDD #define PWM ((PWMREGS *)(PWM_PHYS))
12187 +// DDD #define PWM0 ((PWMXREGS *)(PWM_PHYS))
12188 +// DDD #define PWM1 ((PWMXREGS *)(PWM_PHYS + PWMX_OFFSET))
12190 +/**********************************************************************
12192 + *********************************************************************/
12193 +// DDD #define TIMER2_OFFSET (0x20)
12194 +// DDD #define TIMER0 ((TIMERREG *)(TIMER0_PHYS))
12195 +// DDD #define TIMER1 ((volatile TIMERREG *)(TIMER0_PHYS + TIMER2_OFFSET))
12196 +// DDD #define TIMER2 ((TIMERREG *)(TIMER1_PHYS))
12197 +// DDD #define TIMER3 ((TIMERREG *)(TIMER1_PHYS + TIMER2_OFFSET))
12199 +/**********************************************************************
12200 + * Synchronous Serial Port (SSP)
12201 + *********************************************************************/
12202 +// DDD #define SSP ((SSPREGS *)(SSP_PHYS))
12204 +/**********************************************************************
12205 + * General Purpose Input/Output (GPIO)
12206 + *********************************************************************/
12207 +#define GPIOA ((GPIOPAREGS *)(GPIO0_PHYS))
12208 +#define GPIOB ((GPIOPBREGS *)(GPIO0_PHYS))
12209 +#define GPIOC ((GPIOPAREGS *)(GPIO1_PHYS))
12210 +#define GPIOD ((GPIOPBREGS *)(GPIO1_PHYS))
12211 +#define GPIOE ((GPIOPAREGS *)(GPIO2_PHYS))
12212 +#define GPIOF ((GPIOPBREGS *)(GPIO2_PHYS))
12213 +#define GPIOG ((GPIOPAREGS *)(GPIO3_PHYS))
12214 +#define GPIOH ((GPIOPBREGS *)(GPIO3_PHYS))
12216 +/**********************************************************************
12217 + * Real Time Clock (RTC)
12218 + *********************************************************************/
12219 +// DDD #define RTC ((RTCREGS *)(RTC_PHYS))
12221 +/**********************************************************************
12222 + * DMA Controller (DMAC)
12223 + *********************************************************************/
12224 +// DDD #define DMAC ((DMACREGS *)(DMAC_PHYS))
12226 +/**********************************************************************
12227 + * Reset, Clock, and Power Controller (RCPC)
12228 + *********************************************************************/
12229 +// DDD #define RCPC ((RCPCREGS *)(RCPC_PHYS))
12231 +/**********************************************************************
12232 + * Watchdog Timer (WDTIMER)
12233 + *********************************************************************/
12234 +// DDD #define WDTIMER ((WDTIMERREGS *)(WDTIMER_PHYS))
12236 +/**********************************************************************
12237 + * LCD Interface Control Processor (LCDICP)
12238 + *********************************************************************/
12239 +// DDD #define LCDICP ((LCDICPREGS *)(LCDICP_PHYS))
12241 +/**********************************************************************
12243 + *********************************************************************/
12244 +// DDD #define IOCON ((IOCONREGS *)(IOCON_PHYS))
12246 +/**********************************************************************
12247 + * GPOUT16 (MARMALADE)
12248 + *********************************************************************/
12249 +#define nLED _BIT(8)
12250 +#define TS_DIN _BIT(9)
12251 +#define nTS_CS _BIT(10)
12252 +#define TS_DCLK _BIT(11)
12253 +#define BACKLIGHT _BIT(15)
12254 diff -urN linux-2.4.26/include/asm-arm/arch-lh79520/ide.h linux-2.4.26-vrs1-lnode80/include/asm-arm/arch-lh79520/ide.h
12255 --- linux-2.4.26/include/asm-arm/arch-lh79520/ide.h 1969-12-31 20:00:00.000000000 -0400
12256 +++ linux-2.4.26-vrs1-lnode80/include/asm-arm/arch-lh79520/ide.h 2005-11-02 17:48:27.000000000 -0400
12259 + * linux/include/asm-arm/arch-lh79520/ide.h
12261 + * Copyright 2002 Lineo, Inc.
12263 + * 17-Jan-2002: Initial clone of arch-anakin/ide.h
12266 +#include <linux/config.h>
12267 +#include <asm/irq.h>
12268 +#include <asm/hardware.h>
12271 + * Set up a hw structure for a specified data port, control port and IRQ.
12272 + * This should follow whatever the default interface uses.
12274 +static __inline__ void
12275 +ide_init_hwif_ports(hw_regs_t *hw, int data_port, int ctrl_port, int *irq)
12281 + memset(hw, 0, sizeof(*hw));
12283 + reg = (ide_ioreg_t)data_port;
12285 + for( i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
12286 + hw->io_ports[i] = reg;
12290 + hw->io_ports[IDE_CONTROL_OFFSET] = (ide_ioreg_t) ctrl_port;
12298 + * This registers the standard ports for this architecture with the IDE
12301 +static __inline__ void
12302 +ide_init_default_hwifs(void)
12307 + * The IDE data ports are mapped in at IDE_BASE, and are aligined on 32 bit boundaries
12308 + * The IDE control port (usually found at port 0x3f6 on a PC, e.g.) is 6 ints into IDE_BASE2.
12310 + ide_init_hwif_ports( &hw, IDE_BASE, (char *)IDE2_BASE + 6*sizeof(int), NULL);
12312 + ide_register_hw( &hw, NULL);
12316 diff -urN linux-2.4.26/include/asm-arm/arch-lh79520/iocon.h linux-2.4.26-vrs1-lnode80/include/asm-arm/arch-lh79520/iocon.h
12317 --- linux-2.4.26/include/asm-arm/arch-lh79520/iocon.h 1969-12-31 20:00:00.000000000 -0400
12318 +++ linux-2.4.26-vrs1-lnode80/include/asm-arm/arch-lh79520/iocon.h 2005-11-02 17:37:32.000000000 -0400
12321 + * linux/include/asm-arm/arch-lh79520/iocon.h
12323 + * Copyright (C) 2002 Lineo, Inc.
12324 + * COPYRIGHT (C) 2001 SHARP MICROELECTRONICS OF THE AMERICAS, INC.
12327 + * This program is free software; you can redistribute it and/or modify
12328 + * it under the terms of the GNU General Public License as published by
12329 + * the Free Software Foundation; either version 2 of the License, or
12330 + * (at your option) any later version.
12332 + * This program is distributed in the hope that it will be useful,
12333 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
12334 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12335 + * GNU General Public License for more details.
12337 + * You should have received a copy of the GNU General Public License
12338 + * along with this program; if not, write to the Free Software
12339 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
12342 + * This file contains the structure definitions and manifest
12343 + * constants for ARM IP component:
12344 + * I/O Configuration Block
12347 + * (1) Sharp LH79520 Universal Microcontroller User's Guide,
12348 + * Version 1.x, Sharp Microelectronics of the Americas, Inc.
12349 + * (2) ARM Isis Technical Reference Manual, System on Chip Group,
12350 + * ARM SC063-TRM-0001-B
12352 + *********************************************************************/
12354 +#ifndef LH79520_IOCON_H
12355 +#define LH79520_IOCON_H
12359 +#define _BIT(n) (1 << (n))
12363 +#define _SBF(f,v) ((v) << (f))
12368 + * IO Configuration Block Structure
12371 + volatile unsigned int MemMux;
12372 + volatile unsigned int LCDMux;
12373 + volatile unsigned int MiscMux;
12374 + volatile unsigned int DMAMux;
12375 + volatile unsigned int UARTMux;
12376 + volatile unsigned int SSIMux;
12377 + volatile unsigned int Scratchreg;
12381 + * Memory Multiplexing IOCON Register Bit Field constants
12383 +#define MEMMUX_PIOE_NOMUX _SBF(0,0)
12384 +#define MEMMUX_MIDQM32 _SBF(0,1)
12385 +#define MEMMUX_MIDQM30 _SBF(0,3)
12386 +#define MEMMUX_PIOE4 _SBF(2,0)
12387 +#define MEMMUX_MINWE _SBF(2,1)
12388 +#define MEMMUX_PIOE5 _SBF(3,0)
12389 +#define MEMMUX_MISDNCS0 _SBF(3,1)
12390 +#define MEMMUX_PIOE6 _SBF(4,0)
12391 +#define MEMMUX_MISDNCS1 _SBF(4,1)
12392 +#define MEMMUX_PIOE7 _SBF(5,0)
12393 +#define MEMMUX_MICKE _SBF(5,1)
12394 +#define MEMMUX_PIOF0 _SBF(6,0)
12395 +#define MEMMUX_MICLKIO _SBF(6,1)
12396 +#define MEMMUX_PIO_X _SBF(7,0)
12397 +#define MEMMUX_MIDATA_X _SBF(7,1)
12398 +#define MEMMUX_PIOH2 _SBF(8,0)
12399 +#define MEMMUX_MICSN3 _SBF(8,1)
12400 +#define MEMMUX_PIOH3 _SBF(9,0)
12401 +#define MEMMUX_MICSN4 _SBF(9,1)
12402 +#define MEMMUX_PIOH4 _SBF(10,0)
12403 +#define MEMMUX_MICSN5 _SBF(10,1)
12404 +#define MEMMUX_PIOH5 _SBF(11,0)
12405 +#define MEMMUX_MICSN6 _SBF(11,1)
12406 +#define MEMMUX_PIOH6 _SBF(12,0)
12407 +#define MEMMUX_MIBLSN2 _SBF(12,1)
12408 +#define MEMMUX_PIOH7 _SBF(13,0)
12409 +#define MEMMUX_MIBLSN3 _SBF(13,1)
12412 + * LCD Multiplexing IOCON Register Bit Field constants
12414 +#define LCDMUX_PIOB4 _SBF(0,0)
12415 +#define LCDMUX_CLD12 _SBF(0,1)
12416 +#define LCDMUX_CLREV _SBF(0,2)
12417 +#define LCDMUX_PIOB5 _SBF(2,0)
12418 +#define LCDMUX_CLD13 _SBF(2,1)
12419 +#define LCDMUX_PIOB6 _SBF(3,0)
12420 +#define LCDMUX_CLD14 _SBF(3,1)
12421 +#define LCDMUX_PIOB7 _SBF(4,0)
12422 +#define LCDMUX_CLD15 _SBF(4,1)
12423 +#define LCDMUX_CLDSPLEN _SBF(4,2)
12424 +#define LCDMUX_PIOC0 _SBF(6,0)
12425 +#define LCDMUX_CLDEN _SBF(6,1)
12426 +#define LCDMUX_CLSPL _SBF(6,2)
12427 +#define LCDMUX_PIOC1 _SBF(8,0)
12428 +#define LCDMUX_CLVDDEN _SBF(8,1)
12429 +#define LCDMUX_CLS _SBF(8,2)
12430 +#define LCDMUX_PIOC2 _SBF(10,0)
12431 +#define LCDMUX_CLXCLK _SBF(10,1)
12432 +#define LCDMUX_PIOC3 _SBF(11,0)
12433 +#define LCDMUX_CLCP _SBF(11,1)
12434 +#define LCDMUX_PIOC4 _SBF(12,0)
12435 +#define LCDMUX_CLD16 _SBF(12,1)
12436 +#define LCDMUX_PIOC5 _SBF(13,0)
12437 +#define LCDMUX_CLLP _SBF(13,1)
12438 +#define LCDMUX_CLP _SBF(13,2)
12439 +#define LCDMUX_PIOC6 _SBF(15,0)
12440 +#define LCDMUX_CLD17 _SBF(15,1)
12441 +#define LCDMUX_PIOC7 _SBF(16,0)
12442 +#define LCDMUX_CLFP _SBF(16,1)
12443 +#define LCDMUX_CLSPS _SBF(16,2)
12444 +#define LCDMUX_PIOD0 _SBF(18,0)
12445 +#define LCDMUX_CLD2 _SBF(18,1)
12446 +#define LCDMUX_PIOD1 _SBF(19,0)
12447 +#define LCDMUX_CLD3 _SBF(19,1)
12448 +#define LCDMUX_PIOD2 _SBF(20,0)
12449 +#define LCDMUX_CLD4 _SBF(20,1)
12450 +#define LCDMUX_PIOD3 _SBF(21,0)
12451 +#define LCDMUX_CLD5 _SBF(21,1)
12452 +#define LCDMUX_PIOD4 _SBF(22,0)
12453 +#define LCDMUX_CLD6 _SBF(22,1)
12454 +#define LCDMUX_CPS _SBF(22,2)
12455 +#define LCDMUX_PIOD5 _SBF(24,0)
12456 +#define LCDMUX_CLD7 _SBF(24,1)
12457 +#define LCDMUX_PIOD6 _SBF(25,0)
12458 +#define LCDMUX_CLD8 _SBF(25,1)
12459 +#define LCDMUX_PIOD7 _SBF(26,0)
12460 +#define LCDMUX_CLD9 _SBF(26,1)
12461 +#define LCDMUX_RCEII6 _SBF(27,0)
12462 +#define LCDMUX_CLD10 _SBF(27,1)
12463 +#define LCDMUX_RCEII7 _SBF(28,0)
12464 +#define LCDMUX_CLD11 _SBF(28,1)
12467 + * Miscellaneous Multiplexing IOCON Register Bit Field constants
12469 +#define MISCMUX_PWM1 _SBF(0,0)
12470 +#define MISCMUX_DCDEOT1 _SBF(0,1)
12471 +#define MISCMUX_PIOA5 _SBF(1,0)
12472 +#define MISCMUX_RCCLKOUT _SBF(1,1)
12473 +#define MISCMUX_PIOA6 _SBF(2,0)
12474 +#define MISCMUX_RCEII0 _SBF(2,1)
12475 +#define MISCMUX_PIOA7 _SBF(3,0)
12476 +#define MISCMUX_RCEII1 _SBF(3,1)
12477 +#define MISCMUX_PIOB0 _SBF(4,0)
12478 +#define MISCMUX_RCEII2 _SBF(4,1)
12479 +#define MISCMUX_RCEII3 _SBF(5,0)
12480 +#define MISCMUX_PWM0SYNC _SBF(5,1)
12481 +#define MISCMUX_RCEII4 _SBF(6,0)
12482 +#define MISCMUX_PWM0 _SBF(6,1)
12483 +#define MISCMUX_RCCTOUT _SBF(7,0)
12484 +#define MISCMUX_DCDACK1 _SBF(7,1)
12485 +#define MISCMUX_DCDREQ1 _SBF(8,0)
12486 +#define MISCMUX_RCEII5 _SBF(8,1)
12487 +#define MISCMUX_PIOF1 _SBF(9,0)
12488 +#define MISCMUX_RCCLKEN _SBF(9,1)
12489 +#define MISCMUX_RCCLKIN _SBF(10,0)
12490 +#define MISCMUX_RCUTCLK _SBF(10,1)
12493 + * DMA Multiplexing IOCON Register Bit Field constants
12495 +#define DMAMUX_PIOB1 _SBF(0,0)
12496 +#define DMAMUX_DCDEOT0 _SBF(0,1)
12497 +#define DMAMUX_PIOB2 _SBF(1,0)
12498 +#define DMAMUX_DCDACK0N _SBF(1,1)
12499 +#define DMAMUX_PIOB3 _SBF(2,0)
12500 +#define DMAMUX_DCDREQ0 _SBF(2,1)
12503 + * UART Multiplexing IOCON Register Bit Field constants
12505 +#define UARTMUX_UT0IRRXA _SBF(0,0)
12506 +#define UARTMUX_UT0RXD _SBF(0,1)
12507 +#define UARTMUX_UT0IRTXA _SBF(1,0)
12508 +#define UARTMUX_UT0TXD _SBF(1,1)
12509 +#define UARTMUX_PIOA3 _SBF(2,0)
12510 +#define UARTMUX_UT1RXD _SBF(2,1)
12511 +#define UARTMUX_PIOA4 _SBF(3,0)
12512 +#define UARTMUX_UT1TXD _SBF(3,1)
12515 + * SSI Multiplexing IOCON Register Bit Field constants
12517 +#define SSIMUX_SSPIN _SBF(0,0)
12518 +#define SSIMUX_UT2RXD _SBF(0,1)
12519 +#define SSIMUX_SSPOUT _SBF(1,0)
12520 +#define SSIMUX_UT2TXD _SBF(1,1)
12521 +#define SSIMUX_PIOA0 _SBF(2,0)
12522 +#define SSIMUX_SSPENB _SBF(2,1)
12523 +#define SSIMUX_PIOA1 _SBF(3,0)
12524 +#define SSIMUX_SSPCLK _SBF(3,1)
12525 +#define SSIMUX_PIOA2 _SBF(4,0)
12526 +#define SSIMUX_SSPFRM _SBF(4,1)
12528 +#endif /* LH79520_IOCON_H */
12530 diff -urN linux-2.4.26/include/asm-arm/arch-lh79520/io.h linux-2.4.26-vrs1-lnode80/include/asm-arm/arch-lh79520/io.h
12531 --- linux-2.4.26/include/asm-arm/arch-lh79520/io.h 1969-12-31 20:00:00.000000000 -0400
12532 +++ linux-2.4.26-vrs1-lnode80/include/asm-arm/arch-lh79520/io.h 2005-11-02 17:37:32.000000000 -0400
12535 + * linux/include/asm-arm/arch-lh79520/io.h
12537 + * Copyright (C) 2002 Lineo, Inc.
12539 + * This program is free software; you can redistribute it and/or modify
12540 + * it under the terms of the GNU General Public License as published by
12541 + * the Free Software Foundation; either version 2 of the License, or
12542 + * (at your option) any later version.
12544 + * This program is distributed in the hope that it will be useful,
12545 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
12546 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12547 + * GNU General Public License for more details.
12549 + * You should have received a copy of the GNU General Public License
12550 + * along with this program; if not, write to the Free Software
12551 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
12553 +#ifndef __ASM_ARM_ARCH_IO_H
12554 +#define __ASM_ARM_ARCH_IO_H
12556 +#define IO_SPACE_LIMIT 0xffffffff
12559 + * We don't actually have real ISA nor PCI buses, but there is so many
12560 + * drivers out there that might just work if we fake them...
12562 +// DDD #define __io(a) (PCIO_BASE + (a))
12563 +#define __io(a) (a)
12564 +#define __mem_pci(a) ((unsigned long)(a))
12565 +#define __mem_isa(a) ((unsigned long)(a))
12568 + * Generic virtual read/write
12570 +#define __arch_getw(a) (*(volatile unsigned short *)(a))
12571 +#define __arch_putw(v,a) (*(volatile unsigned short *)(a) = (v))
12572 +#define __arch_ioremap __ioremap
12573 +#define __arch_iounmap __iounmap
12576 + * Validate the pci memory address for ioremap.
12578 +// DDD #define iomem_valid_addr(iomem,size) (1)
12581 + * Convert PCI memory space to a CPU physical address
12583 +// DDD #define iomem_to_phys(iomem) (iomem)
12586 diff -urN linux-2.4.26/include/asm-arm/arch-lh79520/irq.h linux-2.4.26-vrs1-lnode80/include/asm-arm/arch-lh79520/irq.h
12587 --- linux-2.4.26/include/asm-arm/arch-lh79520/irq.h 1969-12-31 20:00:00.000000000 -0400
12588 +++ linux-2.4.26-vrs1-lnode80/include/asm-arm/arch-lh79520/irq.h 2005-11-02 17:51:52.000000000 -0400
12591 + * linux/include/asm-arm/arch-lh79520/irq.h
12593 + * Copyright (C) 2002 Lineo, Inc.
12595 + * This program is free software; you can redistribute it and/or modify
12596 + * it under the terms of the GNU General Public License as published by
12597 + * the Free Software Foundation; either version 2 of the License, or
12598 + * (at your option) any later version.
12600 + * This program is distributed in the hope that it will be useful,
12601 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
12602 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12603 + * GNU General Public License for more details.
12605 + * You should have received a copy of the GNU General Public License
12606 + * along with this program; if not, write to the Free Software
12607 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
12610 +#include <linux/delay.h>
12611 +#include <asm/arch/hardware.h>
12612 +#include <asm/arch/rcpc.h>
12613 +#include <asm/arch/iocon.h>
12615 +#include <asm/arch/cpld.h> // DDD only for testing the switches
12619 +#define NR_VEC 16 /* number of vectors */
12621 + * Vectored Interrupt Controller Module Register Structure
12624 + u32 IRQStatus; /* masked IRQ status */
12625 + u32 FIQStatus; /* masked FIQ status */
12626 + u32 RawIntr; /* raw status */
12627 + u32 IntSelect; /* select whether source generates IRQ or FIQ */
12628 + u32 IntEnable; /* int enable mask */
12629 + u32 IntEnClear; /* writes here clear bits in IntEnable */
12630 + u32 SoftInt; /* gen soft interrupts */
12631 + u32 SoftIntClear; /* writes here clear bits in SoftInt */
12632 + u32 Protection; /* protection enable */
12633 + u32 reserved1[3];
12634 + u32 CurrentISR; /* interrupt vector address of current interrupt */
12635 + u32 DefVectAddr; /* default vector address */
12636 + u32 reserved2[50];
12637 + u32 VectAddr[NR_VEC]; /* interrupt vector address 0...NR_VEC */
12638 + u32 reserved3[48];
12639 + u32 VectCntl[NR_VEC]; /* vector control 0...NR_VEC */
12640 + u32 reserved4[48];
12641 + u32 ITCR; /* test mode */
12642 + u32 ITIP1; /* test mode */
12643 + u32 ITIP2; /* test mode */
12644 + u32 ITOP1; /* test mode */
12645 + u32 ITOP2; /* test mode */
12646 + u32 reserved5[819]; /* empty */
12647 + u32 periphid[4]; /* Peripheral ID register bits */
12648 + u32 cellid[4]; /* PrimeCell ID register bits */
12652 +/**********************************************************************
12653 + * Vectored Interrupt Controller Register Bit Fields
12654 + *********************************************************************/
12656 +/**********************************************************************
12657 + * The bit fields of the following registers have implementation
12658 + * specific meaning, and must be defined at the implementation level.
12660 + * irqstatus - VICIRQStatus
12661 + * fiqstatus - VICFIQStatus
12662 + * rawintr - VICRawIntr
12663 + * intselect - VICIntSelect
12664 + * intenable - VICIntEnable
12665 + * intenclear - VICIntEnClear
12666 + * softint - VICSoftInt
12667 + * softintclear- VICSoftIntClear
12669 + * The following definitions for these registers are generic,
12670 + * i.e., they are implementation independent. They can be used to
12671 + * create implementation specific macros.
12672 + *********************************************************************/
12674 +/**********************************************************************
12675 + * VIC Interrupt Select Register Bit Fields
12676 + *********************************************************************/
12677 +/* The following can be OR'd with the IntSelect Register to select
12678 + * an interrupt as FIQ. */
12679 +#define VIC_INTSELECT_FIQ(n) _BIT((n) & 0x1F)
12680 +/* The following can be AND'd with the IntSelect Register to select
12681 + * an interrupt as IRQ. */
12682 +#define VIC_INTSELECT_IRQ(n) ~(_BIT((n) & 0x1F))
12684 +/**********************************************************************
12685 + * VIC Interrupt Enable, Interrupt Enable Clear Register Bit Fields
12686 + * VIC Soft Interrupt, Soft Interrupt Clear Register Bit Fields
12687 + *********************************************************************/
12688 +#define VIC_INT_ENABLE(n) _BIT((n) & 0x1F)
12689 +#define VIC_INT_CLEAR(n) _BIT((n) & 0x1F)
12691 +/**********************************************************************
12692 + * VIC Protection Enable Register Bit Fields
12693 + *********************************************************************/
12694 +#define VIC_PROTECTION _BIT(0)
12696 +/**********************************************************************
12697 + * VIC Vector Address Clear Register
12698 + *********************************************************************/
12699 +#define VIC_VECTORADDR_CLEAR 0
12701 +/**********************************************************************
12702 + * VIC Vector Control Register Bit Fields
12703 + *********************************************************************/
12704 +/* To revise a Vector Control Register, clear the register, then
12705 + * use the SELECT macro to associate a line and enable the vector
12706 + * with the same operation.
12707 + * The ENABLE macro is provided for completeness.
12708 + * Use this register to enable and disable the VECTOR feature;
12709 + * use the intenable register to enable the interrupt
12710 + * itself, and the intenclear register to clear the interrupt. */
12711 +#define VIC_VECTCNTL_SELECT(n) (_SBF(0,((n) & 0x1F)) | _BIT(5))
12712 +#define VIC_VECTCNTL_ENABLE _BIT(5)
12714 +/**********************************************************************
12715 + * Vectored Interrupt Controller Test Registers
12716 + *********************************************************************/
12717 +/**********************************************************************
12718 + * itcr - Test Control
12719 + *********************************************************************/
12720 +#define VIC_ITCR_ITEN _BIT(0)
12722 +/**********************************************************************
12723 + * itip1 - Test Input 1
12724 + *********************************************************************/
12725 +#define VIC_ITIP1_F _BIT(6)
12726 +#define VIC_ITIP1_I _BIT(7)
12728 +/**********************************************************************
12729 + * itop1 - Test Output 1
12730 + *********************************************************************/
12731 +#define VIC_ITOP1_F _BIT(6)
12732 +#define VIC_ITOP1_I _BIT(7)
12737 +#define fixup_irq(i) (i)
12741 +#ifdef TESTIRQ // DDD
12742 +static unsigned int myReadCp15(void)
12745 + asm ("mrc p15, 0, %0, c1, c0, 0;" : "=r"(x) : );
12752 +static void lh79520_mask_irq( u32 irq)
12754 + vicRegs_t *vic = (vicRegs_t *)VIC_BASE;
12755 + vic->IntEnClear = (1 << irq);
12758 +static void lh79520_unmask_irq( u32 irq)
12760 + vicRegs_t *vic = (vicRegs_t *)VIC_BASE;
12764 + udelay(1); // printk( "VIC unmask irq %d\n", irq);
12766 + vic->IntEnable = (1 << irq);
12771 +static __inline__ void irq_init_irq(void)
12774 + vicRegs_t *vic = (vicRegs_t *)VIC_BASE;
12775 + rcpcRegs_t *rcpc = (rcpcRegs_t *)IO_ADDRESS( RCPC_PHYS);
12776 + ioconRegs_t *iocon = (ioconRegs_t *)IO_ADDRESS( IOCON_PHYS);
12778 + /* allow external interrupts to come in */
12779 + iocon->MiscMux = MISCMUX_RCEII0 |
12783 +#ifdef TESTIRQ // DDD
12784 + printk( "irq_init_irq() cr1=%08X\n", myReadCp15());
12785 + printk( "vic=0x%08lX rcpc=0x%08lX\n", (unsigned long) vic, (unsigned long) rcpc);
12786 + printk( "vic periph id[0-3] = 0x%X 0x%X 0x%X 0x%X\n", vic->periphid[0], vic->periphid[1], vic->periphid[2], vic->periphid[3]);
12789 + vic->IntEnClear = 0xffffffff; /* clear all interrupt enables */
12790 + vic->IntSelect = 0; /* everything generates IRQ */
12792 + // DDD don't want to do this !! vic->Protection = 1; /* allow only priviledged access */
12794 + /* disable vectored interrupts */
12795 + for( i = 0; i < NR_VEC; i++) {
12796 + vic->VectAddr[i] = 0;
12797 + vic->VectCntl[i] = 0;
12800 + for (irq = 0; irq < NR_IRQS; irq++) {
12801 + irq_desc[irq].valid = 1;
12802 + irq_desc[irq].probe_ok = 1;
12803 + irq_desc[irq].mask_ack = lh79520_mask_irq;
12804 + irq_desc[irq].mask = lh79520_mask_irq;
12805 + irq_desc[irq].unmask = lh79520_unmask_irq;
12809 + * External interrupts 0-2 and 6-7 are active LOW, and External
12810 + * interrupts 3-5 are active HIGH. <---= DDD wrong
12813 + rcpc->control |= RCPC_CTRL_WRTLOCK_ENABLED; /* unlock RCPC registers */
12816 + rcpc->intClear = 0xff; /* clear all external interrupts */
12818 + rcpc->intConfig = (
12819 + RCPC_INTCONFIG( RCPC_INT1, RCPC_INT_HLT) | // irq 1 (ide) high level
12820 + RCPC_INTCONFIG( RCPC_INT2, RCPC_INT_LLT) | // irq 2 (MARMALADE ETH) is low level
12821 + RCPC_INTCONFIG( RCPC_INT3, RCPC_INT_FET) | // irq 3 (MARMALADE TS) active low
12822 + RCPC_INTCONFIG( RCPC_INT4, RCPC_INT_HLT) |
12823 + RCPC_INTCONFIG( RCPC_INT5, RCPC_INT_HLT) |
12824 + RCPC_INTCONFIG( RCPC_INT6, RCPC_INT_LLT)
12827 + rcpc->control &= ~RCPC_CTRL_WRTLOCK_ENABLED; /* lock RCPC registers */
12828 + printk( "RCPC locked ->control=0x%08lX\n", (unsigned long) rcpc->control);
12829 + printk( "RCPC ->intConfig = 0x%08lX\n", (unsigned long) rcpc->intConfig);
12832 + { // DDD test the switches
12833 + cpldRegs_t *cpld = (cpldRegs_t *)CPLD_BASE;
12834 + cpld->intr_mask = 0x1f;
12838 + // DDD init_FIQ();
12840 diff -urN linux-2.4.26/include/asm-arm/arch-lh79520/irqs.h linux-2.4.26-vrs1-lnode80/include/asm-arm/arch-lh79520/irqs.h
12841 --- linux-2.4.26/include/asm-arm/arch-lh79520/irqs.h 1969-12-31 20:00:00.000000000 -0400
12842 +++ linux-2.4.26-vrs1-lnode80/include/asm-arm/arch-lh79520/irqs.h 2005-11-02 17:37:32.000000000 -0400
12845 + * linux/include/asm-arm/arch-lh79520/irqs.h
12847 + * Copyright (C) 2002 Lineo, Inc.
12849 + * This program is free software; you can redistribute it and/or modify
12850 + * it under the terms of the GNU General Public License version 2 as
12851 + * published by the Free Software Foundation.
12855 +#ifndef __ASM_ARCH_IRQS_H
12856 +#define __ASM_ARCH_IRQS_H
12858 +#define NR_IRQS 32
12861 +#define IRQ_ETHERNET 0
12863 +#define IRQ_CPLD 2
12864 +#define IRQ_PWM0SYNC 3
12865 +#define IRQ_PWM0 4
12866 +#define IRQ_DREQ1 5
12867 +#define IRQ_LCDVD10 6
12868 +#define IRQ_LCDVD11 7
12869 +#define IRQ_spare_i0 8 /* spare internal */
12870 +#define IRQ_spare_i1 9 /* spare internal */
12871 +#define IRQ_spare_i2 10 /* spare internal */
12872 +#define IRQ_SPEXTINT3 11
12873 +#define IRQ_LCD 12
12874 +#define IRQ_SSPTXINTR 13
12875 +#define IRQ_SSPRXINTR 14
12876 +#define IRQ_SSPRORINTR 15
12877 +#define IRQ_SSPINTR 16
12878 +#define IRQ_TIMER0 17
12879 +#define IRQ_TIMER1 18
12880 +#define IRQ_TIMER2 19
12881 +#define IRQ_TIMER3 20
12882 +#define IRQ_UART0_RX 21
12883 +#define IRQ_UART0_TX 22
12884 +#define IRQ_UART0 23
12885 +#define IRQ_UART1 24
12886 +#define IRQ_UART2 25
12887 +#define IRQ_DMA 26 /* all DMA channels */
12888 +#define IRQ_spare_i4 27 /* spare internal */
12889 +#define IRQ_spare_i5 28 /* spare internal */
12890 +#define IRQ_spare_i6 29 /* spare internal */
12891 +#define IRQ_RTC 30
12892 +#define IRQ_WDT 31
12895 diff -urN linux-2.4.26/include/asm-arm/arch-lh79520/keyboard.h linux-2.4.26-vrs1-lnode80/include/asm-arm/arch-lh79520/keyboard.h
12896 --- linux-2.4.26/include/asm-arm/arch-lh79520/keyboard.h 1969-12-31 20:00:00.000000000 -0400
12897 +++ linux-2.4.26-vrs1-lnode80/include/asm-arm/arch-lh79520/keyboard.h 2005-11-02 17:37:32.000000000 -0400
12900 + * linux/include/asm-arm/arch-anakin/keyboard.h
12902 + * Copyright (C) 2001 Aleph One Ltd. for Acunia N.V.
12904 + * This program is free software; you can redistribute it and/or modify
12905 + * it under the terms of the GNU General Public License version 2 as
12906 + * published by the Free Software Foundation.
12909 + * 11-Apr-2001 TTC Created
12911 +#define kbd_init_hw() do { } while (0)
12912 +#define kbd_enable_irq() do { } while (0)
12913 +#define kbd_disable_irq() do { } while (0)
12914 diff -urN linux-2.4.26/include/asm-arm/arch-lh79520/lh7x-7seg.h linux-2.4.26-vrs1-lnode80/include/asm-arm/arch-lh79520/lh7x-7seg.h
12915 --- linux-2.4.26/include/asm-arm/arch-lh79520/lh7x-7seg.h 1969-12-31 20:00:00.000000000 -0400
12916 +++ linux-2.4.26-vrs1-lnode80/include/asm-arm/arch-lh79520/lh7x-7seg.h 2005-11-02 17:37:32.000000000 -0400
12918 +/* vi: set sw=4 ts=4 ai: */
12920 +#ifndef _LH79X_7SEG_H_
12921 +#define _LH79X_7SEG_H_
12923 +/**********************************************************************
12924 +* linux/drivers/misc/lh79x_7seg.c
12926 +* Provide ADS_784x 7-Segment access for LH7x EVB boards
12928 +* Copyright (C) 2002 Lineo, Inc.
12930 +* This program is free software; you can redistribute it and/or modify
12931 +* it under the terms of the GNU General Public License (GPL) version 2
12932 +* as published by the Free Software Foundation.
12934 +**********************************************************************/
12936 +/**********************************************************************
12937 +* The sharp 7-segment display
12945 +* NOTE: The 7-segment display bars are bit-mapped.
12946 +* NOTE: The 7-segment display bars are ACTIVE LOW.
12948 +* NOTE: When read, the 7-segment display does not return valid data. As a
12949 +* result, it is HIGHLY recommended daemons accessing the display
12950 +* use the provided routines which programatically track the current
12951 +* value of the display to simulate read functionality. Otherwise,
12952 +* application access of the display will be tainted.
12954 +**********************************************************************/
12956 +#define SSD_A 0x01
12957 +#define SSD_B 0x02
12958 +#define SSD_C 0x04
12959 +#define SSD_D 0x08
12960 +#define SSD_E 0x10
12961 +#define SSD_F 0x20
12962 +#define SSD_G 0x40
12963 +#define SSD_DOT 0x80
12964 +#define SSD_DP SSD_DOT
12968 +extern uint16_t lh79x_7seg_read_raw_display(void);
12969 +extern u_char lh79x_7seg_read_raw_display_lsb(void);
12970 +extern u_char lh79x_7seg_read_raw_display_msb(void);
12972 +extern uint16_t lh79x_7seg_read_display(void);
12973 +extern u_char lh79x_7seg_read_display_lsb(void);
12974 +extern u_char lh79x_7seg_read_display_msb(void);
12976 +extern void lh79x_7seg_write_raw_display(uint16_t raw_val);
12977 +extern void lh79x_7seg_write_raw_display_lsb(u_char raw_lsb);
12978 +extern void lh79x_7seg_write_raw_display_msb(u_char raw_msb);
12980 +extern void lh79x_7seg_write_display(uint16_t val)
12981 +extern void lh79x_7seg_write_display_lsb(u_char lsb)
12982 +extern void lh79x_7seg_write_display_msb(u_char msb)
12983 +extern void lh79x_7seg_write_display_str(u_char *str);
12985 +#endif /* KERNEL */
12987 +#endif /* _LH79X_7SEG_H_ */
12989 diff -urN linux-2.4.26/include/asm-arm/arch-lh79520/memory.h linux-2.4.26-vrs1-lnode80/include/asm-arm/arch-lh79520/memory.h
12990 --- linux-2.4.26/include/asm-arm/arch-lh79520/memory.h 1969-12-31 20:00:00.000000000 -0400
12991 +++ linux-2.4.26-vrs1-lnode80/include/asm-arm/arch-lh79520/memory.h 2005-11-02 17:42:57.000000000 -0400
12994 + * linux/include/asm-arm/arch-sa1100/memory.h
12996 + * Copyright (C) 1999-2000 Nicolas Pitre <nico@cam.org>
12999 +#ifndef __ASM_ARCH_MEMORY_H
13000 +#define __ASM_ARCH_MEMORY_H
13002 +#include <linux/config.h>
13007 +#define TASK_SIZE (0xc0000000UL)
13008 +#define TASK_SIZE_26 (0x04000000UL)
13011 + * This decides where the kernel will search for a free chunk of vm
13012 + * space during mmap's.
13014 +#define TASK_UNMAPPED_BASE (TASK_SIZE / 3)
13017 + * Page offset: 3GB
13019 +#define PAGE_OFFSET (0xc0000000UL)
13022 + * Physical DRAM offset is 0xc0000000 on the SA1100
13024 +#define PHYS_OFFSET (0x20000000UL)
13025 +#define PHYS_OFFSET2 (0x28000000UL) /* Phys addr of second bank of SDRAM */
13028 + * We take advantage of the fact that physical and virtual address can be the
13029 + * same. The NUMA code is handling the large holes that might exist between
13030 + * all memory banks.
13032 +#define __virt_to_phys__is_a_macro
13033 +#define __phys_to_virt__is_a_macro
13034 +#define __virt_to_phys(vpage) ((vpage) - PAGE_OFFSET + PHYS_OFFSET)
13035 +#define __phys_to_virt(ppage) ((ppage) + PAGE_OFFSET - PHYS_OFFSET)
13038 + * Virtual view <-> DMA view memory address translations
13039 + * virt_to_bus: Used to translate the virtual address to an
13040 + * address suitable to be passed to set_dma_addr
13041 + * bus_to_virt: Used to convert an address for DMA operations
13042 + * to an address that the kernel can use.
13044 + * On the SA1100, bus addresses are equivalent to physical addresses.
13046 +#define __virt_to_bus__is_a_macro
13047 +#define __bus_to_virt__is_a_macro
13048 +#define __virt_to_bus(x) __virt_to_phys(x)
13049 +#define __bus_to_virt(x) __phys_to_virt(x)
13051 +#ifdef CONFIG_DISCONTIGMEM
13053 + * Because of the wide memory address space between physical RAM banks on the
13054 + * SA1100, it's much more convenient to use Linux's NUMA support to implement
13055 + * our memory map representation. Assuming all memory nodes have equal access
13056 + * characteristics, we then have generic discontiguous memory support.
13058 + * Of course, all this isn't mandatory for SA1100 implementations with only
13059 + * one used memory bank. For those, simply undefine CONFIG_DISCONTIGMEM.
13061 + * The nodes are matched with the physical memory bank addresses which are
13062 + * incidentally the same as virtual addresses.
13064 + * node 0: 0xc0000000 - 0xc7ffffff
13065 + * node 1: 0xc8000000 - 0xcfffffff
13066 + * node 2: 0xd0000000 - 0xd7ffffff
13067 + * node 3: 0xd8000000 - 0xdfffffff
13070 +#define NR_NODES 4
13073 + * Given a kernel address, find the home node of the underlying memory.
13075 +#define KVADDR_TO_NID(addr) (((unsigned long)(addr) - PAGE_OFFSET) >> 27)
13078 + * Given a page frame number, convert it to a node id.
13080 +#define PFN_TO_NID(pfn) (((pfn) - PHYS_PFN_OFFSET) >> (27 - PAGE_SHIFT))
13083 + * Given a kaddr, ADDR_TO_MAPBASE finds the owning node of the memory
13084 + * and returns the mem_map of that node.
13086 +#define ADDR_TO_MAPBASE(kaddr) NODE_MEM_MAP(KVADDR_TO_NID(kaddr))
13089 + * Given a page frame number, find the owning node of the memory
13090 + * and returns the mem_map of that node.
13092 +#define PFN_TO_MAPBASE(pfn) NODE_MEM_MAP(PFN_TO_NID(pfn))
13095 + * Given a kaddr, LOCAL_MEM_MAP finds the owning node of the memory
13096 + * and returns the index corresponding to the appropriate page in the
13097 + * node's mem_map.
13099 +#define LOCAL_MAP_NR(addr) \
13100 + (((unsigned long)(addr) & 0x07ffffff) >> PAGE_SHIFT)
13104 +#define PFN_TO_NID(addr) (0)
13109 diff -urN linux-2.4.26/include/asm-arm/arch-lh79520/param.h linux-2.4.26-vrs1-lnode80/include/asm-arm/arch-lh79520/param.h
13110 --- linux-2.4.26/include/asm-arm/arch-lh79520/param.h 1969-12-31 20:00:00.000000000 -0400
13111 +++ linux-2.4.26-vrs1-lnode80/include/asm-arm/arch-lh79520/param.h 2005-11-02 17:37:32.000000000 -0400
13114 + * linux/include/asm-arm/arch-lh79520/param.h
13116 + * Copyright (C) 2002 Lineo, Inc.
13118 + * This program is free software; you can redistribute it and/or modify
13119 + * it under the terms of the GNU General Public License as published by
13120 + * the Free Software Foundation; either version 2 of the License, or
13121 + * (at your option) any later version.
13123 + * This program is distributed in the hope that it will be useful,
13124 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
13125 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13126 + * GNU General Public License for more details.
13128 + * You should have received a copy of the GNU General Public License
13129 + * along with this program; if not, write to the Free Software
13130 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
13134 diff -urN linux-2.4.26/include/asm-arm/arch-lh79520/rcpc.h linux-2.4.26-vrs1-lnode80/include/asm-arm/arch-lh79520/rcpc.h
13135 --- linux-2.4.26/include/asm-arm/arch-lh79520/rcpc.h 1969-12-31 20:00:00.000000000 -0400
13136 +++ linux-2.4.26-vrs1-lnode80/include/asm-arm/arch-lh79520/rcpc.h 2005-11-02 17:37:32.000000000 -0400
13139 + * linux/include/asm-arm/arch-lh79520/rcpc.h
13141 + * Copyright (C) 2001 Sharp Microelectronics of the Americas, Inc.
13143 + * Portions Copyright (C) 2002 Lineo, Inc.
13147 + * This program is free software; you can redistribute it and/or modify
13148 + * it under the terms of the GNU General Public License version 2 as
13149 + * published by the Free Software Foundation.
13158 + * RCPC: Reset, Clock, and Power Controller Register Structure
13160 +typedef __attribute((packed)) struct {
13161 + u32 control; /* control register */
13162 + u32 id; /* identification */
13163 + u32 remap; /* Remap Control */
13164 + u32 softReset; /* Soft Reset */
13165 + u32 resetStatus; /* Reset Status */
13166 + u32 resetStatusclr; /* Reset Status Clear */
13167 + u32 HCLKPrescale; /* HCLK Prescaler */
13168 + u32 CpuClkPrescale; /* ARM Core Clk Prescaler */
13169 + u32 PCLKPrescale; /* PCLK Prescaler */
13170 + u32 periphClkCtrl; /* Peripheral Clock Ctrl */
13171 + u32 spareClkCtrl; /* Spare Clock Ctrl */
13172 + u32 AHBClkCtrl; /* AHB Clock Ctrl */
13173 + u32 periphClkSel; /* Peripheral Clock Select*/
13174 + u32 spareClkSel; /* Spare Clock Select */
13175 + u32 PWM0Prescale; /* PWM 0 Prescaler*/
13176 + u32 PWM1Prescale; /* PWM 1 Prescaler*/
13177 + u32 spare0Prescale; /* Spare clock 0 Prescaler*/
13178 + u32 spare1Prescale; /* Spare clock 1 Prescaler*/
13179 + u32 spare2Prescale; /* Spare clock 2 Prescaler*/
13180 + u32 spare3Prescale; /* Spare clock 3 Prescaler*/
13181 + u32 spare4Prescale; /* Spare clock 4 Prescaler*/
13182 + u32 spare5Prescale; /* Spare clock 5 Prescaler*/
13183 + u32 spare6Prescale; /* Spare clock 6 Prescaler*/
13184 + u32 spare7Prescale; /* Spare clock 7 Prescaler*/
13185 + u32 spare8Prescale; /* Spare clock 8 Prescaler*/
13186 + u32 spare9Prescale; /* Spare clock 9 Prescaler*/
13187 + u32 spare10Prescale; /* Spare clck 10 Prescaler*/
13188 + u32 spare11Prescale; /* Spare clck 11 Prescaler*/
13189 + u32 spare12Prescale; /* Spare clck 12 Prescaler*/
13190 + u32 spare13Prescale; /* Spare clck 13 Prescaler*/
13191 + u32 spare14Prescale; /* Spare clck 14 Prescaler*/
13192 + u32 spare15Prescale; /* Spare clck 15 Prescaler*/
13193 + u32 intConfig; /* Ext. Interrupt Config */
13194 + u32 intClear; /* Ext. Interrupt Clear */
13195 + u32 coreClkConfig; /* ARM Core Clock Config */
13200 + * RCPC Bit Fields
13204 + * control Register Bit Fields
13206 +#define RCPC_CTRL_EP _BIT(0) /* Enable PLL */
13207 +#define RCPC_CTRL_EX _BIT(1) /* Enable Internal XTAL */
13209 +#define RCPC_CTRL_PWRDWNSEL(n) _SBF(2,(n)) /* Power Down Mode Sel*/
13210 +/* Mode Arguments to RCPC_CTRL_PWRDWNSEL(n) */
13211 +#define PWRDWNSEL_ACTIVE 0
13212 +#define PWRDWNSEL_STANDBY 1
13213 +#define PWRDWNSEL_SLEEP 2
13214 +#define PWRDWNSEL_STOP1 3
13215 +#define PWRDWNSEL_STOP2 4
13217 +#define RCPC_CTRL_OUTSEL(n) _SBF(5,(n))
13218 +/* Arguments to RCPC_CTRL_OUTSEL(n) */
13219 +#define OUTSEL_CLK_INTOSC 0
13220 +#define OUTSEL_CLK_PLL 1
13221 +#define OUTSEL_FCLK_CPU 2
13222 +#define OUTSEL_HCLK 3
13224 +#define RCPC_CTRL_CLKSEL_PLL _SBF(7,0)
13225 +#define RCPC_CTRL_CLKSEL_EXT _SBF(7,1)
13227 +#define RCPC_CTRL_WRTLOCK_LOCKED _SBF(9,0)
13228 +#define RCPC_CTRL_WRTLOCK_ENABLED _SBF(9,1)
13230 +/**********************************************************************
13231 + * identification - Identification Register Bit Fields
13232 + *********************************************************************/
13233 +#define RCPC_ID_DEFAULT (0x5200)
13235 +/**********************************************************************
13236 + * remap - Remap Control Register Bit Fields
13237 + *********************************************************************/
13238 +#define RCPC_REMAP_SMEM0 (0)
13239 +#define RCPC_REMAP_SDMEM0 (1)
13240 +#define RCPC_REMAP_IMEM0 (2)
13242 +/**********************************************************************
13243 + * softreset - Soft Reset Register Bit Fields
13244 + *********************************************************************/
13245 +#define RCPC_SOFTRESET_ALL (0xDEAD)
13246 +#define RCPC_SOFTRESET_GBL (0xDEAC)
13248 +/**********************************************************************
13249 + * resetstatus, resetstatusclr - Reset Status Register Bit Fields
13250 + *********************************************************************/
13251 +#define RCPC_RESET_STATUS_EXT _BIT(0)
13252 +#define RCPC_RESET_STATUS_WDTO _BIT(1)
13254 +/**********************************************************************
13255 + * hclkPrescale - HCLK Prescaler Register Bit Fields
13256 + * cpuclkPrescale - ARM Core Clock Prescaler Register Bit Fields
13257 + * pclkPrescale - PCLK Prescaler Register Bit Fields
13258 + * pwm0Prescale - PWM0 Prescaler Register Bit Fields
13259 + * pwm1Prescale - PWM1 Prescaler Register Bit Fields
13260 + * sparePrescale - Spare Prescaler Register Bit Fields
13261 + * Note: not all constants are applicable to all registers.
13263 + *********************************************************************/
13264 +#define RCPC_PRESCALER_DIV1 _SBF(0,0)
13265 +#define RCPC_PRESCALER_DIV2 _SBF(0,1)
13266 +#define RCPC_PRESCALER_DIV4 _SBF(0,2)
13267 +#define RCPC_PRESCALER_DIV6 _SBF(0,3)
13268 +#define RCPC_PRESCALER_DIV8 _SBF(0,4)
13269 +#define RCPC_PRESCALER_DIV16 _SBF(0,8)
13270 +#define RCPC_PRESCALER_DIV30 _SBF(0,15)
13271 +#define RCPC_PRESCALER_DIV32 _SBF(0,16)
13272 +#define RCPC_PRESCALER_DIV64 _SBF(0,32)
13273 +#define RCPC_PRESCALER_DIV128 _SBF(0,64)
13274 +#define RCPC_PRESCALER_DIV256 _SBF(0,128)
13275 +#define RCPC_PRESCALER_DIV65534 (0xFFFF)
13277 +/**********************************************************************
13278 + * periphclkctrl - Peripheral Clock Control Register Bit Fields
13279 + * spareclkctrl - Spare Clock Control Register Bit Fields
13280 + * ahbclkctrl - AHB Clock Control Register Bit Fields
13281 + * Writing a "0" to a bit in these registers enables the
13282 + * corresponding clock
13283 + *********************************************************************/
13284 +#define RCPC_CLKCTRL_U0_DISABLE _BIT(0)
13285 +#define RCPC_CLKCTRL_U1_DISABLE _BIT(1)
13286 +#define RCPC_CLKCTRL_U2_DISABLE _BIT(2)
13287 +#define RCPC_CLKCTRL_CT0_DISABLE _BIT(3)
13288 +#define RCPC_CLKCTRL_CT1_DISABLE _BIT(4)
13289 +#define RCPC_CLKCTRL_CT2_DISABLE _BIT(5)
13290 +#define RCPC_CLKCTRL_CT3_DISABLE _BIT(6)
13291 +#define RCPC_CLKCTRL_PWM0_DISABLE _BIT(7)
13292 +#define RCPC_CLKCTRL_PWM1_DISABLE _BIT(8)
13293 +#define RCPC_CLKCTRL_RTC_DISABLE _BIT(9)
13294 +#define RCPC_CLKCTRL_SPARE_DISABLE(f) _BIT(f)
13296 +#define RCPC_SPARE_CLKCTRL_SSPCLK_DISABLE _BIT(1)
13297 +#define RCPC_SPARE_CLKCTRL_LCDCLK_DISABLE _BIT(0)
13299 +#define RCPC_CLKCTRL_DMAC_DISABLE _BIT(0)
13300 +#define RCPC_CLKCTRL_HCLKSP0_DISABLE _BIT(1)
13302 +/**********************************************************************
13303 + * periphclksel - Peripheral Clock Select Register Bit Fields
13304 + * Writing a "0" to U0-U2 in this register enables the
13305 + * XTAL Oscillator as the clock source
13306 + * Writing a "0" to CT0-CT3 in this register enables the
13307 + * HCLK as the clock source
13308 + *********************************************************************/
13309 +#define RCPC_PCLKSEL_U0_EXT _BIT(0) /* U0 Clock Source */
13310 +#define RCPC_PCLKSEL_U1_EXT _BIT(1) /* U1 Clock Source */
13311 +#define RCPC_PCLKSEL_U2_EXT _BIT(2) /* U2 Clock Source */
13312 +#define RCPC_PCLKSEL_CT0_EXT _BIT(3) /* CT0 Clock Source */
13313 +#define RCPC_PCLKSEL_CT1_EXT _BIT(4) /* CT1 Clock Source */
13314 +#define RCPC_PCLKSEL_CT2_EXT _BIT(5) /* CT2 Clock Source */
13315 +#define RCPC_PCLKSEL_CT3_EXT _BIT(6) /* CT3 Clock Source */
13316 +#define RCPC_PCLKSEL_RTC_32 0 /* RTC Clock Source 32KHz */
13317 +#define RCPC_PCLKSEL_RTC_EXT _SBF(7,2) /* RTC Clock Source Ext */
13319 +/**********************************************************************
13320 + * spareclksel - Peripheral Clock Select Register Bit Fields
13321 + * Writing a "0" to a bit in this register enables the
13322 + * HCLK as the clock source
13323 + *********************************************************************/
13324 +#define RCPC_SCLKSEL_SP(n) _SBF((n),1) /* SP2 - SP15 */
13325 +#define RCPC_SCLKSEL_SSPCLK _BIT(1) /* SSP Clock External */
13326 +#define RCPC_SCLKSEL_LCDCLK _BIT(0) /* LCD Clock External */
13328 +/**********************************************************************
13329 + * intconfig - External Interrupt Configuration Register Bit Fields
13330 + *********************************************************************/
13331 +#define RCPC_INTCONFIG(f,v) _SBF((f),(v))
13332 +/* RCPC_INTCONFIG arguments for 'f' parameter */
13333 +#define RCPC_INT0 0
13334 +#define RCPC_INT1 2
13335 +#define RCPC_INT2 4
13336 +#define RCPC_INT3 6
13337 +#define RCPC_INT4 8
13338 +#define RCPC_INT5 10
13339 +#define RCPC_INT6 12
13340 +#define RCPC_INT7 14
13341 +/* RCPC_INTCONFIG arguments for 'v' parameter */
13342 +#define RCPC_INT_LLT 0 /* Low Level Trigger */
13343 +#define RCPC_INT_HLT 1 /* High Level Trigger */
13344 +#define RCPC_INT_FET 2 /* Falling Edge Trigger */
13345 +#define RCPC_INT_RET 3 /* Rising Edge Trigger */
13347 +/**********************************************************************
13348 + * intclear - External Interrupt Clear Register Bit Fields
13349 + *********************************************************************/
13350 +#define RCPC_INTCLEAR(n) _BIT(n) /* Clear Edge Interrupt 'n' */
13352 +/**********************************************************************
13353 + * coreclkconfig - Core Clock Configuration Register Bit Fields
13354 + *********************************************************************/
13355 +#define RCPC_CCC_STDASYNCH 0 /* Standard Mode, Asynch operation */
13356 +#define RCPC_CCC_FASTBUS 1 /* Fast Bus Extension Mode */
13357 +#define RCPC_CCC_STDSYNCH 2 /* Standard Mode, Synch operation */
13360 diff -urN linux-2.4.26/include/asm-arm/arch-lh79520/serial.h linux-2.4.26-vrs1-lnode80/include/asm-arm/arch-lh79520/serial.h
13361 --- linux-2.4.26/include/asm-arm/arch-lh79520/serial.h 1969-12-31 20:00:00.000000000 -0400
13362 +++ linux-2.4.26-vrs1-lnode80/include/asm-arm/arch-lh79520/serial.h 2005-11-02 17:37:32.000000000 -0400
13365 + * linux/include/asm-arm/arch-lh79520/serial.h
13367 + * Copyright (c) 2002 Lineo, Inc.
13369 + * This program is free software; you can redistribute it and/or modify
13370 + * it under the terms of the GNU General Public License version 2 as
13371 + * published by the Free Software Foundation.
13374 +#ifndef __ASM_ARCH_SERIAL_H
13375 +#define __ASM_ARCH_SERIAL_H
13378 + * This assumes you have a 14.7456 MHz clock for your UART.
13380 +#define BASE_BAUD (14745600 / 16)
13383 + * Standard COM flags
13385 +#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST)
13387 +#define RS_TABLE_SIZE 2
13389 +#define STD_SERIAL_PORT_DEFNS \
13390 + /* MAGIC UART CLK PORT IRQ FLAGS */ \
13391 + { 0, BASE_BAUD, UART0_BASE, IRQ_UART0, STD_COM_FLAGS }, /* ttyAM0 */ \
13392 + { 0, BASE_BAUD, UART1_BASE, IRQ_UART1, STD_COM_FLAGS }, /* ttyAM0 */ \
13393 + { 0, BASE_BAUD, UART2_BASE, IRQ_UART2, STD_COM_FLAGS }, /* ttyAM1 */ \
13395 +#define EXTRA_SERIAL_PORT_DEFNS
13398 diff -urN linux-2.4.26/include/asm-arm/arch-lh79520/smc_pl090.h linux-2.4.26-vrs1-lnode80/include/asm-arm/arch-lh79520/smc_pl090.h
13399 --- linux-2.4.26/include/asm-arm/arch-lh79520/smc_pl090.h 1969-12-31 20:00:00.000000000 -0400
13400 +++ linux-2.4.26-vrs1-lnode80/include/asm-arm/arch-lh79520/smc_pl090.h 2005-11-02 17:37:32.000000000 -0400
13403 + * linux/include/asm-arm/arch-lh79520/smc_pl090.h
13405 + * Copyright (C) 2002 Lineo, Inc.
13407 + * This program is free software; you can redistribute it and/or modify
13408 + * it under the terms of the GNU General Public License version 2 as
13409 + * published by the Free Software Foundation.
13412 + * This file contains the structure definitions and manifest
13413 + * constants for ARM IP component:
13414 + * Static Memory Controller PrimeCell PL090
13417 + * (1) ARM PrimeCell Static Memory Controller (PL090)
13418 + * Technical Reference Manual, ARM DDI 0160C.
13419 + * (2) ARM Isis Technical Reference Manual, System on Chip Group,
13420 + * ARM SC063-TRM-0001-B
13422 + * COPYRIGHT (C) 2001 SHARP MICROELECTRONICS OF THE AMERICAS, INC.
13426 +#ifndef SMC_PL090_H
13427 +#define SMC_PL090_H
13430 +#define _BIT(n) (1 << (n))
13434 +#define _SBF(f,v) ((v) << (f))
13438 + * Static Memory Controller Module Register Structure
13441 + volatile unsigned int bcr0; /* Configuration for bank 0 */
13442 + volatile unsigned int bcr1; /* Configuration for bank 1 */
13443 + volatile unsigned int bcr2; /* Configuration for bank 2 */
13444 + volatile unsigned int bcr3; /* Configuration for bank 3 */
13445 + volatile unsigned int bcr4; /* Configuration for bank 4 */
13446 + volatile unsigned int bcr5; /* Configuration for bank 5 */
13447 + volatile unsigned int bcr6; /* Configuration for bank 6 */
13448 + volatile unsigned int bcr7; /* Configuration for bank 7 */
13452 + * Static Memory Controller Bit Field constants
13454 +#define IDCY(n) _SBF(0,((n)&0x0F)) /* Idle Cycle Time */
13455 +#define WST1(n) _SBF(5,((n)&0x1F)) /* Wait State 1 */
13456 +#define RBLE(n) _SBF(10,((n)&0x01)) /* Read Byte Lane Enable */
13457 +#define WST2(n) _SBF(11,((n)&0x1F)) /* Wait State 2 */
13458 +#define BUSERR _BIT(24) /* Bus Transfer Error Flag */
13459 +#define WPERR _BIT(25) /* Write Protect Error Flag */
13460 +#define WP _BIT(26) /* Write Protect */
13461 +#define BM _BIT(27) /* Burst Mode */
13462 +#define MW8 _SBF(28,0) /* Memory width 8 bits */
13463 +#define MW16 _SBF(28,1) /* Memory width 16 bits */
13464 +#define MW32 _SBF(28,2) /* Memory width 32 bits */
13465 +#define ATNONE _SBF(30,0) /* No Retry */
13466 +#define ATEVERY _SBF(30,2) /* Retry after every access */
13467 +#define ATAFTER4 _SBF(30,3) /* Retry after 4 accesses */
13469 +#endif /* SMC_PL090_H */
13470 diff -urN linux-2.4.26/include/asm-arm/arch-lh79520/ssp_lh7x.h linux-2.4.26-vrs1-lnode80/include/asm-arm/arch-lh79520/ssp_lh7x.h
13471 --- linux-2.4.26/include/asm-arm/arch-lh79520/ssp_lh7x.h 1969-12-31 20:00:00.000000000 -0400
13472 +++ linux-2.4.26-vrs1-lnode80/include/asm-arm/arch-lh79520/ssp_lh7x.h 2005-11-02 17:37:32.000000000 -0400
13474 +/* vi: set sw=4 ts=4 ai: */
13476 +/**********************************************************************
13477 +* linux/include/asm-arm/arch-lh79520/ssp_lh7x.h
13479 +* Provide SSP (Synchronous Serial Port) types & definitions
13480 +* for LH7x EVB boards
13482 +* Copyright (C) 2002 Lineo, Inc.
13484 +* This program is free software; you can redistribute it and/or modify
13485 +* it under the terms of the GNU General Public License (GPL) version 2
13486 +* as published by the Free Software Foundation.
13488 +**********************************************************************/
13490 +#ifndef _SSP_LH7X_h
13491 +#define _SSP_LH7X_h
13493 +//#define SSP_BASE SSP_PHYS
13495 +/*********************************************************************
13496 +* Synchronous Serial Port Registers
13497 +*********************************************************************/
13498 +#define SSPCR0 (SSP_BASE+0x00) /* Control reg. 0 */
13499 +#define SSPCR1 (SSP_BASE+0x04) /* Control reg. 1 */
13500 +#define SSPDR (SSP_BASE+0x08) /* Receive FIFO (Read)*/
13501 + /* Transmit FIFO data reg. (Write)*/
13502 +#define SSPSR (SSP_BASE+0x0C) /* Status Reg. */
13503 +#define SSPCPSR (SSP_BASE+0x10) /* Clock prescale reg. */
13504 +#define SSPIIR (SSP_BASE+0x14) /* Interrupt identification reg. (Read) */
13505 +#define SSPICR SSPIIR /* Interrupt clear reg. (Write) */
13509 +* 0x40 - 0x90 (For test purposes)
13513 +/*********************************************************************
13514 +* Synchronous Serial Port Register Structure
13515 +*********************************************************************/
13517 + volatile unsigned int cr0;
13518 + volatile unsigned int cr1;
13519 + volatile unsigned int dr;
13520 + volatile unsigned int sr;
13521 + volatile unsigned int cpsr;
13523 + volatile unsigned int iir;
13524 + volatile unsigned int icr;
13526 + volatile unsigned int reservedssp[58];
13530 +* To use the structure, declare the following in your source
13531 +* static sspRegs_t *ssp = (sspRegs_t *)SSP_BASE;
13534 +/*********************************************************************
13535 +* A couple of macros we use here...
13536 +*********************************************************************/
13538 +#define _BIT(n) (1 << (n))
13541 +#define _SBF(f,v) ((v) << (f))
13544 +#define _BITMASK(field_width) ( _BIT(field_width) - 1)
13547 +/*********************************************************************
13548 +* Synchronous Serial Port Bit Fields
13549 +*********************************************************************/
13551 +/*********************************************************************
13552 +* Control 0 Register Bit Fields
13553 +*********************************************************************/
13554 +/* Valid range for argument to SSP_CR0_DSS(n) is [4-16] */
13555 +#define SSP_CR0_DSS(n) _SBF(0,(n)-1) /* Data Size Select */
13556 +#define SSP_CR0_FRF_MOT _SBF(4,0) /* Motorola SPI frame */
13557 +#define SSP_CR0_FRF_TI _SBF(4,1) /* TI synchronous serial frame */
13558 +#define SSP_CR0_FRF_NS _SBF(4,2) /* National Microwire frame */
13559 +#define SSP_CR0_SPO _BIT(6) /* SPI Polarity */
13560 +#define SSP_CR0_SPH _BIT(7) /* SPI Polarity */
13561 +#define SSP_CR0_SCR(n) _SBF(8,(n)) /* Serial Clock Rate */
13563 +/*********************************************************************
13564 +* Control 1 Register Bit Fields
13565 +*********************************************************************/
13566 +#define SSP_CR1_RIE _BIT(0) /* RX FIFO interrupt enable */
13567 +#define SSP_CR1_TIE _BIT(1) /* TX FIFO interrupt enable */
13568 +#define SSP_CR1_RORIE _BIT(2) /* RX FIFO overrun int. enable */
13569 +#define SSP_CR1_LBM _BIT(3) /* Loop back mode */
13570 +#define SSP_CR1_SSE _BIT(4) /* Synchronous serial port enable */
13572 +/*********************************************************************
13573 +* Status Register Bit Fields
13574 +*********************************************************************/
13575 +#define SSP_SR_TFE _BIT(0) /* TX FIFO Empty */
13576 +#define SSP_SR_TNF _BIT(1) /* TX FIFO not full */
13577 +#define SSP_SR_RNE _BIT(2) /* RX FIFO not empty */
13578 +#define SSP_SR_RFF _BIT(3) /* RX FIFO full */
13579 +#define SSP_SR_BSY _BIT(4) /* Busy flag */
13581 +/*********************************************************************
13582 +* Clock Prescale Divisor Register Bit Fields
13583 +*********************************************************************/
13584 +#define SSP_CPSR_CPDVSR(n) _SBF(0,(n)&0xFE) /* Clock prescale divisor */
13586 +/*********************************************************************
13587 +* Interrupt Identification / Interrupt Clear Register Bit Fields
13588 +* Note: ARM Reference conflicts on the definition of these bits
13589 +* and the usage of the registers. Verify before using these
13591 +*********************************************************************/
13592 +#define SSP_IIR_RIS _BIT(0) /* TX FIFO Empty */
13593 +#define SSP_IIR_TIS _BIT(1) /* TX FIFO not full */
13594 +#define SSP_IIR_RORIS _BIT(2) /* RX FIFO overrun int. status */
13596 +/*********************************************************************
13597 +* The TouchScreen communication BPS (bits per second)
13598 +*********************************************************************/
13599 +#define LH7x_TS_BPS 100000
13601 +/*********************************************************************
13603 +*********************************************************************/
13604 +#define SSP_MAX_TIMEOUT 0xffff
13605 +#define RCPC_SSP_PRESCALE_MAX 256
13606 +#define SSP_PRESCALE_MAX 254
13607 +#define SSP_PRESCALE_MIN 2
13608 +#define SSP_DIVIDER_MAX 256
13610 +/* Define values to associate with the device we are conencted to */
13611 +#define SSP_INVALID_DEVICE 0xFF
13612 +#define SSP_EEPROM 0x00
13613 +#define SSP_TOUCHSCREEN 0x01
13615 +/*********************************************************************
13616 +* Context Structure Definition
13617 +*********************************************************************/
13618 +typedef struct sspContext_t sspContext_t;
13619 +struct sspContext_t {
13620 + wait_queue_head_t *irq_wait_ptr;
13622 + int ssp_dev_sel; // cpld->ssp_dev_sel is not readable !!!
13623 + int ts_txTimeout;
13624 + int ts_rxTimeout;
13625 + int ee_txTimeout;
13626 + int ee_rxTimeout;
13628 + spinlock_t sspLock;
13631 +#endif /* _SSP_LH7X_h */
13633 diff -urN linux-2.4.26/include/asm-arm/arch-lh79520/system.h linux-2.4.26-vrs1-lnode80/include/asm-arm/arch-lh79520/system.h
13634 --- linux-2.4.26/include/asm-arm/arch-lh79520/system.h 1969-12-31 20:00:00.000000000 -0400
13635 +++ linux-2.4.26-vrs1-lnode80/include/asm-arm/arch-lh79520/system.h 2005-11-02 17:37:32.000000000 -0400
13638 + * linux/include/asm-arm/arch-lh79520/system.h
13640 + * Copyright (C) 2002 Lineo, Inc.
13642 + * This program is free software; you can redistribute it and/or modify
13643 + * it under the terms of the GNU General Public License version 2 as
13644 + * published by the Free Software Foundation.
13647 + * 07-Jan-2001 Duck Created
13650 +#ifndef __ASM_ARCH_SYSTEM_H
13651 +#define __ASM_ARCH_SYSTEM_H
13653 +static inline void
13658 +static inline void
13659 +arch_reset(char mode)
13665 diff -urN linux-2.4.26/include/asm-arm/arch-lh79520/time.h linux-2.4.26-vrs1-lnode80/include/asm-arm/arch-lh79520/time.h
13666 --- linux-2.4.26/include/asm-arm/arch-lh79520/time.h 1969-12-31 20:00:00.000000000 -0400
13667 +++ linux-2.4.26-vrs1-lnode80/include/asm-arm/arch-lh79520/time.h 2005-11-02 17:37:32.000000000 -0400
13670 + * linux/include/asm-arm/arch-lh79520/time.h
13672 + * Copyright (C) 2002 Lineo, Inc.
13674 + * This program is free software; you can redistribute it and/or modify
13675 + * it under the terms of the GNU General Public License version 2 as
13676 + * published by the Free Software Foundation.
13679 + * 07-Jan-2002 Duck Created
13682 +#ifndef __ASM_ARCH_TIME_H
13683 +#define __ASM_ARCH_TIME_H
13685 +#include <asm/arch/hardware.h>
13686 +#include <asm/arch/rcpc.h>
13689 + * Dual Timer Module Register Structure
13690 + * The LH79520 has two of these.
13693 + unsigned int Timer1Load;
13694 + unsigned int Timer1Value;
13695 + unsigned int Timer1Control;
13696 + unsigned int Timer1Clear;
13697 + unsigned int Timer1Test;
13698 + unsigned int reservedtmr1[3];
13699 + unsigned int Timer2Load;
13700 + unsigned int Timer2Value;
13701 + unsigned int Timer2Control;
13702 + unsigned int Timer2Clear;
13703 + unsigned int Timer2Test;
13704 + unsigned int reservedtmr2[3];
13709 + * Timer Control Register Bit Field constants
13710 + * All other bits in the Timer Control Register must be written as
13713 +#define TMRCTRL_ENABLE _SBF(7,1)
13714 +#define TMRCTRL_DISABLE _SBF(7,0)
13715 +#define TMRCTRL_MODE_PERIODIC _SBF(6,1)
13716 +#define TMRCTRL_MODE_FREERUN _SBF(6,0)
13717 +#define TMRCTRL_CASCADE_ENABLE _SBF(4,1)
13718 +#define TMRCTRL_CASCADE_DISABLE _SBF(4,0)
13719 +#define TMRCTRL_PRESCALE1 _SBF(2,0)
13720 +#define TMRCTRL_PRESCALE16 _SBF(2,1)
13721 +#define TMRCTRL_PRESCALE256 _SBF(2,2)
13724 + * what to load the timer with
13725 + * it's 14.745600 MHz * 21 (PLL multiplier) / 6 (PCLK prescalar) / 16 (TIMER_PRESCALE) / HZ
13726 + * this gives us timerLoad=32256 for Hz=100
13728 +#define TIMER_PRESCALE 16
13731 +timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
13733 + timerRegs_t *mod1Timer = (timerRegs_t *)IO_ADDRESS( TIMER0_PHYS);
13735 + mod1Timer->Timer1Clear = 1; /* clear interrupt */
13741 +static inline void
13744 + rcpcRegs_t *rcpc = (rcpcRegs_t *)IO_ADDRESS( RCPC_PHYS);
13745 + timerRegs_t *mod1Timer = (timerRegs_t *)IO_ADDRESS( TIMER0_PHYS), /* first timer module */
13746 + *mod2Timer = (timerRegs_t *)IO_ADDRESS( TIMER1_PHYS); /* second timer module */
13749 + timerLoad = hclkfreq_get() / TIMER_PRESCALE / HZ;
13750 + printk( "setup_timer(): timerLoad=%d\n", timerLoad);
13752 + /* stop all timers */
13753 + mod1Timer->Timer1Control = 0;
13754 + mod1Timer->Timer2Control = 0;
13755 + mod2Timer->Timer1Control = 0;
13756 + mod2Timer->Timer2Control = 0;
13758 + /* enable clock to first timer */
13759 + rcpc->control |= RCPC_CTRL_WRTLOCK_ENABLED; /* unlock RCPC registers */
13762 + rcpc->periphClkCtrl &= ~RCPC_CLKCTRL_CT0_DISABLE;
13763 + rcpc->control &= ~RCPC_CTRL_WRTLOCK_ENABLED; /* lock RCPC registers */
13765 + /* setup the FRC in the first timer in the first module. */
13766 + mod1Timer->Timer1Load = timerLoad;
13768 + mod1Timer->Timer1Control = TMRCTRL_ENABLE |
13769 + TMRCTRL_MODE_PERIODIC |
13770 + TMRCTRL_PRESCALE16;
13774 + timer_irq.handler = timer_interrupt;
13775 + timer_irq.flags = SA_INTERRUPT;
13776 + setup_arm_irq( IRQ_TIMER0, &timer_irq);
13780 diff -urN linux-2.4.26/include/asm-arm/arch-lh79520/timex.h linux-2.4.26-vrs1-lnode80/include/asm-arm/arch-lh79520/timex.h
13781 --- linux-2.4.26/include/asm-arm/arch-lh79520/timex.h 1969-12-31 20:00:00.000000000 -0400
13782 +++ linux-2.4.26-vrs1-lnode80/include/asm-arm/arch-lh79520/timex.h 2005-11-02 17:37:32.000000000 -0400
13785 + * linux/include/asm-arm/arch-lh79520/timex.h
13787 + * Copyright (C) 2002 Lineo, Inc.
13789 + * This program is free software; you can redistribute it and/or modify
13790 + * it under the terms of the GNU General Public License version 2 as
13791 + * published by the Free Software Foundation.
13796 + * On the LH79520, the DDD
13798 +#define CLOCK_TICK_RATE (PLL_CLOCK / 6 / 16)
13800 diff -urN linux-2.4.26/include/asm-arm/arch-lh79520/uncompress.h linux-2.4.26-vrs1-lnode80/include/asm-arm/arch-lh79520/uncompress.h
13801 --- linux-2.4.26/include/asm-arm/arch-lh79520/uncompress.h 1969-12-31 20:00:00.000000000 -0400
13802 +++ linux-2.4.26-vrs1-lnode80/include/asm-arm/arch-lh79520/uncompress.h 2005-11-02 17:37:32.000000000 -0400
13805 + * linux/include/asm-arm/arch-lh79520/uncompress.h
13807 + * Copyright (C) 2002 Lineo, Inc.
13809 + * This program is free software; you can redistribute it and/or modify
13810 + * it under the terms of the GNU General Public License as published by
13811 + * the Free Software Foundation; either version 2 of the License, or
13812 + * (at your option) any later version.
13814 + * This program is distributed in the hope that it will be useful,
13815 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
13816 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13817 + * GNU General Public License for more details.
13819 + * You should have received a copy of the GNU General Public License
13820 + * along with this program; if not, write to the Free Software
13821 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
13824 +#define UART_DR (*(volatile unsigned char *)0xfffc1000)
13825 +#define UART_FR (*(volatile unsigned short *)0xfffc1018)
13827 +#define UARTFR_TXFE 0x80
13830 + * This does not append a newline
13833 +puts( const char *s)
13836 + while( (UART_FR & UARTFR_TXFE) == 0) /* wait for room in the tx FIFO */
13839 + UART_DR = *s; /* ship a char */
13841 + if (*s == '\n') { /* it's a new line */
13842 + while( (UART_FR & UARTFR_TXFE) == 0) /* wait for room in the tx FIFO */
13845 + UART_DR = '\r'; /* ship a carriage return */
13854 +#define arch_decomp_setup()
13855 +#define arch_decomp_wdog()
13856 diff -urN linux-2.4.26/include/asm-arm/arch-lh79520/vmalloc.h linux-2.4.26-vrs1-lnode80/include/asm-arm/arch-lh79520/vmalloc.h
13857 --- linux-2.4.26/include/asm-arm/arch-lh79520/vmalloc.h 1969-12-31 20:00:00.000000000 -0400
13858 +++ linux-2.4.26-vrs1-lnode80/include/asm-arm/arch-lh79520/vmalloc.h 2005-11-02 17:37:32.000000000 -0400
13861 + * linux/include/asm-arm/arch-lh79520/vmalloc.h
13863 + * Copyright (C) 2002 Lineo, Inc.
13865 + * This program is free software; you can redistribute it and/or modify
13866 + * it under the terms of the GNU General Public License as published by
13867 + * the Free Software Foundation; either version 2 of the License, or
13868 + * (at your option) any later version.
13870 + * This program is distributed in the hope that it will be useful,
13871 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
13872 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13873 + * GNU General Public License for more details.
13875 + * You should have received a copy of the GNU General Public License
13876 + * along with this program; if not, write to the Free Software
13877 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
13881 + * Just any arbitrary offset to the start of the vmalloc VM area: the
13882 + * current 8MB value just means that there will be a 8MB "hole" after the
13883 + * physical memory until the kernel virtual memory starts. That means that
13884 + * any out-of-bounds memory accesses will hopefully be caught.
13885 + * The vmalloc() routines leaves a hole of 4kB between each vmalloced
13886 + * area for the same reason. ;)
13888 +#define VMALLOC_OFFSET (8*1024*1024)
13889 +#define VMALLOC_START (((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1))
13890 +#define VMALLOC_VMADDR(x) ((unsigned long)(x))
13891 +#define VMALLOC_END (PAGE_OFFSET + 0x10000000)
13892 diff -urN linux-2.4.26/include/asm-arm/hardware/cradle.h linux-2.4.26-vrs1-lnode80/include/asm-arm/hardware/cradle.h
13893 --- linux-2.4.26/include/asm-arm/hardware/cradle.h 1969-12-31 20:00:00.000000000 -0400
13894 +++ linux-2.4.26-vrs1-lnode80/include/asm-arm/hardware/cradle.h 2005-11-02 17:37:32.000000000 -0400
13899 +#ifndef _INCLUDE_CRADLE_H_
13900 +#define _INCLUDE_CRADLE_H_
13902 +#define CRADLE_MAJOR 254
13904 +#define CRADLE_GET_DOCKING_STATE_IOCTL 0
13906 +#define CRADLE_DOCKED_STATE 0
13907 +#define CRADLE_UNDOCKED_STATE 1
13910 diff -urN linux-2.4.26/include/asm-arm/hardware/lcd_contrast.h linux-2.4.26-vrs1-lnode80/include/asm-arm/hardware/lcd_contrast.h
13911 --- linux-2.4.26/include/asm-arm/hardware/lcd_contrast.h 1969-12-31 20:00:00.000000000 -0400
13912 +++ linux-2.4.26-vrs1-lnode80/include/asm-arm/hardware/lcd_contrast.h 2005-11-02 17:37:32.000000000 -0400
13918 +These values are intended to be passed to the
13919 +pl110fb lcd driver. The driver was modified to control
13920 +a Maxim contrast controller to make life easy.
13925 +#ifndef _LCD_CONTRAST_
13926 +#define _LCD_CONTRAST_
13930 +#define LCD_CONTRAST_RESET 0
13931 +#define LCD_CONTRAST_INC 1
13932 +#define LCD_CONTRAST_DEC 2
13934 +#define LCD_CONTRAST_PRESET 3
13935 +// above takes parameters (0 - 63)
13941 +#endif //__LCD_CONTRAST__
13944 diff -urN linux-2.4.26/include/asm-arm/hardware/serial_amba_pl011.h linux-2.4.26-vrs1-lnode80/include/asm-arm/hardware/serial_amba_pl011.h
13945 --- linux-2.4.26/include/asm-arm/hardware/serial_amba_pl011.h 1969-12-31 20:00:00.000000000 -0400
13946 +++ linux-2.4.26-vrs1-lnode80/include/asm-arm/hardware/serial_amba_pl011.h 2005-11-02 17:37:32.000000000 -0400
13949 + * linux/include/asm-arm/hardware/serial_amba_pl011.h
13951 + * Internal header file for AMBA PrimeCell PL011 serial ports
13953 + * Copyright (C) 2002 Lineo, Inc.
13955 + * Based on serial_amba.h, which is:
13956 + * Copyright (C) ARM Limited
13957 + * Copyright (C) 2000 Deep Blue Solutions Ltd.
13959 + * This program is free software; you can redistribute it and/or modify
13960 + * it under the terms of the GNU General Public License as published by
13961 + * the Free Software Foundation; either version 2 of the License, or
13962 + * (at your option) any later version.
13964 + * This program is distributed in the hope that it will be useful,
13965 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
13966 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13967 + * GNU General Public License for more details.
13969 + * You should have received a copy of the GNU General Public License
13970 + * along with this program; if not, write to the Free Software
13971 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
13973 +#ifndef ASM_ARM_HARDWARE_SERIAL_AMBA_PL011_H
13974 +#define ASM_ARM_HARDWARE_SERIAL_AMBA_PL011_H
13976 +/* -------------------------------------------------------------------------------
13977 + * From AMBA UART (PL011) TRM
13978 + * -------------------------------------------------------------------------------
13979 + * UART Register Offsets.
13981 +#define AMBA_UARTDR 0x00 /* Data read or written from the interface. */
13982 +#define AMBA_UARTRSR 0x04 /* Receive status register (Read). */
13983 +#define AMBA_UARTECR 0x04 /* Error clear register (Write). */
13986 +#define AMBA_UARTFR 0x18 /* Flag register (Read only). */
13987 +#define AMBA_UARTILPR 0x20 /* IrDA low power counter register. */
13988 +#define AMBA_UARTIBRD 0x24 /* Integer baud rate divisor. */
13989 +#define AMBA_UARTFBRD 0x28 /* Fractional baud rate divisor. */
13990 +#define AMBA_UARTLCR_H 0x2C /* Line control register, high byte. */
13991 +#define AMBA_UARTCR 0x30 /* Control register. */
13992 +#define AMBA_UARTIFLS 0x34 /* Interrupt FIFO level select. */
13993 +#define AMBA_UARTIMSC 0x38 /* Interrupt Mask Set/Clear. */
13994 +#define AMBA_UARTRIS 0x3C /* Raw Interrupt status register (Read). */
13995 +#define AMBA_UARTMIS 0x40 /* Masked Interrupt status register (Read). */
13996 +#define AMBA_UARTICR 0x44 /* Interrupt clear register (Write). */
13998 +#define AMBA_UARTRSR_OE 0x0800 /* Overrun error */
13999 +#define AMBA_UARTRSR_BE 0x0400 /* Break error */
14000 +#define AMBA_UARTRSR_PE 0x0200 /* Parity error */
14001 +#define AMBA_UARTRSR_FE 0x0100 /* framing error */
14003 +#define AMBA_UARTFR_TXFF 0x20 /* Tx FIFO full */
14004 +#define AMBA_UARTFR_RXFE 0x10 /* Rx FIFO empty */
14005 +#define AMBA_UARTFR_BUSY 0x08 /* busy xmitting */
14006 +#define AMBA_UARTFR_DCD 0x04
14007 +#define AMBA_UARTFR_DSR 0x02
14008 +#define AMBA_UARTFR_CTS 0x01
14009 +#define AMBA_UARTFR_TMSK (AMBA_UARTFR_TXFF + AMBA_UARTFR_BUSY)
14011 +/* Interrupt Mask Set/Clear register bits */
14012 +#define AMBA_UARTIMSC_RTIM 0x40 /* Rx timeout interrupt mask */
14013 +#define AMBA_UARTIMSC_TXIM 0x20 /* Tx interrupt mask */
14014 +#define AMBA_UARTIMSC_RXIM 0x10 /* Rx interrupt mask */
14015 +#define AMBA_UARTIMSC_DSRMIM 0x08 /* DSR Modem Interrupt mask */
14016 +#define AMBA_UARTIMSC_DCDMIM 0x04 /* DCD Modem Interrupt mask */
14017 +#define AMBA_UARTIMSC_CTSMIM 0x02 /* CTS Modem Interrupt mask */
14018 +#define AMBA_UARTIMSC_RIMIM 0x01 /* RI Modem Interrupt mask */
14019 +/* all modem mask bits */
14020 +#define AMBA_UARTIMSC_Modem (AMBA_UARTIMSC_DSRMIM |AMBA_UARTIMSC_DCDMIM | \
14021 + AMBA_UARTIMSC_CTSMIM |AMBA_UARTIMSC_RIMIM)
14025 +/* Control Register bits */
14027 +#define AMBA_UARTCR_RTS 0x800 /* nRTS */
14028 +#define AMBA_UARTCR_DTR 0x400 /* nDTR */
14029 +#define AMBA_UARTCR_RXE 0x200 /* Rx enable */
14030 +#define AMBA_UARTCR_TXE 0x100 /* Tx enable */
14031 +#define AMBA_UARTCR_LBE 0x080 /* Loopback enable */
14032 +#define AMBA_UARTCR_SIRLP 0x004 /* IR SIR Low Power Mode */
14033 +#define AMBA_UARTCR_SIREN 0x002 /* IR SIR enable */
14034 +#define AMBA_UARTCR_UARTEN 0x001 /* UART enable */
14036 +#define AMBA_UARTLCR_H_WLEN_8 0x60
14037 +#define AMBA_UARTLCR_H_WLEN_7 0x40
14038 +#define AMBA_UARTLCR_H_WLEN_6 0x20
14039 +#define AMBA_UARTLCR_H_WLEN_5 0x00
14040 +#define AMBA_UARTLCR_H_FEN 0x10
14041 +#define AMBA_UARTLCR_H_STP2 0x08
14042 +#define AMBA_UARTLCR_H_EPS 0x04
14043 +#define AMBA_UARTLCR_H_PEN 0x02
14044 +#define AMBA_UARTLCR_H_BRK 0x01
14046 +/* Raw/Masked Interrupt Status Register bits*/
14047 +#define AMBA_UART_IS_RT 0x40
14048 +#define AMBA_UART_IS_TX 0x20
14049 +#define AMBA_UART_IS_RX 0x10
14050 +#define AMBA_UART_IS_DSR 0x08
14051 +#define AMBA_UART_IS_DCD 0x04
14052 +#define AMBA_UART_IS_CTS 0x02
14053 +#define AMBA_UART_IS_RI 0x01
14054 +#define AMBA_UART_IS_MI (AMBA_UART_IS_DSR | AMBA_UART_IS_DCD | \
14055 + AMBA_UART_IS_CTS | AMBA_UART_IS_RI )
14057 +#define AMBA_UARTRSR_ANY (AMBA_UARTRSR_OE|AMBA_UARTRSR_BE|AMBA_UARTRSR_PE|AMBA_UARTRSR_FE)
14058 +#define AMBA_UARTFR_MODEM_ANY (AMBA_UARTFR_DCD|AMBA_UARTFR_DSR|AMBA_UARTFR_CTS)
14060 +#endif /* ASM_ARM_HARDWARE_SERIAL_AMBA_PL011_H */
14062 diff -urN linux-2.4.26/include/lh79520.h linux-2.4.26-vrs1-lnode80/include/lh79520.h
14063 --- linux-2.4.26/include/lh79520.h 1969-12-31 20:00:00.000000000 -0400
14064 +++ linux-2.4.26-vrs1-lnode80/include/lh79520.h 2005-11-02 17:37:33.000000000 -0400
14067 + * lh79520.h: LH79520 specific defines
14069 + * Copyright (C) 2002 Lineo, Inc.
14071 + * This program is free software; you can redistribute it and/or modify
14072 + * it under the terms of the GNU General Public License as published by
14073 + * the Free Software Foundation; either version 2 of the License, or
14074 + * (at your option) any later version.
14076 + * This program is distributed in the hope that it will be useful,
14077 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
14078 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14079 + * GNU General Public License for more details.
14081 + * You should have received a copy of the GNU General Public License
14082 + * along with this program; if not, write to the Free Software
14083 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
14087 +#ifndef BLOB_ARCH_LH79520_H
14088 +#define BLOB_ARCH_LH79520_H
14091 +#define _BIT(n) (1 << (n))
14095 +#define _SBF(f,v) ((v) << (f))
14098 +/* the base address were BLOB is loaded by the first stage loader */
14099 +// #define BLOB_ABS_BASE_ADDR (0x60000000) // for gdb bootstrap in SRAM
14100 +#define BLOB_ABS_BASE_ADDR (0x20200400)
14103 +/* where do various parts live in RAM */
14104 +#define BLOB_RAM_BASE (0x20100000)
14105 +#define KERNEL_RAM_BASE (0x20008000)
14106 +#define PARAM_RAM_BASE (0x20110000)
14107 +#define RAMDISK_RAM_BASE (0x20400000)
14108 +#define RAMDISK_VIRTUAL_BASE (0xC0400000) // kernel virtual address of where ramdisk will be
14111 +/* and where do they live in flash */
14112 +#define BLOB_FLASH_BASE (0x00000000)
14113 +#define BLOB_FLASH_LEN (128 * 1024) // 128 KB for blob
14115 +#define PARAM_FLASH_BASE (BLOB_FLASH_BASE + BLOB_FLASH_LEN)
14116 +#define PARAM_FLASH_LEN (64 * 1024) // 64 KB for params
14118 +#define KERNEL_FLASH_BASE (PARAM_FLASH_BASE + PARAM_FLASH_LEN)
14119 +#define KERNEL_FLASH_LEN (1024 * 1024 - \
14120 + (BLOB_FLASH_LEN + PARAM_FLASH_LEN)) // 1 MB - (BLOB + PARAM) for kernel
14122 +#define RAMDISK_FLASH_BASE (KERNEL_FLASH_BASE + KERNEL_FLASH_LEN)
14123 +#define RAMDISK_FLASH_LEN (3 * 1024 * 1024) // 3 MB for ramdisk
14125 +#define PARAM_START PARAM_FLASH_BASE
14126 +#define PARAM_LEN PARAM_FLASH_LEN
14128 +/* the position of the kernel boot parameters */
14129 +#define BOOT_PARAMS (0x20000100)
14132 +/* the size (in kbytes) to which the compressed ramdisk expands */
14133 +#define RAMDISK_SIZE (8 * 1024)
14136 +/* Memory configuration */
14138 +/**********************************************************************
14140 + *********************************************************************/
14141 +#define AHB_PHYS (0xFFFF0000)
14142 +#define VIC_PHYS_MIRROR (AHB_PHYS + 0x0000)
14143 +#define SMC_REGS_BASE (AHB_PHYS + 0x1000)
14144 +#define SDRAM_REGS_BASE (AHB_PHYS + 0x2000)
14145 +#define LCD_BASE (AHB_PHYS + 0x4000)
14146 +#define VIC_PHYS (AHB_PHYS + 0xF000)
14148 +/**********************************************************************
14150 + *********************************************************************/
14151 +#define APB_PHYS (0xFFFC0000)
14152 +#define UART0_BASE (APB_PHYS + 0x00000)
14153 +#define UART1_BASE (APB_PHYS + 0x01000)
14154 +#define UART2_BASE (APB_PHYS + 0x02000)
14155 +#define PWM_BASE (APB_PHYS + 0x03000)
14156 +#define TIMER0_BASE (APB_PHYS + 0x04000)
14157 +#define TIMER1_BASE (APB_PHYS + 0x05000)
14158 +#define SSP_BASE (APB_PHYS + 0x06000)
14159 +#define GPIO3_BASE (APB_PHYS + 0x1C000)
14160 +#define GPIO2_BASE (APB_PHYS + 0x1D000)
14161 +#define GPIO1_BASE (APB_PHYS + 0x1E000)
14162 +#define GPIO0_BASE (APB_PHYS + 0x1F000)
14163 +#define RTC_BASE (APB_PHYS + 0x20000)
14164 +#define DMAC_BASE (APB_PHYS + 0x21000)
14165 +#define RCPC_BASE (APB_PHYS + 0x22000)
14166 +#define WDTIMER_BASE (APB_PHYS + 0x23000)
14167 +#define LCDICP_BASE (APB_PHYS + 0x24000)
14168 +#define IOCON_BASE (APB_PHYS + 0x25000)
14170 +#define SDRAM_MEM_BASE 0x20000000
14171 +#define SMC_MEM_BASE (0x40000000)
14172 +#define INTERNAL_MEM_BASE (0x60000000)
14175 +/**********************************************************************
14176 + * SMC Memory Bank Address Space Bases
14177 + *********************************************************************/
14179 +#define SMC_BANK0_BASE (SMC_MEM_BASE + 0x00000000)
14180 +#define SMC_BANK1_BASE (SMC_MEM_BASE + 0x04000000)
14181 +#define SMC_BANK2_BASE (SMC_MEM_BASE + 0x08000000)
14182 +#define SMC_BANK3_BASE (SMC_MEM_BASE + 0x0C000000)
14183 +#define SMC_BANK4_BASE (SMC_MEM_BASE + 0x10000000)
14184 +#define SMC_BANK5_BASE (SMC_MEM_BASE + 0x14000000)
14185 +#define SMC_BANK6_BASE (SMC_MEM_BASE + 0x18000000)
14186 +#define SMC_BANK7_BASE (SMC_MEM_BASE + 0x1C000000)
14189 +#define FLASH_PHYS_BASE 0x00000000
14190 +#define FLASH_PHYS_SIZE 0x00400000
14192 +/**********************************************************************
14193 + * SDRAMC Memory Bank Address Space Bases
14194 + *********************************************************************/
14196 +#define SDRAM_BANK0_BASE (SDRAM_MEM_BASE + 0x00000000)
14197 +#define SDRAM_BANK1_BASE (SDRAM_MEM_BASE + 0x08000000)
14200 +#define WDT_WDCTLR_OFFSET 0x0
14202 +// RCPC offsets for assembly files
14203 +#define RCPC_CONTROL_OFFSET 0x00
14204 +#define RCPC_REMAP_OFFSET 0x08
14205 +#define RCPC_SOFTRESET_OFFSET 0x0C
14206 +#define RCPC_RESETSTATUS_OFFSET 0x10
14207 +#define RCPC_RESETSTATUS_CLEAR_OFFSET 0x14
14208 +#define RCPC_HCLKCLK_PRESCALE_OFFSET 0x18
14209 +#define RCPC_CPUCLK_PRESCALE_OFFSET 0x1C
14210 +#define RCPC_PERIPHCLKCTRL_OFFSET 0x24
14211 +#define RCPC_AHBCLKCTRL_OFFSET 0x2C
14212 +#define RCPC_PERIPHCLKSELECT_OFFSET 0x30
14213 +#define RCPC_CORECLKCONFIG_OFFSET 0x88
14215 +#define RCPC_CPUCLK_PRESCALE_78 0x2
14216 +#define RCPC_CPUCLK_PRESCALE_52 0x3
14217 +#define RCPC_CPUCLK_PRESCALE_39 0x4
14218 +#define RCPC_HCLK_PRESCALE_52 0x3
14219 +#define RCPC_HCLK_PRESCALE_39 0x4
14220 +#define RCPC_CPUCLK_PRESCALE_DEFAULT RCPC_CPUCLK_PRESCALE_52
14221 +#define RCPC_HCLK_PRESCALE_DEFAULT RCPC_HCLK_PRESCALE_52
14222 +//#define RCPC_CPUCLK_PRESCALE_DEFAULT RCPC_CPUCLK_PRESCALE_78
14223 +//#define RCPC_HCLK_PRESCALE_DEFAULT RCPC_HCLK_PRESCALE_52
14225 +/* IOCON offsets for assembly code */
14226 +#define IOCON_MEMMUX_OFFSET 0x00
14227 +//#define IOCON_MEMMUX_INIT 0x00003fff
14228 +#define IOCON_MEMMUX_INIT 0x00000075
14229 +#define IOCON_LCDMUX_OFFSET 0x04
14230 +#define IOCON_LCDMUX_INIT 0x1f3db95d
14231 +#define IOCON_MISCMUX_OFFSET 0x08
14232 +#define IOCON_MISCMUX_INIT 0x0000005e
14233 +#define IOCON_DMAMUX_OFFSET 0x0C
14234 +#define IOCON_DMAMUX_INIT 0x00000000
14235 +#define IOCON_UARTMUX_OFFSET 0x10
14236 +#define IOCON_UARTMUX_INIT 0x0000000f
14237 +#define IOCON_SSPMUX_OFFSET 0x14
14238 +#define IOCON_SSPMUX_INIT 0x0000001c
14241 +/* GPIO Configuration */
14242 +#define GPIOB_DATA_OFFSET 0x000
14243 +#define GPIOB_DATA_INIT 0x00000000
14244 +#define GPIOB_DDR_OFFSET 0x008
14245 +#define GPIOB_DDR_INIT 0x00000000
14246 +#define GPIOF_DATA_OFFSET 0x000
14247 +#define GPIOF_DATA_INIT 0x000000DA
14248 +#define GPIOF_DDR_OFFSET 0x008
14249 +#define GPIOF_DDR_INIT 0x000000FA
14250 +#define GPIOG_DATA_OFFSET 0x000
14251 +#define GPIOG_DATA_INIT 0x000000E0
14252 +#define GPIOG_DDR_OFFSET 0x008
14253 +#define GPIOG_DDR_INIT 0x000000E0
14254 +#define GPIOH_DATA_OFFSET 0x004
14255 +#define GPIOH_DATA_INIT 0x00000043
14256 +#define GPIOH_DDR_OFFSET 0x00C
14257 +#define GPIOH_DDR_INIT 0x00000043
14260 +#define GPIOB_DATA_OFFSET 0x004
14261 +#define GPIOB_DATA_INIT 0x00000000
14262 +#define GPIOB_DDR_OFFSET 0x00c
14263 +#define GPIOB_DDR_INIT 0x00000000
14264 +#define GPIOF_DATA_OFFSET 0x004
14265 +#define GPIOF_DATA_INIT 0x00000008
14266 +#define GPIOF_DDR_OFFSET 0x00C
14267 +#define GPIOF_DDR_INIT 0x00000038
14268 +#define GPIOG_DATA_OFFSET 0x000
14269 +#define GPIOG_DATA_INIT 0x000000E0
14270 +#define GPIOG_DDR_OFFSET 0x008
14271 +#define GPIOG_DDR_INIT 0x000000E0
14272 +#define GPIOH_DATA_OFFSET 0x004
14273 +#define GPIOH_DATA_INIT 0x00000043
14274 +#define GPIOH_DDR_OFFSET 0x00C
14275 +#define GPIOH_DDR_INIT 0x00000043
14280 +/* SDRAM controller offsets */
14281 +#define SDRAM_CFG0_OFF 0
14282 +#define SDRAM_CFG1_OFF 4
14283 +#define SDRAM_REFTIMER_OFF 8
14285 +#define SDRAM_INIT_NORMAL 0
14286 +#define SDRAM_INIT_PALL 1
14287 +#define SDRAM_INIT_MODE 2
14288 +#define SDRAM_INIT_NOP 3
14289 +#define SDRAM_BUSY 0x20 /* SDRAM Engine Status */
14294 + * Caution: these indexes have to be coherent with the equivalent indexes
14295 + * included with associated 'C' modules
14298 +#define RCPC_CLKIDX_DEFAULT 0
14299 +#define RCPC_CLKIDX_39_39 1
14300 +#define RCPC_CLKIDX_52_39 2
14301 +#define RCPC_CLKIDX_52_52 3
14302 +#define RCPC_CLKIDX_78_39 4
14303 +#define RCPC_CLKIDX_78_52 5
14304 +#define RCPC_CLKIDX_78_78 6
14305 +#define RCPC_CLKIDX_10_10 7
14308 + * SDRAM Refresh timer values for various Clock Indexes
14310 +#define REFTIMER_78 0x480
14311 +#define REFTIMER_52 0x320
14312 +#define REFTIMER_39 0x270
14313 +#define REFTIMER_10 0x80
14316 +/**********************************************************************
14317 + * Static Memory Controller (SMC)
14318 + *********************************************************************/
14319 +#define SMC ((SMCREGS *)(SMC_REGS_BASE))
14321 +/**********************************************************************
14322 + * SDRAM Controller (SDRAM)
14323 + *********************************************************************/
14324 +#define SDRAM ((SDRAMREGS *)(SDRAM_REGS_BASE))
14326 +/**********************************************************************
14327 + * Color LCD Controller (CLCDC)
14328 + *********************************************************************/
14329 +#define CLCDC ((CLCDCREGS *)(LCD_BASE))
14331 +/**********************************************************************
14333 + *********************************************************************/
14334 +#define UARTID_OFFSET (0xFE0)
14335 +#define UART0 ((UART *)(UART0_BASE))
14336 +#define UART1 ((UART *)(UART1_BASE))
14337 +#define UART2 ((UART *)(UART2_BASE))
14338 +#define UART0ID ((UARTID *)(UART0_BASE + UARTID_OFFSET))
14339 +#define UART1ID ((UARTID *)(UART1_BASE + UARTID_OFFSET))
14340 +#define UART2ID ((UARTID *)(UART2_BASE + UARTID_OFFSET))
14342 +/* use this serial port */
14343 +#define UART ((UARTREGS *)(UART0_BASE))
14344 +#define LH_UART_NUM 0
14347 +/**********************************************************************
14349 + *********************************************************************/
14350 +#define TIMER2_OFFSET (0x20)
14351 +#define TIMER0 ((TIMERREG *)(TIMER0_BASE))
14352 +#define TIMER1 ((volatile TIMERREG *)(TIMER0_BASE + TIMER2_OFFSET))
14353 +#define TIMER2 ((TIMERREG *)(TIMER1_BASE))
14354 +#define TIMER3 ((TIMERREG *)(TIMER1_BASE + TIMER2_OFFSET))
14357 + * base addresses of each dual timer module
14359 +#define MOD1_TIMER ((TIMERREGS *) TIMER0_BASE)
14360 +#define MOD2_TIMER ((TIMERREGS *) TIMER1_BASE)
14363 +#define RCPC ((RCPCREGS *)(RCPC_BASE))
14364 +#define LCDICP ((LCDICPREGS *)(LCDICP_BASE))
14365 +#define IOCON ((IOCONREGS *)(IOCON_BASE))
14366 +#define CPLD_PHYS_BASE SMC_BANK2_BASE
14367 +#define CPLD ((CPLDREGS *)(CPLD_PHYS_BASE))
14369 +#define _7seg(val) \
14371 + CPLDREGS *cpld = CPLD; \
14372 + cpld->seven_seg = (val); \
14376 + * CPU board DIP switches
14378 +#define DIPSW1 0x01
14379 +#define DIPSW2 0x02
14380 +#define DIPSW3 0x04
14381 +#define DIPSW4 0x08
14382 +#define DIPSW5 0x10
14383 +#define DIPSW6 0x20
14384 +#define DIPSW7 0x40
14385 +#define DIPSW8 0x80
14388 + * CPU and BUS speeds, also tied to SDRAM speed
14389 + * NOTE: Don't change one without changing the others!!!!
14392 +#if 0 // run the CPU at 52 MHz, and the bus at 52 MHz
14393 + #define CPU_CLK_PRESCALAR RCPC_CPUCLK_PRESCALE_52
14394 + #define SDRAM_REFTIMER REFTIMER_52
14395 + #define HCLK_PRESCALAR RCPC_HCLK_PRESCALE_52
14396 + #define CORE_CLK_CONFIG 3 /* FastBus */
14397 +#else // run the CPU at 78 MHz, and the Bus at 52 MHz
14398 + #define CPU_CLK_PRESCALAR RCPC_CPUCLK_PRESCALE_78
14399 + #define SDRAM_REFTIMER 0x320 /*REFTIMER_78*/
14400 + #define HCLK_PRESCALAR RCPC_HCLK_PRESCALE_52
14401 + #define CORE_CLK_CONFIG 0 /* std mode, async */
14405 +#endif // BLOB_ARCH_LH79520_H
14406 diff -urN linux-2.4.26/include/linux/serial_core.h linux-2.4.26-vrs1-lnode80/include/linux/serial_core.h
14407 --- linux-2.4.26/include/linux/serial_core.h 2005-11-02 16:54:26.000000000 -0400
14408 +++ linux-2.4.26-vrs1-lnode80/include/linux/serial_core.h 2005-11-02 17:46:47.000000000 -0400
14410 #define PORT_SA1100 34
14411 #define PORT_UART00 35
14412 #define PORT_21285 37
14413 +#define PORT_AMBA_PL011 38
14414 +#define PORT_LH7A400 39
14416 /* Sparc type numbers. */
14417 #define PORT_SUNZILOG 38
14418 diff -urN linux-2.4.26/include/linux/verbosedebug.h linux-2.4.26-vrs1-lnode80/include/linux/verbosedebug.h
14419 --- linux-2.4.26/include/linux/verbosedebug.h 1969-12-31 20:00:00.000000000 -0400
14420 +++ linux-2.4.26-vrs1-lnode80/include/linux/verbosedebug.h 2005-11-02 17:37:33.000000000 -0400
14422 +/* vi: set sw=4 ts=4 ai: */
14424 +/**********************************************************************
14425 +* linux/include/linux/verbosedebug.h
14427 +* Provide Verbose, Debug, and Verbose+Debug printk macros that can be
14428 +* enabled or disabled vi the definitions of DEBUG and VERBOSE.
14430 +* vprintk -- Verbose printk
14431 +* dprintk -- Debug printk
14432 +* vdprintk -- Verbose+Debug printk
14434 +* Copyright (C) 2002 Lineo, Inc.
14436 +* This program is free software; you can redistribute it and/or modify
14437 +* it under the terms of the GNU General Public License (GPL) version 2
14438 +* as published by the Free Software Foundation.
14440 +**********************************************************************/
14442 +#ifndef _VerboseDebug_h
14443 +#define _VerboseDebug_h
14446 +# define DRVNAME ""
14451 +# define vprintk(fmt,args...) {printk(DRVNAME ": " fmt, ## args);}
14452 +# define dprintk(fmt,args...) {printk(DRVNAME ": " fmt, ## args);}
14453 +# define vdprintk(fmt,args...) {printk(DRVNAME ": " fmt, ## args);}
14455 +# define vprintk(fmt,args...) {printk(DRVNAME ": " fmt, ## args);}
14456 +# define dprintk(fmt,args...) {}
14457 +# define vdprintk(fmt,args...) {}
14461 +# define vprintk(fmt,args...) {}
14462 +# define dprintk(fmt,args...) {printk(DRVNAME ": " fmt, ## args);}
14463 +# define vdprintk(fmt,args...) {}
14465 +# define vprintk(fmt,args...) {}
14466 +# define dprintk(fmt,args...) {}
14467 +# define vdprintk(fmt,args...) {}
14471 +#endif /* _VerboseDebug_h */
14473 diff -urN linux-2.4.26/Makefile linux-2.4.26-vrs1-lnode80/Makefile
14474 --- linux-2.4.26/Makefile 2005-11-02 16:54:16.000000000 -0400
14475 +++ linux-2.4.26-vrs1-lnode80/Makefile 2005-11-03 10:28:43.000000000 -0400
14480 -EXTRAVERSION =-vrs1
14481 +EXTRAVERSION =-vrs1-lnode80
14483 KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
14485 -ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/)
14487 KERNELPATH=kernel-$(shell echo $(KERNELRELEASE) | sed -e "s/-//g")
14489 CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
14492 HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
14495 +CROSS_COMPILE = arm-linux-
14498 # Include the make variables (CC, etc...)